[STATEMENT]
lemma foldl_Gauss_Jordan_column_k_eq:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}"
  assumes k: "k<ncols A"
  shows matrix_to_iarray_Gauss_Jordan_upt_k[code_unfold]: "matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k"
  and fst_foldl_Gauss_Jordan_column_k_eq: "fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])"
  and fst_foldl_Gauss_Jordan_column_k_less: "fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k &&& fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) &&& fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k &&& fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) &&& fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. 0 < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A 0) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) 0
 2. 0 < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc 0]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0])
 3. 0 < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0]) \<le> nrows A
 4. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 5. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 6. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
show "matrix_to_iarray (Gauss_Jordan_upt_k A 0) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gauss_Jordan_upt_k A 0) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) 0
[PROOF STEP]
unfolding Gauss_Jordan_upt_k_def Gauss_Jordan_upt_k_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0])) = snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc 0])
[PROOF STEP]
by (auto, metis k le0 less_nat_zero_code matrix_to_iarray_Gauss_Jordan_column_k_2 neq0_conv)
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gauss_Jordan_upt_k A 0) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) 0

goal (5 subgoals):
 1. 0 < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc 0]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0])
 2. 0 < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0]) \<le> nrows A
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 4. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 5. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
show "fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc 0]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc 0]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0])
[PROOF STEP]
unfolding Gauss_Jordan_upt_k_def Gauss_Jordan_upt_k_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc 0]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0])
[PROOF STEP]
by (auto, metis gr_implies_not0 k le0 matrix_to_iarray_Gauss_Jordan_column_k_1 neq0_conv)
[PROOF STATE]
proof (state)
this:
fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc 0]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0])

goal (4 subgoals):
 1. 0 < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0]) \<le> nrows A
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 4. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
show "fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0]) \<le> nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0]) \<le> nrows A
[PROOF STEP]
unfolding Gauss_Jordan_upt_k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0]) \<le> nrows A
[PROOF STEP]
by (simp add: Gauss_Jordan_column_k_def Let_def size1 nrows_def)
[PROOF STATE]
proof (state)
this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc 0]) \<le> nrows A

goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
assume "(k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k)" and
    "(k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))"
    and "(k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A)"
    and Suc_k_less_card: "Suc k < ncols A"
[PROOF STATE]
proof (state)
this:
k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k
k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])
k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A
Suc k < ncols A

goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
hence hyp1: "matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k"
    and hyp2: "fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])"
    and hyp3: "fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A"
[PROOF STATE]
proof (prove)
using this:
k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k
k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])
k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A
Suc k < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k &&& fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) &&& fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k
fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A

goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
hence hyp1_unfolded: "matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])"
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k
fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A

goal (1 subgoal):
 1. matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])
[PROOF STEP]
using hyp1
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k
fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A
matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k

goal (1 subgoal):
 1. matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])
[PROOF STEP]
unfolding Gauss_Jordan_upt_k_def Gauss_Jordan_upt_k_iarrays_def
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])
fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A
matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])

goal (1 subgoal):
 1. matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])

goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
have upt_rw: "[0..<Suc (Suc k)] = [0..<Suc k] @ [(Suc k)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]

goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
have fold_rw: "(foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])
    = (fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k] = (fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k] = (fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]))

goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
have fold_rw': "(foldl Gauss_Jordan_column_k (0, A) [0..<(Suc k)])
    = (fst (foldl Gauss_Jordan_column_k (0, A) [0..<(Suc k)]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<(Suc k)]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl Gauss_Jordan_column_k (0, A) [0..<Suc k] = (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldl Gauss_Jordan_column_k (0, A) [0..<Suc k] = (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))

goal (3 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
 3. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
show "fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])
[PROOF STEP]
unfolding upt_rw foldl_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k_iarrays (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) [Suc k]) = fst (foldl Gauss_Jordan_column_k (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) [Suc k])
[PROOF STEP]
unfolding List.foldl.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_iarrays (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) (Suc k)) = fst (Gauss_Jordan_column_k (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) (Suc k))
[PROOF STEP]
apply (subst fold_rw)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_iarrays (fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])) (Suc k)) = fst (Gauss_Jordan_column_k (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) (Suc k))
[PROOF STEP]
apply (subst fold_rw')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_iarrays (fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])) (Suc k)) = fst (Gauss_Jordan_column_k (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) (Suc k))
[PROOF STEP]
unfolding hyp2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_iarrays (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])) (Suc k)) = fst (Gauss_Jordan_column_k (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) (Suc k))
[PROOF STEP]
unfolding hyp1_unfolded[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_iarrays (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))) (Suc k)) = fst (Gauss_Jordan_column_k (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) (Suc k))
[PROOF STEP]
proof (rule matrix_to_iarray_Gauss_Jordan_column_k_1[symmetric, of "Suc k" "(snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc k < ncols (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))
 2. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))
[PROOF STEP]
show "Suc k < ncols (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k < ncols (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))
[PROOF STEP]
using Suc_k_less_card
[PROOF STATE]
proof (prove)
using this:
Suc k < ncols A

goal (1 subgoal):
 1. Suc k < ncols (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
Suc k < CARD('columns)

goal (1 subgoal):
 1. Suc k < CARD('columns)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Suc k < ncols (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))

goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))
[PROOF STEP]
show " fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))
[PROOF STEP]
using hyp3
[PROOF STATE]
proof (prove)
using this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A

goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)

goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc (Suc k)]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)])

goal (2 subgoals):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
show "matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
unfolding Gauss_Jordan_upt_k_def Gauss_Jordan_upt_k_iarrays_def  upt_rw foldl_append  List.foldl.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_column_k (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) (Suc k))) = snd (Gauss_Jordan_column_k_iarrays (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) (Suc k))
[PROOF STEP]
apply (subst fold_rw)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_column_k (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) (Suc k))) = snd (Gauss_Jordan_column_k_iarrays (fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])) (Suc k))
[PROOF STEP]
apply (subst fold_rw')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_column_k (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) (Suc k))) = snd (Gauss_Jordan_column_k_iarrays (fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k])) (Suc k))
[PROOF STEP]
unfolding hyp2 hyp1_unfolded[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_column_k (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) (Suc k))) = snd (Gauss_Jordan_column_k_iarrays (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), matrix_to_iarray (snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))) (Suc k))
[PROOF STEP]
proof (rule matrix_to_iarray_Gauss_Jordan_column_k_2, unfold ncols_def nrows_def)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc k < CARD('columns)
 2. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)
[PROOF STEP]
show "Suc k < CARD('columns)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k < CARD('columns)
[PROOF STEP]
using Suc_k_less_card
[PROOF STATE]
proof (prove)
using this:
Suc k < ncols A

goal (1 subgoal):
 1. Suc k < CARD('columns)
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
Suc k < CARD('columns)

goal (1 subgoal):
 1. Suc k < CARD('columns)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Suc k < CARD('columns)

goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)
[PROOF STEP]
show "fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)
[PROOF STEP]
using hyp3
[PROOF STATE]
proof (prove)
using this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A

goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)

goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gauss_Jordan_upt_k A (Suc k)) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) (Suc k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gauss_Jordan_upt_k A k) = Gauss_Jordan_upt_k_iarrays (matrix_to_iarray A) k; k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k_iarrays (0, matrix_to_iarray A) [0..<Suc k]) = fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]); k < ncols A \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A; Suc k < ncols A\<rbrakk> \<Longrightarrow> fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
show "fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
using [[unfold_abs_def = false]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc (Suc k)]) \<le> nrows A
[PROOF STEP]
unfolding upt_rw foldl_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) [Suc k]) \<le> nrows A
[PROOF STEP]
unfolding List.foldl.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) (Suc k)) \<le> nrows A
[PROOF STEP]
apply (subst fold_rw')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) (Suc k)) \<le> nrows A
[PROOF STEP]
unfolding Gauss_Jordan_column_k_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (if (\<forall>m\<ge>mod_type_class.from_nat (fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))). snd (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) $ m $ mod_type_class.from_nat (Suc k) = (0::'a)) \<or> fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = nrows (snd (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))) then (fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])), snd (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))) else (fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) + 1, Gauss_Jordan_in_ij (snd (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))) (mod_type_class.from_nat (fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])))) (mod_type_class.from_nat (Suc k)))) \<le> nrows A
[PROOF STEP]
using hyp3 le_antisym not_less_eq_eq
[PROOF STATE]
proof (prove)
using this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> nrows A
\<lbrakk>?m \<le> ?n; ?n \<le> ?m\<rbrakk> \<Longrightarrow> ?m = ?n
(\<not> ?m \<le> ?n) = (Suc ?n \<le> ?m)

goal (1 subgoal):
 1. fst (if (\<forall>m\<ge>mod_type_class.from_nat (fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))). snd (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) $ m $ mod_type_class.from_nat (Suc k) = (0::'a)) \<or> fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) = nrows (snd (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))) then (fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])), snd (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))) else (fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])) + 1, Gauss_Jordan_in_ij (snd (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]))) (mod_type_class.from_nat (fst (fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]), snd (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k])))) (mod_type_class.from_nat (Suc k)))) \<le> nrows A
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
fst (foldl Gauss_Jordan_column_k (0, A) [0..<Suc k]) \<le> CARD('rows)
\<lbrakk>?m \<le> ?n; ?n \<le> ?m\<rbrakk> \<Longrightarrow> ?m = ?n
(\<not> ?m \<le> ?n) = (Suc ?n \<le> ?m)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_log_of_power:
  assumes "b ^ n < m" "1 < b"
  shows "n < log b m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n < log b m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real n < log b m
[PROOF STEP]
have "0 < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m
[PROOF STEP]
by (metis assms less_trans zero_less_power zero_less_one)
[PROOF STATE]
proof (state)
this:
0 < m

goal (1 subgoal):
 1. real n < log b m
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (1 subgoal):
 1. real n < log b m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < m
b ^ n < m
1 < b

goal (1 subgoal):
 1. real n < log b m
[PROOF STEP]
by (simp add: less_log_iff powr_realpow)
[PROOF STATE]
proof (state)
this:
real n < log b m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_map_path_connectedness:
  assumes "homeomorphic_map X Y f" "U \<subseteq> topspace X"
  shows "path_connectedin Y (f ` U) \<longleftrightarrow> path_connectedin X U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connectedin Y (f ` U) = path_connectedin X U
[PROOF STEP]
unfolding path_connectedin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ` U \<subseteq> topspace Y \<and> path_connected_space (subtopology Y (f ` U))) = (U \<subseteq> topspace X \<and> path_connected_space (subtopology X U))
[PROOF STEP]
proof (intro conj_cong homeomorphic_path_connected_space)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (f ` U \<subseteq> topspace Y) = (U \<subseteq> topspace X)
 2. U \<subseteq> topspace X \<Longrightarrow> subtopology Y (f ` U) homeomorphic_space subtopology X U
[PROOF STEP]
show "(f ` U \<subseteq> topspace Y) = (U \<subseteq> topspace X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ` U \<subseteq> topspace Y) = (U \<subseteq> topspace X)
[PROOF STEP]
using assms homeomorphic_imp_surjective_map
[PROOF STATE]
proof (prove)
using this:
homeomorphic_map X Y f
U \<subseteq> topspace X
homeomorphic_map ?X ?Y ?f \<Longrightarrow> ?f ` topspace ?X = topspace ?Y

goal (1 subgoal):
 1. (f ` U \<subseteq> topspace Y) = (U \<subseteq> topspace X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(f ` U \<subseteq> topspace Y) = (U \<subseteq> topspace X)

goal (1 subgoal):
 1. U \<subseteq> topspace X \<Longrightarrow> subtopology Y (f ` U) homeomorphic_space subtopology X U
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U \<subseteq> topspace X \<Longrightarrow> subtopology Y (f ` U) homeomorphic_space subtopology X U
[PROOF STEP]
assume "U \<subseteq> topspace X"
[PROOF STATE]
proof (state)
this:
U \<subseteq> topspace X

goal (1 subgoal):
 1. U \<subseteq> topspace X \<Longrightarrow> subtopology Y (f ` U) homeomorphic_space subtopology X U
[PROOF STEP]
show "subtopology Y (f ` U) homeomorphic_space subtopology X U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology Y (f ` U) homeomorphic_space subtopology X U
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
homeomorphic_map X Y f
U \<subseteq> topspace X

goal (1 subgoal):
 1. subtopology Y (f ` U) homeomorphic_space subtopology X U
[PROOF STEP]
unfolding homeomorphic_eq_everything_map
[PROOF STATE]
proof (prove)
using this:
continuous_map X Y f \<and> open_map X Y f \<and> closed_map X Y f \<and> f ` topspace X = topspace Y \<and> inj_on f (topspace X)
U \<subseteq> topspace X

goal (1 subgoal):
 1. subtopology Y (f ` U) homeomorphic_space subtopology X U
[PROOF STEP]
by (metis (no_types, opaque_lifting) assms homeomorphic_map_subtopologies homeomorphic_space homeomorphic_space_sym image_mono inf.absorb_iff2)
[PROOF STATE]
proof (state)
this:
subtopology Y (f ` U) homeomorphic_space subtopology X U

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arccos_eq_zero_iff: "arccos x = 0 \<longleftrightarrow> x = 1" if "-1 \<le> x" "x \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arccos x = 0) = (x = 1)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> x
x \<le> 1

goal (1 subgoal):
 1. (arccos x = 0) = (x = 1)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> 1; arccos x = 0\<rbrakk> \<Longrightarrow> x = 1
[PROOF STEP]
using cos_arccos
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 \<le> ?y; ?y \<le> 1\<rbrakk> \<Longrightarrow> cos (arccos ?y) = ?y

goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> 1; arccos x = 0\<rbrakk> \<Longrightarrow> x = 1
[PROOF STEP]
by fastforce


[STATEMENT]
lemma card_compose_bij:
  assumes bijf: "bij_betw f A A"
  shows "card { a \<in> A. P (f a) } = card { a \<in> A. P a }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {a \<in> A. P (f a)} = card {a \<in> A. P a}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {a \<in> A. P (f a)} = card {a \<in> A. P a}
[PROOF STEP]
from bijf
[PROOF STATE]
proof (chain)
picking this:
bij_betw f A A
[PROOF STEP]
have T: "f ` { a \<in> A. P (f a) } = { a \<in> A. P a }"
[PROOF STATE]
proof (prove)
using this:
bij_betw f A A

goal (1 subgoal):
 1. f ` {a \<in> A. P (f a)} = {a \<in> A. P a}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on f A \<and> f ` A = A

goal (1 subgoal):
 1. f ` {a \<in> A. P (f a)} = {a \<in> A. P a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` {a \<in> A. P (f a)} = {a \<in> A. P a}

goal (1 subgoal):
 1. card {a \<in> A. P (f a)} = card {a \<in> A. P a}
[PROOF STEP]
from bijf
[PROOF STATE]
proof (chain)
picking this:
bij_betw f A A
[PROOF STEP]
have "card { a \<in> A. P (f a) } = card (f ` { a \<in> A. P (f a) })"
[PROOF STATE]
proof (prove)
using this:
bij_betw f A A

goal (1 subgoal):
 1. card {a \<in> A. P (f a)} = card (f ` {a \<in> A. P (f a)})
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on f A \<and> f ` A = A

goal (1 subgoal):
 1. card {a \<in> A. P (f a)} = card (f ` {a \<in> A. P (f a)})
[PROOF STEP]
by (auto intro: subset_inj_on card_image[symmetric])
[PROOF STATE]
proof (state)
this:
card {a \<in> A. P (f a)} = card (f ` {a \<in> A. P (f a)})

goal (1 subgoal):
 1. card {a \<in> A. P (f a)} = card {a \<in> A. P a}
[PROOF STEP]
with T
[PROOF STATE]
proof (chain)
picking this:
f ` {a \<in> A. P (f a)} = {a \<in> A. P a}
card {a \<in> A. P (f a)} = card (f ` {a \<in> A. P (f a)})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` {a \<in> A. P (f a)} = {a \<in> A. P a}
card {a \<in> A. P (f a)} = card (f ` {a \<in> A. P (f a)})

goal (1 subgoal):
 1. card {a \<in> A. P (f a)} = card {a \<in> A. P a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {a \<in> A. P (f a)} = card {a \<in> A. P a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma algebraic_mult_cancel_left [simp]:
  assumes "algebraic x" "x \<noteq> 0"
  shows   "algebraic (x * y) \<longleftrightarrow> algebraic y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic (x * y) = algebraic y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. algebraic (x * y) \<Longrightarrow> algebraic y
 2. algebraic y \<Longrightarrow> algebraic (x * y)
[PROOF STEP]
assume "algebraic (x * y)"
[PROOF STATE]
proof (state)
this:
algebraic (x * y)

goal (2 subgoals):
 1. algebraic (x * y) \<Longrightarrow> algebraic y
 2. algebraic y \<Longrightarrow> algebraic (x * y)
[PROOF STEP]
hence "algebraic (x * y / x)"
[PROOF STATE]
proof (prove)
using this:
algebraic (x * y)

goal (1 subgoal):
 1. algebraic (x * y / x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
algebraic (x * y)
algebraic x
x \<noteq> (0::'a)

goal (1 subgoal):
 1. algebraic (x * y / x)
[PROOF STEP]
by (intro algebraic_div) auto
[PROOF STATE]
proof (state)
this:
algebraic (x * y / x)

goal (2 subgoals):
 1. algebraic (x * y) \<Longrightarrow> algebraic y
 2. algebraic y \<Longrightarrow> algebraic (x * y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
algebraic (x * y / x)

goal (2 subgoals):
 1. algebraic (x * y) \<Longrightarrow> algebraic y
 2. algebraic y \<Longrightarrow> algebraic (x * y)
[PROOF STEP]
have "x * y / x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y / x = y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
algebraic x
x \<noteq> (0::'a)

goal (1 subgoal):
 1. x * y / x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x * y / x = y

goal (2 subgoals):
 1. algebraic (x * y) \<Longrightarrow> algebraic y
 2. algebraic y \<Longrightarrow> algebraic (x * y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
algebraic y
[PROOF STEP]
show "algebraic y"
[PROOF STATE]
proof (prove)
using this:
algebraic y

goal (1 subgoal):
 1. algebraic y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
algebraic y

goal (1 subgoal):
 1. algebraic y \<Longrightarrow> algebraic (x * y)
[PROOF STEP]
qed (auto intro: algebraic_times assms)


[STATEMENT]
lemma vec_neg[simp]: assumes "x : carrier_vec n" shows "\<ominus>\<^bsub>V\<^esub> x = - x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<ominus>\<^bsub>V\<^esub> x = - x
[PROOF STEP]
unfolding a_inv_def m_inv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE y. y \<in> carrier (add_monoid V) \<and> x \<otimes>\<^bsub>add_monoid V\<^esub> y = \<one>\<^bsub>add_monoid V\<^esub> \<and> y \<otimes>\<^bsub>add_monoid V\<^esub> x = \<one>\<^bsub>add_monoid V\<^esub>) = - x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE y. y \<in> carrier_vec n \<and> x + y = 0\<^sub>v n \<and> y + x = 0\<^sub>v n) = - x
[PROOF STEP]
apply (rule the_equality, intro conjI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. - x \<in> carrier_vec n
 2. x + - x = 0\<^sub>v n
 3. - x + x = 0\<^sub>v n
 4. \<And>y. y \<in> carrier_vec n \<and> x + y = 0\<^sub>v n \<and> y + x = 0\<^sub>v n \<Longrightarrow> y = - x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier_vec n

goal (4 subgoals):
 1. - x \<in> carrier_vec n
 2. x + - x = 0\<^sub>v n
 3. - x + x = 0\<^sub>v n
 4. \<And>y. y \<in> carrier_vec n \<and> x + y = 0\<^sub>v n \<and> y + x = 0\<^sub>v n \<Longrightarrow> y = - x
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>x \<in> carrier_vec n; y \<in> carrier_vec n; x + y = 0\<^sub>v n; y + x = 0\<^sub>v n\<rbrakk> \<Longrightarrow> y = - x
[PROOF STEP]
using M.minus_unique uminus_carrier_vec uminus_r_inv_vec
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y + ?x = 0\<^sub>v n; ?x + ?y' = 0\<^sub>v n; ?x \<in> carrier_vec n; ?y \<in> carrier_vec n; ?y' \<in> carrier_vec n\<rbrakk> \<Longrightarrow> ?y = ?y'
(- ?v \<in> carrier_vec ?n) = (?v \<in> carrier_vec ?n)
?v \<in> carrier_vec ?n \<Longrightarrow> ?v + - ?v = 0\<^sub>v ?n

goal (1 subgoal):
 1. \<And>y. \<lbrakk>x \<in> carrier_vec n; y \<in> carrier_vec n; x + y = 0\<^sub>v n; y + x = 0\<^sub>v n\<rbrakk> \<Longrightarrow> y = - x
[PROOF STEP]
by blast


[STATEMENT]
lemma invariance_of_dimension_convex_domain:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "convex S"
      and contf: "continuous_on S f" and fim: "f ` S \<subseteq> affine hull T"
      and injf: "inj_on f S"
    shows "aff_dim S \<le> aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> aff_dim S \<le> aff_dim T
 2. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> aff_dim S \<le> aff_dim T
 2. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
by (simp add: aff_dim_geq)
[PROOF STATE]
proof (state)
this:
aff_dim S \<le> aff_dim T

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
have "aff_dim (affine hull S) \<le> aff_dim (affine hull T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
proof (rule invariance_of_dimension_affine_sets)
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. openin (top_of_set (affine hull S)) ?S
 2. affine (affine hull S)
 3. affine (affine hull T)
 4. continuous_on ?S ?f
 5. ?f ` ?S \<subseteq> affine hull T
 6. inj_on ?f ?S
 7. ?S \<noteq> {}
[PROOF STEP]
show "openin (top_of_set (affine hull S)) (rel_interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
[PROOF STEP]
by (simp add: openin_rel_interior)
[PROOF STATE]
proof (state)
this:
openin (top_of_set (affine hull S)) (rel_interior S)

goal (6 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
 3. continuous_on (rel_interior S) ?f
 4. ?f ` rel_interior S \<subseteq> affine hull T
 5. inj_on ?f (rel_interior S)
 6. rel_interior S \<noteq> {}
[PROOF STEP]
show "continuous_on (rel_interior S) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (rel_interior S) f
[PROOF STEP]
using contf continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. continuous_on (rel_interior S) f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on (rel_interior S) f

goal (5 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
 3. f ` rel_interior S \<subseteq> affine hull T
 4. inj_on f (rel_interior S)
 5. rel_interior S \<noteq> {}
[PROOF STEP]
show "f ` rel_interior S \<subseteq> affine hull T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` rel_interior S \<subseteq> affine hull T
[PROOF STEP]
using fim rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
f ` S \<subseteq> affine hull T
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. f ` rel_interior S \<subseteq> affine hull T
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` rel_interior S \<subseteq> affine hull T

goal (4 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
 3. inj_on f (rel_interior S)
 4. rel_interior S \<noteq> {}
[PROOF STEP]
show "inj_on f (rel_interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (rel_interior S)
[PROOF STEP]
using inj_on_subset injf rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>inj_on ?f ?A; ?B \<subseteq> ?A\<rbrakk> \<Longrightarrow> inj_on ?f ?B
inj_on f S
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. inj_on f (rel_interior S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inj_on f (rel_interior S)

goal (3 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
 3. rel_interior S \<noteq> {}
[PROOF STEP]
show "rel_interior S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior S \<noteq> {}
[PROOF STEP]
by (simp add: False \<open>convex S\<close> rel_interior_eq_empty)
[PROOF STATE]
proof (state)
this:
rel_interior S \<noteq> {}

goal (2 subgoals):
 1. affine (affine hull S)
 2. affine (affine hull T)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S \<le> aff_dim T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
aff_dim S \<le> aff_dim T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quot_bounds:
  fixes x :: "'a :: linordered_field"
  assumes "x \<le> x'" "y' \<le> y" "0 < y" "0 \<le> x" "0 < y'"
  shows "x / y \<le> x' / y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x / y \<le> x' / y'
[PROOF STEP]
proof (rule order_trans)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x / y \<le> ?y
 2. ?y \<le> x' / y'
[PROOF STEP]
have "0 \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<le> x'
y' \<le> y
(0::'a) < y
(0::'a) \<le> x
(0::'a) < y'

goal (1 subgoal):
 1. (0::'a) \<le> y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> y

goal (2 subgoals):
 1. x / y \<le> ?y
 2. ?y \<le> x' / y'
[PROOF STEP]
thus "x / y \<le> x' / y"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> y

goal (1 subgoal):
 1. x / y \<le> x' / y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> y
x \<le> x'
y' \<le> y
(0::'a) < y
(0::'a) \<le> x
(0::'a) < y'

goal (1 subgoal):
 1. x / y \<le> x' / y
[PROOF STEP]
by (simp add: divide_right_mono)
[PROOF STATE]
proof (state)
this:
x / y \<le> x' / y

goal (1 subgoal):
 1. x' / y \<le> x' / y'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x' / y \<le> x' / y'
[PROOF STEP]
have "0 \<le> x'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> x'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<le> x'
y' \<le> y
(0::'a) < y
(0::'a) \<le> x
(0::'a) < y'

goal (1 subgoal):
 1. (0::'a) \<le> x'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> x'

goal (1 subgoal):
 1. x' / y \<le> x' / y'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> x'

goal (1 subgoal):
 1. x' / y \<le> x' / y'
[PROOF STEP]
have "0 < y * y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < y * y'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<le> x'
y' \<le> y
(0::'a) < y
(0::'a) \<le> x
(0::'a) < y'

goal (1 subgoal):
 1. (0::'a) < y * y'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) < y * y'

goal (1 subgoal):
 1. x' / y \<le> x' / y'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> x'
(0::'a) < y * y'
[PROOF STEP]
show "x' / y \<le> x' / y'"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> x'
(0::'a) < y * y'

goal (1 subgoal):
 1. x' / y \<le> x' / y'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> x'
(0::'a) < y * y'
x \<le> x'
y' \<le> y
(0::'a) < y
(0::'a) \<le> x
(0::'a) < y'

goal (1 subgoal):
 1. x' / y \<le> x' / y'
[PROOF STEP]
by (simp add: divide_left_mono)
[PROOF STATE]
proof (state)
this:
x' / y \<le> x' / y'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem mutil_not_tiling:
  "t = {0..< 2 * Suc m} \<times> {0..< 2 * Suc n}
   ==> t - {(0,0)} - {(Suc(2 * m), Suc(2 * n))} \<notin> tiling domino"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t = {0..<2 * Suc m} \<times> {0..<2 * Suc n} \<Longrightarrow> t - {(0, 0)} - {(Suc (2 * m), Suc (2 * n))} \<notin> tiling domino
[PROOF STEP]
apply (rule gen_mutil_not_tiling)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. t = {0..<2 * Suc m} \<times> {0..<2 * Suc n} \<Longrightarrow> t \<in> tiling domino
 2. t = {0..<2 * Suc m} \<times> {0..<2 * Suc n} \<Longrightarrow> (0 + 0) mod 2 = 0
 3. t = {0..<2 * Suc m} \<times> {0..<2 * Suc n} \<Longrightarrow> (Suc (2 * m) + Suc (2 * n)) mod 2 = 0
 4. t = {0..<2 * Suc m} \<times> {0..<2 * Suc n} \<Longrightarrow> {(0, 0), (Suc (2 * m), Suc (2 * n))} \<subseteq> t
[PROOF STEP]
apply (blast intro!: dominoes_tile_matrix)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. t = {0..<2 * Suc m} \<times> {0..<2 * Suc n} \<Longrightarrow> (0 + 0) mod 2 = 0
 2. t = {0..<2 * Suc m} \<times> {0..<2 * Suc n} \<Longrightarrow> (Suc (2 * m) + Suc (2 * n)) mod 2 = 0
 3. t = {0..<2 * Suc m} \<times> {0..<2 * Suc n} \<Longrightarrow> {(0, 0), (Suc (2 * m), Suc (2 * n))} \<subseteq> t
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma hnorm_mult: "\<And>x y::'a::real_normed_div_algebra star. hnorm (x * y) = hnorm x * hnorm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. hnorm (x * y) = hnorm x * hnorm y
[PROOF STEP]
by transfer (rule norm_mult)


[STATEMENT]
lemma integral_split:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::{real_normed_vector,complete_space}"
  assumes f: "f integrable_on (cbox a b)"
      and k: "k \<in> Basis"
  shows "integral (cbox a b) f =
           integral (cbox a b \<inter> {x. x\<bullet>k \<le> c}) f +
           integral (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cbox a b) f = integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f + integral (cbox a b \<inter> {x. c \<le> x \<bullet> k}) f
[PROOF STEP]
using k f
[PROOF STATE]
proof (prove)
using this:
k \<in> Basis
f integrable_on cbox a b

goal (1 subgoal):
 1. integral (cbox a b) f = integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f + integral (cbox a b \<inter> {x. c \<le> x \<bullet> k}) f
[PROOF STEP]
by (auto simp: has_integral_integral intro: integral_unique [OF has_integral_split])


[STATEMENT]
lemma set_of_mul_inc:
  "set_of (A * B) \<subseteq> set_of (A' * B')"
  if "set_of A \<subseteq> set_of A'" "set_of B \<subseteq> set_of B'"
  for A :: "'a::{linordered_ring, real_normed_algebra, linear_continuum_topology} interval"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (A * B) \<subseteq> set_of (A' * B')
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
set_of A \<subseteq> set_of A'
set_of B \<subseteq> set_of B'

goal (1 subgoal):
 1. set_of (A * B) \<subseteq> set_of (A' * B')
[PROOF STEP]
unfolding set_of_times
[PROOF STATE]
proof (prove)
using this:
set_of A \<subseteq> set_of A'
set_of B \<subseteq> set_of B'

goal (1 subgoal):
 1. {x * y |x y. x \<in>\<^sub>i A \<and> y \<in>\<^sub>i B} \<subseteq> {x * y |x y. x \<in>\<^sub>i A' \<and> y \<in>\<^sub>i B'}
[PROOF STEP]
by auto


[STATEMENT]
lemma dirichlet_prod'_inversion:
  assumes "dirichlet_prod a ainv = (\<lambda>n. if n = 1 then 1 else 0)"
  shows   "(\<forall>x\<ge>1. g x = dirichlet_prod' a f x) \<longleftrightarrow> (\<forall>x\<ge>1. f x = dirichlet_prod' ainv g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<ge>1. g x = dirichlet_prod' a f x) = (\<forall>x\<ge>1. f x = dirichlet_prod' ainv g x)
[PROOF STEP]
using dirichlet_prod'_inversion1[of g a f _ ainv] dirichlet_prod'_inversion2[of f ainv g _ a]
        assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<ge>1. g x = dirichlet_prod' a f x; 1 \<le> ?x; dirichlet_prod a ainv = (\<lambda>n. if n = 1 then 1::'a else (0::'a))\<rbrakk> \<Longrightarrow> f ?x = dirichlet_prod' ainv g ?x
\<lbrakk>\<forall>x\<ge>1. f x = dirichlet_prod' ainv g x; 1 \<le> ?x; dirichlet_prod a ainv = (\<lambda>n. if n = 1 then 1::'a else (0::'a))\<rbrakk> \<Longrightarrow> g ?x = dirichlet_prod' a f ?x
dirichlet_prod a ainv = (\<lambda>n. if n = 1 then 1::'a else (0::'a))

goal (1 subgoal):
 1. (\<forall>x\<ge>1. g x = dirichlet_prod' a f x) = (\<forall>x\<ge>1. f x = dirichlet_prod' ainv g x)
[PROOF STEP]
by blast


[STATEMENT]
lemma sum_mset_add_diff_nat:
  fixes x:: 'a and  f g :: "'a \<Rightarrow> nat"
  assumes "\<And>x . x \<in># A \<Longrightarrow> f x \<ge> g x"
  shows "(\<Sum> x \<in># A. f x - g x) = (\<Sum> x \<in># A . f x) -  (\<Sum> x \<in># A . g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>#A. f x - g x) = \<Sum>\<^sub># (image_mset f A) - \<Sum>\<^sub># (image_mset g A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in># A \<Longrightarrow> g ?x \<le> f ?x

goal (1 subgoal):
 1. (\<Sum>x\<in>#A. f x - g x) = \<Sum>\<^sub># (image_mset f A) - \<Sum>\<^sub># (image_mset g A)
[PROOF STEP]
by (induction A) (simp_all add: sum_mset_mono)


[STATEMENT]
theorem complex_root_unity:
  fixes j::nat
  assumes "n \<noteq> 0"
    shows "exp(2 * of_real pi * \<i> * of_nat j / of_nat n)^n = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (2 * complex_of_real pi * \<i> * of_nat j / of_nat n) ^ n = 1
[PROOF STEP]
by (metis assms bot_nat_0.not_eq_extremum exp_divide_power_eq exp_of_nat2_mult exp_two_pi_i power_one)


[STATEMENT]
lemma strict_mono_triangle_num: "strict_mono triangle_num"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono triangle_num
[PROOF STEP]
unfolding strict_mono_Suc_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. triangle_num n < triangle_num (Suc n)
[PROOF STEP]
by (auto simp: triangle_num_altdef)


[STATEMENT]
lemma partition_P:
  assumes "partition P xs = (yes, no)"
  shows "(\<forall>p \<in> set yes.  P p) \<and> (\<forall>p  \<in> set no. \<not> P p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>p\<in>set yes. P p) \<and> (\<forall>p\<in>set no. \<not> P p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>p\<in>set yes. P p) \<and> (\<forall>p\<in>set no. \<not> P p)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
partition P xs = (yes, no)
[PROOF STEP]
have "yes = fst (partition P xs)" and "no = snd (partition P xs)"
[PROOF STATE]
proof (prove)
using this:
partition P xs = (yes, no)

goal (1 subgoal):
 1. yes = fst (partition P xs) &&& no = snd (partition P xs)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
yes = fst (partition P xs)
no = snd (partition P xs)

goal (1 subgoal):
 1. (\<forall>p\<in>set yes. P p) \<and> (\<forall>p\<in>set no. \<not> P p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
yes = fst (partition P xs)
no = snd (partition P xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
yes = fst (partition P xs)
no = snd (partition P xs)

goal (1 subgoal):
 1. (\<forall>p\<in>set yes. P p) \<and> (\<forall>p\<in>set no. \<not> P p)
[PROOF STEP]
by (simp_all add: partition_filter1 partition_filter2)
[PROOF STATE]
proof (state)
this:
(\<forall>p\<in>set yes. P p) \<and> (\<forall>p\<in>set no. \<not> P p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arctan_diff_small:
  assumes "\<bar>x*y::real\<bar> < 1"
  shows   "arctan x - arctan y = arctan ((x - y) / (1 + x * y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
have "arctan x - arctan y = arctan x + arctan (-y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x - arctan y = arctan x + arctan (- y)
[PROOF STEP]
by (simp add: arctan_minus)
[PROOF STATE]
proof (state)
this:
arctan x - arctan y = arctan x + arctan (- y)

goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arctan x - arctan y = arctan x + arctan (- y)

goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<bar>x * y\<bar> < 1
[PROOF STEP]
have "\<dots> = arctan ((x - y) / (1 + x * y))"
[PROOF STATE]
proof (prove)
using this:
\<bar>x * y\<bar> < 1

goal (1 subgoal):
 1. arctan x + arctan (- y) = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
by (subst arctan_add_small) simp_all
[PROOF STATE]
proof (state)
this:
arctan x + arctan (- y) = arctan ((x - y) / (1 + x * y))

goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arctan x - arctan y = arctan ((x - y) / (1 + x * y))

goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
arctan x - arctan y = arctan ((x - y) / (1 + x * y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_power_inj':
  assumes "prime p" "prime q"
  assumes "p ^ m = q ^ n" "m > 0" "n > 0"
  shows   "p = q" "m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = q &&& m = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = q
 2. m = n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n
[PROOF STEP]
have "p ^ 1 dvd p ^ m"
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n

goal (1 subgoal):
 1. p ^ 1 dvd p ^ m
[PROOF STEP]
by (intro le_imp_power_dvd) simp
[PROOF STATE]
proof (state)
this:
p ^ 1 dvd p ^ m

goal (2 subgoals):
 1. p = q
 2. m = n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p ^ 1 dvd p ^ m

goal (2 subgoals):
 1. p = q
 2. m = n
[PROOF STEP]
have "p ^ m = q ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ m = q ^ n
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
p ^ m = q ^ n

goal (2 subgoals):
 1. p = q
 2. m = n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p ^ 1 dvd q ^ n
[PROOF STEP]
have "p dvd q ^ n"
[PROOF STATE]
proof (prove)
using this:
p ^ 1 dvd q ^ n

goal (1 subgoal):
 1. p dvd q ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p dvd q ^ n

goal (2 subgoals):
 1. p = q
 2. m = n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n
p dvd q ^ n
[PROOF STEP]
have "p dvd q"
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n
p dvd q ^ n

goal (1 subgoal):
 1. p dvd q
[PROOF STEP]
using prime_dvd_power[of p q]
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n
p dvd q ^ n
\<lbrakk>prime p; p dvd q ^ ?n\<rbrakk> \<Longrightarrow> p dvd q

goal (1 subgoal):
 1. p dvd q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p dvd q

goal (2 subgoals):
 1. p = q
 2. m = n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n
p dvd q
[PROOF STEP]
show "p = q"
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n
p dvd q

goal (1 subgoal):
 1. p = q
[PROOF STEP]
by (simp add: primes_dvd_imp_eq)
[PROOF STATE]
proof (state)
this:
p = q

goal (1 subgoal):
 1. m = n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n
p = q
[PROOF STEP]
show "m = n"
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
p ^ m = q ^ n
0 < m
0 < n
p = q

goal (1 subgoal):
 1. m = n
[PROOF STEP]
by (simp add: prime_power_inj)
[PROOF STATE]
proof (state)
this:
m = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_of_int_ceiling:
  fixes f::"'a \<Rightarrow> 'b::{order_topology,floor_ceiling}"
  assumes "(f \<longlongrightarrow> l) F"
    and "l \<notin> \<int>"
  shows "((\<lambda>x. of_int (ceiling (f x)):: 'c::{ring_1,topological_space}) \<longlongrightarrow> of_int (ceiling l)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. of_int \<lceil>f x\<rceil>) \<longlongrightarrow> of_int \<lceil>l\<rceil>) F
[PROOF STEP]
using eventually_ceiling_eq[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. \<lceil>f x\<rceil> = \<lceil>l\<rceil>

goal (1 subgoal):
 1. ((\<lambda>x. of_int \<lceil>f x\<rceil>) \<longlongrightarrow> of_int \<lceil>l\<rceil>) F
[PROOF STEP]
by (simp add: eventually_mono topological_tendstoI)


[STATEMENT]
lemma "(\<lambda>x::real. (1 - 1/2 * x^2 - cos (x / (1 - x^2))) / x^4) \<midarrow>0\<rightarrow> 23/24"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (1 - 1 / 2 * x\<^sup>2 - cos (x / (1 - x\<^sup>2))) / x ^ 4) \<midarrow>0\<rightarrow> 23 / 24
[PROOF STEP]
by real_asymp


[STATEMENT]
theorem IK_real_card:
  shows "card {f::real set \<Rightarrow> real set. IK f} = 7" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f. IK f} = 7
[PROOF STEP]
proof(rule antisym[OF IK_card])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 7 \<le> card {f. IK f}
[PROOF STEP]
show "?rhs \<le> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 7 \<le> card {f. IK f}
[PROOF STEP]
unfolding IK_nf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 7 \<le> card {f. IK_nf f}
[PROOF STEP]
by (rule le_trans[OF eq_refl[OF IK_nf_real_card[symmetric]] card_image_le])
       (simp add: IK_nf_set)
[PROOF STATE]
proof (state)
this:
7 \<le> card {f. IK f}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_lower_bound: "\<lbrakk>(l::real) > 0; l \<le> x; x \<le> u\<rbrakk> \<Longrightarrow> min (l powr z) (u powr z) \<le> x powr z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u\<rbrakk> \<Longrightarrow> min (l powr z) (u powr z) \<le> x powr z
[PROOF STEP]
apply (cases "z \<ge> 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u; 0 \<le> z\<rbrakk> \<Longrightarrow> min (l powr z) (u powr z) \<le> x powr z
 2. \<lbrakk>0 < l; l \<le> x; x \<le> u; \<not> 0 \<le> z\<rbrakk> \<Longrightarrow> min (l powr z) (u powr z) \<le> x powr z
[PROOF STEP]
apply (rule order.trans[OF min.cobounded1 powr_mono2], simp_all) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u; \<not> 0 \<le> z\<rbrakk> \<Longrightarrow> min (l powr z) (u powr z) \<le> x powr z
[PROOF STEP]
apply (rule order.trans[OF min.cobounded2 powr_mono2'], simp_all) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma union_intersection1: "A \<inter> (A \<union> B) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> (A \<union> B) = A
[PROOF STEP]
by (rule inf_sup_absorb)


[STATEMENT]
lemma powreal_surj:
  assumes "a > 1"
  and "x > 0"
  shows "\<exists>y. a pow\<^sub>\<real> y = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
obtain n where "a pow\<^sub>\<real> - real n < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. a pow\<^sub>\<real> - real n < x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms powreal_IVT_upper_lemma
[PROOF STATE]
proof (prove)
using this:
1 < a
0 < x
\<lbrakk>1 < ?a; 0 < ?x\<rbrakk> \<Longrightarrow> \<exists>n. ?a pow\<^sub>\<real> - real n < ?x

goal (1 subgoal):
 1. (\<And>n. a pow\<^sub>\<real> - real n < x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<real> - real n < x

goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<real> - real n < x

goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
obtain na where "x < a pow\<^sub>\<real> real na"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>na. x < a pow\<^sub>\<real> real na \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms powreal_IVT_lower_lemma
[PROOF STATE]
proof (prove)
using this:
1 < a
0 < x
\<lbrakk>1 < ?a; 0 < ?x\<rbrakk> \<Longrightarrow> \<exists>n. ?x < ?a pow\<^sub>\<real> real n

goal (1 subgoal):
 1. (\<And>na. x < a pow\<^sub>\<real> real na \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x < a pow\<^sub>\<real> real na

goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x < a pow\<^sub>\<real> real na

goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
have "\<forall>x. - real n \<le> x \<and> x \<le> real na \<longrightarrow> isCont ((pow\<^sub>\<real>) a) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. - real n \<le> x \<and> x \<le> real na \<longrightarrow> isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
using assms(1) isCont_powreal_exponent_gt_one
[PROOF STATE]
proof (prove)
using this:
1 < a
1 < ?a \<Longrightarrow> isCont ((pow\<^sub>\<real>) ?a) ?x

goal (1 subgoal):
 1. \<forall>x. - real n \<le> x \<and> x \<le> real na \<longrightarrow> isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x. - real n \<le> x \<and> x \<le> real na \<longrightarrow> isCont ((pow\<^sub>\<real>) a) x

goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a pow\<^sub>\<real> - real n < x
x < a pow\<^sub>\<real> real na
\<forall>x. - real n \<le> x \<and> x \<le> real na \<longrightarrow> isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a pow\<^sub>\<real> - real n < x
x < a pow\<^sub>\<real> real na
\<forall>x. - real n \<le> x \<and> x \<le> real na \<longrightarrow> isCont ((pow\<^sub>\<real>) a) x

goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
using IVT_simple [of _ "-real n" _ "real na"]
[PROOF STATE]
proof (prove)
using this:
a pow\<^sub>\<real> - real n < x
x < a pow\<^sub>\<real> real na
\<forall>x. - real n \<le> x \<and> x \<le> real na \<longrightarrow> isCont ((pow\<^sub>\<real>) a) x
\<lbrakk>?f (- real n) \<le> ?y; ?y \<le> ?f (real na); - real n \<le> real na; \<forall>x. - real n \<le> x \<and> x \<le> real na \<longrightarrow> isCont ?f x\<rbrakk> \<Longrightarrow> \<exists>x. ?f x = ?y

goal (1 subgoal):
 1. \<exists>y. a pow\<^sub>\<real> y = x
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>y. a pow\<^sub>\<real> y = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SmallerMultipleStepsWithLimit:
fixes
  k A limit
assumes
  "\<forall> n \<ge> limit . (A (Suc n)) < (A n)"
shows
  "\<forall> n \<ge> limit . (A (n + k)) \<le> (A n) - k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<ge>limit. A (n + k) \<le> A n - k
[PROOF STEP]
proof(induct k,auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k n. \<lbrakk>\<forall>n\<ge>limit. A (n + k) \<le> A n - k; limit \<le> n\<rbrakk> \<Longrightarrow> A (Suc (n + k)) \<le> A n - Suc k
[PROOF STEP]
fix n k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k n. \<lbrakk>\<forall>n\<ge>limit. A (n + k) \<le> A n - k; limit \<le> n\<rbrakk> \<Longrightarrow> A (Suc (n + k)) \<le> A n - Suc k
[PROOF STEP]
assume IH: "\<forall>n\<ge>limit. A (n + k) \<le> A n - k" "limit \<le> n"
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>limit. A (n + k) \<le> A n - k
limit \<le> n

goal (1 subgoal):
 1. \<And>k n. \<lbrakk>\<forall>n\<ge>limit. A (n + k) \<le> A n - k; limit \<le> n\<rbrakk> \<Longrightarrow> A (Suc (n + k)) \<le> A n - Suc k
[PROOF STEP]
hence "A (Suc (n + k)) < A (n + k)"
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>limit. A (n + k) \<le> A n - k
limit \<le> n

goal (1 subgoal):
 1. A (Suc (n + k)) < A (n + k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>limit. A (n + k) \<le> A n - k
limit \<le> n
\<forall>n\<ge>limit. A (Suc n) < A n

goal (1 subgoal):
 1. A (Suc (n + k)) < A (n + k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A (Suc (n + k)) < A (n + k)

goal (1 subgoal):
 1. \<And>k n. \<lbrakk>\<forall>n\<ge>limit. A (n + k) \<le> A n - k; limit \<le> n\<rbrakk> \<Longrightarrow> A (Suc (n + k)) \<le> A n - Suc k
[PROOF STEP]
hence "A (Suc (n + k)) < A n - k"
[PROOF STATE]
proof (prove)
using this:
A (Suc (n + k)) < A (n + k)

goal (1 subgoal):
 1. A (Suc (n + k)) < A n - k
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
A (Suc (n + k)) < A (n + k)
\<forall>n\<ge>limit. A (n + k) \<le> A n - k
limit \<le> n

goal (1 subgoal):
 1. A (Suc (n + k)) < A n - k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A (Suc (n + k)) < A n - k

goal (1 subgoal):
 1. \<And>k n. \<lbrakk>\<forall>n\<ge>limit. A (n + k) \<le> A n - k; limit \<le> n\<rbrakk> \<Longrightarrow> A (Suc (n + k)) \<le> A n - Suc k
[PROOF STEP]
thus "A (Suc (n + k)) \<le> A n - Suc k"
[PROOF STATE]
proof (prove)
using this:
A (Suc (n + k)) < A n - k

goal (1 subgoal):
 1. A (Suc (n + k)) \<le> A n - Suc k
[PROOF STEP]
by (metis Suc_lessI add_Suc_right add_diff_cancel_left'
       less_diff_conv less_or_eq_imp_le add.commute)
[PROOF STATE]
proof (state)
this:
A (Suc (n + k)) \<le> A n - Suc k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma countable_iff_g_le_Aleph0:
  assumes "small X"
  shows "countable X \<longleftrightarrow> gcard X \<le> \<aleph>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable X = (gcard X \<le> \<aleph>0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. countable X = (gcard X \<le> \<aleph>0)
[PROOF STEP]
have "countable X \<longleftrightarrow> X \<lesssim> elts \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable X = (X \<lesssim> elts \<omega>)
[PROOF STEP]
by (simp add: \<omega>_def countable_iff_lepoll inj_ord_of_nat)
[PROOF STATE]
proof (state)
this:
countable X = (X \<lesssim> elts \<omega>)

goal (1 subgoal):
 1. countable X = (gcard X \<le> \<aleph>0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
countable X = (X \<lesssim> elts \<omega>)

goal (1 subgoal):
 1. countable X = (gcard X \<le> \<aleph>0)
[PROOF STEP]
have "... \<longleftrightarrow> gcard X \<le> \<aleph>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<lesssim> elts \<omega>) = (gcard X \<le> \<aleph>0)
[PROOF STEP]
using Card_\<omega> Card_def assms gcard_le_lepoll lepoll_imp_gcard_le
[PROOF STATE]
proof (prove)
using this:
Card \<omega>
Card ?i \<equiv> ?i = vcard ?i
small X
\<lbrakk>gcard ?A \<le> ?\<alpha>; small ?A\<rbrakk> \<Longrightarrow> ?A \<lesssim> elts ?\<alpha>
\<lbrakk>?A \<lesssim> ?B; small ?B\<rbrakk> \<Longrightarrow> gcard ?A \<le> gcard ?B

goal (1 subgoal):
 1. (X \<lesssim> elts \<omega>) = (gcard X \<le> \<aleph>0)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(X \<lesssim> elts \<omega>) = (gcard X \<le> \<aleph>0)

goal (1 subgoal):
 1. countable X = (gcard X \<le> \<aleph>0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
countable X = (gcard X \<le> \<aleph>0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
countable X = (gcard X \<le> \<aleph>0)

goal (1 subgoal):
 1. countable X = (gcard X \<le> \<aleph>0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
countable X = (gcard X \<le> \<aleph>0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subtopology_discrete_topology [simp]:
  "subtopology (discrete_topology U) S = discrete_topology(U \<inter> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology (discrete_topology U) S = discrete_topology (U \<inter> S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtopology (discrete_topology U) S = discrete_topology (U \<inter> S)
[PROOF STEP]
have "(\<lambda>T. \<exists>Sa. T = Sa \<inter> S \<and> Sa \<subseteq> U) = (\<lambda>Sa. Sa \<subseteq> U \<and> Sa \<subseteq> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>T. \<exists>Sa. T = Sa \<inter> S \<and> Sa \<subseteq> U) = (\<lambda>Sa. Sa \<subseteq> U \<and> Sa \<subseteq> S)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>T. \<exists>Sa. T = Sa \<inter> S \<and> Sa \<subseteq> U) = (\<lambda>Sa. Sa \<subseteq> U \<and> Sa \<subseteq> S)

goal (1 subgoal):
 1. subtopology (discrete_topology U) S = discrete_topology (U \<inter> S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>T. \<exists>Sa. T = Sa \<inter> S \<and> Sa \<subseteq> U) = (\<lambda>Sa. Sa \<subseteq> U \<and> Sa \<subseteq> S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>T. \<exists>Sa. T = Sa \<inter> S \<and> Sa \<subseteq> U) = (\<lambda>Sa. Sa \<subseteq> U \<and> Sa \<subseteq> S)

goal (1 subgoal):
 1. subtopology (discrete_topology U) S = discrete_topology (U \<inter> S)
[PROOF STEP]
by (simp add: subtopology_def) (simp add: discrete_topology_def)
[PROOF STATE]
proof (state)
this:
subtopology (discrete_topology U) S = discrete_topology (U \<inter> S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma outer_prod_mult_vec:
  fixes a b c :: "'a::conjugatable_field vec"
  assumes a: "a \<in> carrier_vec d1" and b: "b \<in> carrier_vec d2"
    and c: "c \<in> carrier_vec d2"
  shows "outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
have "outer_prod a b *\<^sub>v c
    = mat d1 1 (\<lambda>(i, j). a $ i)
    * mat 1 d2 (\<lambda>(i, j). (conjugate b) $ j)
    *\<^sub>v c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = mat d1 1 (\<lambda>(i, j). a $ i) * mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c
[PROOF STEP]
unfolding outer_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_vec a) 1 (\<lambda>(i, j). a $ i) * mat 1 (dim_vec b) (\<lambda>(i, y). conjugate b $ y) *\<^sub>v c = mat d1 1 (\<lambda>(i, j). a $ i) * mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier_vec d1
b \<in> carrier_vec d2
c \<in> carrier_vec d2

goal (1 subgoal):
 1. mat (dim_vec a) 1 (\<lambda>(i, j). a $ i) * mat 1 (dim_vec b) (\<lambda>(i, y). conjugate b $ y) *\<^sub>v c = mat d1 1 (\<lambda>(i, j). a $ i) * mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
outer_prod a b *\<^sub>v c = mat d1 1 (\<lambda>(i, j). a $ i) * mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c

goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
outer_prod a b *\<^sub>v c = mat d1 1 (\<lambda>(i, j). a $ i) * mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c

goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
have "\<dots> = mat d1 1 (\<lambda>(i, j). a $ i)
    *\<^sub>v (mat 1 d2 (\<lambda>(i, j). (conjugate b) $ j)
    *\<^sub>v c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat d1 1 (\<lambda>(i, j). a $ i) * mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c)
[PROOF STEP]
apply (subst assoc_mult_mat_vec)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. mat d1 1 (\<lambda>(i, j). a $ i) \<in> carrier_mat ?n\<^sub>1 ?n\<^sub>2
 2. mat 1 d2 (\<lambda>(i, y). conjugate b $ y) \<in> carrier_mat ?n\<^sub>2 ?n\<^sub>3
 3. c \<in> carrier_vec ?n\<^sub>3
 4. mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, y). conjugate b $ y) *\<^sub>v c) = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, y). conjugate b $ y) *\<^sub>v c)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier_vec d1
b \<in> carrier_vec d2
c \<in> carrier_vec d2

goal (4 subgoals):
 1. mat d1 1 (\<lambda>(i, j). a $ i) \<in> carrier_mat ?n\<^sub>1 ?n\<^sub>2
 2. mat 1 d2 (\<lambda>(i, y). conjugate b $ y) \<in> carrier_mat ?n\<^sub>2 ?n\<^sub>3
 3. c \<in> carrier_vec ?n\<^sub>3
 4. mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, y). conjugate b $ y) *\<^sub>v c) = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, y). conjugate b $ y) *\<^sub>v c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat d1 1 (\<lambda>(i, j). a $ i) * mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c)

goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat d1 1 (\<lambda>(i, j). a $ i) * mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c)

goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
have "\<dots> = mat d1 1 (\<lambda>(i, j). a $ i)
    *\<^sub>v vec 1 (\<lambda>k. inner_prod b c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c) = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v vec 1 (\<lambda>k. inner_prod b c)
[PROOF STEP]
using mat_of_vec_mult_vec[of b] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b \<in> carrier_vec ?d; ?b \<in> carrier_vec ?d\<rbrakk> \<Longrightarrow> mat 1 ?d (\<lambda>(i, j). conjugate b $ j) *\<^sub>v ?b = vec 1 (\<lambda>k. inner_prod b ?b)
a \<in> carrier_vec d1
b \<in> carrier_vec d2
c \<in> carrier_vec d2

goal (1 subgoal):
 1. mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c) = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v vec 1 (\<lambda>k. inner_prod b c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c) = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v vec 1 (\<lambda>k. inner_prod b c)

goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v (mat 1 d2 (\<lambda>(i, j). conjugate b $ j) *\<^sub>v c) = mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v vec 1 (\<lambda>k. inner_prod b c)

goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
have "\<dots> = inner_prod b c \<cdot>\<^sub>v a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v vec 1 (\<lambda>k. inner_prod b c) = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
using mat_of_vec_mult_one_dim_vec assms
[PROOF STATE]
proof (prove)
using this:
?a \<in> carrier_vec ?d \<Longrightarrow> mat ?d 1 (\<lambda>(i, j). ?a $ i) *\<^sub>v vec 1 (\<lambda>k. ?c) = ?c \<cdot>\<^sub>v ?a
a \<in> carrier_vec d1
b \<in> carrier_vec d2
c \<in> carrier_vec d2

goal (1 subgoal):
 1. mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v vec 1 (\<lambda>k. inner_prod b c) = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat d1 1 (\<lambda>(i, j). a $ i) *\<^sub>v vec 1 (\<lambda>k. inner_prod b c) = inner_prod b c \<cdot>\<^sub>v a

goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a

goal (1 subgoal):
 1. outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
outer_prod a b *\<^sub>v c = inner_prod b c \<cdot>\<^sub>v a

goal:
No subgoals!
[PROOF STEP]
qed