[STATEMENT]
lemma invariance_of_dimension_convex_domain:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "convex S"
      and contf: "continuous_on S f" and fim: "f ` S \<subseteq> affine hull T"
      and injf: "inj_on f S"
    shows "aff_dim S \<le> aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> aff_dim S \<le> aff_dim T
 2. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> aff_dim S \<le> aff_dim T
 2. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

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

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
have "aff_dim (affine hull S) \<le> aff_dim (affine hull T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
proof (rule invariance_of_dimension_affine_sets)
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. openin (top_of_set (affine hull S)) ?S
 2. affine (affine hull S)
 3. affine (affine hull T)
 4. continuous_on ?S ?f
 5. ?f ` ?S \<subseteq> affine hull T
 6. inj_on ?f ?S
 7. ?S \<noteq> {}
[PROOF STEP]
show "openin (top_of_set (affine hull S)) (rel_interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
[PROOF STEP]
by (simp add: openin_rel_interior)
[PROOF STATE]
proof (state)
this:
openin (top_of_set (affine hull S)) (rel_interior S)

goal (6 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
 3. continuous_on (rel_interior S) ?f
 4. ?f ` rel_interior S \<subseteq> affine hull T
 5. inj_on ?f (rel_interior S)
 6. rel_interior S \<noteq> {}
[PROOF STEP]
show "continuous_on (rel_interior S) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (rel_interior S) f
[PROOF STEP]
using contf continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. continuous_on (rel_interior S) f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on (rel_interior S) f

