[STATEMENT]
lemma mat_tensor_prod_2 [simp]:
  assumes "state 1 v" and "state 1 w"
  shows "v \<Otimes> w = Matrix.mat 4 1 (\<lambda>(i,j). if i = 0 then v $$ (0,0) * w $$ (0,0) else
                                            if i = 3 then v $$ (1,0) * w $$ (1,0) else
                                              if i = 1 then v $$ (0,0) * w $$ (1,0) else
                                                v $$ (1,0) * w $$ (0,0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<Otimes> w = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))); j < dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)) $$ (i, j)
 2. dim_row (v \<Otimes> w) = dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))
 3. dim_col (v \<Otimes> w) = dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))
[PROOF STEP]
define u where "u = Matrix.mat 4 1 (\<lambda>(i,j). if i = 0 then v $$ (0,0) * w $$ (0,0) else
                                            if i = 3 then v $$ (1,0) * w $$ (1,0) else
                                              if i = 1 then v $$ (0,0) * w $$ (1,0) else
                                                v $$ (1,0) * w $$ (0,0))"
[PROOF STATE]
proof (state)
this:
u = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))); j < dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)) $$ (i, j)
 2. dim_row (v \<Otimes> w) = dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))
 3. dim_col (v \<Otimes> w) = dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))
[PROOF STEP]
show "dim_row (v \<Otimes> w) = dim_row u"
[PROOF STATE]
proof (prove)
using this:
u = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))

goal (1 subgoal):
 1. dim_row (v \<Otimes> w) = dim_row u
[PROOF STEP]
using assms tensor_mat_def state_def
[PROOF STATE]
proof (prove)
using this:
u = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))
state 1 v
state 1 w
?A \<Otimes> ?B \<equiv> Tensor.mat_of_cols_list (dim_row ?A * dim_row ?B) (mult.Tensor (*) (mat_to_cols_list ?A) (mat_to_cols_list ?B))
state ?n ?v \<equiv> dim_col ?v = 1 \<and> dim_row ?v = 2 ^ ?n \<and> \<parallel>Matrix.col ?v 0\<parallel> = 1

goal (1 subgoal):
 1. dim_row (v \<Otimes> w) = dim_row u
[PROOF STEP]
by(simp add: Tensor.mat_of_cols_list_def)
[PROOF STATE]
proof (state)
this:
dim_row (v \<Otimes> w) = dim_row u

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))); j < dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)) $$ (i, j)
 2. dim_col (v \<Otimes> w) = dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_row (v \<Otimes> w) = dim_row u

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))); j < dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)) $$ (i, j)
 2. dim_col (v \<Otimes> w) = dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))
[PROOF STEP]
have "\<dots> = 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row u = 4
[PROOF STEP]
by (simp add: u_def)
[PROOF STATE]
proof (state)
this:
dim_row u = 4

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))); j < dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)) $$ (i, j)
 2. dim_col (v \<Otimes> w) = dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))
[PROOF STEP]
show "dim_col (v \<Otimes> w) = dim_col u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (v \<Otimes> w) = dim_col u
[PROOF STEP]
using u_def assms tensor_mat_def state_def Tensor.mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
u = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))
state 1 v
state 1 w
?A \<Otimes> ?B \<equiv> Tensor.mat_of_cols_list (dim_row ?A * dim_row ?B) (mult.Tensor (*) (mat_to_cols_list ?A) (mat_to_cols_list ?B))
state ?n ?v \<equiv> dim_col ?v = 1 \<and> dim_row ?v = 2 ^ ?n \<and> \<parallel>Matrix.col ?v 0\<parallel> = 1
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_col (v \<Otimes> w) = dim_col u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col (v \<Otimes> w) = dim_col u

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))); j < dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dim_col (v \<Otimes> w) = dim_col u

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))); j < dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)) $$ (i, j)
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col u = 1
[PROOF STEP]
by(simp add: u_def)
[PROOF STATE]
proof (state)
this:
dim_col u = 1

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))); j < dim_col (Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)))\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0)) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dim_row (v \<Otimes> w) = dim_row u
dim_col (v \<Otimes> w) = dim_col u
dim_col u = 1
[PROOF STEP]
show "\<And>i j. i < dim_row u \<Longrightarrow> j < dim_col u \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = u $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
dim_row (v \<Otimes> w) = dim_row u
dim_col (v \<Otimes> w) = dim_col u
dim_col u = 1

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row u; j < dim_col u\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row u; j < dim_col u; dim_row (v \<Otimes> w) = dim_row u; dim_col (v \<Otimes> w) = dim_col u; dim_col u = 1\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
fix i j::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row u; j < dim_col u; dim_row (v \<Otimes> w) = dim_row u; dim_col (v \<Otimes> w) = dim_col u; dim_col u = 1\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
assume a1:"i < dim_row u" and a2:"j < dim_col u"
[PROOF STATE]
proof (state)
this:
i < dim_row u
j < dim_col u

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row u; j < dim_col u; dim_row (v \<Otimes> w) = dim_row u; dim_col (v \<Otimes> w) = dim_col u; dim_col u = 1\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row u
j < dim_col u
[PROOF STEP]
have "(v \<Otimes> w) $$ (i, j) = Matrix.col (v \<Otimes> w) 0 $ i"
[PROOF STATE]
proof (prove)
using this:
i < dim_row u
j < dim_col u

goal (1 subgoal):
 1. (v \<Otimes> w) $$ (i, j) = Matrix.col (v \<Otimes> w) 0 $ i
[PROOF STEP]
using Matrix.col_def u_def assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row u
j < dim_col u
Matrix.col ?A ?j = Matrix.vec (dim_row ?A) (\<lambda>i. ?A $$ (i, ?j))
u = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))
state 1 v
state 1 w

goal (1 subgoal):
 1. (v \<Otimes> w) $$ (i, j) = Matrix.col (v \<Otimes> w) 0 $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(v \<Otimes> w) $$ (i, j) = Matrix.col (v \<Otimes> w) 0 $ i

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row u; j < dim_col u; dim_row (v \<Otimes> w) = dim_row u; dim_col (v \<Otimes> w) = dim_col u; dim_col u = 1\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(v \<Otimes> w) $$ (i, j) = Matrix.col (v \<Otimes> w) 0 $ i
[PROOF STEP]
have f1:"(v \<Otimes> w) $$ (i, j) = (Matrix.col v 0 \<otimes> Matrix.col w 0) $ i"
[PROOF STATE]
proof (prove)
using this:
(v \<Otimes> w) $$ (i, j) = Matrix.col (v \<Otimes> w) 0 $ i

goal (1 subgoal):
 1. (v \<Otimes> w) $$ (i, j) = (Matrix.col v 0 \<otimes> Matrix.col w 0) $ i
[PROOF STEP]
using assms mat_tensor_prod_2_col
[PROOF STATE]
proof (prove)
using this:
(v \<Otimes> w) $$ (i, j) = Matrix.col (v \<Otimes> w) 0 $ i
state 1 v
state 1 w
\<lbrakk>state 1 ?v; state 1 ?w\<rbrakk> \<Longrightarrow> Matrix.col (?v \<Otimes> ?w) 0 = Matrix.col ?v 0 \<otimes> Matrix.col ?w 0

