[STATEMENT]
lemma scale_zero_left [simp]: "0 *s x = 0"
  and scale_minus_left [simp]: "(- a) *s x = - (a *s x)"
  and scale_left_diff_distrib [algebra_simps, algebra_split_simps]:
    "(a - b) *s x = a *s x - b *s x"
  and scale_sum_left: "(sum f A) *s x = (\<Sum>a\<in>A. (f a) *s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) *s x = (0::'b) &&& - a *s x = - (a *s x)) &&& (a - b) *s x = a *s x - b *s x &&& sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (0::'a) *s x = (0::'b)
 2. - a *s x = - (a *s x)
 3. (a - b) *s x = a *s x - b *s x
 4. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
interpret s: additive "\<lambda>a. a *s x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. additive (\<lambda>a. a *s x)
[PROOF STEP]
by standard (rule scale_left_distrib)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (0::'a) *s x = (0::'b)
 2. - a *s x = - (a *s x)
 3. (a - b) *s x = a *s x - b *s x
 4. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
show "0 *s x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) *s x = (0::'b)
[PROOF STEP]
by (rule s.zero)
[PROOF STATE]
proof (state)
this:
(0::'a) *s x = (0::'b)

goal (3 subgoals):
 1. - a *s x = - (a *s x)
 2. (a - b) *s x = a *s x - b *s x
 3. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
show "(- a) *s x = - (a *s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a *s x = - (a *s x)
[PROOF STEP]
by (rule s.minus)
[PROOF STATE]
proof (state)
this:
- a *s x = - (a *s x)

goal (2 subgoals):
 1. (a - b) *s x = a *s x - b *s x
 2. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
show "(a - b) *s x = a *s x - b *s x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b) *s x = a *s x - b *s x
[PROOF STEP]
by (rule s.diff)
[PROOF STATE]
proof (state)
this:
(a - b) *s x = a *s x - b *s x

goal (1 subgoal):
 1. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
