[STATEMENT]
lemma at_top_within_at_top_bounded_right':
  fixes a b::"'a::{dense_order,linorder_topology}"
  assumes "a < b"
  shows "at_top_within {..<b} = at_left b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_top_within {..<b} = at_left b
[PROOF STEP]
unfolding at_top_within_def at_left_eq[OF assms(1)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF k\<in>{..<b}. principal ({k..} \<inter> {..<b})) = (INF a\<in>{..<b}. principal {a<..<b})
[PROOF STEP]
apply (auto intro!: INF_eq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < b \<Longrightarrow> \<exists>j\<in>{..<b}. {j<..<b} \<subseteq> {i..} \<and> {j<..<b} \<subseteq> {..<b}
 2. \<And>j. j < b \<Longrightarrow> \<exists>i\<in>{..<b}. {i..} \<inter> {..<b} \<subseteq> {j<..<b}
[PROOF STEP]
apply (meson atLeast_iff greaterThanLessThan_iff le_less lessThan_iff subset_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < b \<Longrightarrow> \<exists>i\<in>{..<b}. {i..} \<inter> {..<b} \<subseteq> {j<..<b}
[PROOF STEP]
by (metis Ico_subset_Ioo_iff atLeastLessThan_def dense lessThan_iff)


[STATEMENT]
lemma closure_of_complement: "X closure_of (topspace X - S) = topspace X - X interior_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X closure_of (topspace X - S) = topspace X - X interior_of S
[PROOF STEP]
unfolding interior_of_def closure_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> topspace X. \<forall>T. x \<in> T \<and> openin X T \<longrightarrow> (\<exists>y\<in>topspace X - S. y \<in> T)} = topspace X - {x. \<exists>T. openin X T \<and> x \<in> T \<and> T \<subseteq> S}
[PROOF STEP]
by (blast dest: openin_subset)


[STATEMENT]
lemma fref_compI':
    "\<lbrakk> (f,g)\<in>fref P R1 R2; (g,h)\<in>fref Q S1 S2 \<rbrakk>
      \<Longrightarrow> (f,h) \<in> fref (\<lambda>x. Q x \<and> (\<forall>y. (y,x)\<in>S1 \<longrightarrow> P y)) (R1 O S1) (R2 O S2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f, g) \<in> [P]\<^sub>f R1 \<rightarrow> R2; (g, h) \<in> [Q]\<^sub>f S1 \<rightarrow> S2\<rbrakk> \<Longrightarrow> (f, h) \<in> [\<lambda>x. Q x \<and> (\<forall>y. (y, x) \<in> S1 \<longrightarrow> P y)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2
[PROOF STEP]
using fref_compI[of P R1 R2 Q S1 S2]
[PROOF STATE]
proof (prove)
using this:
([P]\<^sub>f R1 \<rightarrow> R2) O ([Q]\<^sub>f S1 \<rightarrow> S2) \<subseteq> [\<lambda>x. Q x \<and> (\<forall>y. (y, x) \<in> S1 \<longrightarrow> P y)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2

goal (1 subgoal):
 1. \<lbrakk>(f, g) \<in> [P]\<^sub>f R1 \<rightarrow> R2; (g, h) \<in> [Q]\<^sub>f S1 \<rightarrow> S2\<rbrakk> \<Longrightarrow> (f, h) \<in> [\<lambda>x. Q x \<and> (\<forall>y. (y, x) \<in> S1 \<longrightarrow> P y)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2
[PROOF STEP]
by auto


[STATEMENT]
lemma nonneg_mat_mult:
  "nonneg_mat A \<Longrightarrow> nonneg_mat B \<Longrightarrow> A \<in> carrier_mat nr n
  \<Longrightarrow> B \<in> carrier_mat n nc \<Longrightarrow> nonneg_mat (A * B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nonneg_mat A; nonneg_mat B; A \<in> carrier_mat nr n; B \<in> carrier_mat n nc\<rbrakk> \<Longrightarrow> nonneg_mat (A * B)
[PROOF STEP]
unfolding nonneg_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>elements_mat A. (0::'a) \<le> a; \<forall>a\<in>elements_mat B. (0::'a) \<le> a; A \<in> carrier_mat nr n; B \<in> carrier_mat n nc\<rbrakk> \<Longrightarrow> \<forall>a\<in>elements_mat (A * B). (0::'a) \<le> a
[PROOF STEP]
by (auto simp: elements_mat_def scalar_prod_def intro!: sum_nonneg)


[STATEMENT]
lemma union_term_eq [simp]:  "(\<Union> w . term_eq t w) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (range (term_eq t)) = UNIV
[PROOF STEP]
apply (simp add: term_eq_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x. {s. t s = x}) = UNIV
[PROOF STEP]
by auto


[STATEMENT]
lemma (in prob_space) sum_indep_random_variable:
  assumes ind: "indep_var borel X borel Y"
  assumes [simp, measurable]: "random_variable borel X"
  assumes [simp, measurable]: "random_variable borel Y"
  shows "distr M borel (\<lambda>x. X x + Y x) = convolution (distr M borel X)  (distr M borel Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr M borel (\<lambda>x. X x + Y x) = (distr M borel X \<star> distr M borel Y)
[PROOF STEP]
using ind
[PROOF STATE]
proof (prove)
using this:
indep_var borel X borel Y

goal (1 subgoal):
 1. distr M borel (\<lambda>x. X x + Y x) = (distr M borel X \<star> distr M borel Y)
[PROOF STEP]
unfolding indep_var_distribution_eq convolution_def
[PROOF STATE]
proof (prove)
using this:
random_variable borel X \<and> random_variable borel Y \<and> distr M borel X \<Otimes>\<^sub>M distr M borel Y = distr M (borel \<Otimes>\<^sub>M borel) (\<lambda>x. (X x, Y x))

goal (1 subgoal):
 1. distr M borel (\<lambda>x. X x + Y x) = distr (distr M borel X \<Otimes>\<^sub>M distr M borel Y) borel (\<lambda>(x, y). x + y)
[PROOF STEP]
by (auto simp: distr_distr intro!:arg_cong[where f = "distr M borel"])


[STATEMENT]
lemma less_eq_ccInf_inter: "countable A \<Longrightarrow> countable B \<Longrightarrow> sup (Inf A) (Inf B) \<le> Inf (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; countable B\<rbrakk> \<Longrightarrow> sup (Inf A) (Inf B) \<le> Inf (A \<inter> B)
[PROOF STEP]
by (auto intro: ccInf_greatest ccInf_lower)


[STATEMENT]
theorem RA1: "(P ;; (Q ;; R)) = ((P ;; Q) ;; R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P ;; Q ;; R = (P ;; Q) ;; R
[PROOF STEP]
by (simp add: seqr_assoc)


[STATEMENT]
lemma closed_injective_linear_image_eq:
    fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
    assumes f: "linear f" "inj f"
      shows "(closed(image f s) \<longleftrightarrow> closed s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (f ` s) = closed s
[PROOF STEP]
by (metis closed_injective_linear_image closure_eq closure_linear_image_subset closure_subset_eq f(1) f(2) inj_image_subset_iff)


[STATEMENT]
lemma compose_surj: "\<lbrakk>f:A \<rightarrow> B; surj_to f A B; g : B \<rightarrow> C; surj_to g B C \<rbrakk>
                         \<Longrightarrow> surj_to (compose A g f) A C "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; surj_to f A B; g \<in> B \<rightarrow> C; surj_to g B C\<rbrakk> \<Longrightarrow> surj_to (compose A g f) A C
[PROOF STEP]
apply (simp add:surj_to_def compose_def image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; {y. \<exists>x\<in>A. y = f x} = B; g \<in> B \<rightarrow> C; {y. \<exists>x\<in>B. y = g x} = C\<rbrakk> \<Longrightarrow> {y. \<exists>x\<in>A. y = g (f x)} = C
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma diameter_closed_interval [simp]: "diameter {a..b} = (if b < a then 0 else b-a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diameter {a..b} = (if b < a then 0 else b - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. diameter {a..b} = (if b < a then 0 else b - a)
[PROOF STEP]
have "{a .. b} = cball ((a+b)/2) ((b-a)/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..b} = cball ((a + b) / 2) ((b - a) / 2)
[PROOF STEP]
by (auto simp: dist_norm abs_if field_split_simps split: if_split_asm)
[PROOF STATE]
proof (state)
this:
{a..b} = cball ((a + b) / 2) ((b - a) / 2)

goal (1 subgoal):
 1. diameter {a..b} = (if b < a then 0 else b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{a..b} = cball ((a + b) / 2) ((b - a) / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{a..b} = cball ((a + b) / 2) ((b - a) / 2)

goal (1 subgoal):
 1. diameter {a..b} = (if b < a then 0 else b - a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diameter {a..b} = (if b < a then 0 else b - a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convergent_prod_exp:
  assumes "summable f"
  shows "convergent_prod (\<lambda>i. exp (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_prod (\<lambda>i. exp (f i))
[PROOF STEP]
using sums_imp_has_prod_exp assms
[PROOF STATE]
proof (prove)
using this:
f sums ?s \<Longrightarrow> raw_has_prod (\<lambda>i. exp (f i)) 0 (exp ?s)
summable f

goal (1 subgoal):
 1. convergent_prod (\<lambda>i. exp (f i))
[PROOF STEP]
unfolding summable_def convergent_prod_def
[PROOF STATE]
proof (prove)
using this:
f sums ?s \<Longrightarrow> raw_has_prod (\<lambda>i. exp (f i)) 0 (exp ?s)
Ex ((sums) f)

goal (1 subgoal):
 1. \<exists>M p. raw_has_prod (\<lambda>i. exp (f i)) M p
[PROOF STEP]
by blast


[STATEMENT]
lemma size_fset_of_list: "size (fset_of_list l) = length (remdups l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (fset_of_list l) = length (remdups l)
[PROOF STEP]
apply (induct l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. size (fset_of_list []) = length (remdups [])
 2. \<And>a l. size (fset_of_list l) = length (remdups l) \<Longrightarrow> size (fset_of_list (a # l)) = length (remdups (a # l))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. size (fset_of_list l) = length (remdups l) \<Longrightarrow> size (fset_of_list (a # l)) = length (remdups (a # l))
[PROOF STEP]
by (simp add: fset_of_list.rep_eq insert_absorb)


[STATEMENT]
theorem "{(n, k). n > 0 \<and> k > 0 \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i :: nat)} = {(1, 1), (2, 3)}"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)} = {(1, 1), (2, 3)}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)} \<subseteq> {(1, 1), (2, 3)}
 2. {(1, 1), (2, 3)} \<subseteq> {(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)}
[PROOF STEP]
show "?lhs \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)} \<subseteq> {(1, 1), (2, 3)}
[PROOF STEP]
using n_k_in_set
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?k; 0 < ?n; fact ?k = (\<Prod>i<?n. 2 ^ ?n - 2 ^ i)\<rbrakk> \<Longrightarrow> (?n, ?k) \<in> {(1, 1), (2, 3)}

goal (1 subgoal):
 1. {(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)} \<subseteq> {(1, 1), (2, 3)}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)} \<subseteq> {(1, 1), (2, 3)}

goal (1 subgoal):
 1. {(1, 1), (2, 3)} \<subseteq> {(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)}
[PROOF STEP]
show "?rhs \<subseteq> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(1, 1), (2, 3)} \<subseteq> {(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)}
[PROOF STEP]
by (auto simp: fact_numeral lessThan_nat_numeral)
[PROOF STATE]
proof (state)
this:
{(1, 1), (2, 3)} \<subseteq> {(n, k). 0 < n \<and> 0 < k \<and> fact k = (\<Prod>i<n. 2 ^ n - 2 ^ i)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lim_1_over_real_power:
  fixes s :: real
  assumes "0 < s"
  shows "((\<lambda>n. 1 / (of_nat n powr s)) \<longlongrightarrow> 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / real n powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
using lim_1_over_complex_power [of "of_real s", THEN filterlim_sequentially_Suc [THEN iffD2]] assms
[PROOF STATE]
proof (prove)
using this:
0 < Re (complex_of_real s) \<Longrightarrow> (\<lambda>x. 1 / of_nat (Suc x) powr complex_of_real s) \<longlonglongrightarrow> 0
0 < s

goal (1 subgoal):
 1. (\<lambda>n. 1 / real n powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
apply (subst filterlim_sequentially_Suc [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < Re (complex_of_real s) \<Longrightarrow> (\<lambda>x. 1 / of_nat (Suc x) powr complex_of_real s) \<longlonglongrightarrow> 0; 0 < s\<rbrakk> \<Longrightarrow> (\<lambda>x. 1 / real (Suc x) powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
by (simp add: lim_sequentially dist_norm Ln_Reals_eq norm_powr_real_powr norm_divide)


[STATEMENT]
lemma d_IN_monotone_convergence_SUP:
  assumes "incseq (\<lambda>n x. f n (x, y))"
  shows "d_IN (\<lambda>e. SUP n. f n e) y = (SUP n. d_IN (f n) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_IN (\<lambda>e. \<Squnion>n. f n e) y = (\<Squnion>n. d_IN (f n) y)
[PROOF STEP]
unfolding d_IN_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ x. \<Squnion>n. f n (x, y)) = (\<Squnion>n. \<Sum>\<^sup>+ x. f n (x, y))
[PROOF STEP]
by(rule nn_integral_monotone_convergence_SUP[OF assms]) simp


[STATEMENT]
lemma zorder_nonzero_div_power:
  assumes "open s" "z \<in> s" "f holomorphic_on s" "f z \<noteq> 0" "n > 0"
  shows  "zorder (\<lambda>w. f w / (w - z) ^ n) z = - n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zorder (\<lambda>w. f w / (w - z) ^ n) z = - int n
[PROOF STEP]
apply (rule zorder_eqI[OF \<open>open s\<close> \<open>z\<in>s\<close> \<open>f holomorphic_on s\<close> \<open>f z\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>w \<in> s; w \<noteq> z\<rbrakk> \<Longrightarrow> f w / (w - z) ^ n = f w * (w - z) powr of_int (- int n)
[PROOF STEP]
apply (subst powr_of_int)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>w. \<lbrakk>w \<in> s; w \<noteq> z\<rbrakk> \<Longrightarrow> w - z \<noteq> 0
 2. \<And>w. \<lbrakk>w \<in> s; w \<noteq> z\<rbrakk> \<Longrightarrow> f w / (w - z) ^ n = f w * (if 0 \<le> - int n then (w - z) ^ nat (- int n) else inverse ((w - z) ^ nat (- (- int n))))
[PROOF STEP]
using \<open>n>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (2 subgoals):
 1. \<And>w. \<lbrakk>w \<in> s; w \<noteq> z\<rbrakk> \<Longrightarrow> w - z \<noteq> 0
 2. \<And>w. \<lbrakk>w \<in> s; w \<noteq> z\<rbrakk> \<Longrightarrow> f w / (w - z) ^ n = f w * (if 0 \<le> - int n then (w - z) ^ nat (- int n) else inverse ((w - z) ^ nat (- (- int n))))
[PROOF STEP]
by (auto simp add:field_simps)


[STATEMENT]
lemma cpoly_of_times:
  shows "cpoly_of pR pI * cpoly_of qR qI = cpoly_of (pR * qR - pI * qI) (pI*qR+pR*qI)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cpoly_of pR pI * cpoly_of qR qI = cpoly_of (pR * qR - pI * qI) (pI * qR + pR * qI)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cpoly_of pR pI * cpoly_of qR qI = cpoly_of (pR * qR - pI * qI) (pI * qR + pR * qI)
[PROOF STEP]
define PR PI where "PR = map_poly complex_of_real pR"
                 and "PI = map_poly complex_of_real pI"
[PROOF STATE]
proof (state)
this:
PR = map_poly complex_of_real pR
PI = map_poly complex_of_real pI

goal (1 subgoal):
 1. cpoly_of pR pI * cpoly_of qR qI = cpoly_of (pR * qR - pI * qI) (pI * qR + pR * qI)
[PROOF STEP]
define QR QI where "QR = map_poly complex_of_real qR"
                 and "QI = map_poly complex_of_real qI"
[PROOF STATE]
proof (state)
this:
QR = map_poly complex_of_real qR
QI = map_poly complex_of_real qI

goal (1 subgoal):
 1. cpoly_of pR pI * cpoly_of qR qI = cpoly_of (pR * qR - pI * qI) (pI * qR + pR * qI)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cpoly_of pR pI * cpoly_of qR qI = cpoly_of (pR * qR - pI * qI) (pI * qR + pR * qI)
[PROOF STEP]
unfolding cpoly_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map_poly complex_of_real pR + smult \<i> (map_poly complex_of_real pI)) * (map_poly complex_of_real qR + smult \<i> (map_poly complex_of_real qI)) = map_poly complex_of_real (pR * qR - pI * qI) + smult \<i> (map_poly complex_of_real (pI * qR + pR * qI))
[PROOF STEP]
by (simp add:algebra_simps of_real_poly_hom.hom_minus smult_add_right
          flip: PR_def PI_def QR_def QI_def)
[PROOF STATE]
proof (state)
this:
cpoly_of pR pI * cpoly_of qR qI = cpoly_of (pR * qR - pI * qI) (pI * qR + pR * qI)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lower_triangular_index:
  assumes "lower_triangular A" "i<j" "i < dim_row A" "j < dim_col A"
  shows "A $$ (i,j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, j) = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lower_triangular A
i < j
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. A $$ (i, j) = (0::'a)
[PROOF STEP]
unfolding lower_triangular_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. i < j \<and> i < dim_row A \<and> j < dim_col A \<longrightarrow> A $$ (i, j) = (0::'a)
i < j
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. A $$ (i, j) = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma prod_list_complementary_nthss:
fixes f ::"'a \<Rightarrow> 'b::comm_monoid_mult"
shows "prod_list (map f xs) = prod_list (map f (nths xs A)) *  prod_list (map f (nths xs (-A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map f xs) = prod_list (map f (nths xs A)) * prod_list (map f (nths xs (- A)))
[PROOF STEP]
proof (induction xs rule:rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prod_list (map f []) = prod_list (map f (nths [] A)) * prod_list (map f (nths [] (- A)))
 2. \<And>x xs. prod_list (map f xs) = prod_list (map f (nths xs A)) * prod_list (map f (nths xs (- A))) \<Longrightarrow> prod_list (map f (xs @ [x])) = prod_list (map f (nths (xs @ [x]) A)) * prod_list (map f (nths (xs @ [x]) (- A)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. prod_list (map f []) = prod_list (map f (nths [] A)) * prod_list (map f (nths [] (- A)))
 2. \<And>x xs. prod_list (map f xs) = prod_list (map f (nths xs A)) * prod_list (map f (nths xs (- A))) \<Longrightarrow> prod_list (map f (xs @ [x])) = prod_list (map f (nths (xs @ [x]) A)) * prod_list (map f (nths (xs @ [x]) (- A)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map f []) = prod_list (map f (nths [] A)) * prod_list (map f (nths [] (- A)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_list (map f []) = prod_list (map f (nths [] A)) * prod_list (map f (nths [] (- A)))

goal (1 subgoal):
 1. \<And>x xs. prod_list (map f xs) = prod_list (map f (nths xs A)) * prod_list (map f (nths xs (- A))) \<Longrightarrow> prod_list (map f (xs @ [x])) = prod_list (map f (nths (xs @ [x]) A)) * prod_list (map f (nths (xs @ [x]) (- A)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. prod_list (map f xs) = prod_list (map f (nths xs A)) * prod_list (map f (nths xs (- A))) \<Longrightarrow> prod_list (map f (xs @ [x])) = prod_list (map f (nths (xs @ [x]) A)) * prod_list (map f (nths (xs @ [x]) (- A)))
[PROOF STEP]
case (snoc x xs)
[PROOF STATE]
proof (state)
this:
prod_list (map f xs) = prod_list (map f (nths xs A)) * prod_list (map f (nths xs (- A)))

goal (1 subgoal):
 1. \<And>x xs. prod_list (map f xs) = prod_list (map f (nths xs A)) * prod_list (map f (nths xs (- A))) \<Longrightarrow> prod_list (map f (xs @ [x])) = prod_list (map f (nths (xs @ [x]) A)) * prod_list (map f (nths (xs @ [x]) (- A)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map f (xs @ [x])) = prod_list (map f (nths (xs @ [x]) A)) * prod_list (map f (nths (xs @ [x]) (- A)))
[PROOF STEP]
unfolding map_append "prod_list.append" nths_append nths_singleton snoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map f (nths xs A)) * prod_list (map f (nths xs (- A))) * prod_list (map f [x]) = prod_list (map f (nths xs A)) * prod_list (map f (if 0 \<in> {j. j + length xs \<in> A} then [x] else [])) * (prod_list (map f (nths xs (- A))) * prod_list (map f (if 0 \<in> {j. j + length xs \<in> - A} then [x] else [])))
[PROOF STEP]
by (cases "(length xs)\<in>A"; simp;metis mult.assoc mult.commute)
[PROOF STATE]
proof (state)
this:
prod_list (map f (xs @ [x])) = prod_list (map f (nths (xs @ [x]) A)) * prod_list (map f (nths (xs @ [x]) (- A)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma GreenThm_typeI_two_chain:
   "two_chain_integral two_chain (\<lambda>a. - partial_vector_derivative (\<lambda>x. (F x) \<bullet> i) j a) = one_chain_line_integral F {i} (two_chain_boundary two_chain)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. two_chain_integral two_chain (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a) = one_chain_line_integral F {i} (two_chain_boundary two_chain)
[PROOF STEP]
proof (simp add: two_chain_boundary_def one_chain_line_integral_def two_chain_integral_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
let ?F_b' = "partial_vector_derivative (\<lambda>x. (F x) \<bullet> i) j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
have all_two_cubes_have_four_distict_edges: "\<forall>twoCube \<in> two_chain. card (boundary twoCube) = 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>twoCube\<in>two_chain. card (boundary twoCube) = 4
[PROOF STEP]
using valid_typeI_div valid_two_chain_def valid_two_cube_def
[PROOF STATE]
proof (prove)
using this:
valid_typeI_division s two_chain
valid_two_chain ?twoChain \<equiv> (\<forall>twoCube\<in>?twoChain. valid_two_cube twoCube) \<and> pairwise (\<lambda>c1 c2. boundary c1 \<inter> boundary c2 = {}) ?twoChain \<and> inj_on cubeImage ?twoChain
valid_two_cube ?twoC \<equiv> card (boundary ?twoC) = 4

goal (1 subgoal):
 1. \<forall>twoCube\<in>two_chain. card (boundary twoCube) = 4
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>twoCube\<in>two_chain. card (boundary twoCube) = 4

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
have no_shared_edges_have_similar_orientations:
    "\<forall>twoCube1 \<in> two_chain. \<forall>twoCube2 \<in> two_chain.  twoCube1 \<noteq> twoCube2 \<longrightarrow>
                          boundary twoCube1 \<inter> boundary twoCube2 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>twoCube1\<in>two_chain. \<forall>twoCube2\<in>two_chain. twoCube1 \<noteq> twoCube2 \<longrightarrow> boundary twoCube1 \<inter> boundary twoCube2 = {}
[PROOF STEP]
using valid_typeI_div valid_two_chain_def
[PROOF STATE]
proof (prove)
using this:
valid_typeI_division s two_chain
valid_two_chain ?twoChain \<equiv> (\<forall>twoCube\<in>?twoChain. valid_two_cube twoCube) \<and> pairwise (\<lambda>c1 c2. boundary c1 \<inter> boundary c2 = {}) ?twoChain \<and> inj_on cubeImage ?twoChain

goal (1 subgoal):
 1. \<forall>twoCube1\<in>two_chain. \<forall>twoCube2\<in>two_chain. twoCube1 \<noteq> twoCube2 \<longrightarrow> boundary twoCube1 \<inter> boundary twoCube2 = {}
[PROOF STEP]
by (auto simp add: pairwise_def)
[PROOF STATE]
proof (state)
this:
\<forall>twoCube1\<in>two_chain. \<forall>twoCube2\<in>two_chain. twoCube1 \<noteq> twoCube2 \<longrightarrow> boundary twoCube1 \<inter> boundary twoCube2 = {}

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
have "(\<Sum>(k,g)\<in> boundary twoCube. k * line_integral F {i} g) = integral (cubeImage twoCube) (\<lambda>a. - ?F_b' a)"
        if "twoCube \<in> two_chain" for twoCube
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)
[PROOF STEP]
have analytically_val: " analytically_valid (cubeImage twoCube) (\<lambda>x. F x \<bullet> i) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. analytically_valid (cubeImage twoCube) (\<lambda>x. F x \<bullet> i) j
[PROOF STEP]
using that F_anal_valid
[PROOF STATE]
proof (prove)
using this:
twoCube \<in> two_chain
\<forall>twoC\<in>two_chain. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j

goal (1 subgoal):
 1. analytically_valid (cubeImage twoCube) (\<lambda>x. F x \<bullet> i) j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
analytically_valid (cubeImage twoCube) (\<lambda>x. F x \<bullet> i) j

goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)
[PROOF STEP]
show "(\<Sum>(k, g)\<in>boundary twoCube. k * line_integral F {i} g) = integral (cubeImage twoCube) (\<lambda>a. - ?F_b' a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)
[PROOF STEP]
using green_typeI_cube.GreenThm_typeI_twoCube
[PROOF STATE]
proof (prove)
using this:
green_typeI_cube ?i ?j ?twoC ?F \<Longrightarrow> integral (cubeImage ?twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. ?F p \<bullet> ?i) ?j a) = one_chain_line_integral ?F {?i} (boundary ?twoC)
green_typeI_cube ?i ?j ?twoC ?F \<Longrightarrow> \<forall>(k, \<gamma>)\<in>boundary ?twoC. line_integral_exists ?F {?i} \<gamma>

goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)
[PROOF STEP]
apply (simp add: one_chain_line_integral_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>i j twoC F. green_typeI_cube i j twoC F \<Longrightarrow> - integral (cubeImage twoC) (partial_vector_derivative (\<lambda>p. F p \<bullet> i) j) = (\<Sum>x\<in>boundary twoC. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g); \<And>i j twoC F. green_typeI_cube i j twoC F \<Longrightarrow> \<forall>x\<in>boundary twoC. case x of (k, \<gamma>) \<Rightarrow> line_integral_exists F {i} \<gamma>\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>boundary twoCube. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = - integral (cubeImage twoCube) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)
[PROOF STEP]
by (simp add: R2_axioms analytically_val green_typeI_cube_axioms_def green_typeI_cube_def that two_chain_valid_valid_cubes valid_typeI_div)
[PROOF STATE]
proof (state)
this:
(\<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?twoCube \<in> two_chain \<Longrightarrow> (\<Sum>(k, g)\<in>boundary ?twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage ?twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?twoCube \<in> two_chain \<Longrightarrow> (\<Sum>(k, g)\<in>boundary ?twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage ?twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)
[PROOF STEP]
have double_sum_eq_sum:
    "(\<Sum>twoCube\<in>(two_chain).(\<Sum>(k,g)\<in> boundary twoCube. k * line_integral F {i} g))
                     =  (\<Sum>twoCube\<in>(two_chain). integral (cubeImage twoCube) (\<lambda>a. - ?F_b' a))"
[PROOF STATE]
proof (prove)
using this:
?twoCube \<in> two_chain \<Longrightarrow> (\<Sum>(k, g)\<in>boundary ?twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage ?twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)

goal (1 subgoal):
 1. (\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = (\<Sum>twoCube\<in>two_chain. integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a))
[PROOF STEP]
using Finite_Cartesian_Product.sum_cong_aux
[PROOF STATE]
proof (prove)
using this:
?twoCube \<in> two_chain \<Longrightarrow> (\<Sum>(k, g)\<in>boundary ?twoCube. real_of_int k * line_integral F {i} g) = integral (cubeImage ?twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a)
(\<And>x. x \<in> ?A \<Longrightarrow> ?f x = ?g x) \<Longrightarrow> sum ?f ?A = sum ?g ?A

goal (1 subgoal):
 1. (\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = (\<Sum>twoCube\<in>two_chain. integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = (\<Sum>twoCube\<in>two_chain. integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a))

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
have pairwise_disjoint_boundaries: "\<forall>x\<in> (boundary ` two_chain). (\<forall>y\<in> (boundary ` two_chain). (x \<noteq> y \<longrightarrow> (x \<inter> y = {})))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>boundary ` two_chain. \<forall>y\<in>boundary ` two_chain. x \<noteq> y \<longrightarrow> x \<inter> y = {}
[PROOF STEP]
using no_shared_edges_have_similar_orientations
[PROOF STATE]
proof (prove)
using this:
\<forall>twoCube1\<in>two_chain. \<forall>twoCube2\<in>two_chain. twoCube1 \<noteq> twoCube2 \<longrightarrow> boundary twoCube1 \<inter> boundary twoCube2 = {}

goal (1 subgoal):
 1. \<forall>x\<in>boundary ` two_chain. \<forall>y\<in>boundary ` two_chain. x \<noteq> y \<longrightarrow> x \<inter> y = {}
[PROOF STEP]
by (force simp add: image_def disjoint_iff_not_equal)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>boundary ` two_chain. \<forall>y\<in>boundary ` two_chain. x \<noteq> y \<longrightarrow> x \<inter> y = {}

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
have finite_boundaries: "\<forall>B \<in> (boundary` two_chain). finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>B\<in>boundary ` two_chain. finite B
[PROOF STEP]
using all_two_cubes_have_four_distict_edges
[PROOF STATE]
proof (prove)
using this:
\<forall>twoCube\<in>two_chain. card (boundary twoCube) = 4

goal (1 subgoal):
 1. \<forall>B\<in>boundary ` two_chain. finite B
[PROOF STEP]
using image_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>twoCube\<in>two_chain. card (boundary twoCube) = 4
(?z \<in> ?f ` ?A) = (\<exists>x\<in>?A. ?z = ?f x)

goal (1 subgoal):
 1. \<forall>B\<in>boundary ` two_chain. finite B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>B\<in>boundary ` two_chain. finite B

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
have boundary_inj: "inj_on boundary two_chain"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on boundary two_chain
[PROOF STEP]
using  all_two_cubes_have_four_distict_edges and no_shared_edges_have_similar_orientations
[PROOF STATE]
proof (prove)
using this:
\<forall>twoCube\<in>two_chain. card (boundary twoCube) = 4
\<forall>twoCube1\<in>two_chain. \<forall>twoCube2\<in>two_chain. twoCube1 \<noteq> twoCube2 \<longrightarrow> boundary twoCube1 \<inter> boundary twoCube2 = {}

goal (1 subgoal):
 1. inj_on boundary two_chain
[PROOF STEP]
by (force simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
inj_on boundary two_chain

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
have "(\<Sum>x\<in>(\<Union>(boundary` two_chain)). case x of (k, g) \<Rightarrow> k * line_integral F {i} g)
        = (sum \<circ> sum) (\<lambda>x. case x of (k, g) \<Rightarrow> (k::int) * line_integral F {i} g) (boundary ` two_chain)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = (sum \<circ> sum) (\<lambda>x. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) (boundary ` two_chain)
[PROOF STEP]
using sum.Union_disjoint[OF finite_boundaries pairwise_disjoint_boundaries]
[PROOF STATE]
proof (prove)
using this:
sum ?g (\<Union> (boundary ` two_chain)) = (sum \<circ> sum) ?g (boundary ` two_chain)

goal (1 subgoal):
 1. (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = (sum \<circ> sum) (\<lambda>x. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) (boundary ` two_chain)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = (sum \<circ> sum) (\<lambda>x. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) (boundary ` two_chain)

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = (sum \<circ> sum) (\<lambda>x. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) (boundary ` two_chain)

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
have "... = (\<Sum>twoCube\<in>(two_chain).(\<Sum>(k,g)\<in> boundary twoCube. k * line_integral F {i} g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sum \<circ> sum) (\<lambda>x. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) (boundary ` two_chain) = (\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g)
[PROOF STEP]
using sum.reindex[OF boundary_inj, of "\<lambda>x. (\<Sum>(k,g)\<in> x. k * line_integral F {i} g)"]
[PROOF STATE]
proof (prove)
using this:
sum (sum (\<lambda>(k, g). real_of_int k * line_integral F {i} g)) (boundary ` two_chain) = sum (sum (\<lambda>(k, g). real_of_int k * line_integral F {i} g) \<circ> boundary) two_chain

goal (1 subgoal):
 1. (sum \<circ> sum) (\<lambda>x. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) (boundary ` two_chain) = (\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(sum \<circ> sum) (\<lambda>x. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) (boundary ` two_chain) = (\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g)

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = (\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g)
[PROOF STEP]
show "(\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>(\<Union>x\<in>two_chain. boundary x). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = (\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g)

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
using double_sum_eq_sum
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = (\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g)
(\<Sum>twoCube\<in>two_chain. \<Sum>(k, g)\<in>boundary twoCube. real_of_int k * line_integral F {i} g) = (\<Sum>twoCube\<in>two_chain. integral (cubeImage twoCube) (\<lambda>a. - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j a))

goal (1 subgoal):
 1. (\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>C\<in>two_chain. - integral (cubeImage C) (partial_vector_derivative (\<lambda>x. F x \<bullet> i) j)) = (\<Sum>x\<in>\<Union> (boundary ` two_chain). case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma null_space_orthogonal_complement_row_space_reals:
  fixes A::"real^'cols::{finite,wellorder}^'rows::{finite,wellorder}"
  shows "null_space A = real_matrix.orthogonal_complement (row_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_space A = real_matrix.v.orthogonal_complement (row_space A)
[PROOF STEP]
using real_matrix.null_space_orthogonal_complement_row_space[of A]
[PROOF STATE]
proof (prove)
using this:
null_space A = real_matrix.v.orthogonal_complement (row_space (\<chi>i j. cnj_class.cnj (A $ i $ j)))

goal (1 subgoal):
 1. null_space A = real_matrix.v.orthogonal_complement (row_space A)
[PROOF STEP]
unfolding cnj_real_def
[PROOF STATE]
proof (prove)
using this:
null_space A = real_matrix.v.orthogonal_complement (row_space (\<chi>i j. id (A $ i $ j)))

goal (1 subgoal):
 1. null_space A = real_matrix.v.orthogonal_complement (row_space A)
[PROOF STEP]
by (simp add: vec_lambda_eta)