[STATEMENT]
lemma lincomb_linear_image:
assumes inj_T: "inj_on T (carrier V)"
assumes A_in_V: "A \<subseteq> carrier V" and a: "a \<in> (T`A) \<rightarrow> carrier K"
assumes f: "finite A"
shows "W.module.lincomb a (T`A) = T (V.module.lincomb (a \<circ> T) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W.module.lincomb a (T ` A) = T (V.module.lincomb (a \<circ> T) A)
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. W.module.lincomb a (T ` A) = T (V.module.lincomb (a \<circ> T) A)
[PROOF STEP]
using A_in_V a
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> T ` A \<rightarrow> carrier K

goal (1 subgoal):
 1. W.module.lincomb a (T ` A) = T (V.module.lincomb (a \<circ> T) A)
[PROOF STEP]
proof (induct A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>{} \<subseteq> carrier V; a \<in> T ` {} \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` {}) = T (V.module.lincomb (a \<circ> T) {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
{} \<subseteq> carrier V
a \<in> T ` {} \<rightarrow> carrier K

goal (2 subgoals):
 1. \<lbrakk>{} \<subseteq> carrier V; a \<in> T ` {} \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` {}) = T (V.module.lincomb (a \<circ> T) {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> carrier V
a \<in> T ` {} \<rightarrow> carrier K

goal (1 subgoal):
 1. W.module.lincomb a (T ` {}) = T (V.module.lincomb (a \<circ> T) {})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
W.module.lincomb a (T ` {}) = T (V.module.lincomb (a \<circ> T) {})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
case (insert x A)
[PROOF STATE]
proof (state)
this:
finite A
x \<notin> A
\<lbrakk>A \<subseteq> carrier V; a \<in> T ` A \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` A) = T (V.module.lincomb (a \<circ> T) A)
insert x A \<subseteq> carrier V
a \<in> T ` insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
have T_insert_rw: "T ` insert x A = insert (T x) (T` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T ` insert x A = insert (T x) (T ` A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
T ` insert x A = insert (T x) (T ` A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
have "W.module.lincomb a (T ` insert x A) = W.module.lincomb a (insert (T x) (T` A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W.module.lincomb a (T ` insert x A) = W.module.lincomb a (insert (T x) (T ` A))
[PROOF STEP]
unfolding T_insert_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W.module.lincomb a (insert (T x) (T ` A)) = W.module.lincomb a (insert (T x) (T ` A))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
W.module.lincomb a (T ` insert x A) = W.module.lincomb a (insert (T x) (T ` A))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
W.module.lincomb a (T ` insert x A) = W.module.lincomb a (insert (T x) (T ` A))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
have "... =  a (T x) \<odot>\<^bsub>W\<^esub> (T x) \<oplus>\<^bsub>W\<^esub> W.module.lincomb a (T` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W.module.lincomb a (insert (T x) (T ` A)) = a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> W.module.lincomb a (T ` A)
[PROOF STEP]
proof (rule W.lincomb_insert2)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. finite (T ` A)
 2. T ` A \<subseteq> carrier W
 3. a \<in> insert (T x) (T ` A) \<rightarrow> carrier K
 4. T x \<notin> T ` A
 5. T x \<in> carrier W
[PROOF STEP]
show "finite (T ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (T ` A)
[PROOF STEP]
by (simp add: insert.hyps(1))
[PROOF STATE]
proof (state)
this:
finite (T ` A)

goal (4 subgoals):
 1. T ` A \<subseteq> carrier W
 2. a \<in> insert (T x) (T ` A) \<rightarrow> carrier K
 3. T x \<notin> T ` A
 4. T x \<in> carrier W
[PROOF STEP]
show "T ` A \<subseteq> carrier W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T ` A \<subseteq> carrier W
[PROOF STEP]
using insert.prems(1)
[PROOF STATE]
proof (prove)
using this:
insert x A \<subseteq> carrier V

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

goal (3 subgoals):
 1. a \<in> insert (T x) (T ` A) \<rightarrow> carrier K
 2. T x \<notin> T ` A
 3. T x \<in> carrier W
[PROOF STEP]
show "a \<in> insert (T x) (T ` A) \<rightarrow> carrier K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> insert (T x) (T ` A) \<rightarrow> carrier K
[PROOF STEP]
using insert.prems(2)
[PROOF STATE]
proof (prove)
using this:
a \<in> T ` insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. a \<in> insert (T x) (T ` A) \<rightarrow> carrier K
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> insert (T x) (T ` A) \<rightarrow> carrier K

goal (2 subgoals):
 1. T x \<notin> T ` A
 2. T x \<in> carrier W
[PROOF STEP]
show "T x \<notin> T ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T x \<notin> T ` A
[PROOF STEP]
by (meson inj_T inj_on_image_mem_iff insert.hyps(2) insert.prems(1) insert_subset)
[PROOF STATE]
proof (state)
this:
T x \<notin> T ` A

goal (1 subgoal):
 1. T x \<in> carrier W
[PROOF STEP]
show "T x \<in> carrier W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T x \<in> carrier W
[PROOF STEP]
using insert.prems(1)
[PROOF STATE]
proof (prove)
using this:
insert x A \<subseteq> carrier V

goal (1 subgoal):
 1. T x \<in> carrier W
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
T x \<in> carrier W

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
W.module.lincomb a (insert (T x) (T ` A)) = a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> W.module.lincomb a (T ` A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
W.module.lincomb a (insert (T x) (T ` A)) = a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> W.module.lincomb a (T ` A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
have "... = a (T x) \<odot>\<^bsub>W\<^esub> (T x) \<oplus>\<^bsub>W\<^esub> (T (V.module.lincomb (a \<circ> T) A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> W.module.lincomb a (T ` A) = a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A)
[PROOF STEP]
using insert.hyps(3) insert.prems(1) insert.prems(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<subseteq> carrier V; a \<in> T ` A \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` A) = T (V.module.lincomb (a \<circ> T) A)
insert x A \<subseteq> carrier V
a \<in> T ` insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> W.module.lincomb a (T ` A) = a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> W.module.lincomb a (T ` A) = a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> W.module.lincomb a (T ` A) = a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
have "... = T (a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>W\<^esub> (T (V.module.lincomb (a \<circ> T) A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A) = T (a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A)
[PROOF STEP]
using insert.prems(1) insert.prems(2)
[PROOF STATE]
proof (prove)
using this:
insert x A \<subseteq> carrier V
a \<in> T ` insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A) = T (a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A) = T (a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a (T x) \<odot>\<^bsub>W\<^esub> T x \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A) = T (a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
have "... = T ((a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>V\<^esub> (V.module.lincomb (a \<circ> T) A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T (a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A) = T (a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A)
[PROOF STEP]
proof (rule T_add[symmetric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a (T x) \<odot>\<^bsub>V\<^esub> x \<in> carrier V
 2. V.module.lincomb (a \<circ> T) A \<in> carrier V
[PROOF STEP]
show "a (T x) \<odot>\<^bsub>V\<^esub> x \<in> carrier V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>V\<^esub> x \<in> carrier V
[PROOF STEP]
using insert.prems(1) insert.prems(2)
[PROOF STATE]
proof (prove)
using this:
insert x A \<subseteq> carrier V
a \<in> T ` insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>V\<^esub> x \<in> carrier V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a (T x) \<odot>\<^bsub>V\<^esub> x \<in> carrier V

goal (1 subgoal):
 1. V.module.lincomb (a \<circ> T) A \<in> carrier V
[PROOF STEP]
show "V.module.lincomb (a \<circ> T) A \<in> carrier V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V.module.lincomb (a \<circ> T) A \<in> carrier V
[PROOF STEP]
proof (rule V.module.lincomb_closed)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A \<subseteq> carrier V
 2. a \<circ> T \<in> A \<rightarrow> carrier K
[PROOF STEP]
show "A \<subseteq> carrier V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> carrier V
[PROOF STEP]
using insert.prems(1)
[PROOF STATE]
proof (prove)
using this:
insert x A \<subseteq> carrier V

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

goal (1 subgoal):
 1. a \<circ> T \<in> A \<rightarrow> carrier K
[PROOF STEP]
show "a \<circ> T \<in> A \<rightarrow> carrier K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<circ> T \<in> A \<rightarrow> carrier K
[PROOF STEP]
using coeff_in_ring insert.prems(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> ?A \<rightarrow> carrier K; ?x \<in> ?A\<rbrakk> \<Longrightarrow> ?a ?x \<in> carrier K
a \<in> T ` insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. a \<circ> T \<in> A \<rightarrow> carrier K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<circ> T \<in> A \<rightarrow> carrier K

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
V.module.lincomb (a \<circ> T) A \<in> carrier V

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
T (a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A) = T (a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
T (a (T x) \<odot>\<^bsub>V\<^esub> x) \<oplus>\<^bsub>W\<^esub> T (V.module.lincomb (a \<circ> T) A) = T (a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
have "... = T (V.module.lincomb (a \<circ> T) (insert x A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T (a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A) = T (V.module.lincomb (a \<circ> T) (insert x A))
[PROOF STEP]
proof (rule arg_cong[of _ _ T])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A = V.module.lincomb (a \<circ> T) (insert x A)
[PROOF STEP]
have "a \<circ> T \<in> insert x A \<rightarrow> carrier K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<circ> T \<in> insert x A \<rightarrow> carrier K
[PROOF STEP]
using comp_def insert.prems(2)
[PROOF STATE]
proof (prove)
using this:
?f \<circ> ?g = (\<lambda>x. ?f (?g x))
a \<in> T ` insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. a \<circ> T \<in> insert x A \<rightarrow> carrier K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<circ> T \<in> insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A = V.module.lincomb (a \<circ> T) (insert x A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<circ> T \<in> insert x A \<rightarrow> carrier K
[PROOF STEP]
show "a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A
      = V.module.lincomb (a \<circ> T) (insert x A)"
[PROOF STATE]
proof (prove)
using this:
a \<circ> T \<in> insert x A \<rightarrow> carrier K

goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A = V.module.lincomb (a \<circ> T) (insert x A)
[PROOF STEP]
using V.lincomb_insert2 insert.hyps(1) insert.hyps(2) insert.prems(1)
[PROOF STATE]
proof (prove)
using this:
a \<circ> T \<in> insert x A \<rightarrow> carrier K
\<lbrakk>finite ?S; ?S \<subseteq> carrier V; ?a \<in> insert ?v ?S \<rightarrow> carrier K; ?v \<notin> ?S; ?v \<in> carrier V\<rbrakk> \<Longrightarrow> V.module.lincomb ?a (insert ?v ?S) = ?a ?v \<odot>\<^bsub>V\<^esub> ?v \<oplus>\<^bsub>V\<^esub> V.module.lincomb ?a ?S
finite A
x \<notin> A
insert x A \<subseteq> carrier V

goal (1 subgoal):
 1. a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A = V.module.lincomb (a \<circ> T) (insert x A)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A = V.module.lincomb (a \<circ> T) (insert x A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
T (a (T x) \<odot>\<^bsub>V\<^esub> x \<oplus>\<^bsub>V\<^esub> V.module.lincomb (a \<circ> T) A) = T (V.module.lincomb (a \<circ> T) (insert x A))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier V; a \<in> T ` F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` F) = T (V.module.lincomb (a \<circ> T) F); insert x F \<subseteq> carrier V; a \<in> T ` insert x F \<rightarrow> carrier K\<rbrakk> \<Longrightarrow> W.module.lincomb a (T ` insert x F) = T (V.module.lincomb (a \<circ> T) (insert x F))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
W.module.lincomb a (T ` insert x A) = T (V.module.lincomb (a \<circ> T) (insert x A))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
W.module.lincomb a (T ` insert x A) = T (V.module.lincomb (a \<circ> T) (insert x A))

goal (1 subgoal):
 1. W.module.lincomb a (T ` insert x A) = T (V.module.lincomb (a \<circ> T) (insert x A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
W.module.lincomb a (T ` insert x A) = T (V.module.lincomb (a \<circ> T) (insert x A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma One_hf_eq_succ: "1 = succ 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 = succ 0
[PROOF STEP]
by (metis One_hf_def succ_def)


[STATEMENT]
lemma to_int_mod_ring_mult:
  "to_int_mod_ring (a*b) =  to_int_mod_ring (a::'a mod_ring) *
    to_int_mod_ring (b::'a mod_ring) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_int_mod_ring (a * b) = to_int_mod_ring a * to_int_mod_ring b mod q
[PROOF STEP]
by (metis (no_types, lifting) CARD_a of_int_hom.hom_mult
  of_int_mod_ring.rep_eq of_int_mod_ring_to_int_mod_ring
  of_int_of_int_mod_ring to_int_mod_ring.rep_eq)


[STATEMENT]
lemma even_0_int: "even (0::int) = True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even 0 = True
[PROOF STEP]
by simp


[STATEMENT]
theorem prime_dvd_intro: "prime p \<Longrightarrow> p * q = m * n \<Longrightarrow> p dvd m \<or> p dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; p * q = m * n\<rbrakk> \<Longrightarrow> p dvd m \<or> p dvd n
[PROOF STEP]
@proof
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; p * q = m * n\<rbrakk> \<Longrightarrow> p dvd m \<or> p dvd n
[PROOF STEP]
@have "p dvd m * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; p * q = m * n\<rbrakk> \<Longrightarrow> p dvd m \<or> p dvd n
[PROOF STEP]
@qed


[STATEMENT]
lemma ghomTr3:"\<lbrakk>Group F; Group G; f \<in> gHom F G ; x \<in> carrier F;
       y \<in> carrier F; f (x \<cdot>\<^bsub>F\<^esub> (\<rho>\<^bsub>F\<^esub> y)) = \<one>\<^bsub>G\<^esub> \<rbrakk> \<Longrightarrow> f x = f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> carrier F; y \<in> carrier F; f (x \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> y) = \<one>\<^bsub>G\<^esub>\<rbrakk> \<Longrightarrow> f x = f y
[PROOF STEP]
apply (frule Group.i_closed[of "F" "y"], assumption+,
       simp only:gHom ghom_inv_inv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> carrier F; y \<in> carrier F; f x \<cdot>\<^bsub>G\<^esub> \<rho>\<^bsub>G\<^esub> f y = \<one>\<^bsub>G\<^esub>; \<rho>\<^bsub>F\<^esub> y \<in> carrier F\<rbrakk> \<Longrightarrow> f x = f y
[PROOF STEP]
apply (rule Group.r_div_eq[of "G" "f x" "f y"], assumption,
       (simp add:gHom_mem)+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem dualization:
  "\<turnstile> \<not>\<box>F = \<diamond>\<not>F"
  "\<turnstile> \<not>\<diamond>F = \<box>\<not>F"
  "\<turnstile> \<not>\<box>[A]_v = \<diamond>\<langle>\<not>A\<rangle>_v"
  "\<turnstile> \<not>\<diamond>\<langle>A\<rangle>_v = \<box>[\<not>A]_v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<turnstile> \<not> \<box>F = \<diamond>\<not> F &&& \<turnstile> \<not> \<diamond>F = \<box>\<not> F) &&& \<turnstile> \<not> \<box>[A]_v = \<diamond>\<langle>\<not> A\<rangle>_v &&& \<turnstile> \<not> \<diamond>\<langle>A\<rangle>_v = \<box>[\<not> A]_v
[PROOF STEP]
unfolding eventually_def angle_action_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<turnstile> \<not> \<box>F = \<not> \<box>\<not> \<not> F &&& \<turnstile> \<not> \<not> \<box>\<not> F = \<box>\<not> F) &&& \<turnstile> \<not> \<box>[A]_v = \<not> \<box>[\<not> \<not> A]_v &&& \<turnstile> \<not> \<not> \<box>[\<not> A]_v = \<box>[\<not> A]_v
[PROOF STEP]
by simp_all


[STATEMENT]
lemma encrypt_ntt:
  "encrypt_ntt t A r e1 e2 dt du dv m = encrypt t A r e1 e2 dt du dv m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. encrypt_ntt t A r e1 e2 dt du dv m = encrypt t A r e1 e2 dt du dv m
[PROOF STEP]
unfolding encrypt_ntt_def encrypt_def mat_vec_mult_ntt scalar_prod_ntt mult_ntt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (compress_vec du (Finite_Cartesian_Product.transpose A \<cdot>\<^bsub>ntt\<^esub> r + e1), compress_poly dv (decompress_vec dt t \<bullet>\<^bsub>ntt\<^esub> r + e2 + to_module (round (real_of_int q / 2)) *\<^bsub>ntt\<^esub> m)) = (compress_vec du (Finite_Cartesian_Product.transpose A \<cdot>\<^bsub>ntt\<^esub> r + e1), compress_poly dv (decompress_vec dt t \<bullet>\<^bsub>ntt\<^esub> r + e2 + to_module (round (real_of_int q / 2)) *\<^bsub>ntt\<^esub> m))
[PROOF STEP]
by auto


[STATEMENT]
lemma lebesgue_integral_eq_integral:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "integrable (lebesgue_on S) f" "S \<in> sets lebesgue"
  shows "integral\<^sup>L (lebesgue_on S) f = integral S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on S) f = integral S f
[PROOF STEP]
by (metis has_integral_integral_lebesgue_on assms integral_unique)


[STATEMENT]
lemma has_absolute_integral_change_of_variables_1':
  fixes f :: "real \<Rightarrow> real" and g :: "real \<Rightarrow> real"
  assumes S: "S \<in> sets lebesgue"
    and der_g: "\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative g' x) (at x within S)"
    and inj: "inj_on g S"
  shows "(\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f(g x)) absolutely_integrable_on S \<and>
           integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f(g x)) = b
     \<longleftrightarrow> f absolutely_integrable_on (g ` S) \<and> integral (g ` S) f = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
have "(\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f(g x)) :: real ^ 1) absolutely_integrable_on S \<and>
           integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f(g x))) = (vec b :: real ^ 1)
         \<longleftrightarrow> (\<lambda>x. vec (f x) :: real ^ 1) absolutely_integrable_on (g ` S) \<and>
           integral (g ` S) (\<lambda>x. vec (f x)) = (vec b :: real ^ 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) = vec b) = ((\<lambda>x. vec (f x)) absolutely_integrable_on g ` S \<and> integral (g ` S) (\<lambda>x. vec (f x)) = vec b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S \<in> sets lebesgue
?x \<in> S \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x within S)
inj_on g S

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) = vec b) = ((\<lambda>x. vec (f x)) absolutely_integrable_on g ` S \<and> integral (g ` S) (\<lambda>x. vec (f x)) = vec b)
[PROOF STEP]
unfolding has_real_derivative_iff_has_vector_derivative
[PROOF STATE]
proof (prove)
using this:
S \<in> sets lebesgue
?x \<in> S \<Longrightarrow> (g has_vector_derivative g' ?x) (at ?x within S)
inj_on g S

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) = vec b) = ((\<lambda>x. vec (f x)) absolutely_integrable_on g ` S \<and> integral (g ` S) (\<lambda>x. vec (f x)) = vec b)
[PROOF STEP]
by (intro has_absolute_integral_change_of_variables_1 assms) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) = vec b) = ((\<lambda>x. vec (f x)) absolutely_integrable_on g ` S \<and> integral (g ` S) (\<lambda>x. vec (f x)) = vec b)

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R vec (f (g x))) = vec b) = ((\<lambda>x. vec (f x)) absolutely_integrable_on g ` S \<and> integral (g ` S) (\<lambda>x. vec (f x)) = vec b)

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
by (simp add: absolutely_integrable_on_1_iff integral_on_1_eq)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma d_delta_arctan_upper_12:
     "((\<lambda>x. arctan_upper_12 x - arctan x) has_field_derivative diff_delta_arctan_upper_12 x) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. arctan_upper_12 x - arctan x) has_real_derivative diff_delta_arctan_upper_12 x) (at x)