show "(sum f A) *s x = (\<Sum>a\<in>A. (f a) *s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
by (rule s.sum)
[PROOF STATE]
proof (state)
this:
sum f A *s x = (\<Sum>a\<in>A. f a *s x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enn2real_INF: "\<lbrakk> A \<noteq> {}; \<forall>x\<in>A. f x < \<top> \<rbrakk> \<Longrightarrow> enn2real (INF x\<in>A. f x) = (INF x\<in>A. enn2real (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> enn2real (\<Sqinter> (f ` A)) = (\<Sqinter>x\<in>A. enn2real (f x))
[PROOF STEP]
apply(rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> enn2real (\<Sqinter> (f ` A)) \<le> (\<Sqinter>x\<in>A. enn2real (f x))
 2. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> (\<Sqinter>x\<in>A. enn2real (f x)) \<le> enn2real (\<Sqinter> (f ` A))
[PROOF STEP]
apply(rule cINF_greatest)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> A \<noteq> {}
 2. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> enn2real (\<Sqinter> (f ` A)) \<le> enn2real (f x)
 3. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> (\<Sqinter>x\<in>A. enn2real (f x)) \<le> enn2real (\<Sqinter> (f ` A))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> enn2real (\<Sqinter> (f ` A)) \<le> enn2real (f x)
 2. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> (\<Sqinter>x\<in>A. enn2real (f x)) \<le> enn2real (\<Sqinter> (f ` A))
[PROOF STEP]
apply(rule enn2real_mono)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> \<Sqinter> (f ` A) \<le> f x
 2. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> f x < \<top>
 3. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> (\<Sqinter>x\<in>A. enn2real (f x)) \<le> enn2real (\<Sqinter> (f ` A))
[PROOF STEP]
apply(erule INF_lower)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> f x < \<top>
 2. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> (\<Sqinter>x\<in>A. enn2real (f x)) \<le> enn2real (\<Sqinter> (f ` A))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> (\<Sqinter>x\<in>A. enn2real (f x)) \<le> enn2real (\<Sqinter> (f ` A))
[PROOF STEP]
apply(rule le_enn2realI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> ennreal (\<Sqinter>x\<in>A. enn2real (f x)) \<le> \<Sqinter> (f ` A)
 2. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; \<Sqinter> (f ` A) = \<top>\<rbrakk> \<Longrightarrow> (\<Sqinter>x\<in>A. enn2real (f x)) \<le> 0
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>\<rbrakk> \<Longrightarrow> ennreal (\<Sqinter>x\<in>A. enn2real (f x)) \<le> \<Sqinter> (f ` A)
[PROOF STEP]
apply(rule INF_greatest)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> ennreal (\<Sqinter>x\<in>A. enn2real (f x)) \<le> f x
[PROOF STEP]
apply(rule ennreal_leI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> (\<Sqinter>x\<in>A. enn2real (f x)) \<le> enn2real (f x)
[PROOF STEP]
apply(rule cINF_lower)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> bdd_below ((\<lambda>x. enn2real (f x)) ` A)
 2. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
apply(rule bdd_belowI[where m=0])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A; xa \<in> (\<lambda>x. enn2real (f x)) ` A\<rbrakk> \<Longrightarrow> 0 \<le> xa
 2. \<And>x. \<lbrakk>A \<noteq> {}; \<forall>x\<in>A. f x < \<top>; x \<in> A\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nat_prod_le: "m \<noteq> (0 :: nat) \<Longrightarrow> m*n \<le> k \<Longrightarrow> n \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<noteq> 0; m * n \<le> k\<rbrakk> \<Longrightarrow> n \<le> k
[PROOF STEP]
using le_trans[of n "m*n" k]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n \<le> m * n; m * n \<le> k\<rbrakk> \<Longrightarrow> n \<le> k

goal (1 subgoal):
 1. \<lbrakk>m \<noteq> 0; m * n \<le> k\<rbrakk> \<Longrightarrow> n \<le> k
[PROOF STEP]
by auto


[STATEMENT]
lemma eval_euler_approx_aux:
  "euler_approx_aux 0 = 1"
  "euler_approx_aux 1 = 2"
  "euler_approx_aux (Suc 0) = 2"
  "euler_approx_aux (numeral n) = 1 + numeral n * euler_approx_aux (pred_numeral n)" (is "?th")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (euler_approx_aux 0 = 1 &&& euler_approx_aux 1 = 2) &&& euler_approx_aux (Suc 0) = 2 &&& euler_approx_aux (numeral n) = 1 + numeral n * euler_approx_aux (pred_numeral n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. euler_approx_aux 0 = 1
 2. euler_approx_aux 1 = 2
 3. euler_approx_aux (Suc 0) = 2
 4. euler_approx_aux (numeral n) = 1 + numeral n * euler_approx_aux (pred_numeral n)
[PROOF STEP]
have A: "euler_approx_aux (Suc m) = 1 + Suc m * euler_approx_aux m" for m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euler_approx_aux (Suc m) = 1 + Suc m * euler_approx_aux m
[PROOF STEP]
unfolding euler_approx_aux_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>Suc m. \<Prod>{k + 1..Suc m}) = 1 + Suc m * (\<Sum>k\<le>m. \<Prod>{k + 1..m})
[PROOF STEP]
by (subst sum_distrib_left) (simp add: atLeastAtMostSuc_conv mult.commute)
[PROOF STATE]
proof (state)
this:
euler_approx_aux (Suc ?m) = 1 + Suc ?m * euler_approx_aux ?m

goal (4 subgoals):
 1. euler_approx_aux 0 = 1
 2. euler_approx_aux 1 = 2
 3. euler_approx_aux (Suc 0) = 2
 4. euler_approx_aux (numeral n) = 1 + numeral n * euler_approx_aux (pred_numeral n)
[PROOF STEP]
show ?th
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euler_approx_aux (numeral n) = 1 + numeral n * euler_approx_aux (pred_numeral n)
[PROOF STEP]
by (subst numeral_eq_Suc, subst A, subst numeral_eq_Suc [symmetric]) simp
[PROOF STATE]
proof (state)
this:
euler_approx_aux (numeral n) = 1 + numeral n * euler_approx_aux (pred_numeral n)

goal (3 subgoals):
 1. euler_approx_aux 0 = 1
 2. euler_approx_aux 1 = 2
 3. euler_approx_aux (Suc 0) = 2
[PROOF STEP]
qed (simp_all add: euler_approx_aux_def)


[STATEMENT]
lemma foldli_bex_aux:
    "distinct (map fst l) \<Longrightarrow> foldli l (\<lambda>x. \<not>x) (\<lambda>x _. P x) b
    \<longleftrightarrow> b \<or> op_map_bex (map_of l) P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map fst l) \<Longrightarrow> foldli l Not (\<lambda>x _. P x) b = (b \<or> op_map_bex (map_of l) P)
[PROOF STEP]
apply (induct l arbitrary: b)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. distinct (map fst []) \<Longrightarrow> foldli [] Not (\<lambda>x _. P x) b = (b \<or> op_map_bex (map_of []) P)
 2. \<And>a l b. \<lbrakk>\<And>b. distinct (map fst l) \<Longrightarrow> foldli l Not (\<lambda>x _. P x) b = (b \<or> op_map_bex (map_of l) P); distinct (map fst (a # l))\<rbrakk> \<Longrightarrow> foldli (a # l) Not (\<lambda>x _. P x) b = (b \<or> op_map_bex (map_of (a # l)) P)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l b. \<lbrakk>\<And>b. distinct (map fst l) \<Longrightarrow> foldli l Not (\<lambda>x _. P x) b = (b \<or> op_map_bex (map_of l) P); distinct (map fst (a # l))\<rbrakk> \<Longrightarrow> foldli (a # l) Not (\<lambda>x _. P x) b = (b \<or> op_map_bex (map_of (a # l)) P)
[PROOF STEP]
apply (force simp: map_to_set_map_of image_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma height_compose_list:  " t\<in> set treeList \<Longrightarrow>
 Max (height ` (insert summary (set treeList)))  \<ge>  height t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> set treeList \<Longrightarrow> height t \<le> Max (height ` insert summary (set treeList))
[PROOF STEP]
apply(induction treeList)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. t \<in> set [] \<Longrightarrow> height t \<le> Max (height ` insert summary (set []))
 2. \<And>a treeList. \<lbrakk>t \<in> set treeList \<Longrightarrow> height t \<le> Max (height ` insert summary (set treeList)); t \<in> set (a # treeList)\<rbrakk> \<Longrightarrow> height t \<le> Max (height ` insert summary (set (a # treeList)))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a treeList. \<lbrakk>t \<in> set treeList \<Longrightarrow> height t \<le> Max (height ` insert summary (set treeList)); t \<in> set (a # treeList)\<rbrakk> \<Longrightarrow> height t \<le> Max (height ` insert summary (set (a # treeList)))
[PROOF STEP]
by (meson List.finite_set Max_ge finite_imageI finite_insert image_eqI subsetD subset_insertI)


[STATEMENT]
lemma aff_dim_injective_linear_image [simp]:
  assumes "linear f" "inj f"
    shows "aff_dim (f ` S) = aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (f ` S) = aff_dim S
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. aff_dim (f ` S) \<le> aff_dim S
 2. aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
show "aff_dim (f ` S) \<le> aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (f ` S) \<le> aff_dim S
[PROOF STEP]
by (simp add: aff_dim_linear_image_le assms(1))
[PROOF STATE]
proof (state)
this:
aff_dim (f ` S) \<le> aff_dim S

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
obtain g where "linear g" "g \<circ> f = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>linear g; g \<circ> f = id\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1) assms(2) linear_injective_left_inverse
[PROOF STATE]
proof (prove)
using this:
linear f
inj f
\<lbrakk>linear ?f; inj ?f\<rbrakk> \<Longrightarrow> \<exists>g. linear g \<and> g \<circ> ?f = id

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>linear g; g \<circ> f = id\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linear g
g \<circ> f = id

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linear g
g \<circ> f = id
[PROOF STEP]
have "aff_dim S \<le> aff_dim(g ` f ` S)"
[PROOF STATE]
proof (prove)
using this:
linear g
g \<circ> f = id

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (g ` f ` S)
[PROOF STEP]
by (simp add: image_comp)
[PROOF STATE]
proof (state)
this:
aff_dim S \<le> aff_dim (g ` f ` S)

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
aff_dim S \<le> aff_dim (g ` f ` S)

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
have "... \<le> aff_dim (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (g ` f ` S) \<le> aff_dim (f ` S)
[PROOF STEP]
by (simp add: \<open>linear g\<close> aff_dim_linear_image_le)
[PROOF STATE]
proof (state)
this:
aff_dim (g ` f ` S) \<le> aff_dim (f ` S)

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
show "aff_dim S \<le> aff_dim (f ` S)"
[PROOF STATE]
proof (prove)
using this:
aff_dim S \<le> aff_dim (f ` S)

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (f ` S)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
aff_dim S \<le> aff_dim (f ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_derivative_sum[simp, derivative_intros]:
  "(\<And>i. i \<in> I \<Longrightarrow> (f i has_derivative f' i) F) \<Longrightarrow>
    ((\<lambda>x. \<Sum>i\<in>I. f i x) has_derivative (\<lambda>x. \<Sum>i\<in>I. f' i x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> (f i has_derivative f' i) F) \<Longrightarrow> ((\<lambda>x. \<Sum>i\<in>I. f i x) has_derivative (\<lambda>x. \<Sum>i\<in>I. f' i x)) F
[PROOF STEP]
by (induct I rule: infinite_finite_induct) simp_all


[STATEMENT]
lemma length_selsort[simp]: "length (selsort xs) = length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (selsort xs) = length xs
[PROOF STEP]
proof (induct xs rule: selsort.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (selsort []) = length []
 2. \<And>y ys. (\<And>x xa. \<lbrakk>x = fold min_for ys y; xa = remove1 x (y # ys)\<rbrakk> \<Longrightarrow> length (selsort xa) = length xa) \<Longrightarrow> length (selsort (y # ys)) = length (y # ys)
[PROOF STEP]
case (2 x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x = fold min_for xs x; ?xa = remove1 ?x (x # xs)\<rbrakk> \<Longrightarrow> length (selsort ?xa) = length ?xa

goal (2 subgoals):
 1. length (selsort []) = length []
 2. \<And>y ys. (\<And>x xa. \<lbrakk>x = fold min_for ys y; xa = remove1 x (y # ys)\<rbrakk> \<Longrightarrow> length (selsort xa) = length xa) \<Longrightarrow> length (selsort (y # ys)) = length (y # ys)
[PROOF STEP]
from 2[OF refl refl]
[PROOF STATE]
proof (chain)
picking this:
length (selsort (remove1 (fold min_for xs x) (x # xs))) = length (remove1 (fold min_for xs x) (x # xs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length (selsort (remove1 (fold min_for xs x) (x # xs))) = length (remove1 (fold min_for xs x) (x # xs))

goal (1 subgoal):
 1. length (selsort (x # xs)) = length (x # xs)
[PROOF STEP]
unfolding selsort.simps
[PROOF STATE]
proof (prove)
using this:
length (selsort (remove1 (fold min_for xs x) (x # xs))) = length (remove1 (fold min_for xs x) (x # xs))

goal (1 subgoal):
 1. length (let xm = fold min_for xs x; xs' = remove1 xm (x # xs) in xm # selsort xs') = length (x # xs)
[PROOF STEP]
by (auto simp: Let_def length_remove1
      simp del: selsort.simps split: if_split_asm
      intro!: Suc_pred
      dest!: fold_min_eqI1)
[PROOF STATE]
proof (state)
this:
length (selsort (x # xs)) = length (x # xs)

goal (1 subgoal):
 1. length (selsort []) = length []
[PROOF STEP]
qed simp


[STATEMENT]
lemma ex_MAXIMUM: assumes "finite A" "A \<noteq> {}"
  shows "\<exists>a \<in> A. Max (f ` A) = f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a\<in>A. Max (f ` A) = f a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a\<in>A. Max (f ` A) = f a
[PROOF STEP]
have "Max (f ` A) \<in> f ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (f ` A) \<in> f ` A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. Max (f ` A) \<in> f ` A
[PROOF STEP]
by (auto intro!: Max_in)
[PROOF STATE]
proof (state)
this:
Max (f ` A) \<in> f ` A

goal (1 subgoal):
 1. \<exists>a\<in>A. Max (f ` A) = f a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Max (f ` A) \<in> f ` A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Max (f ` A) \<in> f ` A

goal (1 subgoal):
 1. \<exists>a\<in>A. Max (f ` A) = f a
[PROOF STEP]
using assms imageE
[PROOF STATE]
proof (prove)
using this:
Max (f ` A) \<in> f ` A
finite A
A \<noteq> {}
\<lbrakk>?b \<in> ?f ` ?A; \<And>x. \<lbrakk>?b = ?f x; x \<in> ?A\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<exists>a\<in>A. Max (f ` A) = f a
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>A. Max (f ` A) = f a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_at_left_real_increasing:
  assumes nondecF: "\<And> x y. x \<le> y \<Longrightarrow> f x \<le> ((f y) :: real)"
  shows "(continuous (at_left (a :: real)) f) = (\<forall>e > 0. \<exists>delta > 0. f a - f (a - delta) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at_left a) f = (\<forall>e>0. \<exists>delta>0. f a - f (a - delta) < e)
[PROOF STEP]
apply (simp add: lessThan_def dist_real_def continuous_within Lim_within_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>d>0. \<forall>x<a. a - x \<le> d \<longrightarrow> \<bar>f x - f a\<bar> < e) = (\<forall>e>0. \<exists>delta>0. f a - f (a - delta) < e)
[PROOF STEP]
apply (intro all_cong ex_cong, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>e d. \<lbrakk>0 < e; 0 < d; \<forall>x<a. a - x \<le> d \<longrightarrow> \<bar>f x - f a\<bar> < e\<rbrakk> \<Longrightarrow> f a - f (a - d) < e
 2. \<And>e d x. \<lbrakk>0 < e; 0 < d; f a - f (a - d) < e; x < a; a - x \<le> d\<rbrakk> \<Longrightarrow> \<bar>f x - f a\<bar> < e
[PROOF STEP]
apply (erule_tac x="a - d" in allE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e d x. \<lbrakk>0 < e; 0 < d; f a - f (a - d) < e; x < a; a - x \<le> d\<rbrakk> \<Longrightarrow> \<bar>f x - f a\<bar> < e
[PROOF STEP]
apply (simp add: nondecF field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e d x. \<lbrakk>0 < e; f a < e + f (a - d); x < a; a \<le> d + x\<rbrakk> \<Longrightarrow> f a < e + f x
[PROOF STEP]
apply (cut_tac x="a - d" and y=x in nondecF, simp_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma LeadsTo_Trans_Un:
     "[| F \<in> A LeadsTo B;  F \<in> B LeadsTo C |]
      ==> F \<in> (A \<union> B) LeadsTo C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> A \<longmapsto>w B; F \<in> B \<longmapsto>w C\<rbrakk> \<Longrightarrow> F \<in> A \<union> B \<longmapsto>w C
[PROOF STEP]
by (blast intro: LeadsTo_Un subset_imp_LeadsTo LeadsTo_weaken_L LeadsTo_Trans)


[STATEMENT]
lemma set_encode_eq: "finite A \<Longrightarrow> finite B \<Longrightarrow> set_encode A = set_encode B \<longleftrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B\<rbrakk> \<Longrightarrow> (set_encode A = set_encode B) = (A = B)
[PROOF STEP]
by (rule iffI) (simp_all add: inj_onD [OF inj_on_set_encode])


[STATEMENT]
lemma minus_in_intervalI:
  fixes x y :: "'a :: ordered_ab_group_add"
  shows "x \<in>\<^sub>i X \<Longrightarrow> y \<in>\<^sub>i Y \<Longrightarrow> x - y \<in>\<^sub>i X - Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in>\<^sub>i X; y \<in>\<^sub>i Y\<rbrakk> \<Longrightarrow> x - y \<in>\<^sub>i X - Y
[PROOF STEP]
by (metis diff_conv_add_uminus minus_interval_def plus_in_intervalI uminus_in_intervalI)


[STATEMENT]
lemma le_take_pref: assumes "k \<le> n" shows "take k ws \<le>p take n ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take k ws \<le>p take n ws
[PROOF STEP]
using take_add[of k "(n-k)" ws, unfolded le_add_diff_inverse[OF \<open>k \<le> n\<close>]]
[PROOF STATE]
proof (prove)
using this:
take n ws = take k ws \<cdot> take (n - k) (drop k ws)

goal (1 subgoal):
 1. take k ws \<le>p take n ws
[PROOF STEP]
by force


[STATEMENT]
lemma wordinterval_lowest_none_empty: "wordinterval_lowest_element r = None \<longleftrightarrow> wordinterval_empty r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (wordinterval_lowest_element r = None) = wordinterval_empty r
[PROOF STEP]
proof(induction r)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x1 x2. (wordinterval_lowest_element (WordInterval x1 x2) = None) = wordinterval_empty (WordInterval x1 x2)
 2. \<And>r1 r2. \<lbrakk>(wordinterval_lowest_element r1 = None) = wordinterval_empty r1; (wordinterval_lowest_element r2 = None) = wordinterval_empty r2\<rbrakk> \<Longrightarrow> (wordinterval_lowest_element (RangeUnion r1 r2) = None) = wordinterval_empty (RangeUnion r1 r2)
[PROOF STEP]
case WordInterval
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x1 x2. (wordinterval_lowest_element (WordInterval x1 x2) = None) = wordinterval_empty (WordInterval x1 x2)
 2. \<And>r1 r2. \<lbrakk>(wordinterval_lowest_element r1 = None) = wordinterval_empty r1; (wordinterval_lowest_element r2 = None) = wordinterval_empty r2\<rbrakk> \<Longrightarrow> (wordinterval_lowest_element (RangeUnion r1 r2) = None) = wordinterval_empty (RangeUnion r1 r2)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (wordinterval_lowest_element (WordInterval x1_ x2_) = None) = wordinterval_empty (WordInterval x1_ x2_)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(wordinterval_lowest_element (WordInterval x1_ x2_) = None) = wordinterval_empty (WordInterval x1_ x2_)

goal (1 subgoal):
 1. \<And>r1 r2. \<lbrakk>(wordinterval_lowest_element r1 = None) = wordinterval_empty r1; (wordinterval_lowest_element r2 = None) = wordinterval_empty r2\<rbrakk> \<Longrightarrow> (wordinterval_lowest_element (RangeUnion r1 r2) = None) = wordinterval_empty (RangeUnion r1 r2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r1 r2. \<lbrakk>(wordinterval_lowest_element r1 = None) = wordinterval_empty r1; (wordinterval_lowest_element r2 = None) = wordinterval_empty r2\<rbrakk> \<Longrightarrow> (wordinterval_lowest_element (RangeUnion r1 r2) = None) = wordinterval_empty (RangeUnion r1 r2)
[PROOF STEP]
case RangeUnion
[PROOF STATE]
proof (state)
this:
(wordinterval_lowest_element r1_ = None) = wordinterval_empty r1_
(wordinterval_lowest_element r2_ = None) = wordinterval_empty r2_

goal (1 subgoal):
 1. \<And>r1 r2. \<lbrakk>(wordinterval_lowest_element r1 = None) = wordinterval_empty r1; (wordinterval_lowest_element r2 = None) = wordinterval_empty r2\<rbrakk> \<Longrightarrow> (wordinterval_lowest_element (RangeUnion r1 r2) = None) = wordinterval_empty (RangeUnion r1 r2)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(wordinterval_lowest_element r1_ = None) = wordinterval_empty r1_
(wordinterval_lowest_element r2_ = None) = wordinterval_empty r2_

goal (1 subgoal):
 1. (wordinterval_lowest_element (RangeUnion r1_ r2_) = None) = wordinterval_empty (RangeUnion r1_ r2_)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(wordinterval_lowest_element (RangeUnion r1_ r2_) = None) = wordinterval_empty (RangeUnion r1_ r2_)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frechet_derivative_componentwise:
  "frechet_derivative f (at a) v = (\<Sum>i\<in>Basis. (v \<bullet> i) * (frechet_derivative f (at a) i))"
  if "f differentiable at a"
  for f::"'a::euclidean_space \<Rightarrow> real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frechet_derivative f (at a) v = (\<Sum>i\<in>Basis. v \<bullet> i * frechet_derivative f (at a) i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. frechet_derivative f (at a) v = (\<Sum>i\<in>Basis. v \<bullet> i * frechet_derivative f (at a) i)
[PROOF STEP]
have "linear (frechet_derivative f (at a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (frechet_derivative f (at a))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
f differentiable at a

goal (1 subgoal):
 1. linear (frechet_derivative f (at a))
[PROOF STEP]
by (rule linear_frechet_derivative)
[PROOF STATE]
proof (state)
this:
linear (frechet_derivative f (at a))

goal (1 subgoal):
 1. frechet_derivative f (at a) v = (\<Sum>i\<in>Basis. v \<bullet> i * frechet_derivative f (at a) i)
[PROOF STEP]
from Linear_Algebra.linear_componentwise[OF this, of v 1]
[PROOF STATE]
proof (chain)
picking this:
frechet_derivative f (at a) v \<bullet> 1 = (\<Sum>i\<in>Basis. v \<bullet> i * (frechet_derivative f (at a) i \<bullet> 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
frechet_derivative f (at a) v \<bullet> 1 = (\<Sum>i\<in>Basis. v \<bullet> i * (frechet_derivative f (at a) i \<bullet> 1))

goal (1 subgoal):
 1. frechet_derivative f (at a) v = (\<Sum>i\<in>Basis. v \<bullet> i * frechet_derivative f (at a) i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
frechet_derivative f (at a) v = (\<Sum>i\<in>Basis. v \<bullet> i * frechet_derivative f (at a) i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in is_functor) cf_umap_fo_is_arr:
  assumes "category \<alpha> \<AA>"
    and "category \<alpha> \<BB>"
    and "r \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
    and "d \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
    and "u : \<FF>\<lparr>ObjMap\<rparr>\<lparr>r\<rparr> \<mapsto>\<^bsub>\<BB>\<^esub> c"
  shows "umap_fo \<FF> c r u d : Hom \<AA> d r \<mapsto>\<^bsub>cat_Set \<alpha>\<^esub> Hom \<BB> (\<FF>\<lparr>ObjMap\<rparr>\<lparr>d\<rparr>) c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. umap_fo \<FF> c r u d : Hom \<AA> d r \<mapsto>\<^bsub>cat_Set \<alpha>\<^esub> Hom \<BB> (\<FF>\<lparr>ObjMap\<rparr>\<lparr>d\<rparr>) c
[PROOF STEP]
proof(intro cat_Set_is_arrI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. arr_Set \<alpha> (umap_fo \<FF> c r u d)
 2. umap_fo \<FF> c r u d\<lparr>ArrDom\<rparr> = Hom \<AA> d r
 3. umap_fo \<FF> c r u d\<lparr>ArrCod\<rparr> = Hom \<BB> (\<FF>\<lparr>ObjMap\<rparr>\<lparr>d\<rparr>) c
[PROOF STEP]
show "arr_Set \<alpha> (umap_fo \<FF> c r u d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr_Set \<alpha> (umap_fo \<FF> c r u d)
[PROOF STEP]
by (rule cf_arr_Set_umap_fo[OF assms])
[PROOF STATE]
proof (state)
this:
arr_Set \<alpha> (umap_fo \<FF> c r u d)

goal (2 subgoals):
 1. umap_fo \<FF> c r u d\<lparr>ArrDom\<rparr> = Hom \<AA> d r
 2. umap_fo \<FF> c r u d\<lparr>ArrCod\<rparr> = Hom \<BB> (\<FF>\<lparr>ObjMap\<rparr>\<lparr>d\<rparr>) c
[PROOF STEP]
qed (simp_all add: umap_fo_components[OF assms(5)])


[STATEMENT]
lemma ln_Gamma_stirling_complex:
  assumes "m > 0"
  shows   "ln_Gamma s = (s - 1 / 2) * ln s - s + ln (2 * pi) / 2 +
             (\<Sum>k=1..<m. of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) -
             stirling_integral m s / of_nat m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) + (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) - stirling_integral m s / of_nat m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) + (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) - stirling_integral m s / of_nat m
[PROOF STEP]
have "ln_Gamma s = (s - 1 / 2) * ln s - s + ln (2 * pi) / 2 - stirling_integral 1 s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) - stirling_integral 1 s
[PROOF STEP]
using limI[OF integral_pbernpoly_1]
[PROOF STATE]
proof (prove)
using this:
lim (\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly 1 x) / (complex_of_real x + s))) = - ln_Gamma s - s + (s - 1 / 2) * Ln s + complex_of_real (ln (2 * pi) / 2)

goal (1 subgoal):
 1. ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) - stirling_integral 1 s
[PROOF STEP]
by (simp add: stirling_integral_def algebra_simps)
[PROOF STATE]
proof (state)
this:
ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) - stirling_integral 1 s

goal (1 subgoal):
 1. ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) + (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) - stirling_integral m s / of_nat m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) - stirling_integral 1 s

goal (1 subgoal):
 1. ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) + (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) - stirling_integral m s / of_nat m
[PROOF STEP]
have "stirling_integral 1 s = stirling_integral m s / of_nat m -
               (\<Sum>k = 1..<m. of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
by (rule stirling_integral_1_unfold)
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (1 subgoal):
 1. ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) + (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) - stirling_integral m s / of_nat m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) - (stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) - (stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)))

goal (1 subgoal):
 1. ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) + (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) - stirling_integral m s / of_nat m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln_Gamma s = (s - 1 / 2) * Ln s - s + complex_of_real (ln (2 * pi) / 2) + (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) - stirling_integral m s / of_nat m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fvi_trm_iff_fv_trm: "x \<in> fvi_trm b t \<longleftrightarrow> x + b \<in> fv_trm t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> fvi_trm b t) = (x + b \<in> fv_trm t)
[PROOF STEP]
using fvi_trm_plus[where b=0 and c=b]
[PROOF STATE]
proof (prove)
using this:
(?x \<in> fvi_trm (0 + b) ?t) = (?x + b \<in> fv_trm ?t)

goal (1 subgoal):
 1. (x \<in> fvi_trm b t) = (x + b \<in> fv_trm t)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma primes_omega_primorial' [simp]: "primes_omega (primorial' k) = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primes_omega (primorial' k) = k
[PROOF STEP]
unfolding primes_omega_def prime_factors_primorial'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (nth_prime ` {..<k}) = k
[PROOF STEP]
by (subst card_image) (auto intro: inj_onI)


[STATEMENT]
lemma filtermap_linear_at_right:
  fixes c::"'a::{linordered_field,linorder_topology,real_normed_field}"
  assumes "c\<noteq>0"
  shows "filtermap (\<lambda>x. c*x+b) (at_right x) = (if c>0 then at_right (c*x+b) else at_left (c*x+b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
let ?f = "\<lambda>x. c*x+b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
have "filtermap ?f (at_right x) = (at (?f x) within ?f ` {x<..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}
[PROOF STEP]
proof (subst filtermap_linear_at_within)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. bij (\<lambda>x. c * x + b)
 2. isCont (\<lambda>x. c * x + b) x
 3. \<And>S. open S \<Longrightarrow> open ((\<lambda>x. c * x + b) ` S)
 4. at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..} = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}
[PROOF STEP]
show "bij ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij (\<lambda>x. c * x + b)
[PROOF STEP]
using \<open>c\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. bij (\<lambda>x. c * x + b)
[PROOF STEP]
by (auto intro!: o_bij[of "\<lambda>x. (x-b)/c"])
[PROOF STATE]
proof (state)
this:
bij (\<lambda>x. c * x + b)

goal (3 subgoals):
 1. isCont (\<lambda>x. c * x + b) x
 2. \<And>S. open S \<Longrightarrow> open ((\<lambda>x. c * x + b) ` S)
 3. at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..} = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}
[PROOF STEP]
show "isCont ?f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>x. c * x + b) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>x. c * x + b) x

goal (2 subgoals):
 1. \<And>S. open S \<Longrightarrow> open ((\<lambda>x. c * x + b) ` S)
 2. at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..} = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}
[PROOF STEP]
show "\<And>S. open S \<Longrightarrow> open (?f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. open S \<Longrightarrow> open ((\<lambda>x. c * x + b) ` S)
[PROOF STEP]
using open_times_image[OF _ \<open>c\<noteq>0\<close>,THEN open_translation,of _ b]
[PROOF STATE]
proof (prove)
using this:
open ?S1 \<Longrightarrow> open ((+) b ` (*) c ` ?S1)

goal (1 subgoal):
 1. \<And>S. open S \<Longrightarrow> open ((\<lambda>x. c * x + b) ` S)
[PROOF STEP]
by (simp add:image_image add.commute)
[PROOF STATE]
proof (state)
this:
open ?S \<Longrightarrow> open ((\<lambda>x. c * x + b) ` ?S)

goal (1 subgoal):
 1. at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..} = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}
[PROOF STEP]
show "at (?f x) within ?f ` {x<..} = at (?f x) within ?f ` {x<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..} = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..} = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
filtermap (\<lambda>x. c * x + b) (at_right x) = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}

goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
filtermap (\<lambda>x. c * x + b) (at_right x) = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}

goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
have "?f ` {x<..} =  {?f x<..}" when "c>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c * x + b) ` {x<..} = {c * x + b<..}
[PROOF STEP]
using image_linear_greaterThan[OF \<open>c\<noteq>0\<close>,of b x] that
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. c * x + b) ` {x<..} = (if (0::'a) < c then {c * x + b<..} else {..<c * x + b})
(0::'a) < c

goal (1 subgoal):
 1. (\<lambda>x. c * x + b) ` {x<..} = {c * x + b<..}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) < c \<Longrightarrow> (\<lambda>x. c * x + b) ` {x<..} = {c * x + b<..}

goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(0::'a) < c \<Longrightarrow> (\<lambda>x. c * x + b) ` {x<..} = {c * x + b<..}

goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
have "?f ` {x<..} =  {..<?f x}" when "\<not> c>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c * x + b) ` {x<..} = {..<c * x + b}
[PROOF STEP]
using image_linear_greaterThan[OF \<open>c\<noteq>0\<close>,of b x] that
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. c * x + b) ` {x<..} = (if (0::'a) < c then {c * x + b<..} else {..<c * x + b})
\<not> (0::'a) < c

goal (1 subgoal):
 1. (\<lambda>x. c * x + b) ` {x<..} = {..<c * x + b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> (0::'a) < c \<Longrightarrow> (\<lambda>x. c * x + b) ` {x<..} = {..<c * x + b}

goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
filtermap (\<lambda>x. c * x + b) (at_right x) = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}
(0::'a) < c \<Longrightarrow> (\<lambda>x. c * x + b) ` {x<..} = {c * x + b<..}
\<not> (0::'a) < c \<Longrightarrow> (\<lambda>x. c * x + b) ` {x<..} = {..<c * x + b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
filtermap (\<lambda>x. c * x + b) (at_right x) = at (c * x + b) within (\<lambda>x. c * x + b) ` {x<..}
(0::'a) < c \<Longrightarrow> (\<lambda>x. c * x + b) ` {x<..} = {c * x + b<..}
\<not> (0::'a) < c \<Longrightarrow> (\<lambda>x. c * x + b) ` {x<..} = {..<c * x + b}

goal (1 subgoal):
 1. filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filtermap (\<lambda>x. c * x + b) (at_right x) = (if (0::'a) < c then at_right (c * x + b) else at_left (c * x + b))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_add_comm [simp]: "(f::('a,'b::ab_semigroup_add) fps) + g = g + f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f + g = g + f
[PROOF STEP]
unfolding plus_fps_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_fps (\<lambda>n. f $ n + g $ n) = Abs_fps (\<lambda>n. g $ n + f $ n)
[PROOF STEP]
by (simp add: add.commute)


[STATEMENT]
lemma arbitrary_intersection_of_Un_eq:
   "(\<forall>S T. (arbitrary intersection_of P) S \<and> (arbitrary intersection_of P) T
               \<longrightarrow> (arbitrary intersection_of P) (S \<union> T)) \<longleftrightarrow>
        (\<forall>S T. P S \<and> P T \<longrightarrow> (arbitrary intersection_of P) (S \<union> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>S T. (arbitrary intersection_of P) S \<and> (arbitrary intersection_of P) T \<longrightarrow> (arbitrary intersection_of P) (S \<union> T)) = (\<forall>S T. P S \<and> P T \<longrightarrow> (arbitrary intersection_of P) (S \<union> T))
[PROOF STEP]
apply (simp add: arbitrary_intersection_of_complement)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>S T. (arbitrary union_of (\<lambda>S. P (- S))) (- S) \<and> (arbitrary union_of (\<lambda>S. P (- S))) (- T) \<longrightarrow> (arbitrary union_of (\<lambda>S. P (- S))) (- S \<inter> - T)) = (\<forall>S T. P S \<and> P T \<longrightarrow> (arbitrary union_of (\<lambda>S. P (- S))) (- S \<inter> - T))
[PROOF STEP]
using arbitrary_union_of_Int_eq [of "\<lambda>S. P (- S)"]
[PROOF STATE]
proof (prove)
using this:
(\<forall>S T. (arbitrary union_of (\<lambda>S. P (- S))) S \<and> (arbitrary union_of (\<lambda>S. P (- S))) T \<longrightarrow> (arbitrary union_of (\<lambda>S. P (- S))) (S \<inter> T)) = (\<forall>S T. P (- S) \<and> P (- T) \<longrightarrow> (arbitrary union_of (\<lambda>S. P (- S))) (S \<inter> T))

goal (1 subgoal):
 1. (\<forall>S T. (arbitrary union_of (\<lambda>S. P (- S))) (- S) \<and> (arbitrary union_of (\<lambda>S. P (- S))) (- T) \<longrightarrow> (arbitrary union_of (\<lambda>S. P (- S))) (- S \<inter> - T)) = (\<forall>S T. P S \<and> P T \<longrightarrow> (arbitrary union_of (\<lambda>S. P (- S))) (- S \<inter> - T))
[PROOF STEP]
by (metis (no_types, lifting) arbitrary_def double_compl union_of_inc)


[STATEMENT]
lemma lran_eq_iff: "lran a l h = lran a' l h \<longleftrightarrow> (\<forall>i. l\<le>i \<and> i<h \<longrightarrow> a i = a' i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lran a l h = lran a' l h) = (\<forall>i. l \<le> i \<and> i < h \<longrightarrow> a i = a' i)
[PROOF STEP]
apply (induction a l h rule: lran.induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l h. (l < h \<Longrightarrow> (lran a (l + 1) h = lran a' (l + 1) h) = (\<forall>i. l + 1 \<le> i \<and> i < h \<longrightarrow> a i = a' i)) \<Longrightarrow> (lran a l h = lran a' l h) = (\<forall>i. l \<le> i \<and> i < h \<longrightarrow> a i = a' i)
[PROOF STEP]
apply (rewrite in "\<hole> = _" lran.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l h. (l < h \<Longrightarrow> (lran a (l + 1) h = lran a' (l + 1) h) = (\<forall>i. l + 1 \<le> i \<and> i < h \<longrightarrow> a i = a' i)) \<Longrightarrow> ((if l < h then a l # lran a (l + 1) h else []) = lran a' l h) = (\<forall>i. l \<le> i \<and> i < h \<longrightarrow> a i = a' i)
[PROOF STEP]
apply (rewrite in "_ = \<hole>" lran.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l h. (l < h \<Longrightarrow> (lran a (l + 1) h = lran a' (l + 1) h) = (\<forall>i. l + 1 \<le> i \<and> i < h \<longrightarrow> a i = a' i)) \<Longrightarrow> ((if l < h then a l # lran a (l + 1) h else []) = (if l < h then a' l # lran a' (l + 1) h else [])) = (\<forall>i. l \<le> i \<and> i < h \<longrightarrow> a i = a' i)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l h i. \<lbrakk>tl (lran a l h) = tl (lran a' l h); a l = a' l; \<forall>i. l + 1 \<le> i \<and> i < h \<longrightarrow> a i = a' i; l \<le> i; i < h\<rbrakk> \<Longrightarrow> a i = a' i
[PROOF STEP]
by (metis antisym_conv not_less zless_imp_add1_zle)


[STATEMENT]
lemma ex_card:
  assumes "n \<le> card A"
  shows "\<exists>S\<subseteq>A. card S = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
proof (cases "finite A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
 2. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. finite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
 2. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
from ex_bij_betw_nat_finite[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>h. bij_betw h {0..<card A} A
[PROOF STEP]
obtain f where f: "bij_betw f {0..<card A} A"
[PROOF STATE]
proof (prove)
using this:
\<exists>h. bij_betw h {0..<card A} A

goal (1 subgoal):
 1. (\<And>f. bij_betw f {0..<card A} A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
bij_betw f {0..<card A} A

goal (2 subgoals):
 1. finite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
 2. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bij_betw f {0..<card A} A

goal (2 subgoals):
 1. finite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
 2. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
from f \<open>n \<le> card A\<close>
[PROOF STATE]
proof (chain)
picking this:
bij_betw f {0..<card A} A
n \<le> card A
[PROOF STEP]
have "{..< n} \<subseteq> {..< card A}" "inj_on f {..< n}"
[PROOF STATE]
proof (prove)
using this:
bij_betw f {0..<card A} A
n \<le> card A

goal (1 subgoal):
 1. {..<n} \<subseteq> {..<card A} &&& inj_on f {..<n}
[PROOF STEP]
by (auto simp: bij_betw_def intro: subset_inj_on)
[PROOF STATE]
proof (state)
this:
{..<n} \<subseteq> {..<card A}
inj_on f {..<n}

goal (2 subgoals):
 1. finite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
 2. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bij_betw f {0..<card A} A
{..<n} \<subseteq> {..<card A}
inj_on f {..<n}
[PROOF STEP]
have "f ` {..< n} \<subseteq> A" "card (f ` {..< n}) = n"
[PROOF STATE]
proof (prove)
using this:
bij_betw f {0..<card A} A
{..<n} \<subseteq> {..<card A}
inj_on f {..<n}

goal (1 subgoal):
 1. f ` {..<n} \<subseteq> A &&& card (f ` {..<n}) = n
[PROOF STEP]
by (auto simp: bij_betw_def card_image)
[PROOF STATE]
proof (state)
this:
f ` {..<n} \<subseteq> A
card (f ` {..<n}) = n

goal (2 subgoals):
 1. finite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
 2. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ` {..<n} \<subseteq> A
card (f ` {..<n}) = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` {..<n} \<subseteq> A
card (f ` {..<n}) = n

goal (1 subgoal):
 1. \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>S\<subseteq>A. card S = n

goal (1 subgoal):
 1. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite A

goal (1 subgoal):
 1. infinite A \<Longrightarrow> \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
with \<open>n \<le> card A\<close>
[PROOF STATE]
proof (chain)
picking this:
n \<le> card A
infinite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<le> card A
infinite A

goal (1 subgoal):
 1. \<exists>S\<subseteq>A. card S = n
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>S\<subseteq>A. card S = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linord_of_list_total_on:
  shows "total_on (set xs) (linord_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. total_on (set xs) (linord_of_list xs)
[PROOF STEP]
unfolding total_on_def linord_of_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. \<forall>y\<in>set xs. x \<noteq> y \<longrightarrow> (x, y) \<in> {(x, y). linord_of_listP x y xs} \<or> (y, x) \<in> {(x, y). linord_of_listP x y xs}
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma GreatestB_le:
fixes n :: \<open>nat\<close>
assumes \<open>x\<le>n\<close> and \<open>P x\<close>
shows \<open>x \<le> (GREATEST k. k\<le>n \<and> P k)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> (GREATEST k. k \<le> n \<and> P k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> (GREATEST k. k \<le> n \<and> P k)
[PROOF STEP]
have *: \<open>\<forall> y. y\<le>n \<and> P y \<longrightarrow> y<Suc n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. y \<le> n \<and> P y \<longrightarrow> y < Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y. y \<le> n \<and> P y \<longrightarrow> y < Suc n

goal (1 subgoal):
 1. x \<le> (GREATEST k. k \<le> n \<and> P k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>y. y \<le> n \<and> P y \<longrightarrow> y < Suc n
[PROOF STEP]
show \<open>x \<le> (GREATEST k. k\<le>n \<and> P k)\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>y. y \<le> n \<and> P y \<longrightarrow> y < Suc n

goal (1 subgoal):
 1. x \<le> (GREATEST k. k \<le> n \<and> P k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>y. y \<le> n \<and> P y \<longrightarrow> y < Suc n
x \<le> n
P x

goal (1 subgoal):
 1. x \<le> (GREATEST k. k \<le> n \<and> P k)
[PROOF STEP]
by (blast intro: Greatest_le_nat)
[PROOF STATE]
proof (state)
this:
x \<le> (GREATEST k. k \<le> n \<and> P k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tuple_partial_image_eq:
  assumes "as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "bs \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>)"
  assumes "x = as @ bs"
  shows "tuple_partial_image n fs x = ((function_tuple_eval Q\<^sub>p n fs) as)@bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tuple_partial_image n fs x = function_tuple_eval Q\<^sub>p n fs as @ bs
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. tuple_partial_image n fs x = function_tuple_eval Q\<^sub>p n fs as @ bs
[PROOF STEP]
have 0: "(take n x) = as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n x = as
[PROOF STEP]
by (metis append_eq_conv_conj assms(1) assms(3) cartesian_power_car_memE)
[PROOF STATE]
proof (state)
this:
take n x = as

goal (1 subgoal):
 1. tuple_partial_image n fs x = function_tuple_eval Q\<^sub>p n fs as @ bs
[PROOF STEP]
have 1: "drop n x = bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop n x = bs
[PROOF STEP]
by (metis "0" append_take_drop_id assms(3) same_append_eq)
[PROOF STATE]
proof (state)
this:
drop n x = bs

goal (1 subgoal):
 1. tuple_partial_image n fs x = function_tuple_eval Q\<^sub>p n fs as @ bs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tuple_partial_image n fs x = function_tuple_eval Q\<^sub>p n fs as @ bs
[PROOF STEP]
using assms 0 1
[PROOF STATE]
proof (prove)
using this:
as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
bs \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>)
x = as @ bs
take n x = as
drop n x = bs

goal (1 subgoal):
 1. tuple_partial_image n fs x = function_tuple_eval Q\<^sub>p n fs as @ bs
[PROOF STEP]
unfolding tuple_partial_image_def
[PROOF STATE]
proof (prove)
using this:
as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
bs \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>)
x = as @ bs
take n x = as
drop n x = bs

goal (1 subgoal):
 1. function_tuple_eval Q\<^sub>p n fs (take n x) @ drop n x = function_tuple_eval Q\<^sub>p n fs as @ bs
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
tuple_partial_image n fs x = function_tuple_eval Q\<^sub>p n fs as @ bs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma onorm_scaleC_left:
  fixes f :: "'a::complex_normed_vector"
  assumes f: "bounded_clinear r"
  shows "onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f
[PROOF STEP]
proof (cases "f = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = (0::'a) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f
 2. f \<noteq> (0::'a) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f
[PROOF STEP]
assume "f \<noteq> 0"
[PROOF STATE]
proof (state)
this:
f \<noteq> (0::'a)

goal (2 subgoals):
 1. f = (0::'a) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f
 2. f \<noteq> (0::'a) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. onorm (\<lambda>x. r x *\<^sub>C f) \<le> onorm r * norm f
 2. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
show "onorm (\<lambda>x. r x *\<^sub>C f) \<le> onorm r * norm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x *\<^sub>C f) \<le> onorm r * norm f
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
bounded_clinear r

goal (1 subgoal):
 1. onorm (\<lambda>x. r x *\<^sub>C f) \<le> onorm r * norm f
[PROOF STEP]
by (rule onorm_scaleC_left_lemma)
[PROOF STATE]
proof (state)
this:
onorm (\<lambda>x. r x *\<^sub>C f) \<le> onorm r * norm f

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
have bl1: "bounded_clinear (\<lambda>x. r x *\<^sub>C f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_clinear (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
by (metis bounded_clinear_scaleC_const f)
[PROOF STATE]
proof (state)
this:
bounded_clinear (\<lambda>x. r x *\<^sub>C f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
have x1:"bounded_clinear (\<lambda>x. r x * norm f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_clinear (\<lambda>x. r x * complex_of_real (norm f))
[PROOF STEP]
by (metis bounded_clinear_mult_const f)
[PROOF STATE]
proof (state)
this:
bounded_clinear (\<lambda>x. r x * complex_of_real (norm f))

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
have "onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) / norm f"
      if "onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * cmod (1 / complex_of_real (norm f))"
        and "f \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) / norm f
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * cmod (1 / complex_of_real (norm f))
f \<noteq> (0::'a)

goal (1 subgoal):
 1. onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) / norm f
[PROOF STEP]
by (metis complex_of_real_cmod complex_of_real_nn_iff field_class.field_divide_inverse
          inverse_eq_divide nice_ordered_field_class.zero_le_divide_1_iff norm_ge_zero of_real_1
          of_real_divide of_real_eq_iff)
[PROOF STATE]
proof (state)
this:
\<lbrakk>onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * cmod (1 / complex_of_real (norm f)); f \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) / norm f

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
hence "onorm r \<le> onorm (\<lambda>x. r x * norm f) * inverse (norm f)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * cmod (1 / complex_of_real (norm f)); f \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) / norm f

goal (1 subgoal):
 1. onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * inverse (norm f)
[PROOF STEP]
using \<open>f \<noteq> 0\<close> onorm_scaleC_left_lemma[OF x1, of "inverse (norm f)"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * cmod (1 / complex_of_real (norm f)); f \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) / norm f
f \<noteq> (0::'a)
onorm (\<lambda>x. (r x * complex_of_real (norm f)) *\<^sub>C complex_of_real (inverse (norm f))) \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * cmod (complex_of_real (inverse (norm f)))

goal (1 subgoal):
 1. onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * inverse (norm f)
[PROOF STEP]
by (simp add: inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * inverse (norm f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
onorm r \<le> onorm (\<lambda>x. r x * complex_of_real (norm f)) * inverse (norm f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
have "onorm (\<lambda>x. r x * norm f) \<le> onorm (\<lambda>x. r x *\<^sub>C f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x * complex_of_real (norm f)) \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
proof (rule onorm_bound)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> onorm (\<lambda>x. r x *\<^sub>C f)
 2. \<And>x. cmod (r x * complex_of_real (norm f)) \<le> onorm (\<lambda>x. r x *\<^sub>C f) * norm x
[PROOF STEP]
have "bounded_linear (\<lambda>x. r x *\<^sub>C f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
using bl1 bounded_clinear.bounded_linear
[PROOF STATE]
proof (prove)
using this:
bounded_clinear (\<lambda>x. r x *\<^sub>C f)
bounded_clinear ?f \<Longrightarrow> bounded_linear ?f

goal (1 subgoal):
 1. bounded_linear (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bounded_linear (\<lambda>x. r x *\<^sub>C f)

goal (2 subgoals):
 1. 0 \<le> onorm (\<lambda>x. r x *\<^sub>C f)
 2. \<And>x. cmod (r x * complex_of_real (norm f)) \<le> onorm (\<lambda>x. r x *\<^sub>C f) * norm x
[PROOF STEP]
thus "0 \<le> onorm (\<lambda>x. r x *\<^sub>C f)"
[PROOF STATE]
proof (prove)
using this:
bounded_linear (\<lambda>x. r x *\<^sub>C f)

goal (1 subgoal):
 1. 0 \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
by (rule Operator_Norm.onorm_pos_le)
[PROOF STATE]
proof (state)
this:
0 \<le> onorm (\<lambda>x. r x *\<^sub>C f)

goal (1 subgoal):
 1. \<And>x. cmod (r x * complex_of_real (norm f)) \<le> onorm (\<lambda>x. r x *\<^sub>C f) * norm x
[PROOF STEP]
show "cmod (r x * complex_of_real (norm f)) \<le> onorm (\<lambda>x. r x *\<^sub>C f) * norm x"
        for x :: 'b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (r x * complex_of_real (norm f)) \<le> onorm (\<lambda>x. r x *\<^sub>C f) * norm x
[PROOF STEP]
by (smt \<open>bounded_linear (\<lambda>x. r x *\<^sub>C f)\<close> complex_of_real_cmod complex_of_real_nn_iff
            complex_scaleC_def norm_ge_zero norm_scaleC of_real_eq_iff onorm)
[PROOF STATE]
proof (state)
this:
cmod (r ?x * complex_of_real (norm f)) \<le> onorm (\<lambda>x. r x *\<^sub>C f) * norm ?x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
onorm (\<lambda>x. r x * complex_of_real (norm f)) \<le> onorm (\<lambda>x. r x *\<^sub>C f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> x * inverse (norm f) \<le> y * inverse (norm f)) \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x *\<^sub>C f) * inverse (norm f)
[PROOF STEP]
show "onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x * inverse (norm f) \<le> y * inverse (norm f)) \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x *\<^sub>C f) * inverse (norm f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
using \<open>f \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x * inverse (norm f) \<le> y * inverse (norm f)) \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x *\<^sub>C f) * inverse (norm f)
f \<noteq> (0::'a)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)
[PROOF STEP]
by (simp add: inverse_eq_divide pos_le_divide_eq mult.commute)
[PROOF STATE]
proof (state)
this:
onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>C f)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f

goal (1 subgoal):
 1. f = (0::'a) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>C f) = onorm r * norm f
[PROOF STEP]
qed (simp add: onorm_zero)


[STATEMENT]
lemma six_divides_bernoulli_denom:
  assumes "even n" "n > 0"
  shows   "6 dvd bernoulli_denom n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 6 dvd bernoulli_denom n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 6 dvd bernoulli_denom n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
even n
0 < n
[PROOF STEP]
have "\<Prod>{2, 3} dvd \<Prod>{p. prime p \<and> (p - 1) dvd n}"
[PROOF STATE]
proof (prove)
using this:
even n
0 < n

goal (1 subgoal):
 1. \<Prod>{2, 3} dvd \<Prod>{p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
by (intro prod_dvd_prod_subset finite_bernoulli_denom_set) auto
[PROOF STATE]
proof (state)
this:
\<Prod>{2, 3} dvd \<Prod>{p. prime p \<and> p - 1 dvd n}

goal (1 subgoal):
 1. 6 dvd bernoulli_denom n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
even n
0 < n
\<Prod>{2, 3} dvd \<Prod>{p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
even n
0 < n
\<Prod>{2, 3} dvd \<Prod>{p. prime p \<and> p - 1 dvd n}

goal (1 subgoal):
 1. 6 dvd bernoulli_denom n
[PROOF STEP]
by (simp add: bernoulli_denom_even)
[PROOF STATE]
proof (state)
this:
6 dvd bernoulli_denom n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma index_of_c_pair_n_is_pr: "index_of_c_pair_n \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. index_of_c_pair_n \<in> PrimRec1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. index_of_c_pair_n \<in> PrimRec1
[PROOF STEP]
have "(\<lambda> x. index_of_id) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. index_of_id) \<in> PrimRec1
[PROOF STEP]
by (rule const_is_pr)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. index_of_id) \<in> PrimRec1

goal (1 subgoal):
 1. index_of_c_pair_n \<in> PrimRec1
[PROOF STEP]
with pair_by_index_is_pr index_of_const_is_pr
[PROOF STATE]
proof (chain)
picking this:
pair_by_index \<in> PrimRec2
index_of_const \<in> PrimRec1
(\<lambda>x. index_of_id) \<in> PrimRec1
[PROOF STEP]
have "(\<lambda> n. pair_by_index (index_of_const n) index_of_id) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
pair_by_index \<in> PrimRec2
index_of_const \<in> PrimRec1
(\<lambda>x. index_of_id) \<in> PrimRec1

goal (1 subgoal):
 1. (\<lambda>n. pair_by_index (index_of_const n) index_of_id) \<in> PrimRec1
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>n. pair_by_index (index_of_const n) index_of_id) \<in> PrimRec1

goal (1 subgoal):
 1. index_of_c_pair_n \<in> PrimRec1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. pair_by_index (index_of_const n) index_of_id) \<in> PrimRec1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. pair_by_index (index_of_const n) index_of_id) \<in> PrimRec1

goal (1 subgoal):
 1. index_of_c_pair_n \<in> PrimRec1
[PROOF STEP]
by (fold index_of_c_pair_n_def)
[PROOF STATE]
proof (state)
this:
index_of_c_pair_n \<in> PrimRec1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rroots: assumes "p \<noteq> 0" "degree p \<le> 2"
  shows "set (rroots p) = {x. poly p x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (rroots p) = {x. poly p x = 0}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
degree p \<le> 2

goal (1 subgoal):
 1. set (rroots p) = {x. poly p x = 0}
[PROOF STEP]
unfolding rroots_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
degree p \<le> 2

goal (1 subgoal):
 1. set (if p = 0 \<or> 2 < degree p then [] else if degree p = 0 then [] else if degree p = 1 then [roots1 p] else rroots2 p) = {x. poly p x = 0}
[PROOF STEP]
using roots0[of p] roots1[of p] rroots2[of p]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
degree p \<le> 2
\<lbrakk>p \<noteq> 0; degree p = 0\<rbrakk> \<Longrightarrow> {x. poly p x = 0} = {}
degree p = 1 \<Longrightarrow> {x. poly p x = 0} = {roots1 p}
degree p = 2 \<Longrightarrow> {x. poly p x = 0} = set (rroots2 p)

goal (1 subgoal):
 1. set (if p = 0 \<or> 2 < degree p then [] else if degree p = 0 then [] else if degree p = 1 then [roots1 p] else rroots2 p) = {x. poly p x = 0}
[PROOF STEP]
by (auto split: if_splits)


[STATEMENT]
lemma iso_integer_zeroth_homology_group_aux:
  assumes X: "path_connected_space X" and f: "singular_simplex 0 X f" and f': "singular_simplex 0 X f'"
  shows "homologous_rel 0 X {} (frag_of f) (frag_of f')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
let ?p = "\<lambda>j. if j = 0 then 1 else 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
have "f ?p \<in> topspace X" "f' ?p \<in> topspace X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X &&& f' (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path_connected_space X
singular_simplex 0 X f
singular_simplex 0 X f'

goal (1 subgoal):
 1. f (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X &&& f' (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X
[PROOF STEP]
by (auto simp: singular_simplex_def continuous_map_def)
[PROOF STATE]
proof (state)
this:
f (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X
f' (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X

goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X
f' (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X
[PROOF STEP]
obtain g where g: "pathin X g"
                  and g0: "g 0 = f ?p"
                  and g1: "g 1 = f' ?p"
[PROOF STATE]
proof (prove)
using this:
f (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X
f' (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>pathin X g; g 0 = f (\<lambda>j. if j = 0 then 1 else 0); g 1 = f' (\<lambda>j. if j = 0 then 1 else 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X
f' (\<lambda>j. if j = 0 then 1 else 0) \<in> topspace X
path_connected_space X
singular_simplex 0 X f
singular_simplex 0 X f'

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>pathin X g; g 0 = f (\<lambda>j. if j = 0 then 1 else 0); g 1 = f' (\<lambda>j. if j = 0 then 1 else 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: path_connected_space_def)
[PROOF STATE]
proof (state)
this:
pathin X g
g 0 = f (\<lambda>j. if j = 0 then 1 else 0)
g 1 = f' (\<lambda>j. if j = 0 then 1 else 0)

goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pathin X g
g 0 = f (\<lambda>j. if j = 0 then 1 else 0)
g 1 = f' (\<lambda>j. if j = 0 then 1 else 0)
[PROOF STEP]
have contg: "continuous_map (subtopology euclideanreal {0..1}) X g"
[PROOF STATE]
proof (prove)
using this:
pathin X g
g 0 = f (\<lambda>j. if j = 0 then 1 else 0)
g 1 = f' (\<lambda>j. if j = 0 then 1 else 0)

goal (1 subgoal):
 1. continuous_map (top_of_set {0..1}) X g
[PROOF STEP]
by (simp add: pathin_def)
[PROOF STATE]
proof (state)
this:
continuous_map (top_of_set {0..1}) X g

goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
have "singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))
[PROOF STEP]
have "continuous_map (subtopology (powertop_real UNIV) (standard_simplex (Suc 0)))
                         (top_of_set {0..1}) (\<lambda>x. x 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (subtopology (powertop_real UNIV) (standard_simplex (Suc 0))) (top_of_set {0..1}) (\<lambda>x. x 0)
[PROOF STEP]
apply (auto simp: continuous_map_in_subtopology g)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. continuous_map (subtopology (powertop_real UNIV) (standard_simplex (Suc 0))) euclideanreal (\<lambda>x. x 0)
 2. \<And>xa. xa \<in> standard_simplex (Suc 0) \<Longrightarrow> 0 \<le> xa 0
 3. \<And>xa. xa \<in> standard_simplex (Suc 0) \<Longrightarrow> xa 0 \<le> 1
[PROOF STEP]
apply (metis (mono_tags) UNIV_I continuous_map_from_subtopology continuous_map_product_projection)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. xa \<in> standard_simplex (Suc 0) \<Longrightarrow> 0 \<le> xa 0
 2. \<And>xa. xa \<in> standard_simplex (Suc 0) \<Longrightarrow> xa 0 \<le> 1
[PROOF STEP]
apply (simp_all add: standard_simplex_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (powertop_real UNIV) (standard_simplex (Suc 0))) (top_of_set {0..1}) (\<lambda>x. x 0)

goal (1 subgoal):
 1. singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (powertop_real UNIV) (standard_simplex (Suc 0))) (top_of_set {0..1}) (\<lambda>x. x 0)

goal (1 subgoal):
 1. singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))
[PROOF STEP]
have "continuous_map (top_of_set {0..1}) X g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (top_of_set {0..1}) X g
[PROOF STEP]
using contg
[PROOF STATE]
proof (prove)
using this:
continuous_map (top_of_set {0..1}) X g

goal (1 subgoal):
 1. continuous_map (top_of_set {0..1}) X g
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_map (top_of_set {0..1}) X g

goal (1 subgoal):
 1. singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
continuous_map (subtopology (powertop_real UNIV) (standard_simplex (Suc 0))) (top_of_set {0..1}) (\<lambda>x. x 0)
continuous_map (top_of_set {0..1}) X g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_map (subtopology (powertop_real UNIV) (standard_simplex (Suc 0))) (top_of_set {0..1}) (\<lambda>x. x 0)
continuous_map (top_of_set {0..1}) X g

goal (1 subgoal):
 1. singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))
[PROOF STEP]
by (force simp: singular_chain_of chain_boundary_of singular_simplex_def continuous_map_compose)
[PROOF STATE]
proof (state)
this:
singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))

goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))

goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
have "chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) =
      frag_of f - frag_of f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) = frag_of f - frag_of f'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) = frag_of f - frag_of f'
[PROOF STEP]
have "singular_face (Suc 0) 0 (g \<circ> (\<lambda>x. x 0)) = f"
         "singular_face (Suc 0) (Suc 0) (g \<circ> (\<lambda>x. x 0)) = f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singular_face (Suc 0) 0 (g \<circ> (\<lambda>x. x 0)) = f &&& singular_face (Suc 0) (Suc 0) (g \<circ> (\<lambda>x. x 0)) = f'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path_connected_space X
singular_simplex 0 X f
singular_simplex 0 X f'

goal (1 subgoal):
 1. singular_face (Suc 0) 0 (g \<circ> (\<lambda>x. x 0)) = f &&& singular_face (Suc 0) (Suc 0) (g \<circ> (\<lambda>x. x 0)) = f'
[PROOF STEP]
by (auto simp: singular_face_def singular_simplex_def extensional_def simplical_face_def standard_simplex_0 g0 g1)
[PROOF STATE]
proof (state)
this:
singular_face (Suc 0) 0 (g \<circ> (\<lambda>x. x 0)) = f
singular_face (Suc 0) (Suc 0) (g \<circ> (\<lambda>x. x 0)) = f'

goal (1 subgoal):
 1. chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) = frag_of f - frag_of f'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
singular_face (Suc 0) 0 (g \<circ> (\<lambda>x. x 0)) = f
singular_face (Suc 0) (Suc 0) (g \<circ> (\<lambda>x. x 0)) = f'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
singular_face (Suc 0) 0 (g \<circ> (\<lambda>x. x 0)) = f
singular_face (Suc 0) (Suc 0) (g \<circ> (\<lambda>x. x 0)) = f'

goal (1 subgoal):
 1. chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) = frag_of f - frag_of f'
[PROOF STEP]
by (simp add: singular_chain_of chain_boundary_of)
[PROOF STATE]
proof (state)
this:
chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) = frag_of f - frag_of f'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) = frag_of f - frag_of f'

goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))
chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) = frag_of f - frag_of f'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
singular_chain (Suc 0) X (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1)))
chain_boundary (Suc 0) (frag_of (restrict (g \<circ> (\<lambda>x. x 0)) (standard_simplex 1))) = frag_of f - frag_of f'

goal (1 subgoal):
 1. homologous_rel 0 X {} (frag_of f) (frag_of f')
[PROOF STEP]
by (auto simp: homologous_rel_def singular_boundary)
[PROOF STATE]
proof (state)
this:
homologous_rel 0 X {} (frag_of f) (frag_of f')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_factors_primorial': "prime_factors (primorial' k) = nth_prime ` {..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors (primorial' k) = nth_prime ` {..<k}
[PROOF STEP]
by (simp add: prime_factorization_primorial')