goal (5 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
 3. f ` rel_interior S \<subseteq> affine hull T
 4. inj_on f (rel_interior S)
 5. rel_interior S \<noteq> {}
[PROOF STEP]
show "f ` rel_interior S \<subseteq> affine hull T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` rel_interior S \<subseteq> affine hull T
[PROOF STEP]
using fim rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
f ` S \<subseteq> affine hull T
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. f ` rel_interior S \<subseteq> affine hull T
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` rel_interior S \<subseteq> affine hull T

goal (4 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
 3. inj_on f (rel_interior S)
 4. rel_interior S \<noteq> {}
[PROOF STEP]
show "inj_on f (rel_interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (rel_interior S)
[PROOF STEP]
using inj_on_subset injf rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>inj_on ?f ?A; ?B \<subseteq> ?A\<rbrakk> \<Longrightarrow> inj_on ?f ?B
inj_on f S
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. inj_on f (rel_interior S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inj_on f (rel_interior S)

goal (3 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
 3. rel_interior S \<noteq> {}
[PROOF STEP]
show "rel_interior S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior S \<noteq> {}
[PROOF STEP]
by (simp add: False \<open>convex S\<close> rel_interior_eq_empty)
[PROOF STATE]
proof (state)
this:
rel_interior S \<noteq> {}

goal (2 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homom2img: "\<lbrakk>Group F; Group G; f \<in> gHom F G \<rbrakk> \<Longrightarrow>
   (f\<dieresis>\<^bsub>F,(Img\<^bsub>F,G\<^esub> f)\<^esub>) \<in> gHom (F / (gker\<^bsub>F,G\<^esub> f)) (Img\<^bsub>F,G\<^esub> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> \<in> gHom (F / gker\<^bsub>F,G\<^esub> f) (Img\<^bsub>F,G\<^esub> f)
[PROOF STEP]
apply (frule hom_to_Img[of "F" "G" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; f \<in> gHom F (Img\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> \<in> gHom (F / gker\<^bsub>F,G\<^esub> f) (Img\<^bsub>F,G\<^esub> f)
[PROOF STEP]
apply (frule inducedHom[of "F" "Img\<^bsub>F,G\<^esub> f" "f"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; f \<in> gHom F (Img\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> Group (Img\<^bsub>F,G\<^esub> f)
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G; f \<in> gHom F (Img\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> f \<in> gHom F (Img\<^bsub>F,G\<^esub> f)
 3. \<lbrakk>Group F; Group G; f \<in> gHom F G; f \<in> gHom F (Img\<^bsub>F,G\<^esub> f); f\<dieresis>\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> \<in> gHom (F / gker\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> f) (Img\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> \<in> gHom (F / gker\<^bsub>F,G\<^esub> f) (Img\<^bsub>F,G\<^esub> f)
[PROOF STEP]
apply (simp add:Group_Img)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; f \<in> gHom F (Img\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> f \<in> gHom F (Img\<^bsub>F,G\<^esub> f)
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G; f \<in> gHom F (Img\<^bsub>F,G\<^esub> f); f\<dieresis>\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> \<in> gHom (F / gker\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> f) (Img\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> \<in> gHom (F / gker\<^bsub>F,G\<^esub> f) (Img\<^bsub>F,G\<^esub> f)
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; f \<in> gHom F (Img\<^bsub>F,G\<^esub> f); f\<dieresis>\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> \<in> gHom (F / gker\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> f) (Img\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> \<in> gHom (F / gker\<^bsub>F,G\<^esub> f) (Img\<^bsub>F,G\<^esub> f)
[PROOF STEP]
apply (simp add:gker_hom_to_img[of "F" "G" "f"])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma range_to_int_mod_ring:
  "range (to_int_mod_ring :: ('a :: finite mod_ring \<Rightarrow> int)) = {0 ..< CARD('a)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range to_int_mod_ring = {0..<int CARD('a)}
[PROOF STEP]
apply (intro equalityI subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> range to_int_mod_ring \<Longrightarrow> x \<in> {0..<int CARD('a)}
 2. \<And>x. x \<in> {0..<int CARD('a)} \<Longrightarrow> x \<in> range to_int_mod_ring
[PROOF STEP]
apply (elim rangeE, transfer, force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<int CARD('a)} \<Longrightarrow> x \<in> range to_int_mod_ring
[PROOF STEP]
by (auto intro!: range_eqI to_int_mod_ring_of_int_mod_ring[symmetric])


[STATEMENT]
lemma smult_diff_left: "smult (a - b) p = smult a p - smult b p"
  for a b :: "'a::comm_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (a - b) p = smult a p - smult b p
[PROOF STEP]
by (rule poly_eqI) (simp add: algebra_simps)


[STATEMENT]
lemma list_gmean_gt_iff:
  fixes one::"real list" and two::"real list"
  assumes
    gz1: "\<Prod>:one > 0" and gz2: "\<Prod>:two > 0" and
    ne1: "one \<noteq> []" and ne2: "two \<noteq> []" and
    pe: "(\<Prod>:one > \<Prod>:two)" and
    le: "(length one = length two)"
  shows "(gmean one > gmean two)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gmean two < gmean one
[PROOF STEP]
unfolding gmean_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root (length two) (prod_list two) < root (length one) (prod_list one)
[PROOF STEP]
using le ne2 pe
[PROOF STATE]
proof (prove)
using this:
length one = length two
two \<noteq> []
prod_list two < prod_list one

goal (1 subgoal):
 1. root (length two) (prod_list two) < root (length one) (prod_list one)
[PROOF STEP]
by simp


[STATEMENT]
lemma nn_integral_stretch:
  "f \<in> borel \<rightarrow>\<^sub>M borel \<Longrightarrow> c \<noteq> 0 \<Longrightarrow> (\<integral>\<^sup>+x. f (c * x) \<partial>lborel) = (1 / \<bar>c\<bar>::real) * (\<integral>\<^sup>+x. f x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable borel; c \<noteq> 0\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f (c * x) \<partial>lborel = ennreal (1 / \<bar>c\<bar>) * integral\<^sup>N lborel f
[PROOF STEP]
using nn_integral_real_affine[of f c 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f \<in> borel_measurable borel; c \<noteq> 0\<rbrakk> \<Longrightarrow> integral\<^sup>N lborel f = ennreal \<bar>c\<bar> * \<integral>\<^sup>+ x. f (0 + c * x) \<partial>lborel

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable borel; c \<noteq> 0\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f (c * x) \<partial>lborel = ennreal (1 / \<bar>c\<bar>) * integral\<^sup>N lborel f
[PROOF STEP]
by (simp add: mult.assoc[symmetric] ennreal_mult[symmetric])


[STATEMENT]
lemma card_union: "finite A \<Longrightarrow> finite B \<Longrightarrow> card (A \<union> B) = card A + card B - card (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B\<rbrakk> \<Longrightarrow> card (A \<union> B) = card A + card B - card (A \<inter> B)
[PROOF STEP]
by (metis card_Un_Int[symmetric] diff_add_inverse2)


[STATEMENT]
lemma neg_sup_eq_inf: "- sup a b = inf (- a) (- b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - sup a b = inf (- a) (- b)
[PROOF STEP]
by (simp add: sup_eq_neg_inf)


[STATEMENT]
lemma Digamma_plus1:
  assumes "z \<noteq> 0"
  shows   "Digamma (z+1) = Digamma z + 1/z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
have sums: "(\<lambda>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k)))
                  sums (inverse (z + of_nat 0) - 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k))) sums (inverse (z + of_nat 0) - (0::'a))
[PROOF STEP]
by (intro telescope_sums'[OF filterlim_compose[OF tendsto_inverse_0]]
              tendsto_add_filterlim_at_infinity[OF tendsto_const] tendsto_of_nat)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k))) sums (inverse (z + of_nat 0) - (0::'a))

goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
have "Digamma (z+1) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))) -
          euler_mascheroni" (is "_ = suminf ?f - _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Digamma (z + (1::'a)) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))) - euler_mascheroni
[PROOF STEP]
by (simp add: Digamma_def add_ac)
[PROOF STATE]
proof (state)
this:
Digamma (z + (1::'a)) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))) - euler_mascheroni

goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Digamma (z + (1::'a)) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))) - euler_mascheroni

goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
have "suminf ?f = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat k)) +
                         (\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat k)) + (\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k)))
[PROOF STEP]
using summable_Digamma[OF assms] sums
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat n))
(\<lambda>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k))) sums (inverse (z + of_nat 0) - (0::'a))

goal (1 subgoal):
 1. (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat k)) + (\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k)))
[PROOF STEP]
by (subst suminf_add) (simp_all add: add_ac sums_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat k)) + (\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k)))

goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat k)) + (\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k)))

goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
have "(\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k))) = 1/z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k))) = (1::'a) / z
[PROOF STEP]
using sums
[PROOF STATE]
proof (prove)
using this:
(\<lambda>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k))) sums (inverse (z + of_nat 0) - (0::'a))

goal (1 subgoal):
 1. (\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k))) = (1::'a) / z
[PROOF STEP]
by (simp add: sums_iff inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
(\<Sum>k. inverse (z + of_nat k) - inverse (z + of_nat (Suc k))) = (1::'a) / z

goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Digamma (z + (1::'a)) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat k)) + (1::'a) / z - euler_mascheroni
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Digamma (z + (1::'a)) = (\<Sum>k. inverse (of_nat (Suc k)) - inverse (z + of_nat k)) + (1::'a) / z - euler_mascheroni

goal (1 subgoal):
 1. Digamma (z + (1::'a)) = Digamma z + (1::'a) / z
[PROOF STEP]
by (simp add: Digamma_def[of z])
[PROOF STATE]
proof (state)
this:
Digamma (z + (1::'a)) = Digamma z + (1::'a) / z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_Un_Int:
  assumes "A \<in> sets M" "B \<in> sets M"
  shows "emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)
[PROOF STEP]
have "A = (A-B) \<union> (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = A - B \<union> A \<inter> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = A - B \<union> A \<inter> B

goal (1 subgoal):
 1. emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = A - B \<union> A \<inter> B
[PROOF STEP]
have "emeasure M A = emeasure M (A-B) + emeasure M (A \<inter> B)"
[PROOF STATE]
proof (prove)
using this:
A = A - B \<union> A \<inter> B

goal (1 subgoal):
 1. emeasure M A = emeasure M (A - B) + emeasure M (A \<inter> B)
[PROOF STEP]
by (metis Diff_Diff_Int Diff_disjoint assms plus_emeasure sets.Diff)
[PROOF STATE]
proof (state)
this:
emeasure M A = emeasure M (A - B) + emeasure M (A \<inter> B)

goal (1 subgoal):
 1. emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
emeasure M A = emeasure M (A - B) + emeasure M (A \<inter> B)

goal (1 subgoal):
 1. emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)
[PROOF STEP]
have "A \<union> B = (A-B) \<union> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union> B = A - B \<union> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<union> B = A - B \<union> B

goal (1 subgoal):
 1. emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<union> B = A - B \<union> B
[PROOF STEP]
have "emeasure M (A \<union> B) = emeasure M (A-B) + emeasure M B"
[PROOF STATE]
proof (prove)
using this:
A \<union> B = A - B \<union> B

goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M (A - B) + emeasure M B
[PROOF STEP]
by (metis Diff_disjoint Int_commute assms plus_emeasure sets.Diff)
[PROOF STATE]
proof (state)
this:
emeasure M (A \<union> B) = emeasure M (A - B) + emeasure M B

goal (1 subgoal):
 1. emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
emeasure M A = emeasure M (A - B) + emeasure M (A \<inter> B)
emeasure M (A \<union> B) = emeasure M (A - B) + emeasure M B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M A = emeasure M (A - B) + emeasure M (A \<inter> B)
emeasure M (A \<union> B) = emeasure M (A - B) + emeasure M B

goal (1 subgoal):
 1. emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)
[PROOF STEP]
by (metis add.assoc add.commute)
[PROOF STATE]
proof (state)
this:
emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma triple_sigma_rewrite_card:
  assumes "finite X" "finite Y" "finite Z"
  shows "card {(x,y,z) . x \<in> X \<and> (y,z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in> X . card {(y,z) \<in> Y \<times> Z. P x y z})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})
[PROOF STEP]
define W where "W \<equiv> \<lambda>x. {(y,z) \<in> Y \<times> Z. P x y z}"
[PROOF STATE]
proof (state)
this:
W \<equiv> \<lambda>x. {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z}

goal (1 subgoal):
 1. card {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})
[PROOF STEP]
have "W x \<subseteq> Y \<times> Z" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W x \<subseteq> Y \<times> Z
[PROOF STEP]
by (auto simp: W_def)
[PROOF STATE]
proof (state)
this:
W ?x \<subseteq> Y \<times> Z

goal (1 subgoal):
 1. card {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
W ?x \<subseteq> Y \<times> Z
[PROOF STEP]
have [simp]: "finite (W x)" for x
[PROOF STATE]
proof (prove)
using this:
W ?x \<subseteq> Y \<times> Z

goal (1 subgoal):
 1. finite (W x)
[PROOF STEP]
by (meson assms finite_SigmaI infinite_super)
[PROOF STATE]
proof (state)
this:
finite (W ?x)

goal (1 subgoal):
 1. card {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})
[PROOF STEP]
have eq: "{(x,y,z) . x \<in> X \<and> (y,z) \<in> Y \<times> Z \<and> P x y z} = (\<Union>x\<in>X. \<Union>(y,z)\<in>W x. {(x,y,z)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Union>x\<in>X. \<Union>(y, z)\<in>W x. {(x, y, z)})
[PROOF STEP]
by (auto simp: W_def)
[PROOF STATE]
proof (state)
this:
{(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Union>x\<in>X. \<Union>(y, z)\<in>W x. {(x, y, z)})

goal (1 subgoal):
 1. card {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})
[PROOF STEP]
unfolding eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union>x\<in>X. \<Union>(y, z)\<in>W x. {(x, y, z)}) = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})
[PROOF STEP]
by (simp add: disjoint_iff assms card_UN_disjoint) (simp add: W_def)
[PROOF STATE]
proof (state)
this:
card {(x, y, z). x \<in> X \<and> (y, z) \<in> Y \<times> Z \<and> P x y z} = (\<Sum>x\<in>X. card {(y, z). (y, z) \<in> Y \<times> Z \<and> P x y z})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eucl_of_list_append[simp]:
  assumes "length xs = DIM('i::executable_euclidean_space)"
  assumes "length ys = DIM('j::executable_euclidean_space)"
  shows "eucl_of_list (xs @ ys) = (eucl_of_list xs::'i, eucl_of_list ys::'j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list (xs @ ys) = (eucl_of_list xs, eucl_of_list ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = DIM('i)
length ys = DIM('j)

goal (1 subgoal):
 1. eucl_of_list (xs @ ys) = (eucl_of_list xs, eucl_of_list ys)
[PROOF STEP]
by (auto simp: eucl_of_list_prod)


[STATEMENT]
lemma mat_arc_pos_plus:
  assumes n0: "n > 0"
  and A: "A \<in> carrier_mat n n"
  and B: "B \<in> carrier_mat n n"
  and arc_pos: "mat_arc_pos A"
  shows "mat_arc_pos (A + B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_arc_pos (A + B)
[PROOF STEP]
unfolding mat_arc_posI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arc_pos ((A + B) $$ (0, 0))
[PROOF STEP]
apply (subst index_add_mat(1))
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 < dim_row B
 2. 0 < dim_col B
 3. arc_pos (A $$ (0, 0) + B $$ (0, 0))
[PROOF STEP]
using arc_pos_plus[OF arc_pos[unfolded mat_arc_posI_def]]
  assms
[PROOF STATE]
proof (prove)
using this:
arc_pos (A $$ (0, 0) + ?y)
0 < n
A \<in> carrier_mat n n
B \<in> carrier_mat n n
mat_arc_pos A

goal (3 subgoals):
 1. 0 < dim_row B
 2. 0 < dim_col B
 3. arc_pos (A $$ (0, 0) + B $$ (0, 0))
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_sum_smult:
  fixes f :: "nat \<Rightarrow> 'b::semiring_1 mat"
  shows "(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow>
        matrix_sum d (\<lambda> k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) 0 = c \<cdot>\<^sub>m matrix_sum d f 0
 2. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) (Suc n) = c \<cdot>\<^sub>m matrix_sum d f (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (2 subgoals):
 1. (\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) 0 = c \<cdot>\<^sub>m matrix_sum d f 0
 2. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) (Suc n) = c \<cdot>\<^sub>m matrix_sum d f (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) 0 = c \<cdot>\<^sub>m matrix_sum d f 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) 0 = c \<cdot>\<^sub>m matrix_sum d f 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) (Suc n) = c \<cdot>\<^sub>m matrix_sum d f (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) (Suc n) = c \<cdot>\<^sub>m matrix_sum d f (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) (Suc n) = c \<cdot>\<^sub>m matrix_sum d f (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) (Suc n) = c \<cdot>\<^sub>m matrix_sum d f (Suc n)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> c \<cdot>\<^sub>m f n + c \<cdot>\<^sub>m matrix_sum d f n = c \<cdot>\<^sub>m (f n + matrix_sum d f n)
[PROOF STEP]
using add_smult_distrib_left_mat Suc matrix_sum_dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?nr ?nc; ?B \<in> carrier_mat ?nr ?nc\<rbrakk> \<Longrightarrow> ?k \<cdot>\<^sub>m (?A + ?B) = ?k \<cdot>\<^sub>m ?A + ?k \<cdot>\<^sub>m ?B
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
(\<And>k. k < ?n \<Longrightarrow> ?f k \<in> carrier_mat ?d ?d) \<Longrightarrow> matrix_sum ?d ?f ?n \<in> carrier_mat ?d ?d

goal (1 subgoal):
 1. \<lbrakk>matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) n = c \<cdot>\<^sub>m matrix_sum d f n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> c \<cdot>\<^sub>m f n + c \<cdot>\<^sub>m matrix_sum d f n = c \<cdot>\<^sub>m (f n + matrix_sum d f n)
[PROOF STEP]
by (metis lessI less_SucI)
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. c \<cdot>\<^sub>m f k) (Suc n) = c \<cdot>\<^sub>m matrix_sum d f (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_field_derivative_inverse_strong:
  fixes f :: "'a::{euclidean_space,real_normed_field} \<Rightarrow> 'a"
  shows "\<lbrakk>DERIV f x :> f'; f' \<noteq> 0; open S; x \<in> S; continuous_on S f;
         \<And>z. z \<in> S \<Longrightarrow> g (f z) = z\<rbrakk>
         \<Longrightarrow> DERIV g (f x) :> inverse (f')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative f') (at x); f' \<noteq> (0::'a); open S; x \<in> S; continuous_on S f; \<And>z. z \<in> S \<Longrightarrow> g (f z) = z\<rbrakk> \<Longrightarrow> (g has_field_derivative inverse f') (at (f x))
[PROOF STEP]
unfolding has_field_derivative_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative (*) f') (at x); f' \<noteq> (0::'a); open S; x \<in> S; continuous_on S f; \<And>z. z \<in> S \<Longrightarrow> g (f z) = z\<rbrakk> \<Longrightarrow> (g has_derivative (*) (inverse f')) (at (f x))
[PROOF STEP]
by (rule has_derivative_inverse_strong [of S x f g]) auto


[STATEMENT]
lemma  cross_eq_0: "x \<times> y = 0 \<longleftrightarrow> collinear{0,x,y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
have "x \<times> y = 0 \<longleftrightarrow> norm (x \<times> y) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<times> y = 0) = (norm (x \<times> y) = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<times> y = 0) = (norm (x \<times> y) = 0)

goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<times> y = 0) = (norm (x \<times> y) = 0)

goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
have "... \<longleftrightarrow> (norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (x \<times> y) = 0) = ((norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2)
[PROOF STEP]
using norm_cross [of x y]
[PROOF STATE]
proof (prove)
using this:
(norm (x \<times> y))\<^sup>2 = (norm x)\<^sup>2 * (norm y)\<^sup>2 - (x \<bullet> y)\<^sup>2

goal (1 subgoal):
 1. (norm (x \<times> y) = 0) = ((norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2)
[PROOF STEP]
by (auto simp: power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(norm (x \<times> y) = 0) = ((norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2)

goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(norm (x \<times> y) = 0) = ((norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2)

goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
have "... \<longleftrightarrow> \<bar>x \<bullet> y\<bar> = norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2) = (\<bar>x \<bullet> y\<bar> = norm x * norm y)
[PROOF STEP]
using power2_eq_iff
[PROOF STATE]
proof (prove)
using this:
(?x\<^sup>2 = ?y\<^sup>2) = (?x = ?y \<or> ?x = - ?y)

goal (1 subgoal):
 1. ((norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2) = (\<bar>x \<bullet> y\<bar> = norm x * norm y)
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) abs_minus abs_norm_cancel abs_power2 norm_mult power_abs real_norm_def)
[PROOF STATE]
proof (state)
this:
((norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2) = (\<bar>x \<bullet> y\<bar> = norm x * norm y)

goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((norm x * norm y)\<^sup>2 = (x \<bullet> y)\<^sup>2) = (\<bar>x \<bullet> y\<bar> = norm x * norm y)

goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
have "... \<longleftrightarrow> collinear {0, x, y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>x \<bullet> y\<bar> = norm x * norm y) = collinear {0, x, y}
[PROOF STEP]
by (rule norm_cauchy_schwarz_equal)
[PROOF STATE]
proof (state)
this:
(\<bar>x \<bullet> y\<bar> = norm x * norm y) = collinear {0, x, y}

goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x \<times> y = 0) = collinear {0, x, y}

goal (1 subgoal):
 1. (x \<times> y = 0) = collinear {0, x, y}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(x \<times> y = 0) = collinear {0, x, y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_shift_denum:
  assumes "summable (\<lambda>i. 1/((f i)::nat))"
  shows "summable (\<lambda>i. 1/(f i - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>i. 1 / real (f i - 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>i. 1 / real (f i - 1))
[PROOF STEP]
have "\<forall>i. 1/(f i - 1) \<le> 2 / f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. 1 / real (f i - 1) \<le> 2 / real (f i)
[PROOF STEP]
using shift_denum[of f]
[PROOF STATE]
proof (prove)
using this:
1 / real (f ?i - 1) \<le> 2 / real (f ?i)

goal (1 subgoal):
 1. \<forall>i. 1 / real (f i - 1) \<le> 2 / real (f i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i. 1 / real (f i - 1) \<le> 2 / real (f i)

goal (1 subgoal):
 1. summable (\<lambda>i. 1 / real (f i - 1))
[PROOF STEP]
have "summable (\<lambda>i. 2/ f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>i. 2 / real (f i))
[PROOF STEP]
using assms summable_mult[of "\<lambda>n. 1/ f n"]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>i. 1 / real (f i))
summable (\<lambda>n. 1 / real (f n)) \<Longrightarrow> summable (\<lambda>n. ?c * (1 / real (f n)))

goal (1 subgoal):
 1. summable (\<lambda>i. 2 / real (f i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
summable (\<lambda>i. 2 / real (f i))

goal (1 subgoal):
 1. summable (\<lambda>i. 1 / real (f i - 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>i. 2 / real (f i))

goal (1 subgoal):
 1. summable (\<lambda>i. 1 / real (f i - 1))
[PROOF STEP]
using summable_bounded[of "\<lambda>i. 1/(f i - 1)" "\<lambda>i. 2 * 1/f i"]
      \<open>\<forall>i. 1 / real (f i - 1) \<le> 2 / real (f i)\<close>
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>i. 2 / real (f i))
\<lbrakk>\<And>i. 0 \<le> 1 / real (f i - 1); \<And>i. 1 / real (f i - 1) \<le> 2 * 1 / real (f i); summable (\<lambda>i. 2 * 1 / real (f i))\<rbrakk> \<Longrightarrow> summable (\<lambda>i. 1 / real (f i - 1))
\<forall>i. 1 / real (f i - 1) \<le> 2 / real (f i)

goal (1 subgoal):
 1. summable (\<lambda>i. 1 / real (f i - 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
summable (\<lambda>i. 1 / real (f i - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bb: "Suc n choose k = (n choose k) + (if k = 0 then 0 else (n choose (k - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n choose k = n choose k + (if k = 0 then 0 else n choose (k - 1))
[PROOF STEP]
by (cases k) simp_all


[STATEMENT]
lemma exp_to_sin:
  fixes x:: real
  shows "exp (\<i> * x) - exp (-(\<i> * x)) = 2 * \<i> * (sin x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) - exp (- (\<i> * complex_of_real x)) = 2 * \<i> * complex_of_real (sin x)
[PROOF STEP]
using exp_of_real exp_of_real_inv
[PROOF STATE]
proof (prove)
using this:
exp (\<i> * complex_of_real ?x) = complex_of_real (cos ?x) + \<i> * complex_of_real (sin ?x)
exp (- (\<i> * complex_of_real ?x)) = complex_of_real (cos ?x) - \<i> * complex_of_real (sin ?x)

goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) - exp (- (\<i> * complex_of_real x)) = 2 * \<i> * complex_of_real (sin x)
[PROOF STEP]
by simp


[STATEMENT]
lemma is_rbt_rbt_product:
  "\<lbrakk> ord.is_rbt (\<sqsubset>\<^sub>a) rbt1; ord.is_rbt (\<sqsubset>\<^sub>b) rbt2 \<rbrakk>
  \<Longrightarrow> ord.is_rbt (\<sqsubset>) (rbt_product f rbt1 rbt2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ord.is_rbt (\<sqsubset>\<^sub>a) rbt1; ord.is_rbt (\<sqsubset>\<^sub>b) rbt2\<rbrakk> \<Longrightarrow> ord.is_rbt (less_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubset>\<^sub>b)) (rbt_product f rbt1 rbt2)
[PROOF STEP]
unfolding rbt_product_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ord.is_rbt (\<sqsubset>\<^sub>a) rbt1; ord.is_rbt (\<sqsubset>\<^sub>b) rbt2\<rbrakk> \<Longrightarrow> ord.is_rbt (less_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubset>\<^sub>b)) (rbtreeify (alist_product f (RBT_Impl.entries rbt1) (RBT_Impl.entries rbt2)))
[PROOF STEP]
by(blast intro: linorder.is_rbt_rbtreeify[OF linorder_prod] sorted_alist_product linorder.rbt_sorted_entries[OF lin_a] ord.is_rbt_rbt_sorted linorder.distinct_entries[OF lin_a] linorder.rbt_sorted_entries[OF lin_b] distinct_alist_product linorder.distinct_entries[OF lin_b])


[STATEMENT]
lemma poincare_distance_formula'_ge_1:
  assumes "u \<in> unit_disc" and "v \<in> unit_disc"
  shows "1 \<le> poincare_distance_formula' (to_complex u) (to_complex v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> poincare_distance_formula' (to_complex u) (to_complex v)
[PROOF STEP]
using unit_disc_cmod_square_lt_1[OF assms(1)] unit_disc_cmod_square_lt_1[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
(cmod (to_complex u))\<^sup>2 < 1
(cmod (to_complex v))\<^sup>2 < 1

goal (1 subgoal):
 1. 1 \<le> poincare_distance_formula' (to_complex u) (to_complex v)
[PROOF STEP]
by auto


[STATEMENT]
theorem invertible_inverse_inverse [simp]:
  "\<lbrakk> invertible u; u \<in> M \<rbrakk> \<Longrightarrow> inverse (inverse u) = u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invertible u; u \<in> M\<rbrakk> \<Longrightarrow> inverse (inverse u) = u
[PROOF STEP]
by (simp add: inverse_equality)


[STATEMENT]
lemma poly_y_x_swapped:
  fixes p :: "'a :: comm_monoid_add poly poly"
  defines "d \<equiv> Max { degree (coeff p i) | i. i \<le> degree p }"
  shows "poly_y_x p = (\<Sum>j\<le>d. \<Sum>i\<le>degree p. monom (monom (coeff (coeff p i) j) i) j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_y_x p = (\<Sum>j\<le>d. \<Sum>i\<le>degree p. monom (monom (coeff (coeff p i) j) i) j)
[PROOF STEP]
using poly_y_x_fixed_deg[of p, folded d_def] sum.swap
[PROOF STATE]
proof (prove)
using this:
poly_y_x p = (\<Sum>i\<le>degree p. \<Sum>j\<le>d. monom (monom (coeff (coeff p i) j) i) j)
(\<Sum>i\<in>?A. sum (?g i) ?B) = (\<Sum>j\<in>?B. \<Sum>i\<in>?A. ?g i j)

goal (1 subgoal):
 1. poly_y_x p = (\<Sum>j\<le>d. \<Sum>i\<le>degree p. monom (monom (coeff (coeff p i) j) i) j)
[PROOF STEP]
by auto


[STATEMENT]
lemma det_addrow:
  assumes l: "l < n" and k: "k \<noteq> l" and A: "A \<in> carrier_mat n n"
  shows "det (addrow a k l A) = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
have "addrow a k l A = addrow_mat n a k l * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. addrow a k l A = addrow_mat n a k l * A
[PROOF STEP]
by (rule addrow_mat[OF A l])
[PROOF STATE]
proof (state)
this:
addrow a k l A = addrow_mat n a k l * A

goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
addrow a k l A = addrow_mat n a k l * A

goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
have "det (addrow_mat n a k l * A) = det (addrow_mat n a k l) * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (addrow_mat n a k l * A) = det (addrow_mat n a k l) * det A
[PROOF STEP]
by (rule det_mult[OF _ A], auto)
[PROOF STATE]
proof (state)
this:
det (addrow_mat n a k l * A) = det (addrow_mat n a k l) * det A

goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (addrow_mat n a k l * A) = det (addrow_mat n a k l) * det A

goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
have "det (addrow_mat n a k l) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (addrow_mat n a k l) = (1::'a)
[PROOF STEP]
by (rule det_addrow_mat[OF k])
[PROOF STATE]
proof (state)
this:
det (addrow_mat n a k l) = (1::'a)

goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (addrow a k l A) = (1::'a) * det A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det (addrow a k l A) = (1::'a) * det A

goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
det (addrow a k l A) = (1::'a) * det A
A \<in> carrier_mat n n

goal (1 subgoal):
 1. det (addrow a k l A) = det A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (addrow a k l A) = det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem avl_fib_bound:
  "avl t \<Longrightarrow> fib(height t + 2) \<le> size1 t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. avl t \<Longrightarrow> fib (height t + 2) \<le> size1 t
[PROOF STEP]
proof (induction rule: tree2_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. avl \<langle>\<rangle> \<Longrightarrow> fib (height \<langle>\<rangle> + 2) \<le> size1 \<langle>\<rangle>
 2. \<And>x1 a b x3. \<lbrakk>avl x1 \<Longrightarrow> fib (height x1 + 2) \<le> size1 x1; avl x3 \<Longrightarrow> fib (height x3 + 2) \<le> size1 x3; avl \<langle>x1, (a, b), x3\<rangle>\<rbrakk> \<Longrightarrow> fib (height \<langle>x1, (a, b), x3\<rangle> + 2) \<le> size1 \<langle>x1, (a, b), x3\<rangle>
[PROOF STEP]
case (Node l a h r)
[PROOF STATE]
proof (state)
this:
avl l \<Longrightarrow> fib (height l + 2) \<le> size1 l
avl r \<Longrightarrow> fib (height r + 2) \<le> size1 r
avl \<langle>l, (a, h), r\<rangle>

goal (2 subgoals):
 1. avl \<langle>\<rangle> \<Longrightarrow> fib (height \<langle>\<rangle> + 2) \<le> size1 \<langle>\<rangle>
 2. \<And>x1 a b x3. \<lbrakk>avl x1 \<Longrightarrow> fib (height x1 + 2) \<le> size1 x1; avl x3 \<Longrightarrow> fib (height x3 + 2) \<le> size1 x3; avl \<langle>x1, (a, b), x3\<rangle>\<rbrakk> \<Longrightarrow> fib (height \<langle>x1, (a, b), x3\<rangle> + 2) \<le> size1 \<langle>x1, (a, b), x3\<rangle>
[PROOF STEP]
have 1: "height l + 1 \<le> height r + 2" and 2: "height r + 1 \<le> height l + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height l + 1 \<le> height r + 2 &&& height r + 1 \<le> height l + 2
[PROOF STEP]
using Node.prems
[PROOF STATE]
proof (prove)
using this:
avl \<langle>l, (a, h), r\<rangle>

goal (1 subgoal):
 1. height l + 1 \<le> height r + 2 &&& height r + 1 \<le> height l + 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
height l + 1 \<le> height r + 2
height r + 1 \<le> height l + 2

goal (2 subgoals):
 1. avl \<langle>\<rangle> \<Longrightarrow> fib (height \<langle>\<rangle> + 2) \<le> size1 \<langle>\<rangle>
 2. \<And>x1 a b x3. \<lbrakk>avl x1 \<Longrightarrow> fib (height x1 + 2) \<le> size1 x1; avl x3 \<Longrightarrow> fib (height x3 + 2) \<le> size1 x3; avl \<langle>x1, (a, b), x3\<rangle>\<rbrakk> \<Longrightarrow> fib (height \<langle>x1, (a, b), x3\<rangle> + 2) \<le> size1 \<langle>x1, (a, b), x3\<rangle>
[PROOF STEP]
have "fib (max (height l) (height r) + 3) \<le> size1 l + size1 r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
assume "height l \<ge> height r"
[PROOF STATE]
proof (state)
this:
height r \<le> height l

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
hence "fib (max (height l) (height r) + 3) = fib (height l + 3)"
[PROOF STATE]
proof (prove)
using this:
height r \<le> height l

goal (1 subgoal):
 1. fib (max (height l) (height r) + 3) = fib (height l + 3)
[PROOF STEP]
by(simp add: max_absorb1)
[PROOF STATE]
proof (state)
this:
fib (max (height l) (height r) + 3) = fib (height l + 3)

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fib (max (height l) (height r) + 3) = fib (height l + 3)

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
have "\<dots> = fib (height l + 2) + fib (height l + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (height l + 3) = fib (height l + 2) + fib (height l + 1)
[PROOF STEP]
by (simp add: numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
fib (height l + 3) = fib (height l + 2) + fib (height l + 1)

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fib (height l + 3) = fib (height l + 2) + fib (height l + 1)

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
have "\<dots> \<le> size1 l + fib (height l + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (height l + 2) + fib (height l + 1) \<le> size1 l + fib (height l + 1)
[PROOF STEP]
using Node
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> fib (height l + 2) \<le> size1 l
avl r \<Longrightarrow> fib (height r + 2) \<le> size1 r
avl \<langle>l, (a, h), r\<rangle>

goal (1 subgoal):
 1. fib (height l + 2) + fib (height l + 1) \<le> size1 l + fib (height l + 1)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
fib (height l + 2) + fib (height l + 1) \<le> size1 l + fib (height l + 1)

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fib (height l + 2) + fib (height l + 1) \<le> size1 l + fib (height l + 1)

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
have "\<dots> \<le> size1 r + size1 l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 l + fib (height l + 1) \<le> size1 r + size1 l
[PROOF STEP]
using Node fib_mono[OF 1]
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> fib (height l + 2) \<le> size1 l
avl r \<Longrightarrow> fib (height r + 2) \<le> size1 r
avl \<langle>l, (a, h), r\<rangle>
fib (height l + 1) \<le> fib (height r + 2)

goal (1 subgoal):
 1. size1 l + fib (height l + 1) \<le> size1 r + size1 l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size1 l + fib (height l + 1) \<le> size1 r + size1 l

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size1 l + fib (height l + 1) \<le> size1 r + size1 l

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
have "\<dots> = size1 (Node l (a,h) r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 r + size1 l = size1 \<langle>l, (a, h), r\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size1 r + size1 l = size1 \<langle>l, (a, h), r\<rangle>

goal (2 subgoals):
 1. ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
 2. \<not> ?P \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fib (max (height l) (height r) + 3) \<le> size1 \<langle>l, (a, h), r\<rangle>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fib (max (height l) (height r) + 3) \<le> size1 \<langle>l, (a, h), r\<rangle>

goal (1 subgoal):
 1. fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
fib (max (height l) (height r) + 3) \<le> size1 l + size1 r

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
assume "\<not> height l \<ge> height r"
[PROOF STATE]
proof (state)
this:
\<not> height r \<le> height l

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
hence "fib (max (height l) (height r) + 3) = fib (height r + 3)"
[PROOF STATE]
proof (prove)
using this:
\<not> height r \<le> height l

goal (1 subgoal):
 1. fib (max (height l) (height r) + 3) = fib (height r + 3)
[PROOF STEP]
by(simp add: max_absorb1)
[PROOF STATE]
proof (state)
this:
fib (max (height l) (height r) + 3) = fib (height r + 3)

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fib (max (height l) (height r) + 3) = fib (height r + 3)

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
have "\<dots> = fib (height r + 2) + fib (height r + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (height r + 3) = fib (height r + 2) + fib (height r + 1)
[PROOF STEP]
by (simp add: numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
fib (height r + 3) = fib (height r + 2) + fib (height r + 1)

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fib (height r + 3) = fib (height r + 2) + fib (height r + 1)

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
have "\<dots> \<le> size1 r + fib (height r + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (height r + 2) + fib (height r + 1) \<le> size1 r + fib (height r + 1)
[PROOF STEP]
using Node
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> fib (height l + 2) \<le> size1 l
avl r \<Longrightarrow> fib (height r + 2) \<le> size1 r
avl \<langle>l, (a, h), r\<rangle>

goal (1 subgoal):
 1. fib (height r + 2) + fib (height r + 1) \<le> size1 r + fib (height r + 1)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
fib (height r + 2) + fib (height r + 1) \<le> size1 r + fib (height r + 1)

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fib (height r + 2) + fib (height r + 1) \<le> size1 r + fib (height r + 1)

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
have "\<dots> \<le> size1 r + size1 l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 r + fib (height r + 1) \<le> size1 r + size1 l
[PROOF STEP]
using Node fib_mono[OF 2]
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> fib (height l + 2) \<le> size1 l
avl r \<Longrightarrow> fib (height r + 2) \<le> size1 r
avl \<langle>l, (a, h), r\<rangle>
fib (height r + 1) \<le> fib (height l + 2)

goal (1 subgoal):
 1. size1 r + fib (height r + 1) \<le> size1 r + size1 l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size1 r + fib (height r + 1) \<le> size1 r + size1 l

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size1 r + fib (height r + 1) \<le> size1 r + size1 l

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
have "\<dots> = size1 (Node l (a,h) r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 r + size1 l = size1 \<langle>l, (a, h), r\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size1 r + size1 l = size1 \<langle>l, (a, h), r\<rangle>

goal (1 subgoal):
 1. \<not> height r \<le> height l \<Longrightarrow> fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fib (max (height l) (height r) + 3) \<le> size1 \<langle>l, (a, h), r\<rangle>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fib (max (height l) (height r) + 3) \<le> size1 \<langle>l, (a, h), r\<rangle>

goal (1 subgoal):
 1. fib (max (height l) (height r) + 3) \<le> size1 l + size1 r
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
fib (max (height l) (height r) + 3) \<le> size1 l + size1 r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fib (max (height l) (height r) + 3) \<le> size1 l + size1 r

goal (2 subgoals):
 1. avl \<langle>\<rangle> \<Longrightarrow> fib (height \<langle>\<rangle> + 2) \<le> size1 \<langle>\<rangle>
 2. \<And>x1 a b x3. \<lbrakk>avl x1 \<Longrightarrow> fib (height x1 + 2) \<le> size1 x1; avl x3 \<Longrightarrow> fib (height x3 + 2) \<le> size1 x3; avl \<langle>x1, (a, b), x3\<rangle>\<rbrakk> \<Longrightarrow> fib (height \<langle>x1, (a, b), x3\<rangle> + 2) \<le> size1 \<langle>x1, (a, b), x3\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fib (max (height l) (height r) + 3) \<le> size1 l + size1 r

goal (2 subgoals):
 1. avl \<langle>\<rangle> \<Longrightarrow> fib (height \<langle>\<rangle> + 2) \<le> size1 \<langle>\<rangle>
 2. \<And>x1 a b x3. \<lbrakk>avl x1 \<Longrightarrow> fib (height x1 + 2) \<le> size1 x1; avl x3 \<Longrightarrow> fib (height x3 + 2) \<le> size1 x3; avl \<langle>x1, (a, b), x3\<rangle>\<rbrakk> \<Longrightarrow> fib (height \<langle>x1, (a, b), x3\<rangle> + 2) \<le> size1 \<langle>x1, (a, b), x3\<rangle>
[PROOF STEP]
have "\<dots> = size1 (Node l (a,h) r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 l + size1 r = size1 \<langle>l, (a, h), r\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size1 l + size1 r = size1 \<langle>l, (a, h), r\<rangle>

goal (2 subgoals):
 1. avl \<langle>\<rangle> \<Longrightarrow> fib (height \<langle>\<rangle> + 2) \<le> size1 \<langle>\<rangle>
 2. \<And>x1 a b x3. \<lbrakk>avl x1 \<Longrightarrow> fib (height x1 + 2) \<le> size1 x1; avl x3 \<Longrightarrow> fib (height x3 + 2) \<le> size1 x3; avl \<langle>x1, (a, b), x3\<rangle>\<rbrakk> \<Longrightarrow> fib (height \<langle>x1, (a, b), x3\<rangle> + 2) \<le> size1 \<langle>x1, (a, b), x3\<rangle>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fib (max (height l) (height r) + 3) \<le> size1 \<langle>l, (a, h), r\<rangle>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
fib (max (height l) (height r) + 3) \<le> size1 \<langle>l, (a, h), r\<rangle>

goal (1 subgoal):
 1. fib (height \<langle>l, (a, h), r\<rangle> + 2) \<le> size1 \<langle>l, (a, h), r\<rangle>
[PROOF STEP]
by (simp del: fib.simps add: numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
fib (height \<langle>l, (a, h), r\<rangle> + 2) \<le> size1 \<langle>l, (a, h), r\<rangle>

goal (1 subgoal):
 1. avl \<langle>\<rangle> \<Longrightarrow> fib (height \<langle>\<rangle> + 2) \<le> size1 \<langle>\<rangle>
[PROOF STEP]
qed auto


[STATEMENT]
lemma infinite_enumerate:
  assumes fS: "infinite S"
  shows "\<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> (\<forall>n. r n \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (\<forall>n. r n \<in> S)
[PROOF STEP]
unfolding strict_mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. (\<forall>x y. x < y \<longrightarrow> r x < r y) \<and> (\<forall>n. r n \<in> S)
[PROOF STEP]
using enumerate_in_set[OF fS] enumerate_mono[of _ _ S] fS
[PROOF STATE]
proof (prove)
using this:
wellorder_class.enumerate S ?n \<in> S
\<lbrakk>?m < ?n; infinite S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S ?m < wellorder_class.enumerate S ?n
infinite S

goal (1 subgoal):
 1. \<exists>r. (\<forall>x y. x < y \<longrightarrow> r x < r y) \<and> (\<forall>n. r n \<in> S)
[PROOF STEP]
by blast


[STATEMENT]
lemma tendsto_add_smallo:
  assumes "(f1 \<longlongrightarrow> a) F"
  assumes "f2 \<in> o[F](f1)"
  shows   "((\<lambda>x. f1 x + f2 x) \<longlongrightarrow> a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f1 x + f2 x) \<longlongrightarrow> a) F
[PROOF STEP]
proof (subst filterlim_cong[OF refl refl])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. f1 x + f2 x = ?g x
 2. (?g \<longlongrightarrow> a) F
[PROOF STEP]
from landau_o.smallD[OF assms(2) zero_less_one]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. norm (f2 x) \<le> 1 * norm (f1 x)
[PROOF STEP]
have "eventually (\<lambda>x. norm (f2 x) \<le> norm (f1 x)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. norm (f2 x) \<le> 1 * norm (f1 x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm (f2 x) \<le> norm (f1 x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. norm (f2 x) \<le> norm (f1 x)

goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. f1 x + f2 x = ?g x
 2. (?g \<longlongrightarrow> a) F
[PROOF STEP]
thus "eventually (\<lambda>x. f1 x + f2 x = f1 x * (1 + f2 x / f1 x)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. norm (f2 x) \<le> norm (f1 x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f1 x + f2 x = f1 x * ((1::'b) + f2 x / f1 x)
[PROOF STEP]
by eventually_elim (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f1 x + f2 x = f1 x * ((1::'b) + f2 x / f1 x)

goal (1 subgoal):
 1. ((\<lambda>x. f1 x * ((1::'b) + f2 x / f1 x)) \<longlongrightarrow> a) F
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. f1 x * ((1::'b) + f2 x / f1 x)) \<longlongrightarrow> a) F
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
(f1 \<longlongrightarrow> a) F
[PROOF STEP]
show "((\<lambda>x. f1 x * (1 + f2 x / f1 x)) \<longlongrightarrow> a) F"
[PROOF STATE]
proof (prove)
using this:
(f1 \<longlongrightarrow> a) F

goal (1 subgoal):
 1. ((\<lambda>x. f1 x * ((1::'b) + f2 x / f1 x)) \<longlongrightarrow> a) F
[PROOF STEP]
by (force intro: tendsto_eq_intros smalloD_tendsto[OF assms(2)])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f1 x * ((1::'b) + f2 x / f1 x)) \<longlongrightarrow> a) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma part_circlepath_conv_subpath:
  "part_circlepath c r a b = subpath (a / (2*pi)) (b / (2*pi)) (circlepath c r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. part_circlepath c r a b = subpath (a / (2 * pi)) (b / (2 * pi)) (circlepath c r)
[PROOF STEP]
by (simp add: part_circlepath_def circlepath_def subpath_def linepath_def algebra_simps exp_eq_polar)


[STATEMENT]
lemma exp_of_real_cnj:
  fixes x ::real
  shows "cnj (exp (\<i> * x)) = exp (-(\<i> * x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (exp (\<i> * complex_of_real x)) = exp (- (\<i> * complex_of_real x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Re (cnj (exp (\<i> * complex_of_real x))) = Re (exp (- (\<i> * complex_of_real x)))
 2. Im (cnj (exp (\<i> * complex_of_real x))) = Im (exp (- (\<i> * complex_of_real x)))
[PROOF STEP]
show "Re (cnj (exp (\<i> * x))) = Re (exp (-(\<i> * x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (cnj (exp (\<i> * complex_of_real x))) = Re (exp (- (\<i> * complex_of_real x)))
[PROOF STEP]
using Re_exp
[PROOF STATE]
proof (prove)
using this:
Re (exp ?z) = exp (Re ?z) * cos (Im ?z)

goal (1 subgoal):
 1. Re (cnj (exp (\<i> * complex_of_real x))) = Re (exp (- (\<i> * complex_of_real x)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Re (cnj (exp (\<i> * complex_of_real x))) = Re (exp (- (\<i> * complex_of_real x)))

goal (1 subgoal):
 1. Im (cnj (exp (\<i> * complex_of_real x))) = Im (exp (- (\<i> * complex_of_real x)))
[PROOF STEP]
show "Im (cnj (exp (\<i> * x))) = Im (exp (-(\<i> * x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (cnj (exp (\<i> * complex_of_real x))) = Im (exp (- (\<i> * complex_of_real x)))
[PROOF STEP]
using Im_exp
[PROOF STATE]
proof (prove)
using this:
Im (exp ?z) = exp (Re ?z) * sin (Im ?z)

goal (1 subgoal):
 1. Im (cnj (exp (\<i> * complex_of_real x))) = Im (exp (- (\<i> * complex_of_real x)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Im (cnj (exp (\<i> * complex_of_real x))) = Im (exp (- (\<i> * complex_of_real x)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complex_mod_sqrt_Re_mult_cnj: "cmod z = sqrt (Re (z * cnj z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod z = sqrt (Re (z * cnj z))
[PROOF STEP]
by (simp add: norm_complex_def power2_eq_square)


[STATEMENT]
lemma span_INT: "span (\<Inter>a\<in>A. span (f a)) = (\<Inter>a\<in>A. span (f a))" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (\<Inter>a\<in>A. span (f a)) = (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (f a))
 2. (\<Inter>a\<in>A. span (f a)) \<subseteq> span (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
have "?l \<subseteq> (\<Inter>a\<in>A. span (span (f a)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (span (f a)))
[PROOF STEP]
by (rule span_INT_subset)
[PROOF STATE]
proof (state)
this:
span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (span (f a)))

goal (2 subgoals):
 1. span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (f a))
 2. (\<Inter>a\<in>A. span (f a)) \<subseteq> span (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (span (f a)))

goal (2 subgoals):
 1. span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (f a))
 2. (\<Inter>a\<in>A. span (f a)) \<subseteq> span (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
have "... = ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>a\<in>A. span (span (f a))) = (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
by (simp add: span_span)
[PROOF STATE]
proof (state)
this:
(\<Inter>a\<in>A. span (span (f a))) = (\<Inter>a\<in>A. span (f a))

goal (2 subgoals):
 1. span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (f a))
 2. (\<Inter>a\<in>A. span (f a)) \<subseteq> span (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
show "?l \<subseteq> ?r"
[PROOF STATE]
proof (prove)
using this:
span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (f a))

goal (1 subgoal):
 1. span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
span (\<Inter>a\<in>A. span (f a)) \<subseteq> (\<Inter>a\<in>A. span (f a))

goal (1 subgoal):
 1. (\<Inter>a\<in>A. span (f a)) \<subseteq> span (\<Inter>a\<in>A. span (f a))
[PROOF STEP]
qed (fact span_superset)


[STATEMENT]
lemma lin_comb_mat_lin_indpt_vs:
  fixes A :: "'a vec list"
  assumes "set (A) \<subseteq> carrier_vec n"
  assumes "distinct A"
  assumes "\<And> f. mat_of_cols n A *\<^sub>v vec (length A) (\<lambda>i. f (A ! i))  = 0\<^sub>v n \<Longrightarrow> \<forall>v\<in> (set A). f v = 0"
  shows "lin_indpt_vs (set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt_vs (set A)
[PROOF STEP]
using lin_comb_mat_lin_indpt lin_indpt_vs_def assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?A \<subseteq> carrier_vec n; distinct ?A; \<And>f. mat_of_cols n ?A *\<^sub>v vec (length ?A) (\<lambda>i. f (?A ! i)) = 0\<^sub>v n \<Longrightarrow> \<forall>v\<in>set ?A. f v = (0::'a)\<rbrakk> \<Longrightarrow> lin_indpt (set ?A)
lin_indpt_vs ?A = lin_indpt ?A
set A \<subseteq> carrier_vec n
distinct A
mat_of_cols n A *\<^sub>v vec (length A) (\<lambda>i. ?f1 (A ! i)) = 0\<^sub>v n \<Longrightarrow> \<forall>v\<in>set A. ?f1 v = (0::'a)

goal (1 subgoal):
 1. lin_indpt_vs (set A)
[PROOF STEP]
by auto


[STATEMENT]
lemma exp_scaleR_diagonal2:
  assumes "mtx_invertible P" and "A = P * (\<d>\<i>\<a>\<g> i. f i) * P\<^sup>-\<^sup>1"
    shows "exp (t *\<^sub>R A) = P * (\<d>\<i>\<a>\<g> i. exp (t * f i)) * P\<^sup>-\<^sup>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (t *\<^sub>R A) = P * (\<d>\<i>\<a>\<g> i. exp (t * f i)) * P\<^sup>-\<^sup>1
[PROOF STEP]
apply(subst sq_mtx_inv_idempotent[OF assms(1), symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (t *\<^sub>R A) = P\<^sup>-\<^sup>1\<^sup>-\<^sup>1 * (\<d>\<i>\<a>\<g> i. exp (t * f i)) * P\<^sup>-\<^sup>1
[PROOF STEP]
apply(rule exp_scaleR_diagonal1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. mtx_invertible P\<^sup>-\<^sup>1
 2. A = P\<^sup>-\<^sup>1\<^sup>-\<^sup>1 * (\<d>\<i>\<a>\<g> i. f i) * P\<^sup>-\<^sup>1
[PROOF STEP]
by (simp_all add: assms)


[STATEMENT]
lemma mset_psubset_iff:
  "X \<subset># Y \<longleftrightarrow> X \<subseteq># Y \<and> (\<exists>x. count X x < count Y x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<subset># Y) = (X \<subseteq># Y \<and> (\<exists>x. count X x < count Y x))
[PROOF STEP]
by (meson less_le_not_le subset_mset.less_le_not_le subseteq_mset_def)


[STATEMENT]
lemma bi_unique_pred_set_conv[pred_set_conv]: "bi_unique (\<lambda> x y. (x, y) \<in> R) \<longleftrightarrow> bijective R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bi_unique (\<lambda>x y. (x, y) \<in> R) = bijective R
[PROOF STEP]
unfolding bi_unique_def bijective_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>x y z. (x, y) \<in> R \<longrightarrow> (x, z) \<in> R \<longrightarrow> y = z) \<and> (\<forall>x y z. (x, z) \<in> R \<longrightarrow> (y, z) \<in> R \<longrightarrow> x = y)) = ((\<forall>x y z. (x, y) \<in> R \<and> (x, z) \<in> R \<longrightarrow> y = z) \<and> (\<forall>x y z. (x, z) \<in> R \<and> (y, z) \<in> R \<longrightarrow> x = y))
[PROOF STEP]
by blast


[STATEMENT]
lemma matrix_equation_main_step:
  fixes p:: "real poly"
  fixes qs:: "real poly list"
  fixes I:: "nat list"
  fixes signs:: "rat list list"
  assumes nonzero: "p\<noteq>0"
  assumes distinct_signs: "distinct signs"
  assumes all_info: "set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set(signs)"
  assumes welldefined: "list_constr I (length qs)"
  assumes pairwise_rel_prime_1: "\<forall>q. ((List.member qs q) \<longrightarrow> (coprime p q))"
  shows "(vec_of_list (mtx_row signs I) \<bullet> (construct_lhs_vector p qs signs)) =
    construct_NofI p (retrieve_polys qs I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = construct_NofI p (retrieve_polys qs I)
[PROOF STEP]
unfolding construct_NofI_prop[OF nonzero]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = rat_of_int (int (card {x. poly p x = 0 \<and> 0 < poly (prod_list (retrieve_polys qs I)) x}) - int (card {x. poly p x = 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0}))
[PROOF STEP]
using matrix_equation_helper_step[OF assms]
[PROOF STATE]
proof (prove)
using this:
vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = rat_of_int (int (card {x. poly p x = 0 \<and> 0 < poly (prod_list (retrieve_polys qs I)) x})) - rat_of_int (int (card {x. poly p x = 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0}))

goal (1 subgoal):
 1. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = rat_of_int (int (card {x. poly p x = 0 \<and> 0 < poly (prod_list (retrieve_polys qs I)) x}) - int (card {x. poly p x = 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0}))
[PROOF STEP]
by linarith


[STATEMENT]
lemma rank_eq_card_iarrays':
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}"
  shows "rank A = (let A' = (Gauss_Jordan_iarrays (matrix_to_iarray A)) in card {row_iarray (to_nat i) A' |i::'rows. \<not> is_zero_iarray (A' !! (to_nat i))})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = (let A' = Gauss_Jordan_iarrays (matrix_to_iarray A) in card {row_iarray (mod_type_class.to_nat i) A' |i. \<not> is_zero_iarray (A' !! mod_type_class.to_nat i)})
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = card {row_iarray (mod_type_class.to_nat i) (Gauss_Jordan_iarrays (matrix_to_iarray A)) |i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)}
[PROOF STEP]
unfolding rank_eq_card_iarrays vec_to_iarray_row'  matrix_to_iarray_Gauss_Jordan row_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i |i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)} = card {Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i |i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)}
[PROOF STEP]
..


[STATEMENT]
lemma eexp_add_mult:
  assumes "\<not>((a = \<infinity> \<and> b = -\<infinity>) \<or> (a = -\<infinity> \<and> b = \<infinity>))"
  shows "eexp(a+b) = eexp a * eexp b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eexp (a + b) = eexp a * eexp b
[PROOF STEP]
using ennexp_add_mult[OF assms]
[PROOF STATE]
proof (prove)
using this:
ennexp (a + b) = ennexp a * ennexp b

goal (1 subgoal):
 1. eexp (a + b) = eexp a * eexp b
[PROOF STEP]
unfolding eexp_def
[PROOF STATE]
proof (prove)
using this:
ennexp (a + b) = ennexp a * ennexp b

goal (1 subgoal):
 1. enn2ereal (ennexp (a + b)) = enn2ereal (ennexp a) * enn2ereal (ennexp b)
[PROOF STEP]
by (simp add: times_ennreal.rep_eq)


[STATEMENT]
lemma
  assumes "0 \<le> x" "x \<le> 1"
  shows hf_nonneg: "0 \<le> hf n x" and hf_le_inverse_fact: "hf n x \<le> 1/fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> hf n x &&& hf n x \<le> 1 / fact n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. 0 \<le> hf n x &&& hf n x \<le> 1 / fact n
[PROOF STEP]
by (auto simp: hf_def divide_simps mult_le_one power_le_one)


[STATEMENT]
lemma cmod_square_less_1_plus:
  assumes "Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1"
    shows "(cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
[PROOF STEP]
proof (cases "Im z = 0 \<or> Re z = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Im z = 0 \<or> Re z = 0 \<Longrightarrow> (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
 2. \<not> (Im z = 0 \<or> Re z = 0) \<Longrightarrow> (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Im z = 0 \<or> Re z = 0

goal (2 subgoals):
 1. Im z = 0 \<or> Re z = 0 \<Longrightarrow> (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
 2. \<not> (Im z = 0 \<or> Re z = 0) \<Longrightarrow> (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
[PROOF STEP]
with assms abs_square_less_1
[PROOF STATE]
proof (chain)
picking this:
Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1
(?x\<^sup>2 < (1::?'a)) = (\<bar>?x\<bar> < (1::?'a))
Im z = 0 \<or> Re z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1
(?x\<^sup>2 < (1::?'a)) = (\<bar>?x\<bar> < (1::?'a))
Im z = 0 \<or> Re z = 0

goal (1 subgoal):
 1. (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
[PROOF STEP]
by (force simp add: Re_power2 Im_power2 cmod_def)
[PROOF STATE]
proof (state)
this:
(cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)

goal (1 subgoal):
 1. \<not> (Im z = 0 \<or> Re z = 0) \<Longrightarrow> (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (Im z = 0 \<or> Re z = 0) \<Longrightarrow> (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (Im z = 0 \<or> Re z = 0)

goal (1 subgoal):
 1. \<not> (Im z = 0 \<or> Re z = 0) \<Longrightarrow> (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
[PROOF STEP]
with cmod_diff_real_less [of "1 - z\<^sup>2" "1"]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>Im (1 - z\<^sup>2) \<noteq> 0; 1 \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (1 - z\<^sup>2 - complex_of_real 1) < cmod (1 - z\<^sup>2) + \<bar>1\<bar>
\<not> (Im z = 0 \<or> Re z = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Im (1 - z\<^sup>2) \<noteq> 0; 1 \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (1 - z\<^sup>2 - complex_of_real 1) < cmod (1 - z\<^sup>2) + \<bar>1\<bar>
\<not> (Im z = 0 \<or> Re z = 0)

goal (1 subgoal):
 1. (cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)
[PROOF STEP]
by (simp add: norm_power Im_power2)
[PROOF STATE]
proof (state)
this:
(cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_space_row_space:
  assumes A: "A \<in> carrier_mat nr n"
  shows "vectorspace class_ring (vs (row_space A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace class_ring (vs (row_space A))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vectorspace class_ring (vs (row_space A))
[PROOF STEP]
have fin: "finite (set (rows A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set (rows A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (set (rows A))

goal (1 subgoal):
 1. vectorspace class_ring (vs (row_space A))
[PROOF STEP]
have s: "set (rows A) \<subseteq> carrier V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (rows A) \<subseteq> carrier V
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr n

goal (1 subgoal):
 1. set (rows A) \<subseteq> carrier V
[PROOF STEP]
unfolding rows_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr n

goal (1 subgoal):
 1. set (map (row A) [0..<dim_row A]) \<subseteq> carrier V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (rows A) \<subseteq> carrier V

goal (1 subgoal):
 1. vectorspace class_ring (vs (row_space A))
[PROOF STEP]
have "span_vs (set (rows A)) = vs (span (set (rows A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vs (local.span (set (rows A))) = vs (local.span (set (rows A)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vs (local.span (set (rows A))) = vs (local.span (set (rows A)))

goal (1 subgoal):
 1. vectorspace class_ring (vs (row_space A))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vs (local.span (set (rows A))) = vs (local.span (set (rows A)))

goal (1 subgoal):
 1. vectorspace class_ring (vs (row_space A))
[PROOF STEP]
have "vectorspace class_ring (span_vs (set (rows A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace class_ring (vs (local.span (set (rows A))))
[PROOF STEP]
using fin s span_is_subspace subspace_def subspace_is_vs
[PROOF STATE]
proof (prove)
using this:
finite (set (rows A))
set (rows A) \<subseteq> carrier V
?S \<subseteq> carrier_vec n \<Longrightarrow> subspace class_ring (local.span ?S) V
subspace ?K ?W ?V \<equiv> vectorspace ?K ?V \<and> LinearCombinations.submodule ?K ?W ?V
subspace class_ring ?W V \<Longrightarrow> vectorspace class_ring (vs ?W)

goal (1 subgoal):
 1. vectorspace class_ring (vs (local.span (set (rows A))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vectorspace class_ring (vs (local.span (set (rows A))))

goal (1 subgoal):
 1. vectorspace class_ring (vs (row_space A))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
vs (local.span (set (rows A))) = vs (local.span (set (rows A)))
vectorspace class_ring (vs (local.span (set (rows A))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vs (local.span (set (rows A))) = vs (local.span (set (rows A)))
vectorspace class_ring (vs (local.span (set (rows A))))

goal (1 subgoal):
 1. vectorspace class_ring (vs (row_space A))
[PROOF STEP]
unfolding row_space_def
[PROOF STATE]
proof (prove)
using this:
vs (local.span (set (rows A))) = vs (local.span (set (rows A)))
vectorspace class_ring (vs (local.span (set (rows A))))

goal (1 subgoal):
 1. vectorspace class_ring (vs (local.span (set (rows A))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vectorspace class_ring (vs (row_space A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mset_le_add_iff1:
  "j \<le> (i::nat) \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i-j) u + m \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
assume "j \<le> i"
[PROOF STATE]
proof (state)
this:
j \<le> i

goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j \<le> i
[PROOF STEP]
have "j + (i - j) = i"
[PROOF STATE]
proof (prove)
using this:
j \<le> i

goal (1 subgoal):
 1. j + (i - j) = i
[PROOF STEP]
using le_add_diff_inverse
[PROOF STATE]
proof (prove)
using this:
j \<le> i
?b \<le> ?a \<Longrightarrow> ?b + (?a - ?b) = ?a

goal (1 subgoal):
 1. j + (i - j) = i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
j + (i - j) = i

goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j + (i - j) = i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
j + (i - j) = i

goal (1 subgoal):
 1. (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
by (metis (no_types) add_le_cancel_left left_add_mult_distrib_mset)
[PROOF STATE]
proof (state)
this:
(repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lim_null_comparison:
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
  assumes "eventually (\<lambda>x. norm (f x) \<le> g x) net" "(g \<longlongrightarrow> 0) net"
  shows "(f \<longlongrightarrow> 0) net"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> (0::'b)) net
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
(g \<longlongrightarrow> 0) net

goal (1 subgoal):
 1. (f \<longlongrightarrow> (0::'b)) net
[PROOF STEP]
proof (rule metric_tendsto_imp_tendsto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. dist (f x) (0::'b) \<le> dist (g x) 0
[PROOF STEP]
show "eventually (\<lambda>x. dist (f x) 0 \<le> dist (g x) 0) net"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. dist (f x) (0::'b) \<le> dist (g x) 0
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in net. norm (f x) \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. dist (f x) (0::'b) \<le> dist (g x) 0
[PROOF STEP]
by (rule eventually_mono) (simp add: dist_norm)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in net. dist (f x) (0::'b) \<le> dist (g x) 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_diff_one [simp]: "\<lfloor>x - 1\<rfloor> = \<lfloor>x\<rfloor> - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x - (1::'a)\<rfloor> = \<lfloor>x\<rfloor> - 1
[PROOF STEP]
using floor_diff_of_int [of x 1]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>x - of_int 1\<rfloor> = \<lfloor>x\<rfloor> - 1

goal (1 subgoal):
 1. \<lfloor>x - (1::'a)\<rfloor> = \<lfloor>x\<rfloor> - 1
[PROOF STEP]
by simp


[STATEMENT]
lemma ln_fact_conv_sum_upto_mangoldt:
  "ln (fact n) = sum_upto (\<lambda>k. mangoldt k * (n div k)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
have [simp]: "{0<..Suc n} = insert (Suc n) {0<..n}" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0<..Suc n} = insert (Suc n) {0<..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0<..Suc ?n} = insert (Suc ?n) {0<..?n}

goal (1 subgoal):
 1. ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
have "ln (fact n) = sum_upto (\<lambda>n. ln (real n)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact n) = sum_upto (\<lambda>n. ln (real n)) (real n)
[PROOF STEP]
by (induction n) (auto simp: sum_upto_altdef nat_add_distrib ln_mult)
[PROOF STATE]
proof (state)
this:
ln (fact n) = sum_upto (\<lambda>n. ln (real n)) (real n)

goal (1 subgoal):
 1. ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (fact n) = sum_upto (\<lambda>n. ln (real n)) (real n)

goal (1 subgoal):
 1. ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
have "\<dots> = sum_upto (\<lambda>k. mangoldt k * (n div k)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) (real n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
unfolding sum_upto_ln_conv_sum_upto_mangoldt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>na. mangoldt na * real (nat \<lfloor>real n / real na\<rfloor>)) (real n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
by (intro sum_upto_cong) (auto simp: floor_divide_of_nat_eq)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. ln (real n)) (real n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)

goal (1 subgoal):
 1. ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)

goal (1 subgoal):
 1. ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln (fact n) = sum_upto (\<lambda>k. mangoldt k * real (n div k)) (real n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_sqrt_le_mono: "x \<le> y \<Longrightarrow> sqrt x \<le> sqrt y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> sqrt x \<le> sqrt y
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> root 2 x \<le> root 2 y
[PROOF STEP]
by (rule real_root_le_mono [OF pos2])


[STATEMENT]
lemma Norm_cmult:
  "Norm N (c *\<^sub>R x) = abs c * Norm N x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Norm N (c *\<^sub>R x) = \<bar>c\<bar> * Norm N x
[PROOF STEP]
unfolding Norm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (eNorm N (c *\<^sub>R x)) = \<bar>c\<bar> * enn2real (eNorm N x)
[PROOF STEP]
unfolding eNorm_cmult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (ennreal \<bar>c\<bar> * eNorm N x) = \<bar>c\<bar> * enn2real (eNorm N x)
[PROOF STEP]
by (simp add: enn2real_mult)


[STATEMENT]
lemma Union_atLeastAtMost:
  assumes "N > 0"
  shows   "(\<Union>n\<in>{0..<N}. {real n..real (n + 1)}) = {0..real N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>n\<in>{0..<N}. {real n..real (n + 1)}) = {0..real N}
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)}) \<Longrightarrow> x \<in> {0..real N}
 2. \<And>x. x \<in> {0..real N} \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)}) \<Longrightarrow> x \<in> {0..real N}
 2. \<And>x. x \<in> {0..real N} \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
assume x: "x \<in> {0..real N}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..real N}

goal (2 subgoals):
 1. \<And>x. x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)}) \<Longrightarrow> x \<in> {0..real N}
 2. \<And>x. x \<in> {0..real N} \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
thus "x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..real N}

goal (1 subgoal):
 1. x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
proof (cases "x = real N")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>x \<in> {0..real N}; x = real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
 2. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = real N

goal (2 subgoals):
 1. \<lbrakk>x \<in> {0..real N}; x = real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
 2. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < N
x = real N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < N
x = real N

goal (1 subgoal):
 1. x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
by (auto intro!: bexI[of _ "N - 1"])
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})

goal (1 subgoal):
 1. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> real N

goal (1 subgoal):
 1. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0..real N}
x \<noteq> real N
[PROOF STEP]
have x: "x \<ge> 0" "x < real N"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..real N}
x \<noteq> real N

goal (1 subgoal):
 1. 0 \<le> x &&& x < real N
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 \<le> x
x < real N

goal (1 subgoal):
 1. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
hence "x \<ge> real (nat \<lfloor>x\<rfloor>)" "x \<le> real (nat \<lfloor>x\<rfloor> + 1)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x < real N

goal (1 subgoal):
 1. real (nat \<lfloor>x\<rfloor>) \<le> x &&& x \<le> real (nat \<lfloor>x\<rfloor> + 1)
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
real (nat \<lfloor>x\<rfloor>) \<le> x
x \<le> real (nat \<lfloor>x\<rfloor> + 1)

goal (1 subgoal):
 1. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (nat \<lfloor>x\<rfloor>) \<le> x
x \<le> real (nat \<lfloor>x\<rfloor> + 1)

goal (1 subgoal):
 1. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
x < real N
[PROOF STEP]
have "nat \<lfloor>x\<rfloor> < N"
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x < real N

goal (1 subgoal):
 1. nat \<lfloor>x\<rfloor> < N
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
nat \<lfloor>x\<rfloor> < N

goal (1 subgoal):
 1. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (nat \<lfloor>x\<rfloor>) \<le> x
x \<le> real (nat \<lfloor>x\<rfloor> + 1)
nat \<lfloor>x\<rfloor> < N
[PROOF STEP]
have "\<exists>n\<in>{0..<N}. x \<in> {real n..real (n + 1)}"
[PROOF STATE]
proof (prove)
using this:
real (nat \<lfloor>x\<rfloor>) \<le> x
x \<le> real (nat \<lfloor>x\<rfloor> + 1)
nat \<lfloor>x\<rfloor> < N

goal (1 subgoal):
 1. \<exists>n\<in>{0..<N}. x \<in> {real n..real (n + 1)}
[PROOF STEP]
by (intro bexI[of _ "nat \<lfloor>x\<rfloor>"]) simp_all
[PROOF STATE]
proof (state)
this:
\<exists>n\<in>{0..<N}. x \<in> {real n..real (n + 1)}

goal (1 subgoal):
 1. \<lbrakk>x \<in> {0..real N}; x \<noteq> real N\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>n\<in>{0..<N}. x \<in> {real n..real (n + 1)}

goal (1 subgoal):
 1. x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)})

goal (1 subgoal):
 1. \<And>x. x \<in> (\<Union>n\<in>{0..<N}. {real n..real (n + 1)}) \<Longrightarrow> x \<in> {0..real N}
[PROOF STEP]
qed auto


[STATEMENT]
lemma affine_hull_2:
  fixes a b :: "'a::real_vector"
  shows "affine hull {a,b} = {u *\<^sub>R a + v *\<^sub>R b| u v. (u + v = 1)}"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
have *:
    "\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::real)"
    "\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y z. (z = x - y) = (y + z = x)) &&& (\<And>x y z. (z = x - y) = (y + z = x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(?z = ?x - ?y) = (?y + ?z = ?x)
(?z = ?x - ?y) = (?y + ?z = ?x)

goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
have "?lhs = {y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull {a, b} = {y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}
[PROOF STEP]
using affine_hull_finite[of "{a,b}"]
[PROOF STATE]
proof (prove)
using this:
finite {a, b} \<Longrightarrow> affine hull {a, b} = {y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}

goal (1 subgoal):
 1. affine hull {a, b} = {y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull {a, b} = {y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}

goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
affine hull {a, b} = {y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}

goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
have "\<dots> = {y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y} = {y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a}
[PROOF STEP]
by (simp add: affine_hull_finite_step[of "{b}" a])
[PROOF STATE]
proof (state)
this:
{y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y} = {y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a}

goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{y. \<exists>u. sum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y} = {y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a}

goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>v u. v + u b = 1 \<and> v *\<^sub>R a + u b *\<^sub>R b = y} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}

goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}

goal (1 subgoal):
 1. affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull {a, b} = {u *\<^sub>R a + v *\<^sub>R b |u v. u + v = 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem F2map_cong: "\<lbrakk>\<And>z. z \<in> F2set x \<Longrightarrow> f z = g z\<rbrakk> \<Longrightarrow> F2map f x = F2map g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. z \<in> F2set x \<Longrightarrow> f z = g z) \<Longrightarrow> F2map f x = F2map g x
[PROOF STEP]
apply (rule F.map_cong0)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>z1. \<lbrakk>\<And>z. z \<in> F2set x \<Longrightarrow> f z = g z; z1 \<in> Fset1 x\<rbrakk> \<Longrightarrow> id z1 = id z1
 2. \<And>z2. \<lbrakk>\<And>z. z \<in> F2set x \<Longrightarrow> f z = g z; z2 \<in> F1set1 x\<rbrakk> \<Longrightarrow> id z2 = id z2
 3. \<And>z3. \<lbrakk>\<And>z. z \<in> F2set x \<Longrightarrow> f z = g z; z3 \<in> F2set x\<rbrakk> \<Longrightarrow> f z3 = g z3
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>z2. \<lbrakk>\<And>z. z \<in> F2set x \<Longrightarrow> f z = g z; z2 \<in> F1set1 x\<rbrakk> \<Longrightarrow> id z2 = id z2
 2. \<And>z3. \<lbrakk>\<And>z. z \<in> F2set x \<Longrightarrow> f z = g z; z3 \<in> F2set x\<rbrakk> \<Longrightarrow> f z3 = g z3
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z3. \<lbrakk>\<And>z. z \<in> F2set x \<Longrightarrow> f z = g z; z3 \<in> F2set x\<rbrakk> \<Longrightarrow> f z3 = g z3
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done