[STATEMENT]
lemma reduced_homology_group_pair:
  assumes "t1_space X" and a: "a \<in> topspace X" and b: "b \<in> topspace X" and "a \<noteq> b"
  shows "reduced_homology_group p (subtopology X {a,b}) \<cong> homology_group p (subtopology X {a})"
        (is  "?lhs \<cong> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
have "?lhs \<cong> relative_homology_group p (subtopology X {a,b}) {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_homology_group p (subtopology X {a, b}) \<cong> relative_homology_group p (subtopology X {a, b}) {b}
[PROOF STEP]
by (simp add: b isomorphic_reduced_homology_by_singleton topspace_subtopology)
[PROOF STATE]
proof (state)
this:
reduced_homology_group p (subtopology X {a, b}) \<cong> relative_homology_group p (subtopology X {a, b}) {b}

goal (1 subgoal):
 1. reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
reduced_homology_group p (subtopology X {a, b}) \<cong> relative_homology_group p (subtopology X {a, b}) {b}

goal (1 subgoal):
 1. reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
have "\<dots> \<cong> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relative_homology_group p (subtopology X {a, b}) {b} \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. relative_homology_group p (subtopology X {a, b}) {b} \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
have sub: "subtopology X {a, b} closure_of {b} \<subseteq> subtopology X {a, b} interior_of {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology X {a, b} closure_of {b} \<subseteq> subtopology X {a, b} interior_of {b}
[PROOF STEP]
by (simp add: assms t1_space_subtopology closure_of_singleton subtopology_eq_discrete_topology_finite discrete_topology_closure_of)
[PROOF STATE]
proof (state)
this:
subtopology X {a, b} closure_of {b} \<subseteq> subtopology X {a, b} interior_of {b}

goal (1 subgoal):
 1. relative_homology_group p (subtopology X {a, b}) {b} \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relative_homology_group p (subtopology X {a, b}) {b} \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
using homology_excision_axiom [OF sub, of "{a,b}" p]
[PROOF STATE]
proof (prove)
using this:
{b} \<subseteq> {a, b} \<Longrightarrow> hom_induced p (subtopology (subtopology X {a, b}) ({a, b} - {b})) ({b} - {b}) (subtopology (subtopology X {a, b}) {a, b}) {b} id \<in> Group.iso (relative_homology_group p (subtopology (subtopology X {a, b}) ({a, b} - {b})) ({b} - {b})) (relative_homology_group p (subtopology (subtopology X {a, b}) {a, b}) {b})

goal (1 subgoal):
 1. relative_homology_group p (subtopology X {a, b}) {b} \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
by (simp add: assms(4) group.iso_sym is_isoI subtopology_subtopology)
[PROOF STATE]
proof (state)
this:
relative_homology_group p (subtopology X {a, b}) {b} \<cong> homology_group p (subtopology X {a})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
relative_homology_group p (subtopology X {a, b}) {b} \<cong> homology_group p (subtopology X {a})

goal (1 subgoal):
 1. reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})

goal (1 subgoal):
 1. reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
reduced_homology_group p (subtopology X {a, b}) \<cong> homology_group p (subtopology X {a})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma combine_lists_concat_rev_eq: "concat (rev (combine_lists_P P y xs)) = concat (rev xs) @ y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (rev (combine_lists_P P y xs)) = concat (rev xs) @ y
[PROOF STEP]
by (induction P y xs rule: combine_lists_P.induct) auto


[STATEMENT]
lemma graph_eq_iff: "g=g' \<longleftrightarrow> nodes g = nodes g' \<and> edges g = edges g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g = g') = (nodes g = nodes g' \<and> edges g = edges g')
[PROOF STEP]
unfolding edges_def nodes_def graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g = g') = (nodes_internal g = nodes_internal g' \<and> edges_internal g = edges_internal g')
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma inverse_of_nat_le:
  fixes n::nat shows "\<lbrakk>n \<le> m; n\<noteq>0\<rbrakk> \<Longrightarrow> 1 / of_nat m \<le> (1::'a::linordered_field) / of_nat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> m; n \<noteq> 0\<rbrakk> \<Longrightarrow> (1::'a) / of_nat m \<le> (1::'a) / of_nat n
[PROOF STEP]
by (simp add: frac_le)


[STATEMENT]
lemma unit_disc_cmod_square_lt_1 [simp]:
  assumes "z \<in> unit_disc"
  shows "(cmod (to_complex z))\<^sup>2 < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (to_complex z))\<^sup>2 < 1
[PROOF STEP]
using assms inf_or_of_complex[of z]
[PROOF STATE]
proof (prove)
using this:
z \<in> unit_disc
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)

goal (1 subgoal):
 1. (cmod (to_complex z))\<^sup>2 < 1
[PROOF STEP]
by (auto simp add: abs_square_less_1)


[STATEMENT]
lemma clique_max_size : "uclique C G p \<Longrightarrow> finite (uverts G) \<Longrightarrow>  p \<le> card (uverts G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>uclique C G p; finite (uverts G)\<rbrakk> \<Longrightarrow> p \<le> card (uverts G)
[PROOF STEP]
by (auto simp add: uclique_def subgraph_def Finite_Set.card_mono)


[STATEMENT]
lemma frac_le_1I:
  assumes "0 \<le> x" "x \<le> 1" "x \<le> y"
  shows "frac x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frac x \<le> y
