[STATEMENT]
lemma list_eq_iff_zip_eq:
  "xs = ys \<longleftrightarrow> length xs = length ys \<and> (\<forall>(x,y) \<in> set (zip xs ys). x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs = ys) = (length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). x = y))
[PROOF STEP]
by(auto simp add: set_zip list_all2_eq list_all2_conv_all_nth cong: conj_cong)


[STATEMENT]
lemma col_mult[simp]: assumes m: "A \<in> carrier_mat nr n" "B \<in> carrier_mat n nc"
  and j: "j < nc"
  shows "col (A * B) j = vec nr (\<lambda> i. row A i \<bullet> col B j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (A * B) j = vec nr (\<lambda>i. row A i \<bullet> col B j)
[PROOF STEP]
by (rule eq_vecI, insert m j, auto)


[STATEMENT]
lemma fps_inverse_one_minus_fps_X:
  fixes   ones :: "'a :: division_ring fps"
  defines "ones \<equiv> Abs_fps (\<lambda>n. 1)"
  shows   "inverse (1 - fps_X) = ones"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (1 - fps_X) = ones
[PROOF STEP]
by      (simp add: fps_inverse_def assms fps_lr_inverse_one_minus_fps_X(2))


[STATEMENT]
lemma take_bit_numeral_numeral:
  \<open>take_bit (numeral m) (numeral n) =
    (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> numeral q)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral m) (numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0::'a | Some q \<Rightarrow> numeral q)
[PROOF STEP]
by (auto split: option.split dest: take_bit_num_eq_None_imp take_bit_num_eq_Some_imp)


[STATEMENT]
lemma reflP_R2P[simp]: "reflP (S2P A) (R2P r) \<longleftrightarrow> refl_on A r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflP (S2P A) (R2P r) = refl_on A r
[PROOF STEP]
unfolding reflP_def refl_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>x y. R2P r x y \<or> R2P r y x \<longrightarrow> S2P A x) \<and> (\<forall>x. S2P A x \<longrightarrow> R2P r x x)) = (r \<subseteq> A \<times> A \<and> (\<forall>x\<in>A. (x, x) \<in> r))
[PROOF STEP]
by auto


[STATEMENT]
lemma n_gt: assumes "2 \<le> i" "i < k"
  shows "n i > n (Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (Suc i) < n i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n (Suc i) < n i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
2 \<le> i
i < k
[PROOF STEP]
have "3 \<le> Suc i" "Suc i \<le> Suc k"
[PROOF STATE]
proof (prove)
using this:
2 \<le> i
i < k

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

goal (1 subgoal):
 1. n (Suc i) < n i
[PROOF STEP]
note pmod = pmod[OF this]
[PROOF STATE]
proof (state)
this:
Polynomial.smult (\<beta> (Suc i)) (F (Suc i)) = pseudo_mod (F (Suc i - 2)) (F (Suc i - 1))

goal (1 subgoal):
 1. n (Suc i) < n i
[PROOF STEP]
from assms F0
[PROOF STATE]
proof (chain)
picking this:
2 \<le> i
i < k
?i \<noteq> 0 \<Longrightarrow> (F ?i = 0) = (k < ?i)
[PROOF STEP]
have "F (Suc i - 1) \<noteq> 0" "F (Suc i) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
2 \<le> i
i < k
?i \<noteq> 0 \<Longrightarrow> (F ?i = 0) = (k < ?i)

goal (1 subgoal):
 1. F (Suc i - 1) \<noteq> 0 &&& F (Suc i) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
F (Suc i - 1) \<noteq> 0
F (Suc i) \<noteq> 0

goal (1 subgoal):
 1. n (Suc i) < n i
[PROOF STEP]
from pseudo_mod(2)[OF this(1), of "F (Suc i - 2)", folded pmod] this(2)
[PROOF STATE]
proof (chain)
picking this:
Polynomial.smult (\<beta> (Suc i)) (F (Suc i)) = 0 \<or> degree (Polynomial.smult (\<beta> (Suc i)) (F (Suc i))) < degree (F (Suc i - 1))
F (Suc i) \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult (\<beta> (Suc i)) (F (Suc i)) = 0 \<or> degree (Polynomial.smult (\<beta> (Suc i)) (F (Suc i))) < degree (F (Suc i - 1))
F (Suc i) \<noteq> 0

goal (1 subgoal):
 1. n (Suc i) < n i
[PROOF STEP]
unfolding n
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult (\<beta> (Suc i)) (F (Suc i)) = 0 \<or> degree (Polynomial.smult (\<beta> (Suc i)) (F (Suc i))) < degree (F (Suc i - 1))
F (Suc i) \<noteq> 0

goal (1 subgoal):
 1. degree (F (Suc i)) < degree (F i)
