[STATEMENT]
lemma matrix_sum_positive:
  fixes f :: "nat \<Rightarrow> complex mat"
  shows "(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> (\<And>k. k < n \<Longrightarrow> positive (f k))
    \<Longrightarrow> positive (matrix_sum d f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f n)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < 0 \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f 0)
 2. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f n); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f (Suc n))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> positive (f ?k)

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

goal (1 subgoal):
 1. positive (matrix_sum d f 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
positive (matrix_sum d f 0)

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f n); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f n)
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> positive (f ?k)
[PROOF STEP]
have dfn: "f n \<in> carrier_mat d d" and psn: "positive (matrix_sum d f n)" and pn: "positive (f n)" and d: "k < n \<Longrightarrow> f k \<in> carrier_mat d d" for k
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f n)
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> positive (f ?k)

goal (1 subgoal):
 1. (f n \<in> carrier_mat d d &&& positive (matrix_sum d f n)) &&& positive (f n) &&& (k < n \<Longrightarrow> f k \<in> carrier_mat d d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f n \<in> carrier_mat d d
positive (matrix_sum d f n)
positive (f n)
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f n); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f n \<in> carrier_mat d d
positive (matrix_sum d f n)
positive (f n)
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
[PROOF STEP]
have dsn: "matrix_sum d f n \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
using this:
f n \<in> carrier_mat d d
positive (matrix_sum d f n)
positive (f n)
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d f n \<in> carrier_mat d d
[PROOF STEP]
using matrix_sum_dim
[PROOF STATE]
proof (prove)
using this:
f n \<in> carrier_mat d d
positive (matrix_sum d f n)
positive (f n)
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
(\<And>k. k < ?n \<Longrightarrow> ?f k \<in> carrier_mat ?d ?d) \<Longrightarrow> matrix_sum ?d ?f ?n \<in> carrier_mat ?d ?d

goal (1 subgoal):
 1. matrix_sum d f n \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f n \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f n); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> positive (f k)\<rbrakk> \<Longrightarrow> positive (matrix_sum d f (Suc n))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (matrix_sum d f (Suc n))
[PROOF STEP]
unfolding matrix_sum.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (f n + matrix_sum d f n)
[PROOF STEP]
using positive_add[OF pn psn dfn dsn]
[PROOF STATE]
proof (prove)
using this:
positive (f n + matrix_sum d f n)