goal (1 subgoal):
 1. (v \<Otimes> w) $$ (i, j) = (Matrix.col v 0 \<otimes> Matrix.col w 0) $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(v \<Otimes> w) $$ (i, j) = (Matrix.col v 0 \<otimes> Matrix.col w 0) $ i

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row u; j < dim_col u; dim_row (v \<Otimes> w) = dim_row u; dim_col (v \<Otimes> w) = dim_col u; dim_col u = 1\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
have "(Matrix.col v 0 \<otimes> Matrix.col w 0) $ i =
 Matrix.vec 4 (\<lambda>i. if i = 0 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 0 else
                                      if i = 3 then Matrix.col v 0 $ 1 * Matrix.col w 0 $ 1 else
                                          if i = 1 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 1 else
                                            Matrix.col v 0 $ 1 * Matrix.col w 0 $ 0) $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Matrix.col v 0 \<otimes> Matrix.col w 0) $ i = Matrix.vec 4 (\<lambda>i. if i = 0 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 0 else if i = 3 then Matrix.col v 0 $ 1 * Matrix.col w 0 $ 1 else if i = 1 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 1 else Matrix.col v 0 $ 1 * Matrix.col w 0 $ 0) $ i
[PROOF STEP]
using vec_tensor_prod_2_bis assms state.state_to_state_qbit
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> state_qbit 1; ?w \<in> state_qbit 1\<rbrakk> \<Longrightarrow> ?v \<otimes> ?w = Matrix.vec 4 (\<lambda>i. if i = 0 then ?v $ 0 * ?w $ 0 else if i = 3 then ?v $ 1 * ?w $ 1 else if i = 1 then ?v $ 0 * ?w $ 1 else ?v $ 1 * ?w $ 0)
state 1 v
state 1 w
state ?n ?v \<Longrightarrow> Matrix.col ?v 0 \<in> state_qbit ?n

goal (1 subgoal):
 1. (Matrix.col v 0 \<otimes> Matrix.col w 0) $ i = Matrix.vec 4 (\<lambda>i. if i = 0 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 0 else if i = 3 then Matrix.col v 0 $ 1 * Matrix.col w 0 $ 1 else if i = 1 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 1 else Matrix.col v 0 $ 1 * Matrix.col w 0 $ 0) $ i
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(Matrix.col v 0 \<otimes> Matrix.col w 0) $ i = Matrix.vec 4 (\<lambda>i. if i = 0 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 0 else if i = 3 then Matrix.col v 0 $ 1 * Matrix.col w 0 $ 1 else if i = 1 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 1 else Matrix.col v 0 $ 1 * Matrix.col w 0 $ 0) $ i

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row u; j < dim_col u; dim_row (v \<Otimes> w) = dim_row u; dim_col (v \<Otimes> w) = dim_col u; dim_col u = 1\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
thus "(v \<Otimes> w) $$ (i, j) = u $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
(Matrix.col v 0 \<otimes> Matrix.col w 0) $ i = Matrix.vec 4 (\<lambda>i. if i = 0 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 0 else if i = 3 then Matrix.col v 0 $ 1 * Matrix.col w 0 $ 1 else if i = 1 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 1 else Matrix.col v 0 $ 1 * Matrix.col w 0 $ 0) $ i