[PROOF STEP]
unfolding arctan_upper_12_def diff_delta_arctan_upper_12_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. 3 * x / (x\<^sup>2 + 3) - arctan x) has_real_derivative - 4 * x ^ 4 / ((x\<^sup>2 + 3)\<^sup>2 * (1 + x\<^sup>2))) (at x)
[PROOF STEP]
apply (intro derivative_eq_intros,  simp_all)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x\<^sup>2 + 3 \<noteq> 0
 2. ((0 * x + 1 * 3) * (x\<^sup>2 + 3) - 3 * x * (2 * (1 * x) + 0)) / ((x\<^sup>2 + 3) * (x\<^sup>2 + 3)) - inverse (1 + x\<^sup>2) * 1 = - (4 * x ^ 4 / ((x\<^sup>2 + 3)\<^sup>2 * (1 + x\<^sup>2)))
[PROOF STEP]
apply (auto simp: divide_simps add_nonneg_eq_0_iff, algebra)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "root 100 1267650600228229401496703205376 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root 100 1267650600228229401496703205376 = 2
[PROOF STEP]
by simp


[STATEMENT]
lemma "4 = Suc (Suc (Suc (Suc 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 = Suc (Suc (Suc (Suc 0)))
[PROOF STEP]
by normalization


[STATEMENT]
lemma monoseq_Suc: "monoseq X \<longleftrightarrow> (\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoseq X = ((\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n))
[PROOF STEP]
unfolding monoseq_iff incseq_Suc_iff decseq_Suc_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n)) = ((\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n))
[PROOF STEP]
..


