[STATEMENT]
lemma V\<^sub>0_power: "V\<^sub>0 v ^ n = monomial 1 (single_pp v n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V\<^sub>0 v ^ n = monomial (1::'b) (single_pp v n)
[PROOF STEP]
by (induction n) (auto simp: V\<^sub>0_def mult_single single_pp_plus)


[STATEMENT]
lemma non_zero_positions_xs_m':
  fixes A::"'a::comm_ring_1 mat"
  assumes A_def: "A = A' @\<^sub>r D \<cdot>\<^sub>m 1\<^sub>m n"
  and A': "A' \<in> carrier_mat m n"
  and nz_def: "non_zero_positions = filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [1..<dim_row A]"
  and m0: "0<m" and n0: "0<n"
  and D0: "D \<noteq> 0"
shows "non_zero_positions = (filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [1..<m]) @ [m]
  \<and> distinct (filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [1..<m])
  \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [1..<m]). x < m \<and> 0 < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have A: "A \<in> carrier_mat (m+n) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat (m + n) n
[PROOF STEP]
using A' A_def
[PROOF STATE]
proof (prove)
using this:
A' \<in> carrier_mat m n
A = A' @\<^sub>r D \<cdot>\<^sub>m 1\<^sub>m n

goal (1 subgoal):
 1. A \<in> carrier_mat (m + n) n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat (m + n) n

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
let ?xs = "filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [1..<m]"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have l_rw: "[1..<dim_row A] = [1..<m+1]@[m+1..<dim_row A]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [1..<dim_row A] = [1..<m + 1] @ [m + 1..<dim_row A]
[PROOF STEP]
using A m0 n0
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat (m + n) n
0 < m
0 < n

goal (1 subgoal):
 1. [1..<dim_row A] = [1..<m + 1] @ [m + 1..<dim_row A]
[PROOF STEP]
by (auto, metis Suc_leI less_add_same_cancel1 upt_add_eq_append upt_conv_Cons)
[PROOF STATE]
proof (state)
this:
[1..<dim_row A] = [1..<m + 1] @ [m + 1..<dim_row A]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have f0: "filter (\<lambda>i. A $$ (i,0) \<noteq> 0) ([m+1..<dim_row A]) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A] = []
[PROOF STEP]
proof (rule filter_False)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x\<in>set [m + 1..<dim_row A]. \<not> A $$ (x, 0) \<noteq> (0::'a)
[PROOF STEP]
have "A $$ (i,0) = 0" if i: "i\<in>set [m + 1..<dim_row A]" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, 0) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A $$ (i, 0) = (0::'a)
[PROOF STEP]
have "A $$ (i,0) = (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (i-m,0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, 0) = (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (i - m, 0)
[PROOF STEP]
by (rule append_rows_nth3[OF A' _ A_def _ _ n0], insert i A, auto)
[PROOF STATE]
proof (state)
this:
A $$ (i, 0) = (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (i - m, 0)

goal (1 subgoal):
 1. A $$ (i, 0) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A $$ (i, 0) = (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (i - m, 0)

goal (1 subgoal):
 1. A $$ (i, 0) = (0::'a)
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (i - m, 0) = (0::'a)
[PROOF STEP]
using i A
[PROOF STATE]
proof (prove)
using this:
i \<in> set [m + 1..<dim_row A]
A \<in> carrier_mat (m + n) n

goal (1 subgoal):
 1. (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (i - m, 0) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(D \<cdot>\<^sub>m 1\<^sub>m n) $$ (i - m, 0) = (0::'a)

goal (1 subgoal):
 1. A $$ (i, 0) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A $$ (i, 0) = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A $$ (i, 0) = (0::'a)

goal (1 subgoal):
 1. A $$ (i, 0) = (0::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A $$ (i, 0) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i \<in> set [m + 1..<dim_row A] \<Longrightarrow> A $$ (?i, 0) = (0::'a)

goal (1 subgoal):
 1. \<forall>x\<in>set [m + 1..<dim_row A]. \<not> A $$ (x, 0) \<noteq> (0::'a)
[PROOF STEP]
thus "\<forall>x\<in>set [m + 1..<dim_row A]. \<not> A $$ (x, 0) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
?i \<in> set [m + 1..<dim_row A] \<Longrightarrow> A $$ (?i, 0) = (0::'a)

goal (1 subgoal):
 1. \<forall>x\<in>set [m + 1..<dim_row A]. \<not> A $$ (x, 0) \<noteq> (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set [m + 1..<dim_row A]. \<not> A $$ (x, 0) \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A] = []

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have fm: "filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [m] = [m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]
[PROOF STEP]
have "A $$ (m, 0) = (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (m-m,0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (m, 0) = (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (m - m, 0)
[PROOF STEP]
by (rule append_rows_nth3[OF A' _ A_def _ _ n0], insert n0, auto)
[PROOF STATE]
proof (state)
this:
A $$ (m, 0) = (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (m - m, 0)

goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A $$ (m, 0) = (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (m - m, 0)

goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]
[PROOF STEP]
have "... = D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (m - m, 0) = D
[PROOF STEP]
using m0 n0
[PROOF STATE]
proof (prove)
using this:
0 < m
0 < n

goal (1 subgoal):
 1. (D \<cdot>\<^sub>m 1\<^sub>m n) $$ (m - m, 0) = D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(D \<cdot>\<^sub>m 1\<^sub>m n) $$ (m - m, 0) = D

goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A $$ (m, 0) = D
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A $$ (m, 0) = D

goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]
[PROOF STEP]
using D0
[PROOF STATE]
proof (prove)
using this:
A $$ (m, 0) = D
D \<noteq> (0::'a)

goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have "non_zero_positions = filter (\<lambda>i. A $$ (i,0) \<noteq> 0) ([1..<m+1]@[m+1..<dim_row A])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m + 1] @ [m + 1..<dim_row A])
[PROOF STEP]
using nz_def l_rw
[PROOF STATE]
proof (prove)
using this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<dim_row A]
[1..<dim_row A] = [1..<m + 1] @ [m + 1..<dim_row A]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m + 1] @ [m + 1..<dim_row A])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m + 1] @ [m + 1..<dim_row A])

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m + 1] @ [m + 1..<dim_row A])

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have "... = filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [1..<m+1] @ filter (\<lambda>i. A $$ (i,0) \<noteq> 0) ([m+1..<dim_row A])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m + 1] @ [m + 1..<dim_row A]) = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] @ filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m + 1] @ [m + 1..<dim_row A]) = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] @ filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m + 1] @ [m + 1..<dim_row A]) = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] @ filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have "... = filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [1..<m+1]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] @ filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A] = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1]
[PROOF STEP]
using f0
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A] = []

goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] @ filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A] = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] @ filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A] = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] @ filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m + 1..<dim_row A] = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have "... = filter (\<lambda>i. A $$ (i,0) \<noteq> 0) ([1..<m]@[m])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m] @ [m])
[PROOF STEP]
using m0
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m] @ [m])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m] @ [m])

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m + 1] = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m] @ [m])

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have "... = filter (\<lambda>i. A $$ (i,0) \<noteq> 0) [1..<m] @ [m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m] @ [m]) = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]
[PROOF STEP]
using fm
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [m] = [m]

goal (1 subgoal):
 1. filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m] @ [m]) = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) ([1..<m] @ [m]) = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]
[PROOF STEP]
have "non_zero_positions = ?xs @ [m]"
[PROOF STATE]
proof (prove)
using this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have "distinct ?xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m])

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m])

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
have "(\<forall>x\<in>set ?xs. x < m \<and> 0 < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]
distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m])
\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m]
distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m])
\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x

goal (1 subgoal):
 1. non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
