[STATEMENT]
lemma has_integral_component_le:
  fixes f g :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes k: "k \<in> Basis"
  assumes "(f has_integral i) S" "(g has_integral j) S"
    and f_le_g: "\<And>x. x \<in> S \<Longrightarrow> (f x)\<bullet>k \<le> (g 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 ik_le_jk: "i\<bullet>k \<le> j\<bullet>k"
    if f_i: "(f has_integral i) (cbox a b)"
    and g_j: "(g has_integral j) (cbox a b)"
    and le: "\<forall>x\<in>cbox a b. (f x)\<bullet>k \<le> (g x)\<bullet>k"
    for a b i and j :: 'b and f g :: "'a \<Rightarrow> 'b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
assume "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> i \<bullet> k \<le> j \<bullet> k

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
have *: "0 < (i\<bullet>k - j\<bullet>k) / 3"
[PROOF STATE]
proof (prove)
using this:
\<not> i \<bullet> k \<le> j \<bullet> k

goal (1 subgoal):
 1. 0 < (i \<bullet> k - j \<bullet> k) / 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
obtain \<gamma>1 where "gauge \<gamma>1"
      and \<gamma>1: "\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>1 fine p\<rbrakk>
                \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) < (i \<bullet> k - j \<bullet> k) / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<gamma>1. \<lbrakk>gauge \<gamma>1; \<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>1 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using f_i[unfolded has_integral,rule_format,OF *]
[PROOF STATE]
proof (prove)
using this:
\<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R f x) - i) < (i \<bullet> k - j \<bullet> k) / 3)

goal (1 subgoal):
 1. (\<And>\<gamma>1. \<lbrakk>gauge \<gamma>1; \<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>1 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
gauge \<gamma>1
\<lbrakk>?p tagged_division_of cbox a b; \<gamma>1 fine ?p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k)\<in>?p. content k *\<^sub>R f x) - i) < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
obtain \<gamma>2 where "gauge \<gamma>2"
      and \<gamma>2: "\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>2 fine p\<rbrakk>
                \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) < (i \<bullet> k - j \<bullet> k) / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<gamma>2. \<lbrakk>gauge \<gamma>2; \<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>2 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using g_j[unfolded has_integral,rule_format,OF *]
[PROOF STATE]
proof (prove)
using this:
\<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R g x) - j) < (i \<bullet> k - j \<bullet> k) / 3)

goal (1 subgoal):
 1. (\<And>\<gamma>2. \<lbrakk>gauge \<gamma>2; \<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>2 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
gauge \<gamma>2
\<lbrakk>?p tagged_division_of cbox a b; \<gamma>2 fine ?p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k)\<in>?p. content k *\<^sub>R g x) - j) < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
obtain p where p: "p tagged_division_of cbox a b" and "\<gamma>1 fine p" "\<gamma>2 fine p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>1 fine p; \<gamma>2 fine p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using fine_division_exists[OF gauge_Int[OF \<open>gauge \<gamma>1\<close> \<open>gauge \<gamma>2\<close>], of a b]
[PROOF STATE]
proof (prove)
using this:
(\<And>p. \<lbrakk>p tagged_division_of cbox a b; (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x) fine p\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>1 fine p; \<gamma>2 fine p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding fine_Int
[PROOF STATE]
proof (prove)
using this:
(\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>1 fine p \<and> \<gamma>2 fine p\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>1 fine p; \<gamma>2 fine p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
p tagged_division_of cbox a b
\<gamma>1 fine p
\<gamma>2 fine p

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p tagged_division_of cbox a b
\<gamma>1 fine p
\<gamma>2 fine p
[PROOF STEP]
have "\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
         "\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
[PROOF STATE]
proof (prove)
using this:
p tagged_division_of cbox a b
\<gamma>1 fine p
\<gamma>2 fine p

goal (1 subgoal):
 1. \<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3 &&& \<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
[PROOF STEP]
using le_less_trans[OF Basis_le_norm[OF k]] k \<gamma>1 \<gamma>2
[PROOF STATE]
proof (prove)
using this:
p tagged_division_of cbox a b
\<gamma>1 fine p
\<gamma>2 fine p
norm ?x1 < ?z \<Longrightarrow> \<bar>?x1 \<bullet> k\<bar> < ?z
k \<in> Basis
\<lbrakk>?p tagged_division_of cbox a b; \<gamma>1 fine ?p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k)\<in>?p. content k *\<^sub>R f x) - i) < (i \<bullet> k - j \<bullet> k) / 3
\<lbrakk>?p tagged_division_of cbox a b; \<gamma>2 fine ?p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k)\<in>?p. content k *\<^sub>R g x) - j) < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3 &&& \<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
[PROOF STEP]
by metis+
[PROOF STATE]
proof (state)
this:
\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding inner_simps
[PROOF STATE]
proof (prove)
using this:
\<bar>(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<bullet> k - i \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>(\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) \<bullet> k - j \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. False
[PROOF STEP]
using rsum_component_le[OF p] le
[PROOF STATE]
proof (prove)
using this:
\<bar>(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<bullet> k - i \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>(\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) \<bullet> k - j \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
(\<And>x. x \<in> cbox a b \<Longrightarrow> ?f x \<bullet> ?i \<le> ?g x \<bullet> ?i) \<Longrightarrow> (\<Sum>(x, K)\<in>p. content K *\<^sub>R ?f x) \<bullet> ?i \<le> (\<Sum>(x, K)\<in>p. content K *\<^sub>R ?g x) \<bullet> ?i
\<forall>x\<in>cbox a b. f x \<bullet> k \<le> g x \<bullet> k

goal (1 subgoal):
 1. False
[PROOF STEP]
by (fastforce simp add: abs_real_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?f has_integral ?i) (cbox ?a ?b); (?g has_integral ?j) (cbox ?a ?b); \<forall>x\<in>cbox ?a ?b. ?f x \<bullet> k \<le> ?g x \<bullet> k\<rbrakk> \<Longrightarrow> ?i \<bullet> k \<le> ?j \<bullet> k

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]
proof (cases "\<exists>a b. S = cbox a b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>a b. S = cbox a b \<Longrightarrow> i \<bullet> k \<le> j \<bullet> k
 2. \<nexists>a b. S = cbox a b \<Longrightarrow> i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>a b. S = cbox a b

goal (2 subgoals):
 1. \<exists>a b. S = cbox a b \<Longrightarrow> i \<bullet> k \<le> j \<bullet> k
 2. \<nexists>a b. S = cbox a b \<Longrightarrow> i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
with ik_le_jk assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>(?f has_integral ?i) (cbox ?a ?b); (?g has_integral ?j) (cbox ?a ?b); \<forall>x\<in>cbox ?a ?b. ?f x \<bullet> k \<le> ?g x \<bullet> k\<rbrakk> \<Longrightarrow> ?i \<bullet> k \<le> ?j \<bullet> k
k \<in> Basis
(f has_integral i) S
(g has_integral j) S
?x \<in> S \<Longrightarrow> f ?x \<bullet> k \<le> g ?x \<bullet> k
\<exists>a b. S = cbox a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f has_integral ?i) (cbox ?a ?b); (?g has_integral ?j) (cbox ?a ?b); \<forall>x\<in>cbox ?a ?b. ?f x \<bullet> k \<le> ?g x \<bullet> k\<rbrakk> \<Longrightarrow> ?i \<bullet> k \<le> ?j \<bullet> k
k \<in> Basis
(f has_integral i) S
(g has_integral j) S
?x \<in> S \<Longrightarrow> f ?x \<bullet> k \<le> g ?x \<bullet> k
\<exists>a b. S = cbox a b

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

goal (1 subgoal):
 1. \<nexists>a b. S = cbox a b \<Longrightarrow> i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>a b. S = cbox a b \<Longrightarrow> i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<nexists>a b. S = cbox a b

goal (1 subgoal):
 1. \<nexists>a b. S = cbox a b \<Longrightarrow> 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]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
assume "\<not> i\<bullet>k \<le> j\<bullet>k"
[PROOF STATE]
proof (state)
this:
\<not> i \<bullet> k \<le> j \<bullet> k

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
have ij: "(i\<bullet>k - j\<bullet>k) / 3 > 0"
[PROOF STATE]
proof (prove)
using this:
\<not> i \<bullet> k \<le> j \<bullet> k

goal (1 subgoal):
 1. 0 < (i \<bullet> k - j \<bullet> k) / 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
obtain B1 where "0 < B1"
           and B1: "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow>
                    \<exists>z. ((\<lambda>x. if x \<in> S then f x else 0) has_integral z) (cbox a b) \<and>
                        norm (z - i) < (i \<bullet> k - j \<bullet> k) / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B1. \<lbrakk>0 < B1; \<And>a b. ball (0::'a) B1 \<subseteq> cbox a b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> S then f x else (0::'b)) has_integral z) (cbox a b) \<and> norm (z - i) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using has_integral_altD[OF _ False ij] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f has_integral ?y) S; \<And>B. \<lbrakk>0 < B; \<forall>a b. ball (0::'a) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> S then ?f x else (0::?'b)) has_integral z) (cbox a b) \<and> norm (z - ?y) < (i \<bullet> k - j \<bullet> k) / 3)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