[STATEMENT]
theorem matrix_kauff_mat:
"((is_tangle_diagram ws)
 \<Longrightarrow> (rat_poly.row_length (kauff_mat ws)) = 2^(nat (domain_wall ws))
 \<and> (length (kauff_mat ws)) = 2^(nat (codomain_wall ws))
 \<and> (mat
        (rat_poly.row_length (kauff_mat ws))
        (length (kauff_mat ws))
            (kauff_mat ws)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
[PROOF STEP]
proof(induct ws)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. is_tangle_diagram (basic x) \<Longrightarrow> rat_poly.row_length (kauff_mat (basic x)) = 2 ^ nat (domain_wall (basic x)) \<and> length (kauff_mat (basic x)) = 2 ^ nat (codomain_wall (basic x)) \<and> mat (rat_poly.row_length (kauff_mat (basic x))) (length (kauff_mat (basic x))) (kauff_mat (basic x))
 2. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
case (basic w)
[PROOF STATE]
proof (state)
this:
is_tangle_diagram (basic w)

goal (2 subgoals):
 1. \<And>x. is_tangle_diagram (basic x) \<Longrightarrow> rat_poly.row_length (kauff_mat (basic x)) = 2 ^ nat (domain_wall (basic x)) \<and> length (kauff_mat (basic x)) = 2 ^ nat (codomain_wall (basic x)) \<and> mat (rat_poly.row_length (kauff_mat (basic x))) (length (kauff_mat (basic x))) (kauff_mat (basic x))
 2. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat (basic w)) = 2 ^ nat (domain_wall (basic w)) \<and> length (kauff_mat (basic w)) = 2 ^ nat (codomain_wall (basic w)) \<and> mat (rat_poly.row_length (kauff_mat (basic w))) (length (kauff_mat (basic w))) (kauff_mat (basic w))
