[STATEMENT]
lemma  cross_linear_image:
   "\<lbrakk>linear f; \<And>x. norm(f x) = norm x; det(matrix f) = 1\<rbrakk>
           \<Longrightarrow> (f x) \<times> (f y) = f(x \<times> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>linear f; \<And>x. norm (f x) = norm x; det (matrix f) = 1\<rbrakk> \<Longrightarrow> f x \<times> f y = f (x \<times> y)
[PROOF STEP]
by (simp add: cross_orthogonal_transformation orthogonal_transformation)


[STATEMENT]
lemma [simp]: "(\<Sum>\<^bsub>v \<in> V\<^esub> 0) = (0::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^bsub>v\<in>V\<^esub> 0) = 0
[PROOF STEP]
by (induct V) simp_all


[STATEMENT]
lemma powr_to_1 [simp]: "z powr 1 = (z::complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z powr 1 = z
[PROOF STEP]
by (simp add: powr_def)


[STATEMENT]
lemma detAB_Znm:
  assumes A: "A \<in> carrier_mat n m"
    and B: "B \<in> carrier_mat m n"
  shows "det (A*B) = (\<Sum>(f, \<pi>)\<in>Z n m. signof \<pi> * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
let ?V="{0..<n}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
let ?U = "{0..<m}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
let ?PU = "{p. p permutes ?U}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
let ?F = " {f. (\<forall>i\<in> {0..<n}. f i \<in> ?U) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
let ?f = "\<lambda>f. det (mat\<^sub>r n n (\<lambda> i. A $$ (i, f i) \<cdot>\<^sub>v row B (f i)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
let ?g = "\<lambda>f. det (mat\<^sub>r n n (\<lambda> i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have fm: "finite {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {0..<m}

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have fn: "finite {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {0..<n}

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have F: "?F= {f. f \<in> {0..<n} \<rightarrow> {0..<m} \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} = {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} = {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have det_rw: "det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i))) =
    (prod (\<lambda>i. B $$ (f i, i)) {0..<n}) * det (mat\<^sub>r n n (\<lambda>i. col A (f i)))"
    if  f: "(\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)" for f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i))) = (\<Prod>i = 0..<n. B $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i)))
[PROOF STEP]
by (rule det_rows_mul, insert A col_dim, auto)
[PROOF STATE]
proof (state)
this:
(\<forall>i\<in>{0..<n}. ?f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> ?f i = i) \<Longrightarrow> Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (?f i, i) \<cdot>\<^sub>v col A (?f i))) = (\<Prod>i = 0..<n. B $$ (?f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (?f i)))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have det_rw2: "det (mat\<^sub>r n n (\<lambda>i. col A (f i)))
  = (\<Sum>\<pi> | \<pi> permutes {0..<n}. signof \<pi> * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))"
    if f: "f \<in> ?F" for f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))
[PROOF STEP]
proof (unfold Determinant.det_def, auto, rule sum.cong, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x permutes {0..<n} \<Longrightarrow> of_int (sign x) * (\<Prod>i = 0..<n. col A (f i) $v x i) = of_int (sign x) * (\<Prod>i = 0..<n. A $$ (x i, f i))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x permutes {0..<n} \<Longrightarrow> of_int (sign x) * (\<Prod>i = 0..<n. col A (f i) $v x i) = of_int (sign x) * (\<Prod>i = 0..<n. A $$ (x i, f i))
[PROOF STEP]
assume x: "x permutes {0..<n}"
[PROOF STATE]
proof (state)
this:
x permutes {0..<n}

goal (1 subgoal):
 1. \<And>x. x permutes {0..<n} \<Longrightarrow> of_int (sign x) * (\<Prod>i = 0..<n. col A (f i) $v x i) = of_int (sign x) * (\<Prod>i = 0..<n. A $$ (x i, f i))
[PROOF STEP]
have "(\<Prod>i = 0..<n. col A (f i) $v x i) = (\<Prod>i = 0..<n. A $$ (x i, f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. col A (f i) $v x i) = (\<Prod>i = 0..<n. A $$ (x i, f i))
[PROOF STEP]
proof (rule prod.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..<n} = {0..<n}
 2. \<And>xa. xa \<in> {0..<n} \<Longrightarrow> col A (f xa) $v x xa = A $$ (x xa, f xa)
[PROOF STEP]
fix xa
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..<n} = {0..<n}
 2. \<And>xa. xa \<in> {0..<n} \<Longrightarrow> col A (f xa) $v x xa = A $$ (x xa, f xa)
[PROOF STEP]
assume xa: "xa \<in> {0..<n}"
[PROOF STATE]
proof (state)
this:
xa \<in> {0..<n}

goal (2 subgoals):
 1. {0..<n} = {0..<n}
 2. \<And>xa. xa \<in> {0..<n} \<Longrightarrow> col A (f xa) $v x xa = A $$ (x xa, f xa)