goal (1 subgoal):
 1. (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
using u_def a1 a2 assms state_def
[PROOF STATE]
proof (prove)
using this:
(Matrix.col v 0 \<otimes> Matrix.col w 0) $ i = Matrix.vec 4 (\<lambda>i. if i = 0 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 0 else if i = 3 then Matrix.col v 0 $ 1 * Matrix.col w 0 $ 1 else if i = 1 then Matrix.col v 0 $ 0 * Matrix.col w 0 $ 1 else Matrix.col v 0 $ 1 * Matrix.col w 0 $ 0) $ i
u = Matrix.mat 4 1 (\<lambda>(i, j). if i = 0 then v $$ (0, 0) * w $$ (0, 0) else if i = 3 then v $$ (1, 0) * w $$ (1, 0) else if i = 1 then v $$ (0, 0) * w $$ (1, 0) else v $$ (1, 0) * w $$ (0, 0))
i < dim_row u
j < dim_col u
state 1 v
state 1 w
state ?n ?v \<equiv> dim_col ?v = 1 \<and> dim_row ?v = 2 ^ ?n \<and> \<parallel>Matrix.col ?v 0\<parallel> = 1

goal (1 subgoal):
 1. (v \<Otimes> w) $$ (i, j) = u $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(v \<Otimes> w) $$ (i, j) = u $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < dim_row u; ?j < dim_col u\<rbrakk> \<Longrightarrow> (v \<Otimes> w) $$ (?i, ?j) = u $$ (?i, ?j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma image_ex1_eq: "inj_on f A \<Longrightarrow> (b \<in> f ` A) \<longleftrightarrow> (\<exists>!x \<in> A. b = f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f A \<Longrightarrow> (b \<in> f ` A) = (\<exists>!x. x \<in> A \<and> b = f x)
[PROOF STEP]
by (unfold inj_on_def) blast


[STATEMENT]
lemma linorder_top_finite_sup:
  fixes f :: "'a::finite \<Rightarrow> 'b::linorder_stone_algebra_expansion"
  assumes "\<forall>k . f k \<noteq> top"
    shows "(\<Squnion>\<^sub>k f k) \<noteq> top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup_monoid.sum f {k. True} \<noteq> top
[PROOF STEP]
by (metis assms linorder_finite_sup_selective)


[STATEMENT]
lemma Max_greaterThanLessThan: "Suc m < n \<Longrightarrow> Max {m<..<n} = n - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc m < n \<Longrightarrow> Max {m<..<n} = n - Suc 0
[PROOF STEP]
by (simp only: atLeastSucLessThan_greaterThanLessThan[symmetric] Max_atLeastLessThan)


[STATEMENT]
lemma finite_par_c: "finite (par_c (tr1, tr2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (par_c (tr1, tr2))
[PROOF STEP]
unfolding par_c.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Inl ` Inl -` (cont tr1 \<union> cont tr2) \<union> Inr ` (Inr -` cont tr1 \<times> Inr -` cont tr2))
[PROOF STEP]
apply(rule finite_UnI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (Inl ` Inl -` (cont tr1 \<union> cont tr2))
 2. finite (Inr ` (Inr -` cont tr1 \<times> Inr -` cont tr2))
[PROOF STEP]
apply (metis finite_Un finite_cont finite_imageI finite_vimageI inj_Inl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Inr ` (Inr -` cont tr1 \<times> Inr -` cont tr2))
[PROOF STEP]
apply(intro finite_imageI finite_cartesian_product finite_vimageI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. finite (cont tr1)
 2. inj Inr
 3. finite (cont tr2)
 4. inj Inr
[PROOF STEP]
using finite_cont
[PROOF STATE]
proof (prove)
using this:
finite (cont ?tr)

goal (4 subgoals):
 1. finite (cont tr1)
 2. inj Inr
 3. finite (cont tr2)
 4. inj Inr
[PROOF STEP]
by auto


[STATEMENT]
lemma poly_eval_sum: "poly_eval a (sum f I) = (\<Sum>i\<in>I. poly_eval a (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_eval a (sum f I) = (\<Sum>i\<in>I. poly_eval a (f i))
[PROOF STEP]
by (induct I rule: infinite_finite_induct) (simp_all add: poly_eval_plus)


[STATEMENT]
lemma degree_0_is_Zp_continuous:
  assumes "f \<in> carrier Zp_x"
  assumes "degree f = 0"
  shows "is_Zp_continuous (to_fun f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Zp_continuous (to_fun f)
[PROOF STEP]
using const_to_constant[of "lcf f"] assms constant_is_Zp_continuous ltrm_deg_0
[PROOF STATE]
proof (prove)
using this:
f (deg Zp f) \<in> carrier Zp \<Longrightarrow> to_fun (monom (UP Zp) (f (deg Zp f)) 0) = \<cc>\<^bsub>Zp\<^esub> (f (deg Zp f))
f \<in> carrier (UP Zp)
deg Zp f = 0
?a \<in> carrier Zp \<Longrightarrow> is_Zp_continuous (\<cc>\<^bsub>Zp\<^esub> ?a)
\<lbrakk>?p \<in> carrier (UP Zp); deg Zp ?p = 0\<rbrakk> \<Longrightarrow> monom (UP Zp) (?p (deg Zp ?p)) (deg Zp ?p) = ?p

goal (1 subgoal):
 1. is_Zp_continuous (to_fun f)
[PROOF STEP]
by (simp add: cfs_closed)


[STATEMENT]
lemma (in design) points_index_subset:
    "x \<subseteq># {#bl \<in># \<B> . ps \<subseteq> bl#} \<Longrightarrow> ps \<subseteq> \<V> \<Longrightarrow> (\<B> index ps) \<ge> (size x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<subseteq># filter_mset ((\<subseteq>) ps) \<B>; ps \<subseteq> \<V>\<rbrakk> \<Longrightarrow> size x \<le> \<B> index ps
[PROOF STEP]
by (simp add: points_index_def size_mset_mono)


[STATEMENT]
lemma three_in_set3:
  assumes "card X \<ge> 3"
  obtains x y z where "x\<in>X" and "y\<in>X" and "z\<in>X" and "x\<noteq>y" and "x\<noteq>z" and "y\<noteq>z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y z. \<lbrakk>x \<in> X; y \<in> X; z \<in> X; x \<noteq> y; x \<noteq> z; y \<noteq> z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
3 \<le> card X

goal (1 subgoal):
 1. (\<And>x y z. \<lbrakk>x \<in> X; y \<in> X; z \<in> X; x \<noteq> y; x \<noteq> z; y \<noteq> z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: card_le_Suc_iff numeral_3_eq_3)


[STATEMENT]
lemma borel_measurable_vimage_halfspace_component_lt:
     "f \<in> borel_measurable (lebesgue_on S) \<longleftrightarrow>
      (\<forall>a i. i \<in> Basis \<longrightarrow> {x \<in> S. f x \<bullet> i < a} \<in> sets (lebesgue_on S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> borel_measurable (lebesgue_on S)) = (\<forall>a i. i \<in> Basis \<longrightarrow> {x \<in> S. f x \<bullet> i < a} \<in> sets (lebesgue_on S))
[PROOF STEP]
apply (rule trans [OF borel_measurable_iff_halfspace_less])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>Basis. \<forall>a. {w \<in> space (lebesgue_on S). f w \<bullet> i < a} \<in> sets (lebesgue_on S)) = (\<forall>a i. i \<in> Basis \<longrightarrow> {x \<in> S. f x \<bullet> i < a} \<in> sets (lebesgue_on S))
[PROOF STEP]
apply (fastforce simp add: space_restrict_space)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fls_integral_linear2:
    "fls_integral (f * fls_const a + g * fls_const b) =
      fls_integral f * fls_const a + fls_integral g * fls_const b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_integral (f * fls_const a + g * fls_const b) = fls_integral f * fls_const a + fls_integral g * fls_const b
[PROOF STEP]
by    (simp add: fls_integral_mult_const_right)


[STATEMENT]
lemma einterval_iff: "x \<in> einterval a b \<longleftrightarrow> a < ereal x \<and> ereal x < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> einterval a b) = (a < ereal x \<and> ereal x < b)
[PROOF STEP]
by (simp add: einterval_def)


[STATEMENT]
lemma "star r x y \<Longrightarrow> star r y z \<Longrightarrow> star r x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>star r x y; star r y z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
proof (induct rule: star_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. star r x z \<Longrightarrow> star r x z
 2. \<And>x y za. \<lbrakk>r x y; star r y za; star r za z \<Longrightarrow> star r y z; star r za z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
print_cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. star r x z \<Longrightarrow> star r x z
 2. \<And>x y za. \<lbrakk>r x y; star r y za; star r za z \<Longrightarrow> star r y z; star r za z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:
star r x_ z

goal (2 subgoals):
 1. \<And>x. star r x z \<Longrightarrow> star r x z
 2. \<And>x y za. \<lbrakk>r x y; star r y za; star r za z \<Longrightarrow> star r y z; star r za z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
star r x_ z
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
star r x_ z

goal (1 subgoal):
 1. star r x_ z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
star r x_ z

goal (1 subgoal):
 1. \<And>x y za. \<lbrakk>r x y; star r y za; star r za z \<Longrightarrow> star r y z; star r za z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y za. \<lbrakk>r x y; star r y za; star r za z \<Longrightarrow> star r y z; star r za z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
case (step a b c)
[PROOF STATE]
proof (state)
this:
r a b
star r b c
star r c z \<Longrightarrow> star r b z
star r c z

goal (1 subgoal):
 1. \<And>x y za. \<lbrakk>r x y; star r y za; star r za z \<Longrightarrow> star r y z; star r za z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
print_facts
[PROOF STATE]
proof (state)
this:
r a b
star r b c
star r c z \<Longrightarrow> star r b z
star r c z

goal (1 subgoal):
 1. \<And>x y za. \<lbrakk>r x y; star r y za; star r za z \<Longrightarrow> star r y z; star r za z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
from step.prems
[PROOF STATE]
proof (chain)
picking this:
star r c z
[PROOF STEP]
have "star r b z"
[PROOF STATE]
proof (prove)
using this:
star r c z

goal (1 subgoal):
 1. star r b z
[PROOF STEP]
by (rule step.IH)
[PROOF STATE]
proof (state)
this:
star r b z

goal (1 subgoal):
 1. \<And>x y za. \<lbrakk>r x y; star r y za; star r za z \<Longrightarrow> star r y z; star r za z\<rbrakk> \<Longrightarrow> star r x z
[PROOF STEP]
with step.r
[PROOF STATE]
proof (chain)
picking this:
r a b
star r b z
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
r a b
star r b z

goal (1 subgoal):
 1. star r a z
[PROOF STEP]
by (rule star.step)
[PROOF STATE]
proof (state)
this:
star r a z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in carrier) compl_open_closed:
  assumes mopen: "m open"
  shows "(carrier - m) closed"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier - m closed
[PROOF STEP]
proof (rule closedI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. carrier - (carrier - m) open
[PROOF STEP]
from mopen
[PROOF STATE]
proof (chain)
picking this:
m open
[PROOF STEP]
have "m \<subseteq> carrier"
[PROOF STATE]
proof (prove)
using this:
m open

goal (1 subgoal):
 1. m \<subseteq> carrier
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m \<subseteq> carrier

goal (1 subgoal):
 1. carrier - (carrier - m) open
[PROOF STEP]
hence "carrier - (carrier - m) = m"
[PROOF STATE]
proof (prove)
using this:
m \<subseteq> carrier

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

goal (1 subgoal):
 1. carrier - (carrier - m) open
[PROOF STEP]
thus "carrier - (carrier - m) open"
[PROOF STATE]
proof (prove)
using this:
carrier - (carrier - m) = m

goal (1 subgoal):
 1. carrier - (carrier - m) open
[PROOF STEP]
using mopen
[PROOF STATE]
proof (prove)
using this:
carrier - (carrier - m) = m
m open

goal (1 subgoal):
 1. carrier - (carrier - m) open
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
carrier - (carrier - m) open

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powreal_less_mono_base:
  assumes r0: "r > 0" and a0: "0 < a" and ab: "a < b"
  shows "a pow\<^sub>\<real> r < b pow\<^sub>\<real> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
have "b/a > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < b / a
[PROOF STEP]
using ab a0
[PROOF STATE]
proof (prove)
using this:
a < b
0 < a

goal (1 subgoal):
 1. 1 < b / a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < b / a

goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < b / a
[PROOF STEP]
have "(b/a) pow\<^sub>\<real> r > 1"
[PROOF STATE]
proof (prove)
using this:
1 < b / a

goal (1 subgoal):
 1. 1 < (b / a) pow\<^sub>\<real> r
[PROOF STEP]
using powreal_gt_one r0
[PROOF STATE]
proof (prove)
using this:
1 < b / a
\<lbrakk>1 < ?a; 0 < ?x\<rbrakk> \<Longrightarrow> 1 < ?a pow\<^sub>\<real> ?x
0 < r

goal (1 subgoal):
 1. 1 < (b / a) pow\<^sub>\<real> r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < (b / a) pow\<^sub>\<real> r

goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < (b / a) pow\<^sub>\<real> r
[PROOF STEP]
have "b pow\<^sub>\<real> r / a pow\<^sub>\<real> r > 1"
[PROOF STATE]
proof (prove)
using this:
1 < (b / a) pow\<^sub>\<real> r

goal (1 subgoal):
 1. 1 < b pow\<^sub>\<real> r / a pow\<^sub>\<real> r
[PROOF STEP]
using ab a0 powreal_divide
[PROOF STATE]
proof (prove)
using this:
1 < (b / a) pow\<^sub>\<real> r
a < b
0 < a
\<lbrakk>0 \<le> ?a; 0 \<le> ?b\<rbrakk> \<Longrightarrow> (?a / ?b) pow\<^sub>\<real> ?x = ?a pow\<^sub>\<real> ?x / ?b pow\<^sub>\<real> ?x

goal (1 subgoal):
 1. 1 < b pow\<^sub>\<real> r / a pow\<^sub>\<real> r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < b pow\<^sub>\<real> r / a pow\<^sub>\<real> r

goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 < b pow\<^sub>\<real> r / a pow\<^sub>\<real> r

goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
have "a pow\<^sub>\<real> r > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a pow\<^sub>\<real> r
[PROOF STEP]
by (simp add: a0 powreal_gt_zero)
[PROOF STATE]
proof (state)
this:
0 < a pow\<^sub>\<real> r

goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 < b pow\<^sub>\<real> r / a pow\<^sub>\<real> r
0 < a pow\<^sub>\<real> r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 < b pow\<^sub>\<real> r / a pow\<^sub>\<real> r
0 < a pow\<^sub>\<real> r

goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
using less_divide_eq_1_pos
[PROOF STATE]
proof (prove)
using this:
1 < b pow\<^sub>\<real> r / a pow\<^sub>\<real> r
0 < a pow\<^sub>\<real> r
(0::?'a) < ?a \<Longrightarrow> ((1::?'a) < ?b / ?a) = (?a < ?b)

goal (1 subgoal):
 1. a pow\<^sub>\<real> r < b pow\<^sub>\<real> r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<real> r < b pow\<^sub>\<real> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma val_nonzero_frac:
  assumes "a \<in> nonzero Q\<^sub>p"
  assumes "b \<in> nonzero Q\<^sub>p"
  assumes "val (a \<div> b) = c"
  shows "val a = val b + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val a = val b + c
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. val a = val b + c
[PROOF STEP]
obtain n where n_def: "c = eint n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. c = eint n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms val_ord
[PROOF STATE]
proof (prove)
using this:
a \<in> nonzero Q\<^sub>p
b \<in> nonzero Q\<^sub>p
val (a \<div> b) = c
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> val ?a = eint (ord ?a)

goal (1 subgoal):
 1. (\<And>n. c = eint n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (no_types, lifting) Qp.integral Qp.nonzero_closed inv_in_frac(1) inv_in_frac(2) val_def)
[PROOF STATE]
proof (state)
this:
c = eint n

goal (1 subgoal):
 1. val a = val b + c
[PROOF STEP]
have 0: "ord (a \<div> b) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord (a \<div> b) = n
[PROOF STEP]
by (metis assms(3) eint.distinct(2) eint.inject n_def val_def)
[PROOF STATE]
proof (state)
this:
ord (a \<div> b) = n

goal (1 subgoal):
 1. val a = val b + c
[PROOF STEP]
have 1: "ord a - ord b = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord a - ord b = n
[PROOF STEP]
using 0 assms
[PROOF STATE]
proof (prove)
using this:
ord (a \<div> b) = n
a \<in> nonzero Q\<^sub>p
b \<in> nonzero Q\<^sub>p
val (a \<div> b) = c

goal (1 subgoal):
 1. ord a - ord b = n
[PROOF STEP]
by (metis ord_fract)
[PROOF STATE]
proof (state)
this:
ord a - ord b = n

goal (1 subgoal):
 1. val a = val b + c
[PROOF STEP]
have 2: "ord a = ord b + n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord a = ord b + n
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
ord a - ord b = n

goal (1 subgoal):
 1. ord a = ord b + n
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
ord a = ord b + n

goal (1 subgoal):
 1. val a = val b + c
[PROOF STEP]
show "val a = val b + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val a = val b + c
[PROOF STEP]
unfolding n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val a = val b + eint n
[PROOF STEP]
using 2 assms
[PROOF STATE]
proof (prove)
using this:
ord a = ord b + n
a \<in> nonzero Q\<^sub>p
b \<in> nonzero Q\<^sub>p
val (a \<div> b) = c

goal (1 subgoal):
 1. val a = val b + eint n
[PROOF STEP]
by (metis Qp.nonzero_memE(1) fract_closed local.fract_cancel_right n_def val_mult)
[PROOF STATE]
proof (state)
this:
val a = val b + c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_nth_Lambert_W: "fps_nth fps_Lambert_W n = (if n = 0 then 0 else ((-n)^(n-1) / fact n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_Lambert_W $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_Lambert_W $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
define F :: "real fps" where "F = fps_X * fps_exp 1"
[PROOF STATE]
proof (state)
this:
F = fps_X * fps_exp 1

goal (1 subgoal):
 1. fps_Lambert_W $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have fps_nth_eq: "fps_nth F n = 1 / fact (n - 1)" if "n > 0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F $ n = 1 / fact (n - 1)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. F $ n = 1 / fact (n - 1)
[PROOF STEP]
unfolding F_def
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (fps_X * fps_exp 1) $ n = 1 / fact (n - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < ?n \<Longrightarrow> F $ ?n = 1 / fact (?n - 1)

goal (1 subgoal):
 1. fps_Lambert_W $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have F_power: "F ^ n = fps_X ^ n * fps_exp (of_nat n)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F ^ n = fps_X ^ n * fps_exp (real n)
[PROOF STEP]
by (simp add: F_def power_mult_distrib fps_exp_power_mult)
[PROOF STATE]
proof (state)
this:
F ^ ?n = fps_X ^ ?n * fps_exp (real ?n)

goal (1 subgoal):
 1. fps_Lambert_W $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have "fps_nth (fps_inv F) n = (if n = 0 then 0 else ((-n)^(n-1) / fact n))" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
proof (induction n rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> fps_inv F $ y = (if y = 0 then 0 else (- real y) ^ (y - 1) / fact y)) \<Longrightarrow> fps_inv F $ x = (if x = 0 then 0 else (- real x) ^ (x - 1) / fact x)
[PROOF STEP]
case (less n)
[PROOF STATE]
proof (state)
this:
?y < n \<Longrightarrow> fps_inv F $ ?y = (if ?y = 0 then 0 else (- real ?y) ^ (?y - 1) / fact ?y)

goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> fps_inv F $ y = (if y = 0 then 0 else (- real y) ^ (y - 1) / fact y)) \<Longrightarrow> fps_inv F $ x = (if x = 0 then 0 else (- real x) ^ (x - 1) / fact x)
[PROOF STEP]
consider "n = 0" | "n = 1" | "n > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n = 0 \<Longrightarrow> thesis; n = 1 \<Longrightarrow> thesis; 1 < n \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = 0 \<Longrightarrow> ?thesis; n = 1 \<Longrightarrow> ?thesis; 1 < n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> fps_inv F $ y = (if y = 0 then 0 else (- real y) ^ (y - 1) / fact y)) \<Longrightarrow> fps_inv F $ x = (if x = 0 then 0 else (- real x) ^ (x - 1) / fact x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = 0 \<Longrightarrow> ?thesis; n = 1 \<Longrightarrow> ?thesis; 1 < n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
case 3
[PROOF STATE]
proof (state)
this:
1 < n

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
hence "fps_nth (fps_inv F) n = -(\<Sum>i=0..n-1. fps_nth (fps_inv F) i * fps_nth (F ^ i) n)"
        (is "_ = -?S")
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. fps_inv F $ n = - (\<Sum>i = 0..n - 1. fps_inv F $ i * F ^ i $ n)
[PROOF STEP]
by (cases n) (auto simp: fps_inv_def F_def)
[PROOF STATE]
proof (state)
this:
fps_inv F $ n = - (\<Sum>i = 0..n - 1. fps_inv F $ i * F ^ i $ n)

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_inv F $ n = - (\<Sum>i = 0..n - 1. fps_inv F $ i * F ^ i $ n)

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have "?S = (\<Sum>i=1..<n. fps_nth (fps_inv F) i * fps_nth (F ^ i) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n - 1. fps_inv F $ i * F ^ i $ n) = (\<Sum>i = 1..<n. fps_inv F $ i * F ^ i $ n)
[PROOF STEP]
using less[of 1] 3
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> fps_inv F $ 1 = (if 1 = 0 then 0 else (- real 1) ^ (1 - 1) / fact 1)
1 < n

goal (1 subgoal):
 1. (\<Sum>i = 0..n - 1. fps_inv F $ i * F ^ i $ n) = (\<Sum>i = 1..<n. fps_inv F $ i * F ^ i $ n)
[PROOF STEP]
by (intro sum.mono_neutral_right) (auto simp: not_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n - 1. fps_inv F $ i * F ^ i $ n) = (\<Sum>i = 1..<n. fps_inv F $ i * F ^ i $ n)

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n - 1. fps_inv F $ i * F ^ i $ n) = (\<Sum>i = 1..<n. fps_inv F $ i * F ^ i $ n)

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have "\<dots> = (-1) ^ (n+1) / fact n *
                        (\<Sum>i=1..<n. ((-1)^(n - i) * real (n choose i) * real i ^ (n - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 1..<n. fps_inv F $ i * F ^ i $ n) = (- 1) ^ (n + 1) / fact n * (\<Sum>i = 1..<n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))
[PROOF STEP]
unfolding sum_divide_distrib sum_distrib_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 1..<n. fps_inv F $ i * F ^ i $ n) = (\<Sum>n = 1..<n. (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - n) * real (n choose n) * real n ^ (n - 1)))
[PROOF STEP]
proof (intro sum.cong, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
case (2 i)
[PROOF STATE]
proof (state)
this:
i \<in> {1..<n}

goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
hence "fps_nth (fps_inv F) i * fps_nth (F ^ i) n =
                 (-1) ^ (i - 1) * real (i ^ (i - 1) * i ^ (n - i)) *
                 (fact n / (fact i * fact (n - i)) / fact n)"
[PROOF STATE]
proof (prove)
using this:
i \<in> {1..<n}

goal (1 subgoal):
 1. fps_inv F $ i * F ^ i $ n = (- 1) ^ (i - 1) * real (i ^ (i - 1) * i ^ (n - i)) * (fact n / (fact i * fact (n - i)) / fact n)
[PROOF STEP]
using less.IH[of i]
[PROOF STATE]
proof (prove)
using this:
i \<in> {1..<n}
i < n \<Longrightarrow> fps_inv F $ i = (if i = 0 then 0 else (- real i) ^ (i - 1) / fact i)

goal (1 subgoal):
 1. fps_inv F $ i * F ^ i $ n = (- 1) ^ (i - 1) * real (i ^ (i - 1) * i ^ (n - i)) * (fact n / (fact i * fact (n - i)) / fact n)
[PROOF STEP]
by (simp add: F_power less fps_X_power_mult_nth power_minus')
[PROOF STATE]
proof (state)
this:
fps_inv F $ i * F ^ i $ n = (- 1) ^ (i - 1) * real (i ^ (i - 1) * i ^ (n - i)) * (fact n / (fact i * fact (n - i)) / fact n)

goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_inv F $ i * F ^ i $ n = (- 1) ^ (i - 1) * real (i ^ (i - 1) * i ^ (n - i)) * (fact n / (fact i * fact (n - i)) / fact n)

goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
have "(fact n / (fact i * fact (n - i))) = real (n choose i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact n / (fact i * fact (n - i)) = real (n choose i)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
i \<in> {1..<n}

goal (1 subgoal):
 1. fact n / (fact i * fact (n - i)) = real (n choose i)
[PROOF STEP]
by (subst binomial_fact) auto
[PROOF STATE]
proof (state)
this:
fact n / (fact i * fact (n - i)) = real (n choose i)

goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact n / (fact i * fact (n - i)) = real (n choose i)

goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
have "i ^ (i - 1) * i ^ (n - i) = i ^ (n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i ^ (i - 1) * i ^ (n - i) = i ^ (n - 1)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
i \<in> {1..<n}

goal (1 subgoal):
 1. i ^ (i - 1) * i ^ (n - i) = i ^ (n - 1)
[PROOF STEP]
by (subst power_add [symmetric]) auto
[PROOF STATE]
proof (state)
this:
i ^ (i - 1) * i ^ (n - i) = i ^ (n - 1)

goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
i ^ (i - 1) * i ^ (n - i) = i ^ (n - 1)

goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
have "(-1) ^ (i - 1) = ((-1) ^ (n+1) * (-1)^(n-i) :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ (i - 1) = (- 1) ^ (n + 1) * (- 1) ^ (n - i)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
i \<in> {1..<n}

goal (1 subgoal):
 1. (- 1) ^ (i - 1) = (- 1) ^ (n + 1) * (- 1) ^ (n - i)
[PROOF STEP]
by (subst power_add [symmetric]) (auto simp: minus_one_power_iff)
[PROOF STATE]
proof (state)
this:
(- 1) ^ (i - 1) = (- 1) ^ (n + 1) * (- 1) ^ (n - i)

goal (2 subgoals):
 1. {1..<n} = {1..<n}
 2. \<And>x. x \<in> {1..<n} \<Longrightarrow> fps_inv F $ x * F ^ x $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - x) * real (n choose x) * real x ^ (n - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_inv F $ i * F ^ i $ n = (- 1) ^ (n + 1) * (- 1) ^ (n - i) * real (i ^ (n - 1)) * (real (n choose i) / fact n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
fps_inv F $ i * F ^ i $ n = (- 1) ^ (n + 1) * (- 1) ^ (n - i) * real (i ^ (n - 1)) * (real (n choose i) / fact n)

goal (1 subgoal):
 1. fps_inv F $ i * F ^ i $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_inv F $ i * F ^ i $ n = (- 1) ^ (n + 1) / fact n * ((- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))

goal (1 subgoal):
 1. {1..<n} = {1..<n}
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..<n. fps_inv F $ i * F ^ i $ n) = (- 1) ^ (n + 1) / fact n * (\<Sum>i = 1..<n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..<n. fps_inv F $ i * F ^ i $ n) = (- 1) ^ (n + 1) / fact n * (\<Sum>i = 1..<n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have "(\<Sum>i=1..<n. ((-1)^(n - i) * real (n choose i) * real i ^ (n - 1))) =
                 (\<Sum>i\<in>{..n}-{n}. ((-1)^(n - i) * real (n choose i) * real i ^ (n - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 1..<n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = (\<Sum>i\<in>{..n} - {n}. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. (\<Sum>i = 1..<n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = (\<Sum>i\<in>{..n} - {n}. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))
[PROOF STEP]
by (intro sum.mono_neutral_left) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..<n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = (\<Sum>i\<in>{..n} - {n}. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..<n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = (\<Sum>i\<in>{..n} - {n}. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1))

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>n. ((-1)^(n - i) * real (n choose i) * real i ^ (n - 1))) -
                      real n ^ (n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{..n} - {n}. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = (\<Sum>i\<le>n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) - real n ^ (n - 1)
[PROOF STEP]
by (subst (2) sum.remove[of _ n]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{..n} - {n}. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = (\<Sum>i\<le>n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) - real n ^ (n - 1)

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{..n} - {n}. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = (\<Sum>i\<le>n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) - real n ^ (n - 1)

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have "(\<Sum>i\<le>n. ((-1)^(n - i) * real (n choose i) * real i ^ (n - 1))) =
                   real (Stirling (n - 1) n) * fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = real (Stirling (n - 1) n) * fact n
[PROOF STEP]
by (subst Stirling_closed_form) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = real (Stirling (n - 1) n) * fact n

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. (- 1) ^ (n - i) * real (n choose i) * real i ^ (n - 1)) = real (Stirling (n - 1) n) * fact n

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have "Stirling (n - 1) n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stirling (n - 1) n = 0
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. Stirling (n - 1) n = 0
[PROOF STEP]
by (subst Stirling_less) auto
[PROOF STATE]
proof (state)
this:
Stirling (n - 1) n = 0

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_inv F $ n = - ((- 1) ^ (n + 1) / fact n * (real 0 * fact n - real n ^ (n - 1)))
[PROOF STEP]
have "fps_nth (fps_inv F) n = -((-1) ^ n * real n ^ (n - 1) / fact n)"
[PROOF STATE]
proof (prove)
using this:
fps_inv F $ n = - ((- 1) ^ (n + 1) / fact n * (real 0 * fact n - real n ^ (n - 1)))

goal (1 subgoal):
 1. fps_inv F $ n = - ((- 1) ^ n * real n ^ (n - 1) / fact n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_inv F $ n = - ((- 1) ^ n * real n ^ (n - 1) / fact n)

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_inv F $ n = - ((- 1) ^ n * real n ^ (n - 1) / fact n)

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
have "\<dots> = (-real n) ^ (n - 1) / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ((- 1) ^ n * real n ^ (n - 1) / fact n) = (- real n) ^ (n - 1) / fact n
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. - ((- 1) ^ n * real n ^ (n - 1) / fact n) = (- real n) ^ (n - 1) / fact n
[PROOF STEP]
by (subst power_minus) (auto simp: minus_one_power_iff)
[PROOF STATE]
proof (state)
this:
- ((- 1) ^ n * real n ^ (n - 1) / fact n) = (- real n) ^ (n - 1) / fact n

goal (3 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 3. 1 < n \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_inv F $ n = (- real n) ^ (n - 1) / fact n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_inv F $ n = (- real n) ^ (n - 1) / fact n

goal (1 subgoal):
 1. fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
fps_inv F $ n = (- real n) ^ (n - 1) / fact n
1 < n

goal (1 subgoal):
 1. fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
 2. n = 1 \<Longrightarrow> fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
qed (auto simp: fps_inv_def F_def)
[PROOF STATE]
proof (state)
this:
fps_inv F $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fps_inv F $ ?n = (if ?n = 0 then 0 else (- real ?n) ^ (?n - 1) / fact ?n)

goal (1 subgoal):
 1. fps_Lambert_W $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_inv F $ ?n = (if ?n = 0 then 0 else (- real ?n) ^ (?n - 1) / fact ?n)

goal (1 subgoal):
 1. fps_Lambert_W $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
by (simp add: F_def fps_Lambert_W_def)
[PROOF STATE]
proof (state)
this:
fps_Lambert_W $ n = (if n = 0 then 0 else (- real n) ^ (n - 1) / fact n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma omax_isOmax:
assumes "finite R" and "R \<noteq> {}" and "\<forall> r \<in> R. Well_order r"
shows "isOmax R (omax R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isOmax R (omax R)
[PROOF STEP]
unfolding omax_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isOmax R (SOME r. isOmax R r)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite R
R \<noteq> {}
\<forall>r\<in>R. Well_order r

goal (1 subgoal):
 1. isOmax R (SOME r. isOmax R r)
[PROOF STEP]
by(simp add: exists_isOmax someI_ex)


[STATEMENT]
lemma ccspan_some_chilbert_basis[simp]: \<open>ccspan some_chilbert_basis = top\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan some_chilbert_basis = top
[PROOF STEP]
using is_onb_def is_onb_some_chilbert_basis
[PROOF STATE]
proof (prove)
using this:
is_onb ?E = (is_ortho_set ?E \<and> (\<forall>b\<in>?E. norm b = 1) \<and> ccspan ?E = top)
is_onb some_chilbert_basis

goal (1 subgoal):
 1. ccspan some_chilbert_basis = top
[PROOF STEP]
by blast


[STATEMENT]
theorem free_group_is_group: "group \<F>\<^bsub>gens\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 3. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 5. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 6. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 3. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 5. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 6. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
assume "x \<in> carrier \<F>\<^bsub>gens\<^esub>"
[PROOF STATE]
proof (state)
this:
x \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (6 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 3. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 5. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 6. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
hence x: "x \<in> lists (UNIV \<times> gens)"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (1 subgoal):
 1. x \<in> lists (UNIV \<times> gens)
[PROOF STEP]
by
    (rule occuring_gens_in_element)
[PROOF STATE]
proof (state)
this:
x \<in> lists (UNIV \<times> gens)

goal (6 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 3. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 5. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 6. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
assume "y \<in> carrier \<F>\<^bsub>gens\<^esub>"
[PROOF STATE]
proof (state)
this:
y \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (6 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 3. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 5. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 6. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
hence y: "y \<in> lists (UNIV \<times> gens)"
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (1 subgoal):
 1. y \<in> lists (UNIV \<times> gens)
[PROOF STEP]
by
    (rule occuring_gens_in_element)
[PROOF STATE]
proof (state)
this:
y \<in> lists (UNIV \<times> gens)

goal (6 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 3. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 5. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 6. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
from x and y
[PROOF STATE]
proof (chain)
picking this:
x \<in> lists (UNIV \<times> gens)
y \<in> lists (UNIV \<times> gens)
[PROOF STEP]
have "x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> lists (UNIV \<times> gens)"
[PROOF STATE]
proof (prove)
using this:
x \<in> lists (UNIV \<times> gens)
y \<in> lists (UNIV \<times> gens)

goal (1 subgoal):
 1. x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> lists (UNIV \<times> gens)
[PROOF STEP]
by (auto intro!: normalize_preserves_generators simp add:free_group_def append_in_lists_conv)
[PROOF STATE]
proof (state)
this:
x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> lists (UNIV \<times> gens)

goal (6 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 3. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 5. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 6. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
thus "x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>"
[PROOF STATE]
proof (prove)
using this:
x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> lists (UNIV \<times> gens)

goal (1 subgoal):
 1. x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
by (auto simp add:free_group_def)
[PROOF STATE]
proof (state)
this:
x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
fix x y z
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
have "cancels_to (x @ y) (normalize (x @ (y::'a word_g_i)))"
   and "cancels_to z (z::'a word_g_i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cancels_to (x @ y) (Cancelation.normalize (x @ y)) &&& cancels_to z z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cancels_to (x @ y) (Cancelation.normalize (x @ y))
cancels_to z z

goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
hence "normalize (normalize (x @ y) @ z) = normalize ((x @ y) @ z)"
[PROOF STATE]
proof (prove)
using this:
cancels_to (x @ y) (Cancelation.normalize (x @ y))
cancels_to z z

goal (1 subgoal):
 1. Cancelation.normalize (Cancelation.normalize (x @ y) @ z) = Cancelation.normalize ((x @ y) @ z)
[PROOF STEP]
by (rule normalize_append_cancel_to[THEN sym])
[PROOF STATE]
proof (state)
this:
Cancelation.normalize (Cancelation.normalize (x @ y) @ z) = Cancelation.normalize ((x @ y) @ z)

goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Cancelation.normalize (Cancelation.normalize (x @ y) @ z) = Cancelation.normalize ((x @ y) @ z)

goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
have "\<dots> = normalize (x @ (y @ z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cancelation.normalize ((x @ y) @ z) = Cancelation.normalize (x @ y @ z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Cancelation.normalize ((x @ y) @ z) = Cancelation.normalize (x @ y @ z)

goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Cancelation.normalize ((x @ y) @ z) = Cancelation.normalize (x @ y @ z)

goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
have "cancels_to (y @ z) (normalize (y @ (z::'a word_g_i)))"
   and "cancels_to x (x::'a word_g_i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cancels_to (y @ z) (Cancelation.normalize (y @ z)) &&& cancels_to x x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cancels_to (y @ z) (Cancelation.normalize (y @ z))
cancels_to x x

goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
hence "normalize (x @ (y @ z)) = normalize (x @ normalize (y @ z))"
[PROOF STATE]
proof (prove)
using this:
cancels_to (y @ z) (Cancelation.normalize (y @ z))
cancels_to x x

goal (1 subgoal):
 1. Cancelation.normalize (x @ y @ z) = Cancelation.normalize (x @ Cancelation.normalize (y @ z))
[PROOF STEP]
by -(rule normalize_append_cancel_to)
[PROOF STATE]
proof (state)
this:
Cancelation.normalize (x @ y @ z) = Cancelation.normalize (x @ Cancelation.normalize (y @ z))

goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier \<F>\<^bsub>gens\<^esub>; y \<in> carrier \<F>\<^bsub>gens\<^esub>; z \<in> carrier \<F>\<^bsub>gens\<^esub>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
 2. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 4. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 5. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Cancelation.normalize (Cancelation.normalize (x @ y) @ z) = Cancelation.normalize (x @ Cancelation.normalize (y @ z))
[PROOF STEP]
show "x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z =
        x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)"
[PROOF STATE]
proof (prove)
using this:
Cancelation.normalize (Cancelation.normalize (x @ y) @ z) = Cancelation.normalize (x @ Cancelation.normalize (y @ z))

goal (1 subgoal):
 1. x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)
[PROOF STEP]
by (auto simp add:free_group_def)
[PROOF STATE]
proof (state)
this:
x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z = x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> (y \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> z)

goal (4 subgoals):
 1. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 4. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
 2. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 3. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 4. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
show "\<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
by (auto simp add:free_group_def)
[PROOF STATE]
proof (state)
this:
\<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (3 subgoals):
 1. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 2. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 3. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 2. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 3. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 2. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 3. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
assume "x \<in> carrier \<F>\<^bsub>gens\<^esub>"
[PROOF STATE]
proof (state)
this:
x \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (3 subgoals):
 1. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
 2. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 3. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
thus "\<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (1 subgoal):
 1. \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x
[PROOF STEP]
by (auto simp add:free_group_def)
[PROOF STATE]
proof (state)
this:
\<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> x = x

goal (2 subgoals):
 1. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 2. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 2. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 2. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
assume "x \<in> carrier \<F>\<^bsub>gens\<^esub>"
[PROOF STATE]
proof (state)
this:
x \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (2 subgoals):
 1. \<And>x. x \<in> carrier \<F>\<^bsub>gens\<^esub> \<Longrightarrow> x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
 2. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
thus "x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier \<F>\<^bsub>gens\<^esub>

goal (1 subgoal):
 1. x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x
[PROOF STEP]
by (auto simp add:free_group_def)
[PROOF STATE]
proof (state)
this:
x \<otimes>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> \<one>\<^bsub>\<F>\<^bsub>gens\<^esub>\<^esub> = x

goal (1 subgoal):
 1. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
show "carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>
[PROOF STEP]
proof (simp add:free_group_def Units_def, rule subsetI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {l \<in> lists (UNIV \<times> gens). canceled l} \<Longrightarrow> x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
fix x :: "'a word_g_i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {l \<in> lists (UNIV \<times> gens). canceled l} \<Longrightarrow> x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
let ?x' = "inv_fg x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {l \<in> lists (UNIV \<times> gens). canceled l} \<Longrightarrow> x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
assume "x \<in> {y\<in>lists(UNIV\<times>gens). canceled y}"
[PROOF STATE]
proof (state)
this:
x \<in> {y \<in> lists (UNIV \<times> gens). canceled y}

goal (1 subgoal):
 1. \<And>x. x \<in> {l \<in> lists (UNIV \<times> gens). canceled l} \<Longrightarrow> x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
hence "?x' \<in> lists(UNIV\<times>gens) \<and> canceled ?x'"
[PROOF STATE]
proof (prove)
using this:
x \<in> {y \<in> lists (UNIV \<times> gens). canceled y}

goal (1 subgoal):
 1. inv_fg x \<in> lists (UNIV \<times> gens) \<and> canceled (inv_fg x)
[PROOF STEP]
by (auto elim:inv_fg_closure1 simp add:inv_fg_closure2)
[PROOF STATE]
proof (state)
this:
inv_fg x \<in> lists (UNIV \<times> gens) \<and> canceled (inv_fg x)

goal (1 subgoal):
 1. \<And>x. x \<in> {l \<in> lists (UNIV \<times> gens). canceled l} \<Longrightarrow> x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inv_fg x \<in> lists (UNIV \<times> gens) \<and> canceled (inv_fg x)

goal (1 subgoal):
 1. \<And>x. x \<in> {l \<in> lists (UNIV \<times> gens). canceled l} \<Longrightarrow> x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
have "normalize (?x' @ x) = []"
     and "normalize (x @ ?x') = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cancelation.normalize (inv_fg x @ x) = [] &&& Cancelation.normalize (x @ inv_fg x) = []
[PROOF STEP]
by (auto simp add:inv_fg_cancel inv_fg_cancel2)
[PROOF STATE]
proof (state)
this:
Cancelation.normalize (inv_fg x @ x) = []
Cancelation.normalize (x @ inv_fg x) = []

goal (1 subgoal):
 1. \<And>x. x \<in> {l \<in> lists (UNIV \<times> gens). canceled l} \<Longrightarrow> x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inv_fg x \<in> lists (UNIV \<times> gens) \<and> canceled (inv_fg x)
Cancelation.normalize (inv_fg x @ x) = []
Cancelation.normalize (x @ inv_fg x) = []
[PROOF STEP]
have "\<exists>y. y \<in> lists (UNIV \<times> gens) \<and>
                  canceled y \<and>
                  normalize (y @ x) = [] \<and> normalize (x @ y) = []"
[PROOF STATE]
proof (prove)
using this:
inv_fg x \<in> lists (UNIV \<times> gens) \<and> canceled (inv_fg x)
Cancelation.normalize (inv_fg x @ x) = []
Cancelation.normalize (x @ inv_fg x) = []

goal (1 subgoal):
 1. \<exists>y. y \<in> lists (UNIV \<times> gens) \<and> canceled y \<and> Cancelation.normalize (y @ x) = [] \<and> Cancelation.normalize (x @ y) = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>y. y \<in> lists (UNIV \<times> gens) \<and> canceled y \<and> Cancelation.normalize (y @ x) = [] \<and> Cancelation.normalize (x @ y) = []

goal (1 subgoal):
 1. \<And>x. x \<in> {l \<in> lists (UNIV \<times> gens). canceled l} \<Longrightarrow> x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
with \<open>x \<in> {y\<in>lists(UNIV\<times>gens). canceled y}\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> {y \<in> lists (UNIV \<times> gens). canceled y}
\<exists>y. y \<in> lists (UNIV \<times> gens) \<and> canceled y \<and> Cancelation.normalize (y @ x) = [] \<and> Cancelation.normalize (x @ y) = []
[PROOF STEP]
show "x \<in> {y \<in> lists (UNIV \<times> gens).  canceled y  \<and>
          (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and>
                  canceled x \<and>
                  normalize (x @ y) = [] \<and> normalize (y @ x) = [])}"
[PROOF STATE]
proof (prove)
using this:
x \<in> {y \<in> lists (UNIV \<times> gens). canceled y}
\<exists>y. y \<in> lists (UNIV \<times> gens) \<and> canceled y \<and> Cancelation.normalize (y @ x) = [] \<and> Cancelation.normalize (x @ y) = []

goal (1 subgoal):
 1. x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {y \<in> lists (UNIV \<times> gens). canceled y \<and> (\<exists>x. x \<in> lists (UNIV \<times> gens) \<and> canceled x \<and> Cancelation.normalize (x @ y) = [] \<and> Cancelation.normalize (y @ x) = [])}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
carrier \<F>\<^bsub>gens\<^esub> \<subseteq> Units \<F>\<^bsub>gens\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nonEqualitySetOfSets:
  assumes "X \<noteq> Y"
  shows "{{x}| x. x \<in> X} \<noteq> {{x}| x. x \<in> Y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {{x} |x. x \<in> X} \<noteq> {{x} |x. x \<in> Y}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
X \<noteq> Y

goal (1 subgoal):
 1. {{x} |x. x \<in> X} \<noteq> {{x} |x. x \<in> Y}
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_mult_nth: "(f * g) $ n = (\<Sum>i=0..n. f$i * g$(n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f * g) $ n = (\<Sum>i = 0..n. f $ i * g $ (n - i))
[PROOF STEP]
unfolding fps_times_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_fps (\<lambda>n. \<Sum>i = 0..n. f $ i * g $ (n - i)) $ n = (\<Sum>i = 0..n. f $ i * g $ (n - i))
[PROOF STEP]
by simp


[STATEMENT]
lemma hcomplex_hcnj_zero [simp]: "hcnj 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hcnj 0 = 0
[PROOF STEP]
by transfer (rule complex_cnj_zero)