k \<in> Basis
(f has_integral i) S
(g has_integral j) S
?x \<in> S \<Longrightarrow> f ?x \<bullet> k \<le> g ?x \<bullet> k

goal (1 subgoal):
 1. (\<And>B1. \<lbrakk>0 < B1; \<And>a b. ball (0::'a) B1 \<subseteq> cbox a b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> S then f x else (0::'b)) has_integral z) (cbox a b) \<and> norm (z - i) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < B1
ball (0::'a) B1 \<subseteq> cbox ?a ?b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> S then f x else (0::'b)) has_integral z) (cbox ?a ?b) \<and> norm (z - i) < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
obtain B2 where "0 < B2"
           and B2: "\<And>a b. ball 0 B2 \<subseteq> cbox a b \<Longrightarrow>
                    \<exists>z. ((\<lambda>x. if x \<in> S then g x else 0) has_integral z) (cbox a b) \<and>
                        norm (z - j) < (i \<bullet> k - j \<bullet> k) / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B2. \<lbrakk>0 < B2; \<And>a b. ball (0::'a) B2 \<subseteq> cbox a b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> S then g x else (0::'b)) has_integral z) (cbox a b) \<and> norm (z - j) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using has_integral_altD[OF _ False ij] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f has_integral ?y) S; \<And>B. \<lbrakk>0 < B; \<forall>a b. ball (0::'a) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> S then ?f x else (0::?'b)) has_integral z) (cbox a b) \<and> norm (z - ?y) < (i \<bullet> k - j \<bullet> k) / 3)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
k \<in> Basis
(f has_integral i) S
(g has_integral j) S
?x \<in> S \<Longrightarrow> f ?x \<bullet> k \<le> g ?x \<bullet> k

goal (1 subgoal):
 1. (\<And>B2. \<lbrakk>0 < B2; \<And>a b. ball (0::'a) B2 \<subseteq> cbox a b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> S then g x else (0::'b)) has_integral z) (cbox a b) \<and> norm (z - j) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < B2