goal (1 subgoal):
 1. positive (f n + matrix_sum d f n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
positive (matrix_sum d f (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gbinomial_mult_1:
  fixes a :: "'a::field_char_0"
  shows "a * (a gchoose k) = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose (Suc k))"
  (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (a gchoose k) = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a * (a gchoose k) = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k)
[PROOF STEP]
have "?r = ((- 1) ^k * pochhammer (- a) k / fact k) * (of_nat k - (- a + of_nat k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k) = (- (1::'a)) ^ k * pochhammer (- a) k / fact k * (of_nat k - (- a + of_nat k))
[PROOF STEP]
unfolding gbinomial_pochhammer pochhammer_Suc right_diff_distrib power_Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat k * ((- (1::'a)) ^ k * pochhammer (- a) k / fact k) + of_nat (Suc k) * (- (1::'a) * (- (1::'a)) ^ k * (pochhammer (- a) k * (- a + of_nat k)) / fact (Suc k)) = (- (1::'a)) ^ k * pochhammer (- a) k / fact k * of_nat k - (- (1::'a)) ^ k * pochhammer (- a) k / fact k * (- a + of_nat k)
[PROOF STEP]
by (auto simp add: field_simps simp del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k) = (- (1::'a)) ^ k * pochhammer (- a) k / fact k * (of_nat k - (- a + of_nat k))

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

goal (1 subgoal):
 1. a * (a gchoose k) = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k)
[PROOF STEP]
have "\<dots> = ?l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ k * pochhammer (- a) k / fact k * (of_nat k - (- a + of_nat k)) = a * (a gchoose k)
[PROOF STEP]
by (simp add: field_simps gbinomial_pochhammer)
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ k * pochhammer (- a) k / fact k * (of_nat k - (- a + of_nat k)) = a * (a gchoose k)

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

goal (1 subgoal):
 1. a * (a gchoose k) = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
a * (a gchoose k) = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem rtl_union_closed:
  "\<lbrakk> L1\<in>regular_languages A; L2\<in>regular_languages A \<rbrakk>
    \<Longrightarrow> L1\<union>L2 \<in> regular_languages A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>L1 \<in> regular_languages A; L2 \<in> regular_languages A\<rbrakk> \<Longrightarrow> L1 \<union> L2 \<in> regular_languages A
[PROOF STEP]
proof (elim rtlE)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<union> L2 \<in> regular_languages A
[PROOF STEP]
fix TA1 TA2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<union> L2 \<in> regular_languages A
[PROOF STEP]
assume TA[simp]: "ranked_tree_automaton TA1 A" "ranked_tree_automaton TA2 A"
    and [simp]: "L1=ta_lang TA1" "L2=ta_lang TA2"
[PROOF STATE]
proof (state)
this:
ranked_tree_automaton TA1 A
ranked_tree_automaton TA2 A
L1 = ta_lang TA1
L2 = ta_lang TA2

goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<union> L2 \<in> regular_languages A
[PROOF STEP]
interpret ta1: ranked_tree_automaton TA1 A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ranked_tree_automaton TA1 A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<union> L2 \<in> regular_languages A
[PROOF STEP]
interpret ta2: ranked_tree_automaton TA2 A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ranked_tree_automaton TA2 A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<union> L2 \<in> regular_languages A
[PROOF STEP]
have "ta_lang (ta_union_wrap TA1 TA2) = ta_lang TA1 \<union> ta_lang TA2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_lang (ta_union_wrap TA1 TA2) = ta_lang TA1 \<union> ta_lang TA2
[PROOF STEP]
apply (rule ta_union_wrap_correct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. tree_automaton TA1
 2. tree_automaton TA2
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
this:
ta_lang (ta_union_wrap TA1 TA2) = ta_lang TA1 \<union> ta_lang TA2

goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<union> L2 \<in> regular_languages A
[PROOF STEP]
with ranked_tree_automaton.rtlI[OF ta_union_wrap_rta[OF TA]]
[PROOF STATE]
proof (chain)
picking this:
ta_lang (ta_union_wrap TA1 TA2) \<in> regular_languages A
ta_lang (ta_union_wrap TA1 TA2) = ta_lang TA1 \<union> ta_lang TA2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ta_lang (ta_union_wrap TA1 TA2) \<in> regular_languages A
ta_lang (ta_union_wrap TA1 TA2) = ta_lang TA1 \<union> ta_lang TA2

goal (1 subgoal):
 1. L1 \<union> L2 \<in> regular_languages A
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
L1 \<union> L2 \<in> regular_languages A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutations_of_set_image_inj:
  assumes inj: "inj_on f A"
  shows   "permutations_of_set (f ` A) = map f ` permutations_of_set A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutations_of_set (f ` A) = map f ` permutations_of_set A
[PROOF STEP]
by (cases "finite A")
     (simp_all add: permutations_of_set_infinite permutations_of_set_altdef
                    permutations_of_multiset_image mset_set_image_inj inj finite_image_iff)


[STATEMENT]
lemma positive_scale:
  fixes c :: real
  assumes  "A \<in> carrier_mat n n"
    and "positive A"
    and "c \<ge> 0"
  shows "positive (c \<cdot>\<^sub>m A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (complex_of_real c \<cdot>\<^sub>m A)
[PROOF STEP]
apply (rule positive_smult)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. A \<in> carrier_mat ?n ?n
 2. positive A
 3. 0 \<le> complex_of_real c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
positive A
0 \<le> c

goal (3 subgoals):
 1. A \<in> carrier_mat ?n ?n
 2. positive A
 3. 0 \<le> complex_of_real c
[PROOF STEP]
by (auto simp: less_eq_complex_def)


[STATEMENT]
lemma finsum_val_ultrametric_diff':
  assumes "g \<in> A \<rightarrow> carrier Q\<^sub>p"
  assumes "finite A"
  assumes "A \<noteq> {}"
  assumes "\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<noteq> b \<Longrightarrow> val (g a) \<noteq> val (g b)"
  shows " val (finsum Q\<^sub>p g A) = (MIN a \<in> A. (val (g a)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (finsum Q\<^sub>p g A) = (MIN a\<in>A. val (g a))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. val (finsum Q\<^sub>p g A) = (MIN a\<in>A. val (g a))
[PROOF STEP]
have 0: "(\<lambda> a. val (g a)) ` A = (val ` g`A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. val (g a)) ` A = val ` g ` A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>a. val (g a)) ` A = val ` g ` A

goal (1 subgoal):
 1. val (finsum Q\<^sub>p g A) = (MIN a\<in>A. val (g a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (finsum Q\<^sub>p g A) = (MIN a\<in>A. val (g a))
[PROOF STEP]
using assms finsum_val_ultrametric_diff[of g A]
[PROOF STATE]
proof (prove)
using this:
g \<in> A \<rightarrow> carrier Q\<^sub>p
finite A
A \<noteq> {}
\<lbrakk>?a1 \<in> A; ?b1 \<in> A; ?a1 \<noteq> ?b1\<rbrakk> \<Longrightarrow> val (g ?a1) \<noteq> val (g ?b1)
\<lbrakk>g \<in> A \<rightarrow> carrier Q\<^sub>p; finite A; A \<noteq> {}; \<And>a b. \<lbrakk>a \<in> A; b \<in> A; a \<noteq> b\<rbrakk> \<Longrightarrow> val (g a) \<noteq> val (g b)\<rbrakk> \<Longrightarrow> val (finsum Q\<^sub>p g A) = Min (val ` g ` A)

goal (1 subgoal):
 1. val (finsum Q\<^sub>p g A) = (MIN a\<in>A. val (g a))
[PROOF STEP]
unfolding 0
[PROOF STATE]
proof (prove)
using this:
g \<in> A \<rightarrow> carrier Q\<^sub>p
finite A
A \<noteq> {}
\<lbrakk>?a1 \<in> A; ?b1 \<in> A; ?a1 \<noteq> ?b1\<rbrakk> \<Longrightarrow> val (g ?a1) \<noteq> val (g ?b1)
\<lbrakk>g \<in> A \<rightarrow> carrier Q\<^sub>p; finite A; A \<noteq> {}; \<And>a b. \<lbrakk>a \<in> A; b \<in> A; a \<noteq> b\<rbrakk> \<Longrightarrow> val (g a) \<noteq> val (g b)\<rbrakk> \<Longrightarrow> val (finsum Q\<^sub>p g A) = Min (val ` g ` A)

goal (1 subgoal):
 1. val (finsum Q\<^sub>p g A) = Min (val ` g ` A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
val (finsum Q\<^sub>p g A) = (MIN a\<in>A. val (g a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsetsum_scaleR_right:
  "infsetsum (\<lambda>x. c *\<^sub>R f x) A = c *\<^sub>R infsetsum f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. c *\<^sub>R f x) = c *\<^sub>R infsetsum f A
[PROOF STEP]
unfolding infsetsum_def abs_summable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|count_space A. c *\<^sub>R f x = c *\<^sub>R integral\<^sup>L (count_space A) f
[PROOF STEP]
by (subst Bochner_Integration.integral_scaleR_right) auto


[STATEMENT]
lemma (in comm_group) IDirProds_card:
  assumes "finite I" "\<forall>i\<in>I. subgroup (S i) G"
          "\<forall>i\<in>I. finite (S i)" "pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) I"
  shows "card (IDirProds G S I) = (\<Prod>i \<in> I. card (S i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
\<forall>i\<in>I. subgroup (S i) G
\<forall>i\<in>I. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) I

goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
[PROOF STEP]
proof (induction I rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<forall>i\<in>{}. subgroup (S i) G; \<forall>i\<in>{}. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) {}\<rbrakk> \<Longrightarrow> card (IDirProds G S {}) = (\<Prod>i\<in>{}. card (S i))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{}. subgroup (S i) G
\<forall>i\<in>{}. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) {}

goal (2 subgoals):
 1. \<lbrakk>\<forall>i\<in>{}. subgroup (S i) G; \<forall>i\<in>{}. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) {}\<rbrakk> \<Longrightarrow> card (IDirProds G S {}) = (\<Prod>i\<in>{}. card (S i))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i\<in>{}. subgroup (S i) G
\<forall>i\<in>{}. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{}. subgroup (S i) G
\<forall>i\<in>{}. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) {}

goal (1 subgoal):
 1. card (IDirProds G S {}) = (\<Prod>i\<in>{}. card (S i))
[PROOF STEP]
using IDirProds_empty[of S]
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{}. subgroup (S i) G
\<forall>i\<in>{}. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) {}
IDirProds G S {} = {\<one>}

goal (1 subgoal):
 1. card (IDirProds G S {}) = (\<Prod>i\<in>{}. card (S i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (IDirProds G S {}) = (\<Prod>i\<in>{}. card (S i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
case i: (insert x I)
[PROOF STATE]
proof (state)
this:
finite I
x \<notin> I
\<lbrakk>\<forall>i\<in>I. subgroup (S i) G; \<forall>i\<in>I. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) I\<rbrakk> \<Longrightarrow> card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
\<forall>i\<in>insert x I. subgroup (S i) G
\<forall>i\<in>insert x I. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
have sx: "subgroup (S x) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (S x) G
[PROOF STEP]
using i(4)
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>insert x I. subgroup (S i) G

goal (1 subgoal):
 1. subgroup (S x) G
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
subgroup (S x) G

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
have cx: "(S x) \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S x \<subseteq> carrier G
[PROOF STEP]
using subgroup.subset[OF sx]
[PROOF STATE]
proof (prove)
using this:
S x \<subseteq> carrier G

goal (1 subgoal):
 1. S x \<subseteq> carrier G
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
S x \<subseteq> carrier G

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
have fx: "finite (S x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (S x)
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
finite I
x \<notin> I
\<lbrakk>\<forall>i\<in>I. subgroup (S i) G; \<forall>i\<in>I. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) I\<rbrakk> \<Longrightarrow> card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
\<forall>i\<in>insert x I. subgroup (S i) G
\<forall>i\<in>insert x I. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x I)

goal (1 subgoal):
 1. finite (S x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (S x)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
have cI: "\<Union>(S ` I) \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (S ` I) \<subseteq> carrier G
[PROOF STEP]
using subgroup.subset[of _ G] i(4)
[PROOF STATE]
proof (prove)
using this:
subgroup ?H G \<Longrightarrow> ?H \<subseteq> carrier G
\<forall>i\<in>insert x I. subgroup (S i) G

goal (1 subgoal):
 1. \<Union> (S ` I) \<subseteq> carrier G
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<Union> (S ` I) \<subseteq> carrier G

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
from generate_is_subgroup[OF this]
[PROOF STATE]
proof (chain)
picking this:
subgroup (generate G (\<Union> (S ` I))) G
[PROOF STEP]
have sIP: "subgroup (IDirProds G S I) G"
[PROOF STATE]
proof (prove)
using this:
subgroup (generate G (\<Union> (S ` I))) G

goal (1 subgoal):
 1. subgroup (IDirProds G S I) G
[PROOF STEP]
unfolding IDirProds_def
[PROOF STATE]
proof (prove)
using this:
subgroup (generate G (\<Union> (S ` I))) G

goal (1 subgoal):
 1. subgroup (generate G (\<Union> (S ` I))) G
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
subgroup (IDirProds G S I) G

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subgroup (IDirProds G S I) G
[PROOF STEP]
have cIP: "(IDirProds G S I) \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
using this:
subgroup (IDirProds G S I) G

goal (1 subgoal):
 1. IDirProds G S I \<subseteq> carrier G
[PROOF STEP]
using subgroup.subset
[PROOF STATE]
proof (prove)
using this:
subgroup (IDirProds G S I) G
subgroup ?H ?G \<Longrightarrow> ?H \<subseteq> carrier ?G

goal (1 subgoal):
 1. IDirProds G S I \<subseteq> carrier G
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
IDirProds G S I \<subseteq> carrier G

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
have fIP: "finite (IDirProds G S I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (IDirProds G S I)
[PROOF STEP]
using IDirProds_finite[OF i(1)] i
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>i\<in>I. subgroup (?S i) G; \<forall>i\<in>I. finite (?S i)\<rbrakk> \<Longrightarrow> finite (IDirProds G ?S I)
finite I
x \<notin> I
\<lbrakk>\<forall>i\<in>I. subgroup (S i) G; \<forall>i\<in>I. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) I\<rbrakk> \<Longrightarrow> card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
\<forall>i\<in>insert x I. subgroup (S i) G
\<forall>i\<in>insert x I. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x I)

goal (1 subgoal):
 1. finite (IDirProds G S I)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (IDirProds G S I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
finite I
x \<notin> I
\<lbrakk>\<forall>i\<in>I. subgroup (S i) G; \<forall>i\<in>I. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) I\<rbrakk> \<Longrightarrow> card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
\<forall>i\<in>insert x I. subgroup (S i) G
\<forall>i\<in>insert x I. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x I)
[PROOF STEP]
have ih: "card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))"
[PROOF STATE]
proof (prove)
using this:
finite I
x \<notin> I
\<lbrakk>\<forall>i\<in>I. subgroup (S i) G; \<forall>i\<in>I. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) I\<rbrakk> \<Longrightarrow> card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
\<forall>i\<in>insert x I. subgroup (S i) G
\<forall>i\<in>insert x I. finite (S i)
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x I)

goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
[PROOF STEP]
unfolding pairwise_def
[PROOF STATE]
proof (prove)
using this:
finite I
x \<notin> I
\<lbrakk>\<forall>i\<in>I. subgroup (S i) G; \<forall>i\<in>I. finite (S i); \<forall>x\<in>I. \<forall>y\<in>I. x \<noteq> y \<longrightarrow> coprime (card (S x)) (card (S y))\<rbrakk> \<Longrightarrow> card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
\<forall>i\<in>insert x I. subgroup (S i) G
\<forall>i\<in>insert x I. finite (S i)
\<forall>xa\<in>insert x I. \<forall>y\<in>insert x I. xa \<noteq> y \<longrightarrow> coprime (card (S xa)) (card (S y))

goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
hence cop: "coprime (card (IDirProds G S I)) (card (S x))"
[PROOF STATE]
proof (prove)
using this:
card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))

goal (1 subgoal):
 1. coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i)) \<Longrightarrow> coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
have cFI0: "card (IDirProds G S I) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (IDirProds G S I) \<noteq> 0
[PROOF STEP]
using finite_subgroup_card_neq_0[OF sIP fIP]
[PROOF STATE]
proof (prove)
using this:
card (IDirProds G S I) \<noteq> 0

goal (1 subgoal):
 1. card (IDirProds G S I) \<noteq> 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (IDirProds G S I) \<noteq> 0

goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i)) \<Longrightarrow> coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (IDirProds G S I) \<noteq> 0

goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i)) \<Longrightarrow> coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
have cx0: "card (S x) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (S x) \<noteq> 0
[PROOF STEP]
using finite_subgroup_card_neq_0[OF sx fx]
[PROOF STATE]
proof (prove)
using this:
card (S x) \<noteq> 0

goal (1 subgoal):
 1. card (S x) \<noteq> 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (S x) \<noteq> 0

goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i)) \<Longrightarrow> coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (S x) \<noteq> 0

goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i)) \<Longrightarrow> coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
have  "prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have n0: "\<And>i. i \<in> I \<Longrightarrow> card (S i) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> card (S i) \<noteq> 0
[PROOF STEP]
using finite_subgroup_card_neq_0 i(4, 5)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subgroup ?H G; finite ?H\<rbrakk> \<Longrightarrow> card ?H \<noteq> 0
\<forall>i\<in>insert x I. subgroup (S i) G
\<forall>i\<in>insert x I. finite (S i)

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> card (S i) \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?i \<in> I \<Longrightarrow> card (S ?i) \<noteq> 0

goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
assume "prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {}"
[PROOF STATE]
proof (state)
this:
prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {}

goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {}

goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "prime_factors (card (IDirProds G S I)) = \<Union>(prime_factors ` (card \<circ> S) ` I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) = \<Union> (prime_factors ` (card \<circ> S) ` I)
[PROOF STEP]
using n0 prime_factors_Prod[OF i(1), of "card \<circ> S"]
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> card (S ?i) \<noteq> 0
(\<And>a. a \<in> I \<Longrightarrow> (card \<circ> S) a \<noteq> 0) \<Longrightarrow> prime_factors (prod (card \<circ> S) I) = \<Union> (prime_factors ` (card \<circ> S) ` I)

goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) = \<Union> (prime_factors ` (card \<circ> S) ` I)
[PROOF STEP]
by (subst ih; simp)
[PROOF STATE]
proof (state)
this:
prime_factors (card (IDirProds G S I)) = \<Union> (prime_factors ` (card \<circ> S) ` I)

goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prime_factors (card (IDirProds G S I)) = \<Union> (prime_factors ` (card \<circ> S) ` I)

goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<And>i. i \<in> I \<Longrightarrow> prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
assume ind: "i \<in> I"
[PROOF STATE]
proof (state)
this:
i \<in> I

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> I
[PROOF STEP]
have coPx: "coprime (card (S i)) (card (S x))"
[PROOF STATE]
proof (prove)
using this:
i \<in> I

goal (1 subgoal):
 1. coprime (card (S i)) (card (S x))
[PROOF STEP]
using i(2, 6)
[PROOF STATE]
proof (prove)
using this:
i \<in> I
x \<notin> I
pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x I)

goal (1 subgoal):
 1. coprime (card (S i)) (card (S x))
[PROOF STEP]
unfolding pairwise_def
[PROOF STATE]
proof (prove)
using this:
i \<in> I
x \<notin> I
\<forall>xa\<in>insert x I. \<forall>y\<in>insert x I. xa \<noteq> y \<longrightarrow> coprime (card (S xa)) (card (S y))

goal (1 subgoal):
 1. coprime (card (S i)) (card (S x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime (card (S i)) (card (S x))

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
have "card (S i) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (S i) \<noteq> 0
[PROOF STEP]
using n0 ind
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> card (S ?i) \<noteq> 0
i \<in> I

goal (1 subgoal):
 1. card (S i) \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (S i) \<noteq> 0

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
from coprime_eq_empty_prime_inter[OF this cx0]
[PROOF STATE]
proof (chain)
picking this:
coprime (card (S i)) (card (S x)) = (prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {})
[PROOF STEP]
show "prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}"
[PROOF STATE]
proof (prove)
using this:
coprime (card (S i)) (card (S x)) = (prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {})

goal (1 subgoal):
 1. prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
using coPx
[PROOF STATE]
proof (prove)
using this:
coprime (card (S i)) (card (S x)) = (prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {})
coprime (card (S i)) (card (S x))

goal (1 subgoal):
 1. prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prime_factors (card (S i)) \<inter> prime_factors (card (S x)) = {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i \<in> I \<Longrightarrow> prime_factors (card (S ?i)) \<inter> prime_factors (card (S x)) = {}

goal (1 subgoal):
 1. prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {}
prime_factors (card (IDirProds G S I)) = \<Union> (prime_factors ` (card \<circ> S) ` I)
?i \<in> I \<Longrightarrow> prime_factors (card (S ?i)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) \<noteq> {}
prime_factors (card (IDirProds G S I)) = \<Union> (prime_factors ` (card \<circ> S) ` I)
?i \<in> I \<Longrightarrow> prime_factors (card (S ?i)) \<inter> prime_factors (card (S x)) = {}

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) = {}

goal (1 subgoal):
 1. card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i)) \<Longrightarrow> coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (IDirProds G S I) \<noteq> 0
card (S x) \<noteq> 0
prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (IDirProds G S I) \<noteq> 0
card (S x) \<noteq> 0
prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) = {}

goal (1 subgoal):
 1. coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
using coprime_eq_empty_prime_inter
[PROOF STATE]
proof (prove)
using this:
card (IDirProds G S I) \<noteq> 0
card (S x) \<noteq> 0
prime_factors (card (IDirProds G S I)) \<inter> prime_factors (card (S x)) = {}
\<lbrakk>?n \<noteq> 0; ?m \<noteq> 0\<rbrakk> \<Longrightarrow> coprime ?n ?m = (prime_factors ?n \<inter> prime_factors ?m = {})

goal (1 subgoal):
 1. coprime (card (IDirProds G S I)) (card (S x))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
coprime (card (IDirProds G S I)) (card (S x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coprime (card (IDirProds G S I)) (card (S x))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
have "card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)
[PROOF STEP]
from finite_sub_comp_iff_card_eq_IDirProd[OF sIP sx fIP fx]
         subgroups_card_coprime_imp_compl[OF sIP sx cop]
[PROOF STATE]
proof (chain)
picking this:
(card (IDirProd G (IDirProds G S I) (S x)) = card (S x) * card (IDirProds G S I)) = complementary (IDirProds G S I) (S x)
complementary (IDirProds G S I) (S x)
[PROOF STEP]
have "card (IDirProd G (IDirProds G S I) (S x)) = card (S x) * card (IDirProds G S I)"
[PROOF STATE]
proof (prove)
using this:
(card (IDirProd G (IDirProds G S I) (S x)) = card (S x) * card (IDirProds G S I)) = complementary (IDirProds G S I) (S x)
complementary (IDirProds G S I) (S x)

goal (1 subgoal):
 1. card (IDirProd G (IDirProds G S I) (S x)) = card (S x) * card (IDirProds G S I)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (IDirProd G (IDirProds G S I) (S x)) = card (S x) * card (IDirProds G S I)

goal (1 subgoal):
 1. card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (IDirProd G (IDirProds G S I) (S x)) = card (S x) * card (IDirProds G S I)

goal (1 subgoal):
 1. card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)
[PROOF STEP]
have "generate G (\<Union> (S ` insert x I)) = generate G (generate G (\<Union> (S ` I)) \<union> S x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generate G (\<Union> (S ` insert x I)) = generate G (generate G (\<Union> (S ` I)) \<union> S x)
[PROOF STEP]
by (simp add: Un_commute cI cx generate_idem'_right)
[PROOF STATE]
proof (state)
this:
generate G (\<Union> (S ` insert x I)) = generate G (generate G (\<Union> (S ` I)) \<union> S x)

goal (1 subgoal):
 1. card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (IDirProd G (IDirProds G S I) (S x)) = card (S x) * card (IDirProds G S I)
generate G (\<Union> (S ` insert x I)) = generate G (generate G (\<Union> (S ` I)) \<union> S x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (IDirProd G (IDirProds G S I) (S x)) = card (S x) * card (IDirProds G S I)
generate G (\<Union> (S ` insert x I)) = generate G (generate G (\<Union> (S ` I)) \<union> S x)