[PROOF STEP]
show "col A (f xa) $v x xa = A $$ (x xa, f  xa)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col A (f xa) $v x xa = A $$ (x xa, f xa)
[PROOF STEP]
by (metis A atLeastLessThan_iff carrier_matD(1) col_def index_vec permutes_less(1) x xa)
[PROOF STATE]
proof (state)
this:
col A (f xa) $v x xa = A $$ (x xa, f xa)

goal (1 subgoal):
 1. {0..<n} = {0..<n}
[PROOF STEP]
qed (auto)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. col A (f i) $v x i) = (\<Prod>i = 0..<n. A $$ (x i, f i))

goal (1 subgoal):
 1. \<And>x. x permutes {0..<n} \<Longrightarrow> of_int (sign x) * (\<Prod>i = 0..<n. col A (f i) $v x i) = of_int (sign x) * (\<Prod>i = 0..<n. A $$ (x i, f i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>i = 0..<n. col A (f i) $v x i) = (\<Prod>i = 0..<n. A $$ (x i, f i))
[PROOF STEP]
show "signof x * (\<Prod>i = 0..<n. col A (f i) $v x i)
      = signof x * (\<Prod>i = 0..<n. A $$ (x i, f i))"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i = 0..<n. col A (f i) $v x i) = (\<Prod>i = 0..<n. A $$ (x i, f i))

goal (1 subgoal):
 1. of_int (sign x) * (\<Prod>i = 0..<n. col A (f i) $v x i) = of_int (sign x) * (\<Prod>i = 0..<n. A $$ (x i, f i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int (sign x) * (\<Prod>i = 0..<n. col A (f i) $v x i) = of_int (sign x) * (\<Prod>i = 0..<n. A $$ (x i, f i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?f \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} \<Longrightarrow> Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (?f i))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, ?f i)))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have fin_n: "finite {0..<n}" and fin_m: "finite {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..<n} &&& finite {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {0..<n}
finite {0..<m}

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "det (A*B) = det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a::comm_ring_1) n
    (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v Matrix.col A k) {0..<m}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
by (rule det_mul_finsum_alt[OF A B])
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... = sum ?g ?F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i))))
[PROOF STEP]
by (rule det_linear_rows_sum[OF fm], auto simp add: A)
[PROOF STATE]
proof (state)
this:
Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... = (\<Sum>f\<in>?F. prod (\<lambda>i. B $$ (f i, i)) {0..<n} * det (mat\<^sub>r n n (\<lambda>i. col A (f i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i))))
[PROOF STEP]
using det_rw
[PROOF STATE]
proof (prove)
using this:
(\<forall>i\<in>{0..<n}. ?f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> ?f i = i) \<Longrightarrow> Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (?f i, i) \<cdot>\<^sub>v col A (?f i))) = (\<Prod>i = 0..<n. B $$ (?f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (?f i)))

goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). Determinant.det (mat\<^sub>r n n (\<lambda>i. B $$ (f i, i) \<cdot>\<^sub>v col A (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... = (\<Sum>f\<in>?F. prod (\<lambda>i. B $$ (f i, i)) {0..<n} *
  (\<Sum>\<pi> | \<pi> permutes {0..<n}. signof \<pi> * (\<Prod>i = 0..<n. A $$ (\<pi> i, f (i)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (\<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))
[PROOF STEP]
by (rule sum.cong, auto simp add: det_rw2)
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (\<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col A (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (\<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... =
  (\<Sum>f\<in>?F. \<Sum>\<pi> | \<pi> permutes {0..<n}. prod (\<lambda>i. B $$ (f i, i)) {0..<n}
    * (signof \<pi> * (\<Prod>i = 0..<n. A $$ (\<pi> i, f (i)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (\<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))
[PROOF STEP]
by (simp add: mult_hom.hom_sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (\<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (\<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f\<in>?F.prod (\<lambda>i. B $$ (f i, i)) {0..<n}
    * (signof \<pi> * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))
[PROOF STEP]
by (rule VS_Connect.class_semiring.finsum_finsum_swap,
      insert finite_permutations finite_bounded_functions[OF fin_m fin_n], auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
thm detAB_Znm_aux
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f\<in>?F. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i))
  * (signof \<pi> * (\<Prod>i = 0..<n. A $$ (i, f i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i))))
[PROOF STEP]
by (rule detAB_Znm_aux, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (\<pi> i, f i)))) = (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... = (\<Sum>f\<in>?F.\<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i))
  * (signof \<pi> * (\<Prod>i = 0..<n. A $$ (i, f i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i))))
[PROOF STEP]
by (rule VS_Connect.class_semiring.finsum_finsum_swap,
      insert finite_permutations finite_bounded_functions[OF fin_m fin_n], auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<pi> | \<pi> permutes {0..<n}. \<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... =  (\<Sum>f\<in>?F.\<Sum>\<pi> | \<pi> permutes {0..<n}. signof \<pi>
    * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
unfolding prod.distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * ((\<Prod>i = 0..<n. A $$ (i, f i)) * (\<Prod>i = 0..<n. B $$ (f i, \<pi> i))))
[PROOF STEP]
by (rule sum.cong, auto, rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. (\<Prod>i = 0..<n. B $$ (f i, \<pi> i)) * (of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
have "... = sum (\<lambda>(f,\<pi>). (signof \<pi>)
    * (prod (\<lambda>i. A$$(i,f i) * B $$ (f i, \<pi> i)) {0..<n})) (Z n m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i))) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
unfolding Z_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i))) = (\<Sum>(f, \<pi>)\<in>{f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i} \<times> {\<pi>. \<pi> permutes {0..<n}}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
unfolding sum.cartesian_product[symmetric] F
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | f \<in> {0..<n} \<rightarrow> {0..<m} \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i))) = (\<Sum>x\<in>{f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}. \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, x i) * B $$ (x i, \<pi> i)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). \<Sum>\<pi> | \<pi> permutes {0..<n}. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i))) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = (\<Sum>(f, \<pi>)\<in>Z n m. of_int (sign \<pi>) * (\<Prod>i = 0..<n. A $$ (i, f i) * B $$ (f i, \<pi> i)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_inter_closure_rel_interior:
  fixes S A :: "'n::euclidean_space set"
  assumes "convex S"
    and "open A"
  shows "A \<inter> closure S = {} \<longleftrightarrow> A \<inter> rel_interior S = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<inter> closure S = {}) = (A \<inter> rel_interior S = {})
[PROOF STEP]
by (metis assms convex_closure_rel_interior open_Int_closure_eq_empty)


[STATEMENT]
lemma is_monomial_set_Un: "is_monomial_set (A \<union> B) \<longleftrightarrow> (is_monomial_set A \<and> is_monomial_set B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_monomial_set (A \<union> B) = (is_monomial_set A \<and> is_monomial_set B)
[PROOF STEP]
by (auto simp: is_monomial_set_def)


[STATEMENT]
lemma smult_scalar_prod_distrib[simp]: assumes v: "v\<^sub>1 \<in> carrier_vec n" "v\<^sub>2 \<in> carrier_vec n"
  shows "(a \<cdot>\<^sub>v v\<^sub>1) \<bullet> v\<^sub>2 = a * (v\<^sub>1 \<bullet> v\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<cdot>\<^sub>v v\<^sub>1) \<bullet> v\<^sub>2 = a * (v\<^sub>1 \<bullet> v\<^sub>2)
[PROOF STEP]
unfolding scalar_prod_def sum_distrib_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec v\<^sub>2. (a \<cdot>\<^sub>v v\<^sub>1) $ i * v\<^sub>2 $ i) = (\<Sum>n = 0..<dim_vec v\<^sub>2. a * (v\<^sub>1 $ n * v\<^sub>2 $ n))
[PROOF STEP]
by (rule sum.cong, insert v, auto simp: ac_simps)


[STATEMENT]
lemma measurable_measure_Diff:
  assumes "A \<in> fmeasurable M" "B \<in> sets M" "B \<subseteq> A"
  shows "measure M (A - B) = measure M A - measure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M B
[PROOF STEP]
by (simp add: assms fmeasurableD fmeasurableD2 measure_Diff)


[STATEMENT]
theorem FIN_subset_CP: "FIN \<subset> CP"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FIN \<subset> CP
[PROOF STEP]
using U0_in_CP U0_not_in_FIN FIN_subseteq_CP
[PROOF STATE]
proof (prove)
using this:
U\<^sub>0 \<in> CP
U\<^sub>0 \<notin> FIN
FIN \<subseteq> CP

goal (1 subgoal):
 1. FIN \<subset> CP
[PROOF STEP]
by auto


[STATEMENT]
lemma integral_powr:
  "y \<noteq> -1 \<Longrightarrow> a \<le> b \<Longrightarrow> a > 0 \<Longrightarrow> integral {a..b} (\<lambda>x. x powr y :: real) =
     inverse (y + 1) * (b powr (y + 1) - a powr (y + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<noteq> - 1; a \<le> b; 0 < a\<rbrakk> \<Longrightarrow> integral {a..b} (\<lambda>x. x powr y) = inverse (y + 1) * (b powr (y + 1) - a powr (y + 1))
[PROOF STEP]
by (subst right_diff_distrib, intro integral_unique fundamental_theorem_of_calculus_real)
     (auto intro!: derivative_eq_intros)


[STATEMENT]
lemma replicate_mset_plus: "replicate_mset (a + b) C = replicate_mset a C + replicate_mset b C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replicate_mset (a + b) C = replicate_mset a C + replicate_mset b C
[PROOF STEP]
by (induct a) (auto simp: ac_simps)


[STATEMENT]
lemma ccINF_union:
  "countable A \<Longrightarrow> countable B \<Longrightarrow> (INF i\<in>A \<union> B. M i) = inf (INF i\<in>A. M i) (INF i\<in>B. M i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; countable B\<rbrakk> \<Longrightarrow> Inf (M ` (A \<union> B)) = inf (Inf (M ` A)) (Inf (M ` B))
[PROOF STEP]
by (auto intro!: order.antisym ccINF_mono intro: le_infI1 le_infI2 ccINF_greatest ccINF_lower)