[PROOF STEP]
using kauff_mat.simps(1) domain_wall.simps(1)
             row_length_domain_block matrix_blockmat
             length_codomain_block basic
[PROOF STATE]
proof (prove)
using this:
kauff_mat (basic ?w) = blockmat ?w
domain_wall (basic ?x) = domain_block ?x
rat_poly.row_length (blockmat ?ls) = 2 ^ nat (domain_block ?ls)
mat (rat_poly.row_length (blockmat ?ls)) (length (blockmat ?ls)) (blockmat ?ls)
length (blockmat ?ls) = 2 ^ nat (codomain_block ?ls)
is_tangle_diagram (basic w)

goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat (basic w)) = 2 ^ nat (domain_wall (basic w)) \<and> length (kauff_mat (basic w)) = 2 ^ nat (codomain_wall (basic w)) \<and> mat (rat_poly.row_length (kauff_mat (basic w))) (length (kauff_mat (basic w))) (kauff_mat (basic w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (kauff_mat (basic w)) = 2 ^ nat (domain_wall (basic w)) \<and> length (kauff_mat (basic w)) = 2 ^ nat (codomain_wall (basic w)) \<and> mat (rat_poly.row_length (kauff_mat (basic w))) (length (kauff_mat (basic w))) (kauff_mat (basic w))

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
case (prod w ws)
[PROOF STATE]
proof (state)
this:
is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
is_tangle_diagram (w * ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have "is_tangle_diagram (w*ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_tangle_diagram (w * ws)
[PROOF STEP]
using prod
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
is_tangle_diagram (w * ws)

goal (1 subgoal):
 1. is_tangle_diagram (w * ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_tangle_diagram (w * ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
is_tangle_diagram (w * ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have prod_1:"is_tangle_diagram ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_tangle_diagram ws
[PROOF STEP]
using is_tangle_diagram.simps  prod.prems
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram (basic ?x) = True
is_tangle_diagram (?x * ?xs) = (if is_tangle_diagram ?xs then codomain_block ?x = domain_wall ?xs else False)
is_tangle_diagram (w * ws)

goal (1 subgoal):
 1. is_tangle_diagram ws
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
is_tangle_diagram ws

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
is_tangle_diagram (w * ws)
is_tangle_diagram ws
[PROOF STEP]
have prod_2:"(codomain_block w) = domain_wall ws"
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram (w * ws)
is_tangle_diagram ws

goal (1 subgoal):
 1. codomain_block w = domain_wall ws
[PROOF STEP]
using is_tangle_diagram.simps
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram (w * ws)
is_tangle_diagram ws
is_tangle_diagram (basic ?x) = True
is_tangle_diagram (?x * ?xs) = (if is_tangle_diagram ?xs then codomain_block ?x = domain_wall ?xs else False)

goal (1 subgoal):
 1. codomain_block w = domain_wall ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
codomain_block w = domain_wall ws

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
from prod_1
[PROOF STATE]
proof (chain)
picking this:
is_tangle_diagram ws
[PROOF STEP]
have prod_3:
         "mat
              (rat_poly.row_length (kauff_mat ws))
              (length (kauff_mat ws))
                           (kauff_mat ws)"
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram ws

goal (1 subgoal):
 1. mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
[PROOF STEP]
using prod.hyps
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram ws
is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)

goal (1 subgoal):
 1. mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have "(rat_poly.row_length (kauff_mat ws))
                                =  2^(nat (domain_wall ws))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws)
[PROOF STEP]
using prod.hyps prod_1
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
is_tangle_diagram ws

goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have prod_4:"length (kauff_mat ws)
                                = 2^(nat (codomain_wall ws))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (kauff_mat ws) = 2 ^ nat (codomain_wall ws)
[PROOF STEP]
using prod.hyps prod_1
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
is_tangle_diagram ws

goal (1 subgoal):
 1. length (kauff_mat ws) = 2 ^ nat (codomain_wall ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (kauff_mat ws) = 2 ^ nat (codomain_wall ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (kauff_mat ws) = 2 ^ nat (codomain_wall ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have prod_5:
           "mat
               (rat_poly.row_length (blockmat w))
               (length (blockmat w))
                            (blockmat w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (rat_poly.row_length (blockmat w)) (length (blockmat w)) (blockmat w)
[PROOF STEP]
using matrix_blockmat
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat ?ls)) (length (blockmat ?ls)) (blockmat ?ls)

goal (1 subgoal):
 1. mat (rat_poly.row_length (blockmat w)) (length (blockmat w)) (blockmat w)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (blockmat w)) (length (blockmat w)) (blockmat w)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (blockmat w)) (length (blockmat w)) (blockmat w)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have prod_6:
           "rat_poly.row_length (blockmat w)
                             = 2^(nat (domain_block w))"
              and "length (blockmat w) = 2^(nat (codomain_block w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.row_length (blockmat w) = 2 ^ nat (domain_block w) &&& length (blockmat w) = 2 ^ nat (codomain_block w)
[PROOF STEP]
using row_length_domain_block length_codomain_block
[PROOF STATE]
proof (prove)
using this:
rat_poly.row_length (blockmat ?ls) = 2 ^ nat (domain_block ?ls)
length (blockmat ?ls) = 2 ^ nat (codomain_block ?ls)

goal (1 subgoal):
 1. rat_poly.row_length (blockmat w) = 2 ^ nat (domain_block w) &&& length (blockmat w) = 2 ^ nat (codomain_block w)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_block w)
length (blockmat w) = 2 ^ nat (codomain_block w)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws)
length (kauff_mat ws) = 2 ^ nat (codomain_wall ws)
mat (rat_poly.row_length (blockmat w)) (length (blockmat w)) (blockmat w)
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_block w)
length (blockmat w) = 2 ^ nat (codomain_block w)
[PROOF STEP]
have ad1:"length (blockmat w)
                             = rat_poly.row_length (kauff_mat ws)"
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws)
length (kauff_mat ws) = 2 ^ nat (codomain_wall ws)
mat (rat_poly.row_length (blockmat w)) (length (blockmat w)) (blockmat w)
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_block w)
length (blockmat w) = 2 ^ nat (codomain_block w)