[PROOF STEP]
using assms dual_order.trans frac_le_self
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> x
x \<le> (1::'a)
x \<le> y
\<lbrakk>?b \<le> ?a; ?c \<le> ?b\<rbrakk> \<Longrightarrow> ?c \<le> ?a
(0::?'a) \<le> ?x \<Longrightarrow> frac ?x \<le> ?x

goal (1 subgoal):
 1. frac x \<le> y
[PROOF STEP]
by auto


[STATEMENT]
lemma map_option_in_optionI:
  "\<lbrakk> ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S \<rbrakk>
  \<Longrightarrow> map_option f ox \<in> opt S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S\<rbrakk> \<Longrightarrow> map_option f ox \<in> opt S
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S\<rbrakk> \<Longrightarrow> map_option f ox \<in> opt S
[PROOF STEP]
apply (unfold map_option_case)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S\<rbrakk> \<Longrightarrow> (case ox of None \<Rightarrow> None | Some x \<Rightarrow> Some (f x)) \<in> opt S
[PROOF STEP]
apply (simp split: option.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S\<rbrakk> \<Longrightarrow> \<forall>x2. ox = Some x2 \<longrightarrow> f x2 \<in> S
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nn_integral_measure_pmf_support:
  fixes f :: "'a \<Rightarrow> ennreal"
  assumes f: "finite A" and nn: "\<And>x. x \<in> A \<Longrightarrow> 0 \<le> f x" "\<And>x. x \<in> set_pmf M \<Longrightarrow> x \<notin> A \<Longrightarrow> f x = 0"
  shows "(\<integral>\<^sup>+x. f x \<partial>measure_pmf M) = (\<Sum>x\<in>A. f x * pmf M x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * ennreal (pmf M x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * ennreal (pmf M x))
[PROOF STEP]
have "(\<integral>\<^sup>+x. f x \<partial>M) = (\<integral>\<^sup>+x. f x * indicator A x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = set_nn_integral (measure_pmf M) A f
[PROOF STEP]
using nn
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> 0 \<le> f ?x
\<lbrakk>?x \<in> set_pmf M; ?x \<notin> A\<rbrakk> \<Longrightarrow> f ?x = 0

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = set_nn_integral (measure_pmf M) A f
[PROOF STEP]
by (intro nn_integral_cong_AE) (auto simp: AE_measure_pmf_iff split: split_indicator)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf M) f = set_nn_integral (measure_pmf M) A f

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * ennreal (pmf M x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf M) f = set_nn_integral (measure_pmf M) A f

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * ennreal (pmf M x))
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>A. f x * emeasure M {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral (measure_pmf M) A f = (\<Sum>x\<in>A. f x * emeasure (measure_pmf M) {x})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
?x \<in> A \<Longrightarrow> 0 \<le> f ?x
\<lbrakk>?x \<in> set_pmf M; ?x \<notin> A\<rbrakk> \<Longrightarrow> f ?x = 0

goal (1 subgoal):
 1. set_nn_integral (measure_pmf M) A f = (\<Sum>x\<in>A. f x * emeasure (measure_pmf M) {x})
[PROOF STEP]
by (intro nn_integral_indicator_finite) auto
[PROOF STATE]
proof (state)
this:
set_nn_integral (measure_pmf M) A f = (\<Sum>x\<in>A. f x * emeasure (measure_pmf M) {x})

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * ennreal (pmf M x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * emeasure (measure_pmf M) {x})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * emeasure (measure_pmf M) {x})

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * ennreal (pmf M x))
[PROOF STEP]
by (simp add: emeasure_measure_pmf_finite)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>A. f x * ennreal (pmf M x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reduction_doesnt_break_length_signs_R:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "(nat list*nat list) list"
  fixes signs :: "rat list list"
  assumes length_init : "\<forall> x\<in> set(signs). length x = length qs"
  assumes sat_eq: "satisfy_equation_R p qs subsets signs"
  assumes inv_mat: "invertible_mat (matrix_A_R signs subsets)"
  shows "\<forall>x \<in> set(reduction_signs_R p qs signs subsets (matrix_A_R signs subsets)).
    length x = length qs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set (reduction_signs_R p qs signs subsets (M_mat_R signs subsets)). length x = length qs
[PROOF STEP]
unfolding reduction_signs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set (reduction_signs_R p qs signs subsets (M_mat_R signs subsets)). length x = length qs
[PROOF STEP]
using take_indices_lem
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?n < length (take_indices ?arb_list ?index_list); \<forall>q. List.member ?index_list q \<longrightarrow> q < length ?arb_list\<rbrakk> \<Longrightarrow> \<exists>k<length ?arb_list. take_indices ?arb_list ?index_list ! ?n = ?arb_list ! k

goal (1 subgoal):
 1. \<forall>x\<in>set (reduction_signs_R p qs signs subsets (M_mat_R signs subsets)). length x = length qs
[PROOF STEP]
by (smt (verit) atLeastLessThan_iff construct_lhs_matches_solve_for_lhs_R filter_is_subset find_nonzeros_from_input_vec_def in_set_conv_nth in_set_member inv_mat length_init reduction_signs_R_def sat_eq set_upt size_of_lhs_R subset_code(1))


[STATEMENT]
lemma powrat_le_cancel_iff [simp]:
  "1 < x \<Longrightarrow> (x  pow\<^sub>\<rat> r \<le> x  pow\<^sub>\<rat> s) = (r \<le> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> (x pow\<^sub>\<rat> r \<le> x pow\<^sub>\<rat> s) = (r \<le> s)
[PROOF STEP]
by (simp add: linorder_not_less [symmetric])


[STATEMENT]
lemma "list_all P xs \<Longrightarrow> \<forall>x\<in> set xs. P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all P xs \<Longrightarrow> \<forall>x\<in>set xs. P x
[PROOF STEP]
using list_all_iff list.pred_set
[PROOF STATE]
proof (prove)
using this:
list_all ?P ?x = Ball (set ?x) ?P
list_all ?P = (\<lambda>x. Ball (set x) ?P)

goal (1 subgoal):
 1. list_all P xs \<Longrightarrow> \<forall>x\<in>set xs. P x
[PROOF STEP]
by (simp add: list_all_iff)


[STATEMENT]
lemma det_swaprows_mat: assumes k: "k < n" and l: "l < n" and kl: "k \<noteq> l"
  shows "det (swaprows_mat n k l) = - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swaprows_mat n k l) = - (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (swaprows_mat n k l) = - (1::'a)
[PROOF STEP]
let ?n = "{0 ..< (n :: nat)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (swaprows_mat n k l) = - (1::'a)
[PROOF STEP]
let ?p = "transpose k l"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (swaprows_mat n k l) = - (1::'a)
[PROOF STEP]
have p: "?p permutes ?n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Transposition.transpose k l permutes {0..<n}
[PROOF STEP]
by (rule permutes_swap_id, insert k l, auto)
[PROOF STATE]
proof (state)
this:
Transposition.transpose k l permutes {0..<n}

goal (1 subgoal):
 1. det (swaprows_mat n k l) = - (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swaprows_mat n k l) = - (1::'a)
[PROOF STEP]
by (rule trans[OF trans[OF _ det_permute_rows[OF one_carrier_mat[of n] p]]],
    subst swap_rows_mat_eq_permute[OF k l], auto simp: sign_swap_id kl)
[PROOF STATE]
proof (state)
this:
det (swaprows_mat n k l) = - (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_subset_contains_Sup:
  fixes A C :: "real set"
  shows "closed C \<Longrightarrow> A \<subseteq> C \<Longrightarrow> A \<noteq> {} \<Longrightarrow> bdd_above A \<Longrightarrow> Sup A \<in> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closed C; A \<subseteq> C; A \<noteq> {}; bdd_above A\<rbrakk> \<Longrightarrow> Sup A \<in> C
[PROOF STEP]
by (metis closure_contains_Sup closure_minimal subset_eq)


[STATEMENT]
lemma integral_sin_Z [simp]:
  assumes "n \<in> \<int>"
  shows "integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. sin(x * n)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|lebesgue_on {- pi..pi}. sin (x * n) = 0
[PROOF STEP]
proof (subst lebesgue_integral_eq_integral)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. sin (x * n))
 2. {- pi..pi} \<in> sets lebesgue
 3. integral {- pi..pi} (\<lambda>x. sin (x * n)) = 0
[PROOF STEP]
show "integrable (lebesgue_on {-pi..pi}) (\<lambda>x. sin (x * n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. sin (x * n))
[PROOF STEP]
by (intro continuous_imp_integrable_real continuous_intros)
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {- pi..pi}) (\<lambda>x. sin (x * n))

goal (2 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. integral {- pi..pi} (\<lambda>x. sin (x * n)) = 0
[PROOF STEP]
show "integral {-pi..pi} (\<lambda>x. sin (x * n)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {- pi..pi} (\<lambda>x. sin (x * n)) = 0
[PROOF STEP]
using assms Ints_cases integral_sin_nx
[PROOF STATE]
proof (prove)
using this:
n \<in> \<int>
\<lbrakk>?q \<in> \<int>; \<And>z. ?q = of_int z \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
integral {- pi..pi} (\<lambda>x. sin (x * real_of_int ?n)) = 0

goal (1 subgoal):
 1. integral {- pi..pi} (\<lambda>x. sin (x * n)) = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integral {- pi..pi} (\<lambda>x. sin (x * n)) = 0

goal (1 subgoal):
 1. {- pi..pi} \<in> sets lebesgue
[PROOF STEP]
qed auto


[STATEMENT]
lemma (in sigma_algebra) sets_Collect_countable_Ex1:
  "(\<And>i :: 'i :: countable. {x \<in> \<Omega>. P i x} \<in> M) \<Longrightarrow> {x \<in> \<Omega>. \<exists>!i. P i x} \<in> M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. {x \<in> \<Omega>. P i x} \<in> M) \<Longrightarrow> {x \<in> \<Omega>. \<exists>!i. P i x} \<in> M
[PROOF STEP]
using sets_Collect_countable_Ex1'[of "UNIV :: 'i set"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i \<in> UNIV \<Longrightarrow> {x \<in> \<Omega>. ?P i x} \<in> M; countable UNIV\<rbrakk> \<Longrightarrow> {x \<in> \<Omega>. \<exists>!i. i \<in> UNIV \<and> ?P i x} \<in> M

goal (1 subgoal):
 1. (\<And>i. {x \<in> \<Omega>. P i x} \<in> M) \<Longrightarrow> {x \<in> \<Omega>. \<exists>!i. P i x} \<in> M
[PROOF STEP]
by simp


[STATEMENT]
lemma lfinite_llength_enat:
  assumes "lfinite xs"
  shows "\<exists>n. llength xs = enat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. llength xs = enat n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lfinite xs

goal (1 subgoal):
 1. \<exists>n. llength xs = enat n
[PROOF STEP]
by induct(auto simp add: eSuc_def zero_enat_def)


[STATEMENT]
lemma finite_setcompr_eq_image: "finite {f x |x. P x} \<longleftrightarrow> finite (f ` {x. P x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f x |x. P x} = finite (f ` {x. P x})
[PROOF STEP]
by (simp add: setcompr_eq_image)


[STATEMENT]
lemma tt_2: assumes dx: "dim_vec x = 2"
  and be: "x $ 0 = True \<and> x $ 1 = True"
  shows "ceros_of_boolean_input x = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input x = {}
[PROOF STEP]
using dx be
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 2
x $ 0 = True \<and> x $ 1 = True

goal (1 subgoal):
 1. ceros_of_boolean_input x = {}
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 2
x $ 0 = True \<and> x $ 1 = True

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {}
[PROOF STEP]
using less_2_cases
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 2
x $ 0 = True \<and> x $ 1 = True
?n < 2 \<Longrightarrow> ?n = 0 \<or> ?n = Suc 0

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma add_pCons [simp]: "pCons a p + pCons b q = pCons (a + b) (p + q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pCons a p + pCons b q = pCons (a + b) (p + q)
[PROOF STEP]
by (rule poly_eqI) (simp add: coeff_pCons split: nat.split)


[STATEMENT]
lemma convert_closed:
  shows "\<And>i. i \<in> set_fml (fst (convert fml)) \<Longrightarrow> i < length (snd (convert fml))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> set_fml (fst (convert fml)) \<Longrightarrow> i < length (snd (convert fml))
[PROOF STEP]
unfolding convert_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> set_fml (fst (map_fml (index_of (remdups (poly_list fml))) fml, remdups (poly_list fml))) \<Longrightarrow> i < length (snd (map_fml (index_of (remdups (poly_list fml))) fml, remdups (poly_list fml)))
[PROOF STEP]
apply (auto simp add: fml.set_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set_fml fml \<Longrightarrow> index_of (remdups (poly_list fml)) x < length (remdups (poly_list fml))
[PROOF STEP]
by (simp add: index_of_lookup(1) poly_list_set_fml)


[STATEMENT]
lemma (in Ring) npeSum2:
  "\<And> n. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk>
        \<Longrightarrow> npow R (x \<plusminus> y) n =
                nsum R (\<lambda> i. nscal R ((npow R x (n-i)) \<cdot>\<^sub>r (npow R y i))
                                       ( n choose i) ) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (n choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (n - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) n
[PROOF STEP]
apply (cut_tac ring_is_ag)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (n choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (n - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) n
[PROOF STEP]
apply (induct_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R 0\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (0 choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (0 - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) 0
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) Suc na
[PROOF STEP]
(*1*)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R 0\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (0 choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (0 - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) 0
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) Suc na
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> 1\<^sub>r = \<zero> \<plusminus> 1\<^sub>r \<cdot>\<^sub>r 1\<^sub>r
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) Suc na
[PROOF STEP]
apply (cut_tac ring_one, simp add:ring_r_one, simp add:aGroup.ag_l_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) Suc na
[PROOF STEP]
(*1:done*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) Suc na
[PROOF STEP]
apply (subst aGroup.nsumElmTail, assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<forall>i.  (Suc na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>) \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n na i. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow>  (Suc na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>) \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
apply (simp add:nsClose ring_tOp_closed npClose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
(**
thm binomial_Suc_Suc
**)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (Suc na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
apply (simp only:binomial_Suc_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i + (na choose Suc i)) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
apply (simp only: nsDistr [THEN sym] add:npClose ring_tOp_closed)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>) \<plusminus>  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
apply (subst aGroup.nsumElmAdd, assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<forall>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>) \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<forall>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>) \<in> carrier R
 3. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
apply (rule allI,
           simp add:nsClose ring_tOp_closed npClose)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<forall>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>) \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
apply (rule allI,
           simp add:nsClose add:ring_tOp_closed npClose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>)
[PROOF STEP]
apply (subst aGroup.ag_pOp_assoc, assumption)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<in> carrier R
 3. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>) \<in> carrier R
 4. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply (rule aGroup.nsum_mem, assumption,
           rule allI, rule impI,  simp add:nsClose ring_tOp_closed npClose)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>) \<in> carrier R
 3. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply (rule aGroup.nsum_mem, assumption,
           rule allI, rule impI,  simp add:nsClose ring_tOp_closed npClose)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>) \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply (simp add:nsClose ring_tOp_closed npClose)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply (rule aGroup.ag_pOp_closed, assumption)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<zero> \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r \<in> carrier R
 3. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply (simp add:aGroup.ag_inc_zero)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply (rule ring_tOp_closed)+
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x^\<^bsup>R na\<^esup> \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<in> carrier R
 3. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> 1\<^sub>r \<in> carrier R
 4. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply (simp add:npClose, assumption, simp add:ring_one)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y)^\<^bsup>R Suc na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply (subst npMulElmL [THEN sym, of "x \<plusminus> y"],
         simp add:aGroup.ag_pOp_closed, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y) \<cdot>\<^sub>r (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - Suc i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc i\<^esup>)) na \<plusminus>  (Suc na choose 0) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (Suc na - 0)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> (x \<plusminus> y) \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r))
