[STATEMENT]
lemma cindex_polyE_inverse_add_cross':
  fixes p q::"real poly"
  assumes "a < b" "poly p a\<noteq>0 \<or> poly q a\<noteq>0" "poly p b\<noteq>0 \<or> poly q b\<noteq>0"
  shows "cindex_polyE a b q p  + cindex_polyE a b p q = cross_alt p q a b / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
define g1 where "g1 = gcd p q"
[PROOF STATE]
proof (state)
this:
g1 = gcd p q

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
obtain p' q' where pq:"p=g1*p'" "q=g1*q'" and "coprime p' q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p' q'. \<lbrakk>p = g1 * p'; q = g1 * q'; coprime p' q'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding g1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p' q'. \<lbrakk>p = gcd p q * p'; q = gcd p q * q'; coprime p' q'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms(2) coprime_commute div_gcd_coprime dvd_mult_div_cancel gcd_dvd1
        gcd_dvd2 order_root)
[PROOF STATE]
proof (state)
this:
p = g1 * p'
q = g1 * q'
coprime p' q'

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have [simp]:"g1\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g1 \<noteq> 0
[PROOF STEP]
unfolding g1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd p q \<noteq> 0
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0 \<or> poly q a \<noteq> 0

goal (1 subgoal):
 1. gcd p q \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
g1 \<noteq> 0

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have "cindex_polyE a b q' p' + cindex_polyE a b p' q' = (cross_alt p' q' a b) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2
[PROOF STEP]
using cindex_polyE_inverse_add_cross[OF \<open>a<b\<close> \<open>coprime p' q'\<close>]
[PROOF STATE]
proof (prove)
using this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2

goal (1 subgoal):
 1. cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have "cindex_polyE a b p' q' = cindex_polyE a b p q "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b p' q' = cindex_polyE a b p q