ball (0::'a) B2 \<subseteq> cbox ?a ?b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> S then g x else (0::'b)) has_integral z) (cbox ?a ?b) \<and> norm (z - j) < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
have "bounded (ball 0 B1 \<union> ball (0::'a) B2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (ball (0::'a) B1 \<union> ball (0::'a) B2)
[PROOF STEP]
unfolding bounded_Un
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (ball (0::'a) B1) \<and> bounded (ball (0::'a) B2)
[PROOF STEP]
by(rule conjI bounded_ball)+
[PROOF STATE]
proof (state)
this:
bounded (ball (0::'a) B1 \<union> ball (0::'a) B2)

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
from bounded_subset_cbox_symmetric[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>a. ball (0::'a) B1 \<union> ball (0::'a) B2 \<subseteq> cbox (- a) a \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain a b::'a where ab: "ball 0 B1 \<subseteq> cbox a b" "ball 0 B2 \<subseteq> cbox a b"
[PROOF STATE]
proof (prove)
using this:
(\<And>a. ball (0::'a) B1 \<union> ball (0::'a) B2 \<subseteq> cbox (- a) a \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>ball (0::'a) B1 \<subseteq> cbox a b; ball (0::'a) B2 \<subseteq> cbox a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson Un_subset_iff)
[PROOF STATE]
proof (state)
this:
ball (0::'a) B1 \<subseteq> cbox a b
ball (0::'a) B2 \<subseteq> cbox a b

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ball (0::'a) B1 \<subseteq> cbox a b
ball (0::'a) B2 \<subseteq> cbox a b
[PROOF STEP]
obtain w1 w2 where int_w1: "((\<lambda>x. if x \<in> S then f x else 0) has_integral w1) (cbox a b)"
                        and norm_w1:  "norm (w1 - i) < (i \<bullet> k - j \<bullet> k) / 3"
                        and int_w2: "((\<lambda>x. if x \<in> S then g x else 0) has_integral w2) (cbox a b)"
                        and norm_w2: "norm (w2 - j) < (i \<bullet> k - j \<bullet> k) / 3"
[PROOF STATE]
proof (prove)
using this:
ball (0::'a) B1 \<subseteq> cbox a b
ball (0::'a) B2 \<subseteq> cbox a b

goal (1 subgoal):
 1. (\<And>w1 w2. \<lbrakk>((\<lambda>x. if x \<in> S then f x else (0::'b)) has_integral w1) (cbox a b); norm (w1 - i) < (i \<bullet> k - j \<bullet> k) / 3; ((\<lambda>x. if x \<in> S then g x else (0::'b)) has_integral w2) (cbox a b); norm (w2 - j) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using B1 B2
[PROOF STATE]
proof (prove)
using this:
ball (0::'a) B1 \<subseteq> cbox a b
ball (0::'a) B2 \<subseteq> cbox a b
ball (0::'a) B1 \<subseteq> cbox ?a ?b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> S then f x else (0::'b)) has_integral z) (cbox ?a ?b) \<and> norm (z - i) < (i \<bullet> k - j \<bullet> k) / 3
ball (0::'a) B2 \<subseteq> cbox ?a ?b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> S then g x else (0::'b)) has_integral z) (cbox ?a ?b) \<and> norm (z - j) < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. (\<And>w1 w2. \<lbrakk>((\<lambda>x. if x \<in> S then f x else (0::'b)) has_integral w1) (cbox a b); norm (w1 - i) < (i \<bullet> k - j \<bullet> k) / 3; ((\<lambda>x. if x \<in> S then g x else (0::'b)) has_integral w2) (cbox a b); norm (w2 - j) < (i \<bullet> k - j \<bullet> k) / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if x \<in> S then f x else (0::'b)) has_integral w1) (cbox a b)
norm (w1 - i) < (i \<bullet> k - j \<bullet> k) / 3
((\<lambda>x. if x \<in> S then g x else (0::'b)) has_integral w2) (cbox a b)
norm (w2 - j) < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
have *: "\<And>w1 w2 j i::real .\<bar>w1 - i\<bar> < (i - j) / 3 \<Longrightarrow> \<bar>w2 - j\<bar> < (i - j) / 3 \<Longrightarrow> w1 \<le> w2 \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w1 w2 j i. \<lbrakk>\<bar>w1 - i\<bar> < (i - j) / 3; \<bar>w2 - j\<bar> < (i - j) / 3; w1 \<le> w2\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (simp add: abs_real_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<bar>?w1.0 - ?i\<bar> < (?i - ?j) / 3; \<bar>?w2.0 - ?j\<bar> < (?i - ?j) / 3; ?w1.0 \<le> ?w2.0\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
have "\<bar>(w1 - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
           "\<bar>(w2 - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>(w1 - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3 &&& \<bar>(w2 - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
[PROOF STEP]
using Basis_le_norm k le_less_trans norm_w1 norm_w2
[PROOF STATE]
proof (prove)
using this:
?b \<in> Basis \<Longrightarrow> \<bar>?x \<bullet> ?b\<bar> \<le> norm ?x
k \<in> Basis
\<lbrakk>?x \<le> ?y; ?y < ?z\<rbrakk> \<Longrightarrow> ?x < ?z
norm (w1 - i) < (i \<bullet> k - j \<bullet> k) / 3
norm (w2 - j) < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<bar>(w1 - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3 &&& \<bar>(w2 - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
\<bar>(w1 - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>(w2 - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<bar>(w1 - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>(w2 - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
have "w1\<bullet>k \<le> w2\<bullet>k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w1 \<bullet> k \<le> w2 \<bullet> k
[PROOF STEP]
using ik_le_jk int_w1 int_w2 f_le_g
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f has_integral ?i) (cbox ?a ?b); (?g has_integral ?j) (cbox ?a ?b); \<forall>x\<in>cbox ?a ?b. ?f x \<bullet> k \<le> ?g x \<bullet> k\<rbrakk> \<Longrightarrow> ?i \<bullet> k \<le> ?j \<bullet> k
((\<lambda>x. if x \<in> S then f x else (0::'b)) has_integral w1) (cbox a b)
((\<lambda>x. if x \<in> S then g x else (0::'b)) has_integral w2) (cbox a b)
?x \<in> S \<Longrightarrow> f ?x \<bullet> k \<le> g ?x \<bullet> k

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

goal (1 subgoal):
 1. \<not> i \<bullet> k \<le> j \<bullet> k \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<bar>(w1 - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>(w2 - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
w1 \<bullet> k \<le> w2 \<bullet> k
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<bar>(w1 - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>(w2 - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
w1 \<bullet> k \<le> w2 \<bullet> k

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding inner_simps
[PROOF STATE]
proof (prove)
using this:
\<bar>w1 \<bullet> k - i \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
\<bar>w2 \<bullet> k - j \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3
w1 \<bullet> k \<le> w2 \<bullet> k

goal (1 subgoal):
 1. False
[PROOF STEP]
by(rule *)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i \<bullet> k \<le> j \<bullet> k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i \<bullet> k \<le> j \<bullet> k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p_not_div_choose_lemma:
  fixes p :: nat
  assumes eeq: "\<And>i. Suc i < K \<Longrightarrow> multiplicity p (Suc i) = multiplicity p (Suc (j + i))"
      and "k < K" and p: "prime p"
    shows "multiplicity p (j + k choose k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (j + k choose k) = 0
[PROOF STEP]
using \<open>k < K\<close>
[PROOF STATE]
proof (prove)
using this:
k < K

goal (1 subgoal):
 1. multiplicity p (j + k choose k) = 0
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < K \<Longrightarrow> multiplicity p (j + 0 choose 0) = 0
 2. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < K

goal (2 subgoals):
 1. 0 < K \<Longrightarrow> multiplicity p (j + 0 choose 0) = 0
 2. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < K
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < K

goal (1 subgoal):
 1. multiplicity p (j + 0 choose 0) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
multiplicity p (j + 0 choose 0) = 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0
Suc k < K

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0
Suc k < K
[PROOF STEP]
have *: "(Suc (j+k) choose Suc k) > 0"
[PROOF STATE]
proof (prove)
using this:
k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0
Suc k < K

goal (1 subgoal):
 1. 0 < Suc (j + k) choose Suc k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Suc (j + k) choose Suc k

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < Suc (j + k) choose Suc k
[PROOF STEP]
have "multiplicity p ((Suc (j+k) choose Suc k) * Suc k) = multiplicity p (Suc k)"
[PROOF STATE]
proof (prove)
using this:
0 < Suc (j + k) choose Suc k

goal (1 subgoal):
 1. multiplicity p ((Suc (j + k) choose Suc k) * Suc k) = multiplicity p (Suc k)
[PROOF STEP]
by (subst Suc_times_binomial_eq [symmetric], subst prime_elem_multiplicity_mult_distrib)
       (insert p Suc.prems, simp_all add: eeq [symmetric] Suc.IH)
[PROOF STATE]
proof (state)
this:
multiplicity p ((Suc (j + k) choose Suc k) * Suc k) = multiplicity p (Suc k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
with p *
[PROOF STATE]
proof (chain)
picking this:
prime p
0 < Suc (j + k) choose Suc k
multiplicity p ((Suc (j + k) choose Suc k) * Suc k) = multiplicity p (Suc k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
prime p
0 < Suc (j + k) choose Suc k
multiplicity p ((Suc (j + k) choose Suc k) * Suc k) = multiplicity p (Suc k)

goal (1 subgoal):
 1. multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
by (subst (asm) prime_elem_multiplicity_mult_distrib) simp_all
[PROOF STATE]
proof (state)
this:
multiplicity p (j + Suc k choose Suc k) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_smult_distrib_right_mat: assumes "A \<in> carrier_mat nr nc"
  shows "(k + l) \<cdot>\<^sub>m A = (k :: 'a :: semiring) \<cdot>\<^sub>m A + l \<cdot>\<^sub>m A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k + l) \<cdot>\<^sub>m A = k \<cdot>\<^sub>m A + l \<cdot>\<^sub>m A
[PROOF STEP]
by (rule eq_matI, insert assms, auto simp: field_simps)


[STATEMENT]
lemma numsub_nb[simp]: "\<lbrakk> numbound0 t ; numbound0 s\<rbrakk> \<Longrightarrow> numbound0 (numsub t s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>numbound0 t; numbound0 s\<rbrakk> \<Longrightarrow> numbound0 (numsub t s)
[PROOF STEP]
using numsub_def
[PROOF STATE]
proof (prove)
using this:
numsub ?s ?t \<equiv> if ?s = ?t then C 0 else numadd (?s, numneg ?t)

goal (1 subgoal):
 1. \<lbrakk>numbound0 t; numbound0 s\<rbrakk> \<Longrightarrow> numbound0 (numsub t s)
[PROOF STEP]
by simp


[STATEMENT]
lemma supp_set:
  fixes xs :: "('a::fs) list"
  shows "supp (set xs) = supp xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp (set xs) = supp xs
[PROOF STEP]
apply(induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. supp (set []) = supp []
 2. \<And>a xs. supp (set xs) = supp xs \<Longrightarrow> supp (set (a # xs)) = supp (a # xs)
[PROOF STEP]
apply(simp add: supp_set_empty supp_Nil)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. supp (set xs) = supp xs \<Longrightarrow> supp (set (a # xs)) = supp (a # xs)
[PROOF STEP]
apply(simp add: supp_Cons supp_of_finite_insert)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma diag_mat_map:
  assumes M_carrier: "M \<in> carrier_mat n n"
  shows "diag_mat (map_mat f M) = map f (diag_mat M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_mat (map_mat f M) = map f (diag_mat M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. diag_mat (map_mat f M) = map f (diag_mat M)
[PROOF STEP]
have dim_eq: "dim_row M = dim_col M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row M = dim_col M
[PROOF STEP]
using M_carrier
[PROOF STATE]
proof (prove)
using this:
M \<in> carrier_mat n n

goal (1 subgoal):
 1. dim_row M = dim_col M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row M = dim_col M

goal (1 subgoal):
 1. diag_mat (map_mat f M) = map f (diag_mat M)
[PROOF STEP]
have m: "map_mat f M $$ (i, i) = f (M $$ (i, i))" if i: "i < dim_row M" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_mat f M $$ (i, i) = f (M $$ (i, i))
[PROOF STEP]
using dim_eq i
[PROOF STATE]
proof (prove)
using this:
dim_row M = dim_col M
i < dim_row M

goal (1 subgoal):
 1. map_mat f M $$ (i, i) = f (M $$ (i, i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i < dim_row M \<Longrightarrow> map_mat f M $$ (?i, ?i) = f (M $$ (?i, ?i))

goal (1 subgoal):
 1. diag_mat (map_mat f M) = map f (diag_mat M)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_mat (map_mat f M) = map f (diag_mat M)
[PROOF STEP]
by (rule nth_equalityI, insert m, auto simp add: diag_mat_def M_carrier)
[PROOF STATE]
proof (state)
this:
diag_mat (map_mat f M) = map f (diag_mat M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma simple_integral_mult[simp]:
  assumes f: "simple_function M f"
  shows "(\<integral>\<^sup>Sx. c * f x \<partial>M) = c * integral\<^sup>S M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * f x \<partial>M = c * integral\<^sup>S M f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * f x \<partial>M = c * integral\<^sup>S M f
[PROOF STEP]
have "(\<integral>\<^sup>Sx. c * f x \<partial>M) = (\<Sum>y\<in>f ` space M. (c * y) * emeasure M {x\<in>space M. f x = y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * f x \<partial>M = (\<Sum>y\<in>f ` space M. c * y * emeasure M {x \<in> space M. f x = y})
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
simple_function M f

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

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

goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * f x \<partial>M = c * integral\<^sup>S M f
[PROOF STEP]
have "\<dots> = c * integral\<^sup>S M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>y\<in>f ` space M. c * y * emeasure M {x \<in> space M. f x = y}) = c * integral\<^sup>S M f
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
simple_function M f

goal (1 subgoal):
 1. (\<Sum>y\<in>f ` space M. c * y * emeasure M {x \<in> space M. f x = y}) = c * integral\<^sup>S M f
[PROOF STEP]
unfolding simple_integral_def
[PROOF STATE]
proof (prove)
using this:
simple_function M f

goal (1 subgoal):
 1. (\<Sum>y\<in>f ` space M. c * y * emeasure M {x \<in> space M. f x = y}) = c * (\<Sum>x\<in>f ` space M. x * emeasure M (f -` {x} \<inter> space M))
[PROOF STEP]
by (subst sum_distrib_left) (auto simp: mult.assoc Int_def conj_commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>f ` space M. c * y * emeasure M {x \<in> space M. f x = y}) = c * integral\<^sup>S M f

goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * f x \<partial>M = c * integral\<^sup>S M f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>S x. c * f x \<partial>M = c * integral\<^sup>S M f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>S x. c * f x \<partial>M = c * integral\<^sup>S M f

goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * f x \<partial>M = c * integral\<^sup>S M f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>S x. c * f x \<partial>M = c * integral\<^sup>S M f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ofilter_init_seg_of:
assumes "ofilter F"
shows "Restr r F initial_segment_of r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Restr r F initial_segment_of r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
local.ofilter F

goal (1 subgoal):
 1. Restr r F initial_segment_of r
[PROOF STEP]
unfolding ofilter_def init_seg_of_def under_def
[PROOF STATE]
proof (prove)
using this:
F \<subseteq> Field r \<and> (\<forall>a\<in>F. {b. (b, a) \<in> r} \<subseteq> F)

goal (1 subgoal):
 1. (Restr r F, r) \<in> {(r, s). r \<subseteq> s \<and> (\<forall>a b c. (a, b) \<in> s \<and> (b, c) \<in> r \<longrightarrow> (a, b) \<in> r)}
[PROOF STEP]
by auto


[STATEMENT]
lemma starset_n_diff: "*sn* (\<lambda>n. (A n) - (B n)) = *sn* A - *sn* B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. *sn* (\<lambda>n. A n - B n) = *sn* A - *sn* B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. *sn* (\<lambda>n. A n - B n) = *sn* A - *sn* B
[PROOF STEP]
have "\<And>N. Iset ((*f* (\<lambda>n. {x. x \<in> A n \<and> x \<notin> B n})) N) =
    {x. x \<in> Iset ((*f* A) N) \<and> x \<notin> Iset ((*f* B) N)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N. Iset ((*f* (\<lambda>n. {x \<in> A n. x \<notin> B n})) N) = {x \<in> Iset ((*f* A) N). x \<notin> Iset ((*f* B) N)}
[PROOF STEP]
by transfer simp
[PROOF STATE]
proof (state)
this:
Iset ((*f* (\<lambda>n. {x \<in> A n. x \<notin> B n})) ?N) = {x \<in> Iset ((*f* A) ?N). x \<notin> Iset ((*f* B) ?N)}

goal (1 subgoal):
 1. *sn* (\<lambda>n. A n - B n) = *sn* A - *sn* B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Iset ((*f* (\<lambda>n. {x \<in> A n. x \<notin> B n})) ?N) = {x \<in> Iset ((*f* A) ?N). x \<notin> Iset ((*f* B) ?N)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Iset ((*f* (\<lambda>n. {x \<in> A n. x \<notin> B n})) ?N) = {x \<in> Iset ((*f* A) ?N). x \<notin> Iset ((*f* B) ?N)}

goal (1 subgoal):
 1. *sn* (\<lambda>n. A n - B n) = *sn* A - *sn* B
[PROOF STEP]
by (simp add: starset_n_def star_n_eq_starfun_whn set_diff_eq)
[PROOF STATE]
proof (state)
this:
*sn* (\<lambda>n. A n - B n) = *sn* A - *sn* B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord_of_inc:
assumes "x \<in> nonzero Z\<^sub>p"
shows "ord_Zp x = ord(\<iota> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord_Zp x = ord (\<iota> x)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ord_Zp x = ord (\<iota> x)
[PROOF STEP]
have "\<iota> x = frac x \<one>\<^bsub>Z\<^sub>p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<iota> x = fraction Z\<^sub>p x \<one>\<^bsub>Z\<^sub>p\<^esub>
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Z\<^sub>p

goal (1 subgoal):
 1. \<iota> x = fraction Z\<^sub>p x \<one>\<^bsub>Z\<^sub>p\<^esub>
[PROOF STEP]
by (simp add: Zp.nonzero_closed local.inc_def)
[PROOF STATE]
proof (state)
this:
\<iota> x = fraction Z\<^sub>p x \<one>\<^bsub>Z\<^sub>p\<^esub>

goal (1 subgoal):
 1. ord_Zp x = ord (\<iota> x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<iota> x = fraction Z\<^sub>p x \<one>\<^bsub>Z\<^sub>p\<^esub>
[PROOF STEP]
have "ord ( \<iota> x) = ord_Zp x - ord_Zp \<one>\<^bsub>Z\<^sub>p\<^esub>"
[PROOF STATE]
proof (prove)
using this:
\<iota> x = fraction Z\<^sub>p x \<one>\<^bsub>Z\<^sub>p\<^esub>

goal (1 subgoal):
 1. ord (\<iota> x) = ord_Zp x - ord_Zp \<one>\<^bsub>Z\<^sub>p\<^esub>
[PROOF STEP]
using assms(1) ord_of_frac
[PROOF STATE]
proof (prove)
using this:
\<iota> x = fraction Z\<^sub>p x \<one>\<^bsub>Z\<^sub>p\<^esub>
x \<in> nonzero Z\<^sub>p
\<lbrakk>?a \<in> nonzero Z\<^sub>p; ?b \<in> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> ord (fraction Z\<^sub>p ?a ?b) = ord_Zp ?a - ord_Zp ?b

goal (1 subgoal):
 1. ord (\<iota> x) = ord_Zp x - ord_Zp \<one>\<^bsub>Z\<^sub>p\<^esub>
[PROOF STEP]
by (simp add: Zp.nonzero_one_closed)
[PROOF STATE]
proof (state)
this:
ord (\<iota> x) = ord_Zp x - ord_Zp \<one>\<^bsub>Z\<^sub>p\<^esub>

goal (1 subgoal):
 1. ord_Zp x = ord (\<iota> x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ord (\<iota> x) = ord_Zp x - ord_Zp \<one>\<^bsub>Z\<^sub>p\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ord (\<iota> x) = ord_Zp x - ord_Zp \<one>\<^bsub>Z\<^sub>p\<^esub>

goal (1 subgoal):
 1. ord_Zp x = ord (\<iota> x)
[PROOF STEP]
using ord_Zp_one
[PROOF STATE]
proof (prove)
using this:
ord (\<iota> x) = ord_Zp x - ord_Zp \<one>\<^bsub>Z\<^sub>p\<^esub>
ord_Zp \<one>\<^bsub>Z\<^sub>p\<^esub> = 0

goal (1 subgoal):
 1. ord_Zp x = ord (\<iota> x)
[PROOF STEP]
by (simp add: ord_Zp_def)
[PROOF STATE]
proof (state)
this:
ord_Zp x = ord (\<iota> x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Prod_any_closed [intro]: "(\<And>x. f x \<in> A) \<Longrightarrow> Prod_any f \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. f x \<in> A) \<Longrightarrow> Prod_any f \<in> A
[PROOF STEP]
unfolding Prod_any.expand_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. f x \<in> A) \<Longrightarrow> prod f {a. f a \<noteq> (1::'a)} \<in> A
[PROOF STEP]
by (rule prod_closed)


[STATEMENT]
lemma remove_all_cycles_distinct: "set ys \<subseteq> set xs \<Longrightarrow> distinct (remove_all_cycles xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set ys \<subseteq> set xs \<Longrightarrow> distinct (remove_all_cycles xs ys)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set ys \<subseteq> set xs \<Longrightarrow> distinct (remove_all_cycles xs ys)
[PROOF STEP]
assume "set ys \<subseteq> set xs"
[PROOF STATE]
proof (state)
this:
set ys \<subseteq> set xs

goal (1 subgoal):
 1. set ys \<subseteq> set xs \<Longrightarrow> distinct (remove_all_cycles xs ys)
[PROOF STEP]
hence "\<forall> x \<in> set ys. cnt x (remove_all_cycles xs ys) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
set ys \<subseteq> set xs

goal (1 subgoal):
 1. \<forall>x\<in>set ys. cnt x (remove_all_cycles xs ys) \<le> 1
[PROOF STEP]
using cnt_remove_all_cycles
[PROOF STATE]
proof (prove)
using this:
set ys \<subseteq> set xs
?x \<in> set ?xs \<Longrightarrow> cnt ?x (remove_all_cycles ?xs ?ys) \<le> 1

goal (1 subgoal):
 1. \<forall>x\<in>set ys. cnt x (remove_all_cycles xs ys) \<le> 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set ys. cnt x (remove_all_cycles xs ys) \<le> 1

goal (1 subgoal):
 1. set ys \<subseteq> set xs \<Longrightarrow> distinct (remove_all_cycles xs ys)
[PROOF STEP]
hence "\<forall> x \<in> set (remove_all_cycles xs ys). cnt x (remove_all_cycles xs ys) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set ys. cnt x (remove_all_cycles xs ys) \<le> 1

goal (1 subgoal):
 1. \<forall>x\<in>set (remove_all_cycles xs ys). cnt x (remove_all_cycles xs ys) \<le> 1
[PROOF STEP]
using remove_all_cycles_subs
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set ys. cnt x (remove_all_cycles xs ys) \<le> 1
set (remove_all_cycles ?xs ?ys) \<subseteq> set ?ys

goal (1 subgoal):
 1. \<forall>x\<in>set (remove_all_cycles xs ys). cnt x (remove_all_cycles xs ys) \<le> 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (remove_all_cycles xs ys). cnt x (remove_all_cycles xs ys) \<le> 1

goal (1 subgoal):
 1. set ys \<subseteq> set xs \<Longrightarrow> distinct (remove_all_cycles xs ys)
[PROOF STEP]
thus "distinct (remove_all_cycles xs ys)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set (remove_all_cycles xs ys). cnt x (remove_all_cycles xs ys) \<le> 1

goal (1 subgoal):
 1. distinct (remove_all_cycles xs ys)
[PROOF STEP]
using cnt_distinct_intro
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set (remove_all_cycles xs ys). cnt x (remove_all_cycles xs ys) \<le> 1
\<forall>x\<in>set ?xs. cnt x ?xs \<le> 1 \<Longrightarrow> distinct ?xs

goal (1 subgoal):
 1. distinct (remove_all_cycles xs ys)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (remove_all_cycles xs ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dtree_from_list_fcard_le1: "fcard (sucs (dtree_from_list r xs)) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcard (sucs (dtree_from_list r xs)) \<le> 1
[PROOF STEP]
by(induction xs) (auto simp: fcard_single_1 fcard_fempty)


[STATEMENT]
lemma replicate_eq_replicate[simp]:
  "(replicate m x = replicate n y) \<longleftrightarrow> (m=n \<and> (m\<noteq>0 \<longrightarrow> x=y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (replicate m x = replicate n y) = (m = n \<and> (m \<noteq> 0 \<longrightarrow> x = y))
[PROOF STEP]
proof (induct m arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. (replicate 0 x = replicate n y) = (0 = n \<and> (0 \<noteq> 0 \<longrightarrow> x = y))
 2. \<And>m n. (\<And>n. (replicate m x = replicate n y) = (m = n \<and> (m \<noteq> 0 \<longrightarrow> x = y))) \<Longrightarrow> (replicate (Suc m) x = replicate n y) = (Suc m = n \<and> (Suc m \<noteq> 0 \<longrightarrow> x = y))
[PROOF STEP]
case (Suc m n)
[PROOF STATE]
proof (state)
this:
(replicate m x = replicate ?n y) = (m = ?n \<and> (m \<noteq> 0 \<longrightarrow> x = y))

goal (2 subgoals):
 1. \<And>n. (replicate 0 x = replicate n y) = (0 = n \<and> (0 \<noteq> 0 \<longrightarrow> x = y))
 2. \<And>m n. (\<And>n. (replicate m x = replicate n y) = (m = n \<and> (m \<noteq> 0 \<longrightarrow> x = y))) \<Longrightarrow> (replicate (Suc m) x = replicate n y) = (Suc m = n \<and> (Suc m \<noteq> 0 \<longrightarrow> x = y))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(replicate m x = replicate ?n y) = (m = ?n \<and> (m \<noteq> 0 \<longrightarrow> x = y))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(replicate m x = replicate ?n y) = (m = ?n \<and> (m \<noteq> 0 \<longrightarrow> x = y))

goal (1 subgoal):
 1. (replicate (Suc m) x = replicate n y) = (Suc m = n \<and> (Suc m \<noteq> 0 \<longrightarrow> x = y))
[PROOF STEP]
by (induct n) auto
[PROOF STATE]
proof (state)
this:
(replicate (Suc m) x = replicate n y) = (Suc m = n \<and> (Suc m \<noteq> 0 \<longrightarrow> x = y))

goal (1 subgoal):
 1. \<And>n. (replicate 0 x = replicate n y) = (0 = n \<and> (0 \<noteq> 0 \<longrightarrow> x = y))
[PROOF STEP]
qed simp


[STATEMENT]
lemma summable_power_series:
  fixes z :: real
  assumes le_1: "\<And>i. f i \<le> 1"
    and nonneg: "\<And>i. 0 \<le> f i"
    and z: "0 \<le> z" "z < 1"
  shows "summable (\<lambda>i. f i * z^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>i. f i * z ^ i)
[PROOF STEP]
proof (rule summable_comparison_test[OF _ summable_geometric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>N. \<forall>n\<ge>N. norm (f n * z ^ n) \<le> ?c1 ^ n
 2. norm ?c1 < 1
[PROOF STEP]
show "norm z < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm z < 1
[PROOF STEP]
using z
[PROOF STATE]
proof (prove)
using this:
0 \<le> z
z < 1

goal (1 subgoal):
 1. norm z < 1
[PROOF STEP]
by (auto simp: less_imp_le)
[PROOF STATE]
proof (state)
this:
norm z < 1

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. norm (f n * z ^ n) \<le> z ^ n
[PROOF STEP]
show "\<And>n. \<exists>N. \<forall>na\<ge>N. norm (f na * z ^ na) \<le> z ^ na"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<exists>N. \<forall>na\<ge>N. norm (f na * z ^ na) \<le> z ^ na
[PROOF STEP]
using z
[PROOF STATE]
proof (prove)
using this:
0 \<le> z
z < 1

goal (1 subgoal):
 1. \<And>n. \<exists>N. \<forall>na\<ge>N. norm (f na * z ^ na) \<le> z ^ na
[PROOF STEP]
by (auto intro!: exI[of _ 0] mult_left_le_one_le simp: abs_mult nonneg power_abs less_imp_le le_1)
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>na\<ge>N. norm (f na * z ^ na) \<le> z ^ na

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Arccos_1 [simp]: "Arccos 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arccos 1 = 0
[PROOF STEP]
by (rule Arccos_unique) auto


[STATEMENT]
lemma cauchy_not_vanishes:
  assumes X: "cauchy X"
    and nz: "\<not> vanishes X"
  shows "\<exists>b>0. \<exists>k. \<forall>n\<ge>k. b < \<bar>X n\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. \<forall>n\<ge>k. b < \<bar>X n\<bar>
[PROOF STEP]
using cauchy_not_vanishes_cases [OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. \<forall>n\<ge>k. b < \<bar>X n\<bar>
[PROOF STEP]
by (elim ex_forward conj_forward asm_rl) auto


[STATEMENT]
lemma card_suc_ordLess_imp_ordLeq:
  assumes ORD: "Card_order r" "Card_order r'" "card_order r'"
  and LESS: "r <o card_suc r'"
shows "r \<le>o r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le>o r'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<le>o r'
[PROOF STEP]
have "Card_order (card_suc r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Card_order (card_suc r')
[PROOF STEP]
by (rule Card_order_card_suc[OF ORD(3)])
[PROOF STATE]
proof (state)
this:
Card_order (card_suc r')

goal (1 subgoal):
 1. r \<le>o r'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Card_order (card_suc r')
[PROOF STEP]
have "cardSuc r \<le>o card_suc r'"
[PROOF STATE]
proof (prove)
using this:
Card_order (card_suc r')

goal (1 subgoal):
 1. cardSuc r \<le>o card_suc r'
[PROOF STEP]
using cardSuc_least ORD LESS
[PROOF STATE]
proof (prove)
using this:
Card_order (card_suc r')
\<lbrakk>Card_order ?r; Card_order ?r'; ?r <o ?r'\<rbrakk> \<Longrightarrow> cardSuc ?r \<le>o ?r'
Card_order r
Card_order r'
card_order r'
r <o card_suc r'

goal (1 subgoal):
 1. cardSuc r \<le>o card_suc r'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cardSuc r \<le>o card_suc r'

goal (1 subgoal):
 1. r \<le>o r'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cardSuc r \<le>o card_suc r'
[PROOF STEP]
have "cardSuc r \<le>o cardSuc r'"
[PROOF STATE]
proof (prove)
using this:
cardSuc r \<le>o card_suc r'

goal (1 subgoal):
 1. cardSuc r \<le>o cardSuc r'
[PROOF STEP]
using cardSuc_ordIso_card_suc ordIso_symmetric
      ordLeq_ordIso_trans ORD(3)
[PROOF STATE]
proof (prove)
using this:
cardSuc r \<le>o card_suc r'
card_order ?r \<Longrightarrow> cardSuc ?r =o card_suc ?r
?r =o ?r' \<Longrightarrow> ?r' =o ?r
\<lbrakk>?r \<le>o ?r'; ?r' =o ?r''\<rbrakk> \<Longrightarrow> ?r \<le>o ?r''
card_order r'

goal (1 subgoal):
 1. cardSuc r \<le>o cardSuc r'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cardSuc r \<le>o cardSuc r'

goal (1 subgoal):
 1. r \<le>o r'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cardSuc r \<le>o cardSuc r'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cardSuc r \<le>o cardSuc r'

goal (1 subgoal):
 1. r \<le>o r'
[PROOF STEP]
using cardSuc_mono_ordLeq ORD
[PROOF STATE]
proof (prove)
using this:
cardSuc r \<le>o cardSuc r'
\<lbrakk>Card_order ?r; Card_order ?r'\<rbrakk> \<Longrightarrow> (cardSuc ?r \<le>o cardSuc ?r') = (?r \<le>o ?r')
Card_order r
Card_order r'
card_order r'

goal (1 subgoal):
 1. r \<le>o r'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r \<le>o r'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mono_up: "xs \<le> ys \<Longrightarrow> up a xs \<le> up a ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<le> ys \<Longrightarrow> up a xs \<le> up a ys
[PROOF STEP]
unfolding less_eq_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix xs ys \<Longrightarrow> prefix (up a xs) (up a ys)
[PROOF STEP]
by (subst (asm) prefix_def) (auto intro!: prefix_up)


[STATEMENT]
lemma fpxs_shift_diff_left: "fpxs_shift (m - n) f = fpxs_shift m (fpxs_shift (-n) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_shift (m - n) f = fpxs_shift m (fpxs_shift (- n) f)
[PROOF STEP]
by (subst fpxs_shift_add_left [symmetric]) auto


[STATEMENT]
lemma in_funswapid_image_iff: "x \<in> (a \<rightleftharpoons>\<^sub>F b) ` S \<longleftrightarrow> (a \<rightleftharpoons>\<^sub>F b) x \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> (a \<rightleftharpoons>\<^sub>F b) ` S) = ((a \<rightleftharpoons>\<^sub>F b) x \<in> S)
[PROOF STEP]
by (fact in_transpose_image_iff)


[STATEMENT]
lemma Keys_hom_components: "Keys (hom_components p) = keys p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Keys (hom_components p) = keys p
[PROOF STEP]
by (auto simp: Keys_def hom_components_def keys_hom_component)


[STATEMENT]
lemma map_spmf_of_pmf [simp]: "map_spmf f (spmf_of_pmf p) = spmf_of_pmf (map_pmf f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf f (spmf_of_pmf p) = spmf_of_pmf (map_pmf f p)
[PROOF STEP]
by(simp add: spmf_of_pmf_def pmf.map_comp o_def)


[STATEMENT]
lemma rel_restrict_compl:
  "rel_restrict R A \<inter> rel_restrict R (-A) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_restrict R A \<inter> rel_restrict R (- A) = {}
[PROOF STEP]
unfolding rel_restrict_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(v, w). (v, w) \<in> R \<and> v \<notin> A \<and> w \<notin> A} \<inter> {(v, w). (v, w) \<in> R \<and> v \<notin> - A \<and> w \<notin> - A} = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma isometry_on_injective:
  assumes "isometry_on X f"
  shows "inj_on f X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f X
[PROOF STEP]
using assms inj_on_def isometry_on_def
[PROOF STATE]
proof (prove)
using this:
isometry_on X f
inj_on ?f ?A = (\<forall>x\<in>?A. \<forall>y\<in>?A. ?f x = ?f y \<longrightarrow> x = y)
isometry_on ?X ?f = (\<forall>x\<in>?X. \<forall>y\<in>?X. dist (?f x) (?f y) = dist x y)

goal (1 subgoal):
 1. inj_on f X
[PROOF STEP]
by force


[STATEMENT]
lemma RedBlack_paths_are_black_paths :
  assumes "RedBlack prb"
  shows   "RedBlack_paths prb \<subseteq> Graph.paths (black prb)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RedBlack_paths prb \<subseteq> subpaths_from (black prb) (init (black prb))
[PROOF STEP]
using assms
      RedBlack_subpaths_are_black_subpaths[of prb "root (red prb)"]
      consistent_roots[of prb]
[PROOF STATE]
proof (prove)
using this:
RedBlack prb
RedBlack prb \<Longrightarrow> RedBlack_paths prb \<subseteq> subpaths_from (black prb) (fst (root (red prb)))
RedBlack prb \<Longrightarrow> fst (root (red prb)) = init (black prb)

goal (1 subgoal):
 1. RedBlack_paths prb \<subseteq> subpaths_from (black prb) (init (black prb))
[PROOF STEP]
by simp


[STATEMENT]
lemma frag_extend_eq_0:
   "(\<And>x. x \<in> Poly_Mapping.keys c \<Longrightarrow> f x = 0) \<Longrightarrow> frag_extend f c = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> keys c \<Longrightarrow> f x = 0) \<Longrightarrow> frag_extend f c = 0
[PROOF STEP]
by (simp add: frag_extend_def)


[STATEMENT]
lemma compact_Int_closed [intro]:
  assumes "compact S"
    and "closed T"
  shows "compact (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (S \<inter> T)
[PROOF STEP]
proof (rule compactI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
fix C
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
assume C: "\<forall>c\<in>C. open c"
[PROOF STATE]
proof (state)
this:
Ball C open

goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
assume cover: "S \<inter> T \<subseteq> \<Union>C"
[PROOF STATE]
proof (state)
this:
S \<inter> T \<subseteq> \<Union> C

goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
from C \<open>closed T\<close>
[PROOF STATE]
proof (chain)
picking this:
Ball C open
closed T
[PROOF STEP]
have "\<forall>c\<in>C \<union> {- T}. open c"
[PROOF STATE]
proof (prove)
using this:
Ball C open
closed T

goal (1 subgoal):
 1. Ball (C \<union> {- T}) open
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ball (C \<union> {- T}) open

goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Ball (C \<union> {- T}) open

goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
from cover
[PROOF STATE]
proof (chain)
picking this:
S \<inter> T \<subseteq> \<Union> C
[PROOF STEP]
have "S \<subseteq> \<Union>(C \<union> {- T})"
[PROOF STATE]
proof (prove)
using this:
S \<inter> T \<subseteq> \<Union> C

goal (1 subgoal):
 1. S \<subseteq> \<Union> (C \<union> {- T})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subseteq> \<Union> (C \<union> {- T})

goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Ball (C \<union> {- T}) open
S \<subseteq> \<Union> (C \<union> {- T})
[PROOF STEP]
have "\<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
Ball (C \<union> {- T}) open
S \<subseteq> \<Union> (C \<union> {- T})

goal (1 subgoal):
 1. \<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union> D
[PROOF STEP]
using \<open>compact S\<close>
[PROOF STATE]
proof (prove)
using this:
Ball (C \<union> {- T}) open
S \<subseteq> \<Union> (C \<union> {- T})
compact S

goal (1 subgoal):
 1. \<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union> D
[PROOF STEP]
unfolding compact_eq_Heine_Borel
[PROOF STATE]
proof (prove)
using this:
Ball (C \<union> {- T}) open
S \<subseteq> \<Union> (C \<union> {- T})
\<forall>C. Ball C open \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D)

goal (1 subgoal):
 1. \<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union> D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union> D

goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union> D
[PROOF STEP]
obtain D where "D \<subseteq> C \<union> {- T} \<and> finite D \<and> S \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
\<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union> D

goal (1 subgoal):
 1. (\<And>D. D \<subseteq> C \<union> {- T} \<and> finite D \<and> S \<subseteq> \<Union> D \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
D \<subseteq> C \<union> {- T} \<and> finite D \<and> S \<subseteq> \<Union> D

goal (1 subgoal):
 1. \<And>C. \<lbrakk>Ball C open; S \<inter> T \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<inter> T \<subseteq> \<Union> C'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
D \<subseteq> C \<union> {- T} \<and> finite D \<and> S \<subseteq> \<Union> D
[PROOF STEP]
show "\<exists>D\<subseteq>C. finite D \<and> S \<inter> T \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> C \<union> {- T} \<and> finite D \<and> S \<subseteq> \<Union> D

goal (1 subgoal):
 1. \<exists>D\<subseteq>C. finite D \<and> S \<inter> T \<subseteq> \<Union> D
[PROOF STEP]
by (intro exI[of _ "D - {-T}"]) auto
[PROOF STATE]
proof (state)
this:
\<exists>D\<subseteq>C. finite D \<and> S \<inter> T \<subseteq> \<Union> D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma t0_mem_closed_segment[intro, simp]: "t0 \<in> {tmin--tmax}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t0 \<in> {tmin--tmax}
[PROOF STEP]
using T_def iv_defined
[PROOF STATE]
proof (prove)
using this:
T = {tmin..tmax}
t0 \<in> T
x0 \<in> X

goal (1 subgoal):
 1. t0 \<in> {tmin--tmax}
[PROOF STEP]
by (simp add: closed_segment_eq_real_ivl)


[STATEMENT]
lemma connectedin_separation:
  "connectedin X S \<longleftrightarrow>
        S \<subseteq> topspace X \<and>
        (\<nexists>C1 C2. C1 \<union> C2 = S \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> C1 \<inter> X closure_of C2 = {} \<and> C2 \<inter> X closure_of C1 = {})" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connectedin X S = (S \<subseteq> topspace X \<and> (\<nexists>C1 C2. C1 \<union> C2 = S \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> C1 \<inter> X closure_of C2 = {} \<and> C2 \<inter> X closure_of C1 = {}))
[PROOF STEP]
unfolding connectedin_def connected_space_closedin_eq closedin_Int_closure_of topspace_subtopology
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<subseteq> topspace X \<and> (\<nexists>E1 E2. S \<inter> X closure_of E1 = E1 \<and> S \<inter> X closure_of E2 = E2 \<and> E1 \<union> E2 = topspace X \<inter> S \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})) = (S \<subseteq> topspace X \<and> (\<nexists>C1 C2. C1 \<union> C2 = S \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> C1 \<inter> X closure_of C2 = {} \<and> C2 \<inter> X closure_of C1 = {}))
[PROOF STEP]
apply (intro conj_cong refl arg_cong [where f=Not])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> topspace X \<Longrightarrow> (\<exists>E1 E2. S \<inter> X closure_of E1 = E1 \<and> S \<inter> X closure_of E2 = E2 \<and> E1 \<union> E2 = topspace X \<inter> S \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {}) = (\<exists>C1 C2. C1 \<union> C2 = S \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> C1 \<inter> X closure_of C2 = {} \<and> C2 \<inter> X closure_of C1 = {})
[PROOF STEP]
apply (intro ex_cong1 iffI, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>E1 E2. \<lbrakk>S \<subseteq> topspace X; E1 \<union> E2 = S \<and> E1 \<noteq> {} \<and> E2 \<noteq> {} \<and> E1 \<inter> X closure_of E2 = {} \<and> E2 \<inter> X closure_of E1 = {}\<rbrakk> \<Longrightarrow> S \<inter> X closure_of E1 = E1 \<and> S \<inter> X closure_of E2 = E2 \<and> E1 \<union> E2 = topspace X \<inter> S \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {}
[PROOF STEP]
using closure_of_subset_Int
[PROOF STATE]
proof (prove)
using this:
topspace ?X \<inter> ?S \<subseteq> ?X closure_of ?S

goal (1 subgoal):
 1. \<And>E1 E2. \<lbrakk>S \<subseteq> topspace X; E1 \<union> E2 = S \<and> E1 \<noteq> {} \<and> E2 \<noteq> {} \<and> E1 \<inter> X closure_of E2 = {} \<and> E2 \<inter> X closure_of E1 = {}\<rbrakk> \<Longrightarrow> S \<inter> X closure_of E1 = E1 \<and> S \<inter> X closure_of E2 = E2 \<and> E1 \<union> E2 = topspace X \<inter> S \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {}
[PROOF STEP]
by force


[STATEMENT]
lemma path_independent_on_consistency_on:
  assumes "path_independent_on A f"
  shows "consistency_on A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
using %invisible assms
[PROOF STATE]
proof (prove)
using this:
path_independent_on A f

goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
unfolding path_independent_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>B C. B \<subseteq> A \<and> C \<subseteq> A \<longrightarrow> f (B \<union> C) = f (B \<union> f C)

goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
by - (rule consistency_onI; metis Un_subset_iff le_iff_sup sup_commute)


[STATEMENT]
lemma list_all2_shortcircuit_weaken: "list_all2_shortcircuit P xs ys \<Longrightarrow> (\<And>xs ys. P xs ys \<Longrightarrow> Q xs ys) \<Longrightarrow> list_all2_shortcircuit Q xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2_shortcircuit P xs ys; \<And>xs ys. P xs ys \<Longrightarrow> Q xs ys\<rbrakk> \<Longrightarrow> list_all2_shortcircuit Q xs ys
[PROOF STEP]
by (metis list_all2_shortcircuit_mono predicate2I rev_predicate2D)


[STATEMENT]
lemma app_vconverseI[sym, intro!]:
  assumes "\<langle>a, b\<rangle> \<in>\<^sub>\<circ> r"
  shows "\<langle>b, a\<rangle> \<in>\<^sub>\<circ> r\<inverse>\<^sub>\<circ>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>b, a\<rangle> \<in>\<^sub>\<circ> r\<inverse>\<^sub>\<circ>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<langle>a, b\<rangle> \<in>\<^sub>\<circ> r

goal (1 subgoal):
 1. \<langle>b, a\<rangle> \<in>\<^sub>\<circ> r\<inverse>\<^sub>\<circ>
[PROOF STEP]
unfolding vconverse_def
[PROOF STATE]
proof (prove)
using this:
\<langle>a, b\<rangle> \<in>\<^sub>\<circ> r

goal (1 subgoal):
 1. \<langle>b, a\<rangle> \<in>\<^sub>\<circ> (\<lambda>r\<in>\<^sub>\<circ>set {r}. set {\<langle>b, a\<rangle> |a b. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r})\<lparr>r\<rparr>
[PROOF STEP]
by auto


[STATEMENT]
lemma gbinomial_partial_sum_poly_xpos:
    "(\<Sum>k\<le>m. (of_nat m + a gchoose k) * x^k * y^(m-k)) =
     (\<Sum>k\<le>m. (of_nat k + a - 1 gchoose k) * x^k * (x + y)^(m-k))" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
have "?lhs = (\<Sum>k\<le>m. (- a gchoose k) * (- x) ^ k * (x + y) ^ (m - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (- a gchoose k) * (- x) ^ k * (x + y) ^ (m - k))
[PROOF STEP]
by (simp add: gbinomial_partial_sum_poly)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (- a gchoose k) * (- x) ^ k * (x + y) ^ (m - k))

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (- a gchoose k) * (- x) ^ k * (x + y) ^ (m - k))

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
have "... = (\<Sum>k\<le>m. (-1) ^ k * (of_nat k - - a - 1 gchoose k) * (- x) ^ k * (x + y) ^ (m - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (- a gchoose k) * (- x) ^ k * (x + y) ^ (m - k)) = (\<Sum>k\<le>m. (- (1::'a)) ^ k * (of_nat k - - a - (1::'a) gchoose k) * (- x) ^ k * (x + y) ^ (m - k))
[PROOF STEP]
by (metis (no_types, opaque_lifting) gbinomial_negated_upper)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (- a gchoose k) * (- x) ^ k * (x + y) ^ (m - k)) = (\<Sum>k\<le>m. (- (1::'a)) ^ k * (of_nat k - - a - (1::'a) gchoose k) * (- x) ^ k * (x + y) ^ (m - k))

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (- a gchoose k) * (- x) ^ k * (x + y) ^ (m - k)) = (\<Sum>k\<le>m. (- (1::'a)) ^ k * (of_nat k - - a - (1::'a) gchoose k) * (- x) ^ k * (x + y) ^ (m - k))

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
have "... = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (- (1::'a)) ^ k * (of_nat k - - a - (1::'a) gchoose k) * (- x) ^ k * (x + y) ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
by (intro sum.cong) (auto simp flip: power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (- (1::'a)) ^ k * (of_nat k - - a - (1::'a) gchoose k) * (- x) ^ k * (x + y) ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (of_nat m + a gchoose k) * x ^ k * y ^ (m - k)) = (\<Sum>k\<le>m. (of_nat k + a - (1::'a) gchoose k) * x ^ k * (x + y) ^ (m - k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_reflect_poly:
  "coeff (reflect_poly p) n = (if n > degree p then 0 else coeff p (degree p - n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (reflect_poly p) n = (if degree p < n then 0::'a else coeff p (degree p - n))
[PROOF STEP]
by (cases "p = 0")
    (auto simp add: reflect_poly_def nth_default_def
      rev_nth degree_eq_length_coeffs coeffs_nth not_less
      dest: le_imp_less_Suc)


[STATEMENT]
lemma join_ti_empty_join:
  assumes "i \<le> n"
         and "join_ti s x n = []"
  shows      "s (x+i) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s (x + i) = []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<le> n
join_ti s x n = []

goal (1 subgoal):
 1. s (x + i) = []
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>i \<le> 0; join_ti s x 0 = []\<rbrakk> \<Longrightarrow> s (x + i) = []
 2. \<And>n. \<lbrakk>\<lbrakk>i \<le> n; join_ti s x n = []\<rbrakk> \<Longrightarrow> s (x + i) = []; i \<le> Suc n; join_ti s x (Suc n) = []\<rbrakk> \<Longrightarrow> s (x + i) = []
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i \<le> 0
join_ti s x 0 = []

goal (2 subgoals):
 1. \<lbrakk>i \<le> 0; join_ti s x 0 = []\<rbrakk> \<Longrightarrow> s (x + i) = []
 2. \<And>n. \<lbrakk>\<lbrakk>i \<le> n; join_ti s x n = []\<rbrakk> \<Longrightarrow> s (x + i) = []; i \<le> Suc n; join_ti s x (Suc n) = []\<rbrakk> \<Longrightarrow> s (x + i) = []
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<le> 0
join_ti s x 0 = []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
i \<le> 0
join_ti s x 0 = []

goal (1 subgoal):
 1. s (x + i) = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s (x + i) = []

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>i \<le> n; join_ti s x n = []\<rbrakk> \<Longrightarrow> s (x + i) = []; i \<le> Suc n; join_ti s x (Suc n) = []\<rbrakk> \<Longrightarrow> s (x + i) = []
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>i \<le> n; join_ti s x n = []\<rbrakk> \<Longrightarrow> s (x + i) = []; i \<le> Suc n; join_ti s x (Suc n) = []\<rbrakk> \<Longrightarrow> s (x + i) = []
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>i \<le> n; join_ti s x n = []\<rbrakk> \<Longrightarrow> s (x + i) = []
i \<le> Suc n
join_ti s x (Suc n) = []

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>i \<le> n; join_ti s x n = []\<rbrakk> \<Longrightarrow> s (x + i) = []; i \<le> Suc n; join_ti s x (Suc n) = []\<rbrakk> \<Longrightarrow> s (x + i) = []
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>i \<le> n; join_ti s x n = []\<rbrakk> \<Longrightarrow> s (x + i) = []
i \<le> Suc n
join_ti s x (Suc n) = []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i \<le> n; join_ti s x n = []\<rbrakk> \<Longrightarrow> s (x + i) = []
i \<le> Suc n
join_ti s x (Suc n) = []

goal (1 subgoal):
 1. s (x + i) = []
[PROOF STEP]
by (metis join_ti_hint1 join_ti_hint2 le_SucE)
[PROOF STATE]
proof (state)
this:
s (x + i) = []

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sorted_wrt_dist_nearest_neighbors:
  "sorted_wrt_dist p (nearest_neighbors n p kdt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt_dist p (nearest_neighbors n p kdt)
[PROOF STEP]
using sorted_nns
[PROOF STATE]
proof (prove)
using this:
sorted_wrt_dist ?p ?ps \<Longrightarrow> sorted_wrt_dist ?p (nearest_nbors ?n ?ps ?p ?kdt)

goal (1 subgoal):
 1. sorted_wrt_dist p (nearest_neighbors n p kdt)
[PROOF STEP]
unfolding nearest_neighbors_def sorted_wrt_dist_def
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (\<lambda>p\<^sub>0 p\<^sub>1. dist p\<^sub>0 ?p \<le> dist p\<^sub>1 ?p) ?ps \<Longrightarrow> sorted_wrt (\<lambda>p\<^sub>0 p\<^sub>1. dist p\<^sub>0 ?p \<le> dist p\<^sub>1 ?p) (nearest_nbors ?n ?ps ?p ?kdt)

goal (1 subgoal):
 1. sorted_wrt (\<lambda>p\<^sub>0 p\<^sub>1. dist p\<^sub>0 p \<le> dist p\<^sub>1 p) (nearest_nbors n [] p kdt)
[PROOF STEP]
by force


[STATEMENT]
lemma authKeys_empty: "authKeys [] = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. authKeys [] = {}
[PROOF STEP]
apply (unfold authKeys_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {authK. \<exists>A Peer Ta. Says Kas A (Crypt (shrK A) \<lbrace>Key authK, Agent Peer, Number Ta, Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, Key authK, Number Ta\<rbrace>\<rbrace>) \<in> set []} = {}
[PROOF STEP]
apply (simp (no_asm))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "id x = x \<and> id True = True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. id x = x \<and> id True = True
[PROOF STEP]
by (smt (verit) id_def)


[STATEMENT]
lemma multiplicity_aprimedivisor_Suc_0_iff:
  assumes "primepow (n :: 'a :: factorial_semiring_multiplicative)"
  shows   "multiplicity (aprimedivisor n) n = Suc 0 \<longleftrightarrow> prime n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (multiplicity (aprimedivisor n) n = Suc 0) = prime n
[PROOF STEP]
by (subst (3) primepow_decompose [OF assms, symmetric])
     (insert assms, auto simp add: prime_power_iff intro!: prime_aprimedivisor')


[STATEMENT]
lemma in_lists_iff_set: "xs \<in> lists A \<longleftrightarrow> set xs \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs \<in> lists A) = (set xs \<subseteq> A)
[PROOF STEP]
by fast


[STATEMENT]
lemma  matrix_right_invertible_gen:
  fixes f :: "'a::field^'m \<Rightarrow> 'a^'n"
  assumes "Vector_Spaces.linear (*s) (*s) f"
  shows "((\<exists>B. matrix f ** B = mat 1) \<longleftrightarrow> (\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>B. matrix f ** B = mat (1::'a)) = (\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B. matrix f ** B = mat (1::'a) \<Longrightarrow> \<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id
 2. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; f \<circ> g = id\<rbrakk> \<Longrightarrow> \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
fix B
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B. matrix f ** B = mat (1::'a) \<Longrightarrow> \<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id
 2. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; f \<circ> g = id\<rbrakk> \<Longrightarrow> \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
assume 1: "matrix f ** B = mat 1"
[PROOF STATE]
proof (state)
this:
matrix f ** B = mat (1::'a)

goal (2 subgoals):
 1. \<And>B. matrix f ** B = mat (1::'a) \<Longrightarrow> \<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id
 2. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; f \<circ> g = id\<rbrakk> \<Longrightarrow> \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
show "\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Vector_Spaces.linear (*s) (*s) ?g
 2. f \<circ> ?g = id
[PROOF STEP]
show "Vector_Spaces.linear (*s) (*s) ((*v) B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Vector_Spaces.linear (*s) (*s) ((*v) B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Vector_Spaces.linear (*s) (*s) ((*v) B)

goal (1 subgoal):
 1. f \<circ> (*v) B = id
[PROOF STEP]
show "f \<circ> (*v) B = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> (*v) B = id
[PROOF STEP]
using 1 assms comp_apply eq_id_iff vec.linear_id matrix_id_mat_1 matrix_vector_mul_assoc matrix_works
[PROOF STATE]
proof (prove)
using this:
matrix f ** B = mat (1::'a)
Vector_Spaces.linear (*s) (*s) f
(?f \<circ> ?g) ?x = ?f (?g ?x)
(\<forall>x. ?f x = x) = (?f = id)
Vector_Spaces.linear (*s) (*s) id
matrix id = mat (1::?'a)
?A *v (?B *v ?x) = ?A ** ?B *v ?x
Vector_Spaces.linear (*s) (*s) ?f \<Longrightarrow> matrix ?f *v ?x = ?f ?x

goal (1 subgoal):
 1. f \<circ> (*v) B = id
[PROOF STEP]
by (metis (no_types, opaque_lifting))
[PROOF STATE]
proof (state)
this:
f \<circ> (*v) B = id

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> f \<circ> g = id

goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; f \<circ> g = id\<rbrakk> \<Longrightarrow> \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; f \<circ> g = id\<rbrakk> \<Longrightarrow> \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
fix g
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; f \<circ> g = id\<rbrakk> \<Longrightarrow> \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
assume "Vector_Spaces.linear (*s) (*s) g" and "f \<circ> g = id"
[PROOF STATE]
proof (state)
this:
Vector_Spaces.linear (*s) (*s) g
f \<circ> g = id

goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; f \<circ> g = id\<rbrakk> \<Longrightarrow> \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Vector_Spaces.linear (*s) (*s) g
f \<circ> g = id
[PROOF STEP]
have "matrix f ** matrix g = mat 1"
[PROOF STATE]
proof (prove)
using this:
Vector_Spaces.linear (*s) (*s) g
f \<circ> g = id

goal (1 subgoal):
 1. matrix f ** matrix g = mat (1::'a)
[PROOF STEP]
by (metis assms matrix_compose_gen matrix_id_mat_1)
[PROOF STATE]
proof (state)
this:
matrix f ** matrix g = mat (1::'a)

goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; f \<circ> g = id\<rbrakk> \<Longrightarrow> \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
matrix f ** matrix g = mat (1::'a)
[PROOF STEP]
show "\<exists>B. matrix f ** B = mat 1"
[PROOF STATE]
proof (prove)
using this:
matrix f ** matrix g = mat (1::'a)

goal (1 subgoal):
 1. \<exists>B. matrix f ** B = mat (1::'a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>B. matrix f ** B = mat (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma word_sint_1:
  "sint (1::'a::len word) = (if LENGTH('a) = 1 then -1 else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sint 1 = (if LENGTH('a) = 1 then - 1 else 1)
[PROOF STEP]
by (fact signed_1)


[STATEMENT]
lemma inj_linear_imp_inv_bounded_linear:
  fixes f::"'a::euclidean_space \<Rightarrow> 'a"
  shows "\<lbrakk>bounded_linear f; inj f\<rbrakk> \<Longrightarrow> bounded_linear (inv f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded_linear f; inj f\<rbrakk> \<Longrightarrow> bounded_linear (inv f)
[PROOF STEP]
by (simp add: inj_linear_imp_inv_linear linear_linear)


[STATEMENT]
lemma count_remdups_mset_If: \<open>count (remdups_mset A) a = (if a \<in># A then 1 else 0)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (remdups_mset A) a = (if a \<in># A then 1 else 0)
[PROOF STEP]
unfolding remdups_mset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (mset_set (set_mset A)) a = (if a \<in># A then 1 else 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma [code]: "float2_of_real p (Ratreal r) =
  (let (a, b) = quotient_of r in
  (float_div_down p a b, float_div_up p a b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. float2_of_real p (Ratreal r) = (let (a, b) = quotient_of r in (float_div_down p a b, float_div_up p a b))
[PROOF STEP]
including float.lifting
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. float2_of_real p (Ratreal r) = (let (a, b) = quotient_of r in (float_div_down p a b, float_div_up p a b))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p r. real2_of_real p (Ratreal r) = (let (a, b) = quotient_of r in (real_div_down p a b, real_div_up p a b))
[PROOF STEP]
apply (auto split: prod.split simp: real2_of_real_def real_div_down_def real_div_up_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>p r x1 x2. quotient_of r = (x1, x2) \<Longrightarrow> truncate_down (Suc p) (real_of_rat r) = truncate_down (Suc p) (real_of_int x1 / real_of_int x2)
 2. \<And>p r x1 x2. quotient_of r = (x1, x2) \<Longrightarrow> truncate_up (Suc p) (real_of_rat r) = truncate_up (Suc p) (real_of_int x1 / real_of_int x2)
[PROOF STEP]
apply (metis of_rat_divide of_rat_of_int_eq quotient_of_div)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem p57: "F(f(a,b),f(b,c)) \<Longrightarrow> F(f(b,c),f(a,c)) \<Longrightarrow>
  \<forall>x y z. F(x,y) \<and> F(y,z) \<longrightarrow> F(x,z) \<Longrightarrow> F(f(a,b),f(a,c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F (f (a, b), f (b, c)); F (f (b, c), f (a, c)); \<forall>x y z. F (x, y) \<and> F (y, z) \<longrightarrow> F (x, z)\<rbrakk> \<Longrightarrow> F (f (a, b), f (a, c))
[PROOF STEP]
by auto2


[STATEMENT]
lemma sup_eq_all: "(\<And>A. (A\<in>M \<Longrightarrow> f(A)=g(A)))
  \<Longrightarrow> Sup {f(A) | A. A\<in>M} = Sup {g(A) | A. A\<in>M}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A. A \<in> M \<Longrightarrow> f A = g A) \<Longrightarrow> Sup {f A |A. A \<in> M} = Sup {g A |A. A \<in> M}
[PROOF STEP]
by metis