[PROOF STEP]
apply (subst ring_distrib2 [of _ "x" "y"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<in> carrier R
 3. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> y \<in> carrier R
 4. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<plusminus> y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r))
[PROOF STEP]
apply (rule aGroup.nsum_mem,assumption,
         rule allI, rule impI, rule nsClose, rule ring_tOp_closed,
         simp add:npClose, simp add:npClose, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<plusminus> y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r))
[PROOF STEP]
apply (rule aGroup.gEQAddcross [THEN sym], assumption+,
         rule aGroup.nsum_mem, assumption, rule allI, rule impI, rule nsClose,
         (rule ring_tOp_closed)+, simp add:npClose,
         rule ring_tOp_closed, simp add:npClose, assumption)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 3. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 4. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na = y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
 5. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
apply (rule aGroup.ag_pOp_closed, assumption)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r \<in> carrier R
 3. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 4. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 5. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na = y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
 6. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
apply (rule aGroup.nsum_mem, assumption,
           rule allI, rule impI, rule nsClose, rule ring_tOp_closed,
          simp add:npClose, rule ring_tOp_closed, simp add:npClose, assumption)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 3. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 4. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na = y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
 5. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
apply (rule aGroup.ag_pOp_closed, assumption, simp add:ring_zero)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 3. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 4. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na = y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
 5. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