goal (1 subgoal):
 1. length (blockmat w) = rat_poly.row_length (kauff_mat ws)
[PROOF STEP]
using prod_2
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws)
length (kauff_mat ws) = 2 ^ nat (codomain_wall ws)
mat (rat_poly.row_length (blockmat w)) (length (blockmat w)) (blockmat w)
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_block w)
length (blockmat w) = 2 ^ nat (codomain_block w)
codomain_block w = domain_wall ws

goal (1 subgoal):
 1. length (blockmat w) = rat_poly.row_length (kauff_mat ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (blockmat w) = rat_poly.row_length (kauff_mat ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (blockmat w) = rat_poly.row_length (kauff_mat ws)
[PROOF STEP]
have "mat
                 (rat_poly.row_length (blockmat w))
                 (length (kauff_mat ws))
                      (rat_poly.matrix_mult (blockmat w) (kauff_mat ws))"
[PROOF STATE]
proof (prove)
using this:
length (blockmat w) = rat_poly.row_length (kauff_mat ws)

goal (1 subgoal):
 1. mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (rat_poly.matrix_mult (blockmat w) (kauff_mat ws))
[PROOF STEP]
using prod_3 prod_5 mat_mult
[PROOF STATE]
proof (prove)
using this:
length (blockmat w) = rat_poly.row_length (kauff_mat ws)
mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws)
mat (rat_poly.row_length (blockmat w)) (length (blockmat w)) (blockmat w)
\<lbrakk>mat ?nr ?n ?m1.0; mat ?n ?nc ?m2.0\<rbrakk> \<Longrightarrow> mat ?nr ?nc (mat_multI ?ze ?pl ?ti ?nr ?m1.0 ?m2.0)

goal (1 subgoal):
 1. mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (rat_poly.matrix_mult (blockmat w) (kauff_mat ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (rat_poly.matrix_mult (blockmat w) (kauff_mat ws))

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (rat_poly.matrix_mult (blockmat w) (kauff_mat ws))
[PROOF STEP]
have res1:"mat
                     (rat_poly.row_length (blockmat w))
                     (length (kauff_mat ws))
                               (kauff_mat (w*ws))"
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (rat_poly.matrix_mult (blockmat w) (kauff_mat ws))

goal (1 subgoal):
 1. mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))
[PROOF STEP]
using kauff_mat.simps(2)
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (rat_poly.matrix_mult (blockmat w) (kauff_mat ws))
kauff_mat (?w * ?ws) = rat_poly.matrix_mult (blockmat ?w) (kauff_mat ?ws)

goal (1 subgoal):
 1. mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))
[PROOF STEP]
have "rat_poly.row_length (kauff_mat (w*ws))
                               = (rat_poly.row_length (blockmat w))"
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))

goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat (w * ws)) = rat_poly.row_length (blockmat w)
[PROOF STEP]
using ad1 length_0_conv rat_poly.mat_empty_column_length
             rat_poly.matrix_row_length rat_poly.row_length_def
             rat_poly.unique_row_col(1)
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))
length (blockmat w) = rat_poly.row_length (kauff_mat ws)
(length ?xs = 0) = (?xs = [])
\<lbrakk>mat ?nr ?nc ?M; ?M = []\<rbrakk> \<Longrightarrow> ?nc = 0
mat ?nr ?nc ?M \<Longrightarrow> mat (rat_poly.row_length ?M) (length ?M) ?M
rat_poly.row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
\<lbrakk>mat ?nr1.0 ?nc1.0 ?M; mat ?nr2.0 ?nc2.0 ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> ?nr1.0 = ?nr2.0

goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat (w * ws)) = rat_poly.row_length (blockmat w)
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (kauff_mat (w * ws)) = rat_poly.row_length (blockmat w)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (kauff_mat (w * ws)) = rat_poly.row_length (blockmat w)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have "...  = 2^(nat (domain_wall (w*ws)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.row_length (blockmat w) = 2 ^ nat (domain_wall (w * ws))
[PROOF STEP]
using prod_6 domain_wall.simps
[PROOF STATE]
proof (prove)
using this:
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_block w)
domain_wall (basic ?x) = domain_block ?x
domain_wall (?x * ?ys) = domain_block ?x

goal (1 subgoal):
 1. rat_poly.row_length (blockmat w) = 2 ^ nat (domain_wall (w * ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_wall (w * ws))

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rat_poly.row_length (kauff_mat (w * ws)) = rat_poly.row_length (blockmat w)
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_wall (w * ws))
[PROOF STEP]
have res2:
                 "rat_poly.row_length (kauff_mat (w*ws))
                       = 2^(nat (domain_wall (w*ws)))"
[PROOF STATE]
proof (prove)
using this:
rat_poly.row_length (kauff_mat (w * ws)) = rat_poly.row_length (blockmat w)
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_wall (w * ws))

goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat (w * ws)) = 2 ^ nat (domain_wall (w * ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (kauff_mat (w * ws)) = 2 ^ nat (domain_wall (w * ws))

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have "length (kauff_mat (w*ws)) = length (kauff_mat ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (kauff_mat (w * ws)) = length (kauff_mat ws)
[PROOF STEP]
using res1  rat_poly.mat_empty_column_length
           rat_poly.matrix_row_length rat_poly.unique_row_col(2)
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))
\<lbrakk>mat ?nr ?nc ?M; ?M = []\<rbrakk> \<Longrightarrow> ?nc = 0
mat ?nr ?nc ?M \<Longrightarrow> mat (rat_poly.row_length ?M) (length ?M) ?M
\<lbrakk>mat ?nr1.0 ?nc1.0 ?M; mat ?nr2.0 ?nc2.0 ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> ?nc1.0 = ?nc2.0

goal (1 subgoal):
 1. length (kauff_mat (w * ws)) = length (kauff_mat ws)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