non_zero_positions = filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m] @ [m] \<and> distinct (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]) \<and> (\<forall>x\<in>set (filter (\<lambda>i. A $$ (i, 0) \<noteq> (0::'a)) [1..<m]). x < m \<and> 0 < x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_ext:
  \<open>(\<forall>i<k. xs'!i=xs!i) \<Longrightarrow>
  k < length xs \<Longrightarrow> k < length xs' \<Longrightarrow>
  take k xs' = take k xs\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i<k. xs' ! i = xs ! i; k < length xs; k < length xs'\<rbrakk> \<Longrightarrow> take k xs' = take k xs
[PROOF STEP]
by (simp add: nth_take_lemma)


[STATEMENT]
lemma tensor_extensionality:
  fixes F G :: \<open>((('a::finite \<times> 'b::finite) ell2) \<Rightarrow>\<^sub>C\<^sub>L (('c::finite \<times> 'd::finite) ell2)) \<Rightarrow> 'e::complex_vector\<close>
  assumes [simp]: "clinear F" "clinear G"
  assumes tensor_eq: "(\<And>a b. F (tensor_op a b) = G (tensor_op a b))"
  shows "F = G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F = G
[PROOF STEP]
proof (rule ext, rule complex_vector.linear_eq_on_span[where f=F and g=G])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x. clinear F
 2. \<And>x. clinear G
 3. \<And>x xa. xa \<in> ?B2 x \<Longrightarrow> F xa = G xa
 4. \<And>x. x \<in> cspan (?B2 x)
[PROOF STEP]
show \<open>clinear F\<close> and \<open>clinear G\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clinear F &&& clinear G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
clinear F
clinear G
F (?a \<otimes>\<^sub>o ?b) = G (?a \<otimes>\<^sub>o ?b)

goal (1 subgoal):
 1. clinear F &&& clinear G
[PROOF STEP]
by (simp_all add: cbilinear_def)
[PROOF STATE]
proof (state)
this:
clinear F
clinear G

goal (2 subgoals):
 1. \<And>x xa. xa \<in> ?B2 x \<Longrightarrow> F xa = G xa
 2. \<And>x. x \<in> cspan (?B2 x)
[PROOF STEP]
show \<open>x \<in> cspan  {tensor_op (butterket i j) (butterket k l)| i j k l. True}\<close>
    for x :: \<open>('a \<times> 'b) ell2 \<Rightarrow>\<^sub>C\<^sub>L ('c \<times> 'd) ell2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> cspan {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True}
[PROOF STEP]
using cspan_tensor_op
[PROOF STATE]
proof (prove)
using this:
cspan {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True} = UNIV

goal (1 subgoal):
 1. x \<in> cspan {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> cspan {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True}

goal (1 subgoal):
 1. \<And>x xa. xa \<in> {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True} \<Longrightarrow> F xa = G xa
[PROOF STEP]
show \<open>F x = G x\<close> if \<open>x \<in> {tensor_op (butterket i j) (butterket k l) |i j k l. True}\<close> for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F x = G x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<in> {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True}

goal (1 subgoal):
 1. F x = G x
[PROOF STEP]
by (auto simp: tensor_eq)
[PROOF STATE]
proof (state)
this:
?x \<in> {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True} \<Longrightarrow> F ?x = G ?x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma encode12_inv2:
  assumes "i < d1" "j < d2"
  shows "encode2 (encode12 (i, j)) = j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. encode2 (encode12 (i, j)) = j
[PROOF STEP]
unfolding encode12.simps encode2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. digit_decode dims2 (nths (digit_encode dims (digit_decode dims (weave vars (digit_encode dims1 i) (digit_encode dims2 j)))) (- vars)) = j
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < d1
j < d2

goal (1 subgoal):
 1. digit_decode dims2 (nths (digit_encode dims (digit_decode dims (weave vars (digit_encode dims1 i) (digit_encode dims2 j)))) (- vars)) = j
[PROOF STEP]
unfolding d1_def d2_def dims1_def dims2_def
[PROOF STATE]
proof (prove)
using this:
i < prod_list (nths dims vars)
j < prod_list (nths dims (- vars))

goal (1 subgoal):
 1. digit_decode (nths dims (- vars)) (nths (digit_encode dims (digit_decode dims (weave vars (digit_encode (nths dims vars) i) (digit_encode (nths dims (- vars)) j)))) (- vars)) = j
[PROOF STEP]
by (metis digit_decode_encode_lt digit_encode_decode digit_encode_valid_index valid_index_weave(1,3))


[STATEMENT]
lemma of_rat_lec_add: "of_rat_lec (c + d) = of_rat_lec c + of_rat_lec d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat_lec (c + d) = of_rat_lec c + of_rat_lec d
[PROOF STEP]
by (cases c; cases d, auto simp: of_rat_add)


[STATEMENT]
lemma filter_sup_mset[simp]: "filter_mset P (A \<union># B) = filter_mset P A \<union># filter_mset P B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset P (A \<union># B) = filter_mset P A \<union># filter_mset P B
[PROOF STEP]
by (rule multiset_eqI) simp


[STATEMENT]
lemma rsum_add: "rsum D (\<lambda>x. f x + g x) =  rsum D f + rsum D g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rsum D (\<lambda>x. f x + g x) = rsum D f + rsum D g
[PROOF STEP]
by (induct D, auto simp add: algebra_simps)


[STATEMENT]
lemma gbinomial_addition_formula:
  "a gchoose (Suc k) = ((a - 1) gchoose (Suc k)) + ((a - 1) gchoose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a gchoose Suc k = a - (1::'a) gchoose Suc k + (a - (1::'a) gchoose k)
[PROOF STEP]
using gbinomial_Suc_Suc[of "a - 1" k]
[PROOF STATE]
proof (prove)
using this:
a - (1::'a) + (1::'a) gchoose Suc k = a - (1::'a) gchoose k + (a - (1::'a) gchoose Suc k)

goal (1 subgoal):
 1. a gchoose Suc k = a - (1::'a) gchoose Suc k + (a - (1::'a) gchoose k)
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma conga_preserves_lta:
  assumes "A B C CongA A' B' C'" and
    "D E F CongA D' E' F'" and
    "A B C LtA D E F"
  shows "A' B' C' LtA D' E' F'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A' B' C' LtA D' E' F'
[PROOF STEP]
by (meson Tarski_neutral_dimensionless.LtA_def Tarski_neutral_dimensionless.conga_trans Tarski_neutral_dimensionless.l11_30 Tarski_neutral_dimensionless.not_conga_sym Tarski_neutral_dimensionless_axioms assms(1) assms(2) assms(3))


[STATEMENT]
lemma replicate_length_filter:
  "replicate (length (filter (\<lambda>y. x = y) xs)) x = filter (\<lambda>y. x = y) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replicate (length (filter ((=) x) xs)) x = filter ((=) x) xs
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma bigtheta_divide_eq_set_divide:
  shows "\<Theta>[F](\<lambda>x. f x / g x) = set_divide (\<Theta>[F](f)) (\<Theta>[F](g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Theta>[F](\<lambda>x. f x / g x) = set_divide \<Theta>[F](f) \<Theta>[F](g)
[PROOF STEP]
by (simp only: set_divide_inverse divide_inverse bigtheta_mult_eq_set_mult
                 bigtheta_inverse_eq_set_inverse)


[STATEMENT]
lemma norm_bound_mult: assumes A1: "A1 \<in> carrier_mat nr n"
  and A2: "A2 \<in> carrier_mat n nc"
  and b1: "norm_bound A1 b1"
  and b2: "norm_bound A2 b2"
  shows "norm_bound (A1 * A2) (b1 * b2 * of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.norm_bound (A1 * A2) (b1 * b2 * real n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
let ?A = "A1 * A2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
let ?n = "of_nat n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
assume i: "i < dim_row ?A" and j: "j < dim_col ?A"
[PROOF STATE]
proof (state)
this:
i < dim_row (A1 * A2)
j < dim_col (A1 * A2)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
define v1 where "v1 = (\<lambda> k. row A1 i $ k)"
[PROOF STATE]
proof (state)
this:
v1 = ($) (row A1 i)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
define v2 where "v2 = (\<lambda> k. col A2 j $ k)"
[PROOF STATE]
proof (state)
this:
v2 = ($) (col A2 j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
from assms(1-2)
[PROOF STATE]
proof (chain)
picking this:
A1 \<in> carrier_mat nr n
A2 \<in> carrier_mat n nc
[PROOF STEP]
have dim: "dim_row A1 = nr" "dim_col A2 = nc" "dim_col A1 = n" "dim_row A2 = n"
[PROOF STATE]
proof (prove)
using this:
A1 \<in> carrier_mat nr n
A2 \<in> carrier_mat n nc

goal (1 subgoal):
 1. (dim_row A1 = nr &&& dim_col A2 = nc) &&& dim_col A1 = n &&& dim_row A2 = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row A1 = nr
dim_col A2 = nc
dim_col A1 = n
dim_row A2 = n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
dim_row A1 = nr
dim_col A2 = nc
dim_col A1 = n
dim_row A2 = n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
assume k: "k < n"
[PROOF STATE]
proof (state)
this:
k < n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
have n: "norm (v1 k) \<le> b1" "norm (v2 k) \<le> b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (v1 k) \<le> b1 &&& norm (v2 k) \<le> b2
[PROOF STEP]
using i j k dim v1_def v2_def
      b1[unfolded norm_bound_def, rule_format, of i k]
      b2[unfolded norm_bound_def, rule_format, of k j]
[PROOF STATE]
proof (prove)
using this:
i < dim_row (A1 * A2)
j < dim_col (A1 * A2)
k < n
dim_row A1 = nr
dim_col A2 = nc
dim_col A1 = n
dim_row A2 = n
v1 = ($) (row A1 i)
v2 = ($) (col A2 j)
\<lbrakk>i < dim_row A1; k < dim_col A1\<rbrakk> \<Longrightarrow> norm (A1 $$ (i, k)) \<le> b1
\<lbrakk>k < dim_row A2; j < dim_col A2\<rbrakk> \<Longrightarrow> norm (A2 $$ (k, j)) \<le> b2

goal (1 subgoal):
 1. norm (v1 k) \<le> b1 &&& norm (v2 k) \<le> b2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (v1 k) \<le> b1
norm (v2 k) \<le> b2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
have "norm (v1 k * v2 k) \<le> norm (v1 k) * norm (v2 k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (v1 k * v2 k) \<le> norm (v1 k) * norm (v2 k)
[PROOF STEP]
by (rule norm_mult_ineq)
[PROOF STATE]
proof (state)
this:
norm (v1 k * v2 k) \<le> norm (v1 k) * norm (v2 k)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (v1 k * v2 k) \<le> norm (v1 k) * norm (v2 k)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
have "\<dots> \<le> b1 * b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (v1 k) * norm (v2 k) \<le> b1 * b2
[PROOF STEP]
by (rule mult_mono'[OF n], auto)
[PROOF STATE]
proof (state)
this:
norm (v1 k) * norm (v2 k) \<le> b1 * b2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (v1 k * v2 k) \<le> b1 * b2
[PROOF STEP]
have "norm (v1 k * v2 k) \<le> b1 * b2"
[PROOF STATE]
proof (prove)
using this:
norm (v1 k * v2 k) \<le> b1 * b2

goal (1 subgoal):
 1. norm (v1 k * v2 k) \<le> b1 * b2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (v1 k * v2 k) \<le> b1 * b2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?k3 < n \<Longrightarrow> norm (v1 ?k3 * v2 ?k3) \<le> b1 * b2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
note bound = this
[PROOF STATE]
proof (state)
this:
?k3 < n \<Longrightarrow> norm (v1 ?k3 * v2 ?k3) \<le> b1 * b2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
have "?A $$ (i,j) = row A1 i \<bullet> col A2 j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A1 * A2) $$ (i, j) = row A1 i \<bullet> col A2 j
[PROOF STEP]
using dim i j
[PROOF STATE]
proof (prove)
using this:
dim_row A1 = nr
dim_col A2 = nc
dim_col A1 = n
dim_row A2 = n
i < dim_row (A1 * A2)
j < dim_col (A1 * A2)

goal (1 subgoal):
 1. (A1 * A2) $$ (i, j) = row A1 i \<bullet> col A2 j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(A1 * A2) $$ (i, j) = row A1 i \<bullet> col A2 j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A1 * A2) $$ (i, j) = row A1 i \<bullet> col A2 j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
have "\<dots> = (\<Sum> k = 0 ..< n. v1 k * v2 k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row A1 i \<bullet> col A2 j = (\<Sum>k = 0..<n. v1 k * v2 k)
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia = 0..<dim_vec (col A2 j). row A1 i $ ia * col A2 j $ ia) = (\<Sum>k = 0..<n. v1 k * v2 k)
[PROOF STEP]
using dim i j v1_def v2_def
[PROOF STATE]
proof (prove)
using this:
dim_row A1 = nr
dim_col A2 = nc
dim_col A1 = n
dim_row A2 = n
i < dim_row (A1 * A2)
j < dim_col (A1 * A2)
v1 = ($) (row A1 i)
v2 = ($) (col A2 j)

goal (1 subgoal):
 1. (\<Sum>ia = 0..<dim_vec (col A2 j). row A1 i $ ia * col A2 j $ ia) = (\<Sum>k = 0..<n. v1 k * v2 k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
row A1 i \<bullet> col A2 j = (\<Sum>k = 0..<n. v1 k * v2 k)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row A1 i \<bullet> col A2 j = (\<Sum>k = 0..<n. v1 k * v2 k)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
have "norm (\<dots>) \<le> (\<Sum> k = 0 ..< n. b1 * b2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>k = 0..<n. v1 k * v2 k) \<le> (\<Sum>k = 0..<n. b1 * b2)
[PROOF STEP]
by (rule sum_norm_le, insert bound, simp)
[PROOF STATE]
proof (state)
this:
norm (\<Sum>k = 0..<n. v1 k * v2 k) \<le> (\<Sum>k = 0..<n. b1 * b2)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (\<Sum>k = 0..<n. v1 k * v2 k) \<le> (\<Sum>k = 0..<n. b1 * b2)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
have "\<dots> = b1 * b2 * ?n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<n. b1 * b2) = b1 * b2 * real n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<n. b1 * b2) = b1 * b2 * real n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A1 * A2); j < dim_col (A1 * A2)\<rbrakk> \<Longrightarrow> norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
show "norm (?A $$ (i,j)) \<le> b1 * b2 * ?n"
[PROOF STATE]
proof (prove)
using this:
norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n

goal (1 subgoal):
 1. norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm ((A1 * A2) $$ (i, j)) \<le> b1 * b2 * real n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma project_constrains:
     "(project h C F \<in> A co B)  =
      (F \<in> (C \<inter> extend_set h A) co (extend_set h B) & A \<subseteq> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (project h C F \<in> A co B) = (F \<in> C \<inter> extend_set h A co extend_set h B \<and> A \<subseteq> B)
[PROOF STEP]
apply (unfold constrains_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (project h C F \<in> {F. \<forall>act\<in>Acts F. act `` A \<subseteq> B}) = (F \<in> {F. \<forall>act\<in>Acts F. act `` (C \<inter> extend_set h A) \<subseteq> extend_set h B} \<and> A \<subseteq> B)
[PROOF STEP]
apply (auto intro!: project_act_I simp add: ball_Un)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>act x xa. \<lbrakk>A \<subseteq> B; \<forall>act\<in>Acts F. project_act h (Restrict C act) `` A \<subseteq> B; act \<in> Acts F; (xa, x) \<in> act; xa \<in> C; f xa \<in> A\<rbrakk> \<Longrightarrow> f x \<in> B
 2. \<And>act x xa. \<lbrakk>\<forall>act\<in>Acts F. act `` (C \<inter> extend_set h A) \<subseteq> extend_set h B; A \<subseteq> B; act \<in> Acts F; (xa, x) \<in> project_act h (Restrict C act); xa \<in> A\<rbrakk> \<Longrightarrow> x \<in> B
[PROOF STEP]
apply (force intro!: project_act_I dest!: subsetD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>act x xa. \<lbrakk>\<forall>act\<in>Acts F. act `` (C \<inter> extend_set h A) \<subseteq> extend_set h B; A \<subseteq> B; act \<in> Acts F; (xa, x) \<in> project_act h (Restrict C act); xa \<in> A\<rbrakk> \<Longrightarrow> x \<in> B
[PROOF STEP]
apply (unfold project_act_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>act x xa. \<lbrakk>\<forall>act\<in>Acts F. act `` (C \<inter> extend_set h A) \<subseteq> extend_set h B; A \<subseteq> B; act \<in> Acts F; (xa, x) \<in> {(x, x'). \<exists>y y'. (h (x, y), h (x', y')) \<in> Restrict C act}; xa \<in> A\<rbrakk> \<Longrightarrow> x \<in> B
[PROOF STEP]
apply (force dest!: subsetD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma msort_alt_def:
  \<open>RETURN o (msort f) =
     REC\<^sub>T (\<lambda>g xs.
        case xs of
          [] \<Rightarrow> RETURN []
        | [x] \<Rightarrow> RETURN [x]
        | _ \<Rightarrow> do {
           a \<leftarrow> g (take (size xs div 2) xs);
           b \<leftarrow> g (drop (size xs div 2) xs);
           RETURN (merge f a b)})\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (RETURN \<circ>\<circ> msort) f = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b))))
[PROOF STEP]
apply (intro ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (RETURN \<circ>\<circ> msort) f x = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) x
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. RETURN (msort f x) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) x
[PROOF STEP]
apply (induct_tac f x rule: msort.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x f. RETURN (msort f []) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) []
 2. \<And>x f xa. RETURN (msort f [xa]) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) [xa]
 3. \<And>x f v vb vc. \<lbrakk>RETURN (msort f (take (length (v # vb # vc) div 2) (v # vb # vc))) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (take (length (v # vb # vc) div 2) (v # vb # vc)); RETURN (msort f (drop (length (v # vb # vc) div 2) (v # vb # vc))) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (drop (length (v # vb # vc) div 2) (v # vb # vc))\<rbrakk> \<Longrightarrow> RETURN (msort f (v # vb # vc)) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (v # vb # vc)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RETURN (msort f_ []) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f_ a b)))) []
[PROOF STEP]
by (subst RECT_unfold, refine_mono) auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x f xa. RETURN (msort f [xa]) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) [xa]
 2. \<And>x f v vb vc. \<lbrakk>RETURN (msort f (take (length (v # vb # vc) div 2) (v # vb # vc))) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (take (length (v # vb # vc) div 2) (v # vb # vc)); RETURN (msort f (drop (length (v # vb # vc) div 2) (v # vb # vc))) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (drop (length (v # vb # vc) div 2) (v # vb # vc))\<rbrakk> \<Longrightarrow> RETURN (msort f (v # vb # vc)) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (v # vb # vc)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RETURN (msort f_ [xa_]) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f_ a b)))) [xa_]
[PROOF STEP]
by (subst RECT_unfold, refine_mono) auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x f v vb vc. \<lbrakk>RETURN (msort f (take (length (v # vb # vc) div 2) (v # vb # vc))) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (take (length (v # vb # vc) div 2) (v # vb # vc)); RETURN (msort f (drop (length (v # vb # vc) div 2) (v # vb # vc))) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (drop (length (v # vb # vc) div 2) (v # vb # vc))\<rbrakk> \<Longrightarrow> RETURN (msort f (v # vb # vc)) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f a b)))) (v # vb # vc)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>RETURN (msort f_ (take (length (v_ # vb_ # vc_) div 2) (v_ # vb_ # vc_))) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f_ a b)))) (take (length (v_ # vb_ # vc_) div 2) (v_ # vb_ # vc_)); RETURN (msort f_ (drop (length (v_ # vb_ # vc_) div 2) (v_ # vb_ # vc_))) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f_ a b)))) (drop (length (v_ # vb_ # vc_) div 2) (v_ # vb_ # vc_))\<rbrakk> \<Longrightarrow> RETURN (msort f_ (v_ # vb_ # vc_)) = REC\<^sub>T (\<lambda>g xs. case xs of [] \<Rightarrow> RETURN [] | [x] \<Rightarrow> RETURN [x] | x # aa # lista \<Rightarrow> g (take (length xs div 2) xs) \<bind> (\<lambda>a. g (drop (length xs div 2) xs) \<bind> (\<lambda>b. RETURN (PAC_Checker_Init.merge f_ a b)))) (v_ # vb_ # vc_)
[PROOF STEP]
by (subst RECT_unfold, refine_mono)
     (smt (verit) let_to_bind_conv list.simps(5) msort.simps(3))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma meet_greatest [intro?]: "z \<sqsubseteq> x \<Longrightarrow> z \<sqsubseteq> y \<Longrightarrow> z \<sqsubseteq> x \<sqinter> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x \<sqinter> y
[PROOF STEP]
by (rule is_inf_greatest) (rule is_inf_meet)


[STATEMENT]
lemma nonzero_ac_val_ord:
  assumes "x \<in> carrier Q\<^sub>p"
  assumes "ac m x \<noteq> 0"
  shows "val x = ord x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val x = eint (ord x)
[PROOF STEP]
using nonzero_ac_imp_nonzero assms val_ord
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier Q\<^sub>p; ac ?m ?x \<noteq> 0\<rbrakk> \<Longrightarrow> ?x \<in> nonzero Q\<^sub>p
x \<in> carrier Q\<^sub>p
ac m x \<noteq> 0
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> val ?a = eint (ord ?a)

goal (1 subgoal):
 1. val x = eint (ord x)
[PROOF STEP]
by blast


[STATEMENT]
lemma list_slice2_nth: "
  \<lbrakk> m < length xs div k \<rbrakk> \<Longrightarrow>
  list_slice2 xs k ! m = xs \<up> (m * k) \<down> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < length xs div k \<Longrightarrow> list_slice2 xs k ! m = xs \<up> (m * k) \<down> k
[PROOF STEP]
by (simp add: list_slice2_def list_slice_length nth_append list_slice_nth)


[STATEMENT]
lemma simplicial_chain_diff:
   "\<lbrakk>simplicial_chain p S c1; simplicial_chain p S c2\<rbrakk> \<Longrightarrow> simplicial_chain p S (c1 - c2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>simplicial_chain p S c1; simplicial_chain p S c2\<rbrakk> \<Longrightarrow> simplicial_chain p S (c1 - c2)
[PROOF STEP]
unfolding simplicial_chain_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Poly_Mapping.keys c1 \<subseteq> Collect (simplicial_simplex p S); Poly_Mapping.keys c2 \<subseteq> Collect (simplicial_simplex p S)\<rbrakk> \<Longrightarrow> Poly_Mapping.keys (c1 - c2) \<subseteq> Collect (simplicial_simplex p S)
[PROOF STEP]
by (meson UnE keys_diff subset_iff)


[STATEMENT]
theorem Clique_not_solvable_by_small_tf_mformula: assumes solution: "\<forall> G \<in> \<G>. G \<in> CLIQUE \<longleftrightarrow> eval (\<theta>\<^sub>g G) \<phi>"
  and tf: "\<phi> \<in> tf_mformula"
  and phi: "\<phi> \<in> \<A>"
shows "cs \<phi> > k powr (4 / 7 * sqrt k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real k powr (4 / 7 * sqrt (real k)) < real (cs \<phi>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real k powr (4 / 7 * sqrt (real k)) < real (cs \<phi>)
[PROOF STEP]
from CLIQUE_solution_imp_POS_sub_ACC[OF solution tf phi]
[PROOF STATE]
proof (chain)
picking this:
POS \<subseteq> ACC_mf \<phi>
[PROOF STEP]
have POS: "POS \<subseteq> ACC_mf \<phi>"
[PROOF STATE]
proof (prove)
using this:
POS \<subseteq> ACC_mf \<phi>

goal (1 subgoal):
 1. POS \<subseteq> ACC_mf \<phi>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
POS \<subseteq> ACC_mf \<phi>

goal (1 subgoal):
 1. real k powr (4 / 7 * sqrt (real k)) < real (cs \<phi>)
[PROOF STEP]
from CLIQUE_solution_imp_ACC_cf_empty[OF solution tf phi]
[PROOF STATE]
proof (chain)
picking this:
ACC_cf_mf \<phi> = {}
[PROOF STEP]
have CF: "ACC_cf_mf \<phi> = {}"
[PROOF STATE]
proof (prove)
using this:
ACC_cf_mf \<phi> = {}

goal (1 subgoal):
 1. ACC_cf_mf \<phi> = {}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ACC_cf_mf \<phi> = {}

goal (1 subgoal):
 1. real k powr (4 / 7 * sqrt (real k)) < real (cs \<phi>)
[PROOF STEP]
from theorem_13[OF tf phi POS CF]
[PROOF STATE]
proof (chain)
picking this:
real k powr (4 / 7 * sqrt (real k)) < real (cs \<phi>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real k powr (4 / 7 * sqrt (real k)) < real (cs \<phi>)

goal (1 subgoal):
 1. real k powr (4 / 7 * sqrt (real k)) < real (cs \<phi>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real k powr (4 / 7 * sqrt (real k)) < real (cs \<phi>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_plus_imp_minus: "a \<in> b +o C \<Longrightarrow> a - b \<in> C"
  for a b :: "'a::ab_group_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> b +o C \<Longrightarrow> a - b \<in> C
[PROOF STEP]
by (auto simp add: elt_set_plus_def ac_simps)


[STATEMENT]
lemma lconjby_alternating_list_order2:
  assumes "s+s=0" "t+t=0"
  shows   "lconjby (sum_list (alternating_list k s t)) (if even k then s else t) =
            sum_list (alternating_list (Suc (2*k)) s t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lconjby (sum_list (alternating_list k s t)) (if even k then s else t) = sum_list (alternating_list (Suc (2 * k)) s t)
[PROOF STEP]
proof (induct k rule: nat_induct_step2)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. lconjby (sum_list (alternating_list 0 s t)) (if even 0 then s else t) = sum_list (alternating_list (Suc (2 * 0)) s t)
 2. lconjby (sum_list (alternating_list 1 s t)) (if is_unit 2 then s else t) = sum_list (alternating_list (Suc (2 * 1)) s t)
 3. \<And>m. lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t) \<Longrightarrow> lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
case (SucSuc m)
[PROOF STATE]
proof (state)
this:
lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t)

goal (3 subgoals):
 1. lconjby (sum_list (alternating_list 0 s t)) (if even 0 then s else t) = sum_list (alternating_list (Suc (2 * 0)) s t)
 2. lconjby (sum_list (alternating_list 1 s t)) (if is_unit 2 then s else t) = sum_list (alternating_list (Suc (2 * 1)) s t)
 3. \<And>m. lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t) \<Longrightarrow> lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
have "lconjby (sum_list (alternating_list (Suc (Suc m)) s t))
          (if even (Suc (Suc m)) then s else t) = s + t +
          lconjby (sum_list (alternating_list m s t)) (if even m then s else t) - t - s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = s + t + lconjby (sum_list (alternating_list m s t)) (if even m then s else t) - t - s
[PROOF STEP]
using alternating_list_SucSuc_ConsCons[of m s t]
[PROOF STATE]
proof (prove)
using this:
alternating_list (Suc (Suc m)) s t = s # t # alternating_list m s t

goal (1 subgoal):
 1. lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = s + t + lconjby (sum_list (alternating_list m s t)) (if even m then s else t) - t - s
[PROOF STEP]
by    (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = s + t + lconjby (sum_list (alternating_list m s t)) (if even m then s else t) - t - s

goal (3 subgoals):
 1. lconjby (sum_list (alternating_list 0 s t)) (if even 0 then s else t) = sum_list (alternating_list (Suc (2 * 0)) s t)
 2. lconjby (sum_list (alternating_list 1 s t)) (if is_unit 2 then s else t) = sum_list (alternating_list (Suc (2 * 1)) s t)
 3. \<And>m. lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t) \<Longrightarrow> lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = s + t + lconjby (sum_list (alternating_list m s t)) (if even m then s else t) - t - s

goal (3 subgoals):
 1. lconjby (sum_list (alternating_list 0 s t)) (if even 0 then s else t) = sum_list (alternating_list (Suc (2 * 0)) s t)
 2. lconjby (sum_list (alternating_list 1 s t)) (if is_unit 2 then s else t) = sum_list (alternating_list (Suc (2 * 1)) s t)
 3. \<And>m. lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t) \<Longrightarrow> lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
from assms SucSuc
[PROOF STATE]
proof (chain)
picking this:
s + s = (0::'a)
t + t = (0::'a)
lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t)
[PROOF STEP]
have  "\<dots> = sum_list (alternating_list (Suc (2*Suc (Suc m))) s t)"
[PROOF STATE]
proof (prove)
using this:
s + s = (0::'a)
t + t = (0::'a)
lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t)

goal (1 subgoal):
 1. s + t + lconjby (sum_list (alternating_list m s t)) (if even m then s else t) - t - s = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
using alternating_list_SucSuc_ConsCons[of "Suc (2*m)" s t]
          sum_list.append[of "alternating_list (Suc (2*Suc m)) s t" "[t]"]
[PROOF STATE]
proof (prove)
using this:
s + s = (0::'a)
t + t = (0::'a)
lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t)
alternating_list (Suc (Suc (Suc (2 * m)))) s t = s # t # alternating_list (Suc (2 * m)) s t
sum_list (alternating_list (Suc (2 * Suc m)) s t @ [t]) = sum_list (alternating_list (Suc (2 * Suc m)) s t) + sum_list [t]

goal (1 subgoal):
 1. s + t + lconjby (sum_list (alternating_list m s t)) (if even m then s else t) - t - s = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
by    (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
s + t + lconjby (sum_list (alternating_list m s t)) (if even m then s else t) - t - s = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)

goal (3 subgoals):
 1. lconjby (sum_list (alternating_list 0 s t)) (if even 0 then s else t) = sum_list (alternating_list (Suc (2 * 0)) s t)
 2. lconjby (sum_list (alternating_list 1 s t)) (if is_unit 2 then s else t) = sum_list (alternating_list (Suc (2 * 1)) s t)
 3. \<And>m. lconjby (sum_list (alternating_list m s t)) (if even m then s else t) = sum_list (alternating_list (Suc (2 * m)) s t) \<Longrightarrow> lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)

goal (1 subgoal):
 1. lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
lconjby (sum_list (alternating_list (Suc (Suc m)) s t)) (if even (Suc (Suc m)) then s else t) = sum_list (alternating_list (Suc (2 * Suc (Suc m))) s t)

goal (2 subgoals):
 1. lconjby (sum_list (alternating_list 0 s t)) (if even 0 then s else t) = sum_list (alternating_list (Suc (2 * 0)) s t)
 2. lconjby (sum_list (alternating_list 1 s t)) (if is_unit 2 then s else t) = sum_list (alternating_list (Suc (2 * 1)) s t)
[PROOF STEP]
qed (auto simp add: assms(1) algebra_simps)


[STATEMENT]
lemma nat_diff_add:
  fixes i :: nat
  shows "\<lbrakk> i + j = k \<rbrakk> \<Longrightarrow> i = k - j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + j = k \<Longrightarrow> i = k - j
[PROOF STEP]
by arith


[STATEMENT]
lemma tree_path_iff_parenthesis:
    assumes "v \<in> dom (finished s)" "w \<in> dom (finished s)"
    shows "(v,w) \<in> (tree_edges s)\<^sup>+ \<longleftrightarrow> \<delta> s v < \<delta> s w \<and> \<phi> s v > \<phi> s w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((v, w) \<in> (tree_edges s)\<^sup>+) = (\<delta> s v < \<delta> s w \<and> \<phi> s w < \<phi> s v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> dom (finished s)
w \<in> dom (finished s)

goal (1 subgoal):
 1. ((v, w) \<in> (tree_edges s)\<^sup>+) = (\<delta> s v < \<delta> s w \<and> \<phi> s w < \<phi> s v)
[PROOF STEP]
by (metis parenthesis_impl_tree_path tree_path_impl_parenthesis)


[STATEMENT]
lemma card_UNION:
  assumes "finite A"
    and "\<forall>k \<in> A. finite k"
  shows "card (\<Union>A) = nat (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter>I)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union> A) = nat (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
by (simp only: flip: int_card_UNION [OF assms])


[STATEMENT]
lemma (in \<Z>) vsnd_arrow_is_cat_Par_arr'[cat_rel_Par_set_cs_intros]:
  assumes "A \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>"
    and "B \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>"
    and "AB = A \<times>\<^sub>\<circ> B"
    and "B' = B"
    and "\<CC>' = cat_Par \<alpha>"
  shows "vsnd_arrow A B : AB \<mapsto>\<^bsub>\<CC>'\<^esub> B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsnd_arrow A B : AB \<mapsto>\<^bsub>\<CC>'\<^esub> B'
[PROOF STEP]
using assms(1-2)
[PROOF STATE]
proof (prove)
using this:
A \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>
B \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. vsnd_arrow A B : AB \<mapsto>\<^bsub>\<CC>'\<^esub> B'
[PROOF STEP]
unfolding assms(3-5)
[PROOF STATE]
proof (prove)
using this:
A \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>
B \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. vsnd_arrow A B : A \<times>\<^sub>\<circ> B \<mapsto>\<^bsub>cat_Par \<alpha>\<^esub> B
[PROOF STEP]
by (rule vsnd_arrow_is_cat_Par_arr)


[STATEMENT]
lemma p_gt_0: "p > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p
[PROOF STEP]
using p_ge_3
[PROOF STATE]
proof (prove)
using this:
3 \<le> p

goal (1 subgoal):
 1. 0 < p
[PROOF STEP]
by linarith


[STATEMENT]
lemma symmetric_condition_1: "\<Lambda> * (\<v> - 1) = \<k> * (\<k> - 1) \<Longrightarrow> \<b> = \<v> \<and> \<r> = \<k>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Lambda> * (\<v> - 1) = \<k> * (\<k> - 1) \<Longrightarrow> \<b> = \<v> \<and> \<r> = \<k>
[PROOF STEP]
using b_non_zero bibd_block_number mult_eq_0_iff necessary_condition_two necessary_condition_one
[PROOF STATE]
proof (prove)
using this:
\<b> \<noteq> 0
\<b> = \<Lambda> * \<v> * (\<v> - 1) div (\<k> * (\<k> - 1))
(?a * ?b = (0::?'a)) = (?a = (0::?'a) \<or> ?b = (0::?'a))
\<v> * \<r> = \<b> * \<k>
\<r> * (\<k> - 1) = \<Lambda> * (\<v> - 1)

goal (1 subgoal):
 1. \<Lambda> * (\<v> - 1) = \<k> * (\<k> - 1) \<Longrightarrow> \<b> = \<v> \<and> \<r> = \<k>
[PROOF STEP]
by auto


[STATEMENT]
lemma not_subseteq:" \<not> A \<subseteq> B \<Longrightarrow> \<exists>a \<in> A. a \<notin> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> A \<subseteq> B \<Longrightarrow> \<exists>a\<in>A. a \<notin> B
[PROOF STEP]
by blast


[STATEMENT]
lemma max_deg1_gt_1_if_new_contr:
  assumes "\<And>r1 t2 e2. is_subtree (Node r1 {|(t2,e2)|}) t0 \<Longrightarrow> rank (rev r1) \<le> rank (rev (Dtree.root t2))"
      and "is_subtree (Node r {|(t1,e1)|}) (merge1 t0)"
      and "rank (rev (Dtree.root t1)) < rank (rev r)"
    shows "max_deg t0 > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < max_deg t0
[PROOF STEP]
using assms merge1_mdeg_gt1_if_uneq
[PROOF STATE]
proof (prove)
using this:
is_subtree (Node ?r1.2 {|(?t2.2, ?e2.2)|}) t0 \<Longrightarrow> rank (rev ?r1.2) \<le> rank (rev (dtree.root ?t2.2))
is_subtree (Node r {|(t1, e1)|}) (merge1 t0)
rank (rev (dtree.root t1)) < rank (rev r)
merge1 ?t1.0 \<noteq> ?t1.0 \<Longrightarrow> 1 < max_deg ?t1.0

goal (1 subgoal):
 1. 1 < max_deg t0
[PROOF STEP]
by force


[STATEMENT]
lemma reflexive_inf_plus_star:
  assumes "reflexive x"
  shows "x \<sqinter> y\<^sup>+ \<le> 1 \<longleftrightarrow> x \<sqinter> y\<^sup>\<star> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coreflexive (x \<sqinter> y\<^sup>+) = (x \<sqinter> y\<^sup>\<star> = (1::'a))
[PROOF STEP]
using assms reflexive_inf_star sup.absorb_iff1
[PROOF STATE]
proof (prove)
using this:
reflexive x
reflexive ?y \<Longrightarrow> ?y \<sqinter> ?x\<^sup>\<star> = (1::'a) \<squnion> ?y \<sqinter> ?x\<^sup>+
(?b \<le> ?a) = (?a \<squnion> ?b = ?a)

goal (1 subgoal):
 1. coreflexive (x \<sqinter> y\<^sup>+) = (x \<sqinter> y\<^sup>\<star> = (1::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma morph_rev_len:  "\<^bold>|f (rev u)\<^bold>| = \<^bold>|f u\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>|f (rev u)\<^bold>| = \<^bold>|f u\<^bold>|
[PROOF STEP]
proof (induction u, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a u. \<^bold>|f (rev u)\<^bold>| = \<^bold>|f u\<^bold>| \<Longrightarrow> \<^bold>|f (rev (a # u))\<^bold>| = \<^bold>|f (a # u)\<^bold>|
[PROOF STEP]
case (Cons a u)
[PROOF STATE]
proof (state)
this:
\<^bold>|f (rev u)\<^bold>| = \<^bold>|f u\<^bold>|

goal (1 subgoal):
 1. \<And>a u. \<^bold>|f (rev u)\<^bold>| = \<^bold>|f u\<^bold>| \<Longrightarrow> \<^bold>|f (rev (a # u))\<^bold>| = \<^bold>|f (a # u)\<^bold>|
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<^bold>|f (rev u)\<^bold>| = \<^bold>|f u\<^bold>|
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<^bold>|f (rev u)\<^bold>| = \<^bold>|f u\<^bold>|

goal (1 subgoal):
 1. \<^bold>|f (rev (a # u))\<^bold>| = \<^bold>|f (a # u)\<^bold>|
[PROOF STEP]
unfolding rev.simps(2) pop_hd[of a u] morph lenmorph
[PROOF STATE]
proof (prove)
using this:
\<^bold>|f (rev u)\<^bold>| = \<^bold>|f u\<^bold>|

goal (1 subgoal):
 1. \<^bold>|f (rev u)\<^bold>| + \<^bold>|f [a]\<^bold>| = \<^bold>|f [a]\<^bold>| + \<^bold>|f u\<^bold>|
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<^bold>|f (rev (a # u))\<^bold>| = \<^bold>|f (a # u)\<^bold>|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma const_is_pr_2: "(\<lambda> x y. (n::nat)) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. n) \<in> PrimRec2
[PROOF STEP]
proof (rule pr_comp1_2 [where ?f="%x.(n::nat)" and ?g="%x y. x"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. n) \<in> PrimRec1
 2. (\<lambda>x y. x) \<in> PrimRec2
[PROOF STEP]
show "(\<lambda> x. n) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. n) \<in> PrimRec1
[PROOF STEP]
by (rule const_is_pr)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. n) \<in> PrimRec1

goal (1 subgoal):
 1. (\<lambda>x y. x) \<in> PrimRec2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x y. x) \<in> PrimRec2
[PROOF STEP]
show "(\<lambda> x y. x) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. x) \<in> PrimRec2
[PROOF STEP]
by (rule pr_id2_1)
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. x) \<in> PrimRec2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reflect_poly_power: "reflect_poly (p ^ n) = reflect_poly p ^ n"
  for p :: "'a::{comm_semiring_1,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflect_poly (p ^ n) = reflect_poly p ^ n
[PROOF STEP]
by (induct n) (simp_all add: reflect_poly_mult)


[STATEMENT]
lemma per_col_unitary:
  assumes "A\<in> carrier_mat n n"
  and "unitary A"
  and "bij_betw f {..< n} {..< n}"
shows "unitary (per_col A f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.unitary (per_col A f)
[PROOF STEP]
unfolding unitary_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. per_col A f \<in> carrier_mat (dim_row (per_col A f)) (dim_row (per_col A f)) \<and> inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. per_col A f \<in> carrier_mat (dim_row (per_col A f)) (dim_row (per_col A f))
 2. inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))
[PROOF STEP]
show pc: "per_col A f \<in>
    carrier_mat (dim_row (per_col A f)) (dim_row (per_col A f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. per_col A f \<in> carrier_mat (dim_row (per_col A f)) (dim_row (per_col A f))
[PROOF STEP]
using assms per_col_carrier
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
Complex_Matrix.unitary A
bij_betw f {..<n} {..<n}
?A \<in> carrier_mat ?n ?m \<Longrightarrow> per_col ?A ?f \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. per_col A f \<in> carrier_mat (dim_row (per_col A f)) (dim_row (per_col A f))
[PROOF STEP]
by (metis carrier_matD(1))
[PROOF STATE]
proof (state)
this:
per_col A f \<in> carrier_mat (dim_row (per_col A f)) (dim_row (per_col A f))

goal (1 subgoal):
 1. inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))
[PROOF STEP]
have "dim_row (per_col A f) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (per_col A f) = n
[PROOF STEP]
using assms per_col_carrier
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
Complex_Matrix.unitary A
bij_betw f {..<n} {..<n}
?A \<in> carrier_mat ?n ?m \<Longrightarrow> per_col ?A ?f \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. dim_row (per_col A f) = n
[PROOF STEP]
by (metis carrier_matD(1))
[PROOF STATE]
proof (state)
this:
dim_row (per_col A f) = n

goal (1 subgoal):
 1. inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dim_row (per_col A f) = n

goal (1 subgoal):
 1. inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))
[PROOF STEP]
have "(Complex_Matrix.adjoint (per_col A f)) * (per_col A f) = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint (per_col A f) * per_col A f = 1\<^sub>m n
[PROOF STEP]
proof (rule eq_matI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
 2. dim_row (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_row (1\<^sub>m n)
 3. dim_col (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_col (1\<^sub>m n)
[PROOF STEP]
show "dim_row (Complex_Matrix.adjoint (per_col A f) * per_col A f) =
      dim_row (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_row (1\<^sub>m n)
[PROOF STEP]
using pc
[PROOF STATE]
proof (prove)
using this:
per_col A f \<in> carrier_mat (dim_row (per_col A f)) (dim_row (per_col A f))

goal (1 subgoal):
 1. dim_row (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_row (1\<^sub>m n)
[PROOF STEP]
by (metis adjoint_dim_row calculation carrier_matD(2) index_mult_mat(2)
          index_one_mat(2))
[PROOF STATE]
proof (state)
this:
dim_row (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_row (1\<^sub>m n)

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
 2. dim_col (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_col (1\<^sub>m n)
[PROOF STEP]
thus "dim_col (Complex_Matrix.adjoint (per_col A f) * per_col A f) =
      dim_col (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
using this:
dim_row (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_row (1\<^sub>m n)

goal (1 subgoal):
 1. dim_col (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_col (1\<^sub>m n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_col (Complex_Matrix.adjoint (per_col A f) * per_col A f) = dim_col (1\<^sub>m n)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
assume "i < dim_row (1\<^sub>m n)" and "j < dim_col (1\<^sub>m n)"
[PROOF STATE]
proof (state)
this:
i < dim_row (1\<^sub>m n)
j < dim_col (1\<^sub>m n)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
note ij = this
[PROOF STATE]
proof (state)
this:
i < dim_row (1\<^sub>m n)
j < dim_col (1\<^sub>m n)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
have "(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) =
      (Complex_Matrix.adjoint A * A) $$ (f i, f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
proof (rule per_col_mult_adjoint)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. A \<in> carrier_mat ?n ?n
 2. i < ?n
 3. j < ?n
 4. f i < ?n
 5. f j < ?n
[PROOF STEP]
show "A\<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
Complex_Matrix.unitary A
bij_betw f {..<n} {..<n}

goal (1 subgoal):
 1. A \<in> carrier_mat n n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n

goal (4 subgoals):
 1. i < n
 2. j < n
 3. f i < n
 4. f j < n
[PROOF STEP]
show "i < n" "j < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < n &&& j < n
[PROOF STEP]
using ij
[PROOF STATE]
proof (prove)
using this:
i < dim_row (1\<^sub>m n)
j < dim_col (1\<^sub>m n)

goal (1 subgoal):
 1. i < n &&& j < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < n
j < n

goal (2 subgoals):
 1. f i < n
 2. f j < n
[PROOF STEP]
thus "f i < n"
[PROOF STATE]
proof (prove)
using this:
i < n
j < n

goal (1 subgoal):
 1. f i < n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < n
j < n
A \<in> carrier_mat n n
Complex_Matrix.unitary A
bij_betw f {..<n} {..<n}

goal (1 subgoal):
 1. f i < n
[PROOF STEP]
by (meson bij_betw_apply lessThan_iff)
[PROOF STATE]
proof (state)
this:
f i < n

goal (1 subgoal):
 1. f j < n
[PROOF STEP]
show "f j < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f j < n
[PROOF STEP]
using \<open>j < n\<close> assms
[PROOF STATE]
proof (prove)
using this:
j < n
A \<in> carrier_mat n n
Complex_Matrix.unitary A
bij_betw f {..<n} {..<n}

goal (1 subgoal):
 1. f j < n
[PROOF STEP]
by (meson bij_betw_apply lessThan_iff)
[PROOF STATE]
proof (state)
this:
f j < n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
have "... = (1\<^sub>m n) $$ (f i, f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Complex_Matrix.adjoint A * A) $$ (f i, f j) = 1\<^sub>m n $$ (f i, f j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
Complex_Matrix.unitary A
bij_betw f {..<n} {..<n}

goal (1 subgoal):
 1. (Complex_Matrix.adjoint A * A) $$ (f i, f j) = 1\<^sub>m n $$ (f i, f j)
[PROOF STEP]
unfolding Complex_Matrix.unitary_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
A \<in> carrier_mat (dim_row A) (dim_row A) \<and> inverts_mat A (Complex_Matrix.adjoint A)
bij_betw f {..<n} {..<n}

goal (1 subgoal):
 1. (Complex_Matrix.adjoint A * A) $$ (f i, f j) = 1\<^sub>m n $$ (f i, f j)
[PROOF STEP]
by (metis  assms(2) unitary_simps(1))
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint A * A) $$ (f i, f j) = 1\<^sub>m n $$ (f i, f j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint A * A) $$ (f i, f j) = 1\<^sub>m n $$ (f i, f j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
have "... = (1\<^sub>m n) $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m n $$ (f i, f j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
using idty_index[of f n i j] assms ij
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bij_betw f {..<n} {..<n}; i < n; j < n\<rbrakk> \<Longrightarrow> 1\<^sub>m n $$ (i, j) = 1\<^sub>m n $$ (f i, f j)
A \<in> carrier_mat n n
Complex_Matrix.unitary A
bij_betw f {..<n} {..<n}
i < dim_row (1\<^sub>m n)
j < dim_col (1\<^sub>m n)

goal (1 subgoal):
 1. 1\<^sub>m n $$ (f i, f j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1\<^sub>m n $$ (f i, f j) = 1\<^sub>m n $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m n); j < dim_col (1\<^sub>m n)\<rbrakk> \<Longrightarrow> (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
show "(Complex_Matrix.adjoint (per_col A f) *
      per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)

goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = 1\<^sub>m n $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (per_col A f) * per_col A f = 1\<^sub>m n

goal (1 subgoal):
 1. inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dim_row (per_col A f) = n
Complex_Matrix.adjoint (per_col A f) * per_col A f = 1\<^sub>m n
[PROOF STEP]
show "inverts_mat (per_col A f)
    (Complex_Matrix.adjoint (per_col A f))"
[PROOF STATE]
proof (prove)
using this:
dim_row (per_col A f) = n
Complex_Matrix.adjoint (per_col A f) * per_col A f = 1\<^sub>m n

goal (1 subgoal):
 1. inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))
[PROOF STEP]
using inverts_mat_symm inverts_mat_def
[PROOF STATE]
proof (prove)
using this:
dim_row (per_col A f) = n
Complex_Matrix.adjoint (per_col A f) * per_col A f = 1\<^sub>m n
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n; inverts_mat ?A ?B\<rbrakk> \<Longrightarrow> inverts_mat ?B ?A
inverts_mat ?A ?B \<equiv> ?A * ?B = 1\<^sub>m (dim_row ?A)

goal (1 subgoal):
 1. inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))
[PROOF STEP]
by (metis (no_types, lifting) adjoint_dim_col adjoint_dim_row
        carrier_mat_triv index_mult_mat(3) index_one_mat(3))
[PROOF STATE]
proof (state)
this:
inverts_mat (per_col A f) (Complex_Matrix.adjoint (per_col A f))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_edges_alt: "all_edges S = {{x, y} | x y . x \<in> S \<and> y \<in> S \<and> x \<noteq> y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_edges S = {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
[PROOF STEP]
unfolding all_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {e. e \<subseteq> S \<and> card e = 2} = {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
[PROOF STEP]
proof (intro subset_antisym subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {e. e \<subseteq> S \<and> card e = 2} \<Longrightarrow> x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
 2. \<And>x. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> x \<in> {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {e. e \<subseteq> S \<and> card e = 2} \<Longrightarrow> x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
 2. \<And>x. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> x \<in> {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
assume "x \<in> {e. e \<subseteq> S \<and> card e = 2}"
[PROOF STATE]
proof (state)
this:
x \<in> {e. e \<subseteq> S \<and> card e = 2}

goal (2 subgoals):
 1. \<And>x. x \<in> {e. e \<subseteq> S \<and> card e = 2} \<Longrightarrow> x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
 2. \<And>x. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> x \<in> {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
obtain u v where "x = {u, v}" and "card {u, v} = 2" and "{u, v} \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
x \<in> {e. e \<subseteq> S \<and> card e = 2}

goal (1 subgoal):
 1. (\<And>u v. \<lbrakk>x = {u, v}; card {u, v} = 2; {u, v} \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (mono_tags, lifting) card_2_iff mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
x = {u, v}
card {u, v} = 2
{u, v} \<subseteq> S

goal (2 subgoals):
 1. \<And>x. x \<in> {e. e \<subseteq> S \<and> card e = 2} \<Longrightarrow> x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
 2. \<And>x. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> x \<in> {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = {u, v}
card {u, v} = 2
{u, v} \<subseteq> S
[PROOF STEP]
show "x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}"
[PROOF STATE]
proof (prove)
using this:
x = {u, v}
card {u, v} = 2
{u, v} \<subseteq> S

goal (1 subgoal):
 1. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}

goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> x \<in> {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> x \<in> {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
show "\<And>x. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> x \<in> {e. e \<subseteq> S \<and> card e = 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> x \<in> {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<Longrightarrow> ?x \<in> {e. e \<subseteq> S \<and> card e = 2}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_diff_l: "n\<le>m \<Longrightarrow> gcd m n = gcd (m-n) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> m \<Longrightarrow> Arith2.gcd m n = Arith2.gcd (m - n) n
[PROOF STEP]
apply (unfold gcd_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> m \<Longrightarrow> (SOME x. cd x m n \<and> (\<forall>y. cd y m n \<longrightarrow> y \<le> x)) = (SOME x. cd x (m - n) n \<and> (\<forall>y. cd y (m - n) n \<longrightarrow> y \<le> x))
[PROOF STEP]
apply (subgoal_tac "n\<le>m \<Longrightarrow> \<forall>x. cd x m n = cd x (m-n) n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>n \<le> m; n \<le> m \<Longrightarrow> \<forall>x. cd x m n = cd x (m - n) n\<rbrakk> \<Longrightarrow> (SOME x. cd x m n \<and> (\<forall>y. cd y m n \<longrightarrow> y \<le> x)) = (SOME x. cd x (m - n) n \<and> (\<forall>y. cd y (m - n) n \<longrightarrow> y \<le> x))
 2. \<lbrakk>n \<le> m; n \<le> m\<rbrakk> \<Longrightarrow> \<forall>x. cd x m n = cd x (m - n) n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> m; n \<le> m\<rbrakk> \<Longrightarrow> \<forall>x. cd x m n = cd x (m - n) n
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>n \<le> m; n \<le> m\<rbrakk> \<Longrightarrow> cd x m n = cd x (m - n) n
[PROOF STEP]
apply (erule cd_diff_l)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma image_zmset_pre: "t \<in>#\<^sub>z image_zmset f M \<Longrightarrow> \<exists>m. m \<in>#\<^sub>z M \<and> f m = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in>#\<^sub>z Auxiliary.image_zmset f M \<Longrightarrow> \<exists>m. m \<in>#\<^sub>z M \<and> f m = t
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>t \<in>#\<^sub>z Auxiliary.image_zmset f M; \<nexists>m. m \<in>#\<^sub>z M \<and> f m = t\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume t: "t \<in>#\<^sub>z image_zmset f M"
[PROOF STATE]
proof (state)
this:
t \<in>#\<^sub>z Auxiliary.image_zmset f M

goal (1 subgoal):
 1. \<lbrakk>t \<in>#\<^sub>z Auxiliary.image_zmset f M; \<nexists>m. m \<in>#\<^sub>z M \<and> f m = t\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "\<nexists>m. m \<in>#\<^sub>z M \<and> f m = t"
[PROOF STATE]
proof (state)
this:
\<nexists>m. m \<in>#\<^sub>z M \<and> f m = t

goal (1 subgoal):
 1. \<lbrakk>t \<in>#\<^sub>z Auxiliary.image_zmset f M; \<nexists>m. m \<in>#\<^sub>z M \<and> f m = t\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<nexists>m. m \<in>#\<^sub>z M \<and> f m = t
[PROOF STEP]
have "m \<in>#\<^sub>z M \<Longrightarrow> \<not> f m = t" for m
[PROOF STATE]
proof (prove)
using this:
\<nexists>m. m \<in>#\<^sub>z M \<and> f m = t

goal (1 subgoal):
 1. m \<in>#\<^sub>z M \<Longrightarrow> f m \<noteq> t
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?m \<in>#\<^sub>z M \<Longrightarrow> f ?m \<noteq> t

goal (1 subgoal):
 1. \<lbrakk>t \<in>#\<^sub>z Auxiliary.image_zmset f M; \<nexists>m. m \<in>#\<^sub>z M \<and> f m = t\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?m \<in>#\<^sub>z M \<Longrightarrow> f ?m \<noteq> t
[PROOF STEP]
have "zcount (image_zmset f M) t = 0"
[PROOF STATE]
proof (prove)
using this:
?m \<in>#\<^sub>z M \<Longrightarrow> f ?m \<noteq> t

goal (1 subgoal):
 1. zcount (Auxiliary.image_zmset f M) t = 0
[PROOF STEP]
by (meson t zcount_image_zmset_zero)
[PROOF STATE]
proof (state)
this:
zcount (Auxiliary.image_zmset f M) t = 0

goal (1 subgoal):
 1. \<lbrakk>t \<in>#\<^sub>z Auxiliary.image_zmset f M; \<nexists>m. m \<in>#\<^sub>z M \<and> f m = t\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with t
[PROOF STATE]
proof (chain)
picking this:
t \<in>#\<^sub>z Auxiliary.image_zmset f M
zcount (Auxiliary.image_zmset f M) t = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
t \<in>#\<^sub>z Auxiliary.image_zmset f M
zcount (Auxiliary.image_zmset f M) t = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
by (meson zcount_ne_zero_iff)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma logically_equivalent_eqvt:
    assumes "P =\<cdot> Q" shows "p \<bullet> P =\<cdot> p \<bullet> Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<bullet> P =\<cdot> p \<bullet> Q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P =\<cdot> Q

goal (1 subgoal):
 1. p \<bullet> P =\<cdot> p \<bullet> Q
[PROOF STEP]
unfolding logically_equivalent_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x. P \<Turnstile> x = Q \<Turnstile> x

goal (1 subgoal):
 1. \<forall>x. p \<bullet> P \<Turnstile> x = p \<bullet> Q \<Turnstile> x
[PROOF STEP]
by (metis (mono_tags) permute_minus_cancel(1) valid_eqvt)


[STATEMENT]
lemma word_atLeastLessThan_Suc_atLeastAtMost_union:
  fixes l::"'a::len word"
  assumes "m \<noteq> - 1" and "l \<le> m" and "m \<le> u"
  shows "{l..m} \<union> {m+1..u} = {l..u}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l..m} \<union> {m + 1..u} = {l..u}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {l..m} \<union> {m + 1..u} = {l..u}
[PROOF STEP]
from ivl_disj_un_two(8)[OF assms(2) assms(3)]
[PROOF STATE]
proof (chain)
picking this:
{l..m} \<union> {m<..u} = {l..u}
[PROOF STEP]
have "{l..u} = {l..m} \<union> {m<..u}"
[PROOF STATE]
proof (prove)
using this:
{l..m} \<union> {m<..u} = {l..u}

goal (1 subgoal):
 1. {l..u} = {l..m} \<union> {m<..u}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{l..u} = {l..m} \<union> {m<..u}

goal (1 subgoal):
 1. {l..m} \<union> {m + 1..u} = {l..u}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> - 1
l \<le> m
m \<le> u
{l..u} = {l..m} \<union> {m<..u}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m \<noteq> - 1
l \<le> m
m \<le> u
{l..u} = {l..m} \<union> {m<..u}

goal (1 subgoal):
 1. {l..m} \<union> {m + 1..u} = {l..u}
[PROOF STEP]
by(simp add: word_atLeastAtMost_Suc_greaterThanAtMost)
[PROOF STATE]
proof (state)
this:
{l..m} \<union> {m + 1..u} = {l..u}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiplicative_function_divide_nat_power:
  fixes f :: "nat \<Rightarrow> 'a :: {nat_power, field}"
  assumes "multiplicative_function f"
  shows   "multiplicative_function (\<lambda>n. f n / nat_power n s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function (\<lambda>n. f n / nat_power n s)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f 0 / nat_power 0 s = (0::'a)
 2. f 1 / nat_power 1 s = (1::'a)
 3. \<And>a b. \<lbrakk>1 < a; 1 < b; coprime a b\<rbrakk> \<Longrightarrow> f (a * b) / nat_power (a * b) s = f a / nat_power a s * (f b / nat_power b s)
[PROOF STEP]
interpret f: multiplicative_function f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function f
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f 0 / nat_power 0 s = (0::'a)
 2. f 1 / nat_power 1 s = (1::'a)
 3. \<And>a b. \<lbrakk>1 < a; 1 < b; coprime a b\<rbrakk> \<Longrightarrow> f (a * b) / nat_power (a * b) s = f a / nat_power a s * (f b / nat_power b s)
[PROOF STEP]
show "f 0 / nat_power 0 s = 0" "f 1 / nat_power 1 s = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 / nat_power 0 s = (0::'a) &&& f 1 / nat_power 1 s = (1::'a)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
f 0 / nat_power 0 s = (0::'a)
f 1 / nat_power 1 s = (1::'a)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>1 < a; 1 < b; coprime a b\<rbrakk> \<Longrightarrow> f (a * b) / nat_power (a * b) s = f a / nat_power a s * (f b / nat_power b s)
[PROOF STEP]
fix a b :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>1 < a; 1 < b; coprime a b\<rbrakk> \<Longrightarrow> f (a * b) / nat_power (a * b) s = f a / nat_power a s * (f b / nat_power b s)
[PROOF STEP]
assume "a > 1" "b > 1" "coprime a b"
[PROOF STATE]
proof (state)
this:
1 < a
1 < b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>1 < a; 1 < b; coprime a b\<rbrakk> \<Longrightarrow> f (a * b) / nat_power (a * b) s = f a / nat_power a s * (f b / nat_power b s)
[PROOF STEP]
thus "f (a * b) / nat_power (a * b) s = f a / nat_power a s * (f b / nat_power b s)"
[PROOF STATE]
proof (prove)
using this:
1 < a
1 < b
coprime a b

goal (1 subgoal):
 1. f (a * b) / nat_power (a * b) s = f a / nat_power a s * (f b / nat_power b s)
[PROOF STEP]
by (simp_all add: f.mult_coprime nat_power_mult_distrib)
[PROOF STATE]
proof (state)
this:
f (a * b) / nat_power (a * b) s = f a / nat_power a s * (f b / nat_power b s)

goal:
No subgoals!
[PROOF STEP]
qed