[PROOF STEP]
using \<beta>0
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult (\<beta> (Suc i)) (F (Suc i)) = 0 \<or> degree (Polynomial.smult (\<beta> (Suc i)) (F (Suc i))) < degree (F (Suc i - 1))
F (Suc i) \<noteq> 0
\<beta> ?i \<noteq> (0::'a)

goal (1 subgoal):
 1. degree (F (Suc i)) < degree (F i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n (Suc i) < n i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ucast_minus:
  fixes a b :: "'a::len word"
  assumes "LENGTH('a) > LENGTH('b)"
  shows "(ucast (a - b) ::'b::len word) = (ucast a - ucast b::'b::len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ucast (a - b) = ucast a - ucast b
[PROOF STEP]
using ucast_plus[OF assms,of a "-b"] ucast_uminus[OF assms,of b]
[PROOF STATE]
proof (prove)
using this:
ucast (a + - b) = ucast a + ucast (- b)
ucast (- b) = - ucast b

goal (1 subgoal):
 1. ucast (a - b) = ucast a - ucast b
[PROOF STEP]
by auto


[STATEMENT]
lemma hrabs_hyperpow_minus [simp]: "\<And>(a::'a::linordered_idom star) n. \<bar>(-a) pow n\<bar> = \<bar>a pow n\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a n. \<bar>(- a) pow n\<bar> = \<bar>a pow n\<bar>
[PROOF STEP]
by transfer (rule abs_power_minus)


[STATEMENT]
lemma height_node44:
  "height n > 0 \<Longrightarrow> height(node44 l a m b n c r) =
   max (height l) (max (height m) (max (height n) (height r))) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height n \<Longrightarrow> height (node44 l a m b n c r) = max (height l) (max (height m) (max (height n) (height r))) + 1
[PROOF STEP]
by(induct l a m b n c r rule: node44.induct)(simp_all add: max_def)


[STATEMENT]
lemma continuous_on_cross:
  fixes f :: "'a::t2_space \<Rightarrow> real^7"
  shows "\<lbrakk>continuous_on S f; continuous_on S g\<rbrakk> \<Longrightarrow> continuous_on S (\<lambda>x. f x \<times>\<^sub>7 g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on S f; continuous_on S g\<rbrakk> \<Longrightarrow> continuous_on S (\<lambda>x. f x \<times>\<^sub>7 g x)
[PROOF STEP]
by (simp add: continuous_on_eq_continuous_within continuous_cross7)


[STATEMENT]
lemma (in vec_space) lin_indpt_full_rank:
assumes "A \<in> carrier_mat n nc"
assumes "distinct (cols A)"
assumes "lin_indpt (set (cols A))"
shows "rank A = nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = nc
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank A = nc
[PROOF STEP]
have "maximal (set (cols A)) (\<lambda>T. T \<subseteq> set (cols A) \<and> lin_indpt T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. maximal (set (cols A)) (\<lambda>T. T \<subseteq> set (cols A) \<and> lin_indpt T)
[PROOF STEP]
by (simp add: assms(3) maximal_def subset_antisym)
[PROOF STATE]
proof (state)
this:
maximal (set (cols A)) (\<lambda>T. T \<subseteq> set (cols A) \<and> lin_indpt T)

goal (1 subgoal):
 1. rank A = nc
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
maximal (set (cols A)) (\<lambda>T. T \<subseteq> set (cols A) \<and> lin_indpt T)
[PROOF STEP]
have "rank A = card (set (cols A))"
[PROOF STATE]
proof (prove)
using this:
maximal (set (cols A)) (\<lambda>T. T \<subseteq> set (cols A) \<and> lin_indpt T)

goal (1 subgoal):
 1. rank A = card (set (cols A))
[PROOF STEP]
using assms(1) vec_space.rank_card_indpt
[PROOF STATE]
proof (prove)
using this:
maximal (set (cols A)) (\<lambda>T. T \<subseteq> set (cols A) \<and> lin_indpt T)
A \<in> carrier_mat n nc
\<lbrakk>?A \<in> carrier_mat ?n ?nc; maximal ?S (\<lambda>T. T \<subseteq> set (cols ?A) \<and> \<not> module.lin_dep class_ring (module_vec TYPE(?'a) ?n) T)\<rbrakk> \<Longrightarrow> vec_space.rank ?n ?A = card ?S

goal (1 subgoal):
 1. rank A = card (set (cols A))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
rank A = card (set (cols A))

goal (1 subgoal):
 1. rank A = nc
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rank A = card (set (cols A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rank A = card (set (cols A))

goal (1 subgoal):
 1. rank A = nc
[PROOF STEP]
using assms(1) assms(2) distinct_card
[PROOF STATE]
proof (prove)
using this:
rank A = card (set (cols A))
A \<in> carrier_mat n nc
distinct (cols A)
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs

goal (1 subgoal):
 1. rank A = nc
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
rank A = nc

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_summable_on_subset:
  assumes "f abs_summable_on B" and "A \<subseteq> B"
  shows   "f abs_summable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f abs_summable_on A
[PROOF STEP]
unfolding abs_summable_on_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable (count_space UNIV) A f
[PROOF STEP]
by (rule set_integrable_subset) (insert assms, auto simp: abs_summable_on_altdef)


[STATEMENT]
lemma Amicable_Example_Fermat:
  shows  "17296 Amic 18416"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have a: "(4::nat)>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < 4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < 4

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have b: "prime((3::nat)*(2^(4-1))-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (3 * 2 ^ (4 - 1) - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime (3 * 2 ^ (4 - 1) - 1)

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have c: "prime((3::nat)*(2^4)-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (3 * 2 ^ 4 - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime (3 * 2 ^ 4 - 1)

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have d: "prime (1151::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime 1151
[PROOF STEP]
by (pratt (code))
[PROOF STATE]
proof (state)
this:
prime 1151

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have e: "(1151::nat) = 9*(2^(2*4-1))-1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1151 = 9 * 2 ^ (2 * 4 - 1) - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1151 = 9 * 2 ^ (2 * 4 - 1) - 1

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have f: "prime((9::nat)*(2^(2*4-1))-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (9 * 2 ^ (2 * 4 - 1) - 1)
[PROOF STEP]
using d e
[PROOF STATE]
proof (prove)
using this:
prime 1151
1151 = 9 * 2 ^ (2 * 4 - 1) - 1

goal (1 subgoal):
 1. prime (9 * 2 ^ (2 * 4 - 1) - 1)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
prime (9 * 2 ^ (2 * 4 - 1) - 1)

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have g: "((2^4)*(3*(2^(4-1))-1)*(3*(2^4)-1)) Amic((2^4)*(9*(2^(2*4-1))-1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ 4 * (3 * 2 ^ (4 - 1) - 1) * (3 * 2 ^ 4 - 1)) Amic (2 ^ 4 * (9 * 2 ^ (2 * 4 - 1) - 1))
[PROOF STEP]
using  Thabit_ibn_Qurra_Rule_Amicable a b c f
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < ?k; prime ?p; prime ?q; prime ?r; ?p = 2 ^ (?k - 1) * 3 - 1; ?q = 2 ^ ?k * 3 - 1; ?r = 2 ^ (2 * ?k - 1) * 9 - 1\<rbrakk> \<Longrightarrow> (2 ^ ?k * ?p * ?q) Amic (2 ^ ?k * ?r)
1 < 4
prime (3 * 2 ^ (4 - 1) - 1)
prime (3 * 2 ^ 4 - 1)
prime (9 * 2 ^ (2 * 4 - 1) - 1)

goal (1 subgoal):
 1. (2 ^ 4 * (3 * 2 ^ (4 - 1) - 1) * (3 * 2 ^ 4 - 1)) Amic (2 ^ 4 * (9 * 2 ^ (2 * 4 - 1) - 1))
[PROOF STEP]
by (metis mult.commute)
[PROOF STATE]
proof (state)
this:
(2 ^ 4 * (3 * 2 ^ (4 - 1) - 1) * (3 * 2 ^ 4 - 1)) Amic (2 ^ 4 * (9 * 2 ^ (2 * 4 - 1) - 1))

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have h: "((2::nat)^4)*23*47 = 17296"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ 4 * 23 * 47 = 17296
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ 4 * 23 * 47 = 17296

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
have i: "(((2::nat)^4)*1151) = 18416"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ 4 * 1151 = 18416
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ 4 * 1151 = 18416

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
using g h i
[PROOF STATE]
proof (prove)
using this:
(2 ^ 4 * (3 * 2 ^ (4 - 1) - 1) * (3 * 2 ^ 4 - 1)) Amic (2 ^ 4 * (9 * 2 ^ (2 * 4 - 1) - 1))
2 ^ 4 * 23 * 47 = 17296
2 ^ 4 * 1151 = 18416

goal (1 subgoal):
 1. 17296 Amic 18416
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
17296 Amic 18416

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_rel_frontier_aff_dim:
  fixes S1 S2 :: "'n::euclidean_space set"
  assumes "convex S1"
    and "convex S2"
    and "S2 \<noteq> {}"
    and "S1 \<le> rel_frontier S2"
  shows "aff_dim S1 < aff_dim S2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
have "S1 \<subseteq> closure S2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S1 \<subseteq> closure S2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convex S1
convex S2
S2 \<noteq> {}
S1 \<subseteq> rel_frontier S2

goal (1 subgoal):
 1. S1 \<subseteq> closure S2
[PROOF STEP]
unfolding rel_frontier_def
[PROOF STATE]
proof (prove)
using this:
convex S1
convex S2
S2 \<noteq> {}
S1 \<subseteq> closure S2 - rel_interior S2

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

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S1 \<subseteq> closure S2
[PROOF STEP]
have *: "affine hull S1 \<subseteq> affine hull S2"
[PROOF STATE]
proof (prove)
using this:
S1 \<subseteq> closure S2

goal (1 subgoal):
 1. affine hull S1 \<subseteq> affine hull S2
[PROOF STEP]
using hull_mono[of "S1" "closure S2"] closure_same_affine_hull[of S2]
[PROOF STATE]
proof (prove)
using this:
S1 \<subseteq> closure S2
S1 \<subseteq> closure S2 \<Longrightarrow> ?S hull S1 \<subseteq> ?S hull closure S2
affine hull closure S2 = affine hull S2

goal (1 subgoal):
 1. affine hull S1 \<subseteq> affine hull S2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
affine hull S1 \<subseteq> affine hull S2

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
affine hull S1 \<subseteq> affine hull S2
[PROOF STEP]
have "aff_dim S1 \<le> aff_dim S2"
[PROOF STATE]
proof (prove)
using this:
affine hull S1 \<subseteq> affine hull S2

goal (1 subgoal):
 1. aff_dim S1 \<le> aff_dim S2
[PROOF STEP]
using * aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2]
      aff_dim_subset[of "affine hull S1" "affine hull S2"]
[PROOF STATE]
proof (prove)
using this:
affine hull S1 \<subseteq> affine hull S2
affine hull S1 \<subseteq> affine hull S2
aff_dim (affine hull S1) = aff_dim S1
aff_dim (affine hull S2) = aff_dim S2
affine hull S1 \<subseteq> affine hull S2 \<Longrightarrow> aff_dim (affine hull S1) \<le> aff_dim (affine hull S2)

goal (1 subgoal):
 1. aff_dim S1 \<le> aff_dim S2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aff_dim S1 \<le> aff_dim S2

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
aff_dim S1 \<le> aff_dim S2

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
aff_dim S1 \<le> aff_dim S2

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
assume eq: "aff_dim S1 = aff_dim S2"
[PROOF STATE]
proof (state)
this:
aff_dim S1 = aff_dim S2

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim S1 = aff_dim S2
[PROOF STEP]
have "S1 \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
aff_dim S1 = aff_dim S2

goal (1 subgoal):
 1. S1 \<noteq> {}
[PROOF STEP]
using aff_dim_empty[of S1] aff_dim_empty[of S2] \<open>S2 \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
aff_dim S1 = aff_dim S2
(S1 = {}) = (aff_dim S1 = - 1)
(S2 = {}) = (aff_dim S2 = - 1)
S2 \<noteq> {}

goal (1 subgoal):
 1. S1 \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S1 \<noteq> {}

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
have **: "affine hull S1 = affine hull S2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull S1 = affine hull S2
[PROOF STEP]
by (simp_all add: * eq \<open>S1 \<noteq> {}\<close> affine_dim_equal)
[PROOF STATE]
proof (state)
this:
affine hull S1 = affine hull S2

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
obtain a where a: "a \<in> rel_interior S1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a \<in> rel_interior S1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>S1 \<noteq> {}\<close> rel_interior_eq_empty assms
[PROOF STATE]
proof (prove)
using this:
S1 \<noteq> {}
convex ?S \<Longrightarrow> (rel_interior ?S = {}) = (?S = {})
convex S1
convex S2
S2 \<noteq> {}
S1 \<subseteq> rel_frontier S2

goal (1 subgoal):
 1. (\<And>a. a \<in> rel_interior S1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> rel_interior S1

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
obtain T where T: "open T" "a \<in> T \<inter> S1" "T \<inter> affine hull S1 \<subseteq> S1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>T. \<lbrakk>open T; a \<in> T \<inter> S1; T \<inter> affine hull S1 \<subseteq> S1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using mem_rel_interior[of a S1] a
[PROOF STATE]
proof (prove)
using this:
(a \<in> rel_interior S1) = (\<exists>T. open T \<and> a \<in> T \<inter> S1 \<and> T \<inter> affine hull S1 \<subseteq> S1)
a \<in> rel_interior S1

goal (1 subgoal):
 1. (\<And>T. \<lbrakk>open T; a \<in> T \<inter> S1; T \<inter> affine hull S1 \<subseteq> S1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
open T
a \<in> T \<inter> S1
T \<inter> affine hull S1 \<subseteq> S1

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open T
a \<in> T \<inter> S1
T \<inter> affine hull S1 \<subseteq> S1
[PROOF STEP]
have "a \<in> T \<inter> closure S2"
[PROOF STATE]
proof (prove)
using this:
open T
a \<in> T \<inter> S1
T \<inter> affine hull S1 \<subseteq> S1

goal (1 subgoal):
 1. a \<in> T \<inter> closure S2
[PROOF STEP]
using a assms
[PROOF STATE]
proof (prove)
using this:
open T
a \<in> T \<inter> S1
T \<inter> affine hull S1 \<subseteq> S1
a \<in> rel_interior S1
convex S1
convex S2
S2 \<noteq> {}
S1 \<subseteq> rel_frontier S2

goal (1 subgoal):
 1. a \<in> T \<inter> closure S2
[PROOF STEP]
unfolding rel_frontier_def
[PROOF STATE]
proof (prove)
using this:
open T
a \<in> T \<inter> S1
T \<inter> affine hull S1 \<subseteq> S1
a \<in> rel_interior S1
convex S1
convex S2
S2 \<noteq> {}
S1 \<subseteq> closure S2 - rel_interior S2

goal (1 subgoal):
 1. a \<in> T \<inter> closure S2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> T \<inter> closure S2

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> T \<inter> closure S2
[PROOF STEP]
obtain b where b: "b \<in> T \<inter> rel_interior S2"
[PROOF STATE]
proof (prove)
using this:
a \<in> T \<inter> closure S2

goal (1 subgoal):
 1. (\<And>b. b \<in> T \<inter> rel_interior S2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using open_inter_closure_rel_interior[of S2 T] assms T
[PROOF STATE]
proof (prove)
using this:
a \<in> T \<inter> closure S2
\<lbrakk>convex S2; open T\<rbrakk> \<Longrightarrow> (T \<inter> closure S2 = {}) = (T \<inter> rel_interior S2 = {})
convex S1
convex S2
S2 \<noteq> {}
S1 \<subseteq> rel_frontier S2
open T
a \<in> T \<inter> S1
T \<inter> affine hull S1 \<subseteq> S1

goal (1 subgoal):
 1. (\<And>b. b \<in> T \<inter> rel_interior S2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> T \<inter> rel_interior S2

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> T \<inter> rel_interior S2
[PROOF STEP]
have "b \<in> affine hull S1"
[PROOF STATE]
proof (prove)
using this:
b \<in> T \<inter> rel_interior S2

goal (1 subgoal):
 1. b \<in> affine hull S1
[PROOF STEP]
using rel_interior_subset hull_subset[of S2] **
[PROOF STATE]
proof (prove)
using this:
b \<in> T \<inter> rel_interior S2
rel_interior ?S \<subseteq> ?S
S2 \<subseteq> ?S hull S2
affine hull S1 = affine hull S2

goal (1 subgoal):
 1. b \<in> affine hull S1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> affine hull S1

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> affine hull S1
[PROOF STEP]
have "b \<in> S1"
[PROOF STATE]
proof (prove)
using this:
b \<in> affine hull S1

goal (1 subgoal):
 1. b \<in> S1
[PROOF STEP]
using T b
[PROOF STATE]
proof (prove)
using this:
b \<in> affine hull S1
open T
a \<in> T \<inter> S1
T \<inter> affine hull S1 \<subseteq> S1
b \<in> T \<inter> rel_interior S2

goal (1 subgoal):
 1. b \<in> S1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> S1

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> S1
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
b \<in> S1

goal (1 subgoal):
 1. False
[PROOF STEP]
using b assms
[PROOF STATE]
proof (prove)
using this:
b \<in> S1
b \<in> T \<inter> rel_interior S2
convex S1
convex S2
S2 \<noteq> {}
S1 \<subseteq> rel_frontier S2

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding rel_frontier_def
[PROOF STATE]
proof (prove)
using this:
b \<in> S1
b \<in> T \<inter> rel_interior S2
convex S1
convex S2
S2 \<noteq> {}
S1 \<subseteq> closure S2 - rel_interior S2

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

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
aff_dim S1 = aff_dim S2 \<Longrightarrow> False

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
aff_dim S1 \<le> aff_dim S2
aff_dim S1 = aff_dim S2 \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim S1 \<le> aff_dim S2
aff_dim S1 = aff_dim S2 \<Longrightarrow> False

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
using less_le
[PROOF STATE]
proof (prove)
using this:
aff_dim S1 \<le> aff_dim S2
aff_dim S1 = aff_dim S2 \<Longrightarrow> False
(?x < ?y) = (?x \<le> ?y \<and> ?x \<noteq> ?y)

goal (1 subgoal):
 1. aff_dim S1 < aff_dim S2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aff_dim S1 < aff_dim S2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infinite_local_ordering_intro:
  assumes "infinite X"
    and "\<forall>n::nat. f n \<in> X"
    and "\<forall>x \<in> X. \<exists>n::nat. f n = x"
    and "\<forall>n n' n''. Suc n = n' \<and> Suc n' = n'' \<longrightarrow> ord (f n) (f n') (f n'')"
  shows "local_ordering f ord X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_ordering f ord X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
infinite X
\<forall>n. f n \<in> X
\<forall>x\<in>X. \<exists>n. f n = x
\<forall>n n' n''. Suc n = n' \<and> Suc n' = n'' \<longrightarrow> ord (f n) (f n') (f n'')

goal (1 subgoal):
 1. local_ordering f ord X
[PROOF STEP]
unfolding local_ordering_def
[PROOF STATE]
proof (prove)
using this:
infinite X
\<forall>n. f n \<in> X
\<forall>x\<in>X. \<exists>n. f n = x
\<forall>n n' n''. Suc n = n' \<and> Suc n' = n'' \<longrightarrow> ord (f n) (f n') (f n'')

goal (1 subgoal):
 1. (\<forall>n. (finite X \<longrightarrow> n < card X) \<longrightarrow> f n \<in> X) \<and> (\<forall>x\<in>X. \<exists>n. (finite X \<longrightarrow> n < card X) \<and> f n = x) \<and> (\<forall>n. (finite X \<longrightarrow> Suc (Suc n) < card X) \<longrightarrow> ord (f n) (f (Suc n)) (f (Suc (Suc n))))
[PROOF STEP]
by metis


[STATEMENT]
theorem Join_empty: "\<Squnion>{} = \<Sqinter>UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>{} = \<Sqinter>UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Squnion>{} = \<Sqinter>UNIV
[PROOF STEP]
have "dual (\<Squnion>{}) = \<Sqinter>{}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual (\<Squnion>{}) = \<Sqinter>{}
[PROOF STEP]
by (simp add: dual_Join)
[PROOF STATE]
proof (state)
this:
dual (\<Squnion>{}) = \<Sqinter>{}

goal (1 subgoal):
 1. \<Squnion>{} = \<Sqinter>UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dual (\<Squnion>{}) = \<Sqinter>{}

goal (1 subgoal):
 1. \<Squnion>{} = \<Sqinter>UNIV
[PROOF STEP]
have "\<dots> = \<Squnion>UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>{} = \<Squnion>UNIV
[PROOF STEP]
by (rule Meet_empty)
[PROOF STATE]
proof (state)
this:
\<Sqinter>{} = \<Squnion>UNIV

goal (1 subgoal):
 1. \<Squnion>{} = \<Sqinter>UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sqinter>{} = \<Squnion>UNIV

goal (1 subgoal):
 1. \<Squnion>{} = \<Sqinter>UNIV
[PROOF STEP]
have "\<dots> = dual (\<Sqinter>UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>UNIV = dual (\<Sqinter>UNIV)
[PROOF STEP]
by (simp add: dual_Meet)
[PROOF STATE]
proof (state)
this:
\<Squnion>UNIV = dual (\<Sqinter>UNIV)

goal (1 subgoal):
 1. \<Squnion>{} = \<Sqinter>UNIV
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dual (\<Squnion>{}) = dual (\<Sqinter>UNIV)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dual (\<Squnion>{}) = dual (\<Sqinter>UNIV)

goal (1 subgoal):
 1. \<Squnion>{} = \<Sqinter>UNIV
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<Squnion>{} = \<Sqinter>UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_by_cons_trans :
  assumes trans_cmp: "transp cmp"
  shows "sorted_by cmp (x # xs) = ((\<forall>x' \<in> set xs . cmp x x') \<and> sorted_by cmp xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_by cmp (x # xs) = ((\<forall>x'\<in>set xs. cmp x x') \<and> sorted_by cmp xs)
[PROOF STEP]
proof (induct xs arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. sorted_by cmp [x] = (Ball (set []) (cmp x) \<and> sorted_by cmp [])
 2. \<And>a xs x. (\<And>x. sorted_by cmp (x # xs) = (Ball (set xs) (cmp x) \<and> sorted_by cmp xs)) \<Longrightarrow> sorted_by cmp (x # a # xs) = (Ball (set (a # xs)) (cmp x) \<and> sorted_by cmp (a # xs))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x. sorted_by cmp [x] = (Ball (set []) (cmp x) \<and> sorted_by cmp [])
 2. \<And>a xs x. (\<And>x. sorted_by cmp (x # xs) = (Ball (set xs) (cmp x) \<and> sorted_by cmp xs)) \<Longrightarrow> sorted_by cmp (x # a # xs) = (Ball (set (a # xs)) (cmp x) \<and> sorted_by cmp (a # xs))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_by cmp [x] = ((\<forall>a\<in>set []. cmp x a) \<and> sorted_by cmp [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_by cmp [x] = ((\<forall>a\<in>set []. cmp x a) \<and> sorted_by cmp [])

goal (1 subgoal):
 1. \<And>a xs x. (\<And>x. sorted_by cmp (x # xs) = (Ball (set xs) (cmp x) \<and> sorted_by cmp xs)) \<Longrightarrow> sorted_by cmp (x # a # xs) = (Ball (set (a # xs)) (cmp x) \<and> sorted_by cmp (a # xs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs x. (\<And>x. sorted_by cmp (x # xs) = (Ball (set xs) (cmp x) \<and> sorted_by cmp xs)) \<Longrightarrow> sorted_by cmp (x # a # xs) = (Ball (set (a # xs)) (cmp x) \<and> sorted_by cmp (a # xs))
[PROOF STEP]
case (Cons x2 xs x1)
[PROOF STATE]
proof (state)
this:
sorted_by cmp (?x # xs) = ((\<forall>a\<in>set xs. cmp ?x a) \<and> sorted_by cmp xs)

goal (1 subgoal):
 1. \<And>a xs x. (\<And>x. sorted_by cmp (x # xs) = (Ball (set xs) (cmp x) \<and> sorted_by cmp xs)) \<Longrightarrow> sorted_by cmp (x # a # xs) = (Ball (set (a # xs)) (cmp x) \<and> sorted_by cmp (a # xs))
[PROOF STEP]
note ind_hyp = this
[PROOF STATE]
proof (state)
this:
sorted_by cmp (?x # xs) = ((\<forall>a\<in>set xs. cmp ?x a) \<and> sorted_by cmp xs)

goal (1 subgoal):
 1. \<And>a xs x. (\<And>x. sorted_by cmp (x # xs) = (Ball (set xs) (cmp x) \<and> sorted_by cmp xs)) \<Longrightarrow> sorted_by cmp (x # a # xs) = (Ball (set (a # xs)) (cmp x) \<and> sorted_by cmp (a # xs))
[PROOF STEP]
from trans_cmp
[PROOF STATE]
proof (chain)
picking this:
transp cmp
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
transp cmp

goal (1 subgoal):
 1. sorted_by cmp (x1 # x2 # xs) = ((\<forall>a\<in>set (x2 # xs). cmp x1 a) \<and> sorted_by cmp (x2 # xs))
[PROOF STEP]
by (auto simp add: ind_hyp transp_def)
[PROOF STATE]
proof (state)
this:
sorted_by cmp (x1 # x2 # xs) = ((\<forall>a\<in>set (x2 # xs). cmp x1 a) \<and> sorted_by cmp (x2 # xs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Maclaurin_cos_expansion2:
  assumes "x > 0" "n > 0"
  shows "\<exists>t. 0 < t \<and> t < x \<and>
      cos x = (\<Sum>m<n. cos_coeff m * x ^ m) + (cos (t + 1/2 * real n * pi) / fact n) * x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos_coeff m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos_coeff m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
let ?diff = "\<lambda>n x. cos (x + 1/2 * real n * pi)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos_coeff m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
have "\<exists>t. 0 < t \<and> t < x \<and> cos x = (\<Sum>m<n. ?diff m 0 / (fact m) * x ^ m) + ?diff n t / fact n * x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos (0 + 1 / 2 * real m * pi) / fact m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
proof (rule Maclaurin)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. 0 < x
 2. 0 < n
 3. (\<lambda>a. cos (a + 1 / 2 * real 0 * pi)) = cos
 4. \<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow> ((\<lambda>a. cos (a + 1 / 2 * real m * pi)) has_real_derivative cos (t + 1 / 2 * real (Suc m) * pi)) (at t)
[PROOF STEP]
show "\<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow>
              ((\<lambda>u. cos (u + 1 / 2 * real m * pi)) has_real_derivative
               cos (t + 1 / 2 * real (Suc m) * pi)) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow> ((\<lambda>u. cos (u + 1 / 2 * real m * pi)) has_real_derivative cos (t + 1 / 2 * real (Suc m) * pi)) (at t)
[PROOF STEP]
by (simp add: cos_expansion_lemma del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
\<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow> ((\<lambda>u. cos (u + 1 / 2 * real m * pi)) has_real_derivative cos (t + 1 / 2 * real (Suc m) * pi)) (at t)

goal (3 subgoals):
 1. 0 < x
 2. 0 < n
 3. (\<lambda>a. cos (a + 1 / 2 * real 0 * pi)) = cos
[PROOF STEP]
qed (use assms in auto)
[PROOF STATE]
proof (state)
this:
\<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos (0 + 1 / 2 * real m * pi) / fact m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n

goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos_coeff m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos (0 + 1 / 2 * real m * pi) / fact m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos (0 + 1 / 2 * real m * pi) / fact m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n

goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos_coeff m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
apply (rule ex_forward, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t. \<lbrakk>0 < t \<and> t < x \<and> cos x = (\<Sum>m<n. cos (real m * pi / 2) * x ^ m / fact m) + cos (t + real n * pi / 2) * x ^ n / fact n; \<exists>ta>0. ta < x \<and> cos (t + real n * pi / 2) = cos (ta + real n * pi / 2)\<rbrakk> \<Longrightarrow> (\<Sum>m<n. cos (real m * pi / 2) * x ^ m / fact m) = (\<Sum>m<n. cos_coeff m * x ^ m)
[PROOF STEP]
apply (rule sum.cong[OF refl])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t xa. \<lbrakk>0 < t \<and> t < x \<and> cos x = (\<Sum>m<n. cos (real m * pi / 2) * x ^ m / fact m) + cos (t + real n * pi / 2) * x ^ n / fact n; \<exists>ta>0. ta < x \<and> cos (t + real n * pi / 2) = cos (ta + real n * pi / 2); xa \<in> {..<n}\<rbrakk> \<Longrightarrow> cos (real xa * pi / 2) * x ^ xa / fact xa = cos_coeff xa * x ^ xa
[PROOF STEP]
apply (auto simp: cos_coeff_def cos_zero_iff elim: evenE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>t>0. t < x \<and> cos x = (\<Sum>m<n. cos_coeff m * x ^ m) + cos (t + 1 / 2 * real n * pi) / fact n * x ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma firstPosAppendNonMemberFirstMemberSecond:
  assumes "a \<notin> set l1" and  "a \<in> set l2"
  shows "firstPos a (l1 @ l2) = length l1 + firstPos a l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. firstPos a (l1 @ l2) = length l1 + firstPos a l2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<notin> set l1
a \<in> set l2

goal (1 subgoal):
 1. firstPos a (l1 @ l2) = length l1 + firstPos a l2
[PROOF STEP]
by (induct l1) auto


[STATEMENT]
lemma convex_ball [iff]:
  fixes x :: "'a::real_normed_vector"
  shows "convex (ball x e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (ball x e)
[PROOF STEP]
proof (auto simp: convex_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa y u v. \<lbrakk>dist x xa < e; dist x y < e; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> dist x (u *\<^sub>R xa + v *\<^sub>R y) < e
[PROOF STEP]
fix y z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa y u v. \<lbrakk>dist x xa < e; dist x y < e; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> dist x (u *\<^sub>R xa + v *\<^sub>R y) < e
[PROOF STEP]
assume yz: "dist x y < e" "dist x z < e"
[PROOF STATE]
proof (state)
this:
dist x y < e
dist x z < e

goal (1 subgoal):
 1. \<And>xa y u v. \<lbrakk>dist x xa < e; dist x y < e; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> dist x (u *\<^sub>R xa + v *\<^sub>R y) < e
[PROOF STEP]
fix u v :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa y u v. \<lbrakk>dist x xa < e; dist x y < e; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> dist x (u *\<^sub>R xa + v *\<^sub>R y) < e
[PROOF STEP]
assume uv: "0 \<le> u" "0 \<le> v" "u + v = 1"
[PROOF STATE]
proof (state)
this:
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. \<And>xa y u v. \<lbrakk>dist x xa < e; dist x y < e; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> dist x (u *\<^sub>R xa + v *\<^sub>R y) < e
[PROOF STEP]
have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
[PROOF STEP]
using uv yz
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
0 \<le> v
u + v = 1
dist x y < e
dist x z < e

goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
[PROOF STEP]
using convex_on_dist [of "ball x e" x, unfolded convex_on_def,
      THEN bspec[where x=y], THEN bspec[where x=z]]
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
0 \<le> v
u + v = 1
dist x y < e
dist x z < e
\<lbrakk>y \<in> ball x e; z \<in> ball x e\<rbrakk> \<Longrightarrow> \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z

goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z

goal (1 subgoal):
 1. \<And>xa y u v. \<lbrakk>dist x xa < e; dist x y < e; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> dist x (u *\<^sub>R xa + v *\<^sub>R y) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
[PROOF STEP]
show "dist x (u *\<^sub>R y + v *\<^sub>R z) < e"
[PROOF STATE]
proof (prove)
using this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z

goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) < e
[PROOF STEP]
using convex_bound_lt[OF yz uv]
[PROOF STATE]
proof (prove)
using this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
u * dist x y + v * dist x z < e

goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) < e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist x (u *\<^sub>R y + v *\<^sub>R z) < e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filter_mset_cong2:
  "(\<And>x. x \<in># M \<Longrightarrow> f x = g x) \<Longrightarrow> M = N \<Longrightarrow> filter_mset f M = filter_mset g N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in># M \<Longrightarrow> f x = g x; M = N\<rbrakk> \<Longrightarrow> filter_mset f M = filter_mset g N
[PROOF STEP]
by (hypsubst, rule filter_mset_cong, simp)


[STATEMENT]
lemma card1_eE: "finite S \<Longrightarrow> \<exists>y. y \<in> S \<Longrightarrow> 1 \<le> card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; \<exists>y. y \<in> S\<rbrakk> \<Longrightarrow> 1 \<le> card S
[PROOF STEP]
using card_0_eq
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> (card ?A = 0) = (?A = {})

goal (1 subgoal):
 1. \<lbrakk>finite S; \<exists>y. y \<in> S\<rbrakk> \<Longrightarrow> 1 \<le> card S
[PROOF STEP]
by fastforce


[STATEMENT]
lemma hnorm_eq_zero [simp]: "\<And>x::'a::real_normed_vector star. hnorm x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (hnorm x = 0) = (x = 0)
[PROOF STEP]
by transfer (rule norm_eq_zero)


[STATEMENT]
lemma scaleC_nonneg_nonpos: "0 \<le> a \<Longrightarrow> x \<le> 0 \<Longrightarrow> a *\<^sub>C x \<le> 0"
  for x :: "'a::ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; x \<le> (0::'a)\<rbrakk> \<Longrightarrow> a *\<^sub>C x \<le> (0::'a)
[PROOF STEP]
using scaleC_left_mono [of x 0 a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<le> (0::'a); 0 \<le> a\<rbrakk> \<Longrightarrow> a *\<^sub>C x \<le> a *\<^sub>C (0::'a)

goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; x \<le> (0::'a)\<rbrakk> \<Longrightarrow> a *\<^sub>C x \<le> (0::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma inj_on_restrict_iff: "A \<subseteq> B \<Longrightarrow> inj_on (restrict f B) A \<longleftrightarrow> inj_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> inj_on (restrict f B) A = inj_on f A
[PROOF STEP]
by (metis inj_on_cong restrict_def subset_iff)


[STATEMENT]
lemma ent_false_iff[simp]: "(P \<Longrightarrow>\<^sub>A false) \<longleftrightarrow> (\<forall>h. \<not>h\<Turnstile>P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<Longrightarrow>\<^sub>A false) = (\<forall>h. \<not> h \<Turnstile> P)
[PROOF STEP]
unfolding entails_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>h. h \<Turnstile> P \<longrightarrow> h \<Turnstile> false) = (\<forall>h. \<not> h \<Turnstile> P)
[PROOF STEP]
by auto


[STATEMENT]
lemma n_mult_comm: "n x \<cdot> n y = n y \<cdot> n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
have "n x \<cdot> n y = n n (n x \<cdot> n y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n x \<cdot> n y = n n (n x \<cdot> n y)
[PROOF STEP]
by (metis local.test_mult)
[PROOF STATE]
proof (state)
this:
n x \<cdot> n y = n n (n x \<cdot> n y)

goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n x \<cdot> n y = n n (n x \<cdot> n y)

goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
have "... = n (n n x + n n y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n n (n x \<cdot> n y) = n (n n x + n n y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n n (n x \<cdot> n y) = n (n n x + n n y)

goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n n (n x \<cdot> n y) = n (n n x + n n y)

goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
have "... = n (n n y + n n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (n n x + n n y) = n (n n y + n n x)
[PROOF STEP]
by (metis add_commute)
[PROOF STATE]
proof (state)
this:
n (n n x + n n y) = n (n n y + n n x)

goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n (n n x + n n y) = n (n n y + n n x)

goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
have "... = n n (n y \<cdot> n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (n n y + n n x) = n n (n y \<cdot> n x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n (n n y + n n x) = n n (n y \<cdot> n x)

goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n x \<cdot> n y = n n (n y \<cdot> n x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n x \<cdot> n y = n n (n y \<cdot> n x)

goal (1 subgoal):
 1. n x \<cdot> n y = n y \<cdot> n x
[PROOF STEP]
by (metis local.test_mult)
[PROOF STATE]
proof (state)
this:
n x \<cdot> n y = n y \<cdot> n x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fact_dvd_pochhammer:
  assumes "m \<le> n + 1"
  shows   "fact m dvd pochhammer (int n - int m + 1) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact m dvd pochhammer (int n - int m + 1) m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fact m dvd pochhammer (int n - int m + 1) m
[PROOF STEP]
have "(real n gchoose m) * fact m = of_int (pochhammer (int n - int m + 1) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real n gchoose m) * fact m = real_of_int (pochhammer (int n - int m + 1) m)
[PROOF STEP]
by (simp add: gbinomial_pochhammer' pochhammer_of_int [symmetric])
[PROOF STATE]
proof (state)
this:
(real n gchoose m) * fact m = real_of_int (pochhammer (int n - int m + 1) m)

goal (1 subgoal):
 1. fact m dvd pochhammer (int n - int m + 1) m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real n gchoose m) * fact m = real_of_int (pochhammer (int n - int m + 1) m)

goal (1 subgoal):
 1. fact m dvd pochhammer (int n - int m + 1) m
[PROOF STEP]
have "(real n gchoose m) * fact m = of_int (int (n choose m) * fact m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real n gchoose m) * fact m = real_of_int (int (n choose m) * fact m)
[PROOF STEP]
by (simp add: binomial_gbinomial)
[PROOF STATE]
proof (state)
this:
(real n gchoose m) * fact m = real_of_int (int (n choose m) * fact m)

goal (1 subgoal):
 1. fact m dvd pochhammer (int n - int m + 1) m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int (int (n choose m) * fact m) = real_of_int (pochhammer (int n - int m + 1) m)
[PROOF STEP]
have "int (n choose m) * fact m = pochhammer (int n - int m + 1) m"
[PROOF STATE]
proof (prove)
using this:
real_of_int (int (n choose m) * fact m) = real_of_int (pochhammer (int n - int m + 1) m)

goal (1 subgoal):
 1. int (n choose m) * fact m = pochhammer (int n - int m + 1) m
[PROOF STEP]
by (subst (asm) of_int_eq_iff)
[PROOF STATE]
proof (state)
this:
int (n choose m) * fact m = pochhammer (int n - int m + 1) m

goal (1 subgoal):
 1. fact m dvd pochhammer (int n - int m + 1) m
[PROOF STEP]
from this [symmetric]
[PROOF STATE]
proof (chain)
picking this:
pochhammer (int n - int m + 1) m = int (n choose m) * fact m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pochhammer (int n - int m + 1) m = int (n choose m) * fact m

goal (1 subgoal):
 1. fact m dvd pochhammer (int n - int m + 1) m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fact m dvd pochhammer (int n - int m + 1) m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trees_mono: "A \<subseteq> B \<Longrightarrow> trees A \<subseteq> trees B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> trees A \<subseteq> trees B
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>A \<subseteq> B; x \<in> trees A\<rbrakk> \<Longrightarrow> x \<in> trees B
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>A \<subseteq> B; x \<in> trees A\<rbrakk> \<Longrightarrow> x \<in> trees B
[PROOF STEP]
assume "A \<subseteq> B" "t \<in> trees A"
[PROOF STATE]
proof (state)
this:
A \<subseteq> B
t \<in> trees A

goal (1 subgoal):
 1. \<And>x. \<lbrakk>A \<subseteq> B; x \<in> trees A\<rbrakk> \<Longrightarrow> x \<in> trees B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> B
t \<in> trees A
[PROOF STEP]
show "t \<in> trees B"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B
t \<in> trees A

goal (1 subgoal):
 1. t \<in> trees B
[PROOF STEP]
by (induction t) auto
[PROOF STATE]
proof (state)
this:
t \<in> trees B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_eq2:
  assumes "eventually (\<lambda>x. f x \<noteq> 0) F"
  shows   "(\<lambda>x. inverse (f x)) \<in> L F (g) \<longleftrightarrow> (\<lambda>x. 1) \<in> L F (\<lambda>x. f x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) \<in> L F g) = ((\<lambda>x. 1::'b) \<in> L F (\<lambda>x. f x * g x))
[PROOF STEP]
using divide_eq2[of f F "\<lambda>_. 1" g]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<noteq> (0::'b) \<Longrightarrow> ((\<lambda>x. (1::'b) / f x) \<in> L F g) = ((\<lambda>_. 1::'b) \<in> L F (\<lambda>x. g x * f x))

goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) \<in> L F g) = ((\<lambda>x. 1::'b) \<in> L F (\<lambda>x. f x * g x))
[PROOF STEP]
by (simp add: divide_inverse assms mult_ac)


[STATEMENT]
lemma poly_y_x_poly_x_minus_y:
  fixes p :: "'a :: idom poly"
  shows "poly_y_x (poly_x_minus_y p) = poly_y_minus_x p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_y_x (poly_x_minus_y p) = poly_y_minus_x p
[PROOF STEP]
apply (induct p, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; poly_y_x (poly_x_minus_y p) = poly_y_minus_x p\<rbrakk> \<Longrightarrow> poly_y_x (poly_x_minus_y (pCons a p)) = poly_y_minus_x (pCons a p)
[PROOF STEP]
apply (unfold poly_x_minus_y_pCons hom_distribs)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; poly_y_x (poly_x_minus_y p) = poly_y_minus_x p\<rbrakk> \<Longrightarrow> poly_y_x [:[:a:]:] + poly_y_x (poly_x_minus_y p) * poly_y_x x_y = poly_y_minus_x (pCons a p)
[PROOF STEP]
by simp


[STATEMENT]
lemma upto_enum_step_subset:
  "set [x, y .e. z] \<subseteq> {x .. z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [x , y .e. z] \<subseteq> {x..z}
[PROOF STEP]
apply (clarsimp simp: upto_enum_step_def linorder_not_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>x \<le> z; xa \<le> (z - x) div (y - x)\<rbrakk> \<Longrightarrow> x \<le> x + xa * (y - x) \<and> x + xa * (y - x) \<le> z
[PROOF STEP]
apply (drule div_to_mult_word_lt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> x \<le> x + xa * (y - x) \<and> x + xa * (y - x) \<le> z
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> x \<le> x + xa * (y - x)
 2. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> x + xa * (y - x) \<le> z
[PROOF STEP]
apply (erule word_random[rotated])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. x \<le> z \<Longrightarrow> x \<le> x + (z - x)
 2. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> x + xa * (y - x) \<le> z
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> x + xa * (y - x) \<le> z
[PROOF STEP]
apply (rule order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> x + xa * (y - x) \<le> ?y20 xa
 2. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> ?y20 xa \<le> z
[PROOF STEP]
apply (erule word_plus_mono_right)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. x \<le> z \<Longrightarrow> x \<le> x + (z - x)
 2. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> x + (z - x) \<le> z
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>x \<le> z; xa * (y - x) \<le> z - x\<rbrakk> \<Longrightarrow> x + (z - x) \<le> z
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma finsum_partition:
  assumes "finite S"
  assumes "f \<in> S \<rightarrow> carrier R"
  assumes "T \<subseteq> S"
  shows "finsum  R f S  = finsum R f T  \<oplus> finsum  R f (S - T) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f S = finsum R f T \<oplus> finsum R f (S - T)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finsum R f S = finsum R f T \<oplus> finsum R f (S - T)
[PROOF STEP]
have "\<And>U. finite U \<Longrightarrow> U \<subseteq> S \<longrightarrow> finsum  R f S  = finsum R f U  \<oplus> finsum  R f (S - U) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>U. finite U \<Longrightarrow> U \<subseteq> S \<longrightarrow> finsum R f S = finsum R f U \<oplus> finsum R f (S - U)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. finite U \<Longrightarrow> U \<subseteq> S \<longrightarrow> finsum R f S = finsum R f U \<oplus> finsum R f (S - U)
[PROOF STEP]
fix U
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. finite U \<Longrightarrow> U \<subseteq> S \<longrightarrow> finsum R f S = finsum R f U \<oplus> finsum R f (S - U)
[PROOF STEP]
show "finite U \<Longrightarrow> U \<subseteq> S \<longrightarrow> finsum R f S = finsum R f U \<oplus> finsum R f (S - U) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite U \<Longrightarrow> U \<subseteq> S \<longrightarrow> finsum R f S = finsum R f U \<oplus> finsum R f (S - U)
[PROOF STEP]
apply(erule finite.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {} \<subseteq> S \<longrightarrow> finsum R f S = finsum R f {} \<oplus> finsum R f (S - {})
 2. \<And>A a. \<lbrakk>finite A; A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A)\<rbrakk> \<Longrightarrow> insert a A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
apply (metis Diff_empty assms(2) finsum_closed finsum_empty l_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A)\<rbrakk> \<Longrightarrow> insert a A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
fix A :: "'c set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
assume A0: "finite A"
[PROOF STATE]
proof (state)
this:
finite A

goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
show "A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A) \<Longrightarrow> insert a A \<subseteq> S \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
assume A1: "A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A)"
[PROOF STATE]
proof (state)
this:
A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A)

goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
assume A2: "insert a A \<subseteq> S"
[PROOF STATE]
proof (state)
this:
insert a A \<subseteq> S

goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
show "finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
apply(cases "a \<in> A")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<in> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
 2. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
apply (metis A1 A2 insert_absorb)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
assume A3: "a \<notin> A"
[PROOF STATE]
proof (state)
this:
a \<notin> A

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A4: "f a \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<in> carrier R
[PROOF STEP]
by (metis A2 Pi_iff assms(2) insert_subset)
[PROOF STATE]
proof (state)
this:
f a \<in> carrier R

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A5: " finsum R f (insert a A) = f a \<oplus> finsum R f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f (insert a A) = f a \<oplus> finsum R f A
[PROOF STEP]
using A0 A1 A2 finsum_insert[of A a f] assms  A3
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A)
insert a A \<subseteq> S
\<lbrakk>finite A; a \<notin> A; f \<in> A \<rightarrow> carrier R; f a \<in> carrier R\<rbrakk> \<Longrightarrow> finsum R f (insert a A) = f a \<oplus> finsum R f A
finite S
f \<in> S \<rightarrow> carrier R
T \<subseteq> S
a \<notin> A

goal (1 subgoal):
 1. finsum R f (insert a A) = f a \<oplus> finsum R f A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finsum R f (insert a A) = f a \<oplus> finsum R f A

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A6: "a \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> S
[PROOF STEP]
using A2
[PROOF STATE]
proof (prove)
using this:
insert a A \<subseteq> S

goal (1 subgoal):
 1. a \<in> S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> S

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A7: "finsum R f S \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f S \<in> carrier R
[PROOF STEP]
using assms(2) finsum_closed
[PROOF STATE]
proof (prove)
using this:
f \<in> S \<rightarrow> carrier R
?f \<in> ?A \<rightarrow> carrier R \<Longrightarrow> finsum R ?f ?A \<in> carrier R

goal (1 subgoal):
 1. finsum R f S \<in> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finsum R f S \<in> carrier R

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A8: " finsum R f (S - A)\<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f (S - A) \<in> carrier R
[PROOF STEP]
using Diff_subset[of S A] Pi_iff assms(2) finsum_closed[of f] subsetD[of _ S ]
[PROOF STATE]
proof (prove)
using this:
S - A \<subseteq> S
(?f \<in> Pi ?I ?X) = (\<forall>i\<in>?I. ?f i \<in> ?X i)
f \<in> S \<rightarrow> carrier R
f \<in> ?A \<rightarrow> carrier R \<Longrightarrow> finsum R f ?A \<in> carrier R
\<lbrakk>?A \<subseteq> S; ?c \<in> ?A\<rbrakk> \<Longrightarrow> ?c \<in> S

goal (1 subgoal):
 1. finsum R f (S - A) \<in> carrier R
[PROOF STEP]
by (meson Pi_anti_mono in_mono)
[PROOF STATE]
proof (state)
this:
finsum R f (S - A) \<in> carrier R

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A9: "finsum R f A \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f A \<in> carrier R
[PROOF STEP]
by (meson A2 Pi_anti_mono assms(2) finsum_closed insert_subset subsetD)
[PROOF STATE]
proof (state)
this:
finsum R f A \<in> carrier R

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A10: "finsum R f A =  finsum R f S \<ominus> finsum R f (S - A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f A = finsum R f S \<ominus> finsum R f (S - A)
[PROOF STEP]
using A7 A8 A9
[PROOF STATE]
proof (prove)
using this:
finsum R f S \<in> carrier R
finsum R f (S - A) \<in> carrier R
finsum R f A \<in> carrier R

goal (1 subgoal):
 1. finsum R f A = finsum R f S \<ominus> finsum R f (S - A)
[PROOF STEP]
by (metis A1 A2 add.inv_solve_right' insert_subset minus_eq)
[PROOF STATE]
proof (state)
this:
finsum R f A = finsum R f S \<ominus> finsum R f (S - A)

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A11: " finsum R f (insert a A) = f a \<oplus> (finsum R f S \<ominus> finsum R f (S - A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f (insert a A) = f a \<oplus> (finsum R f S \<ominus> finsum R f (S - A))
[PROOF STEP]
using A5 A6 A1 A2 assms  A10
[PROOF STATE]
proof (prove)
using this:
finsum R f (insert a A) = f a \<oplus> finsum R f A
a \<in> S
A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A)
insert a A \<subseteq> S
finite S
f \<in> S \<rightarrow> carrier R
T \<subseteq> S
finsum R f A = finsum R f S \<ominus> finsum R f (S - A)

goal (1 subgoal):
 1. finsum R f (insert a A) = f a \<oplus> (finsum R f S \<ominus> finsum R f (S - A))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
finsum R f (insert a A) = f a \<oplus> (finsum R f S \<ominus> finsum R f (S - A))

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finsum R f (insert a A) = f a \<oplus> (finsum R f S \<ominus> finsum R f (S - A))
[PROOF STEP]
have A12: " finsum R f (insert a A) =finsum R f S \<oplus>( f a  \<ominus> finsum R f (S - A))"
[PROOF STATE]
proof (prove)
using this:
finsum R f (insert a A) = f a \<oplus> (finsum R f S \<ominus> finsum R f (S - A))

goal (1 subgoal):
 1. finsum R f (insert a A) = finsum R f S \<oplus> (f a \<ominus> finsum R f (S - A))
[PROOF STEP]
using A4 A7 A8 add.inv_closed add.m_lcomm minus_eq
[PROOF STATE]
proof (prove)
using this:
finsum R f (insert a A) = f a \<oplus> (finsum R f S \<ominus> finsum R f (S - A))
f a \<in> carrier R
finsum R f S \<in> carrier R
finsum R f (S - A) \<in> carrier R
?x \<in> carrier R \<Longrightarrow> \<ominus> ?x \<in> carrier R
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R; ?z \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<oplus> (?y \<oplus> ?z) = ?y \<oplus> (?x \<oplus> ?z)
?x \<ominus> ?y = ?x \<oplus> \<ominus> ?y

goal (1 subgoal):
 1. finsum R f (insert a A) = finsum R f S \<oplus> (f a \<ominus> finsum R f (S - A))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
finsum R f (insert a A) = finsum R f S \<oplus> (f a \<ominus> finsum R f (S - A))

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A13: "finsum R f (insert a A) \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f (insert a A) \<in> carrier R
[PROOF STEP]
using A4 A5 A9 add.m_closed
[PROOF STATE]
proof (prove)
using this:
f a \<in> carrier R
finsum R f (insert a A) = f a \<oplus> finsum R f A
finsum R f A \<in> carrier R
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y \<in> carrier R

goal (1 subgoal):
 1. finsum R f (insert a A) \<in> carrier R
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
finsum R f (insert a A) \<in> carrier R

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A14: " finsum R f (S - insert a A) \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f (S - insert a A) \<in> carrier R
[PROOF STEP]
by (meson Diff_subset Pi_anti_mono assms(2) finsum_closed in_mono)
[PROOF STATE]
proof (state)
this:
finsum R f (S - insert a A) \<in> carrier R

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A15: "finsum R f S = finsum R f (insert a A) \<ominus> ( f a  \<ominus> finsum R f (S - A)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<ominus> (f a \<ominus> finsum R f (S - A))
[PROOF STEP]
by (metis A12 A13 A4 A7 A8 add.inv_solve_right' minus_closed minus_eq)
[PROOF STATE]
proof (state)
this:
finsum R f S = finsum R f (insert a A) \<ominus> (f a \<ominus> finsum R f (S - A))

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A16: "finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - A) \<ominus> f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - A) \<ominus> f a
[PROOF STEP]
using  A1 A2 A4 A5 A8 A9 add.inv_closed add.m_assoc add.m_comm insert_subset minus_closed minus_eq r_neg1
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A)
insert a A \<subseteq> S
f a \<in> carrier R
finsum R f (insert a A) = f a \<oplus> finsum R f A
finsum R f (S - A) \<in> carrier R
finsum R f A \<in> carrier R
?x \<in> carrier R \<Longrightarrow> \<ominus> ?x \<in> carrier R
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R; ?z \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y \<oplus> ?z = ?x \<oplus> (?y \<oplus> ?z)
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y = ?y \<oplus> ?x
(insert ?x ?A \<subseteq> ?B) = (?x \<in> ?B \<and> ?A \<subseteq> ?B)
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<ominus> ?y \<in> carrier R
?x \<ominus> ?y = ?x \<oplus> \<ominus> ?y
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> \<ominus> ?x \<oplus> (?x \<oplus> ?y) = ?y

goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - A) \<ominus> f a
[PROOF STEP]
unfolding a_minus_def
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A)
insert a A \<subseteq> S
f a \<in> carrier R
finsum R f (insert a A) = f a \<oplus> finsum R f A
finsum R f (S - A) \<in> carrier R
finsum R f A \<in> carrier R
?x \<in> carrier R \<Longrightarrow> \<ominus> ?x \<in> carrier R
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R; ?z \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y \<oplus> ?z = ?x \<oplus> (?y \<oplus> ?z)
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y = ?y \<oplus> ?x
(insert ?x ?A \<subseteq> ?B) = (?x \<in> ?B \<and> ?A \<subseteq> ?B)
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<oplus> \<ominus> ?y \<in> carrier R
?x \<oplus> \<ominus> ?y = ?x \<oplus> \<ominus> ?y
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> \<ominus> ?x \<oplus> (?x \<oplus> ?y) = ?y

goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - A) \<oplus> \<ominus> f a
[PROOF STEP]
by (metis add.m_closed)
[PROOF STATE]
proof (state)
this:
finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - A) \<ominus> f a

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A16: "finsum R f S = finsum R f (insert a A) \<oplus> (finsum R f (S - A) \<ominus> f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> (finsum R f (S - A) \<ominus> f a)
[PROOF STEP]
unfolding a_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> (finsum R f (S - A) \<oplus> \<ominus> f a)
[PROOF STEP]
using A13 A16 A4 A8 add.inv_closed add.m_assoc minus_eq
[PROOF STATE]
proof (prove)
using this:
finsum R f (insert a A) \<in> carrier R
finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - A) \<ominus> f a
f a \<in> carrier R
finsum R f (S - A) \<in> carrier R
?x \<in> carrier R \<Longrightarrow> \<ominus> ?x \<in> carrier R
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R; ?z \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y \<oplus> ?z = ?x \<oplus> (?y \<oplus> ?z)
?x \<ominus> ?y = ?x \<oplus> \<ominus> ?y

goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> (finsum R f (S - A) \<oplus> \<ominus> f a)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
finsum R f S = finsum R f (insert a A) \<oplus> (finsum R f (S - A) \<ominus> f a)

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
have A17: "(finsum R f (S - A) \<ominus> f a) = finsum R f (S - insert a A) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)
[PROOF STEP]
have A170: "(S - A) = insert a (S - insert a A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - A = insert a (S - insert a A)
[PROOF STEP]
using A3 A6
[PROOF STATE]
proof (prove)
using this:
a \<notin> A
a \<in> S

goal (1 subgoal):
 1. S - A = insert a (S - insert a A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S - A = insert a (S - insert a A)

goal (1 subgoal):
 1. finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)
[PROOF STEP]
have A171: "a \<notin> S - insert a A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<notin> S - insert a A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<notin> S - insert a A

goal (1 subgoal):
 1. finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<notin> S - insert a A
[PROOF STEP]
have "finsum R f (S - A)  =(f a) \<oplus> finsum R f (S - insert a A) "
[PROOF STATE]
proof (prove)
using this:
a \<notin> S - insert a A

goal (1 subgoal):
 1. finsum R f (S - A) = f a \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
using A170 finsum_insert[of "(S - insert a A)" a f]
[PROOF STATE]
proof (prove)
using this:
a \<notin> S - insert a A
S - A = insert a (S - insert a A)
\<lbrakk>finite (S - insert a A); a \<notin> S - insert a A; f \<in> S - insert a A \<rightarrow> carrier R; f a \<in> carrier R\<rbrakk> \<Longrightarrow> finsum R f (insert a (S - insert a A)) = f a \<oplus> finsum R f (S - insert a A)

goal (1 subgoal):
 1. finsum R f (S - A) = f a \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
by (metis A4 Diff_subset Pi_anti_mono assms(1) assms(2)
                  rev_finite_subset subsetD )
[PROOF STATE]
proof (state)
this:
finsum R f (S - A) = f a \<oplus> finsum R f (S - insert a A)

goal (1 subgoal):
 1. finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finsum R f (S - A) = f a \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finsum R f (S - A) = f a \<oplus> finsum R f (S - insert a A)

goal (1 subgoal):
 1. finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)
[PROOF STEP]
by (metis A1 A13 A14 A16 A2 A4 A5 A8 A9 add.l_cancel
                  add.m_assoc add.m_comm insert_subset minus_closed)
[PROOF STATE]
proof (state)
this:
finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)

goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)
[PROOF STEP]
show "finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A) "
[PROOF STATE]
proof (prove)
using this:
finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)

goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
using A16
[PROOF STATE]
proof (prove)
using this:
finsum R f (S - A) \<ominus> f a = finsum R f (S - insert a A)
finsum R f S = finsum R f (insert a A) \<oplus> (finsum R f (S - A) \<ominus> f a)

goal (1 subgoal):
 1. finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>A \<subseteq> S \<longrightarrow> finsum R f S = finsum R f A \<oplus> finsum R f (S - A); insert a A \<subseteq> S\<rbrakk> \<Longrightarrow> finsum R f S = finsum R f (insert a A) \<oplus> finsum R f (S - insert a A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite U \<Longrightarrow> U \<subseteq> S \<longrightarrow> finsum R f S = finsum R f U \<oplus> finsum R f (S - U)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite ?U23 \<Longrightarrow> ?U23 \<subseteq> S \<longrightarrow> finsum R f S = finsum R f ?U23 \<oplus> finsum R f (S - ?U23)

goal (1 subgoal):
 1. finsum R f S = finsum R f T \<oplus> finsum R f (S - T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite ?U23 \<Longrightarrow> ?U23 \<subseteq> S \<longrightarrow> finsum R f S = finsum R f ?U23 \<oplus> finsum R f (S - ?U23)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite ?U23 \<Longrightarrow> ?U23 \<subseteq> S \<longrightarrow> finsum R f S = finsum R f ?U23 \<oplus> finsum R f (S - ?U23)

goal (1 subgoal):
 1. finsum R f S = finsum R f T \<oplus> finsum R f (S - T)
[PROOF STEP]
by (meson assms(1) assms(3) rev_finite_subset)
[PROOF STATE]
proof (state)
this:
finsum R f S = finsum R f T \<oplus> finsum R f (S - T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_le_zero:
    assumes "g \<longlonglongrightarrow> 0" "\<forall>\<^sup>\<infinity>n. 0 \<le> f n" "\<forall>\<^sup>\<infinity>n. f n \<le> g n"
    shows "f \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule real_tendsto_sandwich[OF assms(2) assms(3) tendsto_const assms(1)])


[STATEMENT]
lemma independent_sets_mono:
  "vs \<in> independent_sets G \<Longrightarrow> us \<subseteq> vs \<Longrightarrow> us \<in> independent_sets G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>vs \<in> independent_sets G; us \<subseteq> vs\<rbrakk> \<Longrightarrow> us \<in> independent_sets G
[PROOF STEP]
using Int_mono[OF all_edges_mono, of us vs "uedges G" "uedges G"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>us \<subseteq> vs; uedges G \<subseteq> uedges G\<rbrakk> \<Longrightarrow> all_edges us \<inter> uedges G \<subseteq> all_edges vs \<inter> uedges G

goal (1 subgoal):
 1. \<lbrakk>vs \<in> independent_sets G; us \<subseteq> vs\<rbrakk> \<Longrightarrow> us \<in> independent_sets G
[PROOF STEP]
unfolding independent_sets_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>us \<subseteq> vs; uedges G \<subseteq> uedges G\<rbrakk> \<Longrightarrow> all_edges us \<inter> uedges G \<subseteq> all_edges vs \<inter> uedges G

goal (1 subgoal):
 1. \<lbrakk>vs \<in> {vs. vs \<subseteq> uverts G \<and> all_edges vs \<inter> uedges G = {}}; us \<subseteq> vs\<rbrakk> \<Longrightarrow> us \<in> {vs. vs \<subseteq> uverts G \<and> all_edges vs \<inter> uedges G = {}}
[PROOF STEP]
by auto


[STATEMENT]
lemma ordered_complement_mat_map: "ordered_comp.N = map_mat (\<lambda>x. if x = 1 then 0 else 1) N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordered_comp.N = map_mat (\<lambda>x. if x = 1 then 0 else 1) N
[PROOF STEP]
apply (intro eq_matI, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < ordered_comp.\<v>; j < length \<B>s\<rbrakk> \<Longrightarrow> (N $$ (i, j) = 1 \<longrightarrow> ordered_comp.N $$ (i, j) = 0) \<and> (N $$ (i, j) \<noteq> 1 \<longrightarrow> ordered_comp.N $$ (i, j) = 1)
[PROOF STEP]
using ordered_incidence_system.matrix_point_in_block_iff ordered_incidence_system_axioms
    complement_mat_entries_val
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ordered_incidence_system ?\<V>s ?\<B>s; ?i < card (set ?\<V>s); ?j < size (mset ?\<B>s)\<rbrakk> \<Longrightarrow> (inc_mat_of ?\<V>s ?\<B>s $$ (?i, ?j) = 1) = (?\<V>s ! ?i \<in> ?\<B>s ! ?j)
ordered_incidence_system \<V>s \<B>s
\<lbrakk>?i < ordered_comp.\<v>; ?j < \<b>\<rbrakk> \<Longrightarrow> ordered_comp.N $$ (?i, ?j) = (if \<V>s ! ?i \<in> \<B>s ! ?j then 0 else 1)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < ordered_comp.\<v>; j < length \<B>s\<rbrakk> \<Longrightarrow> (N $$ (i, j) = 1 \<longrightarrow> ordered_comp.N $$ (i, j) = 0) \<and> (N $$ (i, j) \<noteq> 1 \<longrightarrow> ordered_comp.N $$ (i, j) = 1)
[PROOF STEP]
by (metis blocks_list_length)


[STATEMENT]
lemma subspace_inter: "subspace A \<Longrightarrow> subspace B \<Longrightarrow> subspace (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subspace A; subspace B\<rbrakk> \<Longrightarrow> subspace (A \<inter> B)
[PROOF STEP]
by (simp add: subspace_def)


[STATEMENT]
lemma octo_cnj_mult_conv_norm: "cnj x * x = octo_of_real (norm x) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Octonions.cnj x * x = (octo_of_real (norm x))\<^sup>2
[PROOF STEP]
by (simp add: octo_eq_iff octo_mult_components norm_octo_def power2_eq_square
           flip: octo_of_real_power)


[STATEMENT]
lemma interpret_floatarith_inner_eq:
  assumes "length xs = length ys"
  shows "interpret_floatarith (inner_floatariths xs ys) vs =
    (\<Sum>i<length ys. (interpret_floatariths xs vs ! i) * (interpret_floatariths ys vs ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)
[PROOF STEP]
proof (induction rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. interpret_floatarith (inner_floatariths [] []) vs = (\<Sum>i<length []. interpret_floatariths [] vs ! i * interpret_floatariths [] vs ! i)
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)\<rbrakk> \<Longrightarrow> interpret_floatarith (inner_floatariths (x # xs) (y # ys)) vs = (\<Sum>i<length (y # ys). interpret_floatariths (x # xs) vs ! i * interpret_floatariths (y # ys) vs ! i)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. interpret_floatarith (inner_floatariths [] []) vs = (\<Sum>i<length []. interpret_floatariths [] vs ! i * interpret_floatariths [] vs ! i)
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)\<rbrakk> \<Longrightarrow> interpret_floatarith (inner_floatariths (x # xs) (y # ys)) vs = (\<Sum>i<length (y # ys). interpret_floatariths (x # xs) vs ! i * interpret_floatariths (y # ys) vs ! i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interpret_floatarith (inner_floatariths [] []) vs = (\<Sum>i<length []. interpret_floatariths [] vs ! i * interpret_floatariths [] vs ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
interpret_floatarith (inner_floatariths [] []) vs = (\<Sum>i<length []. interpret_floatariths [] vs ! i * interpret_floatariths [] vs ! i)

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)\<rbrakk> \<Longrightarrow> interpret_floatarith (inner_floatariths (x # xs) (y # ys)) vs = (\<Sum>i<length (y # ys). interpret_floatariths (x # xs) vs ! i * interpret_floatariths (y # ys) vs ! i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)\<rbrakk> \<Longrightarrow> interpret_floatarith (inner_floatariths (x # xs) (y # ys)) vs = (\<Sum>i<length (y # ys). interpret_floatariths (x # xs) vs ! i * interpret_floatariths (y # ys) vs ! i)
[PROOF STEP]
case (Cons x xs y ys)
[PROOF STATE]
proof (state)
this:
length xs = length ys
interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)\<rbrakk> \<Longrightarrow> interpret_floatarith (inner_floatariths (x # xs) (y # ys)) vs = (\<Sum>i<length (y # ys). interpret_floatariths (x # xs) vs ! i * interpret_floatariths (y # ys) vs ! i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs = length ys
interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)

goal (1 subgoal):
 1. interpret_floatarith (inner_floatariths (x # xs) (y # ys)) vs = (\<Sum>i<length (y # ys). interpret_floatariths (x # xs) vs ! i * interpret_floatariths (y # ys) vs ! i)
[PROOF STEP]
unfolding length_Cons sum.lessThan_Suc_shift
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
interpret_floatarith (inner_floatariths xs ys) vs = (\<Sum>i<length ys. interpret_floatariths xs vs ! i * interpret_floatariths ys vs ! i)

goal (1 subgoal):
 1. interpret_floatarith (inner_floatariths (x # xs) (y # ys)) vs = interpret_floatariths (x # xs) vs ! 0 * interpret_floatariths (y # ys) vs ! 0 + (\<Sum>i<length ys. interpret_floatariths (x # xs) vs ! Suc i * interpret_floatariths (y # ys) vs ! Suc i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
interpret_floatarith (inner_floatariths (x # xs) (y # ys)) vs = (\<Sum>i<length (y # ys). interpret_floatariths (x # xs) vs ! i * interpret_floatariths (y # ys) vs ! i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma element_generates_subgroup:
  assumes finite[simp]: "finite (carrier G)"
  assumes a[simp]: "a \<in> carrier G"
  shows "subgroup {a [^] i | i. i \<in> {0 .. ord a - 1}} G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup {a [^] i |i. i \<in> {0..ord a - 1}} G
[PROOF STEP]
using generate_is_subgroup[of "{ a }"] assms(2)
        generate_pow_on_finite_carrier[OF assms]
[PROOF STATE]
proof (prove)
using this:
{a} \<subseteq> carrier G \<Longrightarrow> subgroup (generate G {a}) G
a \<in> carrier G
generate G {a} = {a [^] k |k. k \<in> UNIV}

goal (1 subgoal):
 1. subgroup {a [^] i |i. i \<in> {0..ord a - 1}} G
[PROOF STEP]
unfolding ord_elems[OF assms]
[PROOF STATE]
proof (prove)
using this:
{a} \<subseteq> carrier G \<Longrightarrow> subgroup (generate G {a}) G
a \<in> carrier G
generate G {a} = {a [^] k |k. k \<in> {0..ord a - 1}}

goal (1 subgoal):
 1. subgroup {a [^] i |i. i \<in> {0..ord a - 1}} G
[PROOF STEP]
by auto


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


[STATEMENT]
lemma fls_divide_fps_to_fls:
  fixes f g :: "'a::{inverse,ab_group_add,mult_zero} fps"
  assumes "subdegree f \<ge> subdegree g"
  shows   "fps_to_fls f / fps_to_fls g = fps_to_fls (f/g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_to_fls f / fps_to_fls g = fps_to_fls (f / g)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_to_fls f / fps_to_fls g = fps_to_fls (f / g)
[PROOF STEP]
have 1:
    "fps_to_fls f / fps_to_fls g =
      fls_shift (int (subdegree g)) (fps_to_fls (f * inverse (unit_factor g)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_to_fls f / fps_to_fls g = fls_shift (int (subdegree g)) (fps_to_fls (f * inverse (unit_factor g)))
[PROOF STEP]
using fls_base_factor_to_fps_to_fls[of f] fls_base_factor_to_fps_to_fls[of g]
          fls_subdegree_fls_to_fps[of f] fls_subdegree_fls_to_fps[of g]
          fps_divide_def[of "unit_factor f" "unit_factor g"]
          fls_times_fps_to_fls[of "unit_factor f" "inverse (unit_factor g)"]
          fls_shifted_times_simps(2)[of "-int (subdegree f)" "fps_to_fls (unit_factor f)"]
          fls_times_fps_to_fls[of f "inverse (unit_factor g)"]
[PROOF STATE]
proof (prove)
using this:
fls_base_factor_to_fps (fps_to_fls f) = unit_factor f
fls_base_factor_to_fps (fps_to_fls g) = unit_factor g
fls_subdegree (fps_to_fls f) = int (subdegree f)
fls_subdegree (fps_to_fls g) = int (subdegree g)
unit_factor f / unit_factor g = fps_shift (subdegree (unit_factor g)) (unit_factor f * inverse (unit_factor (unit_factor g)))
fps_to_fls (unit_factor f * inverse (unit_factor g)) = fps_to_fls (unit_factor f) * fps_to_fls (inverse (unit_factor g))
fls_shift (- int (subdegree f)) (fps_to_fls (unit_factor f)) * ?g = fls_shift (- int (subdegree f)) (fps_to_fls (unit_factor f) * ?g)
fps_to_fls (f * inverse (unit_factor g)) = fps_to_fls f * fps_to_fls (inverse (unit_factor g))

goal (1 subgoal):
 1. fps_to_fls f / fps_to_fls g = fls_shift (int (subdegree g)) (fps_to_fls (f * inverse (unit_factor g)))
[PROOF STEP]
by    (simp add: fls_divide_def)
[PROOF STATE]
proof (state)
this:
fps_to_fls f / fps_to_fls g = fls_shift (int (subdegree g)) (fps_to_fls (f * inverse (unit_factor g)))

goal (1 subgoal):
 1. fps_to_fls f / fps_to_fls g = fps_to_fls (f / g)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
subdegree g \<le> subdegree f
fps_to_fls f / fps_to_fls g = fls_shift (int (subdegree g)) (fps_to_fls (f * inverse (unit_factor g)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subdegree g \<le> subdegree f
fps_to_fls f / fps_to_fls g = fls_shift (int (subdegree g)) (fps_to_fls (f * inverse (unit_factor g)))

goal (1 subgoal):
 1. fps_to_fls f / fps_to_fls g = fps_to_fls (f / g)
[PROOF STEP]
using fps_mult_subdegree_ge[of f "inverse (unit_factor g)"]
          fps_shift_to_fls[of "subdegree g" "f * inverse (unit_factor g)"]
[PROOF STATE]
proof (prove)
using this:
subdegree g \<le> subdegree f
fps_to_fls f / fps_to_fls g = fls_shift (int (subdegree g)) (fps_to_fls (f * inverse (unit_factor g)))
f * inverse (unit_factor g) \<noteq> 0 \<Longrightarrow> subdegree f + subdegree (inverse (unit_factor g)) \<le> subdegree (f * inverse (unit_factor g))
subdegree g \<le> subdegree (f * inverse (unit_factor g)) \<Longrightarrow> fps_to_fls (fps_shift (subdegree g) (f * inverse (unit_factor g))) = fls_shift (int (subdegree g)) (fps_to_fls (f * inverse (unit_factor g)))

goal (1 subgoal):
 1. fps_to_fls f / fps_to_fls g = fps_to_fls (f / g)
[PROOF STEP]
by    (cases "f * inverse (unit_factor g) = 0") (simp_all add: fps_divide_def)
[PROOF STATE]
proof (state)
this:
fps_to_fls f / fps_to_fls g = fps_to_fls (f / g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dense_lattice_char_2:
  "(\<forall>x y . x \<sqinter> y = bot \<longrightarrow> x = bot \<or> y = bot) \<longleftrightarrow> (\<forall>x . regular x \<longrightarrow> x = bot \<or> x = top)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. x \<sqinter> y = bot \<longrightarrow> x = bot \<or> y = bot) = (\<forall>x. regular x \<longrightarrow> x = bot \<or> x = top)
[PROOF STEP]
by (metis dense_lattice_char_1 inf_top.left_neutral p_inf regular_closed_p regular_closed_top)


[STATEMENT]
lemma median_commute_mono:
  assumes "n > 0"
  assumes "mono g"
  shows "g (median n f) = median n (g \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (median n f) = median n (g \<circ> f)
[PROOF STEP]
apply (simp add: median_def del:map_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (sort (map f [0..<n]) ! (n div 2)) = sort (map (g \<circ> f) [0..<n]) ! (n div 2)
[PROOF STEP]
apply (subst map_map[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (sort (map f [0..<n]) ! (n div 2)) = sort (map g (map f [0..<n])) ! (n div 2)
[PROOF STEP]
apply (subst map_sort[OF assms(2)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (sort (map f [0..<n]) ! (n div 2)) = map g (sort (map f [0..<n])) ! (n div 2)
[PROOF STEP]
apply (subst nth_map, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n div 2 < n
 2. g (sort (map f [0..<n]) ! (n div 2)) = g (sort (map f [0..<n]) ! (n div 2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
mono g

goal (2 subgoals):
 1. n div 2 < n
 2. g (sort (map f [0..<n]) ! (n div 2)) = g (sort (map f [0..<n]) ! (n div 2))
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (sort (map f [0..<n]) ! (n div 2)) = g (sort (map f [0..<n]) ! (n div 2))
[PROOF STEP]
by simp


[STATEMENT]
lemma div_mult_le: "m div n * n \<le> m" for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m div n * n \<le> m
[PROOF STEP]
by (fact div_times_less_eq_dividend)


[STATEMENT]
lemma is_bezout_euclid_ext: "is_bezout (\<lambda>a b. (fst (bezout_coefficients a b), snd (bezout_coefficients a b), gcd a b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_bezout (\<lambda>a b. (fst (bezout_coefficients a b), snd (bezout_coefficients a b), gcd a b))
[PROOF STEP]
by (auto simp add: is_bezout_def bezout_coefficients)


[STATEMENT]
lemma rcis_plus_2pi[simp]: "rcis y (x + 2 * pi) = rcis y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rcis y (x + 2 * pi) = rcis y x
[PROOF STEP]
unfolding rcis_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real y * cis (x + 2 * pi) = complex_of_real y * cis x
[PROOF STEP]
by simp


[STATEMENT]
lemma iMODb_plus: "
  \<lbrakk> x \<in> [r, mod m, c]; k \<le> r + m * c - x \<rbrakk> \<Longrightarrow>
  (x + k \<in> [r, mod m, c]) = (k mod m = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> r + m * c - x\<rbrakk> \<Longrightarrow> (x + k \<in> [ r, mod m, c ]) = (k mod m = 0)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> r + m * c - x; x + k \<in> [ r, mod m, c ]\<rbrakk> \<Longrightarrow> k mod m = 0
 2. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> r + m * c - x; m dvd k\<rbrakk> \<Longrightarrow> x + k \<in> [ r, mod m, c ]
[PROOF STEP]
apply (rule mod_add_eq_imp_mod_0[of x, THEN iffD1])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> r + m * c - x; x + k \<in> [ r, mod m, c ]\<rbrakk> \<Longrightarrow> (x + k) mod m = x mod m
 2. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> r + m * c - x; m dvd k\<rbrakk> \<Longrightarrow> x + k \<in> [ r, mod m, c ]
[PROOF STEP]
apply (simp add: iT_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> r + m * c - x; m dvd k\<rbrakk> \<Longrightarrow> x + k \<in> [ r, mod m, c ]
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma infnorm_cart:"infnorm (x::real^'n) = Sup {\<bar>x$i\<bar> |i. i\<in>UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infnorm x = Sup {\<bar>x $ i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
by (simp add: infnorm_def inner_axis Basis_vec_def) (metis (lifting) inner_axis real_inner_1_right)


[STATEMENT]
lemma bv_or_is_node: "\<lbrakk>nfa_is_node A p; nfa_is_node A q\<rbrakk> \<Longrightarrow> nfa_is_node A (bv_or p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nfa_is_node A p; nfa_is_node A q\<rbrakk> \<Longrightarrow> nfa_is_node A (bv_or p q)
[PROOF STEP]
by (simp add: bv_or_length nfa_is_node_def)


[STATEMENT]
lemma uniformly_Cauchy_imp_Cauchy:
  "uniformly_Cauchy_on X f \<Longrightarrow> x \<in> X \<Longrightarrow> Cauchy (\<lambda>n. f n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>uniformly_Cauchy_on X f; x \<in> X\<rbrakk> \<Longrightarrow> Cauchy (\<lambda>n. f n x)
[PROOF STEP]
unfolding Cauchy_def uniformly_Cauchy_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>e>0. \<exists>M. \<forall>x\<in>X. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x) (f n x) < e; x \<in> X\<rbrakk> \<Longrightarrow> \<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x) (f n x) < e
[PROOF STEP]
by fast


[STATEMENT]
lemma ln_mono_strict: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> x < y \<Longrightarrow> ln (x::real) < ln y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < y; x < y\<rbrakk> \<Longrightarrow> ln x < ln y
[PROOF STEP]
by (subst ln_less_cancel_iff) simp_all


[STATEMENT]
lemma ptensor_mat_mult_vec:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "v1 \<in> carrier_vec d1"
    and "m2 \<in> carrier_mat d2 d2"
    and "v2 \<in> carrier_vec d2"
  shows "ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2
[PROOF STEP]
interpret st: partial_state dims0 vars1'
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2
[PROOF STEP]
have "st.d1 = d1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.d1 = d1
[PROOF STEP]
unfolding st.d1_def st.dims1_def d1_def nths_vars1'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list dims1 = prod_list dims1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.d1 = d1

goal (1 subgoal):
 1. ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
st.d1 = d1

goal (1 subgoal):
 1. ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2
[PROOF STEP]
have "st.d2 = d2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.d2 = d2
[PROOF STEP]
unfolding st.d2_def st.dims2_def d2_def nths_vars2'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list dims2 = prod_list dims2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.d2 = d2

goal (1 subgoal):
 1. ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
st.d1 = d1
st.d2 = d2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
st.d1 = d1
st.d2 = d2

goal (1 subgoal):
 1. ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2
[PROOF STEP]
unfolding ptensor_mat_def ptensor_vec_def
[PROOF STATE]
proof (prove)
using this:
st.d1 = d1
st.d2 = d2

goal (1 subgoal):
 1. st.tensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = st.tensor_mat m1 m2 *\<^sub>v st.tensor_vec v1 v2
[PROOF STEP]
using st.tensor_mat_mult_vec assms
[PROOF STATE]
proof (prove)
using this:
st.d1 = d1
st.d2 = d2
\<lbrakk>?m1.0 \<in> carrier_mat st.d1 st.d1; ?m2.0 \<in> carrier_mat st.d2 st.d2; ?v1.0 \<in> carrier_vec st.d1; ?v2.0 \<in> carrier_vec st.d2\<rbrakk> \<Longrightarrow> st.tensor_vec (?m1.0 *\<^sub>v ?v1.0) (?m2.0 *\<^sub>v ?v2.0) = st.tensor_mat ?m1.0 ?m2.0 *\<^sub>v st.tensor_vec ?v1.0 ?v2.0
m1 \<in> carrier_mat d1 d1
v1 \<in> carrier_vec d1
m2 \<in> carrier_mat d2 d2
v2 \<in> carrier_vec d2

goal (1 subgoal):
 1. st.tensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = st.tensor_mat m1 m2 *\<^sub>v st.tensor_vec v1 v2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ptensor_vec (m1 *\<^sub>v v1) (m2 *\<^sub>v v2) = ptensor_mat m1 m2 *\<^sub>v ptensor_vec v1 v2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_alls2:
  "set (alls2 A B a b) = {((x, s), (y, t)). length x = length a \<and> length y = length b \<and>
    (\<forall>i<length a. x ! i \<le> A) \<and> (\<forall>j<length b. y ! j \<le> B) \<and> s = a \<bullet> x \<and> t = b \<bullet> y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (alls2 A B a b) = {((x, s), y, t). length x = length a \<and> length y = length b \<and> (\<forall>i<length a. x ! i \<le> A) \<and> (\<forall>j<length b. y ! j \<le> B) \<and> s = a \<bullet> x \<and> t = b \<bullet> y}
[PROOF STEP]
by (auto simp: alls2_def set_alls)


[STATEMENT]
lemma Ord_TC_less_iff: "\<lbrakk>Ord \<alpha>; Ord \<beta>\<rbrakk> \<Longrightarrow> \<beta> \<sqsubset> \<alpha> \<longleftrightarrow> \<beta> < \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ord \<alpha>; Ord \<beta>\<rbrakk> \<Longrightarrow> (\<beta> \<sqsubset> \<alpha>) = (\<beta> < \<alpha>)
[PROOF STEP]
by (metis Ord_def Ord_mem_iff_lt Transset_TC_eq less_TC_def)


[STATEMENT]
lemma less_1_mult':
  fixes a::"'a::linordered_semidom"
  shows "1 < a \<Longrightarrow> 1 \<le> b \<Longrightarrow> 1 < a * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(1::'a) < a; (1::'a) \<le> b\<rbrakk> \<Longrightarrow> (1::'a) < a * b
[PROOF STEP]
by (metis le_less less_1_mult mult.right_neutral)


[STATEMENT]
lemma of_nat_qr_eq_0_iff [simp]:
  "of_nat n = (0 :: 'a :: qr_spec qr) \<longleftrightarrow> CARD('a) dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat n = 0) = (CARD('a) dvd n)
[PROOF STEP]
using of_int_qr_eq_0_iff[of "int n"]
[PROOF STATE]
proof (prove)
using this:
(of_int (int n) = 0) = (int CARD(?'a) dvd int n)

goal (1 subgoal):
 1. (of_nat n = 0) = (CARD('a) dvd n)
[PROOF STEP]
by simp


[STATEMENT]
lemma fstar_comm:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  shows "Inf_pres f \<Longrightarrow> f \<circ> fstar f = fstar f \<circ> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> f \<circ> fstar f = fstar f \<circ> f
[PROOF STEP]
apply (simp add: fun_eq_iff fstar_def image_comp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f (\<Sqinter> x) = \<Sqinter> (f ` x) \<Longrightarrow> \<forall>x. (\<Sqinter>xa. f (fpower f xa x)) = (\<Sqinter>xa. fpower f xa (f x))
[PROOF STEP]
by (metis (mono_tags, lifting) INF_cong comp_eq_dest fun_mon.power_commutes)