apply ((rule ring_tOp_closed)+,
           simp add:npClose,assumption, simp add:ring_one)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 3. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na = y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
 4. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
apply (rule ring_tOp_closed, assumption,
           rule aGroup.nsum_mem, assumption, rule allI, rule impI,
           rule nsClose, rule ring_tOp_closed,
           (simp add:npClose)+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na \<in> carrier R
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na = y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
 3. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
apply (rule ring_tOp_closed, assumption+,
           rule aGroup.nsum_mem, assumption, rule allI, rule impI,
           rule nsClose,
           rule ring_tOp_closed,
           simp add:npClose, simp add:npClose)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na = y \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
 2. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
apply (subst npeSum2_sub_muly [of "x" "y"], assumption+, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
(* final part *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = x \<cdot>\<^sub>r \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na
[PROOF STEP]
apply (subst npeSum2_sub_mulx2 [of x y], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; aGroup R; (x \<plusminus> y)^\<^bsup>R na\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r y^\<^bsup>R i\<^esup>)) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r 1\<^sub>r) = \<Sigma>\<^sub>e R (\<lambda>i.  (na choose Suc i) \<times>\<^bsub>R\<^esub> (x^\<^bsup>R (na - i)\<^esup> \<cdot>\<^sub>r (y^\<^bsup>R i\<^esup> \<cdot>\<^sub>r y))) na \<plusminus> (\<zero> \<plusminus> x \<cdot>\<^sub>r x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r 1\<^sub>r)
[PROOF STEP]
apply (frule_tac n = na in npClose[of x],
         simp add:ring_tOp_commute[of _ x])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fls_base_factor_mult_both_base_factor:
  fixes f g :: "'a::{comm_monoid_add,mult_zero} fls"
  shows "fls_base_factor (fls_base_factor f * fls_base_factor g) = fls_base_factor (f * g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_base_factor (fls_base_factor f * fls_base_factor g) = fls_base_factor (f * g)
[PROOF STEP]
using fls_base_factor_mult_base_factor(1)[of "fls_base_factor f" g]
        fls_base_factor_mult_base_factor(2)[of f g]
[PROOF STATE]
proof (prove)
using this:
fls_base_factor (fls_base_factor f * fls_base_factor g) = fls_base_factor (fls_base_factor f * g)
fls_base_factor (fls_base_factor f * g) = fls_base_factor (f * g)

goal (1 subgoal):
 1. fls_base_factor (fls_base_factor f * fls_base_factor g) = fls_base_factor (f * g)
[PROOF STEP]
by    simp


[STATEMENT]
lemma "((P\<or>Q)\<longrightarrow>(P\<or>R)) \<longrightarrow> (P\<or>(Q\<longrightarrow>R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<or> Q \<longrightarrow> P \<or> R) \<longrightarrow> P \<or> (Q \<longrightarrow> R)
[PROOF STEP]
by blast


[STATEMENT]
lemma condition_3_part_2:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  defines ia:"ia\<equiv>(if \<forall>m. is_zero_row_upt_k m k A then 0 else to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1)"
  defines B:"B\<equiv>(snd (Gauss_Jordan_column_k (ia,A) k))"
  assumes i_le: "i < i + 1"
  and not_zero_i_suc_k: "\<not> is_zero_row_upt_k i (Suc k) B"
  and not_zero_suc_i_suc_k: "\<not> is_zero_row_upt_k (i + 1) (Suc k) B"
  and all_zero: "\<forall>m. is_zero_row_upt_k m k A"
  and Amk_notzero: "A $ m $ from_nat k \<noteq> 0"
  shows "(LEAST n. Gauss_Jordan_in_ij A 0 (from_nat k) $ i $ n \<noteq> 0) < (LEAST n. Gauss_Jordan_in_ij A 0 (from_nat k) $ (i + 1) $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
have ia2: "ia = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia = 0
[PROOF STEP]
using ia all_zero
[PROOF STATE]
proof (prove)
using this:
ia \<equiv> if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
\<forall>m. is_zero_row_upt_k m k A

goal (1 subgoal):
 1. ia = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ia = 0

goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
have B_eq_Gauss: "B = Gauss_Jordan_in_ij A 0 (from_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
unfolding B Gauss_Jordan_column_k_def Let_def fst_conv snd_conv ia2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat 0) (mod_type_class.from_nat k))) = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
using all_zero Amk_notzero least_mod_type
[PROOF STATE]
proof (prove)
using this:
\<forall>m. is_zero_row_upt_k m k A
A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)
(0::?'a) \<le> ?n

goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat 0) (mod_type_class.from_nat k))) = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
unfolding from_nat_0
[PROOF STATE]
proof (prove)
using this:
\<forall>m. is_zero_row_upt_k m k A
A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)
(0::?'a) \<le> ?n

goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>0::'rows. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))) = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)

goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
have "i=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = (0::'rows)
[PROOF STEP]
using all_zero_imp_Gauss_Jordan_column_not_zero_in_row_0[OF all_zero _ Amk_notzero] not_zero_i_suc_k
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row_upt_k ?i (Suc k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1, A) k)) \<Longrightarrow> ?i = (0::'rows)
\<not> is_zero_row_upt_k i (Suc k) B

goal (1 subgoal):
 1. i = (0::'rows)
[PROOF STEP]
unfolding B ia
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row_upt_k ?i (Suc k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1, A) k)) \<Longrightarrow> ?i = (0::'rows)
\<not> is_zero_row_upt_k i (Suc k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1, A) k))