goal (1 subgoal):
 1. card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)
[PROOF STEP]
unfolding IDirProds_def IDirProd_def
[PROOF STATE]
proof (prove)
using this:
card (generate G (generate G (\<Union> (S ` I)) \<union> S x)) = card (S x) * card (generate G (\<Union> (S ` I)))
generate G (\<Union> (S ` insert x I)) = generate G (generate G (\<Union> (S ` I)) \<union> S x)

goal (1 subgoal):
 1. card (generate G (\<Union> (S ` insert x I))) = card (S x) * card (generate G (\<Union> (S ` I)))
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (IDirProds G S (insert x I)) = card (S x) * card (IDirProds G S I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
have "\<dots> = card (S x) * prod (card \<circ> S) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (S x) * card (IDirProds G S I) = card (S x) * prod (card \<circ> S) I
[PROOF STEP]
using ih
[PROOF STATE]
proof (prove)
using this:
card (IDirProds G S I) = (\<Prod>i\<in>I. card (S i))

goal (1 subgoal):
 1. card (S x) * card (IDirProds G S I) = card (S x) * prod (card \<circ> S) I
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (S x) * card (IDirProds G S I) = card (S x) * prod (card \<circ> S) I

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (S x) * card (IDirProds G S I) = card (S x) * prod (card \<circ> S) I

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
have "\<dots> = prod (card \<circ> S) ({x} \<union> I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (S x) * prod (card \<circ> S) I = prod (card \<circ> S) ({x} \<union> I)
[PROOF STEP]
using i.hyps
[PROOF STATE]
proof (prove)
using this:
finite I
x \<notin> I

goal (1 subgoal):
 1. card (S x) * prod (card \<circ> S) I = prod (card \<circ> S) ({x} \<union> I)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (S x) * prod (card \<circ> S) I = prod (card \<circ> S) ({x} \<union> I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<forall>i\<in>F. subgroup (S i) G; \<forall>i\<in>F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) F\<rbrakk> \<Longrightarrow> card (IDirProds G S F) = (\<Prod>i\<in>F. card (S i)); \<forall>i\<in>insert x F. subgroup (S i) G; \<forall>i\<in>insert x F. finite (S i); pairwise (\<lambda>x y. coprime (card (S x)) (card (S y))) (insert x F)\<rbrakk> \<Longrightarrow> card (IDirProds G S (insert x F)) = (\<Prod>i\<in>insert x F. card (S i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (IDirProds G S (insert x I)) = prod (card \<circ> S) ({x} \<union> I)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (IDirProds G S (insert x I)) = prod (card \<circ> S) ({x} \<union> I)

goal (1 subgoal):
 1. card (IDirProds G S (insert x I)) = (\<Prod>i\<in>insert x I. card (S i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (IDirProds G S (insert x I)) = (\<Prod>i\<in>insert x I. card (S i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem poincare_map_plane_has_derivative:
  assumes rt: "returns_to {x \<in> S. x \<bullet> i = c} x" (is "returns_to ?P _")
  assumes cS: "closed S"
  assumes fnz: "f (poincare_map ?P x) \<bullet> i \<noteq> 0"
  assumes eventually_inside: "\<forall>\<^sub>F x in at (poincare_map ?P x). x \<bullet> i = c \<longrightarrow> x \<in> S"
  assumes outside: "x \<notin> S \<or> x \<bullet> i \<noteq> c"
  notes [derivative_intros] = return_time_plane_has_derivative[OF rt cS fnz eventually_inside outside]
  shows "(poincare_map ?P has_derivative Dpoincare_map' i c S x) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poincare_map {x \<in> S. x \<bullet> i = c} has_derivative blinfun_apply (Dpoincare_map' i c S x)) (at x)
[PROOF STEP]
unfolding poincare_map_def Dpoincare_map'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. flow0 x (return_time {x \<in> S. x \<bullet> i = c} x)) has_derivative blinfun_apply (Dflow x (return_time {x \<in> S. x \<bullet> i - c = 0} x) - (blinfun_scaleR_left (f (flow0 x (return_time {x \<in> S. x \<bullet> i = c} x))) o\<^sub>L (blinfun_scaleR_left (inverse (f (flow0 x (return_time {x \<in> S. x \<bullet> i = c} x)) \<bullet> i)) o\<^sub>L (blinfun_inner_left i o\<^sub>L Dflow x (return_time {x \<in> S. x \<bullet> i - c = 0} x)))))) (at x)
[PROOF STEP]
using fnz outside
[PROOF STATE]
proof (prove)
using this:
f (poincare_map {x \<in> S. x \<bullet> i = c} x) \<bullet> i \<noteq> 0
x \<notin> S \<or> x \<bullet> i \<noteq> c

goal (1 subgoal):
 1. ((\<lambda>x. flow0 x (return_time {x \<in> S. x \<bullet> i = c} x)) has_derivative blinfun_apply (Dflow x (return_time {x \<in> S. x \<bullet> i - c = 0} x) - (blinfun_scaleR_left (f (flow0 x (return_time {x \<in> S. x \<bullet> i = c} x))) o\<^sub>L (blinfun_scaleR_left (inverse (f (flow0 x (return_time {x \<in> S. x \<bullet> i = c} x)) \<bullet> i)) o\<^sub>L (blinfun_inner_left i o\<^sub>L Dflow x (return_time {x \<in> S. x \<bullet> i - c = 0} x)))))) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros return_time_exivl assms ext closed_levelset_within
      continuous_intros
      simp: flowderiv_eq poincare_map_def blinfun.bilinear_simps inverse_eq_divide algebra_simps)


[STATEMENT]
lemma transpose_combine_matrix: "f 0 0 = 0 \<Longrightarrow> transpose_matrix (combine_matrix f A B) = combine_matrix f (transpose_matrix A) (transpose_matrix B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (0::'b) (0::'c) = (0::'a) \<Longrightarrow> transpose_matrix (combine_matrix f A B) = combine_matrix f (transpose_matrix A) (transpose_matrix B)
[PROOF STEP]
apply (simp add: Rep_matrix_inject[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (0::'b) (0::'c) = (0::'a) \<Longrightarrow> Rep_matrix (transpose_matrix (combine_matrix f A B)) = Rep_matrix (combine_matrix f (transpose_matrix A) (transpose_matrix B))
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. f (0::'b) (0::'c) = (0::'a) \<Longrightarrow> Rep_matrix (transpose_matrix (combine_matrix f A B)) x xa = Rep_matrix (combine_matrix f (transpose_matrix A) (transpose_matrix B)) x xa
[PROOF STEP]
by simp


[STATEMENT]
theorem set_vebt_pred'[vebt_simps]: "invar_vebt t n \<Longrightarrow>
  vebt_pred t x = (if \<exists>  y \<in> set_vebt t. y < x then Some (GREATEST y. y \<in> set_vebt t \<and> y < x) else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> vebt_pred t x = (if \<exists>y\<in>set_vebt t. y < x then Some (GREATEST y. y \<in> set_vebt t \<and> y < x) else None)
[PROOF STEP]
apply (clarsimp simp: member_correct pred_empty pred_correct is_pred_in_set_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>invar_vebt t n; y \<in> set_vebt t; y < x\<rbrakk> \<Longrightarrow> (GREATEST y. y \<in> set_vebt t \<and> y < x) \<in> set_vebt t \<and> (GREATEST y. y \<in> set_vebt t \<and> y < x) < x \<and> (\<forall>z\<in>set_vebt t. z < x \<longrightarrow> z \<le> (GREATEST y. y \<in> set_vebt t \<and> y < x))
[PROOF STEP]
by (metis (no_types, lifting) GreatestI_nat Greatest_le_nat less_imp_le)


[STATEMENT]
lemma  f_sum_card_quadruple_set_additive_energy: assumes "A \<subseteq> G" and "finite A"
  shows "(\<Sum> d \<in> sumset A A. (f_sum d A)^2) = additive_energy A * (card A)^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = additive_energy A * real (card A ^ 3)
[PROOF STEP]
using assms f_sum_card_quadruple_set additive_energy_def
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> G
finite A
\<lbrakk>?A \<subseteq> G; finite ?A\<rbrakk> \<Longrightarrow> (\<Sum>d\<in>sumset ?A ?A. (f_sum d ?A)\<^sup>2) = card (additive_quadruple_set ?A)
additive_energy ?A \<equiv> real (card (additive_quadruple_set ?A)) / real (card ?A ^ 3)

goal (1 subgoal):
 1. real (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = additive_energy A * real (card A ^ 3)
[PROOF STEP]
by force


[STATEMENT]
lemma card_of_Times_singleton:
  fixes A :: "'a set"
  shows "|A \<times> {x}| =o |A|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A \<times> {x}| =o |A|
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |A \<times> {x}| =o |A|
[PROOF STEP]
define f :: "'a \<times> 'b \<Rightarrow> 'a" where "f = (\<lambda>(a, b). a)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>(a, b). a)

goal (1 subgoal):
 1. |A \<times> {x}| =o |A|
[PROOF STEP]
have "A \<subseteq> f ` (A \<times> {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> f ` (A \<times> {x})
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> (\<lambda>(a, b). a) ` (A \<times> {x})
[PROOF STEP]
by (auto simp: image_iff)
[PROOF STATE]
proof (state)
this:
A \<subseteq> f ` (A \<times> {x})

goal (1 subgoal):
 1. |A \<times> {x}| =o |A|
[PROOF STEP]
hence "bij_betw f (A \<times> {x}) A"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> f ` (A \<times> {x})

goal (1 subgoal):
 1. bij_betw f (A \<times> {x}) A
[PROOF STEP]
unfolding bij_betw_def inj_on_def f_def
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> (\<lambda>(a, b). a) ` (A \<times> {x})

goal (1 subgoal):
 1. (\<forall>xa\<in>A \<times> {x}. \<forall>y\<in>A \<times> {x}. (case xa of (a, b) \<Rightarrow> a) = (case y of (a, b) \<Rightarrow> a) \<longrightarrow> xa = y) \<and> (\<lambda>(a, b). a) ` (A \<times> {x}) = A
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
bij_betw f (A \<times> {x}) A

goal (1 subgoal):
 1. |A \<times> {x}| =o |A|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw f (A \<times> {x}) A

goal (1 subgoal):
 1. |A \<times> {x}| =o |A|
[PROOF STEP]
using card_of_ordIso
[PROOF STATE]
proof (prove)
using this:
bij_betw f (A \<times> {x}) A
(\<exists>f. bij_betw f ?A ?B) = (|?A| =o |?B|)

goal (1 subgoal):
 1. |A \<times> {x}| =o |A|
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
|A \<times> {x}| =o |A|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma min_shift:
fixes f :: "nat \<Rightarrow> Clocktime" and S
assumes notEmpFin: "S \<noteq> {}" "finite S"
shows
"Min (f`S) + x = Min ( (\<lambda> p. f p + x) ` S) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (f ` S) + x = (MIN p\<in>S. f p + x)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Min (f ` S) + x = (MIN p\<in>S. f p + x)
[PROOF STEP]
from notEmpFin
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
finite S
[PROOF STEP]
have "f`S \<noteq> {}" and "(\<lambda> p. f p + x) ` S \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
finite S

goal (1 subgoal):
 1. f ` S \<noteq> {} &&& (\<lambda>p. f p + x) ` S \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` S \<noteq> {}
(\<lambda>p. f p + x) ` S \<noteq> {}

goal (1 subgoal):
 1. Min (f ` S) + x = (MIN p\<in>S. f p + x)
[PROOF STEP]
with notEmpFin
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
finite S
f ` S \<noteq> {}
(\<lambda>p. f p + x) ` S \<noteq> {}
[PROOF STEP]
have
    "Min (f`S) \<in> f ` S " "Min ((\<lambda> p. f p + x)`S) \<in> (\<lambda> p. f p + x) ` S "
    "(\<forall>fs \<in> (f`S). Min (f`S) <= fs)"
    "(\<forall>fs \<in> ((\<lambda> p. f p + x)`S). Min ((\<lambda> p. f p + x)`S) <= fs)"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
finite S
f ` S \<noteq> {}
(\<lambda>p. f p + x) ` S \<noteq> {}

goal (1 subgoal):
 1. (Min (f ` S) \<in> f ` S &&& (MIN p\<in>S. f p + x) \<in> (\<lambda>p. f p + x) ` S) &&& \<forall>fs\<in>f ` S. Min (f ` S) \<le> fs &&& \<forall>fs\<in>(\<lambda>p. f p + x) ` S. (MIN p\<in>S. f p + x) \<le> fs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Min (f ` S) \<in> f ` S
(MIN p\<in>S. f p + x) \<in> (\<lambda>p. f p + x) ` S
\<forall>fs\<in>f ` S. Min (f ` S) \<le> fs
\<forall>fs\<in>(\<lambda>p. f p + x) ` S. (MIN p\<in>S. f p + x) \<le> fs

goal (1 subgoal):
 1. Min (f ` S) + x = (MIN p\<in>S. f p + x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Min (f ` S) \<in> f ` S
(MIN p\<in>S. f p + x) \<in> (\<lambda>p. f p + x) ` S
\<forall>fs\<in>f ` S. Min (f ` S) \<le> fs
\<forall>fs\<in>(\<lambda>p. f p + x) ` S. (MIN p\<in>S. f p + x) \<le> fs

goal (1 subgoal):
 1. Min (f ` S) + x = (MIN p\<in>S. f p + x)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Min (f ` S) + x = (MIN p\<in>S. f p + x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_imp_homotopy_equivalent_space:
  "X homeomorphic_space Y \<Longrightarrow> X homotopy_equivalent_space Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X homeomorphic_space Y \<Longrightarrow> X homotopy_equivalent_space Y
[PROOF STEP]
unfolding homeomorphic_space_def homotopy_equivalent_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f g. homeomorphic_maps X Y f g \<Longrightarrow> \<exists>f g. continuous_map X Y f \<and> continuous_map Y X g \<and> homotopic_with (\<lambda>x. True) X X (g \<circ> f) id \<and> homotopic_with (\<lambda>x. True) Y Y (f \<circ> g) id
[PROOF STEP]
apply (erule ex_forward)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f g. homeomorphic_maps X Y f g \<Longrightarrow> continuous_map X Y f \<and> continuous_map Y X g \<and> homotopic_with (\<lambda>x. True) X X (g \<circ> f) id \<and> homotopic_with (\<lambda>x. True) Y Y (f \<circ> g) id
[PROOF STEP]
by (simp add: homotopic_with_equal homotopic_with_sym homeomorphic_maps_def)


[STATEMENT]
lemma convex_closure [intro,simp]:
  fixes S :: "'a::real_normed_vector set"
  assumes "convex S"
  shows "convex (closure S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (closure S)
[PROOF STEP]
apply (rule convexI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> closure S; y \<in> closure S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> closure S
[PROOF STEP]
unfolding closure_sequential
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>\<exists>xa. (\<forall>n. xa n \<in> S) \<and> xa \<longlonglongrightarrow> x; \<exists>x. (\<forall>n. x n \<in> S) \<and> x \<longlonglongrightarrow> y; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> \<exists>xa. (\<forall>n. xa n \<in> S) \<and> xa \<longlonglongrightarrow> u *\<^sub>R x + v *\<^sub>R y
[PROOF STEP]
apply (elim exE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y u v xa xb. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; (\<forall>n. xa n \<in> S) \<and> xa \<longlonglongrightarrow> x; (\<forall>n. xb n \<in> S) \<and> xb \<longlonglongrightarrow> y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<forall>n. xa n \<in> S) \<and> xa \<longlonglongrightarrow> u *\<^sub>R x + v *\<^sub>R y
[PROOF STEP]
subgoal for x y u v f g
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; (\<forall>n. f n \<in> S) \<and> f \<longlonglongrightarrow> x; (\<forall>n. g n \<in> S) \<and> g \<longlonglongrightarrow> y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<forall>n. xa n \<in> S) \<and> xa \<longlonglongrightarrow> u *\<^sub>R x + v *\<^sub>R y
[PROOF STEP]
by (rule_tac x="\<lambda>n. u *\<^sub>R f n + v *\<^sub>R g n" in exI) (force intro: tendsto_intros dest: convexD [OF assms])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma scalar_prod_is_Matrix_scalar_prod [simp]:
  fixes u::"complex list" and v::"complex list"
  assumes "length u = length v"
  shows "plus_mult.scalar_product (*) 0 (+) u v = (vec_of_list u) \<bullet> (vec_of_list v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
have f:"(vec_of_list u) \<bullet> (vec_of_list v) = (\<Sum>i=0..<length v. u ! i * v ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i)
[PROOF STEP]
using assms scalar_prod_def[of "vec_of_list u" "vec_of_list v"] Matrix.dim_vec_of_list[of v] index_vec_of_list
[PROOF STATE]
proof (prove)
using this:
length u = length v
vec_of_list u \<bullet> vec_of_list v \<equiv> \<Sum>i = 0..<dim_vec (vec_of_list v). vec_of_list u $ i * vec_of_list v $ i
dim_vec (vec_of_list v) = length v
?i < length ?xs \<Longrightarrow> vec_of_list ?xs $ ?i = ?xs ! ?i

goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i)
[PROOF STEP]
by (metis (no_types, lifting) atLeastLessThan_iff sum.cong)
[PROOF STATE]
proof (state)
this:
vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i)

goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i)

goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
have "plus_mult.scalar_product (*) 0 (+) u v = semiring_0_class.scalar_prod u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) u v = semiring_0_class.scalar_prod u v
[PROOF STEP]
using  plus_mult.scalar_product_def[of 1 "(*)" 0 "(+)" "a_inv cpx_rng" u v]
[PROOF STATE]
proof (prove)
using this:
plus_mult 1 (*) 0 (+) (a_inv cpx_rng) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = semiring_0_class.scalar_prod u v

goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) u v = semiring_0_class.scalar_prod u v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
plus_mult.scalar_product (*) 0 (+) u v = semiring_0_class.scalar_prod u v

goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
plus_mult.scalar_product (*) 0 (+) u v = semiring_0_class.scalar_prod u v

goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
have "\<dots> = sum_list (map (\<lambda>(x,y). x * y) (zip u v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semiring_0_class.scalar_prod u v = sum_list (map2 (*) u v)
[PROOF STEP]
by (simp add: scalar_prod)
[PROOF STATE]
proof (state)
this:
semiring_0_class.scalar_prod u v = sum_list (map2 (*) u v)

goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
semiring_0_class.scalar_prod u v = sum_list (map2 (*) u v)

goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
have "\<forall>i<length v. (zip u v) ! i = (u ! i, v ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length v. zip u v ! i = (u ! i, v ! i)
[PROOF STEP]
using assms zip_def
[PROOF STATE]
proof (prove)
using this:
length u = length v
zip \<equiv> \<lambda>uu uua. rec_list (\<lambda>xs. []) (\<lambda>y ys ysa xs. case xs of [] \<Rightarrow> [] | z # zs \<Rightarrow> (z, y) # ysa zs) uua uu

goal (1 subgoal):
 1. \<forall>i<length v. zip u v ! i = (u ! i, v ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i<length v. zip u v ! i = (u ! i, v ! i)

goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<length v. zip u v ! i = (u ! i, v ! i)
[PROOF STEP]
have "\<forall>i<length v. (map (\<lambda>(x,y). x * y) (zip u v)) ! i = u ! i * v ! i"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length v. zip u v ! i = (u ! i, v ! i)

goal (1 subgoal):
 1. \<forall>i<length v. map2 (*) u v ! i = u ! i * v ! i
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
\<forall>i<length v. map2 (*) u v ! i = u ! i * v ! i

goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
plus_mult.scalar_product (*) 0 (+) u v = semiring_0_class.scalar_prod u v
semiring_0_class.scalar_prod u v = sum_list (map2 (*) u v)
\<forall>i<length v. map2 (*) u v ! i = u ! i * v ! i
[PROOF STEP]
have "plus_mult.scalar_product (*) 0 (+) u v = (\<Sum>i=0..<length v. u ! i * v ! i)"
[PROOF STATE]
proof (prove)
using this:
plus_mult.scalar_product (*) 0 (+) u v = semiring_0_class.scalar_prod u v
semiring_0_class.scalar_prod u v = sum_list (map2 (*) u v)
\<forall>i<length v. map2 (*) u v ! i = u ! i * v ! i

goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) u v = (\<Sum>i = 0..<length v. u ! i * v ! i)
[PROOF STEP]
by(metis (no_types, lifting) assms atLeastLessThan_iff length_map map_fst_zip sum.cong sum_list_sum_nth)
[PROOF STATE]
proof (state)
this:
plus_mult.scalar_product (*) 0 (+) u v = (\<Sum>i = 0..<length v. u ! i * v ! i)

goal (1 subgoal):
 1. vec_of_list u \<bullet> vec_of_list v = (\<Sum>i = 0..<length v. u ! i * v ! i) \<Longrightarrow> plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
plus_mult.scalar_product (*) 0 (+) u v = (\<Sum>i = 0..<length v. u ! i * v ! i)

goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v
[PROOF STEP]
by (simp add: f)
[PROOF STATE]
proof (state)
this:
plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
plus_mult.scalar_product (*) 0 (+) u v = vec_of_list u \<bullet> vec_of_list v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Nset_un:"{j. j \<le> (Suc n)} = {j. j \<le> n} \<union> {Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {j. j \<le> Suc n} = {j. j \<le> n} \<union> {Suc n}
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {j. j \<le> Suc n} \<subseteq> {j. j \<le> n} \<union> {Suc n}
 2. {j. j \<le> n} \<union> {Suc n} \<subseteq> {j. j \<le> Suc n}
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> {j. j \<le> Suc n} \<Longrightarrow> x \<in> {j. j \<le> n} \<union> {Suc n}
 2. {j. j \<le> n} \<union> {Suc n} \<subseteq> {j. j \<le> Suc n}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<le> Suc n \<Longrightarrow> x = Suc n \<or> x \<le> n
 2. {j. j \<le> n} \<union> {Suc n} \<subseteq> {j. j \<le> Suc n}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


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

goal (1 subgoal):
 1. \<And>v. v \<in> set A \<Longrightarrow> dim_vec v = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?v1 \<in> set A \<Longrightarrow> dim_vec ?v1 = n

goal (1 subgoal):
 1. \<And>f v. \<lbrakk>lincomb_list (\<lambda>i. f (A ! i)) A = 0\<^sub>v n; v \<in> set A\<rbrakk> \<Longrightarrow> f v = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?v1 \<in> set A \<Longrightarrow> dim_vec ?v1 = n
[PROOF STEP]
show "lincomb_list (\<lambda>i. f (A ! i)) A = 0\<^sub>v n \<Longrightarrow> v \<in> set A \<Longrightarrow> f v = 0"
[PROOF STATE]
proof (prove)
using this:
?v1 \<in> set A \<Longrightarrow> dim_vec ?v1 = n

goal (1 subgoal):
 1. \<lbrakk>lincomb_list (\<lambda>i. f (A ! i)) A = 0\<^sub>v n; v \<in> set A\<rbrakk> \<Longrightarrow> f v = (0::'a)
[PROOF STEP]
using  lincomb_list_as_mat_mult[of A "(\<lambda>i. f (A ! i))"] assms(3)[of f]
[PROOF STATE]
proof (prove)
using this:
?v1 \<in> set A \<Longrightarrow> dim_vec ?v1 = n
\<forall>w\<in>set A. dim_vec w = n \<Longrightarrow> lincomb_list (\<lambda>i. f (A ! i)) A = mat_of_cols n A *\<^sub>v vec (length A) (\<lambda>i. f (A ! i))
mat_of_cols n A *\<^sub>v vec (length A) (\<lambda>i. f (A ! i)) = 0\<^sub>v n \<Longrightarrow> \<forall>v\<in>set A. f v = (0::'a)

goal (1 subgoal):
 1. \<lbrakk>lincomb_list (\<lambda>i. f (A ! i)) A = 0\<^sub>v n; v \<in> set A\<rbrakk> \<Longrightarrow> f v = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>lincomb_list (\<lambda>i. f (A ! i)) A = 0\<^sub>v n; v \<in> set A\<rbrakk> \<Longrightarrow> f v = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_eq_between:
  fixes S1 S2 :: "'n::euclidean_space set"
  assumes "convex S1"
    and "convex S2"
  shows "closure S1 = closure S2 \<longleftrightarrow> rel_interior S1 \<le> S2 \<and> S2 \<subseteq> closure S1"
  (is "?A \<longleftrightarrow> ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (closure S1 = closure S2) = (rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. closure S1 = closure S2 \<Longrightarrow> rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1
 2. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1 \<Longrightarrow> closure S1 = closure S2
[PROOF STEP]
assume ?A
[PROOF STATE]
proof (state)
this:
closure S1 = closure S2

goal (2 subgoals):
 1. closure S1 = closure S2 \<Longrightarrow> rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1
 2. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1 \<Longrightarrow> closure S1 = closure S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
closure S1 = closure S2
[PROOF STEP]
show ?B
[PROOF STATE]
proof (prove)
using this:
closure S1 = closure S2

goal (1 subgoal):
 1. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1
[PROOF STEP]
by (metis assms closure_subset convex_rel_interior_closure rel_interior_subset)
[PROOF STATE]
proof (state)
this:
rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1

goal (1 subgoal):
 1. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1 \<Longrightarrow> closure S1 = closure S2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1 \<Longrightarrow> closure S1 = closure S2
[PROOF STEP]
assume ?B
[PROOF STATE]
proof (state)
this:
rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1

goal (1 subgoal):
 1. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1 \<Longrightarrow> closure S1 = closure S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1
[PROOF STEP]
have "closure S1 \<subseteq> closure S2"
[PROOF STATE]
proof (prove)
using this:
rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1

goal (1 subgoal):
 1. closure S1 \<subseteq> closure S2
[PROOF STEP]
by (metis assms(1) convex_closure_rel_interior closure_mono)
[PROOF STATE]
proof (state)
this:
closure S1 \<subseteq> closure S2

goal (1 subgoal):
 1. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1 \<Longrightarrow> closure S1 = closure S2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
closure S1 \<subseteq> closure S2

goal (1 subgoal):
 1. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1 \<Longrightarrow> closure S1 = closure S2
[PROOF STEP]
from \<open>?B\<close>
[PROOF STATE]
proof (chain)
picking this:
rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1
[PROOF STEP]
have "closure S1 \<supseteq> closure S2"
[PROOF STATE]
proof (prove)
using this:
rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1

goal (1 subgoal):
 1. closure S2 \<subseteq> closure S1
[PROOF STEP]
by (metis closed_closure closure_minimal)
[PROOF STATE]
proof (state)
this:
closure S2 \<subseteq> closure S1

goal (1 subgoal):
 1. rel_interior S1 \<subseteq> S2 \<and> S2 \<subseteq> closure S1 \<Longrightarrow> closure S1 = closure S2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
closure S1 \<subseteq> closure S2
closure S2 \<subseteq> closure S1
[PROOF STEP]
show ?A
[PROOF STATE]
proof (prove)
using this:
closure S1 \<subseteq> closure S2
closure S2 \<subseteq> closure S1

goal (1 subgoal):
 1. closure S1 = closure S2
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
closure S1 = closure S2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aff_dim_affine_independent:
  fixes B :: "'n::euclidean_space set"
  assumes "\<not> affine_dependent B"
  shows "of_nat (card B) = aff_dim B + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (card B) = aff_dim B + 1
[PROOF STEP]
using aff_dim_unique[of B B] assms
[PROOF STATE]
proof (prove)
using this:
affine hull B = affine hull B \<and> \<not> affine_dependent B \<Longrightarrow> int (card B) = aff_dim B + 1
\<not> affine_dependent B

goal (1 subgoal):
 1. int (card B) = aff_dim B + 1
[PROOF STEP]
by auto


[STATEMENT]
lemma eventually_conjE: "eventually (\<lambda>x. P x \<and> Q x) F \<Longrightarrow> (eventually P F \<Longrightarrow> eventually Q F \<Longrightarrow> R) \<Longrightarrow> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in F. P x \<and> Q x; \<lbrakk>eventually P F; eventually Q F\<rbrakk> \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R
[PROOF STEP]
apply (frule eventually_rev_mp[of _ _ P], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in F. P x \<and> Q x; \<lbrakk>eventually P F; eventually Q F\<rbrakk> \<Longrightarrow> R; eventually P F\<rbrakk> \<Longrightarrow> R
[PROOF STEP]
apply (drule eventually_rev_mp[of _ _ Q], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>eventually P F; eventually Q F\<rbrakk> \<Longrightarrow> R; eventually P F; eventually Q F\<rbrakk> \<Longrightarrow> R
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lm041:
  assumes "a \<in> allAllocations N G" "aa \<in> allAllocations N G" "finite G"
  shows  "(card (pseudoAllocation aa \<inter> (pseudoAllocation a)) = card (pseudoAllocation a)) =
          (pseudoAllocation a = pseudoAllocation aa)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
let ?P=pseudoAllocation
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
let ?c=card
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
let ?A="?P a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
let ?AA="?P aa"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
have "?c ?A=?c G & ?c ?AA=?c G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (pseudoAllocation a) = card G \<and> card (pseudoAllocation aa) = card G
[PROOF STEP]
using assms lm034
[PROOF STATE]
proof (prove)
using this:
a \<in> allAllocations N G
aa \<in> allAllocations N G
finite G
\<lbrakk>?a \<in> allAllocations ?N ?G; finite ?G\<rbrakk> \<Longrightarrow> card (pseudoAllocation ?a) = card ?G

goal (1 subgoal):
 1. card (pseudoAllocation a) = card G \<and> card (pseudoAllocation aa) = card G
[PROOF STEP]
by (metis (lifting, mono_tags))
[PROOF STATE]
proof (state)
this:
card (pseudoAllocation a) = card G \<and> card (pseudoAllocation aa) = card G

goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (pseudoAllocation a) = card G \<and> card (pseudoAllocation aa) = card G

goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
have "finite ?A & finite ?AA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (pseudoAllocation a) \<and> finite (pseudoAllocation aa)
[PROOF STEP]
using assms lm040
[PROOF STATE]
proof (prove)
using this:
a \<in> allAllocations N G
aa \<in> allAllocations N G
finite G
\<lbrakk>?a \<in> allAllocations ?N ?G; finite ?G\<rbrakk> \<Longrightarrow> finite (pseudoAllocation ?a)

goal (1 subgoal):
 1. finite (pseudoAllocation a) \<and> finite (pseudoAllocation aa)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (pseudoAllocation a) \<and> finite (pseudoAllocation aa)

goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (pseudoAllocation a) = card G \<and> card (pseudoAllocation aa) = card G
finite (pseudoAllocation a) \<and> finite (pseudoAllocation aa)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (pseudoAllocation a) = card G \<and> card (pseudoAllocation aa) = card G
finite (pseudoAllocation a) \<and> finite (pseudoAllocation aa)

goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
using assms cardinalityIntersectionEquality
[PROOF STATE]
proof (prove)
using this:
card (pseudoAllocation a) = card G \<and> card (pseudoAllocation aa) = card G
finite (pseudoAllocation a) \<and> finite (pseudoAllocation aa)
a \<in> allAllocations N G
aa \<in> allAllocations N G
finite G
\<lbrakk>finite ?X; finite ?Y; card ?X = card ?Y\<rbrakk> \<Longrightarrow> (card (?X \<inter> ?Y) = card ?X) = (?X = ?Y)

goal (1 subgoal):
 1. (card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)
[PROOF STEP]
by (metis(no_types,lifting))
[PROOF STATE]
proof (state)
this:
(card (pseudoAllocation aa \<inter> pseudoAllocation a) = card (pseudoAllocation a)) = (pseudoAllocation a = pseudoAllocation aa)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_m_prod_mset_le: "degree_m (prod_mset fs) \<le> sum_mset (image_mset degree_m fs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs)
[PROOF STEP]
proof (induct fs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree_m (\<Prod>\<^sub># {#}) \<le> \<Sum>\<^sub># (image_mset degree_m {#})
 2. \<And>x fs. degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs) \<Longrightarrow> degree_m (\<Prod>\<^sub># (add_mset x fs)) \<le> \<Sum>\<^sub># (image_mset degree_m (add_mset x fs))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. degree_m (\<Prod>\<^sub># {#}) \<le> \<Sum>\<^sub># (image_mset degree_m {#})
 2. \<And>x fs. degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs) \<Longrightarrow> degree_m (\<Prod>\<^sub># (add_mset x fs)) \<le> \<Sum>\<^sub># (image_mset degree_m (add_mset x fs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree_m (\<Prod>\<^sub># {#}) \<le> \<Sum>\<^sub># (image_mset degree_m {#})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree_m (\<Prod>\<^sub># {#}) \<le> \<Sum>\<^sub># (image_mset degree_m {#})

goal (1 subgoal):
 1. \<And>x fs. degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs) \<Longrightarrow> degree_m (\<Prod>\<^sub># (add_mset x fs)) \<le> \<Sum>\<^sub># (image_mset degree_m (add_mset x fs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x fs. degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs) \<Longrightarrow> degree_m (\<Prod>\<^sub># (add_mset x fs)) \<le> \<Sum>\<^sub># (image_mset degree_m (add_mset x fs))
[PROOF STEP]
case (add f fs)
[PROOF STATE]
proof (state)
this:
degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs)

goal (1 subgoal):
 1. \<And>x fs. degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs) \<Longrightarrow> degree_m (\<Prod>\<^sub># (add_mset x fs)) \<le> \<Sum>\<^sub># (image_mset degree_m (add_mset x fs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs)

goal (1 subgoal):
 1. degree_m (\<Prod>\<^sub># (add_mset f fs)) \<le> \<Sum>\<^sub># (image_mset degree_m (add_mset f fs))
[PROOF STEP]
using degree_m_mult_le[of f "prod_mset fs"]
[PROOF STATE]
proof (prove)
using this:
degree_m (\<Prod>\<^sub># fs) \<le> \<Sum>\<^sub># (image_mset degree_m fs)
degree_m (f * \<Prod>\<^sub># fs) \<le> degree_m f + degree_m (\<Prod>\<^sub># fs)

goal (1 subgoal):
 1. degree_m (\<Prod>\<^sub># (add_mset f fs)) \<le> \<Sum>\<^sub># (image_mset degree_m (add_mset f fs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree_m (\<Prod>\<^sub># (add_mset f fs)) \<le> \<Sum>\<^sub># (image_mset degree_m (add_mset f fs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_times_has_integral:
  "((\<lambda>t. exp (c * t)) has_integral (if c = 0 then t else exp (c * t) / c) - (if c = 0 then t0 else exp (c * t0) / c)) {t0 .. t}"
  if "t0 \<le> t"
  for c t::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. exp (c * t)) has_integral (if c = 0 then t else exp (c * t) / c) - (if c = 0 then t0 else exp (c * t0) / c)) {t0..t}
[PROOF STEP]
apply (cases "c = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>t. exp (c * t)) has_integral (if c = 0 then t else exp (c * t) / c) - (if c = 0 then t0 else exp (c * t0) / c)) {t0..t}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>t. exp (c * t)) has_integral (if c = 0 then t else exp (c * t) / c) - (if c = 0 then t0 else exp (c * t0) / c)) {t0..t}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c = 0 \<Longrightarrow> ((\<lambda>t. exp (c * t)) has_integral (if c = 0 then t else exp (c * t) / c) - (if c = 0 then t0 else exp (c * t0) / c)) {t0..t}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
t0 \<le> t

goal (1 subgoal):
 1. c = 0 \<Longrightarrow> ((\<lambda>t. exp (c * t)) has_integral (if c = 0 then t else exp (c * t) / c) - (if c = 0 then t0 else exp (c * t0) / c)) {t0..t}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c = 0; t0 \<le> t\<rbrakk> \<Longrightarrow> ((\<lambda>t. 1) has_integral t - t0) {t0..t}
[PROOF STEP]
apply (rule has_integral_eq_rhs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>c = 0; t0 \<le> t\<rbrakk> \<Longrightarrow> ((\<lambda>t. 1) has_integral ?j2) {t0..t}
 2. \<lbrakk>c = 0; t0 \<le> t\<rbrakk> \<Longrightarrow> t - t0 = ?j2
[PROOF STEP]
apply (rule has_integral_const_real)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c = 0; t0 \<le> t\<rbrakk> \<Longrightarrow> t - t0 = content {t0..t} *\<^sub>R 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> ((\<lambda>t. exp (c * t)) has_integral (if c = 0 then t else exp (c * t) / c) - (if c = 0 then t0 else exp (c * t0) / c)) {t0..t}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> ((\<lambda>t. exp (c * t)) has_integral (if c = 0 then t else exp (c * t) / c) - (if c = 0 then t0 else exp (c * t0) / c)) {t0..t}
[PROOF STEP]
apply (rule fundamental_theorem_of_calculus)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<noteq> 0 \<Longrightarrow> t0 \<le> t
 2. \<And>x. \<lbrakk>c \<noteq> 0; x \<in> {t0..t}\<rbrakk> \<Longrightarrow> ((\<lambda>a. if c = 0 then a else exp (c * a) / c) has_vector_derivative exp (c * x)) (at x within {t0..t})
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
t0 \<le> t

goal (2 subgoals):
 1. c \<noteq> 0 \<Longrightarrow> t0 \<le> t
 2. \<And>x. \<lbrakk>c \<noteq> 0; x \<in> {t0..t}\<rbrakk> \<Longrightarrow> ((\<lambda>a. if c = 0 then a else exp (c * a) / c) has_vector_derivative exp (c * x)) (at x within {t0..t})
[PROOF STEP]
by (auto simp: has_vector_derivative_def intro!: derivative_eq_intros)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nat_to_mset_Suc: "nat_to_mset i (Suc n) = add_mset i (nat_to_mset i n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_mset i (Suc n) = add_mset i (nat_to_mset i n)
[PROOF STEP]
using nat_to_mset_add[of i n 1]
[PROOF STATE]
proof (prove)
using this:
nat_to_mset i (n + 1) = nat_to_mset i n + nat_to_mset i 1

goal (1 subgoal):
 1. nat_to_mset i (Suc n) = add_mset i (nat_to_mset i n)
[PROOF STEP]
by (simp add: multiset_eqI nat_to_msetE nat_to_msetE')


[STATEMENT]
lemma islimpt_range_imp_convergent_subsequence:
  fixes l :: "'a :: {t1_space, first_countable_topology}"
  assumes l: "l islimpt (range f)"
  shows "\<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
using l
[PROOF STATE]
proof (prove)
using this:
l islimpt range f

goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
unfolding islimpt_eq_acc_point
[PROOF STATE]
proof (prove)
using this:
\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> range f)

goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
by (rule acc_point_range_imp_convergent_subsequence)


[STATEMENT]
theorem c_unfold_len: "ALL u. length (c_unfold k u) = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u. length (c_unfold k u) = k
[PROOF STEP]
apply(induct k)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>u. length (c_unfold 0 u) = 0
 2. \<And>k. \<forall>u. length (c_unfold k u) = k \<Longrightarrow> \<forall>u. length (c_unfold (Suc k) u) = Suc k
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<forall>u. length (c_unfold k u) = k \<Longrightarrow> \<forall>u. length (c_unfold (Suc k) u) = Suc k
[PROOF STEP]
apply(subgoal_tac "n=(0::nat) \<or> n>0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k. \<lbrakk>\<forall>u. length (c_unfold k u) = k; n = 0 \<or> 0 < n\<rbrakk> \<Longrightarrow> \<forall>u. length (c_unfold (Suc k) u) = Suc k
 2. \<And>k. \<forall>u. length (c_unfold k u) = k \<Longrightarrow> n = 0 \<or> 0 < n
[PROOF STEP]
apply(drule disjE)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>k. \<lbrakk>\<forall>u. length (c_unfold k u) = k; n = 0\<rbrakk> \<Longrightarrow> ?R3 k
 2. \<And>k. \<lbrakk>\<forall>u. length (c_unfold k u) = k; 0 < n\<rbrakk> \<Longrightarrow> ?R3 k
 3. \<And>k. \<lbrakk>\<forall>u. length (c_unfold k u) = k; ?R3 k\<rbrakk> \<Longrightarrow> \<forall>u. length (c_unfold (Suc k) u) = Suc k
 4. \<And>k. \<forall>u. length (c_unfold k u) = k \<Longrightarrow> n = 0 \<or> 0 < n
[PROOF STEP]
prefer 3
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>k. \<lbrakk>\<forall>u. length (c_unfold k u) = k; ?R3 k\<rbrakk> \<Longrightarrow> \<forall>u. length (c_unfold (Suc k) u) = Suc k
 2. \<And>k. \<lbrakk>\<forall>u. length (c_unfold k u) = k; n = 0\<rbrakk> \<Longrightarrow> ?R3 k
 3. \<And>k. \<lbrakk>\<forall>u. length (c_unfold k u) = k; 0 < n\<rbrakk> \<Longrightarrow> ?R3 k
 4. \<And>k. \<forall>u. length (c_unfold k u) = k \<Longrightarrow> n = 0 \<or> 0 < n
[PROOF STEP]
apply(simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<forall>u. length (c_unfold k u) = k \<Longrightarrow> n = 0 \<or> 0 < n
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dvd_iff_poly_eq_0: "[:c, 1:] dvd p \<longleftrightarrow> poly p (- c) = 0"
  for c :: "'a::comm_ring_1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([:c, 1::'a:] dvd p) = (poly p (- c) = (0::'a))
[PROOF STEP]
by (simp add: poly_eq_0_iff_dvd)


[STATEMENT]
lemma tendsto_norm_zero_iff: "((\<lambda>x. norm (f x)) \<longlongrightarrow> 0) F \<longleftrightarrow> (f \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. norm (f x)) \<longlongrightarrow> 0) F = (f \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
unfolding tendsto_iff dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<forall>\<^sub>F x in F. norm (norm (f x) - 0) < e) = (\<forall>e>0. \<forall>\<^sub>F x in F. norm (f x - (0::'b)) < e)
[PROOF STEP]
by simp


[STATEMENT]
lemma minVertex_zero2: "minVertex (Face (rev [0..<Suc z]) Nonfinal) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. minVertex (Face (rev [0..<Suc z]) Nonfinal) = 0
[PROOF STEP]
apply (induct z)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. minVertex (Face (rev [0..<Suc 0]) Nonfinal) = 0
 2. \<And>z. minVertex (Face (rev [0..<Suc z]) Nonfinal) = 0 \<Longrightarrow> minVertex (Face (rev [0..<Suc (Suc z)]) Nonfinal) = 0
[PROOF STEP]
apply (simp add: minVertex_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. minVertex (Face (rev [0..<Suc z]) Nonfinal) = 0 \<Longrightarrow> minVertex (Face (rev [0..<Suc (Suc z)]) Nonfinal) = 0
[PROOF STEP]
by (simp add: minVertex_def min_def)


[STATEMENT]
lemma convergent_minus_iff:
  fixes X :: "nat \<Rightarrow> 'a::topological_group_add"
  shows "convergent X \<longleftrightarrow> convergent (\<lambda>n. - X n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent X = convergent (\<lambda>n. - X n)
[PROOF STEP]
unfolding convergent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>L. X \<longlonglongrightarrow> L) = (\<exists>L. (\<lambda>n. - X n) \<longlonglongrightarrow> L)
[PROOF STEP]
by (force dest: tendsto_minus)


[STATEMENT]
lemma  cross_eq_self: "x \<times> y = x \<longleftrightarrow> x = 0" "x \<times> y = y \<longleftrightarrow> y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<times> y = x) = (x = 0) &&& (x \<times> y = y) = (y = 0)
[PROOF STEP]
apply (metis cross_zero_left dot_cross_self(1) inner_eq_zero_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<times> y = y) = (y = 0)
[PROOF STEP]
by (metis cross_zero_right dot_cross_self(2) inner_eq_zero_iff)