[STATEMENT]
theorem well_defined_Tensor:
 "(mat (row_length M1) (length M1) M1)
\<and> (mat (row_length M2) (length M2) M2)
\<Longrightarrow>(mat ((row_length M1)*(row_length M2)) ((length M1)*(length M2)) (M1\<otimes>M2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
[PROOF STEP]
proof(induct M1)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
 2. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
 2. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "(row_length []) * (row_length M2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length [] * row_length M2 = 0
[PROOF STEP]
using row_length_def  mult_zero_left
[PROOF STATE]
proof (prove)
using this:
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
(0::?'a) * ?a = (0::?'a)

goal (1 subgoal):
 1. row_length [] * row_length M2 = 0
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
row_length [] * row_length M2 = 0

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
 2. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
row_length [] * row_length M2 = 0

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
 2. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "(length []) * (length M2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length [] * length M2 = 0
[PROOF STEP]
using  mult_zero_left list.size(3)
[PROOF STATE]
proof (prove)
using this:
(0::?'a) * ?a = (0::?'a)
length [] = 0

goal (1 subgoal):
 1. length [] * length M2 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length [] * length M2 = 0

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
 2. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length [] * length M2 = 0

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
 2. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "[] \<otimes> M2 = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<otimes> M2 = []
[PROOF STEP]
using Tensor.simps(1)
[PROOF STATE]
proof (prove)
using this:
[] \<otimes> ?xs = []

goal (1 subgoal):
 1. [] \<otimes> M2 = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[] \<otimes> M2 = []

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
 2. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
row_length [] * row_length M2 = 0
length [] * length M2 = 0
[] \<otimes> M2 = []
[PROOF STEP]
have
       "mat (row_length []*row_length M2) (length []*length M2) ([] \<otimes> M2)"
[PROOF STATE]
proof (prove)
using this:
row_length [] * row_length M2 = 0
length [] * length M2 = 0
[] \<otimes> M2 = []

goal (1 subgoal):
 1. mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
[PROOF STEP]
using zero_matrix
[PROOF STATE]
proof (prove)
using this:
row_length [] * row_length M2 = 0
length [] * length M2 = 0
[] \<otimes> M2 = []
mat 0 0 []

goal (1 subgoal):
 1. mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
 2. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)

goal (1 subgoal):
 1. mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat (row_length [] * row_length M2) (length [] * length M2) ([] \<otimes> M2)

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
case (Cons a M1)
[PROOF STATE]
proof (state)
this:
mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have step1: "mat (row_length (a # M1)) (length (a # M1)) (a # M1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length (a # M1)) (length (a # M1)) (a # M1)
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2

goal (1 subgoal):
 1. mat (row_length (a # M1)) (length (a # M1)) (a # M1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1)

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1)
[PROOF STEP]
have "mat (row_length (M1)) (length (M1)) (M1)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1)

goal (1 subgoal):
 1. mat (row_length M1) (length M1) M1
[PROOF STEP]
using reduct_matrix
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1)
mat (row_length (?a # ?M)) (length (?a # ?M)) (?a # ?M) \<Longrightarrow> mat (row_length ?M) (length ?M) ?M

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

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat (row_length M1) (length M1) M1

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "mat (row_length (M2)) (length (M2)) (M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M2) (length M2) M2
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2

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

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat (row_length M1) (length M1) M1
mat (row_length M2) (length M2) M2
[PROOF STEP]
have step2:
      "mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length M1) (length M1) M1
mat (row_length M2) (length M2) M2

goal (1 subgoal):
 1. mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
[PROOF STEP]
using Cons.hyps
[PROOF STATE]
proof (prove)
using this:
mat (row_length M1) (length M1) M1
mat (row_length M2) (length M2) M2
mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)

goal (1 subgoal):
 1. mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have 0:"row_length (a#M1) = length a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length (a # M1) = length a
[PROOF STEP]
using row_length_def  list.distinct(1)
[PROOF STATE]
proof (prove)
using this:
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
[] \<noteq> ?x21.0 # ?x22.0

goal (1 subgoal):
 1. row_length (a # M1) = length a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length (a # M1) = length a

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "mat
           (row_length (a # M1)*row_length M2)
           (length (a # M1)*length M2)
                           (a # M1 \<otimes> M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
proof(cases M1)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. M1 = [] \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
 2. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
M1 = []

goal (2 subgoals):
 1. M1 = [] \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
 2. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "(mat ((row_length M2)*(length a)) (length M2) (vec_mat_Tensor a M2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
[PROOF STEP]
using Cons.prems well_defined_vec_mat_Tensor
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2
mat (row_length ?M) (length ?M) ?M \<Longrightarrow> mat (row_length ?M * length ?v) (length ?M) (vec_mat_Tensor ?v ?M)

goal (1 subgoal):
 1. mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)

goal (2 subgoals):
 1. M1 = [] \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
 2. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)

goal (2 subgoals):
 1. M1 = [] \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
 2. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "(length (a # M1)) * (length M2) = length M2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (a # M1) * length M2 = length M2
[PROOF STEP]
using Nil
[PROOF STATE]
proof (prove)
using this:
M1 = []

goal (1 subgoal):
 1. length (a # M1) * length M2 = length M2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (a # M1) * length M2 = length M2

goal (2 subgoals):
 1. M1 = [] \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
 2. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (a # M1) * length M2 = length M2

goal (2 subgoals):
 1. M1 = [] \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
 2. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "(a#M1)\<otimes>M2 = (vec_mat_Tensor a M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a # M1 \<otimes> M2 = vec_mat_Tensor a M2
[PROOF STEP]
using Nil Tensor.simps append.simps(1)
[PROOF STATE]
proof (prove)
using this:
M1 = []
[] \<otimes> ?xs = []
?x # ?xs \<otimes> ?ys = vec_mat_Tensor ?x ?ys @ (?xs \<otimes> ?ys)
[] @ ?ys = ?ys

goal (1 subgoal):
 1. a # M1 \<otimes> M2 = vec_mat_Tensor a M2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a # M1 \<otimes> M2 = vec_mat_Tensor a M2

goal (2 subgoals):
 1. M1 = [] \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
 2. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
length (a # M1) * length M2 = length M2
a # M1 \<otimes> M2 = vec_mat_Tensor a M2
[PROOF STEP]
have
        "(mat
            ((row_length M2)*(row_length (a#M1)))
            ((length (a # M1)) * (length M2))
               ((a#M1)\<otimes>M2))"
[PROOF STATE]
proof (prove)
using this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
length (a # M1) * length M2 = length M2
a # M1 \<otimes> M2 = vec_mat_Tensor a M2

goal (1 subgoal):
 1. mat (row_length M2 * row_length (a # M1)) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
length (a # M1) * length M2 = length M2
a # M1 \<otimes> M2 = vec_mat_Tensor a M2
row_length (a # M1) = length a

goal (1 subgoal):
 1. mat (row_length M2 * row_length (a # M1)) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length M2 * row_length (a # M1)) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal (2 subgoals):
 1. M1 = [] \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
 2. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length M2 * row_length (a # M1)) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat (row_length M2 * row_length (a # M1)) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal (1 subgoal):
 1. mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
case (Cons b N1)
[PROOF STATE]
proof (state)
this:
M1 = b # N1

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have 1:"x \<in> (set (a#M1)) \<longrightarrow> ((x=a) \<or> (x \<in> (set M1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set (a # M1) \<longrightarrow> x = a \<or> x \<in> set M1
[PROOF STEP]
using hd_set
[PROOF STATE]
proof (prove)
using this:
?x \<in> set (?a # ?M) \<Longrightarrow> ?x = ?a \<or> ?x \<in> set ?M

goal (1 subgoal):
 1. x \<in> set (a # M1) \<longrightarrow> x = a \<or> x \<in> set M1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (a # M1) \<longrightarrow> x = a \<or> x \<in> set M1

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "mat (row_length (a#M1)) (length (a#M1)) (a#M1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length (a # M1)) (length (a # M1)) (a # M1)
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2

goal (1 subgoal):
 1. mat (row_length (a # M1)) (length (a # M1)) (a # M1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1)

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1)
[PROOF STEP]
have "x\<in> (set (a#M1)) \<longrightarrow> (vec (row_length (a#M1)) x)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1)

goal (1 subgoal):
 1. x \<in> set (a # M1) \<longrightarrow> vec (row_length (a # M1)) x
[PROOF STEP]
using mat_def Ball_def
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1)) (length (a # M1)) (a # M1)
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))
Ball ?A ?P = (\<forall>x. x \<in> ?A \<longrightarrow> ?P x)

goal (1 subgoal):
 1. x \<in> set (a # M1) \<longrightarrow> vec (row_length (a # M1)) x
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
x \<in> set (a # M1) \<longrightarrow> vec (row_length (a # M1)) x

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (a # M1) \<longrightarrow> vec (row_length (a # M1)) x
[PROOF STEP]
have "x\<in> (set (a#M1))\<longrightarrow> (vec (length a) x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (a # M1) \<longrightarrow> vec (row_length (a # M1)) x

goal (1 subgoal):
 1. x \<in> set (a # M1) \<longrightarrow> vec (length a) x
[PROOF STEP]
using row_length_def  list.distinct(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> set (a # M1) \<longrightarrow> vec (row_length (a # M1)) x
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
[] \<noteq> ?x21.0 # ?x22.0

goal (1 subgoal):
 1. x \<in> set (a # M1) \<longrightarrow> vec (length a) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (a # M1) \<longrightarrow> vec (length a) x

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (a # M1) \<longrightarrow> x = a \<or> x \<in> set M1
x \<in> set (a # M1) \<longrightarrow> vec (length a) x
[PROOF STEP]
have "x\<in> (set M1)\<longrightarrow> (vec (length a) x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (a # M1) \<longrightarrow> x = a \<or> x \<in> set M1
x \<in> set (a # M1) \<longrightarrow> vec (length a) x

goal (1 subgoal):
 1. x \<in> set M1 \<longrightarrow> vec (length a) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set M1 \<longrightarrow> vec (length a) x

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> set M1 \<longrightarrow> vec (length a) x

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have " b \<in> (set M1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> set M1
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
M1 = b # N1

goal (1 subgoal):
 1. b \<in> set M1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> set M1

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> set M1 \<longrightarrow> vec (length a) x
b \<in> set M1
[PROOF STEP]
have "vec (length a) b"
[PROOF STATE]
proof (prove)
using this:
x \<in> set M1 \<longrightarrow> vec (length a) x
b \<in> set M1

goal (1 subgoal):
 1. vec (length a) b
[PROOF STEP]
using  Cons.prems in_set_member mat_def member_rec(1) vec_def
[PROOF STATE]
proof (prove)
using this:
x \<in> set M1 \<longrightarrow> vec (length a) x
b \<in> set M1
mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2
(?x \<in> set ?xs) = List.member ?xs ?x
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))
List.member (?x # ?xs) ?y = (?x = ?y \<or> List.member ?xs ?y)
vec ?n ?x = (length ?x = ?n)

goal (1 subgoal):
 1. vec (length a) b
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
vec (length a) b

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vec (length a) b
[PROOF STEP]
have "(length b) = (length a)"
[PROOF STATE]
proof (prove)
using this:
vec (length a) b

goal (1 subgoal):
 1. length b = length a
[PROOF STEP]
using vec_def vec_uniqueness
[PROOF STATE]
proof (prove)
using this:
vec (length a) b
vec ?n ?x = (length ?x = ?n)
\<lbrakk>vec ?m ?v; vec ?n ?v\<rbrakk> \<Longrightarrow> ?m = ?n

goal (1 subgoal):
 1. length b = length a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length b = length a

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length b = length a
[PROOF STEP]
have 2:"row_length M1 = (length a)"
[PROOF STATE]
proof (prove)
using this:
length b = length a

goal (1 subgoal):
 1. row_length M1 = length a
[PROOF STEP]
using row_length_def Cons
[PROOF STATE]
proof (prove)
using this:
length b = length a
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
M1 = b # N1

goal (1 subgoal):
 1. row_length M1 = length a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length M1 = length a

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row_length M1 = length a
[PROOF STEP]
have "mat
                    ((length a) * row_length M2)
                    (length M1 * length M2)
                                    (M1 \<otimes> M2)"
[PROOF STATE]
proof (prove)
using this:
row_length M1 = length a

goal (1 subgoal):
 1. mat (length a * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
[PROOF STEP]
using step2
[PROOF STATE]
proof (prove)
using this:
row_length M1 = length a
mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)

goal (1 subgoal):
 1. mat (length a * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (length a * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (length a * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
[PROOF STEP]
have "Ball (set (M1\<otimes>M2)) (vec ((length a)*(row_length M2))) "
[PROOF STATE]
proof (prove)
using this:
mat (length a * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)

goal (1 subgoal):
 1. Ball (set (M1 \<otimes> M2)) (vec (length a * row_length M2))
[PROOF STEP]
using mat_def
[PROOF STATE]
proof (prove)
using this:
mat (length a * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))

goal (1 subgoal):
 1. Ball (set (M1 \<otimes> M2)) (vec (length a * row_length M2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ball (set (M1 \<otimes> M2)) (vec (length a * row_length M2))

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
Ball (set (M1 \<otimes> M2)) (vec (length a * row_length M2))
[PROOF STEP]
have 3:
         "\<forall>x. x \<in> (set (M1 \<otimes> M2)) \<longrightarrow> (vec ((length a)*(row_length M2)) x)"
[PROOF STATE]
proof (prove)
using this:
Ball (set (M1 \<otimes> M2)) (vec (length a * row_length M2))

goal (1 subgoal):
 1. \<forall>x. x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
[PROOF STEP]
using Ball_def
[PROOF STATE]
proof (prove)
using this:
Ball (set (M1 \<otimes> M2)) (vec (length a * row_length M2))
Ball ?A ?P = (\<forall>x. x \<in> ?A \<longrightarrow> ?P x)

goal (1 subgoal):
 1. \<forall>x. x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "mat
              ((row_length M2)*(length a))
              (length M2)
                 (vec_mat_Tensor a M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
[PROOF STEP]
using well_defined_vec_mat_Tensor Cons.prems
[PROOF STATE]
proof (prove)
using this:
mat (row_length ?M) (length ?M) ?M \<Longrightarrow> mat (row_length ?M * length ?v) (length ?M) (vec_mat_Tensor ?v ?M)
mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2

goal (1 subgoal):
 1. mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
[PROOF STEP]
have "Ball
                    (set (vec_mat_Tensor a M2))
                    (vec ((row_length M2)*(length a)))"
[PROOF STATE]
proof (prove)
using this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)

goal (1 subgoal):
 1. Ball (set (vec_mat_Tensor a M2)) (vec (row_length M2 * length a))
[PROOF STEP]
using mat_def
[PROOF STATE]
proof (prove)
using this:
mat (row_length M2 * length a) (length M2) (vec_mat_Tensor a M2)
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))

goal (1 subgoal):
 1. Ball (set (vec_mat_Tensor a M2)) (vec (row_length M2 * length a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ball (set (vec_mat_Tensor a M2)) (vec (row_length M2 * length a))

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Ball (set (vec_mat_Tensor a M2)) (vec (row_length M2 * length a))
[PROOF STEP]
have 4:
              "\<forall>x. x \<in> (set (vec_mat_Tensor a M2))
                        \<longrightarrow> (vec ((length a)*(row_length M2)) x)"
[PROOF STATE]
proof (prove)
using this:
Ball (set (vec_mat_Tensor a M2)) (vec (row_length M2 * length a))

goal (1 subgoal):
 1. \<forall>x. x \<in> set (vec_mat_Tensor a M2) \<longrightarrow> vec (length a * row_length M2) x
[PROOF STEP]
using mult.commute
[PROOF STATE]
proof (prove)
using this:
Ball (set (vec_mat_Tensor a M2)) (vec (row_length M2 * length a))
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. \<forall>x. x \<in> set (vec_mat_Tensor a M2) \<longrightarrow> vec (length a * row_length M2) x
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> set (vec_mat_Tensor a M2) \<longrightarrow> vec (length a * row_length M2) x

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
\<forall>x. x \<in> set (vec_mat_Tensor a M2) \<longrightarrow> vec (length a * row_length M2) x
[PROOF STEP]
have 5: "\<forall>x. (x \<in> (set (vec_mat_Tensor a M2)))
                          \<or>(x \<in> (set (M1 \<otimes> M2)))
                                 \<longrightarrow> (vec ((length a)*(row_length M2)) x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
\<forall>x. x \<in> set (vec_mat_Tensor a M2) \<longrightarrow> vec (length a * row_length M2) x

goal (1 subgoal):
 1. \<forall>x. x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have 6:"(a # M1 \<otimes> M2) = (vec_mat_Tensor a M2)@(M1 \<otimes>M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a # M1 \<otimes> M2 = vec_mat_Tensor a M2 @ (M1 \<otimes> M2)
[PROOF STEP]
using Tensor.simps(2)
[PROOF STATE]
proof (prove)
using this:
?x # ?xs \<otimes> ?ys = vec_mat_Tensor ?x ?ys @ (?xs \<otimes> ?ys)

goal (1 subgoal):
 1. a # M1 \<otimes> M2 = vec_mat_Tensor a M2 @ (M1 \<otimes> M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a # M1 \<otimes> M2 = vec_mat_Tensor a M2 @ (M1 \<otimes> M2)

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a # M1 \<otimes> M2 = vec_mat_Tensor a M2 @ (M1 \<otimes> M2)
[PROOF STEP]
have "x \<in> (set (a # M1 \<otimes> M2))
                 \<longrightarrow> (x \<in> (set (vec_mat_Tensor a M2)))\<or>(x \<in> (set (M1 \<otimes> M2)))"
[PROOF STATE]
proof (prove)
using this:
a # M1 \<otimes> M2 = vec_mat_Tensor a M2 @ (M1 \<otimes> M2)

goal (1 subgoal):
 1. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2)
[PROOF STEP]
using set_def append_def
[PROOF STATE]
proof (prove)
using this:
a # M1 \<otimes> M2 = vec_mat_Tensor a M2 @ (M1 \<otimes> M2)
set \<equiv> ctor_fold_list (\<lambda>z. set1_pre_list z \<union> \<Union> (set2_pre_list z))
(@) \<equiv> rec_list (\<lambda>ys. ys) (\<lambda>x xs xsa ys. x # xsa ys)

goal (1 subgoal):
 1. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2)

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
with 5
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2)
[PROOF STEP]
have 7:"\<forall>x. (x \<in>  (set (a # M1 \<otimes> M2)))
                         \<longrightarrow> (vec ((length a)*(row_length M2)) x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> x \<in> set (vec_mat_Tensor a M2) \<or> x \<in> set (M1 \<otimes> M2)

goal (1 subgoal):
 1. \<forall>x. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
[PROOF STEP]
have 8:
        "Ball (set (a # M1 \<otimes> M2)) (vec ((row_length (a#M1))*(row_length M2)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x

goal (1 subgoal):
 1. Ball (set (a # M1 \<otimes> M2)) (vec (row_length (a # M1) * row_length M2))
[PROOF STEP]
using Ball_def 0
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
Ball ?A ?P = (\<forall>x. x \<in> ?A \<longrightarrow> ?P x)
row_length (a # M1) = length a

goal (1 subgoal):
 1. Ball (set (a # M1 \<otimes> M2)) (vec (row_length (a # M1) * row_length M2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ball (set (a # M1 \<otimes> M2)) (vec (row_length (a # M1) * row_length M2))

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
have "(length ((a#M1)\<otimes>M2)) = (length (a#M1))*(length M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (a # M1 \<otimes> M2) = length (a # M1) * length M2
[PROOF STEP]
using length_Tensor
[PROOF STATE]
proof (prove)
using this:
length (?M1.0 \<otimes> ?M2.0) = length ?M1.0 * length ?M2.0

goal (1 subgoal):
 1. length (a # M1 \<otimes> M2) = length (a # M1) * length M2
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
length (a # M1 \<otimes> M2) = length (a # M1) * length M2

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
with 7 8
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
Ball (set (a # M1 \<otimes> M2)) (vec (row_length (a # M1) * row_length M2))
length (a # M1 \<otimes> M2) = length (a # M1) * length M2
[PROOF STEP]
have "mat
                     (row_length (a # M1) * row_length M2)
                       (length (a # M1) * length M2)
                                (a # M1 \<otimes> M2)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
Ball (set (a # M1 \<otimes> M2)) (vec (row_length (a # M1) * row_length M2))
length (a # M1 \<otimes> M2) = length (a # M1) * length M2

goal (1 subgoal):
 1. mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
using mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set (a # M1 \<otimes> M2) \<longrightarrow> vec (length a * row_length M2) x
Ball (set (a # M1 \<otimes> M2)) (vec (row_length (a # M1) * row_length M2))
length (a # M1 \<otimes> M2) = length (a # M1) * length M2
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))

goal (1 subgoal):
 1. mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
by (metis "0"  length_Tensor)
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal (1 subgoal):
 1. \<And>aa list. M1 = aa # list \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal (1 subgoal):
 1. mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal (1 subgoal):
 1. \<And>a M1. \<lbrakk>mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<Longrightarrow> mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2); mat (row_length (a # M1)) (length (a # M1)) (a # M1) \<and> mat (row_length M2) (length M2) M2\<rbrakk> \<Longrightarrow> mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal (1 subgoal):
 1. mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M1) * row_length M2) (length (a # M1) * length M2) (a # M1 \<otimes> M2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_zero_iff [simp]: "(\<forall>u. inner x u = 0) \<longleftrightarrow> (x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>u. inner x u = 0) = (x = (0::'a))
[PROOF STEP]
by auto (use inner_eq_zero_iff in blast)


[STATEMENT]
lemma root_powr_inverse: "0 < n \<Longrightarrow> 0 < x \<Longrightarrow> root n x = x powr (1/n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> root n x = x powr (1 / real n)
[PROOF STEP]
by (rule real_root_pos_unique) (auto simp: powr_realpow[symmetric] powr_powr)


[STATEMENT]
lemma infsum_nonneg:
  fixes f :: "'a \<Rightarrow> 'b::{ordered_comm_monoid_add,linorder_topology}"
  assumes "\<And>x. x \<in> M \<Longrightarrow> 0 \<le> f x"
  shows "infsum f M \<ge> 0" (is "?lhs \<ge> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'b) \<le> infsum f M
[PROOF STEP]
apply (cases \<open>f summable_on M\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f summable_on M \<Longrightarrow> (0::'b) \<le> infsum f M
 2. \<not> f summable_on M \<Longrightarrow> (0::'b) \<le> infsum f M
[PROOF STEP]
apply (metis assms infsum_0_simp summable_on_0_simp infsum_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> f summable_on M \<Longrightarrow> (0::'b) \<le> infsum f M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> M \<Longrightarrow> (0::'b) \<le> f ?x

goal (1 subgoal):
 1. \<not> f summable_on M \<Longrightarrow> (0::'b) \<le> infsum f M
[PROOF STEP]
by (auto simp add: infsum_not_exists)


[STATEMENT]
lemma winding_number_zero:
  assumes "simply_connected S"
  shows "connected S \<and>
         (\<forall>\<gamma> z. path \<gamma> \<and> path_image \<gamma> \<subseteq> S \<and>
                   pathfinish \<gamma> = pathstart \<gamma> \<and> z \<notin> S \<longrightarrow> winding_number \<gamma> z = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected S \<and> (\<forall>\<gamma> z. path \<gamma> \<and> path_image \<gamma> \<subseteq> S \<and> pathfinish \<gamma> = pathstart \<gamma> \<and> z \<notin> S \<longrightarrow> winding_number \<gamma> z = 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
simply_connected S

goal (1 subgoal):
 1. connected S \<and> (\<forall>\<gamma> z. path \<gamma> \<and> path_image \<gamma> \<subseteq> S \<and> pathfinish \<gamma> = pathstart \<gamma> \<and> z \<notin> S \<longrightarrow> winding_number \<gamma> z = 0)
[PROOF STEP]
by (auto simp: simply_connected_imp_connected simply_connected_imp_winding_number_zero)


[STATEMENT]
lemma Singleton: "Elem x (Singleton y) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Elem x (Singleton y) = (x = y)
[PROOF STEP]
by (simp add: Singleton_def Upair)


[STATEMENT]
lemma Suc_n_minus_m_eq: "\<lbrakk> n\<ge>m; m>1 \<rbrakk> \<Longrightarrow> Suc (n - m) = n - (m - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n; 1 < m\<rbrakk> \<Longrightarrow> Suc (n - m) = n - (m - 1)
[PROOF STEP]
by simp


[STATEMENT]
lemma fds_converges_norm_iff [simp]:
  fixes s :: "'a :: {nat_power_normed_field,banach}"
  shows "fds_converges (fds_norm f) (s \<bullet> 1) \<longleftrightarrow> fds_abs_converges f s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_converges (fds_norm f) (s \<bullet> (1::'a)) = fds_abs_converges f s
[PROOF STEP]
unfolding fds_converges_def fds_abs_converges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. fds_nth (fds_norm f) n / nat_power n (s \<bullet> (1::'a))) = summable (\<lambda>n. norm (fds_nth f n / nat_power n s))
[PROOF STEP]
by (rule summable_cong [OF eventually_mono[OF eventually_gt_at_top[of 0]]])
     (simp add: fds_abs_converges_def fds_norm_def fds_nth_fds' norm_divide norm_nat_power)


[STATEMENT]
lemma norm_ket[simp]: "norm (ket i) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (ket i) = 1
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. ell2_norm (\<lambda>y. if i = y then 1 else 0) = 1
[PROOF STEP]
by (rule ell2_norm_ket)


[STATEMENT]
lemma eval_fds_truncate: "eval_fds (fds_truncate n f) s = (\<Sum>k=1..n. fds_nth f k / nat_power k s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)
[PROOF STEP]
have "eval_fds (fds_truncate n f) s = (\<Sum>k=1..n. fds_nth (fds_truncate n f) k / nat_power k s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth (fds_truncate n f) k / nat_power k s)
[PROOF STEP]
unfolding eval_fds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>na. fds_nth (fds_truncate n f) na / nat_power na s) = (\<Sum>k = 1..n. fds_nth (fds_truncate n f) k / nat_power k s)
[PROOF STEP]
by (intro suminf_finite) (auto simp: fds_nth_truncate Suc_le_eq)
[PROOF STATE]
proof (state)
this:
eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth (fds_truncate n f) k / nat_power k s)

goal (1 subgoal):
 1. eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth (fds_truncate n f) k / nat_power k s)

goal (1 subgoal):
 1. eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)
[PROOF STEP]
have "\<dots> = (\<Sum>k=1..n. fds_nth f k / nat_power k s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. fds_nth (fds_truncate n f) k / nat_power k s) = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)
[PROOF STEP]
by (intro sum.cong) (auto simp: fds_nth_truncate)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. fds_nth (fds_truncate n f) k / nat_power k s) = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)

goal (1 subgoal):
 1. eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)

goal (1 subgoal):
 1. eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
eval_fds (fds_truncate n f) s = (\<Sum>k = 1..n. fds_nth f k / nat_power k s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inc_matrix_elems_max_two: "card (elements_mat (inc_mat_of Vs Bs)) \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (elements_mat (inc_mat_of Vs Bs)) \<le> 2
[PROOF STEP]
using inc_mat_one_zero_elems order_trans card_2_iff
[PROOF STATE]
proof (prove)
using this:
elements_mat (inc_mat_of ?Vs ?Bs) \<subseteq> {0::?'a, 1::?'a}
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z
(card ?S = 2) = (\<exists>x y. ?S = {x, y} \<and> x \<noteq> y)

goal (1 subgoal):
 1. card (elements_mat (inc_mat_of Vs Bs)) \<le> 2
[PROOF STEP]
by (smt (verit, del_insts) antisym bot.extremum card.empty insert_commute insert_subsetI
      is_singletonI is_singleton_altdef linorder_le_cases not_one_le_zero one_le_numeral  subset_insert)


[STATEMENT]
lemma card_sumset_singleton_subset_eq:
  assumes "a \<in> G" and "A \<subseteq> G"
  shows "card (sumset {a} A) = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset {a} A) = card A
[PROOF STEP]
using assms card_sumset_singleton_eq card.infinite card_sumset_0_iff' le_iff_inf sumset_commute
[PROOF STATE]
proof (prove)
using this:
a \<in> G
A \<subseteq> G
finite ?A \<Longrightarrow> card (sumset ?A {?a}) = (if ?a \<in> G then card (?A \<inter> G) else 0)
infinite ?A \<Longrightarrow> card ?A = 0
(card (sumset ?A ?B) = 0) = (card (?A \<inter> G) = 0 \<or> card (?B \<inter> G) = 0)
(?x \<le> ?y) = (inf ?x ?y = ?x)
sumset ?A ?B = sumset ?B ?A

goal (1 subgoal):
 1. card (sumset {a} A) = card A
[PROOF STEP]
by metis


[STATEMENT]
theorem the1_equality': "P a \<Longrightarrow> \<exists>!x. P x \<Longrightarrow> (THE x. P x) = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P a; \<exists>!x. P x\<rbrakk> \<Longrightarrow> (THE x. P x) = a
[PROOF STEP]
by (simp add: the1_equality)


[STATEMENT]
lemma divisibility_congruence:
  assumes "m = k*l" and "b>2" "m>0"
  shows "\<alpha> b m mod (\<alpha> b k)^2 = ((-1)^(l-1)*l*(\<alpha> b k)*(\<alpha> b (k-1))^(l-1)) mod (\<alpha> b k)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> b m mod (\<alpha> b k)\<^sup>2 = (- 1) ^ (l - 1) * int l * \<alpha> b k * \<alpha> b (k - 1) ^ (l - 1) mod (\<alpha> b k)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<alpha> b m mod (\<alpha> b k)\<^sup>2 = (- 1) ^ (l - 1) * int l * \<alpha> b k * \<alpha> b (k - 1) ^ (l - 1) mod (\<alpha> b k)\<^sup>2
[PROOF STEP]
have S0: "\<alpha> b m = mat_21 (A b m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> b m = mat_21 (A b m)
[PROOF STEP]
by (metis A.elims assms(3) mat2.sel(3) neq0_conv)
[PROOF STATE]
proof (state)
this:
\<alpha> b m = mat_21 (A b m)

goal (1 subgoal):
 1. \<alpha> b m mod (\<alpha> b k)\<^sup>2 = (- 1) ^ (l - 1) * int l * \<alpha> b k * \<alpha> b (k - 1) ^ (l - 1) mod (\<alpha> b k)\<^sup>2
[PROOF STEP]
from assms S0 divisibility_equations
[PROOF STATE]
proof (chain)
picking this:
m = k * l
2 < b
0 < m
\<alpha> b m = mat_21 (A b m)
\<lbrakk>?m = ?k * ?l; 2 < ?b; 0 < ?m\<rbrakk> \<Longrightarrow> A ?b ?m = mat_pow ?l (mat_minus (mat_scalar_mult (\<alpha> ?b ?k) (B ?b)) (mat_scalar_mult (\<alpha> ?b (?k - 1)) ID))
[PROOF STEP]
have S1: "\<alpha> b m =
    mat_21 ( mat_pow l (mat_minus (mat_scalar_mult (\<alpha> b k) (B b))
                                        (mat_scalar_mult (\<alpha> b (k-1)) ID)))"
[PROOF STATE]
proof (prove)
using this:
m = k * l
2 < b
0 < m
\<alpha> b m = mat_21 (A b m)
\<lbrakk>?m = ?k * ?l; 2 < ?b; 0 < ?m\<rbrakk> \<Longrightarrow> A ?b ?m = mat_pow ?l (mat_minus (mat_scalar_mult (\<alpha> ?b ?k) (B ?b)) (mat_scalar_mult (\<alpha> ?b (?k - 1)) ID))

goal (1 subgoal):
 1. \<alpha> b m = mat_21 (mat_pow l (mat_minus (mat_scalar_mult (\<alpha> b k) (B b)) (mat_scalar_mult (\<alpha> b (k - 1)) ID)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<alpha> b m = mat_21 (mat_pow l (mat_minus (mat_scalar_mult (\<alpha> b k) (B b)) (mat_scalar_mult (\<alpha> b (k - 1)) ID)))

goal (1 subgoal):
 1. \<alpha> b m mod (\<alpha> b k)\<^sup>2 = (- 1) ^ (l - 1) * int l * \<alpha> b k * \<alpha> b (k - 1) ^ (l - 1) mod (\<alpha> b k)\<^sup>2
[PROOF STEP]
have S2: "mat_21 (B b) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_21 (B b) = 1
[PROOF STEP]
using Binomial.binomial_ring
[PROOF STATE]
proof (prove)
using this:
(?a + ?b) ^ ?n = (\<Sum>k\<le>?n. of_nat (?n choose k) * ?a ^ k * ?b ^ (?n - k))

goal (1 subgoal):
 1. mat_21 (B b) = 1
[PROOF STEP]
by (simp add: Exp_Matrices.B.simps)
[PROOF STATE]
proof (state)
this:
mat_21 (B b) = 1

goal (1 subgoal):
 1. \<alpha> b m mod (\<alpha> b k)\<^sup>2 = (- 1) ^ (l - 1) * int l * \<alpha> b k * \<alpha> b (k - 1) ^ (l - 1) mod (\<alpha> b k)\<^sup>2
[PROOF STEP]
have S3: "mat_22 (B b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_22 (B b) = 0
[PROOF STEP]
by (simp add: Exp_Matrices.B.simps)
[PROOF STATE]
proof (state)
this:
mat_22 (B b) = 0

goal (1 subgoal):
 1. \<alpha> b m mod (\<alpha> b k)\<^sup>2 = (- 1) ^ (l - 1) * int l * \<alpha> b k * \<alpha> b (k - 1) ^ (l - 1) mod (\<alpha> b k)\<^sup>2
[PROOF STEP]
from S1 S2 S3 divisibility_cong
[PROOF STATE]
proof (chain)
picking this:
\<alpha> b m = mat_21 (mat_pow l (mat_minus (mat_scalar_mult (\<alpha> b k) (B b)) (mat_scalar_mult (\<alpha> b (k - 1)) ID)))
mat_21 (B b) = 1
mat_22 (B b) = 0
\<lbrakk>mat_22 ?M = 0; mat_21 ?M = 1\<rbrakk> \<Longrightarrow> mat_21 (mat_pow ?l (mat_minus (mat_scalar_mult ?e ?M) (mat_scalar_mult ?f ID))) mod ?e\<^sup>2 = (- 1) ^ (?l - 1) * int ?l * ?e * ?f ^ (?l - 1) * mat_21 ?M mod ?e\<^sup>2 \<and> mat_22 (mat_pow ?l (mat_minus (mat_scalar_mult ?e ?M) (mat_scalar_mult ?f ID))) mod ?e\<^sup>2 = (- 1) ^ ?l * ?f ^ ?l mod ?e\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<alpha> b m = mat_21 (mat_pow l (mat_minus (mat_scalar_mult (\<alpha> b k) (B b)) (mat_scalar_mult (\<alpha> b (k - 1)) ID)))
mat_21 (B b) = 1
mat_22 (B b) = 0
\<lbrakk>mat_22 ?M = 0; mat_21 ?M = 1\<rbrakk> \<Longrightarrow> mat_21 (mat_pow ?l (mat_minus (mat_scalar_mult ?e ?M) (mat_scalar_mult ?f ID))) mod ?e\<^sup>2 = (- 1) ^ (?l - 1) * int ?l * ?e * ?f ^ (?l - 1) * mat_21 ?M mod ?e\<^sup>2 \<and> mat_22 (mat_pow ?l (mat_minus (mat_scalar_mult ?e ?M) (mat_scalar_mult ?f ID))) mod ?e\<^sup>2 = (- 1) ^ ?l * ?f ^ ?l mod ?e\<^sup>2

goal (1 subgoal):
 1. \<alpha> b m mod (\<alpha> b k)\<^sup>2 = (- 1) ^ (l - 1) * int l * \<alpha> b k * \<alpha> b (k - 1) ^ (l - 1) mod (\<alpha> b k)\<^sup>2
[PROOF STEP]
by (metis mult.right_neutral)
[PROOF STATE]
proof (state)
this:
\<alpha> b m mod (\<alpha> b k)\<^sup>2 = (- 1) ^ (l - 1) * int l * \<alpha> b k * \<alpha> b (k - 1) ^ (l - 1) mod (\<alpha> b k)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma selberg_aux:
  "(\<chi> n. of_real ((ln n)\<^sup>2)) * fds moebius_mu =
     (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt :: 'a :: {comm_ring_1,real_algebra_1} fds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
have "(\<chi> n. of_real (ln (real n) ^ 2)) = fds_deriv (fds_deriv fds_zeta :: 'a fds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>n. of_real ((ln (real n))\<^sup>2)) = fds_deriv (fds_deriv fds_zeta)
[PROOF STEP]
by (rule fds_eqI) (simp add: fds_nth_fds fds_nth_deriv power2_eq_square scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
(\<chi>n. of_real ((ln (real n))\<^sup>2)) = fds_deriv (fds_deriv fds_zeta)

goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<chi>n. of_real ((ln (real n))\<^sup>2)) = fds_deriv (fds_deriv fds_zeta)

goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
have "\<dots> = (fds mangoldt ^ 2 - fds_deriv (fds mangoldt)) * fds_zeta"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_deriv (fds_deriv fds_zeta) = ((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * fds_zeta
[PROOF STEP]
by (simp add: fds_deriv_zeta algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
fds_deriv (fds_deriv fds_zeta) = ((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * fds_zeta

goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds_deriv (fds_deriv fds_zeta) = ((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * fds_zeta

goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
have "\<dots> * fds moebius_mu = ((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) *
                                      (fds_zeta * fds moebius_mu)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * fds_zeta * fds moebius_mu = ((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * (fds_zeta * fds moebius_mu)
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * fds_zeta * fds moebius_mu = ((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * (fds_zeta * fds moebius_mu)

goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * fds_zeta * fds moebius_mu = ((fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)) * (fds_zeta * fds moebius_mu)

goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
have "fds_zeta * fds moebius_mu = (1 :: 'a fds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_zeta * fds moebius_mu = 1
[PROOF STEP]
by (fact fds_zeta_times_moebius_mu)
[PROOF STATE]
proof (state)
this:
fds_zeta * fds moebius_mu = 1

goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<chi>n. of_real ((ln (real n))\<^sup>2)) * (\<chi>a. moebius_mu a) = ((\<chi>a. mangoldt a)\<^sup>2 - fds_deriv (\<chi>a. mangoldt a)) * 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<chi>n. of_real ((ln (real n))\<^sup>2)) * (\<chi>a. moebius_mu a) = ((\<chi>a. mangoldt a)\<^sup>2 - fds_deriv (\<chi>a. mangoldt a)) * 1

goal (1 subgoal):
 1. (\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<chi>x. of_real ((ln (real x))\<^sup>2)) * fds moebius_mu = (fds mangoldt)\<^sup>2 - fds_deriv (fds mangoldt)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_member: "finite (Collect (RBT_Set2.member (t :: 'a set_rbt)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Collect (member t))
[PROOF STEP]
by transfer (simp add: rbt_comps linorder.finite_dom_rbt_lookup[OF set_linorder])


[STATEMENT]
lemma add_periodic_arithmetic:
  fixes f g :: "nat \<Rightarrow> complex"
  assumes "periodic_arithmetic f k"
  assumes "periodic_arithmetic g k"
  shows "periodic_arithmetic (\<lambda>n. f n + g n) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. periodic_arithmetic (\<lambda>n. f n + g n) k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
periodic_arithmetic f k
periodic_arithmetic g k

goal (1 subgoal):
 1. periodic_arithmetic (\<lambda>n. f n + g n) k
[PROOF STEP]
unfolding periodic_arithmetic_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. f (n + k) = f n
\<forall>n. g (n + k) = g n

goal (1 subgoal):
 1. \<forall>n. f (n + k) + g (n + k) = f n + g n
[PROOF STEP]
by simp


[STATEMENT]
lemma hyperdual_power_simps [simp]:
  shows "Base ((x :: 'a :: comm_ring_1 hyperdual) ^ n) = Base x ^ n"
    and "Eps1 ((x :: 'a :: comm_ring_1 hyperdual) ^ n) = Eps1 x * of_nat n * (Base x) ^ (n - 1)"
    and "Eps2 ((x :: 'a :: comm_ring_1 hyperdual) ^ n) = Eps2 x * of_nat n * (Base x) ^ (n - 1)"
    and "Eps12 ((x :: 'a :: comm_ring_1 hyperdual) ^ n) =
  (Eps12 x * of_nat n * (Base x) ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * (Base x) ^ (n - 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Base (x ^ n) = Base x ^ n &&& Eps1 (x ^ n) = Eps1 x * of_nat n * Base x ^ (n - 1)) &&& Eps2 (x ^ n) = Eps2 x * of_nat n * Base x ^ (n - 1) &&& Eps12 (x ^ n) = Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2)
[PROOF STEP]
by (simp_all add: hyperdual_power)


[STATEMENT]
lemma sum_of_powers: "0 < k \<Longrightarrow> (k - 1) * (\<Sum>i=0..<n. k^i) = k^n - 1"
  for k :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> (k - 1) * sum ((^) k) {0..<n} = k ^ n - 1
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma coprime_bezout_coefficients:
  assumes cop: "coprime f g"
    and ext: "bezout_coefficients f g = (a, b)"
  shows "a * f + b * g = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * f + b * g = (1::'a)
[PROOF STEP]
using assms bezout_coefficients [of f g a b]
[PROOF STATE]
proof (prove)
using this:
comm_monoid_mult_class.coprime f g
bezout_coefficients f g = (a, b)
bezout_coefficients f g = (a, b) \<Longrightarrow> a * f + b * g = gcd f g

goal (1 subgoal):
 1. a * f + b * g = (1::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma in_path_image_part_circlepath:
  assumes "w \<in> path_image(part_circlepath z r s t)" "s \<le> t" "0 \<le> r"
    shows "norm(w - z) = r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (w - z) = r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (w - z) = r
[PROOF STEP]
have "w \<in> {c. dist z c = r}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<in> {c. dist z c = r}
[PROOF STEP]
by (metis (no_types) path_image_part_circlepath_subset sphere_def subset_eq assms)
[PROOF STATE]
proof (state)
this:
w \<in> {c. dist z c = r}

goal (1 subgoal):
 1. cmod (w - z) = r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
w \<in> {c. dist z c = r}

goal (1 subgoal):
 1. cmod (w - z) = r
[PROOF STEP]
by (simp add: dist_norm norm_minus_commute)
[PROOF STATE]
proof (state)
this:
cmod (w - z) = r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nprt_move_matrix: "nprt (move_matrix (A::('a::lattice_ring) matrix) j i) = move_matrix (nprt A) j i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprt (move_matrix A j i) = move_matrix (nprt A) j i
[PROOF STEP]
apply (simp add: nprt_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf (move_matrix A j i) 0 = move_matrix (inf A 0) j i
[PROOF STEP]
apply (simp add: inf_matrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. combine_matrix inf (move_matrix A j i) 0 = move_matrix (combine_matrix inf A 0) j i
[PROOF STEP]
apply (simp add: Rep_matrix_inject[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (combine_matrix inf (move_matrix A j i) 0) = Rep_matrix (move_matrix (combine_matrix inf A 0) j i)
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. Rep_matrix (combine_matrix inf (move_matrix A j i) 0) x xa = Rep_matrix (move_matrix (combine_matrix inf A 0) j i) x xa
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prime_imp_fermat_liar:
  "prime p \<Longrightarrow> a \<in> {1 ..< p} \<Longrightarrow> fermat_liar a p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; a \<in> {1..<p}\<rbrakk> \<Longrightarrow> fermat_liar a p
[PROOF STEP]
unfolding fermat_liar_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; a \<in> {1..<p}\<rbrakk> \<Longrightarrow> [a ^ (p - 1) = 1] (mod p)
[PROOF STEP]
using fermat_theorem and nat_dvd_not_less
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime ?p; \<not> ?p dvd ?a\<rbrakk> \<Longrightarrow> [?a ^ (?p - 1) = 1] (mod ?p)
\<lbrakk>0 < ?m; ?m < ?n\<rbrakk> \<Longrightarrow> \<not> ?n dvd ?m

goal (1 subgoal):
 1. \<lbrakk>prime p; a \<in> {1..<p}\<rbrakk> \<Longrightarrow> [a ^ (p - 1) = 1] (mod p)
[PROOF STEP]
by simp


[STATEMENT]
lemma nn_integral_count_space_nat:
  fixes f :: "nat \<Rightarrow> ennreal"
  shows "(\<integral>\<^sup>+i. f i \<partial>count_space UNIV) = (\<Sum>i. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV) f = (\<Sum>i. f i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV) f = (\<Sum>i. f i)
[PROOF STEP]
have "(\<integral>\<^sup>+i. f i \<partial>count_space UNIV) =
    (\<integral>\<^sup>+i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV) f = \<integral>\<^sup>+ i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV
[PROOF STEP]
proof (intro nn_integral_cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> space (count_space UNIV) \<Longrightarrow> f x = (\<Sum>j. f j * indicator {j} x)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> space (count_space UNIV) \<Longrightarrow> f x = (\<Sum>j. f j * indicator {j} x)
[PROOF STEP]
have "f i = (\<Sum>j\<in>{i}. f j * indicator {j} i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i = (\<Sum>j\<in>{i}. f j * indicator {j} i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f i = (\<Sum>j\<in>{i}. f j * indicator {j} i)

goal (1 subgoal):
 1. \<And>x. x \<in> space (count_space UNIV) \<Longrightarrow> f x = (\<Sum>j. f j * indicator {j} x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f i = (\<Sum>j\<in>{i}. f j * indicator {j} i)

goal (1 subgoal):
 1. \<And>x. x \<in> space (count_space UNIV) \<Longrightarrow> f x = (\<Sum>j. f j * indicator {j} x)
[PROOF STEP]
have "\<dots> = (\<Sum>j. f j * indicator {j} i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>{i}. f j * indicator {j} i) = (\<Sum>j. f j * indicator {j} i)
[PROOF STEP]
by (rule suminf_finite[symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>{i}. f j * indicator {j} i) = (\<Sum>j. f j * indicator {j} i)

goal (1 subgoal):
 1. \<And>x. x \<in> space (count_space UNIV) \<Longrightarrow> f x = (\<Sum>j. f j * indicator {j} x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f i = (\<Sum>j. f j * indicator {j} i)
[PROOF STEP]
show "f i = (\<Sum>j. f j * indicator {j} i)"
[PROOF STATE]
proof (prove)
using this:
f i = (\<Sum>j. f j * indicator {j} i)

goal (1 subgoal):
 1. f i = (\<Sum>j. f j * indicator {j} i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f i = (\<Sum>j. f j * indicator {j} i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space UNIV) f = \<integral>\<^sup>+ i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV

goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV) f = (\<Sum>i. f i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space UNIV) f = \<integral>\<^sup>+ i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV

goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV) f = (\<Sum>i. f i)
[PROOF STEP]
have "\<dots> = (\<Sum>j. (\<integral>\<^sup>+i. f j * indicator {j} i \<partial>count_space UNIV))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV = (\<Sum>j. \<integral>\<^sup>+ i. f j * indicator {j} i \<partial>count_space UNIV)
[PROOF STEP]
by (rule nn_integral_suminf) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV = (\<Sum>j. \<integral>\<^sup>+ i. f j * indicator {j} i \<partial>count_space UNIV)

goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV) f = (\<Sum>i. f i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>N (count_space UNIV) f = (\<Sum>j. \<integral>\<^sup>+ i. f j * indicator {j} i \<partial>count_space UNIV)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N (count_space UNIV) f = (\<Sum>j. \<integral>\<^sup>+ i. f j * indicator {j} i \<partial>count_space UNIV)

goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV) f = (\<Sum>i. f i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space UNIV) f = (\<Sum>i. f i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_cnj: "cnj (poly p z) = poly (map_poly cnj p) (cnj z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (poly p z) = poly (map_poly cnj p) (cnj z)
[PROOF STEP]
by (simp add: poly_altdef degree_map_poly coeff_map_poly)


[STATEMENT]
lemma adjust_preserves_span:
  assumes w[simp]: "(w :: 'a vec) : carrier_vec n"
    and us: "set (us :: 'a vec list) \<subseteq> carrier_vec n"
    and dist: "distinct us"
  shows "w : span (set us) \<longleftrightarrow> adjuster n w us + w : span (set us)"
    (is "_ \<longleftrightarrow> ?v + _ : _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w \<in> local.span (set us)) = (adjuster n w us + w \<in> local.span (set us))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (w \<in> local.span (set us)) = (adjuster n w us + w \<in> local.span (set us))
[PROOF STEP]
have "?v : span (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set us)
[PROOF STEP]
using adjuster_lincomb[OF assms]
[PROOF STATE]
proof (prove)
using this:
adjuster n w us = lincomb (\<lambda>u. - (w \<bullet>c u) / (u \<bullet>c u)) (set us)

goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set us)
[PROOF STEP]
unfolding finite_span[OF finite_set us]
[PROOF STATE]
proof (prove)
using this:
adjuster n w us = lincomb (\<lambda>u. - (w \<bullet>c u) / (u \<bullet>c u)) (set us)

goal (1 subgoal):
 1. adjuster n w us \<in> {uu_. \<exists>a. uu_ = lincomb a (set us)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us \<in> local.span (set us)

goal (1 subgoal):
 1. (w \<in> local.span (set us)) = (adjuster n w us + w \<in> local.span (set us))
[PROOF STEP]
hence [simp]: "?v : carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us \<in> local.span (set us)

goal (1 subgoal):
 1. adjuster n w us \<in> carrier_vec n
[PROOF STEP]
using span_closed[OF us]
[PROOF STATE]
proof (prove)
using this:
adjuster n w us \<in> local.span (set us)
?v \<in> local.span (set us) \<Longrightarrow> ?v \<in> carrier_vec n

goal (1 subgoal):
 1. adjuster n w us \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us \<in> carrier_vec n

goal (1 subgoal):
 1. (w \<in> local.span (set us)) = (adjuster n w us + w \<in> local.span (set us))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w \<in> local.span (set us)) = (adjuster n w us + w \<in> local.span (set us))
[PROOF STEP]
using span_add[OF us adjuster_in_span[OF w us] w] comm_add_vec[OF w] dist
[PROOF STATE]
proof (prove)
using this:
distinct us \<Longrightarrow> (w \<in> local.span (set us)) = (adjuster n w us + w \<in> local.span (set us))
?v\<^sub>2 \<in> carrier_vec n \<Longrightarrow> w + ?v\<^sub>2 = ?v\<^sub>2 + w
distinct us

goal (1 subgoal):
 1. (w \<in> local.span (set us)) = (adjuster n w us + w \<in> local.span (set us))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(w \<in> local.span (set us)) = (adjuster n w us + w \<in> local.span (set us))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiset_prod_fact_insert:
  "(\<Prod>y\<in>set_mset (A+{#x#}). fact (count (A+{#x#}) y)) =
     (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
have "(\<Prod>y\<in>set_mset (A+{#x#}). fact (count (A+{#x#}) y)) =
          (\<Prod>y\<in>set_mset (A+{#x#}). (if y = x then count A x + 1 else 1) * fact (count A y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (\<Prod>y\<in>set_mset (A + {#x#}). (if y = x then count A x + 1 else 1) * fact (count A y))
[PROOF STEP]
by (intro prod.cong) simp_all
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (\<Prod>y\<in>set_mset (A + {#x#}). (if y = x then count A x + 1 else 1) * fact (count A y))

goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (\<Prod>y\<in>set_mset (A + {#x#}). (if y = x then count A x + 1 else 1) * fact (count A y))

goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
have "\<dots> = (count A x + 1) * (\<Prod>y\<in>set_mset (A+{#x#}). fact (count A y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). (if y = x then count A x + 1 else 1) * fact (count A y)) = (count A x + 1) * (\<Prod>y\<in>set_mset (A + {#x#}). fact (count A y))
[PROOF STEP]
by (simp add: prod.distrib)
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). (if y = x then count A x + 1 else 1) * fact (count A y)) = (count A x + 1) * (\<Prod>y\<in>set_mset (A + {#x#}). fact (count A y))

goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). (if y = x then count A x + 1 else 1) * fact (count A y)) = (count A x + 1) * (\<Prod>y\<in>set_mset (A + {#x#}). fact (count A y))

goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
have "(\<Prod>y\<in>set_mset (A+{#x#}). fact (count A y)) = (\<Prod>y\<in>set_mset A. fact (count A y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count A y)) = (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
by (intro prod.mono_neutral_right) (auto simp: not_in_iff)
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count A y)) = (\<Prod>y\<in>set_mset A. fact (count A y))

goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))

goal (1 subgoal):
 1. (\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_list_ge:
  fixes xs::"nat list"
  assumes "\<forall> x \<in> set xs . x \<ge> 1"
  shows "prod_list xs \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> prod_list xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set xs. 1 \<le> x

goal (1 subgoal):
 1. 1 \<le> prod_list xs
[PROOF STEP]
by (induction xs) auto


[STATEMENT]
lemma admissible_iff [cont_intro, simp]:
  "\<lbrakk> ccpo.admissible lub ord (\<lambda>x. P x \<longrightarrow> Q x); ccpo.admissible lub ord (\<lambda>x. Q x \<longrightarrow> P x) \<rbrakk>
  \<Longrightarrow> ccpo.admissible lub ord (\<lambda>x. P x \<longleftrightarrow> Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ccpo.admissible lub ord (\<lambda>x. P x \<longrightarrow> Q x); ccpo.admissible lub ord (\<lambda>x. Q x \<longrightarrow> P x)\<rbrakk> \<Longrightarrow> ccpo.admissible lub ord (\<lambda>x. P x = Q x)
[PROOF STEP]
by(subst iff_conv_conj_imp)(rule admissible_conj)


[STATEMENT]
lemma Carmichael_4 [simp]: "Carmichael 4 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael 4 = 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Carmichael 4 = 2
[PROOF STEP]
have "Carmichael 4 dvd 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael 4 dvd 2
[PROOF STEP]
using Carmichael_dvd_totient[of 4]
[PROOF STATE]
proof (prove)
using this:
Carmichael 4 dvd totient 4

goal (1 subgoal):
 1. Carmichael 4 dvd 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Carmichael 4 dvd 2

goal (1 subgoal):
 1. Carmichael 4 = 2
[PROOF STEP]
hence "Carmichael 4 \<le> 2"
[PROOF STATE]
proof (prove)
using this:
Carmichael 4 dvd 2

goal (1 subgoal):
 1. Carmichael 4 \<le> 2
[PROOF STEP]
by (rule dvd_imp_le) auto
[PROOF STATE]
proof (state)
this:
Carmichael 4 \<le> 2

goal (1 subgoal):
 1. Carmichael 4 = 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Carmichael 4 \<le> 2

goal (1 subgoal):
 1. Carmichael 4 = 2
[PROOF STEP]
have "Carmichael 4 \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael 4 \<noteq> 1
[PROOF STEP]
using power_Carmichael_eq_1[of "4::nat" 3]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < 4; coprime 4 3\<rbrakk> \<Longrightarrow> [3 ^ Carmichael 4 = 1] (mod 4)

goal (1 subgoal):
 1. Carmichael 4 \<noteq> 1
[PROOF STEP]
unfolding coprime_iff_gcd_eq_1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < 4; gcd 4 3 = 1\<rbrakk> \<Longrightarrow> [3 ^ Carmichael 4 = 1] (mod 4)

goal (1 subgoal):
 1. Carmichael 4 \<noteq> 1
[PROOF STEP]
by (auto simp: gcd_non_0_nat cong_def)
[PROOF STATE]
proof (state)
this:
Carmichael 4 \<noteq> 1

goal (1 subgoal):
 1. Carmichael 4 = 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Carmichael 4 \<le> 2
Carmichael 4 \<noteq> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Carmichael 4 \<le> 2
Carmichael 4 \<noteq> 1

goal (1 subgoal):
 1. Carmichael 4 = 2
[PROOF STEP]
using Carmichael_pos[of 4]
[PROOF STATE]
proof (prove)
using this:
Carmichael 4 \<le> 2
Carmichael 4 \<noteq> 1
0 < Carmichael 4

goal (1 subgoal):
 1. Carmichael 4 = 2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
Carmichael 4 = 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gval_fold_gOr_map:
  "gval (fold gOr l (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) l) (false)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gval (fold gOr l (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) l) false
[PROOF STEP]
proof(induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. gval (fold gOr [] (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) []) false
 2. \<And>a l. gval (fold gOr l (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) l) false \<Longrightarrow> gval (fold gOr (a # l) (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) (a # l)) false
[PROOF STEP]
case (Cons a l)
[PROOF STATE]
proof (state)
this:
gval (fold gOr l (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) l) false

goal (2 subgoals):
 1. gval (fold gOr [] (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) []) false
 2. \<And>a l. gval (fold gOr l (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) l) false \<Longrightarrow> gval (fold gOr (a # l) (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) (a # l)) false
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
gval (fold gOr l (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) l) false
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
gval (fold gOr l (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) l) false

goal (1 subgoal):
 1. gval (fold gOr (a # l) (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) (a # l)) false
[PROOF STEP]
by (metis fold_maybe_or_cons gval_fold_gOr list.simps(9))
[PROOF STATE]
proof (state)
this:
gval (fold gOr (a # l) (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) (a # l)) false

goal (1 subgoal):
 1. gval (fold gOr [] (Bc False)) s = fold (\<or>?) (map (\<lambda>g. gval g s) []) false
[PROOF STEP]
qed auto


[STATEMENT]
lemma nonempty_set_star_has_least_lemma:
  "\<exists>n\<in>S. \<forall>m\<in>S. n \<le> m" if "S \<noteq> {}" for S :: "nat set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n\<in>S. \<forall>m\<in>S. n \<le> m
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>m\<in>S. ?n \<le> m
 2. ?n \<in> S
[PROOF STEP]
show "\<forall>m\<in>S. (LEAST n. n \<in> S) \<le> m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m\<in>S. (LEAST n. n \<in> S) \<le> m
[PROOF STEP]
by (simp add: Least_le)
[PROOF STATE]
proof (state)
this:
\<forall>m\<in>S. (LEAST n. n \<in> S) \<le> m

goal (1 subgoal):
 1. (LEAST n. n \<in> S) \<in> S
[PROOF STEP]
show "(LEAST n. n \<in> S) \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. n \<in> S) \<in> S
[PROOF STEP]
by (meson that LeastI_ex equals0I)
[PROOF STATE]
proof (state)
this:
(LEAST n. n \<in> S) \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_1_imp_less_3:
  "ln x = (1::real) \<Longrightarrow> x < 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
assume "ln x = 1"
[PROOF STATE]
proof (state)
this:
ln x = 1

goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln x = 1

goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
have "(1::real) \<le> ln (exp 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> ln (exp 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> ln (exp 1)

goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln x \<le> ln (exp 1)
[PROOF STEP]
have "ln x \<le> ln (exp 1)"
[PROOF STATE]
proof (prove)
using this:
ln x \<le> ln (exp 1)

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

goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
hence "x \<le> exp 1"
[PROOF STATE]
proof (prove)
using this:
ln x \<le> ln (exp 1)

goal (1 subgoal):
 1. x \<le> exp 1
[PROOF STEP]
by (cases "x > 0") (force simp del: ln_exp simp add: not_less intro: order.trans)+
[PROOF STATE]
proof (state)
this:
x \<le> exp 1

goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<le> exp 1

goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
have "... < 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp 1 < 3
[PROOF STEP]
by (rule exp_1_lt_3)
[PROOF STATE]
proof (state)
this:
exp 1 < 3

goal (1 subgoal):
 1. ln x = 1 \<Longrightarrow> x < 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x < 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x < 3

goal (1 subgoal):
 1. x < 3
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x < 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma numer_cf5_deriv:
  shows "(numer_cf5 has_field_derivative numer_cf5_deriv x) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (numer_cf5 has_real_derivative numer_cf5_deriv x) (at x)
[PROOF STEP]
unfolding numer_cf5_def numer_cf5_deriv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x ^ 5 + 30 * x ^ 4 + 420 * x ^ 3 + 3360 * x\<^sup>2 + 15120 * x + 30240) has_real_derivative 5 * x ^ 4 + 120 * x ^ 3 + 1260 * x\<^sup>2 + 6720 * x + 15120) (at x)
[PROOF STEP]
by (intro derivative_eq_intros | simp)+


[STATEMENT]
lemma path_component_disjoint:
   "disjnt (path_component_set S a) (path_component_set S b) \<longleftrightarrow>
    (a \<notin> path_component_set S b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjnt (path_component_set S a) (path_component_set S b) = (a \<notin> path_component_set S b)
[PROOF STEP]
unfolding disjnt_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. \<not> (x \<in> path_component_set S a \<and> x \<in> path_component_set S b)) = (a \<notin> path_component_set S b)
[PROOF STEP]
using path_component_sym path_component_trans
[PROOF STATE]
proof (prove)
using this:
path_component ?S ?x ?y \<Longrightarrow> path_component ?S ?y ?x
\<lbrakk>path_component ?S ?x ?y; path_component ?S ?y ?z\<rbrakk> \<Longrightarrow> path_component ?S ?x ?z

goal (1 subgoal):
 1. (\<forall>x. \<not> (x \<in> path_component_set S a \<and> x \<in> path_component_set S b)) = (a \<notin> path_component_set S b)
[PROOF STEP]
by blast


[STATEMENT]
lemma fls_base_factor_zero_iff: "fls_base_factor (f::'a::zero fls) = 0 \<longleftrightarrow> f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fls_base_factor f = 0) = (f = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fls_base_factor f = 0 \<Longrightarrow> f = 0
 2. f = 0 \<Longrightarrow> fls_base_factor f = 0
[PROOF STEP]
have "fls_shift (-fls_subdegree f) (fls_shift (fls_subdegree f) f) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_shift (- fls_subdegree f) (fls_shift (fls_subdegree f) f) = f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fls_shift (- fls_subdegree f) (fls_shift (fls_subdegree f) f) = f

goal (2 subgoals):
 1. fls_base_factor f = 0 \<Longrightarrow> f = 0
 2. f = 0 \<Longrightarrow> fls_base_factor f = 0
[PROOF STEP]
thus "fls_base_factor f = 0 \<Longrightarrow> f=0"
[PROOF STATE]
proof (prove)
using this:
fls_shift (- fls_subdegree f) (fls_shift (fls_subdegree f) f) = f

goal (1 subgoal):
 1. fls_base_factor f = 0 \<Longrightarrow> f = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fls_base_factor f = 0 \<Longrightarrow> f = 0

goal (1 subgoal):
 1. f = 0 \<Longrightarrow> fls_base_factor f = 0
[PROOF STEP]
qed simp


[STATEMENT]
lemma s''_s: "$s''^{m}_n = (1+i).^(1/m) * $s^{m}_n" if "m \<noteq> 0" for m::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $s''^{m}_n = (1 + i) .^ (1 / real m) * $s^{m}_n
[PROOF STEP]
unfolding acc_def acc_due_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) .^ (real (k + 1) / real m) / real m) = (1 + i) .^ (1 / real m) * (\<Sum>k<n * m. (1 + i) .^ (real k / real m) / real m)
[PROOF STEP]
by (simp add: sum_distrib_left add_divide_distrib powr_add)


[STATEMENT]
theorem exists_split: "(\<exists>x y. P x \<and> Q y) = ((\<exists>x. P x) \<and> (\<exists>y. Q y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x y. P x \<and> Q y) = ((\<exists>x. P x) \<and> (\<exists>y. Q y))
[PROOF STEP]
by simp


[STATEMENT]
lemma measure_lim_emb:
  "J \<subseteq> I \<Longrightarrow> finite J \<Longrightarrow> X \<in> sets (\<Pi>\<^sub>M i\<in>J. borel) \<Longrightarrow> measure lim (emb I J X) = measure (P J) X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>J \<subseteq> I; finite J; X \<in> sets (Pi\<^sub>M J (\<lambda>i. borel))\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure local.lim (emb I J X) = Sigma_Algebra.measure (P J) X
[PROOF STEP]
unfolding measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>J \<subseteq> I; finite J; X \<in> sets (Pi\<^sub>M J (\<lambda>i. borel))\<rbrakk> \<Longrightarrow> enn2real (emeasure local.lim (emb I J X)) = enn2real (emeasure (P J) X)
[PROOF STEP]
by (subst emeasure_lim_emb) auto


[STATEMENT]
lemma poly_fcompose:
   assumes "poly q2 x\<noteq>0"
   shows "poly (fcompose p q1 q2) x = poly p (poly q1 x/poly q2 x) * (poly q2 x)^(degree p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (fcompose p q1 q2) x = poly p (poly q1 x / poly q2 x) * poly q2 x ^ degree p
[PROOF STEP]
using fcompose_poly[OF assms] assms
[PROOF STATE]
proof (prove)
using this:
poly ?p (poly ?q1.0 x / poly q2 x) = poly (fcompose ?p ?q1.0 q2) x / poly (q2 ^ degree ?p) x
poly q2 x \<noteq> (0::'a)

goal (1 subgoal):
 1. poly (fcompose p q1 q2) x = poly p (poly q1 x / poly q2 x) * poly q2 x ^ degree p
[PROOF STEP]
by (auto simp add:field_simps)


[STATEMENT]
lemma simplex_furthest_le_exists:
  fixes S :: "('a::real_inner) set"
  shows "finite S \<Longrightarrow> \<forall>x\<in>(convex hull S). \<exists>y\<in>S. norm (x - a) \<le> norm (y - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> \<forall>x\<in>convex hull S. \<exists>y\<in>S. norm (x - a) \<le> norm (y - a)
[PROOF STEP]
using simplex_furthest_le[of S]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite S; S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. \<forall>x\<in>convex hull S. norm (x - ?a) \<le> norm (y - ?a)

goal (1 subgoal):
 1. finite S \<Longrightarrow> \<forall>x\<in>convex hull S. \<exists>y\<in>S. norm (x - a) \<le> norm (y - a)
[PROOF STEP]
by (cases "S = {}") auto


[STATEMENT]
lemma Hausdorff_space_sing_Inter_opens:
   "\<lbrakk>Hausdorff_space X; a \<in> topspace X\<rbrakk> \<Longrightarrow> \<Inter>{u. openin X u \<and> a \<in> u} = {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Hausdorff_space X; a \<in> topspace X\<rbrakk> \<Longrightarrow> \<Inter> {u. openin X u \<and> a \<in> u} = {a}
[PROOF STEP]
using Hausdorff_imp_t1_space t1_space_singleton_Inter_open
[PROOF STATE]
proof (prove)
using this:
Hausdorff_space ?X \<Longrightarrow> t1_space ?X
t1_space ?X = (\<forall>x\<in>topspace ?X. \<Inter> {U. openin ?X U \<and> x \<in> U} = {x})

goal (1 subgoal):
 1. \<lbrakk>Hausdorff_space X; a \<in> topspace X\<rbrakk> \<Longrightarrow> \<Inter> {u. openin X u \<and> a \<in> u} = {a}
[PROOF STEP]
by force


[STATEMENT]
lemma of_nat_diff_poly_mapping_nat:
  assumes "m \<ge> n"
  shows   "of_nat (m - n) = (of_nat m - of_nat n :: 'a :: monoid_add \<Rightarrow>\<^sub>0 nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (m - n) = of_nat m - of_nat n
[PROOF STEP]
by (auto intro!: poly_mapping_eqI simp: lookup_of_nat lookup_minus when_def)


[STATEMENT]
lemma homeomorphism_on_UNIV_sequentially:
  fixes f::"'a::{first_countable_topology, t2_space} \<Rightarrow> 'b::{first_countable_topology, t2_space}"
  assumes "\<And>x u. u \<longlonglongrightarrow> x \<longleftrightarrow> (\<lambda>n. f (u n)) \<longlonglongrightarrow> f x"
  shows "homeomorphism_on UNIV f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism_on UNIV f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?u \<longlonglongrightarrow> ?x = (\<lambda>n. f (?u n)) \<longlonglongrightarrow> f ?x

goal (1 subgoal):
 1. homeomorphism_on UNIV f
[PROOF STEP]
by (auto intro!: homeomorphism_on_sequentially)


[STATEMENT]
lemma (in bounded_lattice_bot) join_irreducible_def':
  "join_irreducible x = (x \<noteq> \<bottom> \<and> (\<forall> y z . x = y \<squnion> z \<longrightarrow> x = y \<or> x = z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. join_irreducible x = (x \<noteq> \<bottom> \<and> (\<forall>y z. x = y \<squnion> z \<longrightarrow> x = y \<or> x = z))
[PROOF STEP]
unfolding join_irreducible_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<noteq> \<bottom> \<and> (\<forall>y z. y < x \<longrightarrow> z < x \<longrightarrow> y \<squnion> z < x)) = (x \<noteq> \<bottom> \<and> (\<forall>y z. x = y \<squnion> z \<longrightarrow> x = y \<or> x = z))
[PROOF STEP]
by (metis
        nless_le
        sup.bounded_iff
        sup.cobounded1
        sup_ge2)


[STATEMENT]
lemma Gcd_fin_0_iff:
  "Gcd\<^sub>f\<^sub>i\<^sub>n A = 0 \<longleftrightarrow> A \<subseteq> {0} \<and> finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Gcd\<^sub>f\<^sub>i\<^sub>n A = (0::'a)) = (A \<subseteq> {0::'a} \<and> finite A)
[PROOF STEP]
by (induct A rule: infinite_finite_induct) simp_all


[STATEMENT]
lemma mem_Rep_preal_diff_iff:
  "r < s \<Longrightarrow>
       (z \<in> Rep_preal (s - r)) \<longleftrightarrow>
       (\<exists>x. 0 < x \<and> 0 < z \<and> x \<notin> Rep_preal r \<and> x + z \<in> Rep_preal s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r < s \<Longrightarrow> (z \<in> Rep_preal (s - r)) = (\<exists>x>0. 0 < z \<and> x \<notin> Rep_preal r \<and> x + z \<in> Rep_preal s)
[PROOF STEP]
apply (simp add: preal_diff_def mem_diff_set Rep_preal)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r < s \<Longrightarrow> (z \<in> diff_set (Rep_preal s) (Rep_preal r)) = (\<exists>x>0. 0 < z \<and> x \<notin> Rep_preal r \<and> x + z \<in> Rep_preal s)
[PROOF STEP]
apply (force simp: diff_set_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done