[STATEMENT]
lemma mono_bag_of: "mono (bag_of :: 'a list => ('a::order) multiset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono mset
[PROOF STEP]
apply (rule monoI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> mset x \<le> mset y
[PROOF STEP]
apply (unfold prefix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> genPrefix Id \<Longrightarrow> mset x \<le> mset y
[PROOF STEP]
apply (erule genPrefix.induct, simp_all add: add_right_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs ys zs. \<lbrakk>(xs, ys) \<in> genPrefix Id; mset xs \<le> mset ys\<rbrakk> \<Longrightarrow> mset xs \<le> mset ys + mset zs
[PROOF STEP]
apply (erule order_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs ys zs. (xs, ys) \<in> genPrefix Id \<Longrightarrow> mset ys \<le> mset ys + mset zs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iless_eSuc0[simp]: "(n < eSuc 0) = (n = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n < eSuc 0) = (n = 0)
[PROOF STEP]
by (simp add: zero_enat_def eSuc_def less_enat_def split: enat.split)


[STATEMENT]
lemma CauchyI: "(\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e) \<Longrightarrow> Cauchy X"
  for X :: "nat \<Rightarrow> 'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e) \<Longrightarrow> Cauchy X
[PROOF STEP]
by (simp add: Cauchy_iff)


[STATEMENT]
lemma divideC_field_splits_simps_2 [field_split_simps]: (* In Real_Vector_Spaces, these lemmas are unnamed *)
  "0 < c \<Longrightarrow> a \<le> b /\<^sub>C c \<longleftrightarrow> (if c > 0 then c *\<^sub>C a \<le> b else if c < 0 then b \<le> c *\<^sub>C a else a \<le> 0)"
  "0 < c \<Longrightarrow> a < b /\<^sub>C c \<longleftrightarrow> (if c > 0 then c *\<^sub>C a < b else if c < 0 then b < c *\<^sub>C a else a < 0)"
  "0 < c \<Longrightarrow> b /\<^sub>C c \<le> a \<longleftrightarrow> (if c > 0 then b \<le> c *\<^sub>C a else if c < 0 then c *\<^sub>C a \<le> b else a \<ge> 0)"
  "0 < c \<Longrightarrow> b /\<^sub>C c < a \<longleftrightarrow> (if c > 0 then b < c *\<^sub>C a else if c < 0 then c *\<^sub>C a < b else a > 0)"
  "0 < c \<Longrightarrow> a \<le> - (b /\<^sub>C c) \<longleftrightarrow> (if c > 0 then c *\<^sub>C a \<le> - b else if c < 0 then - b \<le> c *\<^sub>C a else a \<le> 0)"
  "0 < c \<Longrightarrow> a < - (b /\<^sub>C c) \<longleftrightarrow> (if c > 0 then c *\<^sub>C a < - b else if c < 0 then - b < c *\<^sub>C a else a < 0)"
  "0 < c \<Longrightarrow> - (b /\<^sub>C c) \<le> a \<longleftrightarrow> (if c > 0 then - b \<le> c *\<^sub>C a else if c < 0 then c *\<^sub>C a \<le> - b else a \<ge> 0)"
  "0 < c \<Longrightarrow> - (b /\<^sub>C c) < a \<longleftrightarrow> (if c > 0 then - b < c *\<^sub>C a else if c < 0 then c *\<^sub>C a < - b else a > 0)"
  for a b :: "'a :: ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((0 < c \<Longrightarrow> (a \<le> b /\<^sub>C c) = (if 0 < c then c *\<^sub>C a \<le> b else if c < 0 then b \<le> c *\<^sub>C a else a \<le> (0::'a))) &&& (0 < c \<Longrightarrow> (a < b /\<^sub>C c) = (if 0 < c then c *\<^sub>C a < b else if c < 0 then b < c *\<^sub>C a else a < (0::'a)))) &&& (0 < c \<Longrightarrow> (b /\<^sub>C c \<le> a) = (if 0 < c then b \<le> c *\<^sub>C a else if c < 0 then c *\<^sub>C a \<le> b else (0::'a) \<le> a)) &&& (0 < c \<Longrightarrow> (b /\<^sub>C c < a) = (if 0 < c then b < c *\<^sub>C a else if c < 0 then c *\<^sub>C a < b else (0::'a) < a))) &&& ((0 < c \<Longrightarrow> (a \<le> - (b /\<^sub>C c)) = (if 0 < c then c *\<^sub>C a \<le> - b else if c < 0 then - b \<le> c *\<^sub>C a else a \<le> (0::'a))) &&& (0 < c \<Longrightarrow> (a < - (b /\<^sub>C c)) = (if 0 < c then c *\<^sub>C a < - b else if c < 0 then - b < c *\<^sub>C a else a < (0::'a)))) &&& (0 < c \<Longrightarrow> (- (b /\<^sub>C c) \<le> a) = (if 0 < c then - b \<le> c *\<^sub>C a else if c < 0 then c *\<^sub>C a \<le> - b else (0::'a) \<le> a)) &&& (0 < c \<Longrightarrow> (- (b /\<^sub>C c) < a) = (if 0 < c then - b < c *\<^sub>C a else if c < 0 then c *\<^sub>C a < - b else (0::'a) < a))
[PROOF STEP]
by (clarsimp intro!: field_simps)+


[STATEMENT]
lemma prod_bij: "\<lbrakk>bij_betw f A C; bij_betw g B D\<rbrakk>
             \<Longrightarrow> bij_betw (\<lambda>(x, y). (f x, g y)) (A \<times> B) (C \<times> D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij_betw f A C; bij_betw g B D\<rbrakk> \<Longrightarrow> bij_betw (\<lambda>(x, y). (f x, g y)) (A \<times> B) (C \<times> D)
[PROOF STEP]
apply (rule bij_betw_byWitness [where f' = "\<lambda>(x,y). (inv_into A f x, inv_into B g y)"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>bij_betw f A C; bij_betw g B D\<rbrakk> \<Longrightarrow> \<forall>a\<in>A \<times> B. (case case a of (x, y) \<Rightarrow> (f x, g y) of (x, y) \<Rightarrow> (inv_into A f x, inv_into B g y)) = a
 2. \<lbrakk>bij_betw f A C; bij_betw g B D\<rbrakk> \<Longrightarrow> \<forall>a'\<in>C \<times> D. (case case a' of (x, y) \<Rightarrow> (inv_into A f x, inv_into B g y) of (x, y) \<Rightarrow> (f x, g y)) = a'
 3. \<lbrakk>bij_betw f A C; bij_betw g B D\<rbrakk> \<Longrightarrow> (\<lambda>(x, y). (f x, g y)) ` (A \<times> B) \<subseteq> C \<times> D
 4. \<lbrakk>bij_betw f A C; bij_betw g B D\<rbrakk> \<Longrightarrow> (\<lambda>(x, y). (inv_into A f x, inv_into B g y)) ` (C \<times> D) \<subseteq> A \<times> B
[PROOF STEP]
apply (auto simp: bij_betw_inv_into_left bij_betw_inv_into_right bij_betwE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>aa ba. \<lbrakk>bij_betw f A C; bij_betw g B D; aa \<in> C; ba \<in> D\<rbrakk> \<Longrightarrow> inv_into A f aa \<in> A
 2. \<And>aa ba. \<lbrakk>bij_betw f A C; bij_betw g B D; aa \<in> C; ba \<in> D\<rbrakk> \<Longrightarrow> inv_into B g ba \<in> B
[PROOF STEP]
using bij_betwE bij_betw_inv_into
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> \<forall>a\<in>?A. ?f a \<in> ?B
bij_betw ?f ?A ?B \<Longrightarrow> bij_betw (inv_into ?A ?f) ?B ?A

goal (2 subgoals):
 1. \<And>aa ba. \<lbrakk>bij_betw f A C; bij_betw g B D; aa \<in> C; ba \<in> D\<rbrakk> \<Longrightarrow> inv_into A f aa \<in> A
 2. \<And>aa ba. \<lbrakk>bij_betw f A C; bij_betw g B D; aa \<in> C; ba \<in> D\<rbrakk> \<Longrightarrow> inv_into B g ba \<in> B
[PROOF STEP]
apply blast+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma coprime_of_int_gauss_int: "coprime (of_int a :: gauss_int) (of_int b) = coprime a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (of_int a) (of_int b) = coprime a b
[PROOF STEP]
unfolding coprime_iff_gcd_eq_1 gcd_of_int_gauss_int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_int (gcd a b) = 1) = (gcd a b = 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma invertible_mat_n:
  fixes n::"'a::{field}"
  assumes n: "n \<noteq> 0"
  shows "invertible ((mat n)::'a^'n^'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (mat n)
[PROOF STEP]
proof (unfold invertible_def, rule exI[of _ "mat (inverse n)"], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mat n ** mat (inverse n) = mat (1::'a)
 2. mat (inverse n) ** mat n = mat (1::'a)
[PROOF STEP]
show "mat n ** mat (inverse n) = (mat 1::'a^'n^'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat n ** mat (inverse n) = mat (1::'a)
[PROOF STEP]
proof (unfold matrix_matrix_mult_def mat_def, vector, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
fix ia::'n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
let ?f="(\<lambda>k. (if ia = k then n else 0) * (if k = ia then inverse n else 0))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
have UNIV_rw: "(UNIV::'n set) = insert ia (UNIV-{ia})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = insert ia (UNIV - {ia})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
UNIV = insert ia (UNIV - {ia})

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
have "(\<Sum>k\<in>(UNIV::'n set). (if ia = k then n else 0) * (if k = ia then inverse n else 0)) =
      (\<Sum>k\<in>insert ia (UNIV-{ia}). (if ia = k then n else 0) * (if k = ia then inverse n else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a)))
[PROOF STEP]
using UNIV_rw
[PROOF STATE]
proof (prove)
using this:
UNIV = insert ia (UNIV - {ia})

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a)))

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a)))

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
have "... = ?f ia + sum ?f (UNIV-{ia})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (if ia = ia then n else (0::'a)) * (if ia = ia then inverse n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a)))
[PROOF STEP]
proof (rule sum.insert)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (UNIV - {ia})
 2. ia \<notin> UNIV - {ia}
[PROOF STEP]
show "finite (UNIV - {ia})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (UNIV - {ia})
[PROOF STEP]
using finite_UNIV
[PROOF STATE]
proof (prove)
using this:
finite_UNIV = Phantom(?'a) (finite UNIV)

goal (1 subgoal):
 1. finite (UNIV - {ia})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
finite (UNIV - {ia})

goal (1 subgoal):
 1. ia \<notin> UNIV - {ia}
[PROOF STEP]
show "ia \<notin> UNIV - {ia}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia \<notin> UNIV - {ia}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
ia \<notin> UNIV - {ia}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (if ia = ia then n else (0::'a)) * (if ia = ia then inverse n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a)))

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (if ia = ia then n else (0::'a)) * (if ia = ia then inverse n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a)))

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if ia = ia then n else (0::'a)) * (if ia = ia then inverse n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
[PROOF STEP]
using right_inverse[OF n]
[PROOF STATE]
proof (prove)
using this:
n * inverse n = (1::'a)

goal (1 subgoal):
 1. (if ia = ia then n else (0::'a)) * (if ia = ia then inverse n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if ia = ia then n else (0::'a)) * (if ia = ia then inverse n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
[PROOF STEP]
show " (\<Sum>k\<in>(UNIV::'n set). (if ia = k then n else 0) * (if k = ia then inverse n else 0)) = (1::'a)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (if ia = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (1::'a)

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
fix i::'n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
assume i_not_ia: "i \<noteq> ia"
[PROOF STATE]
proof (state)
this:
i \<noteq> ia

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
show "(\<Sum>k\<in>(UNIV::'n set). (if i = k then n else 0) * (if k = ia then inverse n else 0)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, simp add: i_not_ia)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (if i = k then n else (0::'a)) * (if k = ia then inverse n else (0::'a))) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat n ** mat (inverse n) = mat (1::'a)

goal (1 subgoal):
 1. mat (inverse n) ** mat n = mat (1::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat (inverse n) ** mat n = mat (1::'a)
[PROOF STEP]
show "mat (inverse n) ** mat n = ((mat 1)::'a^'n^'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (inverse n) ** mat n = mat (1::'a)
[PROOF STEP]
proof (unfold matrix_matrix_mult_def mat_def, vector, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
fix ia::'n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
let ?f=" (\<lambda>k. (if ia = k then inverse n else 0) * (if k = ia then n else 0))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
have UNIV_rw: "(UNIV::'n set) = insert ia (UNIV-{ia})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = insert ia (UNIV - {ia})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
UNIV = insert ia (UNIV - {ia})

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
have "(\<Sum>k\<in>(UNIV::'n set). (if ia = k then inverse n else 0) * (if k = ia then n else 0)) =
      (\<Sum>k\<in>insert ia (UNIV-{ia}). (if ia = k then inverse n else 0) * (if k = ia then n else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a)))
[PROOF STEP]
using UNIV_rw
[PROOF STATE]
proof (prove)
using this:
UNIV = insert ia (UNIV - {ia})

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a)))

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a)))

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
have "... = ?f ia + sum ?f (UNIV-{ia})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (if ia = ia then inverse n else (0::'a)) * (if ia = ia then n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a)))
[PROOF STEP]
proof (rule sum.insert)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (UNIV - {ia})
 2. ia \<notin> UNIV - {ia}
[PROOF STEP]
show "finite (UNIV - {ia})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (UNIV - {ia})
[PROOF STEP]
using finite_UNIV
[PROOF STATE]
proof (prove)
using this:
finite_UNIV = Phantom(?'a) (finite UNIV)

goal (1 subgoal):
 1. finite (UNIV - {ia})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
finite (UNIV - {ia})

goal (1 subgoal):
 1. ia \<notin> UNIV - {ia}
[PROOF STEP]
show "ia \<notin> UNIV - {ia}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia \<notin> UNIV - {ia}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
ia \<notin> UNIV - {ia}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (if ia = ia then inverse n else (0::'a)) * (if ia = ia then n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a)))

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert ia (UNIV - {ia}). (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (if ia = ia then inverse n else (0::'a)) * (if ia = ia then n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a)))

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if ia = ia then inverse n else (0::'a)) * (if ia = ia then n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
[PROOF STEP]
using left_inverse[OF n]
[PROOF STATE]
proof (prove)
using this:
inverse n * n = (1::'a)

goal (1 subgoal):
 1. (if ia = ia then inverse n else (0::'a)) * (if ia = ia then n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if ia = ia then inverse n else (0::'a)) * (if ia = ia then n else (0::'a)) + (\<Sum>k\<in>UNIV - {ia}. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)

goal (2 subgoals):
 1. \<And>ia. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
[PROOF STEP]
show " (\<Sum>k\<in>(UNIV::'n set). (if ia = k then inverse n else 0) * (if k = ia then n else 0)) = (1::'a)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (if ia = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (1::'a)

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
fix i::'n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
assume i_not_ia: "i \<noteq> ia"
[PROOF STATE]
proof (state)
this:
i \<noteq> ia

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
show "(\<Sum>k\<in>(UNIV::'n set). (if i = k then inverse n else 0) * (if k = ia then n else 0)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, simp add: i_not_ia)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (if i = k then inverse n else (0::'a)) * (if k = ia then n else (0::'a))) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat (inverse n) ** mat n = mat (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma luckyFind_eval' : "
      (\<exists>xs. (length xs = var + 1) \<and> eval (list_conj (map fm.Atom L @ F)) (xs @ \<Gamma>)) =
      (\<exists>xs. (length xs = var + 1) \<and> eval (luckyFind' var L F) (xs @ \<Gamma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>xs. length xs = var + 1 \<and> eval (list_conj (map fm.Atom L @ F)) (xs @ \<Gamma>)) = (\<exists>xs. length xs = var + 1 \<and> eval (luckyFind' var L F) (xs @ \<Gamma>))
[PROOF STEP]
apply(rule step_converter[of luckyFind' var L F \<Gamma>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs var L F \<Gamma>. length xs = var \<Longrightarrow> (\<exists>x. eval (list_conj (map fm.Atom L @ F)) (xs @ x # \<Gamma>)) = (\<exists>x. eval (luckyFind' var L F) (xs @ x # \<Gamma>))
[PROOF STEP]
using luckyFind'_eval
[PROOF STATE]
proof (prove)
using this:
length ?xs = ?var \<Longrightarrow> (\<exists>x. eval (list_conj (map fm.Atom ?L @ ?F)) (?xs @ x # ?\<Gamma>)) = (\<exists>x. eval (luckyFind' ?var ?L ?F) (?xs @ x # ?\<Gamma>))

goal (1 subgoal):
 1. \<And>xs var L F \<Gamma>. length xs = var \<Longrightarrow> (\<exists>x. eval (list_conj (map fm.Atom L @ F)) (xs @ x # \<Gamma>)) = (\<exists>x. eval (luckyFind' var L F) (xs @ x # \<Gamma>))
[PROOF STEP]
by blast