[PROOF STEP]
unfolding pq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b p' q' = cindex_polyE a b (g1 * p') (g1 * q')
[PROOF STEP]
apply (subst cindex_polyE_mult_cancel)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g1 \<noteq> 0
 2. cindex_polyE a b p' q' = cindex_polyE a b p' q'
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
cindex_polyE a b p' q' = cindex_polyE a b p q

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_polyE a b p' q' = cindex_polyE a b p q

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have "cindex_polyE a b q' p' = cindex_polyE a b q p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q' p' = cindex_polyE a b q p
[PROOF STEP]
unfolding pq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q' p' = cindex_polyE a b (g1 * q') (g1 * p')
[PROOF STEP]
apply (subst cindex_polyE_mult_cancel)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g1 \<noteq> 0
 2. cindex_polyE a b q' p' = cindex_polyE a b q' p'
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q' p' = cindex_polyE a b q p

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q' p' = cindex_polyE a b q p

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have "cross_alt p' q' a b = cross_alt p q a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_alt p' q' a b = cross_alt p q a b
[PROOF STEP]
unfolding pq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_alt p' q' a b = cross_alt (g1 * p') (g1 * q') a b
[PROOF STEP]
apply (subst cross_alt_cancel)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. poly g1 a \<noteq> 0
 2. poly g1 b \<noteq> 0
 3. cross_alt p' q' a b = cross_alt p' q' a b
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly g1 a \<noteq> 0
[PROOF STEP]
using assms(2) g1_def poly_gcd_0_iff
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0 \<or> poly q a \<noteq> 0
g1 = gcd p q
(poly (gcd ?p ?q) ?x = (0::?'a)) = (poly ?p ?x = (0::?'a) \<and> poly ?q ?x = (0::?'a))

goal (1 subgoal):
 1. poly g1 a \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. poly g1 b \<noteq> 0
 2. cross_alt p' q' a b = cross_alt p' q' a b
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly g1 b \<noteq> 0
[PROOF STEP]
using assms(3) g1_def poly_gcd_0_iff
[PROOF STATE]
proof (prove)
using this:
poly p b \<noteq> 0 \<or> poly q b \<noteq> 0
g1 = gcd p q
(poly (gcd ?p ?q) ?x = (0::?'a)) = (poly ?p ?x = (0::?'a) \<and> poly ?q ?x = (0::?'a))

goal (1 subgoal):
 1. poly g1 b \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_alt p' q' a b = cross_alt p' q' a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cross_alt p' q' a b = cross_alt p q a b

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2
cindex_polyE a b p' q' = cindex_polyE a b p q
cindex_polyE a b q' p' = cindex_polyE a b q p
cross_alt p' q' a b = cross_alt p q a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2
cindex_polyE a b p' q' = cindex_polyE a b p q
cindex_polyE a b q' p' = cindex_polyE a b q p
cross_alt p' q' a b = cross_alt p q a b

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_length_mat:
    "(row_length (m1\<otimes>m2)) = (row_length m1)*(row_length m2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2
[PROOF STEP]
proof(induct m1)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. row_length ([] \<otimes> m2) = row_length [] * row_length m2
 2. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. row_length ([] \<otimes> m2) = row_length [] * row_length m2
 2. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
have "row_length ([]\<otimes>m2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length ([] \<otimes> m2) = 0
[PROOF STEP]
using Tensor.simps(1) row_length_def
[PROOF STATE]
proof (prove)
using this:
[] \<otimes> ?xs = []
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. row_length ([] \<otimes> m2) = 0
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
row_length ([] \<otimes> m2) = 0

goal (2 subgoals):
 1. row_length ([] \<otimes> m2) = row_length [] * row_length m2
 2. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
row_length ([] \<otimes> m2) = 0
[PROOF STEP]
have "row_length ([]\<otimes>m2) = (row_length [])*(row_length m2)"
[PROOF STATE]
proof (prove)
using this:
row_length ([] \<otimes> m2) = 0

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

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

goal (2 subgoals):
 1. row_length ([] \<otimes> m2) = row_length [] * row_length m2
 2. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row_length ([] \<otimes> m2) = row_length [] * row_length m2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
row_length ([] \<otimes> m2) = row_length [] * row_length m2

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

goal (1 subgoal):
 1. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
fix a m1
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
assume "row_length (m1 \<otimes> m2) = row_length m1 * row_length m2"
[PROOF STATE]
proof (state)
this:
row_length (m1 \<otimes> m2) = row_length m1 * row_length m2

goal (1 subgoal):
 1. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
let ?case =
    "row_length ((a # m1) \<otimes> m2) = row_length (a # m1) * row_length m2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
have B: "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. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
have "row_length ((a # m1) \<otimes> m2) = row_length (a # m1) * row_length m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
proof(induct m2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. row_length (a # m1 \<otimes> []) = row_length (a # m1) * row_length []
 2. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. row_length (a # m1 \<otimes> []) = row_length (a # m1) * row_length []
 2. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length (a # m1 \<otimes> []) = row_length (a # m1) * row_length []
[PROOF STEP]
using Tensor_null row_length_def  mult_0_right
[PROOF STATE]
proof (prove)
using this:
?xs \<otimes> [] = []
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
?m * 0 = 0

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

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
fix aa m2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
assume "row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2"
[PROOF STATE]
proof (state)
this:
row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
let ?case=
      "row_length (a # m1 \<otimes> aa # m2)
                  = row_length (a # m1) * row_length (aa # m2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
have "aa#m2 \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aa # m2 \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aa # m2 \<noteq> []

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
aa # m2 \<noteq> []
[PROOF STEP]
have non_zero:"(vec_mat_Tensor a (aa#m2)) \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
aa # m2 \<noteq> []

goal (1 subgoal):
 1. vec_mat_Tensor a (aa # m2) \<noteq> []
[PROOF STEP]
using vec_mat_Tensor_def
[PROOF STATE]
proof (prove)
using this:
aa # m2 \<noteq> []
vec_mat_Tensor \<equiv> \<lambda>uu uua. rec_list (\<lambda>xs. []) (\<lambda>ys yss yssa xs. vec_vec_Tensor xs ys # yssa xs) uua uu

goal (1 subgoal):
 1. vec_mat_Tensor a (aa # m2) \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_mat_Tensor a (aa # m2) \<noteq> []

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
vec_mat_Tensor a (aa # m2) \<noteq> []
[PROOF STEP]
have
            "hd ((vec_mat_Tensor a (aa#m2))@(m1\<otimes>m2))
                  = hd (vec_mat_Tensor a (aa#m2))"
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor a (aa # m2) \<noteq> []

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

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
hd (vec_mat_Tensor a (aa # m2) @ (m1 \<otimes> m2)) = hd (vec_mat_Tensor a (aa # m2))
[PROOF STEP]
have
            "hd ((a#m1)\<otimes>(aa#m2)) = hd (vec_mat_Tensor a (aa#m2))"
[PROOF STATE]
proof (prove)
using this:
hd (vec_mat_Tensor a (aa # m2) @ (m1 \<otimes> m2)) = hd (vec_mat_Tensor a (aa # m2))

goal (1 subgoal):
 1. hd (a # m1 \<otimes> aa # m2) = hd (vec_mat_Tensor a (aa # m2))
[PROOF STEP]
using Tensor.simps(2)
[PROOF STATE]
proof (prove)
using this:
hd (vec_mat_Tensor a (aa # m2) @ (m1 \<otimes> m2)) = hd (vec_mat_Tensor a (aa # m2))
?x # ?xs \<otimes> ?ys = vec_mat_Tensor ?x ?ys @ (?xs \<otimes> ?ys)

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

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
hd (a # m1 \<otimes> aa # m2) = hd (vec_mat_Tensor a (aa # m2))
[PROOF STEP]
have s1: "row_length ((a#m1)\<otimes>(aa#m2))
                       = row_length (vec_mat_Tensor a (aa#m2))"
[PROOF STATE]
proof (prove)
using this:
hd (a # m1 \<otimes> aa # m2) = hd (vec_mat_Tensor a (aa # m2))

goal (1 subgoal):
 1. row_length (a # m1 \<otimes> aa # m2) = row_length (vec_mat_Tensor a (aa # m2))
[PROOF STEP]
using row_length_def  Nil_is_append_conv non_zero Tensor.simps(2)
[PROOF STATE]
proof (prove)
using this:
hd (a # m1 \<otimes> aa # m2) = hd (vec_mat_Tensor a (aa # m2))
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
([] = ?xs @ ?ys) = (?xs = [] \<and> ?ys = [])
vec_mat_Tensor a (aa # m2) \<noteq> []
?x # ?xs \<otimes> ?ys = vec_mat_Tensor ?x ?ys @ (?xs \<otimes> ?ys)

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

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
have "row_length (vec_mat_Tensor a (aa#m2))
                    = (length a)*row_length(aa#m2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length (vec_mat_Tensor a (aa # m2)) = length a * row_length (aa # m2)
[PROOF STEP]
using row_length_vect_mat
[PROOF STATE]
proof (prove)
using this:
row_length (vec_mat_Tensor ?v ?m) = length ?v * row_length ?m

goal (1 subgoal):
 1. row_length (vec_mat_Tensor a (aa # m2)) = length a * row_length (aa # m2)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
row_length (vec_mat_Tensor a (aa # m2)) = length a * row_length (aa # m2)

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
from this and s1
[PROOF STATE]
proof (chain)
picking this:
row_length (vec_mat_Tensor a (aa # m2)) = length a * row_length (aa # m2)
row_length (a # m1 \<otimes> aa # m2) = row_length (vec_mat_Tensor a (aa # m2))
[PROOF STEP]
have "row_length (vec_mat_Tensor a (aa#m2))
                             = (length a)*row_length(aa#m2)"
[PROOF STATE]
proof (prove)
using this:
row_length (vec_mat_Tensor a (aa # m2)) = length a * row_length (aa # m2)
row_length (a # m1 \<otimes> aa # m2) = row_length (vec_mat_Tensor a (aa # m2))

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

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
from this and B
[PROOF STATE]
proof (chain)
picking this:
row_length (vec_mat_Tensor a (aa # m2)) = length a * row_length (aa # m2)
row_length (a # m1) = length a
[PROOF STEP]
have "row_length (vec_mat_Tensor a (aa#m2))
                           = (row_length (a#m1))*row_length(aa#m2)"
[PROOF STATE]
proof (prove)
using this:
row_length (vec_mat_Tensor a (aa # m2)) = length a * row_length (aa # m2)
row_length (a # m1) = length a

goal (1 subgoal):
 1. row_length (vec_mat_Tensor a (aa # m2)) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length (vec_mat_Tensor a (aa # m2)) = row_length (a # m1) * row_length (aa # m2)

goal (1 subgoal):
 1. \<And>aa m2. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
from this  and s1
[PROOF STATE]
proof (chain)
picking this:
row_length (vec_mat_Tensor a (aa # m2)) = row_length (a # m1) * row_length (aa # m2)
row_length (a # m1 \<otimes> aa # m2) = row_length (vec_mat_Tensor a (aa # m2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
row_length (vec_mat_Tensor a (aa # m2)) = row_length (a # m1) * row_length (aa # m2)
row_length (a # m1 \<otimes> aa # m2) = row_length (vec_mat_Tensor a (aa # m2))

goal (1 subgoal):
 1. row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length (a # m1 \<otimes> aa # m2) = row_length (a # m1) * row_length (aa # m2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2

goal (1 subgoal):
 1. \<And>a m1. row_length (m1 \<otimes> m2) = row_length m1 * row_length m2 \<Longrightarrow> row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2

goal (1 subgoal):
 1. row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length (a # m1 \<otimes> m2) = row_length (a # m1) * row_length m2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma op_norm_diag_mat_eq: "\<parallel>diag_mat f\<parallel>\<^sub>o\<^sub>p = Max {\<bar>f i\<bar> |i. i \<in> UNIV}" (is "_ = Max ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>diag_mat f\<parallel>\<^sub>o\<^sub>p = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
proof(unfold op_norm_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
have obs: "\<And>x i. (f i)\<^sup>2 * (x $ i)\<^sup>2 \<le> Max {(f i)\<^sup>2|i. i \<in> UNIV} * (x $ i)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x i. (f i)\<^sup>2 * (x $ i)\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (x $ i)\<^sup>2
[PROOF STEP]
apply(rule mult_right_mono[OF _ zero_le_power2])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x i. (f i)\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV}
[PROOF STEP]
using le_max_image_of_finite[of "\<lambda>i. (f i)^2"]
[PROOF STATE]
proof (prove)
using this:
(f ?i)\<^sup>2 \<le> Max {x. \<exists>i. x = (f i)\<^sup>2}

goal (1 subgoal):
 1. \<And>x i. (f i)\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f ?i)\<^sup>2 * (?x $ ?i)\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (?x $ ?i)\<^sup>2

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(f ?i)\<^sup>2 * (?x $ ?i)\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (?x $ ?i)\<^sup>2

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
fix r
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
assume "r \<in> {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}"
[PROOF STATE]
proof (state)
this:
r \<in> {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r \<in> {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}
[PROOF STEP]
obtain x where x_def: "\<parallel>diag_mat f *v x\<parallel> = r \<and> \<parallel>x\<parallel> = 1"
[PROOF STATE]
proof (prove)
using this:
r \<in> {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}

goal (1 subgoal):
 1. (\<And>x. \<parallel>diag_mat f *v x\<parallel> = r \<and> \<parallel>x\<parallel> = 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<parallel>diag_mat f *v x\<parallel> = r \<and> \<parallel>x\<parallel> = 1

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
hence "r\<^sup>2 = (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
\<parallel>diag_mat f *v x\<parallel> = r \<and> \<parallel>x\<parallel> = 1

goal (1 subgoal):
 1. r\<^sup>2 = (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2)
[PROOF STEP]
unfolding norm_vec_def L2_set_def matrix_vector_mul_diag_mat
[PROOF STATE]
proof (prove)
using this:
sqrt (\<Sum>i\<in>UNIV. \<parallel>(\<chi>i. f i * x $ i) $ i\<parallel>\<^sup>2) = r \<and> sqrt (\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel>\<^sup>2) = 1

goal (1 subgoal):
 1. r\<^sup>2 = (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2)
[PROOF STEP]
apply (simp add: power_mult_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2) = r \<and> (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2) = 1 \<Longrightarrow> r\<^sup>2 = (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2)
[PROOF STEP]
by (metis (no_types, lifting) x_def norm_ge_zero real_sqrt_ge_0_iff real_sqrt_pow2)
[PROOF STATE]
proof (state)
this:
r\<^sup>2 = (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2)

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r\<^sup>2 = (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2)

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
have "... \<le> (Max {(f i)\<^sup>2|i. i \<in> UNIV}) * (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2) \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2)
[PROOF STEP]
using obs[of _ x]
[PROOF STATE]
proof (prove)
using this:
(f ?i)\<^sup>2 * (x $ ?i)\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (x $ ?i)\<^sup>2

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2) \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2)
[PROOF STEP]
by (simp add: sum_mono sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2) \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2)

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. (f i)\<^sup>2 * (x $ i)\<^sup>2) \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2)

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
have "... = Max {(f i)\<^sup>2|i. i \<in> UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2) = Max {(f i)\<^sup>2 |i. i \<in> UNIV}
[PROOF STEP]
using x_def
[PROOF STATE]
proof (prove)
using this:
\<parallel>diag_mat f *v x\<parallel> = r \<and> \<parallel>x\<parallel> = 1

goal (1 subgoal):
 1. Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2) = Max {(f i)\<^sup>2 |i. i \<in> UNIV}
[PROOF STEP]
by (simp add: norm_vec_def L2_set_def)
[PROOF STATE]
proof (state)
this:
Max {(f i)\<^sup>2 |i. i \<in> UNIV} * (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2) = Max {(f i)\<^sup>2 |i. i \<in> UNIV}

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
r\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV}
[PROOF STEP]
have "r \<le> sqrt (Max {(f i)\<^sup>2|i. i \<in> UNIV})"
[PROOF STATE]
proof (prove)
using this:
r\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV}

goal (1 subgoal):
 1. r \<le> sqrt (Max {(f i)\<^sup>2 |i. i \<in> UNIV})
[PROOF STEP]
using x_def real_le_rsqrt
[PROOF STATE]
proof (prove)
using this:
r\<^sup>2 \<le> Max {(f i)\<^sup>2 |i. i \<in> UNIV}
\<parallel>diag_mat f *v x\<parallel> = r \<and> \<parallel>x\<parallel> = 1
?x\<^sup>2 \<le> ?y \<Longrightarrow> ?x \<le> sqrt ?y

goal (1 subgoal):
 1. r \<le> sqrt (Max {(f i)\<^sup>2 |i. i \<in> UNIV})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r \<le> sqrt (Max {(f i)\<^sup>2 |i. i \<in> UNIV})

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
hence "r \<le> Max ?A"
[PROOF STATE]
proof (prove)
using this:
r \<le> sqrt (Max {(f i)\<^sup>2 |i. i \<in> UNIV})

goal (1 subgoal):
 1. r \<le> Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
by (subst (asm) sqrt_Max_power2_eq_max_abs[of UNIV f], simp_all)
[PROOF STATE]
proof (state)
this:
r \<le> Max {\<bar>f i\<bar> |i. i \<in> UNIV}

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?r2 \<in> {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> ?r2 \<le> Max {\<bar>f i\<bar> |i. i \<in> UNIV}

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
hence 1: "\<forall>x\<in>{\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}. x \<le> Max ?A"
[PROOF STATE]
proof (prove)
using this:
?r2 \<in> {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> ?r2 \<le> Max {\<bar>f i\<bar> |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<forall>x\<in>{\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}. x \<le> Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
using this:
?r2 \<in> {\<parallel>(\<chi>i j. if i = j then f i else 0) *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> ?r2 \<le> Max {\<bar>f i\<bar> |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<forall>x\<in>{\<parallel>(\<chi>i j. if i = j then f i else 0) *v x\<parallel> |x. \<parallel>x\<parallel> = 1}. x \<le> Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}. x \<le> Max {\<bar>f i\<bar> |i. i \<in> UNIV}

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
obtain i where i_def: "Max ?A = \<parallel>diag_mat f *v \<e> i\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. Max {\<bar>f i\<bar> |i. i \<in> UNIV} = \<parallel>diag_mat f *v \<e> i\<parallel> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cMax_finite_ex[of ?A]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {\<bar>f i\<bar> |i. i \<in> UNIV}; {\<bar>f i\<bar> |i. i \<in> UNIV} \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>x\<in>{\<bar>f i\<bar> |i. i \<in> UNIV}. Max {\<bar>f i\<bar> |i. i \<in> UNIV} = x

goal (1 subgoal):
 1. (\<And>i. Max {\<bar>f i\<bar> |i. i \<in> UNIV} = \<parallel>diag_mat f *v \<e> i\<parallel> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Max {\<bar>f i\<bar> |i. i \<in> UNIV} = \<parallel>diag_mat f *v \<e> i\<parallel>

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
hence 2: "\<exists>x\<in>{\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}. Max ?A \<le> x"
[PROOF STATE]
proof (prove)
using this:
Max {\<bar>f i\<bar> |i. i \<in> UNIV} = \<parallel>diag_mat f *v \<e> i\<parallel>

goal (1 subgoal):
 1. \<exists>x\<in>{\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}. Max {\<bar>f i\<bar> |i. i \<in> UNIV} \<le> x
[PROOF STEP]
by (metis (mono_tags, lifting) abs_1 mem_Collect_eq norm_axis_eq order_refl real_norm_def)
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>{\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1}. Max {\<bar>f i\<bar> |i. i \<in> UNIV} \<le> x

goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
show "Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
by (rule cSup_eq[OF 1 2])
[PROOF STATE]
proof (state)
this:
Sup {\<parallel>diag_mat f *v x\<parallel> |x. \<parallel>x\<parallel> = 1} = Max {\<bar>f i\<bar> |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma increasing_conv_subseq_fun_0:
  assumes "s \<in> closed_seqs Zp"
  assumes "\<exists>s'. s' = convergent_subseq s"
  assumes "a = acc_point s"
  shows "convergent_subseq_fun s a (Suc n) > convergent_subseq_fun s a n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_subseq_fun s a n < convergent_subseq_fun s a (Suc n)
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_subseq_fun s a n < (SOME k. convergent_subseq_fun s a n < k \<and> s k (Suc n) = a (Suc n))
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convergent_subseq_fun s a 0 < (SOME k. convergent_subseq_fun s a 0 < k \<and> s k (Suc 0) = a (Suc 0))
 2. \<And>n. convergent_subseq_fun s a n < (SOME k. convergent_subseq_fun s a n < k \<and> s k (Suc n) = a (Suc n)) \<Longrightarrow> convergent_subseq_fun s a (Suc n) < (SOME k. convergent_subseq_fun s a (Suc n) < k \<and> s k (Suc (Suc n)) = a (Suc (Suc n)))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. convergent_subseq_fun s a 0 < (SOME k. convergent_subseq_fun s a 0 < k \<and> s k (Suc 0) = a (Suc 0))
 2. \<And>n. convergent_subseq_fun s a n < (SOME k. convergent_subseq_fun s a n < k \<and> s k (Suc n) = a (Suc n)) \<Longrightarrow> convergent_subseq_fun s a (Suc n) < (SOME k. convergent_subseq_fun s a (Suc n) < k \<and> s k (Suc (Suc n)) = a (Suc (Suc n)))
[PROOF STEP]
have "convergent_subseq_fun s a 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_subseq_fun s a 0 = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
convergent_subseq_fun s a 0 = 0

goal (2 subgoals):
 1. convergent_subseq_fun s a 0 < (SOME k. convergent_subseq_fun s a 0 < k \<and> s k (Suc 0) = a (Suc 0))
 2. \<And>n. convergent_subseq_fun s a n < (SOME k. convergent_subseq_fun s a n < k \<and> s k (Suc n) = a (Suc n)) \<Longrightarrow> convergent_subseq_fun s a (Suc n) < (SOME k. convergent_subseq_fun s a (Suc n) < k \<and> s k (Suc (Suc n)) = a (Suc (Suc n)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
convergent_subseq_fun s a 0 = 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
convergent_subseq_fun s a 0 = 0

goal (1 subgoal):
 1. convergent_subseq_fun s a 0 < (SOME k. convergent_subseq_fun s a 0 < k \<and> s k (Suc 0) = a (Suc 0))
[PROOF STEP]
by (smt assms(1) assms(3) less_Suc_eq less_Suc_eq_0_disj increasing_conv_induction_0_pre padic_integers_axioms someI_ex)
[PROOF STATE]
proof (state)
this:
convergent_subseq_fun s a 0 < (SOME k. convergent_subseq_fun s a 0 < k \<and> s k (Suc 0) = a (Suc 0))

goal (1 subgoal):
 1. \<And>n. convergent_subseq_fun s a n < (SOME k. convergent_subseq_fun s a n < k \<and> s k (Suc n) = a (Suc n)) \<Longrightarrow> convergent_subseq_fun s a (Suc n) < (SOME k. convergent_subseq_fun s a (Suc n) < k \<and> s k (Suc (Suc n)) = a (Suc (Suc n)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. convergent_subseq_fun s a n < (SOME k. convergent_subseq_fun s a n < k \<and> s k (Suc n) = a (Suc n)) \<Longrightarrow> convergent_subseq_fun s a (Suc n) < (SOME k. convergent_subseq_fun s a (Suc n) < k \<and> s k (Suc (Suc n)) = a (Suc (Suc n)))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
convergent_subseq_fun s a k < (SOME ka. convergent_subseq_fun s a k < ka \<and> s ka (Suc k) = a (Suc k))

goal (1 subgoal):
 1. \<And>n. convergent_subseq_fun s a n < (SOME k. convergent_subseq_fun s a n < k \<and> s k (Suc n) = a (Suc n)) \<Longrightarrow> convergent_subseq_fun s a (Suc n) < (SOME k. convergent_subseq_fun s a (Suc n) < k \<and> s k (Suc (Suc n)) = a (Suc (Suc n)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
convergent_subseq_fun s a k < (SOME ka. convergent_subseq_fun s a k < ka \<and> s ka (Suc k) = a (Suc k))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
convergent_subseq_fun s a k < (SOME ka. convergent_subseq_fun s a k < ka \<and> s ka (Suc k) = a (Suc k))

goal (1 subgoal):
 1. convergent_subseq_fun s a (Suc k) < (SOME ka. convergent_subseq_fun s a (Suc k) < ka \<and> s ka (Suc (Suc k)) = a (Suc (Suc k)))
[PROOF STEP]
by (metis (mono_tags, lifting) assms(1) assms(3) increasing_conv_induction_0_pre someI_ex)
[PROOF STATE]
proof (state)
this:
convergent_subseq_fun s a (Suc k) < (SOME ka. convergent_subseq_fun s a (Suc k) < ka \<and> s ka (Suc (Suc k)) = a (Suc (Suc k)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pivot_unsat_core_id: "\<lbrakk>\<triangle> (\<T> s); x\<^sub>i \<in> lvars (\<T> s); x\<^sub>j \<in> rvars_of_lvar (\<T> s) x\<^sub>i\<rbrakk> \<Longrightarrow> \<U>\<^sub>c (pivot x\<^sub>i x\<^sub>j s) = \<U>\<^sub>c s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<triangle> (\<T> s); x\<^sub>i \<in> lvars (\<T> s); x\<^sub>j \<in> rvars_eq (eq_for_lvar (\<T> s) x\<^sub>i)\<rbrakk> \<Longrightarrow> \<U>\<^sub>c (pivot x\<^sub>i x\<^sub>j s) = \<U>\<^sub>c s
[PROOF STEP]
using pivot_id
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<triangle> (\<T> ?s); ?x\<^sub>i \<in> lvars (\<T> ?s); ?x\<^sub>j \<in> rvars_eq (eq_for_lvar (\<T> ?s) ?x\<^sub>i)\<rbrakk> \<Longrightarrow> let s' = pivot ?x\<^sub>i ?x\<^sub>j ?s in \<V> s' = \<V> ?s \<and> \<B>\<^sub>i s' = \<B>\<^sub>i ?s \<and> \<U> s' = \<U> ?s \<and> \<U>\<^sub>c s' = \<U>\<^sub>c ?s

goal (1 subgoal):
 1. \<lbrakk>\<triangle> (\<T> s); x\<^sub>i \<in> lvars (\<T> s); x\<^sub>j \<in> rvars_eq (eq_for_lvar (\<T> s) x\<^sub>i)\<rbrakk> \<Longrightarrow> \<U>\<^sub>c (pivot x\<^sub>i x\<^sub>j s) = \<U>\<^sub>c s
[PROOF STEP]
by (simp add: Let_def)


[STATEMENT]
lemma fv_fo_terms_set_cong: "fv_fo_terms_set ts = fv_fo_terms_set (map (map_fo_term f) ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv_fo_terms_set ts = fv_fo_terms_set (map (map_fo_term f) ts)
[PROOF STEP]
using fv_fo_term_set_cong
[PROOF STATE]
proof (prove)
using this:
fv_fo_term_set ?t = fv_fo_term_set (map_fo_term ?f ?t)

goal (1 subgoal):
 1. fv_fo_terms_set ts = fv_fo_terms_set (map (map_fo_term f) ts)
[PROOF STEP]
by (induction ts) (fastforce simp: fv_fo_terms_set_def)+


[STATEMENT]
lemma has_integral_0_eq[simp]: "((\<lambda>x. 0) has_integral i) S \<longleftrightarrow> i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. 0::'b) has_integral i) S = (i = (0::'b))
[PROOF STEP]
using has_integral_unique[OF has_integral_0]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. 0::?'a) has_integral ?k2.0) ?i \<Longrightarrow> (0::?'a) = ?k2.0

goal (1 subgoal):
 1. ((\<lambda>x. 0::'b) has_integral i) S = (i = (0::'b))
[PROOF STEP]
by auto


[STATEMENT]
lemma signed_take_bit_eq_take_bit_shift:
  \<open>signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n\<close>
  for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
have *: \<open>take_bit n k OR 2 ^ n = take_bit n k + 2 ^ n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit n k OR 2 ^ n = take_bit n k + 2 ^ n
[PROOF STEP]
by (simp add: disjunctive_add bit_exp_iff bit_take_bit_iff)
[PROOF STATE]
proof (state)
this:
take_bit n k OR 2 ^ n = take_bit n k + 2 ^ n

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
have \<open>take_bit n k - 2 ^ n = take_bit n k + NOT (mask n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit n k - 2 ^ n = take_bit n k + NOT (mask n)
[PROOF STEP]
by (simp add: minus_exp_eq_not_mask)
[PROOF STATE]
proof (state)
this:
take_bit n k - 2 ^ n = take_bit n k + NOT (mask n)

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
take_bit n k - 2 ^ n = take_bit n k + NOT (mask n)

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
have \<open>\<dots> = take_bit n k OR NOT (mask n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit n k + NOT (mask n) = take_bit n k OR NOT (mask n)
[PROOF STEP]
by (rule disjunctive_add)
      (simp add: bit_exp_iff bit_take_bit_iff bit_not_iff bit_mask_iff)
[PROOF STATE]
proof (state)
this:
take_bit n k + NOT (mask n) = take_bit n k OR NOT (mask n)

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
take_bit n k - 2 ^ n = take_bit n k OR NOT (mask n)
[PROOF STEP]
have **: \<open>take_bit n k - 2 ^ n = take_bit n k OR NOT (mask n)\<close>
[PROOF STATE]
proof (prove)
using this:
take_bit n k - 2 ^ n = take_bit n k OR NOT (mask n)

goal (1 subgoal):
 1. take_bit n k - 2 ^ n = take_bit n k OR NOT (mask n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
take_bit n k - 2 ^ n = take_bit n k OR NOT (mask n)

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
have \<open>take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (take_bit (Suc n) k + take_bit (Suc n) (2 ^ n))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (take_bit (Suc n) k + take_bit (Suc n) (2 ^ n))
[PROOF STEP]
by (simp only: take_bit_add)
[PROOF STATE]
proof (state)
this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (take_bit (Suc n) k + take_bit (Suc n) (2 ^ n))

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (take_bit (Suc n) k + take_bit (Suc n) (2 ^ n))

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
have \<open>take_bit (Suc n) k = 2 ^ n * of_bool (bit k n) + take_bit n k\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) k = 2 ^ n * of_bool (bit k n) + take_bit n k
[PROOF STEP]
by (simp add: take_bit_Suc_from_most)
[PROOF STATE]
proof (state)
this:
take_bit (Suc n) k = 2 ^ n * of_bool (bit k n) + take_bit n k

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ n * of_bool (bit k n) + take_bit n k + take_bit (Suc n) (2 ^ n))
[PROOF STEP]
have \<open>take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ (n + of_bool (bit k n)) + take_bit n k)\<close>
[PROOF STATE]
proof (prove)
using this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ n * of_bool (bit k n) + take_bit n k + take_bit (Suc n) (2 ^ n))

goal (1 subgoal):
 1. take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ (n + of_bool (bit k n)) + take_bit n k)
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ (n + of_bool (bit k n)) + take_bit n k)

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ (n + of_bool (bit k n)) + take_bit n k)

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
have \<open>2 ^ (n + of_bool (bit k n)) + take_bit n k = 2 ^ (n + of_bool (bit k n)) OR take_bit n k\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (n + of_bool (bit k n)) + take_bit n k = 2 ^ (n + of_bool (bit k n)) OR take_bit n k
[PROOF STEP]
by (rule disjunctive_add)
      (auto simp add: disjunctive_add bit_take_bit_iff bit_double_iff bit_exp_iff)
[PROOF STATE]
proof (state)
this:
2 ^ (n + of_bool (bit k n)) + take_bit n k = 2 ^ (n + of_bool (bit k n)) OR take_bit n k

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ (n + of_bool (bit k n)) OR take_bit n k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ (n + of_bool (bit k n)) OR take_bit n k)

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
using * **
[PROOF STATE]
proof (prove)
using this:
take_bit (Suc n) (k + 2 ^ n) = take_bit (Suc n) (2 ^ (n + of_bool (bit k n)) OR take_bit n k)
take_bit n k OR 2 ^ n = take_bit n k + 2 ^ n
take_bit n k - 2 ^ n = take_bit n k OR NOT (mask n)

goal (1 subgoal):
 1. signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n
[PROOF STEP]
by (simp add: signed_take_bit_def concat_bit_Suc min_def ac_simps)
[PROOF STATE]
proof (state)
this:
signed_take_bit n k = take_bit (Suc n) (k + 2 ^ n) - 2 ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma idempotent_subset:
  assumes "idempotent R" "S \<subseteq> R"
  shows "S O R \<subseteq> R" "R O S \<subseteq> R" "S O R O S \<subseteq> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S O R \<subseteq> R &&& R O S \<subseteq> R &&& S O R O S \<subseteq> R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
idempotent R
S \<subseteq> R

goal (1 subgoal):
 1. S O R \<subseteq> R &&& R O S \<subseteq> R &&& S O R O S \<subseteq> R
[PROOF STEP]
by (auto simp:idempotent_def)


[STATEMENT]
lemma sorted_wrt_linorder_unique:
  assumes "linorder_on A R" "mset xs = mset ys" "sorted_wrt R xs" "sorted_wrt R ys"
  shows   "xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = ys
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs = ys
[PROOF STEP]
from \<open>mset xs = mset ys\<close>
[PROOF STATE]
proof (chain)
picking this:
mset xs = mset ys
[PROOF STEP]
have "length xs = length ys"
[PROOF STATE]
proof (prove)
using this:
mset xs = mset ys

goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
by (rule mset_eq_length)
[PROOF STATE]
proof (state)
this:
length xs = length ys

goal (1 subgoal):
 1. xs = ys
[PROOF STEP]
from this and assms(2-)
[PROOF STATE]
proof (chain)
picking this:
length xs = length ys
mset xs = mset ys
Linorder_Relations.sorted_wrt R xs
Linorder_Relations.sorted_wrt R ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
mset xs = mset ys
Linorder_Relations.sorted_wrt R xs
Linorder_Relations.sorted_wrt R ys

goal (1 subgoal):
 1. xs = ys
[PROOF STEP]
proof (induction xs ys rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
case (Cons x xs y ys)
[PROOF STATE]
proof (state)
this:
length xs = length ys
\<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys
mset (x # xs) = mset (y # ys)
Linorder_Relations.sorted_wrt R (x # xs)
Linorder_Relations.sorted_wrt R (y # ys)

goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
have "set (x # xs) = set_mset (mset (x # xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (x # xs) = set_mset (mset (x # xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (x # xs) = set_mset (mset (x # xs))

goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (x # xs) = set_mset (mset (x # xs))

goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
have "mset (x # xs) = mset (y # ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (x # xs) = mset (y # ys)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
mset (x # xs) = mset (y # ys)

goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mset (x # xs) = mset (y # ys)

goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
have "set_mset \<dots> = set (y # ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset (mset (y # ys)) = set (y # ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_mset (mset (y # ys)) = set (y # ys)

goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (x # xs) = set (y # ys)
[PROOF STEP]
have eq: "set (x # xs) = set (y # ys)"
[PROOF STATE]
proof (prove)
using this:
set (x # xs) = set (y # ys)

goal (1 subgoal):
 1. set (x # xs) = set (y # ys)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set (x # xs) = set (y # ys)

goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
have "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
assume "x \<noteq> y"
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
set (x # xs) = set (y # ys)
x \<noteq> y
[PROOF STEP]
have "x \<in> set ys" "y \<in> set xs"
[PROOF STATE]
proof (prove)
using this:
set (x # xs) = set (y # ys)
x \<noteq> y

goal (1 subgoal):
 1. x \<in> set ys &&& y \<in> set xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set ys
y \<in> set xs

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
with Cons.prems and assms(1) and eq
[PROOF STATE]
proof (chain)
picking this:
mset (x # xs) = mset (y # ys)
Linorder_Relations.sorted_wrt R (x # xs)
Linorder_Relations.sorted_wrt R (y # ys)
linorder_on A R
set (x # xs) = set (y # ys)
x \<in> set ys
y \<in> set xs
[PROOF STEP]
have "(x, y) \<in> R" "(y, x) \<in> R"
[PROOF STATE]
proof (prove)
using this:
mset (x # xs) = mset (y # ys)
Linorder_Relations.sorted_wrt R (x # xs)
Linorder_Relations.sorted_wrt R (y # ys)
linorder_on A R
set (x # xs) = set (y # ys)
x \<in> set ys
y \<in> set xs

goal (1 subgoal):
 1. (x, y) \<in> R &&& (y, x) \<in> R
[PROOF STEP]
by (auto simp: sorted_wrt_Cons)
[PROOF STATE]
proof (state)
this:
(x, y) \<in> R
(y, x) \<in> R

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
with assms(1)
[PROOF STATE]
proof (chain)
picking this:
linorder_on A R
(x, y) \<in> R
(y, x) \<in> R
[PROOF STEP]
have "x = y"
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
(x, y) \<in> R
(y, x) \<in> R

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

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
with \<open>x \<noteq> y\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
x = y
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
x = y

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = y

goal (2 subgoals):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys; mset (x # xs) = mset (y # ys); Linorder_Relations.sorted_wrt R (x # xs); Linorder_Relations.sorted_wrt R (y # ys)\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
length xs = length ys
\<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys
mset (x # xs) = mset (y # ys)
Linorder_Relations.sorted_wrt R (x # xs)
Linorder_Relations.sorted_wrt R (y # ys)
x = y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
\<lbrakk>mset xs = mset ys; Linorder_Relations.sorted_wrt R xs; Linorder_Relations.sorted_wrt R ys\<rbrakk> \<Longrightarrow> xs = ys
mset (x # xs) = mset (y # ys)
Linorder_Relations.sorted_wrt R (x # xs)
Linorder_Relations.sorted_wrt R (y # ys)
x = y

goal (1 subgoal):
 1. x # xs = y # ys
[PROOF STEP]
by (auto simp: sorted_wrt_Cons)
[PROOF STATE]
proof (state)
this:
x # xs = y # ys

goal (1 subgoal):
 1. \<lbrakk>mset [] = mset []; Linorder_Relations.sorted_wrt R []; Linorder_Relations.sorted_wrt R []\<rbrakk> \<Longrightarrow> [] = []
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
xs = ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<Delta>_max_degree: "u \<in> V \<Longrightarrow> degree_vertex u \<le> \<Delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> V \<Longrightarrow> degree_vertex u \<le> \<Delta>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u \<in> V \<Longrightarrow> degree_vertex u \<le> \<Delta>
[PROOF STEP]
assume H: "u \<in> V"
[PROOF STATE]
proof (state)
this:
u \<in> V

goal (1 subgoal):
 1. u \<in> V \<Longrightarrow> degree_vertex u \<le> \<Delta>
[PROOF STEP]
have "finite {degree_vertex u |u. u \<in> V}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {degree_vertex u |u. u \<in> V}
[PROOF STEP]
by (metis finite_V finite_imageI Setcompr_eq_image)
[PROOF STATE]
proof (state)
this:
finite {degree_vertex u |u. u \<in> V}

goal (1 subgoal):
 1. u \<in> V \<Longrightarrow> degree_vertex u \<le> \<Delta>
[PROOF STEP]
with H
[PROOF STATE]
proof (chain)
picking this:
u \<in> V
finite {degree_vertex u |u. u \<in> V}
[PROOF STEP]
show "degree_vertex u \<le> \<Delta>"
[PROOF STATE]
proof (prove)
using this:
u \<in> V
finite {degree_vertex u |u. u \<in> V}

goal (1 subgoal):
 1. degree_vertex u \<le> \<Delta>
[PROOF STEP]
using Max_ge
[PROOF STATE]
proof (prove)
using this:
u \<in> V
finite {degree_vertex u |u. u \<in> V}
\<lbrakk>finite ?A; ?x \<in> ?A\<rbrakk> \<Longrightarrow> ?x \<le> Max ?A

goal (1 subgoal):
 1. degree_vertex u \<le> \<Delta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree_vertex u \<le> \<Delta>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma up_set_prop: "(X::'a::preorder set) \<noteq> {} \<Longrightarrow> ub_set X = \<Inter>{\<up>x |x. x \<in> X}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> ub_set X = \<Inter> {\<up> x |x. x \<in> X}
[PROOF STEP]
unfolding ub_set_def upset_def upset_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> {y. \<forall>x\<in>X. x \<le> y} = \<Inter> {((\<lambda>X. {y. \<exists>x\<in>X. x \<le> y}) \<circ> \<eta>) x |x. x \<in> X}
[PROOF STEP]
by (safe, simp_all, blast)


[STATEMENT]
theorem length_nearest_neighbors:
  "length (nearest_neighbors n p kdt) = min n (size_kdt kdt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (nearest_neighbors n p kdt) = min n (KD_Tree.size_kdt kdt)
[PROOF STEP]
by (simp add: length_nns nearest_neighbors_def)


[STATEMENT]
lemma real_sqrt_abs [simp]: "sqrt (x\<^sup>2) = \<bar>x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x\<^sup>2) = \<bar>x\<bar>
[PROOF STEP]
by (metis power2_abs abs_ge_zero real_sqrt_unique)


[STATEMENT]
lemma lang_PLUS: "lang (PLUS xs) = (\<Union>r \<in> set xs. lang r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang (PLUS xs) = \<Union> (lang ` set xs)
[PROOF STEP]
by (induct xs rule: list_singleton_induct) auto


[STATEMENT]
theorem bernoulli_conv_akiyama_tanigawa:
  "bernoulli n = akiyama_tanigawa n 0 - (if n = 1 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli n = akiyama_tanigawa n 0 - (if n = 1 then 1 else 0)
[PROOF STEP]
using bernoulli'_conv_akiyama_tanigawa[of n]
[PROOF STATE]
proof (prove)
using this:
bernoulli' n = akiyama_tanigawa n 0

goal (1 subgoal):
 1. bernoulli n = akiyama_tanigawa n 0 - (if n = 1 then 1 else 0)
[PROOF STEP]
by (auto simp: bernoulli_conv_bernoulli')


[STATEMENT]
lemma of_real_quat_re_cnj: "quat_of_real(Re q) = inverse(quat_of_real 2) * (q + cnj q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quat_of_real (quat.Re q) = inverse (quat_of_real 2) * (q + Quaternions.cnj q)
[PROOF STEP]
by (simp add: quat_eq_iff)


[STATEMENT]
lemma carrier_integer_mod_group:
  "carrier(integer_mod_group n) = (if n=0 then UNIV else {0..<int n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (integer_mod_group n) = (if n = 0 then UNIV else {0..<int n})
[PROOF STEP]
by (simp add: integer_mod_group_def)


[STATEMENT]
lemma in_IF2rel:
  "IF2rel R x y \<longleftrightarrow> (\<exists> z. z \<in> IF2in (Collect (case_prod R)) \<and> IF2map fst z = x \<and> IF2map snd z = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IF2rel R x y = (\<exists>z. z \<in> IF2in {(x, y). R x y} \<and> IF2map fst z = x \<and> IF2map snd z = y)
[PROOF STEP]
unfolding IF2rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((BNF_Def.Grp (IF2in {(x, y). R x y}) (IF2map fst))\<inverse>\<inverse> OO BNF_Def.Grp (IF2in {(x, y). R x y}) (IF2map snd)) x y = (\<exists>z. z \<in> IF2in {(x, y). R x y} \<and> IF2map fst z = x \<and> IF2map snd z = y)
[PROOF STEP]
by (rule predicate2_eqD[OF OO_Grp_alt])


[STATEMENT]
lemma real_prod_integrable:
  fixes f g :: "'a \<Rightarrow> real"
  assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
  assumes sq_int: "integrable M (\<lambda>\<omega>. f \<omega>^2)" "integrable M (\<lambda>\<omega>. g \<omega>^2)"
  shows "integrable M (\<lambda>\<omega>. f \<omega> * g \<omega>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>\<omega>. f \<omega> * g \<omega>)
[PROOF STEP]
unfolding integrable_iff_bounded
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>) \<and> \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>)
 2. \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
have "(\<integral>\<^sup>+ \<omega>. ennreal (norm (f \<omega> * g \<omega>)) \<partial>M)\<^sup>2 = (\<integral>\<^sup>+ \<omega>. ennreal \<bar>f \<omega>\<bar> * ennreal \<bar>g \<omega>\<bar> \<partial>M)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<integral>\<^sup>+ \<omega>. ennreal (norm (f \<omega> * g \<omega>)) \<partial>M)\<^sup>2 = (\<integral>\<^sup>+ \<omega>. ennreal \<bar>f \<omega>\<bar> * ennreal \<bar>g \<omega>\<bar> \<partial>M)\<^sup>2
[PROOF STEP]
by (simp add: abs_mult ennreal_mult)
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+ \<omega>. ennreal (norm (f \<omega> * g \<omega>)) \<partial>M)\<^sup>2 = (\<integral>\<^sup>+ \<omega>. ennreal \<bar>f \<omega>\<bar> * ennreal \<bar>g \<omega>\<bar> \<partial>M)\<^sup>2

goal (2 subgoals):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>)
 2. \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+ \<omega>. ennreal (norm (f \<omega> * g \<omega>)) \<partial>M)\<^sup>2 = (\<integral>\<^sup>+ \<omega>. ennreal \<bar>f \<omega>\<bar> * ennreal \<bar>g \<omega>\<bar> \<partial>M)\<^sup>2

goal (2 subgoals):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>)
 2. \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
have "... \<le>  (\<integral>\<^sup>+ \<omega>. ennreal \<bar>f \<omega>\<bar>^2 \<partial>M) * (\<integral>\<^sup>+ \<omega>. ennreal \<bar>g \<omega>\<bar>^2 \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<integral>\<^sup>+ \<omega>. ennreal \<bar>f \<omega>\<bar> * ennreal \<bar>g \<omega>\<bar> \<partial>M)\<^sup>2 \<le> \<integral>\<^sup>+ \<omega>. (ennreal \<bar>f \<omega>\<bar>)\<^sup>2 \<partial>M * \<integral>\<^sup>+ \<omega>. (ennreal \<bar>g \<omega>\<bar>)\<^sup>2 \<partial>M
[PROOF STEP]
by (rule Cauchy_Schwarz_nn_integral, auto)
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+ \<omega>. ennreal \<bar>f \<omega>\<bar> * ennreal \<bar>g \<omega>\<bar> \<partial>M)\<^sup>2 \<le> \<integral>\<^sup>+ \<omega>. (ennreal \<bar>f \<omega>\<bar>)\<^sup>2 \<partial>M * \<integral>\<^sup>+ \<omega>. (ennreal \<bar>g \<omega>\<bar>)\<^sup>2 \<partial>M

goal (2 subgoals):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>)
 2. \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+ \<omega>. ennreal \<bar>f \<omega>\<bar> * ennreal \<bar>g \<omega>\<bar> \<partial>M)\<^sup>2 \<le> \<integral>\<^sup>+ \<omega>. (ennreal \<bar>f \<omega>\<bar>)\<^sup>2 \<partial>M * \<integral>\<^sup>+ \<omega>. (ennreal \<bar>g \<omega>\<bar>)\<^sup>2 \<partial>M

goal (2 subgoals):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>)
 2. \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
have "... < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ \<omega>. (ennreal \<bar>f \<omega>\<bar>)\<^sup>2 \<partial>M * \<integral>\<^sup>+ \<omega>. (ennreal \<bar>g \<omega>\<bar>)\<^sup>2 \<partial>M < \<infinity>
[PROOF STEP]
using sq_int
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>\<omega>. (f \<omega>)\<^sup>2)
integrable M (\<lambda>\<omega>. (g \<omega>)\<^sup>2)

goal (1 subgoal):
 1. \<integral>\<^sup>+ \<omega>. (ennreal \<bar>f \<omega>\<bar>)\<^sup>2 \<partial>M * \<integral>\<^sup>+ \<omega>. (ennreal \<bar>g \<omega>\<bar>)\<^sup>2 \<partial>M < \<infinity>
[PROOF STEP]
by (auto simp: integrable_iff_bounded ennreal_power ennreal_mult_less_top)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<omega>. (ennreal \<bar>f \<omega>\<bar>)\<^sup>2 \<partial>M * \<integral>\<^sup>+ \<omega>. (ennreal \<bar>g \<omega>\<bar>)\<^sup>2 \<partial>M < \<infinity>

goal (2 subgoals):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>)
 2. \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<integral>\<^sup>+ \<omega>. ennreal (norm (f \<omega> * g \<omega>)) \<partial>M)\<^sup>2 < \<infinity>
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M)\<^sup>2 < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
(\<integral>\<^sup>+ \<omega>. ennreal (norm (f \<omega> * g \<omega>)) \<partial>M)\<^sup>2 < \<infinity>

goal (1 subgoal):
 1. (\<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M)\<^sup>2 < \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M)\<^sup>2 < \<infinity>

goal (2 subgoals):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>)
 2. \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
thus "(\<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M) < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
(\<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M)\<^sup>2 < \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>
[PROOF STEP]
by (simp add: power_less_top_ennreal)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x * g x)) \<partial>M < \<infinity>

goal (1 subgoal):
 1. random_variable borel (\<lambda>\<omega>. f \<omega> * g \<omega>)
[PROOF STEP]
qed auto


[STATEMENT]
lemma lt_1_iff_eq_0_hmset: "M < 1 \<longleftrightarrow> M = 0" for M :: hmultiset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M < 1) = (M = 0)
[PROOF STEP]
by (simp add: less_iff_add1_le_hmset)


[STATEMENT]
lemma nat_eq_cancel: "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> (nat a = nat b) = (a = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; 0 < b\<rbrakk> \<Longrightarrow> (nat a = nat b) = (a = b)
[PROOF STEP]
by auto


[STATEMENT]
lemma iterate_op_plus: "(((+) k) ^^ m) 0 = k * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((+) k ^^ m) 0 = k * m
[PROOF STEP]
by (induction m) auto


[STATEMENT]
lemma d_delta_arctan_upper_11: "x \<noteq> 0 \<Longrightarrow>
    ((\<lambda>x. arctan_upper_11 x - arctan x) has_field_derivative diff_delta_arctan_upper_11 x) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> ((\<lambda>x. arctan_upper_11 x - arctan x) has_real_derivative diff_delta_arctan_upper_11 x) (at x)
[PROOF STEP]
unfolding arctan_upper_11_def diff_delta_arctan_upper_11_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> ((\<lambda>x. - (pi / 2) - 1 / x - arctan x) has_real_derivative 1 / (x\<^sup>2 * (1 + x\<^sup>2))) (at x)
[PROOF STEP]
apply (intro derivative_eq_intros | simp)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> 1 / (x * x) - inverse (1 + x\<^sup>2) = 1 / (x\<^sup>2 * (1 + x\<^sup>2))
[PROOF STEP]
apply (simp add: divide_simps add_nonneg_eq_0_iff, algebra)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bigo_const_mult [simp]: "c \<noteq> 0 \<Longrightarrow> O(\<lambda>x. c * f x) = O(f)"
  for c :: "'a::linordered_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> O(\<lambda>x. c * f x) = O(f)
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<noteq> (0::'a) \<Longrightarrow> O(\<lambda>x. c * f x) \<subseteq> O(f)
 2. c \<noteq> (0::'a) \<Longrightarrow> O(f) \<subseteq> O(\<lambda>x. c * f x)
[PROOF STEP]
apply (rule bigo_const_mult2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> O(f) \<subseteq> O(\<lambda>x. c * f x)
[PROOF STEP]
apply (erule bigo_const_mult4)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma connectedin_subset_separated_union:
     "\<lbrakk>connectedin X C; separatedin X S T; C \<subseteq> S \<union> T\<rbrakk> \<Longrightarrow> C \<subseteq> S \<or> C \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connectedin X C; separatedin X S T; C \<subseteq> S \<union> T\<rbrakk> \<Longrightarrow> C \<subseteq> S \<or> C \<subseteq> T
[PROOF STEP]
unfolding connectedin_eq_not_separated_subset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> topspace X \<and> (\<nexists>C1 C2. C \<subseteq> C1 \<union> C2 \<and> C \<inter> C1 \<noteq> {} \<and> C \<inter> C2 \<noteq> {} \<and> separatedin X C1 C2); separatedin X S T; C \<subseteq> S \<union> T\<rbrakk> \<Longrightarrow> C \<subseteq> S \<or> C \<subseteq> T
[PROOF STEP]
by blast


[STATEMENT]
lemma ordinal_of_hmset_singleton[simp]: "ordinal_of_hmset (\<omega>^k) = \<omega> ** ordinal_of_hmset k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_of_hmset (\<omega>\<^sub>h^ k) = \<omega> ** ordinal_of_hmset k
[PROOF STEP]
by simp


[STATEMENT]
lemma complex_of_real_mono_iff[simp]:
  "complex_of_real x \<le> complex_of_real y \<longleftrightarrow> x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (complex_of_real x \<le> complex_of_real y) = (x \<le> y)
[PROOF STEP]
unfolding less_eq_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Re (complex_of_real x) \<le> Re (complex_of_real y) \<and> Im (complex_of_real x) = Im (complex_of_real y)) = (x \<le> y)
[PROOF STEP]
by auto