length (kauff_mat (w * ws)) = length (kauff_mat ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (kauff_mat (w * ws)) = length (kauff_mat ws)

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
have "... = 2^(nat (codomain_wall (w*ws)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (kauff_mat ws) = 2 ^ nat (codomain_wall (w * ws))
[PROOF STEP]
using prod_4 codomain_wall.simps(2)
[PROOF STATE]
proof (prove)
using this:
length (kauff_mat ws) = 2 ^ nat (codomain_wall ws)
codomain_wall (?x * ?ys) = codomain_wall ?ys

goal (1 subgoal):
 1. length (kauff_mat ws) = 2 ^ nat (codomain_wall (w * ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (kauff_mat ws) = 2 ^ nat (codomain_wall (w * ws))

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (kauff_mat (w * ws)) = length (kauff_mat ws)
length (kauff_mat ws) = 2 ^ nat (codomain_wall (w * ws))
[PROOF STEP]
have res3:"length (kauff_mat (w*ws))
                               =  2^(nat (codomain_wall (w*ws)))"
[PROOF STATE]
proof (prove)
using this:
length (kauff_mat (w * ws)) = length (kauff_mat ws)
length (kauff_mat ws) = 2 ^ nat (codomain_wall (w * ws))

goal (1 subgoal):
 1. length (kauff_mat (w * ws)) = 2 ^ nat (codomain_wall (w * ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (kauff_mat (w * ws)) = 2 ^ nat (codomain_wall (w * ws))

goal (1 subgoal):
 1. \<And>x1a ws. \<lbrakk>is_tangle_diagram ws \<Longrightarrow> rat_poly.row_length (kauff_mat ws) = 2 ^ nat (domain_wall ws) \<and> length (kauff_mat ws) = 2 ^ nat (codomain_wall ws) \<and> mat (rat_poly.row_length (kauff_mat ws)) (length (kauff_mat ws)) (kauff_mat ws); is_tangle_diagram (x1a * ws)\<rbrakk> \<Longrightarrow> rat_poly.row_length (kauff_mat (x1a * ws)) = 2 ^ nat (domain_wall (x1a * ws)) \<and> length (kauff_mat (x1a * ws)) = 2 ^ nat (codomain_wall (x1a * ws)) \<and> mat (rat_poly.row_length (kauff_mat (x1a * ws))) (length (kauff_mat (x1a * ws))) (kauff_mat (x1a * ws))
[PROOF STEP]
with res1 res2
[PROOF STATE]
proof (chain)
picking this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))
rat_poly.row_length (kauff_mat (w * ws)) = 2 ^ nat (domain_wall (w * ws))
length (kauff_mat (w * ws)) = 2 ^ nat (codomain_wall (w * ws))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))
rat_poly.row_length (kauff_mat (w * ws)) = 2 ^ nat (domain_wall (w * ws))
length (kauff_mat (w * ws)) = 2 ^ nat (codomain_wall (w * ws))

goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat (w * ws)) = 2 ^ nat (domain_wall (w * ws)) \<and> length (kauff_mat (w * ws)) = 2 ^ nat (codomain_wall (w * ws)) \<and> mat (rat_poly.row_length (kauff_mat (w * ws))) (length (kauff_mat (w * ws))) (kauff_mat (w * ws))
[PROOF STEP]
using  \<open>length (kauff_mat ws) = 2 ^ nat (codomain_wall (w * ws))\<close>
           \<open>rat_poly.row_length (blockmat w) = 2 ^ nat (domain_wall (w * ws))\<close>
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (blockmat w)) (length (kauff_mat ws)) (kauff_mat (w * ws))
rat_poly.row_length (kauff_mat (w * ws)) = 2 ^ nat (domain_wall (w * ws))
length (kauff_mat (w * ws)) = 2 ^ nat (codomain_wall (w * ws))
length (kauff_mat ws) = 2 ^ nat (codomain_wall (w * ws))
rat_poly.row_length (blockmat w) = 2 ^ nat (domain_wall (w * ws))

goal (1 subgoal):
 1. rat_poly.row_length (kauff_mat (w * ws)) = 2 ^ nat (domain_wall (w * ws)) \<and> length (kauff_mat (w * ws)) = 2 ^ nat (codomain_wall (w * ws)) \<and> mat (rat_poly.row_length (kauff_mat (w * ws))) (length (kauff_mat (w * ws))) (kauff_mat (w * ws))
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (kauff_mat (w * ws)) = 2 ^ nat (domain_wall (w * ws)) \<and> length (kauff_mat (w * ws)) = 2 ^ nat (codomain_wall (w * ws)) \<and> mat (rat_poly.row_length (kauff_mat (w * ws))) (length (kauff_mat (w * ws))) (kauff_mat (w * ws))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma erf_complex_altdef:
  "erf z = of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (-(t^2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
define A where "A = (\<lambda>z. contour_integral (linepath 0 z) (\<lambda>t. exp (-(t^2))))"
[PROOF STATE]
proof (state)
this:
A = (\<lambda>z. contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2)))

goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
have [derivative_intros]: "(A has_field_derivative exp (-(z^2))) (at z)" for z :: complex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A has_field_derivative exp (- z\<^sup>2)) (at z)
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))) has_field_derivative exp (- z\<^sup>2)) (at z)
[PROOF STEP]
by (rule contour_integral_has_field_derivative[where A = UNIV])
       (auto intro!: holomorphic_intros)
[PROOF STATE]
proof (state)
this:
(A has_field_derivative exp (- ?z\<^sup>2)) (at ?z)

goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
have "erf z - 2 / sqrt pi * A z = erf 0 - 2 / sqrt pi * A 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf z - complex_of_real (2 / sqrt pi) * A z = erf 0 - complex_of_real (2 / sqrt pi) * A 0
[PROOF STEP]
by (rule has_derivative_zero_unique [where f = "\<lambda>z. erf z - 2 / sqrt pi * A z" and s = UNIV])
       (auto intro!: has_field_derivative_imp_has_derivative derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
erf z - complex_of_real (2 / sqrt pi) * A z = erf 0 - complex_of_real (2 / sqrt pi) * A 0

goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
erf z - complex_of_real (2 / sqrt pi) * A z = erf 0 - complex_of_real (2 / sqrt pi) * A 0

goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
have "A 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A 0 = 0
[PROOF STEP]
by (simp only: A_def contour_integral_trivial)
[PROOF STATE]
proof (state)
this:
A 0 = 0

goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
erf z - complex_of_real (2 / sqrt pi) * A z = erf 0 - complex_of_real (2 / sqrt pi) * 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
erf z - complex_of_real (2 / sqrt pi) * A z = erf 0 - complex_of_real (2 / sqrt pi) * 0

goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
using this:
erf z - complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2)) = erf 0 - complex_of_real (2 / sqrt pi) * 0

goal (1 subgoal):
 1. erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
erf z = complex_of_real (2 / sqrt pi) * contour_integral (linepath 0 z) (\<lambda>t. exp (- t\<^sup>2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iMODb_append_union_Suc: "
  [r, mod m, c] \<union> [ r + m * Suc c, mod m, c'] = [r, mod m, Suc (c + c')]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [ r, mod m, c ] \<union> [ r + m * Suc c, mod m, c' ] = [ r, mod m, Suc (c + c') ]
