[STATEMENT]
lemma subfrmlsn_card:
  "card (subfrmlsn \<phi>) \<le> size \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (subfrmlsn \<phi>) \<le> size \<phi>
[PROOF STEP]
by (induction \<phi>) (simp_all add: card_insert_if subfrmlsn_finite, (meson add_le_mono card_Un_le dual_order.trans le_SucI)+)


[STATEMENT]
lemma Maclaurin_exp_lt:
  fixes x :: real and n :: nat
  shows
    "x \<noteq> 0 \<Longrightarrow> n > 0 \<Longrightarrow>
      (\<exists>t. 0 < \<bar>t\<bar> \<and> \<bar>t\<bar> < \<bar>x\<bar> \<and> exp x = (\<Sum>m<n. (x ^ m) / fact m) + (exp t / fact n) * x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<noteq> 0; 0 < n\<rbrakk> \<Longrightarrow> \<exists>t. 0 < \<bar>t\<bar> \<and> \<bar>t\<bar> < \<bar>x\<bar> \<and> exp x = (\<Sum>m<n. x ^ m / fact m) + exp t / fact n * x ^ n
[PROOF STEP]
using Maclaurin_all_lt [where diff = "\<lambda>n. exp" and f = exp and x = x and n = n]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>exp = exp; 0 < n; x \<noteq> 0; \<forall>m x. (exp has_real_derivative exp x) (at x)\<rbrakk> \<Longrightarrow> \<exists>t. 0 < \<bar>t\<bar> \<and> \<bar>t\<bar> < \<bar>x\<bar> \<and> exp x = (\<Sum>m<n. exp 0 / fact m * x ^ m) + exp t / fact n * x ^ n

goal (1 subgoal):
 1. \<lbrakk>x \<noteq> 0; 0 < n\<rbrakk> \<Longrightarrow> \<exists>t. 0 < \<bar>t\<bar> \<and> \<bar>t\<bar> < \<bar>x\<bar> \<and> exp x = (\<Sum>m<n. x ^ m / fact m) + exp t / fact n * x ^ n
[PROOF STEP]
by auto


[STATEMENT]
lemma succ_tran_set: "set (succ_tran G v) = {e2. (v,e2) \<in> (set (edgesL G))\<^sup>+}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (FiniteListGraph.succ_tran G v) = {e2. (v, e2) \<in> (set (edgesL G))\<^sup>+}
[PROOF STEP]
unfolding succ_tran_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (trancl_list_impl (edgesL G) [v]) = {e2. (v, e2) \<in> (set (edgesL G))\<^sup>+}
[PROOF STEP]
by (simp add: trancl_list_impl)


[STATEMENT]
lemma lower_split_interval1: "lower (fst (split_interval X m)) = min (lower X) m"
  and lower_split_interval2: "lower (snd (split_interval X m)) = min (upper X) m"
  and upper_split_interval1: "upper (fst (split_interval X m)) = max (lower X) m"
  and upper_split_interval2: "upper (snd (split_interval X m)) = max (upper X) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lower (fst (split_interval X m)) = min (lower X) m &&& lower (snd (split_interval X m)) = min (upper X) m) &&& upper (fst (split_interval X m)) = max (lower X) m &&& upper (snd (split_interval X m)) = max (upper X) m
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower (fst (split_interval X m)) = min (lower X) m
[PROOF STEP]
by transfer auto
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. lower (snd (split_interval X m)) = min (upper X) m
 2. upper (fst (split_interval X m)) = max (lower X) m
 3. upper (snd (split_interval X m)) = max (upper X) m
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower (snd (split_interval X m)) = min (upper X) m
[PROOF STEP]
by transfer (auto simp: min.commute)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. upper (fst (split_interval X m)) = max (lower X) m
 2. upper (snd (split_interval X m)) = max (upper X) m
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper (fst (split_interval X m)) = max (lower X) m
[PROOF STEP]
by transfer auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper (snd (split_interval X m)) = max (upper X) m
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper (snd (split_interval X m)) = max (upper X) m
[PROOF STEP]
by transfer auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma xor_left_commute:
  fixes x y :: "'a :: boolean_algebra"
  shows "x \<oplus> (y \<oplus> z) = y \<oplus> (x \<oplus> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<oplus> y \<oplus> z = y \<oplus> x \<oplus> z
[PROOF STEP]
by (metis xor_assoc xor_commute)


[STATEMENT]
lemma signed_real_of_word_sum_less_numeral_iff:
  \<open>signed_real_of_word v + signed_real_of_word w < numeral n
    \<longleftrightarrow> sint v + sint w < numeral n\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (signed_real_of_word v + signed_real_of_word w < numeral n) = (sint v + sint w < numeral n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (signed_real_of_word v + signed_real_of_word w < numeral n) = (sint v + sint w < numeral n)
[PROOF STEP]
have \<open>?Q \<longleftrightarrow> real_of_int (sint v + sint w) < real_of_int (numeral n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sint v + sint w < numeral n) = (real_of_int (sint v + sint w) < real_of_int (numeral n))
[PROOF STEP]
by (simp only: of_int_less_iff)
[PROOF STATE]
proof (state)
this:
(sint v + sint w < numeral n) = (real_of_int (sint v + sint w) < real_of_int (numeral n))

goal (1 subgoal):
 1. (signed_real_of_word v + signed_real_of_word w < numeral n) = (sint v + sint w < numeral n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(sint v + sint w < numeral n) = (real_of_int (sint v + sint w) < real_of_int (numeral n))

goal (1 subgoal):
 1. (signed_real_of_word v + signed_real_of_word w < numeral n) = (sint v + sint w < numeral n)
[PROOF STEP]
have \<open>\<dots> \<longleftrightarrow> ?P\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_int (sint v + sint w) < real_of_int (numeral n)) = (signed_real_of_word v + signed_real_of_word w < numeral n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(real_of_int (sint v + sint w) < real_of_int (numeral n)) = (signed_real_of_word v + signed_real_of_word w < numeral n)

goal (1 subgoal):
 1. (signed_real_of_word v + signed_real_of_word w < numeral n) = (sint v + sint w < numeral n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(sint v + sint w < numeral n) = (signed_real_of_word v + signed_real_of_word w < numeral n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(sint v + sint w < numeral n) = (signed_real_of_word v + signed_real_of_word w < numeral n)

goal (1 subgoal):
 1. (signed_real_of_word v + signed_real_of_word w < numeral n) = (sint v + sint w < numeral n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(signed_real_of_word v + signed_real_of_word w < numeral n) = (sint v + sint w < numeral n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arcsin_less_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arcsin x < arcsin y \<longleftrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<bar>x\<bar> \<le> 1; \<bar>y\<bar> \<le> 1\<rbrakk> \<Longrightarrow> (arcsin x < arcsin y) = (x < y)
[PROOF STEP]
by (rule trans [OF sin_mono_less_eq [symmetric]]) (use arcsin_ubound arcsin_lbound in auto)


[STATEMENT]
lemma holomorphic_on_sum [holomorphic_intros]:
  "(\<And>i. i \<in> I \<Longrightarrow> (f i) holomorphic_on s) \<Longrightarrow> (\<lambda>x. sum (\<lambda>i. f i x) I) holomorphic_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> f i holomorphic_on s) \<Longrightarrow> (\<lambda>x. \<Sum>i\<in>I. f i x) holomorphic_on s
[PROOF STEP]
unfolding holomorphic_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> \<forall>x\<in>s. f i field_differentiable at x within s) \<Longrightarrow> \<forall>x\<in>s. (\<lambda>x. \<Sum>i\<in>I. f i x) field_differentiable at x within s
[PROOF STEP]
by (metis field_differentiable_sum)


[STATEMENT]
lemma minus_zero [simp]: "- (0::'a) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (0::'a) = (0::'a)
[PROOF STEP]
by (simp add: negate_eq1)


[STATEMENT]
lemma degree_le:
  assumes d: "\<forall>j \<ge> d. pdevs_apply x j = 0"
  shows "degree x \<le> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree x \<le> d
[PROOF STEP]
unfolding degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST i. \<forall>j\<ge>i. pdevs_apply x j = (0::'a)) \<le> d
[PROOF STEP]
by (rule Least_le) (rule d)


[STATEMENT]
lemma notFinished_WtFT[simp]:
assumes "n < length cl" and "\<not> finished (cl ! n)"
shows "1 / length cl \<le> 1 - WtFT cl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real (length cl) \<le> 1 - WtFT cl
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / real (length cl) \<le> 1 - WtFT cl
[PROOF STEP]
have "0 < length cl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < length cl
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < length cl
\<not> finished (cl ! n)

goal (1 subgoal):
 1. 0 < length cl
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < length cl

goal (1 subgoal):
 1. 1 / real (length cl) \<le> 1 - WtFT cl
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < length cl

goal (1 subgoal):
 1. 1 / real (length cl) \<le> 1 - WtFT cl
[PROOF STEP]
unfolding WtFT_def
[PROOF STATE]
proof (prove)
using this:
0 < length cl

goal (1 subgoal):
 1. 1 / real (length cl) \<le> 1 - (\<Sum>n\<in>theFT cl. 1 / real (length cl))
[PROOF STEP]
apply(intro sum_1[of "{..< length cl}"])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. 0 < length cl \<Longrightarrow> finite {..<length cl}
 2. 0 < length cl \<Longrightarrow> (\<Sum>n<length cl. 1 / real (length cl)) = 1
 3. 0 < length cl \<Longrightarrow> ?i1 \<in> {..<length cl} - theFT cl
 4. 0 < length cl \<Longrightarrow> theFT cl \<subseteq> {..<length cl}
 5. \<And>i. \<lbrakk>0 < length cl; i \<in> {..<length cl}\<rbrakk> \<Longrightarrow> 0 \<le> 1 / real (length cl)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < length cl
\<not> finished (cl ! n)

goal (5 subgoals):
 1. 0 < length cl \<Longrightarrow> finite {..<length cl}
 2. 0 < length cl \<Longrightarrow> (\<Sum>n<length cl. 1 / real (length cl)) = 1
 3. 0 < length cl \<Longrightarrow> ?i1 \<in> {..<length cl} - theFT cl
 4. 0 < length cl \<Longrightarrow> theFT cl \<subseteq> {..<length cl}
 5. \<And>i. \<lbrakk>0 < length cl; i \<in> {..<length cl}\<rbrakk> \<Longrightarrow> 0 \<le> 1 / real (length cl)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / real (length cl) \<le> 1 - WtFT cl

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_choose_drop_zero:
  "(\<Sum>k = 0..Suc n. if k = 0 then 0 else (Suc n - k) choose (k - 1)) =
    (\<Sum>j = 0..n. (n-j) choose j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..Suc n. if k = 0 then 0 else Suc n - k choose (k - 1)) = (\<Sum>j = 0..n. n - j choose j)
[PROOF STEP]
by (rule trans [OF sum.cong sum_drop_zero]) auto


[STATEMENT]
lemma degree_prod_sum_eq:
  "(\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> 0) \<Longrightarrow>
     degree (prod f A :: 'a :: idom poly) = (\<Sum>x\<in>A. degree (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> 0) \<Longrightarrow> degree (prod f A) = (\<Sum>x\<in>A. degree (f x))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto simp: degree_mult_eq)


[STATEMENT]
lemma nonneg_zcount_image_zmset[simp]: "(\<And>t. 0 \<le> zcount M t) \<Longrightarrow> 0 \<le> zcount (image_zmset f M) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. 0 \<le> zcount M t) \<Longrightarrow> 0 \<le> zcount (Auxiliary.image_zmset f M) t
[PROOF STEP]
by (meson mset_neg_empty_iff mset_neg_image_zmset)


[STATEMENT]
lemma qo_on_predecessor_subset_conv:
  "\<lbrakk>qo_on P A; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> {z\<in>A. P z x} \<subseteq> {z\<in>A. P z y} \<longleftrightarrow> P x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>qo_on P A; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> ({z \<in> A. P z x} \<subseteq> {z \<in> A. P z y}) = P x y
[PROOF STEP]
using qo_on_predecessor_subset_conv' [of P A "{x}" "{y}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>qo_on P A; {x} \<subseteq> A; {y} \<subseteq> A\<rbrakk> \<Longrightarrow> ({xa \<in> A. \<exists>y\<in>{x}. P xa y} \<subseteq> {x \<in> A. \<exists>y\<in>{y}. P x y}) = (\<forall>x\<in>{x}. \<exists>y\<in>{y}. P x y)

goal (1 subgoal):
 1. \<lbrakk>qo_on P A; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> ({z \<in> A. P z x} \<subseteq> {z \<in> A. P z y}) = P x y
[PROOF STEP]
by simp


[STATEMENT]
lemma homeomorphic_finite:
  fixes S :: "'a::t1_space set" and T :: "'b::t1_space set"
  assumes "finite T"
  shows "S homeomorphic T \<longleftrightarrow> finite S \<and> finite T \<and> card S = card T" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T = (finite S \<and> finite T \<and> card S = card T)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S homeomorphic T \<Longrightarrow> finite S \<and> finite T \<and> card S = card T
 2. finite S \<and> finite T \<and> card S = card T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
assume "S homeomorphic T"
[PROOF STATE]
proof (state)
this:
S homeomorphic T

goal (2 subgoals):
 1. S homeomorphic T \<Longrightarrow> finite S \<and> finite T \<and> card S = card T
 2. finite S \<and> finite T \<and> card S = card T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite T
S homeomorphic T
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
finite T
S homeomorphic T

goal (1 subgoal):
 1. finite S \<and> finite T \<and> card S = card T
[PROOF STEP]
apply (auto simp: homeomorphic_def homeomorphism_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f g. \<lbrakk>finite (f ` S); \<forall>x\<in>S. g (f x) = x; T = f ` S; continuous_on S f; g ` f ` S = S; continuous_on (f ` S) g\<rbrakk> \<Longrightarrow> finite S
 2. \<And>f g. \<lbrakk>finite (f ` S); \<forall>x\<in>S. g (f x) = x; T = f ` S; continuous_on S f; g ` f ` S = S; continuous_on (f ` S) g\<rbrakk> \<Longrightarrow> card S = card (f ` S)
[PROOF STEP]
apply (metis finite_imageI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite (f ` S); \<forall>x\<in>S. g (f x) = x; T = f ` S; continuous_on S f; g ` f ` S = S; continuous_on (f ` S) g\<rbrakk> \<Longrightarrow> card S = card (f ` S)
[PROOF STEP]
by (metis card_image_le finite_imageI le_antisym)
[PROOF STATE]
proof (state)
this:
finite S \<and> finite T \<and> card S = card T

goal (1 subgoal):
 1. finite S \<and> finite T \<and> card S = card T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite S \<and> finite T \<and> card S = card T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
assume R: ?rhs
[PROOF STATE]
proof (state)
this:
finite S \<and> finite T \<and> card S = card T

goal (1 subgoal):
 1. finite S \<and> finite T \<and> card S = card T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
with finite_same_card_bij
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite ?A; finite ?B; card ?A = card ?B\<rbrakk> \<Longrightarrow> \<exists>h. bij_betw h ?A ?B
finite S \<and> finite T \<and> card S = card T
[PROOF STEP]
obtain h where "bij_betw h S T"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; finite ?B; card ?A = card ?B\<rbrakk> \<Longrightarrow> \<exists>h. bij_betw h ?A ?B
finite S \<and> finite T \<and> card S = card T

goal (1 subgoal):
 1. (\<And>h. bij_betw h S T \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij_betw h S T

goal (1 subgoal):
 1. finite S \<and> finite T \<and> card S = card T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
with R
[PROOF STATE]
proof (chain)
picking this:
finite S \<and> finite T \<and> card S = card T
bij_betw h S T
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
finite S \<and> finite T \<and> card S = card T
bij_betw h S T

goal (1 subgoal):
 1. S homeomorphic T
[PROOF STEP]
apply (auto simp: homeomorphic_def homeomorphism_def continuous_on_finite)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij_betw h S T; finite S; finite T; card S = card T\<rbrakk> \<Longrightarrow> \<exists>f g. (\<forall>x\<in>S. g (f x) = x) \<and> f ` S = T \<and> (\<forall>y\<in>T. f (g y) = y) \<and> g ` T = S
[PROOF STEP]
apply (rule_tac x=h in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij_betw h S T; finite S; finite T; card S = card T\<rbrakk> \<Longrightarrow> \<exists>g. (\<forall>x\<in>S. g (h x) = x) \<and> h ` S = T \<and> (\<forall>y\<in>T. h (g y) = y) \<and> g ` T = S
[PROOF STEP]
apply (rule_tac x="inv_into S h" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij_betw h S T; finite S; finite T; card S = card T\<rbrakk> \<Longrightarrow> (\<forall>x\<in>S. inv_into S h (h x) = x) \<and> h ` S = T \<and> (\<forall>y\<in>T. h (inv_into S h y) = y) \<and> inv_into S h ` T = S
[PROOF STEP]
apply (auto simp:  bij_betw_inv_into_left bij_betw_inv_into_right bij_betw_imp_surj_on inv_into_into bij_betwE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>bij_betw h S T; finite S; finite T; card S = card T; x \<in> S\<rbrakk> \<Longrightarrow> x \<in> inv_into S h ` T
[PROOF STEP]
apply (metis bij_betw_def bij_betw_inv_into)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
S homeomorphic T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isometryI [intro?]:
  assumes "\<And>x y. dist (f x) (f y) = dist x y"
          "range f = UNIV"
  shows "isometry f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry f
[PROOF STEP]
unfolding isometry_def isometry_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. dist (f x) (f y) = dist x y) \<and> surj f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dist (f ?x) (f ?y) = dist ?x ?y
surj f

goal (1 subgoal):
 1. (\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. dist (f x) (f y) = dist x y) \<and> surj f
[PROOF STEP]
by auto


[STATEMENT]
lemma prod_list_normalize:
  fixes P :: "'b :: {idom_divide,normalization_semidom_multiplicative} poly list"
  shows "normalize (prod_list P) = prod_list (map normalize P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (prod_list P) = prod_list (map normalize P)
[PROOF STEP]
proof (induct P)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. normalize (prod_list []) = prod_list (map normalize [])
 2. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. normalize (prod_list []) = prod_list (map normalize [])
 2. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (prod_list []) = prod_list (map normalize [])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
normalize (prod_list []) = prod_list (map normalize [])

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
case (Cons p P)
[PROOF STATE]
proof (state)
this:
normalize (prod_list P) = prod_list (map normalize P)

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
have "normalize (prod_list (p # P)) = normalize p * normalize (prod_list P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (prod_list (p # P)) = normalize p * normalize (prod_list P)
[PROOF STEP]
using normalize_mult
[PROOF STATE]
proof (prove)
using this:
normalize (?a * ?b) = normalize ?a * normalize ?b

goal (1 subgoal):
 1. normalize (prod_list (p # P)) = normalize p * normalize (prod_list P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
normalize (prod_list (p # P)) = normalize p * normalize (prod_list P)

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
normalize (prod_list (p # P)) = normalize p * normalize (prod_list P)

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
have "... = normalize p * prod_list (map normalize P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize p * normalize (prod_list P) = normalize p * prod_list (map normalize P)
[PROOF STEP]
using Cons.hyps
[PROOF STATE]
proof (prove)
using this:
normalize (prod_list P) = prod_list (map normalize P)

goal (1 subgoal):
 1. normalize p * normalize (prod_list P) = normalize p * prod_list (map normalize P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
normalize p * normalize (prod_list P) = normalize p * prod_list (map normalize P)

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
normalize p * normalize (prod_list P) = normalize p * prod_list (map normalize P)

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
have "... = prod_list (normalize p # (map normalize P))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize p * prod_list (map normalize P) = prod_list (normalize p # map normalize P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
normalize p * prod_list (map normalize P) = prod_list (normalize p # map normalize P)

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
normalize p * prod_list (map normalize P) = prod_list (normalize p # map normalize P)

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
have "... = prod_list (map normalize (p # P))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (normalize p # map normalize P) = prod_list (map normalize (p # P))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod_list (normalize p # map normalize P) = prod_list (map normalize (p # P))

goal (1 subgoal):
 1. \<And>a P. normalize (prod_list P) = prod_list (map normalize P) \<Longrightarrow> normalize (prod_list (a # P)) = prod_list (map normalize (a # P))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
normalize (prod_list (p # P)) = prod_list (map normalize (p # P))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
normalize (prod_list (p # P)) = prod_list (map normalize (p # P))

goal (1 subgoal):
 1. normalize (prod_list (p # P)) = prod_list (map normalize (p # P))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
normalize (prod_list (p # P)) = prod_list (map normalize (p # P))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complete_N_of_norm:
  "complete\<^sub>N (N_of_norm::'a::banach quasinorm)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complete\<^sub>N N_of_norm
[PROOF STEP]
proof (rule complete\<^sub>N_I)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>cauchy_in\<^sub>N N_of_norm u; \<forall>n. u n \<in> space\<^sub>N N_of_norm\<rbrakk> \<Longrightarrow> \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
fix u::"nat \<Rightarrow> 'a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>cauchy_in\<^sub>N N_of_norm u; \<forall>n. u n \<in> space\<^sub>N N_of_norm\<rbrakk> \<Longrightarrow> \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
assume "cauchy_in\<^sub>N N_of_norm u"
[PROOF STATE]
proof (state)
this:
cauchy_in\<^sub>N N_of_norm u

goal (1 subgoal):
 1. \<And>u. \<lbrakk>cauchy_in\<^sub>N N_of_norm u; \<forall>n. u n \<in> space\<^sub>N N_of_norm\<rbrakk> \<Longrightarrow> \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cauchy_in\<^sub>N N_of_norm u
[PROOF STEP]
have "Cauchy u"
[PROOF STATE]
proof (prove)
using this:
cauchy_in\<^sub>N N_of_norm u

goal (1 subgoal):
 1. Cauchy u
[PROOF STEP]
unfolding Cauchy_def cauchy_in\<^sub>N_def N_of_norm(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>M. \<forall>n\<ge>M. \<forall>m\<ge>M. norm (u n - u m) < e

goal (1 subgoal):
 1. \<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (u m) (u n) < e
[PROOF STEP]
by (simp add: dist_norm)
[PROOF STATE]
proof (state)
this:
Cauchy u

goal (1 subgoal):
 1. \<And>u. \<lbrakk>cauchy_in\<^sub>N N_of_norm u; \<forall>n. u n \<in> space\<^sub>N N_of_norm\<rbrakk> \<Longrightarrow> \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Cauchy u
[PROOF STEP]
obtain x where "u \<longlonglongrightarrow> x"
[PROOF STATE]
proof (prove)
using this:
Cauchy u

goal (1 subgoal):
 1. (\<And>x. u \<longlonglongrightarrow> x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using convergent_eq_Cauchy
[PROOF STATE]
proof (prove)
using this:
Cauchy u
(\<exists>l. ?S \<longlonglongrightarrow> l) = Cauchy ?S

goal (1 subgoal):
 1. (\<And>x. u \<longlonglongrightarrow> x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u \<longlonglongrightarrow> x

goal (1 subgoal):
 1. \<And>u. \<lbrakk>cauchy_in\<^sub>N N_of_norm u; \<forall>n. u n \<in> space\<^sub>N N_of_norm\<rbrakk> \<Longrightarrow> \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<longlonglongrightarrow> x
[PROOF STEP]
have "tendsto_in\<^sub>N N_of_norm u x"
[PROOF STATE]
proof (prove)
using this:
u \<longlonglongrightarrow> x

goal (1 subgoal):
 1. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
unfolding tendsto_in\<^sub>N_def N_of_norm(2)
[PROOF STATE]
proof (prove)
using this:
u \<longlonglongrightarrow> x

goal (1 subgoal):
 1. (\<lambda>n. norm (u n - x)) \<longlonglongrightarrow> 0
[PROOF STEP]
using Lim_null tendsto_norm_zero_iff
[PROOF STATE]
proof (prove)
using this:
u \<longlonglongrightarrow> x
(?f \<longlongrightarrow> ?l) ?net = ((\<lambda>x. ?f x - ?l) \<longlongrightarrow> (0::?'b)) ?net
((\<lambda>x. norm (?f x)) \<longlongrightarrow> 0) ?F = (?f \<longlongrightarrow> (0::?'b)) ?F

goal (1 subgoal):
 1. (\<lambda>n. norm (u n - x)) \<longlonglongrightarrow> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
tendsto_in\<^sub>N N_of_norm u x

goal (1 subgoal):
 1. \<And>u. \<lbrakk>cauchy_in\<^sub>N N_of_norm u; \<forall>n. u n \<in> space\<^sub>N N_of_norm\<rbrakk> \<Longrightarrow> \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
tendsto_in\<^sub>N N_of_norm u x

goal (1 subgoal):
 1. \<And>u. \<lbrakk>cauchy_in\<^sub>N N_of_norm u; \<forall>n. u n \<in> space\<^sub>N N_of_norm\<rbrakk> \<Longrightarrow> \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
have "x \<in> space\<^sub>N N_of_norm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> space\<^sub>N N_of_norm
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> space\<^sub>N N_of_norm

goal (1 subgoal):
 1. \<And>u. \<lbrakk>cauchy_in\<^sub>N N_of_norm u; \<forall>n. u n \<in> space\<^sub>N N_of_norm\<rbrakk> \<Longrightarrow> \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
tendsto_in\<^sub>N N_of_norm u x
x \<in> space\<^sub>N N_of_norm
[PROOF STEP]
show "\<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x"
[PROOF STATE]
proof (prove)
using this:
tendsto_in\<^sub>N N_of_norm u x
x \<in> space\<^sub>N N_of_norm

goal (1 subgoal):
 1. \<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>space\<^sub>N N_of_norm. tendsto_in\<^sub>N N_of_norm u x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma relI:
  assumes "\<And>a b. (a,b) \<in> F \<Longrightarrow> (a,b) \<in> G"
    and "\<And>a b. (a,b) \<in> G \<Longrightarrow> (a,b) \<in> F" shows "F=G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F = G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(?a, ?b) \<in> F \<Longrightarrow> (?a, ?b) \<in> G
(?a, ?b) \<in> G \<Longrightarrow> (?a, ?b) \<in> F

goal (1 subgoal):
 1. F = G
[PROOF STEP]
by auto


[STATEMENT]
lemma subdegree_mult':
  fixes   f g :: "'a::{comm_monoid_add,mult_zero} fps"
  assumes "f $ subdegree f * g $ subdegree g \<noteq> 0"
  shows   "subdegree (f*g) = subdegree f + subdegree g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subdegree (f * g) = subdegree f + subdegree g
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subdegree (f * g) = subdegree f + subdegree g
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f $ subdegree f * g $ subdegree g \<noteq> (0::'a)
[PROOF STEP]
have "(f * g) $ (subdegree f + subdegree g) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
f $ subdegree f * g $ subdegree g \<noteq> (0::'a)

goal (1 subgoal):
 1. (f * g) $ (subdegree f + subdegree g) \<noteq> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f * g) $ (subdegree f + subdegree g) \<noteq> (0::'a)

goal (1 subgoal):
 1. subdegree (f * g) = subdegree f + subdegree g
[PROOF STEP]
hence "f*g \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
(f * g) $ (subdegree f + subdegree g) \<noteq> (0::'a)

goal (1 subgoal):
 1. f * g \<noteq> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f * g \<noteq> 0

goal (1 subgoal):
 1. subdegree (f * g) = subdegree f + subdegree g
[PROOF STEP]
hence "subdegree (f*g) \<ge> subdegree f + subdegree g"
[PROOF STATE]
proof (prove)
using this:
f * g \<noteq> 0

goal (1 subgoal):
 1. subdegree f + subdegree g \<le> subdegree (f * g)
[PROOF STEP]
using fps_mult_subdegree_ge
[PROOF STATE]
proof (prove)
using this:
f * g \<noteq> 0
?f * ?g \<noteq> 0 \<Longrightarrow> subdegree ?f + subdegree ?g \<le> subdegree (?f * ?g)

goal (1 subgoal):
 1. subdegree f + subdegree g \<le> subdegree (f * g)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
subdegree f + subdegree g \<le> subdegree (f * g)

goal (1 subgoal):
 1. subdegree (f * g) = subdegree f + subdegree g
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
subdegree f + subdegree g \<le> subdegree (f * g)

goal (1 subgoal):
 1. subdegree (f * g) = subdegree f + subdegree g
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f $ subdegree f * g $ subdegree g \<noteq> (0::'a)
[PROOF STEP]
have "subdegree (f*g) \<le> subdegree f + subdegree g"
[PROOF STATE]
proof (prove)
using this:
f $ subdegree f * g $ subdegree g \<noteq> (0::'a)

goal (1 subgoal):
 1. subdegree (f * g) \<le> subdegree f + subdegree g
[PROOF STEP]
by (intro subdegree_leI) simp
[PROOF STATE]
proof (state)
this:
subdegree (f * g) \<le> subdegree f + subdegree g

goal (1 subgoal):
 1. subdegree (f * g) = subdegree f + subdegree g
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
subdegree f + subdegree g \<le> subdegree (f * g)
subdegree (f * g) \<le> subdegree f + subdegree g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subdegree f + subdegree g \<le> subdegree (f * g)
subdegree (f * g) \<le> subdegree f + subdegree g

goal (1 subgoal):
 1. subdegree (f * g) = subdegree f + subdegree g
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
subdegree (f * g) = subdegree f + subdegree g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iMODb_eq_conv: "\<lbrakk> 0 < m; 0 < c \<rbrakk> \<Longrightarrow>
  ([r, mod m, c] = [r', mod m', c']) = (r = r' \<and> m = m' \<and> c = c')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; 0 < c\<rbrakk> \<Longrightarrow> ([ r, mod m, c ] = [ r', mod m', c' ]) = (r = r' \<and> m = m' \<and> c = c')
[PROOF STEP]
apply (case_tac "c' = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; 0 < c; c' = 0\<rbrakk> \<Longrightarrow> ([ r, mod m, c ] = [ r', mod m', c' ]) = (r = r' \<and> m = m' \<and> c = c')
 2. \<lbrakk>0 < m; 0 < c; c' \<noteq> 0\<rbrakk> \<Longrightarrow> ([ r, mod m, c ] = [ r', mod m', c' ]) = (r = r' \<and> m = m' \<and> c = c')
[PROOF STEP]
apply (simp add: iMODb_0 iIN_0 iMODb_singleton_eq_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; 0 < c; c' \<noteq> 0\<rbrakk> \<Longrightarrow> ([ r, mod m, c ] = [ r', mod m', c' ]) = (r = r' \<and> m = m' \<and> c = c')
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; 0 < c; c' \<noteq> 0; [ r, mod m, c ] = [ r', mod m', c' ]\<rbrakk> \<Longrightarrow> r = r' \<and> m = m' \<and> c = c'
 2. \<lbrakk>0 < m; 0 < c; c' \<noteq> 0; r = r' \<and> m = m' \<and> c = c'\<rbrakk> \<Longrightarrow> [ r, mod m, c ] = [ r', mod m', c' ]
[PROOF STEP]
apply (fastforce simp: set_eq_subset iMODb_subset_conv')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; 0 < c; c' \<noteq> 0; r = r' \<and> m = m' \<and> c = c'\<rbrakk> \<Longrightarrow> [ r, mod m, c ] = [ r', mod m', c' ]
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma null_sets_translation:
  assumes "N \<in> null_sets lborel" shows "{x. x - a \<in> N} \<in> null_sets lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x - a \<in> N} \<in> null_sets lborel
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x. x - a \<in> N} \<in> null_sets lborel
[PROOF STEP]
have [simp]: "(\<lambda>x. x + a) ` N = {x. x - a \<in> N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x + a) ` N = {x. x - a \<in> N}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x + a) ` N = {x. x - a \<in> N}

goal (1 subgoal):
 1. {x. x - a \<in> N} \<in> null_sets lborel
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x - a \<in> N} \<in> null_sets lborel
[PROOF STEP]
using assms emeasure_lebesgue_affine [of 1 a N]
[PROOF STATE]
proof (prove)
using this:
N \<in> null_sets lborel
emeasure lebesgue ((\<lambda>x. 1 *\<^sub>R x + a) ` N) = ennreal (\<bar>1\<bar> ^ DIM('a)) * emeasure lebesgue N

goal (1 subgoal):
 1. {x. x - a \<in> N} \<in> null_sets lborel
[PROOF STEP]
by (auto simp: null_sets_def)
[PROOF STATE]
proof (state)
this:
{x. x - a \<in> N} \<in> null_sets lborel

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arg_inv_not_pi:
  assumes "z \<noteq> 0" and "Arg z \<noteq> pi"
  shows "Arg (1 / z) = - Arg z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (1 / z) = - Arg z
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Arg (1 / z) = - Arg z
[PROOF STEP]
have "1/z = cnj z / cor ((cmod z)\<^sup>2 )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / z = cnj z / cor ((cmod z)\<^sup>2)
[PROOF STEP]
using \<open>z \<noteq> 0\<close> complex_mult_cnj_cmod[of z]
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
z * cnj z = cor ((cmod z)\<^sup>2)

goal (1 subgoal):
 1. 1 / z = cnj z / cor ((cmod z)\<^sup>2)
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
1 / z = cnj z / cor ((cmod z)\<^sup>2)

goal (1 subgoal):
 1. Arg (1 / z) = - Arg z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / z = cnj z / cor ((cmod z)\<^sup>2)

goal (1 subgoal):
 1. Arg (1 / z) = - Arg z
[PROOF STEP]
using arg_div_real_positive[of "(cmod z)\<^sup>2" "cnj z"] \<open>z \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
1 / z = cnj z / cor ((cmod z)\<^sup>2)
0 < (cmod z)\<^sup>2 \<Longrightarrow> Arg (cnj z / cor ((cmod z)\<^sup>2)) = Arg (cnj z)
z \<noteq> 0

goal (1 subgoal):
 1. Arg (1 / z) = - Arg z
[PROOF STEP]
using arg_cnj_not_pi[of z] \<open>Arg z \<noteq> pi\<close>
[PROOF STATE]
proof (prove)
using this:
1 / z = cnj z / cor ((cmod z)\<^sup>2)
0 < (cmod z)\<^sup>2 \<Longrightarrow> Arg (cnj z / cor ((cmod z)\<^sup>2)) = Arg (cnj z)
z \<noteq> 0
Arg z \<noteq> pi \<Longrightarrow> Arg (cnj z) = - Arg z
Arg z \<noteq> pi

goal (1 subgoal):
 1. Arg (1 / z) = - Arg z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Arg (1 / z) = - Arg z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_coprime_exists:
  assumes "gcd a b \<noteq> 0"
  shows "\<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'
[PROOF STEP]
have "coprime (a div gcd a b) (b div gcd a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (a div gcd a b) (b div gcd a b)
[PROOF STEP]
using assms div_gcd_coprime
[PROOF STATE]
proof (prove)
using this:
gcd a b \<noteq> (0::'a)
?a \<noteq> (0::'a) \<or> ?b \<noteq> (0::'a) \<Longrightarrow> coprime (?a div gcd ?a ?b) (?b div gcd ?a ?b)

goal (1 subgoal):
 1. coprime (a div gcd a b) (b div gcd a b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime (a div gcd a b) (b div gcd a b)

goal (1 subgoal):
 1. \<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coprime (a div gcd a b) (b div gcd a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime (a div gcd a b) (b div gcd a b)

goal (1 subgoal):
 1. \<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nodes_root_height_lower_bound:
  assumes "root_order k t"
    and "bal t"
  shows "2*((k+1)^(height t - 1) - 1) + (of_bool (t \<noteq> Leaf))*k  \<le> nodes t * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
proof (cases t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
case (Node ts t)
[PROOF STATE]
proof (state)
this:
t = Node ts t

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
let ?sub_height = "((k + 1) ^ height t - 1)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
from Node
[PROOF STATE]
proof (chain)
picking this:
t = Node ts t
[PROOF STEP]
have "?sub_height \<le> length ts * ?sub_height"
[PROOF STATE]
proof (prove)
using this:
t = Node ts t

goal (1 subgoal):
 1. bound k (height t) \<le> length ts * bound k (height t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
t = Node ts t
root_order k t
bal t

goal (1 subgoal):
 1. bound k (height t) \<le> length ts * bound k (height t)
[PROOF STEP]
by (simp add: Suc_leI)
[PROOF STATE]
proof (state)
this:
bound k (height t) \<le> length ts * bound k (height t)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bound k (height t) \<le> length ts * bound k (height t)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
have "\<dots> = sum_list (replicate (length ts) ?sub_height)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ts * bound k (height t) = sum_list (replicate (length ts) (bound k (height t)))
[PROOF STEP]
using sum_list_replicate
[PROOF STATE]
proof (prove)
using this:
sum_list (replicate ?n ?c) = ?n * ?c

goal (1 subgoal):
 1. length ts * bound k (height t) = sum_list (replicate (length ts) (bound k (height t)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length ts * bound k (height t) = sum_list (replicate (length ts) (bound k (height t)))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length ts * bound k (height t) = sum_list (replicate (length ts) (bound k (height t)))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
have "\<dots> = sum_list (map (\<lambda>x. ?sub_height) (subtrees ts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate (length ts) (bound k (height t))) = (\<Sum>x\<leftarrow>subtrees ts. bound k (height t))
[PROOF STEP]
using map_replicate_const[of ?sub_height "subtrees ts"] length_map
[PROOF STATE]
proof (prove)
using this:
map (\<lambda>x. bound k (height t)) (subtrees ts) = replicate (length (subtrees ts)) (bound k (height t))
length (map ?f ?xs) = length ?xs

goal (1 subgoal):
 1. sum_list (replicate (length ts) (bound k (height t))) = (\<Sum>x\<leftarrow>subtrees ts. bound k (height t))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (replicate (length ts) (bound k (height t))) = (\<Sum>x\<leftarrow>subtrees ts. bound k (height t))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (replicate (length ts) (bound k (height t))) = (\<Sum>x\<leftarrow>subtrees ts. bound k (height t))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
have "\<dots> \<le> sum_list (map (\<lambda>t. nodes t * k) (subtrees ts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>subtrees ts. bound k (height t)) \<le> (\<Sum>t\<leftarrow>subtrees ts. nodes t * k)
[PROOF STEP]
using Node
      sum_list_mono[of "subtrees ts" "\<lambda>x. (k+1)^(height t) - 1" "\<lambda>x. nodes x * k"]
      nodes_height_lower_bound assms
[PROOF STATE]
proof (prove)
using this:
t = Node ts t
(\<And>x. x \<in> set (subtrees ts) \<Longrightarrow> bound k (height t) \<le> nodes x * k) \<Longrightarrow> (\<Sum>x\<leftarrow>subtrees ts. bound k (height t)) \<le> (\<Sum>x\<leftarrow>subtrees ts. nodes x * k)
\<lbrakk>order ?k ?t; bal ?t\<rbrakk> \<Longrightarrow> bound ?k (height ?t) \<le> nodes ?t * ?k
root_order k t
bal t

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>subtrees ts. bound k (height t)) \<le> (\<Sum>t\<leftarrow>subtrees ts. nodes t * k)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>subtrees ts. bound k (height t)) \<le> (\<Sum>t\<leftarrow>subtrees ts. nodes t * k)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>subtrees ts. bound k (height t)) \<le> (\<Sum>t\<leftarrow>subtrees ts. nodes t * k)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
have "\<dots> = sum_list (map nodes (subtrees ts)) * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>subtrees ts. nodes t * k) = sum_list (map nodes (subtrees ts)) * k
[PROOF STEP]
using sum_list_mult_const[of nodes k "subtrees ts"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<leftarrow>subtrees ts. nodes x * k) = sum_list (map nodes (subtrees ts)) * k

goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>subtrees ts. nodes t * k) = sum_list (map nodes (subtrees ts)) * k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>subtrees ts. nodes t * k) = sum_list (map nodes (subtrees ts)) * k

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bound k (height t) \<le> sum_list (map nodes (subtrees ts)) * k
[PROOF STEP]
have "sum_list (map nodes (subtrees ts))*k \<ge> ?sub_height"
[PROOF STATE]
proof (prove)
using this:
bound k (height t) \<le> sum_list (map nodes (subtrees ts)) * k

goal (1 subgoal):
 1. bound k (height t) \<le> sum_list (map nodes (subtrees ts)) * k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bound k (height t) \<le> sum_list (map nodes (subtrees ts)) * k

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bound k (height t) \<le> sum_list (map nodes (subtrees ts)) * k

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
have "(nodes t)*k \<ge> ?sub_height"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bound k (height t) \<le> nodes t * k
[PROOF STEP]
using Node assms nodes_height_lower_bound
[PROOF STATE]
proof (prove)
using this:
t = Node ts t
root_order k t
bal t
\<lbrakk>order ?k ?t; bal ?t\<rbrakk> \<Longrightarrow> bound ?k (height ?t) \<le> nodes ?t * ?k

goal (1 subgoal):
 1. bound k (height t) \<le> nodes t * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bound k (height t) \<le> nodes t * k

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bound k (height t) \<le> sum_list (map nodes (subtrees ts)) * k
bound k (height t) \<le> nodes t * k
[PROOF STEP]
have "(nodes (Node ts t))*k \<ge>
        ?sub_height
        + ?sub_height + k"
[PROOF STATE]
proof (prove)
using this:
bound k (height t) \<le> sum_list (map nodes (subtrees ts)) * k
bound k (height t) \<le> nodes t * k

goal (1 subgoal):
 1. bound k (height t) + bound k (height t) + k \<le> nodes (Node ts t) * k
[PROOF STEP]
unfolding nodes.simps add_mult_distrib
[PROOF STATE]
proof (prove)
using this:
bound k (height t) \<le> sum_list (map nodes (subtrees ts)) * k
bound k (height t) \<le> nodes t * k

goal (1 subgoal):
 1. bound k (height t) + bound k (height t) + k \<le> 1 * k + sum_list (map nodes (subtrees ts)) * k + nodes t * k
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
bound k (height t) + bound k (height t) + k \<le> nodes (Node ts t) * k

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bound k (height t) + bound k (height t) + k \<le> nodes (Node ts t) * k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bound k (height t) + bound k (height t) + k \<le> nodes (Node ts t) * k

goal (1 subgoal):
 1. 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
using Node assms(2) height_bal_tree
[PROOF STATE]
proof (prove)
using this:
bound k (height t) + bound k (height t) + k \<le> nodes (Node ts t) * k
t = Node ts t
bal t
bal (Node ?ts ?t) \<Longrightarrow> height (Node ?ts ?t) = Suc (height ?t)

goal (1 subgoal):
 1. 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k

goal (1 subgoal):
 1. t = Leaf \<Longrightarrow> 2 * bound k (height t - 1) + of_bool (t \<noteq> Leaf) * k \<le> nodes t * k
[PROOF STEP]
qed simp


[STATEMENT]
lemma card4_eq:
  assumes "card X = 4"
  shows "\<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
obtain a X' where "X = insert a X'" and "a \<notin> X'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a X'. \<lbrakk>X = insert a X'; a \<notin> X'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis Suc_eq_numeral assms card_Suc_eq)
[PROOF STATE]
proof (state)
this:
X = insert a X'
a \<notin> X'

goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X = insert a X'
a \<notin> X'
[PROOF STEP]
have "card X' = 3"
[PROOF STATE]
proof (prove)
using this:
X = insert a X'
a \<notin> X'

goal (1 subgoal):
 1. card X' = 3
[PROOF STEP]
by (metis add_2_eq_Suc' assms card_eq_0_iff card_insert_if diff_Suc_1 finite_insert numeral_3_eq_3 numeral_Bit0 plus_nat.add_0 zero_neq_numeral)
[PROOF STATE]
proof (state)
this:
card X' = 3

goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card X' = 3
[PROOF STEP]
obtain b X'' where "X' = insert b X''" and "b \<notin> X''"
[PROOF STATE]
proof (prove)
using this:
card X' = 3

goal (1 subgoal):
 1. (\<And>b X''. \<lbrakk>X' = insert b X''; b \<notin> X''\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis card_Suc_eq numeral_3_eq_3)
[PROOF STATE]
proof (state)
this:
X' = insert b X''
b \<notin> X''

goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X' = insert b X''
b \<notin> X''
[PROOF STEP]
have "card X'' = 2"
[PROOF STATE]
proof (prove)
using this:
X' = insert b X''
b \<notin> X''

goal (1 subgoal):
 1. card X'' = 2
[PROOF STEP]
by (metis Suc_eq_numeral \<open>card X' = 3\<close> card.infinite card_insert_if finite_insert pred_numeral_simps(3) zero_neq_numeral)
[PROOF STATE]
proof (state)
this:
card X'' = 2

goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card X'' = 2
[PROOF STEP]
have "\<exists>c d. c \<noteq> d \<and> X'' = {c, d}"
[PROOF STATE]
proof (prove)
using this:
card X'' = 2

goal (1 subgoal):
 1. \<exists>c d. c \<noteq> d \<and> X'' = {c, d}
[PROOF STEP]
by (meson card_2_iff)
[PROOF STATE]
proof (state)
this:
\<exists>c d. c \<noteq> d \<and> X'' = {c, d}

goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>c d. c \<noteq> d \<and> X'' = {c, d}

goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
using \<open>X = insert a X'\<close> \<open>X' = insert b X''\<close> \<open>a \<notin> X'\<close> \<open>b \<notin> X''\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>c d. c \<noteq> d \<and> X'' = {c, d}
X = insert a X'
X' = insert b X''
a \<notin> X'
b \<notin> X''

goal (1 subgoal):
 1. \<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>a b c d. a \<noteq> b \<and> a \<noteq> c \<and> a \<noteq> d \<and> b \<noteq> c \<and> b \<noteq> d \<and> c \<noteq> d \<and> X = {a, b, c, d}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma count_vec_two_elems:
  fixes v :: "'a :: {zero_neq_one} vec"
  assumes "\<And> i. i < dim_vec v \<Longrightarrow> v $ i = 1 \<or> v $ i = 0"
  shows "count_vec v 1 + count_vec v 0 = dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
have ss: "vec_set v \<subseteq> {0, 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set\<^sub>v v \<subseteq> {0::'a, 1::'a}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i < dim_vec v \<Longrightarrow> v $ ?i = (1::'a) \<or> v $ ?i = (0::'a)

goal (1 subgoal):
 1. set\<^sub>v v \<subseteq> {0::'a, 1::'a}
[PROOF STEP]
by (auto simp add: vec_set_def)
[PROOF STATE]
proof (state)
this:
set\<^sub>v v \<subseteq> {0::'a, 1::'a}

goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
have "dim_vec v = size (vec_mset v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec v = size (vec_mset v)
[PROOF STEP]
by (simp add: mset_vec_same_size)
[PROOF STATE]
proof (state)
this:
dim_vec v = size (vec_mset v)

goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
have "size (vec_mset v) = (\<Sum> x \<in> (vec_set v) . count (vec_mset v) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (vec_mset v) = sum (count_vec v) (set\<^sub>v v)
[PROOF STEP]
by (simp add: vec_mset_set size_multiset_overloaded_eq)
[PROOF STATE]
proof (state)
this:
size (vec_mset v) = sum (count_vec v) (set\<^sub>v v)

goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size (vec_mset v) = sum (count_vec v) (set\<^sub>v v)

goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
have  "... = (\<Sum> x \<in> {0, 1} . count (vec_mset v) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (count_vec v) (set\<^sub>v v) = sum (count_vec v) {0::'a, 1::'a}
[PROOF STEP]
using size_count_mset_ss ss
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?B; set_mset ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> size ?A = sum (count ?A) ?B
set\<^sub>v v \<subseteq> {0::'a, 1::'a}

goal (1 subgoal):
 1. sum (count_vec v) (set\<^sub>v v) = sum (count_vec v) {0::'a, 1::'a}
[PROOF STEP]
by (metis calculation finite.emptyI finite.insertI vec_mset_set)
[PROOF STATE]
proof (state)
this:
sum (count_vec v) (set\<^sub>v v) = sum (count_vec v) {0::'a, 1::'a}

goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size (vec_mset v) = sum (count_vec v) {0::'a, 1::'a}
[PROOF STEP]
have "size (vec_mset v) = count (vec_mset v) 0 + count (vec_mset v) 1"
[PROOF STATE]
proof (prove)
using this:
size (vec_mset v) = sum (count_vec v) {0::'a, 1::'a}

goal (1 subgoal):
 1. size (vec_mset v) = count_vec v (0::'a) + count_vec v (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size (vec_mset v) = count_vec v (0::'a) + count_vec v (1::'a)

goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
size (vec_mset v) = count_vec v (0::'a) + count_vec v (1::'a)

goal (1 subgoal):
 1. count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v
[PROOF STEP]
by (simp add: \<open>dim_vec v = size (vec_mset v)\<close>)
[PROOF STATE]
proof (state)
this:
count_vec v (1::'a) + count_vec v (0::'a) = dim_vec v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma r01_eq_iff:
  assumes "0 < r1" "r1 < 1"
          "0 < r2" "r2 < 1"
    shows "r1 = r2 \<longleftrightarrow> r01_binary_expansion' r1 = r01_binary_expansion' r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r1 = r2) = (r01_binary_expansion' r1 = r01_binary_expansion' r2)
[PROOF STEP]
proof auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r01_binary_expansion' r1 = r01_binary_expansion' r2 \<Longrightarrow> r1 = r2
[PROOF STEP]
assume "r01_binary_expansion' r1 = r01_binary_expansion' r2"
[PROOF STATE]
proof (state)
this:
r01_binary_expansion' r1 = r01_binary_expansion' r2

goal (1 subgoal):
 1. r01_binary_expansion' r1 = r01_binary_expansion' r2 \<Longrightarrow> r1 = r2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r01_binary_expansion' r1 = r01_binary_expansion' r2
[PROOF STEP]
have 1:"r01_binary_expression r1 = r01_binary_expression r2"
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion' r1 = r01_binary_expansion' r2

goal (1 subgoal):
 1. r01_binary_expression r1 = r01_binary_expression r2
[PROOF STEP]
using r01_binary_expansion'_expression_eq[of r1 r2]
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion' r1 = r01_binary_expansion' r2
(r01_binary_expansion' r1 = r01_binary_expansion' r2) = (r01_binary_expression r1 = r01_binary_expression r2)

goal (1 subgoal):
 1. r01_binary_expression r1 = r01_binary_expression r2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r01_binary_expression r1 = r01_binary_expression r2

goal (1 subgoal):
 1. r01_binary_expansion' r1 = r01_binary_expansion' r2 \<Longrightarrow> r1 = r2
[PROOF STEP]
have "r1 = lim (r01_binary_expression r1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r1 = lim (r01_binary_expression r1)
[PROOF STEP]
using limI[of _ r1] r01_binary_expression_converges_to_r[of r1] assms(1,2)
[PROOF STATE]
proof (prove)
using this:
?X \<longlonglongrightarrow> r1 \<Longrightarrow> lim ?X = r1
\<lbrakk>0 < r1; r1 < 1\<rbrakk> \<Longrightarrow> r01_binary_expression r1 \<longlonglongrightarrow> r1
0 < r1
r1 < 1

goal (1 subgoal):
 1. r1 = lim (r01_binary_expression r1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r1 = lim (r01_binary_expression r1)

goal (1 subgoal):
 1. r01_binary_expansion' r1 = r01_binary_expansion' r2 \<Longrightarrow> r1 = r2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r1 = lim (r01_binary_expression r1)

goal (1 subgoal):
 1. r01_binary_expansion' r1 = r01_binary_expansion' r2 \<Longrightarrow> r1 = r2
[PROOF STEP]
have "... = lim (r01_binary_expression r2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lim (r01_binary_expression r1) = lim (r01_binary_expression r2)
[PROOF STEP]
by (simp add: 1)
[PROOF STATE]
proof (state)
this:
lim (r01_binary_expression r1) = lim (r01_binary_expression r2)

goal (1 subgoal):
 1. r01_binary_expansion' r1 = r01_binary_expansion' r2 \<Longrightarrow> r1 = r2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lim (r01_binary_expression r1) = lim (r01_binary_expression r2)

goal (1 subgoal):
 1. r01_binary_expansion' r1 = r01_binary_expansion' r2 \<Longrightarrow> r1 = r2
[PROOF STEP]
have "... = r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lim (r01_binary_expression r2) = r2
[PROOF STEP]
using limI[of _ r2] r01_binary_expression_converges_to_r[of r2] assms(3,4)
[PROOF STATE]
proof (prove)
using this:
?X \<longlonglongrightarrow> r2 \<Longrightarrow> lim ?X = r2
\<lbrakk>0 < r2; r2 < 1\<rbrakk> \<Longrightarrow> r01_binary_expression r2 \<longlonglongrightarrow> r2
0 < r2
r2 < 1

goal (1 subgoal):
 1. lim (r01_binary_expression r2) = r2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lim (r01_binary_expression r2) = r2

goal (1 subgoal):
 1. r01_binary_expansion' r1 = r01_binary_expansion' r2 \<Longrightarrow> r1 = r2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
r1 = r2
[PROOF STEP]
show "r1 = r2"
[PROOF STATE]
proof (prove)
using this:
r1 = r2

goal (1 subgoal):
 1. r1 = r2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
r1 = r2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Bessel_inequality:
  assumes "orthonormal_system S w" "\<And>i. (w i) square_integrable S"
    "f square_integrable S" "finite I"
  shows "(\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2) \<le> (l2norm S f)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2) \<le> (l2norm S f)\<^sup>2
[PROOF STEP]
using orthonormal_partial_sum_diff [OF assms, of "orthonormal_coeff S w f"]
[PROOF STATE]
proof (prove)
using this:
(l2norm S (\<lambda>x. f x - (\<Sum>i\<in>I. orthonormal_coeff S w f i * w i x)))\<^sup>2 = (l2norm S f)\<^sup>2 + (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2) - 2 * (\<Sum>i\<in>I. orthonormal_coeff S w f i * orthonormal_coeff S w f i)

goal (1 subgoal):
 1. (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2) \<le> (l2norm S f)\<^sup>2
[PROOF STEP]
apply (simp add: algebra_simps flip: power2_eq_square)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2) + (l2norm S (\<lambda>x. f x - (\<Sum>i\<in>I. w i x * orthonormal_coeff S w f i)))\<^sup>2 = (l2norm S f)\<^sup>2 \<Longrightarrow> (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2) \<le> (l2norm S f)\<^sup>2
[PROOF STEP]
by (metis (lifting) add_diff_cancel_left' diff_ge_0_iff_ge zero_le_power2)


[STATEMENT]
lemma pos_neg_q_pn: "0 < 1 - q * (1 - p^Suc N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - q * (1 - p ^ Suc N)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < 1 - q * (1 - p ^ Suc N)
[PROOF STEP]
have "p ^ Suc N \<le> 1 ^ Suc N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ Suc N \<le> 1 ^ Suc N
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
0 < p
p < 1

goal (1 subgoal):
 1. p ^ Suc N \<le> 1 ^ Suc N
[PROOF STEP]
by (intro power_mono) auto
[PROOF STATE]
proof (state)
this:
p ^ Suc N \<le> 1 ^ Suc N

goal (1 subgoal):
 1. 0 < 1 - q * (1 - p ^ Suc N)
[PROOF STEP]
with p q
[PROOF STATE]
proof (chain)
picking this:
0 < p
p < 1
0 < q
q < 1
p ^ Suc N \<le> 1 ^ Suc N
[PROOF STEP]
have "q * (1 - p^Suc N) < 1 * 1"
[PROOF STATE]
proof (prove)
using this:
0 < p
p < 1
0 < q
q < 1
p ^ Suc N \<le> 1 ^ Suc N

goal (1 subgoal):
 1. q * (1 - p ^ Suc N) < 1 * 1
[PROOF STEP]
by (intro mult_strict_mono) (auto simp: field_simps simp del: power_Suc)
[PROOF STATE]
proof (state)
this:
q * (1 - p ^ Suc N) < 1 * 1

goal (1 subgoal):
 1. 0 < 1 - q * (1 - p ^ Suc N)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q * (1 - p ^ Suc N) < 1 * 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
q * (1 - p ^ Suc N) < 1 * 1

goal (1 subgoal):
 1. 0 < 1 - q * (1 - p ^ Suc N)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < 1 - q * (1 - p ^ Suc N)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_hom_inj_lim:
  assumes "elements_mat M \<subseteq> A" and "elements_mat N \<subseteq> A"
  shows "map_mat f M = map_mat f N \<Longrightarrow> M = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_mat f M = map_mat f N \<Longrightarrow> M = N
[PROOF STEP]
unfolding mat_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (map_mat f M) = dim_row (map_mat f N) \<and> dim_col (map_mat f M) = dim_col (map_mat f N) \<and> (\<forall>i j. i < dim_row (map_mat f N) \<longrightarrow> j < dim_col (map_mat f N) \<longrightarrow> map_mat f M $$ (i, j) = map_mat f N $$ (i, j)) \<Longrightarrow> dim_row M = dim_row N \<and> dim_col M = dim_col N \<and> (\<forall>i j. i < dim_row N \<longrightarrow> j < dim_col N \<longrightarrow> M $$ (i, j) = N $$ (i, j))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>dim_row M = dim_row N; dim_col M = dim_col N; \<forall>i<dim_row N. \<forall>j<dim_col N. f (M $$ (i, j)) = f (N $$ (i, j)); i < dim_row N; j < dim_col N\<rbrakk> \<Longrightarrow> M $$ (i, j) = N $$ (i, j)
[PROOF STEP]
using assms injectivity_lim
[PROOF STATE]
proof (prove)
using this:
elements_mat M \<subseteq> A
elements_mat N \<subseteq> A
\<lbrakk>?x \<in> A; ?y \<in> A; f ?x = f ?y\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>dim_row M = dim_row N; dim_col M = dim_col N; \<forall>i<dim_row N. \<forall>j<dim_col N. f (M $$ (i, j)) = f (N $$ (i, j)); i < dim_row N; j < dim_col N\<rbrakk> \<Longrightarrow> M $$ (i, j) = N $$ (i, j)
[PROOF STEP]
by blast


[STATEMENT]
lemma gbinomial_pochhammer': "a gchoose k = pochhammer (a - of_nat k + 1) k / fact k"
  for a :: "'a::field_char_0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a gchoose k = pochhammer (a - of_nat k + (1::'a)) k / fact k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a gchoose k = pochhammer (a - of_nat k + (1::'a)) k / fact k
[PROOF STEP]
have "a gchoose k = ((-1)^k * (-1)^k) * pochhammer (a - of_nat k + 1) k / fact k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a gchoose k = (- (1::'a)) ^ k * (- (1::'a)) ^ k * pochhammer (a - of_nat k + (1::'a)) k / fact k
[PROOF STEP]
by (simp add: gbinomial_pochhammer pochhammer_minus mult_ac)
[PROOF STATE]
proof (state)
this:
a gchoose k = (- (1::'a)) ^ k * (- (1::'a)) ^ k * pochhammer (a - of_nat k + (1::'a)) k / fact k

goal (1 subgoal):
 1. a gchoose k = pochhammer (a - of_nat k + (1::'a)) k / fact k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a gchoose k = (- (1::'a)) ^ k * (- (1::'a)) ^ k * pochhammer (a - of_nat k + (1::'a)) k / fact k

goal (1 subgoal):
 1. a gchoose k = pochhammer (a - of_nat k + (1::'a)) k / fact k
[PROOF STEP]
have "(-1 :: 'a)^k * (-1)^k = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ k * (- (1::'a)) ^ k = (1::'a)
[PROOF STEP]
by (subst power_add [symmetric]) simp
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ k * (- (1::'a)) ^ k = (1::'a)

goal (1 subgoal):
 1. a gchoose k = pochhammer (a - of_nat k + (1::'a)) k / fact k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a gchoose k = (1::'a) * pochhammer (a - of_nat k + (1::'a)) k / fact k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a gchoose k = (1::'a) * pochhammer (a - of_nat k + (1::'a)) k / fact k

goal (1 subgoal):
 1. a gchoose k = pochhammer (a - of_nat k + (1::'a)) k / fact k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a gchoose k = pochhammer (a - of_nat k + (1::'a)) k / fact k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_converges_diff:
  assumes "fds_converges f s" "fds_converges g s"
  shows   "fds_converges (f - g) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_converges (f - g) s
[PROOF STEP]
using summable_diff[OF assms[unfolded fds_converges_def]]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. fds_nth f n / nat_power n s - fds_nth g n / nat_power n s)

goal (1 subgoal):
 1. fds_converges (f - g) s
[PROOF STEP]
by (simp add: fds_converges_def diff_divide_distrib)


[STATEMENT]
lemma pos_neg_null_set:
  assumes "pos_meas_set A"
    and "neg_meas_set A"
  shows "\<mu> A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> A = 0
[PROOF STEP]
using assms pos_meas_self[of A] neg_meas_self[of A]
[PROOF STATE]
proof (prove)
using this:
pos_meas_set A
neg_meas_set A
pos_meas_set A \<Longrightarrow> 0 \<le> \<mu> A
neg_meas_set A \<Longrightarrow> \<mu> A \<le> 0

goal (1 subgoal):
 1. \<mu> A = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma scaleR_columns_Gram_Schmidt_matrix:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes "i \<noteq> j"
  and "rank A = ncols A"
  shows "column j (Gram_Schmidt_matrix A) \<bullet> column i (Gram_Schmidt_matrix A) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column j (Gram_Schmidt_matrix A) \<bullet> column i (Gram_Schmidt_matrix A) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. column j (Gram_Schmidt_matrix A) \<bullet> column i (Gram_Schmidt_matrix A) = 0
[PROOF STEP]
have "column j (Gram_Schmidt_matrix A) \<noteq> column i (Gram_Schmidt_matrix A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column j (Gram_Schmidt_matrix A) \<noteq> column i (Gram_Schmidt_matrix A)
[PROOF STEP]
using column_eq_Gram_Schmidt_matrix assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>rank ?A = ncols ?A; column ?i (Gram_Schmidt_matrix ?A) = column ?ia (Gram_Schmidt_matrix ?A)\<rbrakk> \<Longrightarrow> ?i = ?ia
i \<noteq> j
rank A = ncols A

goal (1 subgoal):
 1. column j (Gram_Schmidt_matrix A) \<noteq> column i (Gram_Schmidt_matrix A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column j (Gram_Schmidt_matrix A) \<noteq> column i (Gram_Schmidt_matrix A)

goal (1 subgoal):
 1. column j (Gram_Schmidt_matrix A) \<bullet> column i (Gram_Schmidt_matrix A) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
column j (Gram_Schmidt_matrix A) \<noteq> column i (Gram_Schmidt_matrix A)

goal (1 subgoal):
 1. column j (Gram_Schmidt_matrix A) \<bullet> column i (Gram_Schmidt_matrix A) = 0
[PROOF STEP]
using orthogonal_Gram_Schmidt_matrix2
[PROOF STATE]
proof (prove)
using this:
column j (Gram_Schmidt_matrix A) \<noteq> column i (Gram_Schmidt_matrix A)
pairwise orthogonal (columns (Gram_Schmidt_matrix ?A))

goal (1 subgoal):
 1. column j (Gram_Schmidt_matrix A) \<bullet> column i (Gram_Schmidt_matrix A) = 0
[PROOF STEP]
unfolding pairwise_def orthogonal_def columns_def
[PROOF STATE]
proof (prove)
using this:
column j (Gram_Schmidt_matrix A) \<noteq> column i (Gram_Schmidt_matrix A)
\<forall>x\<in>{column i (Gram_Schmidt_matrix ?A) |i. i \<in> UNIV}. \<forall>y\<in>{column i (Gram_Schmidt_matrix ?A) |i. i \<in> UNIV}. x \<noteq> y \<longrightarrow> x \<bullet> y = 0

goal (1 subgoal):
 1. column j (Gram_Schmidt_matrix A) \<bullet> column i (Gram_Schmidt_matrix A) = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
column j (Gram_Schmidt_matrix A) \<bullet> column i (Gram_Schmidt_matrix A) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  expl_cond_exp_add:
  assumes "integrable M X"
  and "integrable M Z"
shows "\<forall>w\<in> space M. expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>w\<in>space M. expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. w \<in> space M \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. w \<in> space M \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
assume "w\<in> space M"
[PROOF STATE]
proof (state)
this:
w \<in> space M

goal (1 subgoal):
 1. \<And>w. w \<in> space M \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
define prY where "prY = measure M ((Y -` {Y w}) \<inter> space M)"
[PROOF STATE]
proof (state)
this:
prY = Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M)

goal (1 subgoal):
 1. \<And>w. w \<in> space M \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
show "expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
proof (cases "prY = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prY = 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
 2. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
prY = 0

goal (2 subgoals):
 1. prY = 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
 2. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
prY = 0

goal (1 subgoal):
 1. expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
unfolding expl_cond_expect_def img_dce_def prY_def
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M) = 0

goal (1 subgoal):
 1. ((\<lambda>y. if Sigma_Algebra.measure M (Y -` {y} \<inter> space M) = 0 then 0 else (LINT w|M. (X w + Z w) * indicat_real (Y -` {y} \<inter> space M) w) / Sigma_Algebra.measure M (Y -` {y} \<inter> space M)) \<circ> Y) w = ((\<lambda>y. if Sigma_Algebra.measure M (Y -` {y} \<inter> space M) = 0 then 0 else (LINT w|M. X w * indicat_real (Y -` {y} \<inter> space M) w) / Sigma_Algebra.measure M (Y -` {y} \<inter> space M)) \<circ> Y) w + ((\<lambda>y. if Sigma_Algebra.measure M (Y -` {y} \<inter> space M) = 0 then 0 else (LINT w|M. Z w * indicat_real (Y -` {y} \<inter> space M) w) / Sigma_Algebra.measure M (Y -` {y} \<inter> space M)) \<circ> Y) w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
prY \<noteq> 0

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
hence "(Y -` {Y w}) \<inter> space M \<in> sets M"
[PROOF STATE]
proof (prove)
using this:
prY \<noteq> 0

goal (1 subgoal):
 1. Y -` {Y w} \<inter> space M \<in> sets M
[PROOF STEP]
unfolding prY_def
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M) \<noteq> 0

goal (1 subgoal):
 1. Y -` {Y w} \<inter> space M \<in> sets M
[PROOF STEP]
using measure_notin_sets
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M) \<noteq> 0
?A \<notin> sets ?M \<Longrightarrow> Sigma_Algebra.measure ?M ?A = 0

goal (1 subgoal):
 1. Y -` {Y w} \<inter> space M \<in> sets M
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Y -` {Y w} \<inter> space M \<in> sets M

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
let ?indA = "indicator ((Y -` {Y w}) \<inter> space M)::('a\<Rightarrow>real)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
have "integrable M (\<lambda>x. X x * ?indA x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. X x * indicat_real (Y -` {Y w} \<inter> space M) x)
[PROOF STEP]
using \<open>Y -` {Y w} \<inter> space M \<in> sets M\<close> assms(1) integrable_real_mult_indicator
[PROOF STATE]
proof (prove)
using this:
Y -` {Y w} \<inter> space M \<in> sets M
integrable M X
\<lbrakk>?A \<in> sets ?M; integrable ?M ?f\<rbrakk> \<Longrightarrow> integrable ?M (\<lambda>x. ?f x * indicat_real ?A x)

goal (1 subgoal):
 1. integrable M (\<lambda>x. X x * indicat_real (Y -` {Y w} \<inter> space M) x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. X x * indicat_real (Y -` {Y w} \<inter> space M) x)

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. X x * indicat_real (Y -` {Y w} \<inter> space M) x)

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
have "integrable M (\<lambda>x. Z x * ?indA x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
[PROOF STEP]
using \<open>Y -` {Y w} \<inter> space M \<in> sets M\<close> assms(2) integrable_real_mult_indicator
[PROOF STATE]
proof (prove)
using this:
Y -` {Y w} \<inter> space M \<in> sets M
integrable M Z
\<lbrakk>?A \<in> sets ?M; integrable ?M ?f\<rbrakk> \<Longrightarrow> integrable ?M (\<lambda>x. ?f x * indicat_real ?A x)

goal (1 subgoal):
 1. integrable M (\<lambda>x. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
integrable M (\<lambda>x. X x * indicat_real (Y -` {Y w} \<inter> space M) x)
integrable M (\<lambda>x. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
[PROOF STEP]
have "integral\<^sup>L M (\<lambda>x. X x * ?indA x + Z x * ?indA x) = integral\<^sup>L M (\<lambda>x. X x * ?indA x) + integral\<^sup>L M (\<lambda>x. Z x * ?indA x)"
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. X x * indicat_real (Y -` {Y w} \<inter> space M) x)
integrable M (\<lambda>x. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)

goal (1 subgoal):
 1. LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
[PROOF STEP]
using Bochner_Integration.integral_add
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. X x * indicat_real (Y -` {Y w} \<inter> space M) x)
integrable M (\<lambda>x. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
\<lbrakk>integrable ?M ?f; integrable ?M ?g\<rbrakk> \<Longrightarrow> LINT x|?M. ?f x + ?g x = integral\<^sup>L ?M ?f + integral\<^sup>L ?M ?g

goal (1 subgoal):
 1. LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
have "\<forall>x\<in> space M. X x * ?indA x + Z x * ?indA x = (X x + Z x) * ?indA x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>space M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x
[PROOF STEP]
by (simp add: indicator_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>space M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
\<forall>x\<in>space M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x
[PROOF STEP]
have fsteq: "integral\<^sup>L M (\<lambda>x. (X x + Z x) * ?indA x) = integral\<^sup>L M (\<lambda>x. X x * ?indA x) + integral\<^sup>L M (\<lambda>x. Z x * ?indA x)"
[PROOF STATE]
proof (prove)
using this:
LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
\<forall>x\<in>space M. X x * indicat_real (Y -` {Y w} \<inter> space M) x + Z x * indicat_real (Y -` {Y w} \<inter> space M) x = (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x

goal (1 subgoal):
 1. LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)
[PROOF STEP]
by (metis (no_types, lifting) Bochner_Integration.integral_cong)
[PROOF STATE]
proof (state)
this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
have "integral\<^sup>L M (\<lambda>x. (X x + Z x) * ?indA x/prY) = integral\<^sup>L M (\<lambda>x. (X x + Z x) * ?indA x)/prY"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x) / prY
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x) / prY

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x) / prY

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
have "... = integral\<^sup>L M (\<lambda>x. X x * ?indA x)/prY + integral\<^sup>L M (\<lambda>x. Z x * ?indA x)/prY"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x) / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY
[PROOF STEP]
using fsteq
[PROOF STATE]
proof (prove)
using this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x)

goal (1 subgoal):
 1. (LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x) / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY
[PROOF STEP]
by (simp add: add_divide_distrib)
[PROOF STATE]
proof (state)
this:
(LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x) / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x) / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
have "... = integral\<^sup>L M (\<lambda>x. X x * ?indA x/prY) + integral\<^sup>L M (\<lambda>x. Z x * ?indA x/prY)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x) / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)
[PROOF STEP]
have "integral\<^sup>L M (\<lambda>x. (X x + Z x) * ?indA x/prY) = integral\<^sup>L M (\<lambda>x. X x * ?indA x/prY) + integral\<^sup>L M (\<lambda>x. Z x * ?indA x/prY)"
[PROOF STATE]
proof (prove)
using this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)

goal (1 subgoal):
 1. LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)

goal (1 subgoal):
 1. prY \<noteq> 0 \<Longrightarrow> expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)

goal (1 subgoal):
 1. expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)
prY \<noteq> 0

goal (1 subgoal):
 1. expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w
[PROOF STEP]
unfolding expl_cond_expect_def img_dce_def
[PROOF STATE]
proof (prove)
using this:
LINT x|M. (X x + Z x) * indicat_real (Y -` {Y w} \<inter> space M) x / prY = (LINT x|M. X x * indicat_real (Y -` {Y w} \<inter> space M) x / prY) + (LINT x|M. Z x * indicat_real (Y -` {Y w} \<inter> space M) x / prY)
prY \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>y. if Sigma_Algebra.measure M (Y -` {y} \<inter> space M) = 0 then 0 else (LINT w|M. (X w + Z w) * indicat_real (Y -` {y} \<inter> space M) w) / Sigma_Algebra.measure M (Y -` {y} \<inter> space M)) \<circ> Y) w = ((\<lambda>y. if Sigma_Algebra.measure M (Y -` {y} \<inter> space M) = 0 then 0 else (LINT w|M. X w * indicat_real (Y -` {y} \<inter> space M) w) / Sigma_Algebra.measure M (Y -` {y} \<inter> space M)) \<circ> Y) w + ((\<lambda>y. if Sigma_Algebra.measure M (Y -` {y} \<inter> space M) = 0 then 0 else (LINT w|M. Z w * indicat_real (Y -` {y} \<inter> space M) w) / Sigma_Algebra.measure M (Y -` {y} \<inter> space M)) \<circ> Y) w
[PROOF STEP]
by (simp add: add_divide_distrib fsteq)
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y (\<lambda>x. X x + Z x) w = expl_cond_expect M Y X w + expl_cond_expect M Y Z w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma walras_law_in_compeq:
  assumes "\<And>i. i\<in>agents \<Longrightarrow> local_nonsatiation consumption_set Pr[i]"
  assumes "competitive_equilibrium P X Y"
  shows "P \<bullet> ((\<Sum>i\<in>agents. (X i)) - (\<Sum>i\<in>agents. \<E>[i]) - (\<Sum>j\<in>firms. Y j)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<bullet> (sum X agents - sum \<E> agents - sum Y firms) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P \<bullet> (sum X agents - sum \<E> agents - sum Y firms) = 0
[PROOF STEP]
have "P \<bullet> (\<Sum>i\<in>agents. (X i)) = P \<bullet> ((\<Sum>i\<in>agents. \<E>[i]) + (\<Sum>j\<in>firms. Y j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<bullet> sum X agents = P \<bullet> (sum \<E> agents + sum Y firms)
[PROOF STEP]
using assms(1) assms(2) walras_law
[PROOF STATE]
proof (prove)
using this:
?i \<in> agents \<Longrightarrow> local_nonsatiation consumption_set Pr[?i]
competitive_equilibrium P X Y
\<lbrakk>\<And>i. i \<in> agents \<Longrightarrow> local_nonsatiation consumption_set Pr[i]; \<forall>i\<in>agents. ?X i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) ?P) consumption_set (poe_wealth ?P i ?Y))\<rbrakk> \<Longrightarrow> ?P \<bullet> sum ?X agents = ?P \<bullet> (sum \<E> agents + sum ?Y firms)

goal (1 subgoal):
 1. P \<bullet> sum X agents = P \<bullet> (sum \<E> agents + sum Y firms)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P \<bullet> sum X agents = P \<bullet> (sum \<E> agents + sum Y firms)

goal (1 subgoal):
 1. P \<bullet> (sum X agents - sum \<E> agents - sum Y firms) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<bullet> sum X agents = P \<bullet> (sum \<E> agents + sum Y firms)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P \<bullet> sum X agents = P \<bullet> (sum \<E> agents + sum Y firms)

goal (1 subgoal):
 1. P \<bullet> (sum X agents - sum \<E> agents - sum Y firms) = 0
[PROOF STEP]
by (simp add: inner_diff_right inner_right_distrib)
[PROOF STATE]
proof (state)
this:
P \<bullet> (sum X agents - sum \<E> agents - sum Y firms) = 0

goal:
No subgoals!
[PROOF STEP]
qed