goal (1 subgoal):
 1. i = (0::'rows)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
i = (0::'rows)

goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i = (0::'rows)

goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
have "i+1=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + (1::'rows) = (0::'rows)
[PROOF STEP]
using all_zero_imp_Gauss_Jordan_column_not_zero_in_row_0[OF all_zero _ Amk_notzero] not_zero_suc_i_suc_k
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row_upt_k ?i (Suc k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1, A) k)) \<Longrightarrow> ?i = (0::'rows)
\<not> is_zero_row_upt_k (i + (1::'rows)) (Suc k) B

goal (1 subgoal):
 1. i + (1::'rows) = (0::'rows)
[PROOF STEP]
unfolding B ia
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row_upt_k ?i (Suc k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1, A) k)) \<Longrightarrow> ?i = (0::'rows)
\<not> is_zero_row_upt_k (i + (1::'rows)) (Suc k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1, A) k))

goal (1 subgoal):
 1. i + (1::'rows) = (0::'rows)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
i + (1::'rows) = (0::'rows)

goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
i = (0::'rows)
i + (1::'rows) = (0::'rows)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i = (0::'rows)
i + (1::'rows) = (0::'rows)

goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
using i_le
[PROOF STATE]
proof (prove)
using this:
i = (0::'rows)
i + (1::'rows) = (0::'rows)
i < i + (1::'rows)

goal (1 subgoal):
 1. (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ n \<noteq> (0::'a)) < (LEAST n. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (i + (1::'rows)) $ n \<noteq> (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "27 powr (inverse 3) = (3::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 27 powr inverse 3 = 3
[PROOF STEP]
by simp


[STATEMENT]
lemma mat_assoc_test:
  fixes A B C D :: "complex mat"
  assumes "A \<in> carrier_mat n n" "B \<in> carrier_mat n n" "C \<in> carrier_mat n n" "D \<in> carrier_mat n n"
  shows
    "(A * B) * (C * D) = A * B * C * D"
    "adjoint (A * adjoint B) * C = B * (adjoint A * C)"
    "A * 1\<^sub>m n * 1\<^sub>m n * B * 1\<^sub>m n = A * B"
    "(A - B) + (B - C) = A + (-B) + B + (-C)"
    "A + (B - C) = A + B - C"
    "A - (B + C + D) = A - B - C - D"
    "(A + B) * (B + C) = A * B + B * B + A * C + B * C"
    "A - B = A + (-1) \<cdot>\<^sub>m B"
    "A * (B - C) * D = A * B * D - A * C * D"
    "trace (A * B * C) = trace (B * C * A)"
    "trace (A * B * C * D) = trace (C * D * A * B)"
    "trace (A + B * C) = trace A + trace (C * B)"
    "A + B = B + A"
    "A + B + C = C + B + A"
    "A + B + (C + D) = A + C + (B + D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A * B * (C * D) = A * B * C * D &&& adjoint (A * adjoint B) * C = B * (adjoint A * C) &&& A * 1\<^sub>m n * 1\<^sub>m n * B * 1\<^sub>m n = A * B) &&& (A - B + (B - C) = A + - B + B + - C &&& A + (B - C) = A + B - C) &&& A - (B + C + D) = A - B - C - D &&& (A + B) * (B + C) = A * B + B * B + A * C + B * C) &&& ((A - B = A + - 1 \<cdot>\<^sub>m B &&& A * (B - C) * D = A * B * D - A * C * D) &&& trace (A * B * C) = trace (B * C * A) &&& trace (A * B * C * D) = trace (C * D * A * B)) &&& (trace (A + B * C) = trace A + trace (C * B) &&& A + B = B + A) &&& A + B + C = C + B + A &&& A + B + (C + D) = A + C + (B + D)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n
D \<in> carrier_mat n n

goal (1 subgoal):
 1. ((A * B * (C * D) = A * B * C * D &&& adjoint (A * adjoint B) * C = B * (adjoint A * C) &&& A * 1\<^sub>m n * 1\<^sub>m n * B * 1\<^sub>m n = A * B) &&& (A - B + (B - C) = A + - B + B + - C &&& A + (B - C) = A + B - C) &&& A - (B + C + D) = A - B - C - D &&& (A + B) * (B + C) = A * B + B * B + A * C + B * C) &&& ((A - B = A + - 1 \<cdot>\<^sub>m B &&& A * (B - C) * D = A * B * D - A * C * D) &&& trace (A * B * C) = trace (B * C * A) &&& trace (A * B * C * D) = trace (C * D * A * B)) &&& (trace (A + B * C) = trace A + trace (C * B) &&& A + B = B + A) &&& A + B + C = C + B + A &&& A + B + (C + D) = A + C + (B + D)
[PROOF STEP]
by (mat_assoc n)+


[STATEMENT]
lemma Sup_llist_imp_exists_index: "x \<in> Sup_llist Xs \<Longrightarrow> \<exists>i. enat i < llength Xs \<and> x \<in> lnth Xs i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> Sup_llist Xs \<Longrightarrow> \<exists>i. enat i < llength Xs \<and> x \<in> lnth Xs i
[PROOF STEP]
unfolding Sup_llist_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> \<Union> (lnth Xs ` {i. enat i < llength Xs}) \<Longrightarrow> \<exists>i. enat i < llength Xs \<and> x \<in> lnth Xs i
[PROOF STEP]
by auto


[STATEMENT]
lemma wens_set_imp_subset: "A \<in> wens_set F B ==> B \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> wens_set F B \<Longrightarrow> B \<subseteq> A
[PROOF STEP]
apply (erule wens_set.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. B \<subseteq> B
 2. \<And>X act. \<lbrakk>X \<in> wens_set F B; B \<subseteq> X; act \<in> Acts F\<rbrakk> \<Longrightarrow> B \<subseteq> wens F act X
 3. \<And>W. \<lbrakk>W \<noteq> {}; \<forall>U\<in>W. U \<in> wens_set F B \<and> B \<subseteq> U\<rbrakk> \<Longrightarrow> B \<subseteq> \<Union> W
[PROOF STEP]
apply (blast intro: wens_weakening [THEN subsetD])+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bounded_antilinear_eq_on:
  fixes A B :: "'a::complex_normed_vector \<Rightarrow> 'b::complex_normed_vector"
  assumes \<open>bounded_antilinear A\<close> and \<open>bounded_antilinear B\<close> and
    eq: \<open>\<And>x. x \<in> G \<Longrightarrow> A x = B x\<close> and t: \<open>t \<in> closure (cspan G)\<close>
  shows \<open>A t = B t\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
let ?A = \<open>\<lambda>x. A (from_conjugate_space x)\<close> and ?B = \<open>\<lambda>x. B (from_conjugate_space x)\<close>
    and ?G = \<open>to_conjugate_space ` G\<close> and ?t = \<open>to_conjugate_space t\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
have \<open>bounded_clinear ?A\<close> and \<open>bounded_clinear ?B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_clinear (\<lambda>x. A (from_conjugate_space x)) &&& bounded_clinear (\<lambda>x. B (from_conjugate_space x))
[PROOF STEP]
by (auto intro!: bounded_antilinear_o_bounded_antilinear[OF \<open>bounded_antilinear A\<close>]
        bounded_antilinear_o_bounded_antilinear[OF \<open>bounded_antilinear B\<close>])
[PROOF STATE]
proof (state)
this:
bounded_clinear (\<lambda>x. A (from_conjugate_space x))
bounded_clinear (\<lambda>x. B (from_conjugate_space x))

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bounded_clinear (\<lambda>x. A (from_conjugate_space x))
bounded_clinear (\<lambda>x. B (from_conjugate_space x))

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
from eq
[PROOF STATE]
proof (chain)
picking this:
?x \<in> G \<Longrightarrow> A ?x = B ?x
[PROOF STEP]
have \<open>\<And>x. x \<in> ?G \<Longrightarrow> ?A x = ?B x\<close>
[PROOF STATE]
proof (prove)
using this:
?x \<in> G \<Longrightarrow> A ?x = B ?x

goal (1 subgoal):
 1. \<And>x. x \<in> to_conjugate_space ` G \<Longrightarrow> A (from_conjugate_space x) = B (from_conjugate_space x)
[PROOF STEP]
by (metis image_iff iso_tuple_UNIV_I to_conjugate_space_inverse)
[PROOF STATE]
proof (state)
this:
?x \<in> to_conjugate_space ` G \<Longrightarrow> A (from_conjugate_space ?x) = B (from_conjugate_space ?x)

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> to_conjugate_space ` G \<Longrightarrow> A (from_conjugate_space ?x) = B (from_conjugate_space ?x)

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
from t
[PROOF STATE]
proof (chain)
picking this:
t \<in> closure (cspan G)
[PROOF STEP]
have \<open>?t \<in> closure (cspan ?G)\<close>
[PROOF STATE]
proof (prove)
using this:
t \<in> closure (cspan G)

goal (1 subgoal):
 1. to_conjugate_space t \<in> closure (cspan (to_conjugate_space ` G))
[PROOF STEP]
by (metis bounded_antilinear.bounded_linear bounded_antilinear_to_conjugate_space closure_bounded_linear_image_subset cspan_to_conjugate_space imageI subsetD)
[PROOF STATE]
proof (state)
this:
to_conjugate_space t \<in> closure (cspan (to_conjugate_space ` G))

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bounded_clinear (\<lambda>x. A (from_conjugate_space x))
bounded_clinear (\<lambda>x. B (from_conjugate_space x))
?x \<in> to_conjugate_space ` G \<Longrightarrow> A (from_conjugate_space ?x) = B (from_conjugate_space ?x)
to_conjugate_space t \<in> closure (cspan (to_conjugate_space ` G))
[PROOF STEP]
have \<open>?A ?t = ?B ?t\<close>
[PROOF STATE]
proof (prove)
using this:
bounded_clinear (\<lambda>x. A (from_conjugate_space x))
bounded_clinear (\<lambda>x. B (from_conjugate_space x))
?x \<in> to_conjugate_space ` G \<Longrightarrow> A (from_conjugate_space ?x) = B (from_conjugate_space ?x)
to_conjugate_space t \<in> closure (cspan (to_conjugate_space ` G))

goal (1 subgoal):
 1. A (from_conjugate_space (to_conjugate_space t)) = B (from_conjugate_space (to_conjugate_space t))
[PROOF STEP]
by (rule bounded_clinear_eq_on)
[PROOF STATE]
proof (state)
this:
A (from_conjugate_space (to_conjugate_space t)) = B (from_conjugate_space (to_conjugate_space t))

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A (from_conjugate_space (to_conjugate_space t)) = B (from_conjugate_space (to_conjugate_space t))
[PROOF STEP]
show \<open>A t = B t\<close>
[PROOF STATE]
proof (prove)
using this:
A (from_conjugate_space (to_conjugate_space t)) = B (from_conjugate_space (to_conjugate_space t))

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
by (simp add: to_conjugate_space_inverse)
[PROOF STATE]
proof (state)
this:
A t = B t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma orthonormal_system_trigonometric_set:
    "orthonormal_system {-pi..pi} trigonometric_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthonormal_system {- pi..pi} trigonometric_set
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthonormal_system {- pi..pi} trigonometric_set
[PROOF STEP]
have "l2product {-pi..pi} (trigonometric_set m) (trigonometric_set n) = (if m = n then 1 else 0)" for m n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2product {- pi..pi} (trigonometric_set m) (trigonometric_set n) = (if m = n then 1 else 0)
[PROOF STEP]
proof (induction m rule: odd_even_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. l2product {- pi..pi} (trigonometric_set 0) (trigonometric_set n) = (if 0 = n then 1 else 0)
 2. \<And>na. l2product {- pi..pi} (trigonometric_set (Suc (2 * na))) (trigonometric_set n) = (if Suc (2 * na) = n then 1 else 0)
 3. \<And>na. l2product {- pi..pi} (trigonometric_set (2 * na + 2)) (trigonometric_set n) = (if 2 * na + 2 = n then 1 else 0)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. l2product {- pi..pi} (trigonometric_set 0) (trigonometric_set n) = (if 0 = n then 1 else 0)
 2. \<And>na. l2product {- pi..pi} (trigonometric_set (Suc (2 * na))) (trigonometric_set n) = (if Suc (2 * na) = n then 1 else 0)
 3. \<And>na. l2product {- pi..pi} (trigonometric_set (2 * na + 2)) (trigonometric_set n) = (if 2 * na + 2 = n then 1 else 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2product {- pi..pi} (trigonometric_set 0) (trigonometric_set n) = (if 0 = n then 1 else 0)
[PROOF STEP]
by (induction n rule: odd_even_cases) (auto simp: trigonometric_set l2product_def measure_restrict_space)
[PROOF STATE]
proof (state)
this:
l2product {- pi..pi} (trigonometric_set 0) (trigonometric_set n) = (if 0 = n then 1 else 0)

goal (2 subgoals):
 1. \<And>na. l2product {- pi..pi} (trigonometric_set (Suc (2 * na))) (trigonometric_set n) = (if Suc (2 * na) = n then 1 else 0)
 2. \<And>na. l2product {- pi..pi} (trigonometric_set (2 * na + 2)) (trigonometric_set n) = (if 2 * na + 2 = n then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>na. l2product {- pi..pi} (trigonometric_set (Suc (2 * na))) (trigonometric_set n) = (if Suc (2 * na) = n then 1 else 0)
 2. \<And>na. l2product {- pi..pi} (trigonometric_set (2 * na + 2)) (trigonometric_set n) = (if 2 * na + 2 = n then 1 else 0)
[PROOF STEP]
case (odd m)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>na. l2product {- pi..pi} (trigonometric_set (Suc (2 * na))) (trigonometric_set n) = (if Suc (2 * na) = n then 1 else 0)
 2. \<And>na. l2product {- pi..pi} (trigonometric_set (2 * na + 2)) (trigonometric_set n) = (if 2 * na + 2 = n then 1 else 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2product {- pi..pi} (trigonometric_set (Suc (2 * m))) (trigonometric_set n) = (if Suc (2 * m) = n then 1 else 0)
[PROOF STEP]
by (induction n rule: odd_even_cases) (auto simp: trigonometric_set l2product_def double_not_eq_Suc_double)
[PROOF STATE]
proof (state)
this:
l2product {- pi..pi} (trigonometric_set (Suc (2 * m))) (trigonometric_set n) = (if Suc (2 * m) = n then 1 else 0)

goal (1 subgoal):
 1. \<And>na. l2product {- pi..pi} (trigonometric_set (2 * na + 2)) (trigonometric_set n) = (if 2 * na + 2 = n then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. l2product {- pi..pi} (trigonometric_set (2 * na + 2)) (trigonometric_set n) = (if 2 * na + 2 = n then 1 else 0)
[PROOF STEP]
case (even m)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>na. l2product {- pi..pi} (trigonometric_set (2 * na + 2)) (trigonometric_set n) = (if 2 * na + 2 = n then 1 else 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2product {- pi..pi} (trigonometric_set (2 * m + 2)) (trigonometric_set n) = (if 2 * m + 2 = n then 1 else 0)
[PROOF STEP]
by (induction n rule: odd_even_cases) (auto simp: trigonometric_set l2product_def Suc_double_not_eq_double)
[PROOF STATE]
proof (state)
this:
l2product {- pi..pi} (trigonometric_set (2 * m + 2)) (trigonometric_set n) = (if 2 * m + 2 = n then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l2product {- pi..pi} (trigonometric_set ?m) (trigonometric_set ?n) = (if ?m = ?n then 1 else 0)

goal (1 subgoal):
 1. orthonormal_system {- pi..pi} trigonometric_set
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l2product {- pi..pi} (trigonometric_set ?m) (trigonometric_set ?n) = (if ?m = ?n then 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
l2product {- pi..pi} (trigonometric_set ?m) (trigonometric_set ?n) = (if ?m = ?n then 1 else 0)

goal (1 subgoal):
 1. orthonormal_system {- pi..pi} trigonometric_set
[PROOF STEP]
unfolding orthonormal_system_def
[PROOF STATE]
proof (prove)
using this:
l2product {- pi..pi} (trigonometric_set ?m) (trigonometric_set ?n) = (if ?m = ?n then 1 else 0)

goal (1 subgoal):
 1. \<forall>m n. l2product {- pi..pi} (trigonometric_set m) (trigonometric_set n) = (if m = n then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
orthonormal_system {- pi..pi} trigonometric_set

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inj_on_list_of_vec: "inj_on list_of_vec (carrier_vec n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on list_of_vec (carrier_vec n)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>carrier_vec n. \<forall>y\<in>carrier_vec n. list_of_vec x = list_of_vec y \<longrightarrow> x = y
[PROOF STEP]
unfolding list_of_vec_rw_map
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>carrier_vec n. \<forall>y\<in>carrier_vec n. map (($) x) [0..<dim_vec x] = map (($) y) [0..<dim_vec y] \<longrightarrow> x = y
[PROOF STEP]
by auto


[STATEMENT]
lemma poly_of_pm_plus: "poly_of_pm x (p + q) = poly_of_pm x p + poly_of_pm x q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_pm x (p + q) = poly_of_pm x p + poly_of_pm x q
[PROOF STEP]
unfolding Polynomial.plus_poly.abs_eq coeff_poly_of_pm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_pm x (p + q) = Abs_poly (\<lambda>n. lookup p (monomial n x) + lookup q (monomial n x))
[PROOF STEP]
by (simp add: poly_of_pm_def lookup_add)


[STATEMENT]
lemma LIM_equal2:
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::topological_space"
  assumes "0 < R"
    and "\<And>x. x \<noteq> a \<Longrightarrow> norm (x - a) < R \<Longrightarrow> f x = g x"
  shows "g \<midarrow>a\<rightarrow> l \<Longrightarrow> f \<midarrow>a\<rightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<midarrow>a\<rightarrow> l \<Longrightarrow> f \<midarrow>a\<rightarrow> l
[PROOF STEP]
by (rule metric_LIM_equal2 [OF _ assms]) (simp_all add: dist_norm)


[STATEMENT]
lemma measure_Union':
  "finite F \<Longrightarrow> (\<And>S. S \<in> F \<Longrightarrow> S \<in> fmeasurable M) \<Longrightarrow> pairwise disjnt F \<Longrightarrow> measure M (\<Union>F) = (\<Sum>S\<in>F. measure M S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite F; \<And>S. S \<in> F \<Longrightarrow> S \<in> fmeasurable M; disjoint F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union> F) = sum (Sigma_Algebra.measure M) F
[PROOF STEP]
using measure_UNION'[of F "\<lambda>x. x" M]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite F; \<And>i. i \<in> F \<Longrightarrow> i \<in> fmeasurable M; disjoint F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union>i\<in>F. i) = sum (Sigma_Algebra.measure M) F

goal (1 subgoal):
 1. \<lbrakk>finite F; \<And>S. S \<in> F \<Longrightarrow> S \<in> fmeasurable M; disjoint F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union> F) = sum (Sigma_Algebra.measure M) F
[PROOF STEP]
by simp