[PROOF STEP]
apply (subst insert_absorb[of "r + m * c" "[r, mod m, c] \<union> [ r + m * Suc c, mod m, c']", symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. r + m * c \<in> [ r, mod m, c ] \<union> [ r + m * Suc c, mod m, c' ]
 2. insert (r + m * c) ([ r, mod m, c ] \<union> [ r + m * Suc c, mod m, c' ]) = [ r, mod m, Suc (c + c') ]
[PROOF STEP]
apply (simp add: iT_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert (r + m * c) ([ r, mod m, c ] \<union> [ r + m * Suc c, mod m, c' ]) = [ r, mod m, Suc (c + c') ]
[PROOF STEP]
apply (simp del: Un_insert_right add: Un_insert_right[symmetric] add.commute[of m] add.assoc[symmetric] iMODb_Suc_pred_insert_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [ r, mod m, c ] \<union> [ r + m * c, mod m, Suc c' ] = [ r, mod m, Suc (c + c') ]
[PROOF STEP]
apply (simp add: iMODb_append_union)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma topology_bases_eq:
   "\<lbrakk>\<And>U x. \<lbrakk>P U; x \<in> U\<rbrakk> \<Longrightarrow> \<exists>V. Q V \<and> x \<in> V \<and> V \<subseteq> U;
    \<And>V x. \<lbrakk>Q V; x \<in> V\<rbrakk> \<Longrightarrow> \<exists>U. P U \<and> x \<in> U \<and> U \<subseteq> V\<rbrakk>
        \<Longrightarrow> topology (arbitrary union_of P) =
            topology (arbitrary union_of Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>U x. \<lbrakk>P U; x \<in> U\<rbrakk> \<Longrightarrow> \<exists>V. Q V \<and> x \<in> V \<and> V \<subseteq> U; \<And>V x. \<lbrakk>Q V; x \<in> V\<rbrakk> \<Longrightarrow> \<exists>U. P U \<and> x \<in> U \<and> U \<subseteq> V\<rbrakk> \<Longrightarrow> topology (arbitrary union_of P) = topology (arbitrary union_of Q)
[PROOF STEP]
by (fastforce intro:  arg_cong [where f=topology]  elim: topology_bases_eq_aux)


[STATEMENT]
lemma len_eq0_iff: "len n = 0 \<longleftrightarrow> n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (len n = 0) = (n = 0)
[PROOF STEP]
by (induct n rule: len.induct) auto


[STATEMENT]
lemma octo_mult_components:
  "Ree (x *  y ) =  Ree x *  Ree y - Im1 x * Im1 y -  Im2 x * Im2 y - Im3 x * Im3 y
   - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y-  Im7 x * Im7 y"
  "Im1 (x  *  y )  =  Ree x * Im1 y +   Im1 x * Ree y + Im2 x * Im4 y +Im3 x * Im7 y -
     Im4 x * Im2 y    +Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y "
   " Im2 (x  *  y )  =  Ree x *  Im2 y - Im1 x * Im4 y+ Im2 x  * Ree y + Im3 x * Im5 y
          + Im4 x * Im1 y  - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x *Im6 y  "
   " Im3 (x * y ) =  Ree x * Im3 y -Im1 x * Im7 y -Im2 x *Im5 y +Im3 x * Ree y + Im4 x * Im6 y
         +  Im5 x *Im2 y  - Im6 x * Im4 y + Im7 x * Im1 y "
   "Im4  (x *y ) =  Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y -Im3 x * Im6 y + Im4 x * Ree y
        +Im5 x * Im7 y +Im6 x * Im3 y -Im7 x * Im5 y  "
   "Im5  (x * y ) = Ree x * Im5 y - Im1 x * Im6 y +Im2 x * Im3 y -Im3 x * Im2 y -Im4 x * Im7 y
         +Im5 x * Ree y  +Im6 x * Im1 y + Im7 x  * Im4 y  "
   " Im6  (x *  y) = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y +Im3 x * Im4 y - Im4 x * Im3 y
        -Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y   "
    "Im7 (x * y)  = Ree x * Im7 y + Im1 x * Im3 y +Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y
   -Im5 x * Im4 y - Im6 x * Im2 y +Im7 x * Ree y  "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((Ree (x * y) = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y &&& Im1 (x * y) = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y) &&& Im2 (x * y) = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y &&& Im3 (x * y) = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y) &&& (Im4 (x * y) = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y &&& Im5 (x * y) = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y) &&& Im6 (x * y) = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y &&& Im7 (x * y) = Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y
[PROOF STEP]
unfolding times_octo_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((Ree (let t0 = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y; t1 = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y; t2 = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y; t3 = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y; t4 = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y; t5 = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y; t6 = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y in Let (Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y) (Octo t0 t1 t2 t3 t4 t5 t6)) = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y &&& Im1 (let t0 = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y; t1 = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y; t2 = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y; t3 = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y; t4 = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y; t5 = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y; t6 = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y in Let (Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y) (Octo t0 t1 t2 t3 t4 t5 t6)) = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y) &&& Im2 (let t0 = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y; t1 = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y; t2 = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y; t3 = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y; t4 = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y; t5 = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y; t6 = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y in Let (Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y) (Octo t0 t1 t2 t3 t4 t5 t6)) = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y &&& Im3 (let t0 = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y; t1 = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y; t2 = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y; t3 = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y; t4 = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y; t5 = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y; t6 = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y in Let (Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y) (Octo t0 t1 t2 t3 t4 t5 t6)) = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y) &&& (Im4 (let t0 = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y; t1 = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y; t2 = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y; t3 = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y; t4 = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y; t5 = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y; t6 = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y in Let (Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y) (Octo t0 t1 t2 t3 t4 t5 t6)) = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y &&& Im5 (let t0 = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y; t1 = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y; t2 = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y; t3 = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y; t4 = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y; t5 = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y; t6 = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y in Let (Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y) (Octo t0 t1 t2 t3 t4 t5 t6)) = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y) &&& Im6 (let t0 = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y; t1 = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y; t2 = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y; t3 = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y; t4 = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y; t5 = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y; t6 = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y in Let (Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y) (Octo t0 t1 t2 t3 t4 t5 t6)) = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y &&& Im7 (let t0 = Ree x * Ree y - Im1 x * Im1 y - Im2 x * Im2 y - Im3 x * Im3 y - Im4 x * Im4 y - Im5 x * Im5 y - Im6 x * Im6 y - Im7 x * Im7 y; t1 = Ree x * Im1 y + Im1 x * Ree y + Im2 x * Im4 y + Im3 x * Im7 y - Im4 x * Im2 y + Im5 x * Im6 y - Im6 x * Im5 y - Im7 x * Im3 y; t2 = Ree x * Im2 y - Im1 x * Im4 y + Im2 x * Ree y + Im3 x * Im5 y + Im4 x * Im1 y - Im5 x * Im3 y + Im6 x * Im7 y - Im7 x * Im6 y; t3 = Ree x * Im3 y - Im1 x * Im7 y - Im2 x * Im5 y + Im3 x * Ree y + Im4 x * Im6 y + Im5 x * Im2 y - Im6 x * Im4 y + Im7 x * Im1 y; t4 = Ree x * Im4 y + Im1 x * Im2 y - Im2 x * Im1 y - Im3 x * Im6 y + Im4 x * Ree y + Im5 x * Im7 y + Im6 x * Im3 y - Im7 x * Im5 y; t5 = Ree x * Im5 y - Im1 x * Im6 y + Im2 x * Im3 y - Im3 x * Im2 y - Im4 x * Im7 y + Im5 x * Ree y + Im6 x * Im1 y + Im7 x * Im4 y; t6 = Ree x * Im6 y + Im1 x * Im5 y - Im2 x * Im7 y + Im3 x * Im4 y - Im4 x * Im3 y - Im5 x * Im1 y + Im6 x * Ree y + Im7 x * Im2 y in Let (Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y) (Octo t0 t1 t2 t3 t4 t5 t6)) = Ree x * Im7 y + Im1 x * Im3 y + Im2 x * Im6 y - Im3 x * Im1 y + Im4 x * Im5 y - Im5 x * Im4 y - Im6 x * Im2 y + Im7 x * Ree y
[PROOF STEP]
by auto


[STATEMENT]
lemma pderiv_power:
  "pderiv (p ^ n) = smult (of_nat n) (p ^ (n - 1) * pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv (p ^ n) = Polynomial.smult (of_nat n) (p ^ (n - 1) * pderiv p)
[PROOF STEP]
by (cases n) (simp_all add: pderiv_power_Suc del: power_Suc)


[STATEMENT]
lemma cos_ms_aux':
  assumes "ms_exp_gt 0 (ms_aux_hd_exp xs)" "basis_wf basis" "is_expansion_aux xs f basis"
  shows   "is_expansion_aux (cos_ms_aux' xs) (\<lambda>x. cos (f x)) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_expansion_aux (cos_ms_aux' xs) (\<lambda>x. cos (f x)) basis
[PROOF STEP]
unfolding cos_ms_aux'_def cos_conv_pre_cos power2_eq_square
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_expansion_aux (powser_ms_aux (msllist_of_msstream cos_series_stream) (times_ms_aux xs xs)) (\<lambda>x. powser (msllist_of_msstream cos_series_stream) (f x * f x)) basis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ms_exp_gt 0 (ms_aux_hd_exp xs)
basis_wf basis
is_expansion_aux xs f basis

goal (1 subgoal):
 1. is_expansion_aux (powser_ms_aux (msllist_of_msstream cos_series_stream) (times_ms_aux xs xs)) (\<lambda>x. powser (msllist_of_msstream cos_series_stream) (f x * f x)) basis
[PROOF STEP]
by (intro times_ms_aux powser_ms_aux[unfolded o_def] convergent_powser_cos_series_stream)
     (auto simp: hd_exp_times add_neg_neg split: option.splits)


[STATEMENT]
lemma "OAlist_tc_prod_ord (\<lambda>_. greater_eq)
                (oalist_tc_of_list [(1, 4), (0::nat, 4::nat), (1, 3), (0, 2), (3, 1)])
                (oalist_tc_of_list [(0, 4), (1, 3), (2, 2), (1, 1)]) = False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OAlist_tc_prod_ord (\<lambda>_ x y. y \<le> x) (oalist_tc_of_list [(1, 4), (0, 4), (1, 3), (0, 2), (3, 1)]) (oalist_tc_of_list [(0, 4), (1, 3), (2, 2), (1, 1)]) = False
[PROOF STEP]
by eval


[STATEMENT]
lemma coord_ring_plus:
  assumes "p \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  assumes "Q \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  shows "(p \<oplus>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> Q) m = p m \<oplus> Q m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) m = p m \<oplus> Q m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>n\<^esub>])

goal (1 subgoal):
 1. (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) m = p m \<oplus> Q m
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (Pring R {..<n})
Q \<in> carrier (Pring R {..<n})

goal (1 subgoal):
 1. (p \<oplus>\<^bsub>Pring R {..<n}\<^esub> Q) m = p m \<oplus> Q m
[PROOF STEP]
by (metis R.Pring_add R.indexed_padd_def)


[STATEMENT]
lemma setops_list\<^sub>s\<^sub>s\<^sub>t_is_setops\<^sub>s\<^sub>s\<^sub>t: "setops\<^sub>s\<^sub>s\<^sub>t S = set (setops_list\<^sub>s\<^sub>s\<^sub>t S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. setops\<^sub>s\<^sub>s\<^sub>t S = set (setops_list\<^sub>s\<^sub>s\<^sub>t S)
[PROOF STEP]
unfolding setops\<^sub>s\<^sub>s\<^sub>t_def setops_list\<^sub>s\<^sub>s\<^sub>t_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set S) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p S)))
[PROOF STEP]
proof (induction S)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set []) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p [])))
 2. \<And>a S. \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set S) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p S))) \<Longrightarrow> \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set (a # S)) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p (a # S))))
[PROOF STEP]
case (Cons x S)
[PROOF STATE]
proof (state)
this:
\<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set S) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p S)))

goal (2 subgoals):
 1. \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set []) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p [])))
 2. \<And>a S. \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set S) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p S))) \<Longrightarrow> \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set (a # S)) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p (a # S))))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set S) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p S)))

goal (1 subgoal):
 1. \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set (x # S)) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p (x # S))))
[PROOF STEP]
by (cases x) auto
[PROOF STATE]
proof (state)
this:
\<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set (x # S)) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p (x # S))))

goal (1 subgoal):
 1. \<Union> (setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set []) = set (remdups (concat (map setops_list\<^sub>s\<^sub>s\<^sub>t\<^sub>p [])))
[PROOF STEP]
qed simp


[STATEMENT]
lemma has_integral_set_lebesgue:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes f: "set_integrable lebesgue S f"
  shows "(f has_integral (LINT x:S|lebesgue. f x)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral set_lebesgue_integral lebesgue S f) S
[PROOF STEP]
using has_integral_integral_lebesgue f
[PROOF STATE]
proof (prove)
using this:
integrable lebesgue ?f \<Longrightarrow> (?f has_integral integral\<^sup>L lebesgue ?f) UNIV
set_integrable lebesgue S f

goal (1 subgoal):
 1. (f has_integral set_lebesgue_integral lebesgue S f) S
[PROOF STEP]
by (fastforce simp add: set_integrable_def set_lebesgue_integral_def indicator_def
    of_bool_def if_distrib[of "\<lambda>x. x *\<^sub>R f _"] cong: if_cong)


[STATEMENT]
lemma expSum: "exp x (a+b) = (exp x a) * (exp x b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x (a + b) = exp x a * exp x b
[PROOF STEP]
apply(induct a, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma setprod_eq_zero [simp]:
  fixes f::"nat \<Rightarrow> nat"
  shows "(\<Prod>i < n. f i) = 0 \<longleftrightarrow> (\<exists>i < n. f i = 0)"
    "(\<Prod>i \<le> n. f i) = 0 \<longleftrightarrow> (\<exists>i \<le> n. f i = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prod f {..<n} = 0) = (\<exists>i<n. f i = 0) &&& (prod f {..n} = 0) = (\<exists>i\<le>n. f i = 0)
[PROOF STEP]
by (auto)


[STATEMENT]
lemma "((x::int) + y)^3 - 1 = (x - z)^2 - 10 \<Longrightarrow> x = z + 3 \<Longrightarrow> x = - y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(x + y) ^ 3 - 1 = (x - z)\<^sup>2 - 10; x = z + 3\<rbrakk> \<Longrightarrow> x = - y
[PROOF STEP]
by algebra


[STATEMENT]
lemma algebraic_csqrt [intro]: "algebraic x \<Longrightarrow> algebraic (csqrt x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic x \<Longrightarrow> algebraic (csqrt x)
[PROOF STEP]
by (rule algebraic_nth_root[of 2 x]) auto