[STATEMENT]
lemma mat_to_cols_list_times_mat [simp]:
  assumes "dim_col A = dim_row B" and "dim_col A > 0"
  shows "mat_to_cols_list (A * B) = plus_mult.matrix_mult (*) 0 (+) (mat_to_cols_list A) (mat_to_cols_list B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_to_cols_list (A * B) = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B)
[PROOF STEP]
proof (rule nth_equalityI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (mat_to_cols_list (A * B)) = length (mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B))
 2. \<And>i. i < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! i = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B) ! i
[PROOF STEP]
define M where "M = plus_mult.matrix_mult (*) 0 (+) (mat_to_cols_list A) (mat_to_cols_list B)"
[PROOF STATE]
proof (state)
this:
M = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B)

goal (2 subgoals):
 1. length (mat_to_cols_list (A * B)) = length (mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B))
 2. \<And>i. i < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! i = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B)
[PROOF STEP]
show f0:"length (mat_to_cols_list (A * B)) = length M"
[PROOF STATE]
proof (prove)
using this:
M = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B)

goal (1 subgoal):
 1. length (mat_to_cols_list (A * B)) = length M
[PROOF STEP]
by (simp add: mat_multI_def)
[PROOF STATE]
proof (state)
this:
length (mat_to_cols_list (A * B)) = length M

goal (1 subgoal):
 1. \<And>i. i < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! i = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B) ! i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (mat_to_cols_list (A * B)) = length M

goal (1 subgoal):
 1. \<And>i. i < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! i = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B) ! i
[PROOF STEP]
have f1:"\<And>j. j<length (mat_to_cols_list (A * B)) \<longrightarrow> mat_to_cols_list (A * B) ! j = M ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
fix j:: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
assume a0:"j < length (mat_to_cols_list (A * B))"
[PROOF STATE]
proof (state)
this:
j < length (mat_to_cols_list (A * B))

goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j < length (mat_to_cols_list (A * B))
[PROOF STEP]
have "length (mat_to_cols_list (A * B) ! j) = dim_row A"
[PROOF STATE]
proof (prove)
using this:
j < length (mat_to_cols_list (A * B))

goal (1 subgoal):
 1. length (mat_to_cols_list (A * B) ! j) = dim_row A
[PROOF STEP]
by (simp add: mat_to_cols_list_def)
[PROOF STATE]
proof (state)
this:
length (mat_to_cols_list (A * B) ! j) = dim_row A

goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (mat_to_cols_list (A * B) ! j) = dim_row A
[PROOF STEP]
also
[PROOF STATE]
proof (chain)
picking this:
length (mat_to_cols_list (A * B) ! j) = dim_row A
[PROOF STEP]
have f2:"length (M ! j) = dim_row A"
[PROOF STATE]
proof (prove)
using this:
length (mat_to_cols_list (A * B) ! j) = dim_row A

goal (1 subgoal):
 1. length (M ! j) = dim_row A
[PROOF STEP]
using a0 M_def mat_multI_def[of 0 "(+)" "(*)" "dim_row A" "mat_to_cols_list A" "mat_to_cols_list B"]
        row_length_mat_to_cols_list assms(2)
[PROOF STATE]
proof (prove)
using this:
length (mat_to_cols_list (A * B) ! j) = dim_row A
j < length (mat_to_cols_list (A * B))
M = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B)
mat_mult (dim_row A) (mat_to_cols_list A) (mat_to_cols_list B) \<equiv> map (matT_vec_multI 0 (+) (*) (Matrix_Legacy.transpose (dim_row A) (mat_to_cols_list A))) (mat_to_cols_list B)
0 < dim_col ?A \<Longrightarrow> mult.row_length (mat_to_cols_list ?A) = dim_row ?A
0 < dim_col A

goal (1 subgoal):
 1. length (M ! j) = dim_row A
[PROOF STEP]
by (metis assms(1) f0 length_greater_0_conv length_map length_mat_to_cols_list
list_to_mat_to_cols_list mat_mult mat_to_cols_list_is_mat matrix_mult_to_times_mat)
[PROOF STATE]
proof (state)
this:
length (M ! j) = dim_row A

goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (mat_to_cols_list (A * B) ! j) = dim_row A
length (M ! j) = dim_row A
[PROOF STEP]
have "length (mat_to_cols_list (A * B) ! j) = length (M ! j)"
[PROOF STATE]
proof (prove)
using this:
length (mat_to_cols_list (A * B) ! j) = dim_row A
length (M ! j) = dim_row A

goal (1 subgoal):
 1. length (mat_to_cols_list (A * B) ! j) = length (M ! j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (mat_to_cols_list (A * B) ! j) = length (M ! j)

goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (mat_to_cols_list (A * B) ! j) = length (M ! j)

goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
have "\<And>i. i<dim_row A \<longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < dim_row A \<longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
assume a1:"i < dim_row A"
[PROOF STATE]
proof (state)
this:
i < dim_row A

goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
have "mat (mult.row_length (mat_to_cols_list A)) (dim_col A) (mat_to_cols_list A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Legacy.mat (mult.row_length (mat_to_cols_list A)) (dim_col A) (mat_to_cols_list A)
[PROOF STEP]
using mat_to_cols_list_is_mat assms(2)
[PROOF STATE]
proof (prove)
using this:
0 < dim_col ?A \<Longrightarrow> Matrix_Legacy.mat (mult.row_length (mat_to_cols_list ?A)) (length (mat_to_cols_list ?A)) (mat_to_cols_list ?A)
0 < dim_col A

goal (1 subgoal):
 1. Matrix_Legacy.mat (mult.row_length (mat_to_cols_list A)) (dim_col A) (mat_to_cols_list A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix_Legacy.mat (mult.row_length (mat_to_cols_list A)) (dim_col A) (mat_to_cols_list A)

goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Matrix_Legacy.mat (mult.row_length (mat_to_cols_list A)) (dim_col A) (mat_to_cols_list A)

goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
have "mat (dim_col A) (dim_col B) (mat_to_cols_list B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Legacy.mat (dim_col A) (dim_col B) (mat_to_cols_list B)
[PROOF STEP]
using mat_to_cols_list_is_mat assms(1) a0
[PROOF STATE]
proof (prove)
using this:
0 < dim_col ?A \<Longrightarrow> Matrix_Legacy.mat (mult.row_length (mat_to_cols_list ?A)) (length (mat_to_cols_list ?A)) (mat_to_cols_list ?A)
dim_col A = dim_row B
j < length (mat_to_cols_list (A * B))

goal (1 subgoal):
 1. Matrix_Legacy.mat (dim_col A) (dim_col B) (mat_to_cols_list B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix_Legacy.mat (dim_col A) (dim_col B) (mat_to_cols_list B)

goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Matrix_Legacy.mat (mult.row_length (mat_to_cols_list A)) (dim_col A) (mat_to_cols_list A)
Matrix_Legacy.mat (dim_col A) (dim_col B) (mat_to_cols_list B)
[PROOF STEP]
have "M ! j ! i = plus_mult.scalar_product (*) 0 (+) (row (mat_to_cols_list A) i) (col (mat_to_cols_list B) j)"
[PROOF STATE]
proof (prove)
using this:
Matrix_Legacy.mat (mult.row_length (mat_to_cols_list A)) (dim_col A) (mat_to_cols_list A)
Matrix_Legacy.mat (dim_col A) (dim_col B) (mat_to_cols_list B)

goal (1 subgoal):
 1. M ! j ! i = plus_mult.scalar_product (*) 0 (+) (Matrix_Legacy.row (mat_to_cols_list A) i) (Matrix_Legacy.col (mat_to_cols_list B) j)
[PROOF STEP]
using plus_mult.matrix_index a0 a1 row_length_mat_to_cols_list assms(2) plus_mult_cpx M_def
[PROOF STATE]
proof (prove)
using this:
Matrix_Legacy.mat (mult.row_length (mat_to_cols_list A)) (dim_col A) (mat_to_cols_list A)
Matrix_Legacy.mat (dim_col A) (dim_col B) (mat_to_cols_list B)
\<lbrakk>plus_mult ?id ?f ?zer ?g ?inver; Matrix_Legacy.mat (mult.row_length ?m1.0) ?n ?m1.0; Matrix_Legacy.mat ?n ?nc ?m2.0; ?i < mult.row_length ?m1.0; ?j < ?nc\<rbrakk> \<Longrightarrow> mat_multI ?zer ?g ?f (mult.row_length ?m1.0) ?m1.0 ?m2.0 ! ?j ! ?i = plus_mult.scalar_product ?f ?zer ?g (Matrix_Legacy.row ?m1.0 ?i) (Matrix_Legacy.col ?m2.0 ?j)
j < length (mat_to_cols_list (A * B))
i < dim_row A
0 < dim_col ?A \<Longrightarrow> mult.row_length (mat_to_cols_list ?A) = dim_row ?A
0 < dim_col A
plus_mult 1 (*) 0 (+) (a_inv cpx_rng)
M = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B)

goal (1 subgoal):
 1. M ! j ! i = plus_mult.scalar_product (*) 0 (+) (Matrix_Legacy.row (mat_to_cols_list A) i) (Matrix_Legacy.col (mat_to_cols_list B) j)
[PROOF STEP]
by (metis index_mult_mat(3) length_mat_to_cols_list)
[PROOF STATE]
proof (state)
this:
M ! j ! i = plus_mult.scalar_product (*) 0 (+) (Matrix_Legacy.row (mat_to_cols_list A) i) (Matrix_Legacy.col (mat_to_cols_list B) j)

goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M ! j ! i = plus_mult.scalar_product (*) 0 (+) (Matrix_Legacy.row (mat_to_cols_list A) i) (Matrix_Legacy.col (mat_to_cols_list B) j)

goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
have "\<dots> = vec_of_list (row (mat_to_cols_list A) i) \<bullet> vec_of_list (col (mat_to_cols_list B) j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) (Matrix_Legacy.row (mat_to_cols_list A) i) (Matrix_Legacy.col (mat_to_cols_list B) j) = vec_of_list (Matrix_Legacy.row (mat_to_cols_list A) i) \<bullet> vec_of_list (Matrix_Legacy.col (mat_to_cols_list B) j)
[PROOF STEP]
using a0 a1 assms(1)
[PROOF STATE]
proof (prove)
using this:
j < length (mat_to_cols_list (A * B))
i < dim_row A
dim_col A = dim_row B

goal (1 subgoal):
 1. plus_mult.scalar_product (*) 0 (+) (Matrix_Legacy.row (mat_to_cols_list A) i) (Matrix_Legacy.col (mat_to_cols_list B) j) = vec_of_list (Matrix_Legacy.row (mat_to_cols_list A) i) \<bullet> vec_of_list (Matrix_Legacy.col (mat_to_cols_list B) j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
plus_mult.scalar_product (*) 0 (+) (Matrix_Legacy.row (mat_to_cols_list A) i) (Matrix_Legacy.col (mat_to_cols_list B) j) = vec_of_list (Matrix_Legacy.row (mat_to_cols_list A) i) \<bullet> vec_of_list (Matrix_Legacy.col (mat_to_cols_list B) j)

goal (1 subgoal):
 1. \<And>i. i < dim_row A \<Longrightarrow> mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M ! j ! i = vec_of_list (Matrix_Legacy.row (mat_to_cols_list A) i) \<bullet> vec_of_list (Matrix_Legacy.col (mat_to_cols_list B) j)
[PROOF STEP]
show "mat_to_cols_list (A * B) ! j ! i = M ! j ! i"
[PROOF STATE]
proof (prove)
using this:
M ! j ! i = vec_of_list (Matrix_Legacy.row (mat_to_cols_list A) i) \<bullet> vec_of_list (Matrix_Legacy.col (mat_to_cols_list B) j)

goal (1 subgoal):
 1. mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
using mat_to_cols_list_def index_mult_mat(1) a0 a1
[PROOF STATE]
proof (prove)
using this:
M ! j ! i = vec_of_list (Matrix_Legacy.row (mat_to_cols_list A) i) \<bullet> vec_of_list (Matrix_Legacy.col (mat_to_cols_list B) j)
mat_to_cols_list ?A = map (\<lambda>j. map (\<lambda>i. ?A $$ (i, j)) [0..<dim_row ?A]) [0..<dim_col ?A]
\<lbrakk>?i < dim_row ?A; ?j < dim_col ?B\<rbrakk> \<Longrightarrow> (?A * ?B) $$ (?i, ?j) = Matrix.row ?A ?i \<bullet> Matrix.col ?B ?j
j < length (mat_to_cols_list (A * B))
i < dim_row A

goal (1 subgoal):
 1. mat_to_cols_list (A * B) ! j ! i = M ! j ! i
[PROOF STEP]
by(simp add: Matrix_row_is_Legacy_row Matrix_col_is_Legacy_col)
[PROOF STATE]
proof (state)
this:
mat_to_cols_list (A * B) ! j ! i = M ! j ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i < dim_row A \<longrightarrow> mat_to_cols_list (A * B) ! j ! ?i = M ! j ! ?i

goal (1 subgoal):
 1. \<And>j. j < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (mat_to_cols_list (A * B) ! j) = length (M ! j)
?i < dim_row A \<longrightarrow> mat_to_cols_list (A * B) ! j ! ?i = M ! j ! ?i
[PROOF STEP]
show "mat_to_cols_list (A * B) ! j = M ! j"
[PROOF STATE]
proof (prove)
using this:
length (mat_to_cols_list (A * B) ! j) = length (M ! j)
?i < dim_row A \<longrightarrow> mat_to_cols_list (A * B) ! j ! ?i = M ! j ! ?i

goal (1 subgoal):
 1. mat_to_cols_list (A * B) ! j = M ! j
[PROOF STEP]
by(simp add: nth_equalityI f2)
[PROOF STATE]
proof (state)
this:
mat_to_cols_list (A * B) ! j = M ! j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?j < length (mat_to_cols_list (A * B)) \<longrightarrow> mat_to_cols_list (A * B) ! ?j = M ! ?j

goal (1 subgoal):
 1. \<And>i. i < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! i = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B) ! i
[PROOF STEP]
fix i:: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! i = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B) ! i
[PROOF STEP]
assume "i < length (mat_to_cols_list (A * B))"
[PROOF STATE]
proof (state)
this:
i < length (mat_to_cols_list (A * B))

goal (1 subgoal):
 1. \<And>i. i < length (mat_to_cols_list (A * B)) \<Longrightarrow> mat_to_cols_list (A * B) ! i = mat_mult (mult.row_length (mat_to_cols_list A)) (mat_to_cols_list A) (mat_to_cols_list B) ! i
[PROOF STEP]
thus "mat_to_cols_list (A * B) ! i = M ! i"
[PROOF STATE]
proof (prove)
using this:
i < length (mat_to_cols_list (A * B))

goal (1 subgoal):
 1. mat_to_cols_list (A * B) ! i = M ! i
[PROOF STEP]
by (simp add: f1)
[PROOF STATE]
proof (state)
this:
mat_to_cols_list (A * B) ! i = M ! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_integral_cmult_indicator: "A \<in> sets M \<Longrightarrow> (\<integral>\<^sup>+ x. c * indicator A x \<partial>M) = c * emeasure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> sets M \<Longrightarrow> \<integral>\<^sup>+ x. c * indicator A x \<partial>M = c * emeasure M A
[PROOF STEP]
by (subst nn_integral_eq_simple_integral) (auto)


[STATEMENT]
lemma seq_char:
    shows "seq \<mu> \<nu> \<longleftrightarrow> Cell \<mu> \<and> Cell \<nu> \<and> Src \<mu> = Src \<nu> \<and> Trg \<mu> = Trg \<nu> \<and>
                       partial_magma.seq (Hom (Src \<mu>) (Trg \<mu>)) (Map \<mu>) (Map \<nu>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. seq \<mu> \<nu> = ((\<mu> \<noteq> Null \<and> Src \<mu> \<in> Obj \<and> Trg \<mu> \<in> Obj \<and> partial_magma.arr (Hom (Src \<mu>) (Trg \<mu>)) (Map \<mu>)) \<and> (\<nu> \<noteq> Null \<and> Src \<nu> \<in> Obj \<and> Trg \<nu> \<in> Obj \<and> partial_magma.arr (Hom (Src \<nu>) (Trg \<nu>)) (Map \<nu>)) \<and> Src \<mu> = Src \<nu> \<and> Trg \<mu> = Trg \<nu> \<and> partial_magma.arr (Hom (Src \<mu>) (Trg \<mu>)) (Hom (Src \<mu>) (Trg \<mu>) (Map \<mu>) (Map \<nu>)))
[PROOF STEP]
using arr_char vcomp_def
[PROOF STATE]
proof (prove)
using this:
arr ?\<mu> = (?\<mu> \<noteq> Null \<and> Src ?\<mu> \<in> Obj \<and> Trg ?\<mu> \<in> Obj \<and> partial_magma.arr (Hom (Src ?\<mu>) (Trg ?\<mu>)) (Map ?\<mu>))
vcomp ?\<mu> ?\<nu> \<equiv> if (?\<mu> \<noteq> Null \<and> Src ?\<mu> \<in> Obj \<and> Trg ?\<mu> \<in> Obj \<and> partial_magma.arr (Hom (Src ?\<mu>) (Trg ?\<mu>)) (Map ?\<mu>)) \<and> (?\<nu> \<noteq> Null \<and> Src ?\<nu> \<in> Obj \<and> Trg ?\<nu> \<in> Obj \<and> partial_magma.arr (Hom (Src ?\<nu>) (Trg ?\<nu>)) (Map ?\<nu>)) \<and> Src ?\<mu> = Src ?\<nu> \<and> Trg ?\<mu> = Trg ?\<nu> \<and> partial_magma.arr (Hom (Src ?\<mu>) (Trg ?\<mu>)) (Hom (Src ?\<mu>) (Trg ?\<mu>) (Map ?\<mu>) (Map ?\<nu>)) then MkCell (Src ?\<mu>) (Trg ?\<mu>) (Hom (Src ?\<mu>) (Trg ?\<mu>) (Map ?\<mu>) (Map ?\<nu>)) else Null

goal (1 subgoal):
 1. seq \<mu> \<nu> = ((\<mu> \<noteq> Null \<and> Src \<mu> \<in> Obj \<and> Trg \<mu> \<in> Obj \<and> partial_magma.arr (Hom (Src \<mu>) (Trg \<mu>)) (Map \<mu>)) \<and> (\<nu> \<noteq> Null \<and> Src \<nu> \<in> Obj \<and> Trg \<nu> \<in> Obj \<and> partial_magma.arr (Hom (Src \<nu>) (Trg \<nu>)) (Map \<nu>)) \<and> Src \<mu> = Src \<nu> \<and> Trg \<mu> = Trg \<nu> \<and> partial_magma.arr (Hom (Src \<mu>) (Trg \<mu>)) (Hom (Src \<mu>) (Trg \<mu>) (Map \<mu>) (Map \<nu>)))
[PROOF STEP]
by auto


[STATEMENT]
lemma fset_sum_ge_elem: "finite xs \<Longrightarrow> x \<in> xs \<Longrightarrow> (\<Sum>u\<in>xs. (f::'a \<Rightarrow> nat) u) \<ge> f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite xs; x \<in> xs\<rbrakk> \<Longrightarrow> f x \<le> sum f xs
[PROOF STEP]
by (simp add: sum_nonneg_leq_bound)


[STATEMENT]
lemma polytope_scaling:
  assumes "polytope S"  shows "polytope (image (\<lambda>x. c *\<^sub>R x) S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polytope ((*\<^sub>R) c ` S)
[PROOF STEP]
by (simp add: assms polytope_linear_image)


[STATEMENT]
lemma eventually_uminus_at_top_at_bot:
  fixes P::"'a::{ordered_ab_group_add,linorder} \<Rightarrow> bool"
  shows "eventually (P o uminus) at_bot \<longleftrightarrow> eventually P at_top"
    "eventually (P o uminus) at_top \<longleftrightarrow> eventually P at_bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually (P \<circ> uminus) at_bot = eventually P at_top &&& eventually (P \<circ> uminus) at_top = eventually P at_bot
[PROOF STEP]
unfolding eventually_comp_filtermap
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (filtermap uminus at_bot) = eventually P at_top &&& eventually P (filtermap uminus at_top) = eventually P at_bot
[PROOF STEP]
by (fold at_top_mirror at_bot_mirror,auto)


[STATEMENT]
lemma INFM_finite_Bex_distrib: "finite A \<Longrightarrow> (INFM y. \<exists>x\<in>A. P x y) \<longleftrightarrow> (\<exists>x\<in>A. INFM y. P x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> (\<exists>\<^sub>\<infinity>y. \<exists>x\<in>A. P x y) = (\<exists>x\<in>A. \<exists>\<^sub>\<infinity>y. P x y)
[PROOF STEP]
by (fact frequently_bex_finite_distrib)


[STATEMENT]
lemma is_interval_cart:
  "is_interval (s::(real^'n) set) \<longleftrightarrow>
    (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i. ((a$i \<le> x$i \<and> x$i \<le> b$i) \<or> (b$i \<le> x$i \<and> x$i \<le> a$i))) \<longrightarrow> x \<in> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_interval s = (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i \<or> b $ i \<le> x $ i \<and> x $ i \<le> a $ i) \<longrightarrow> x \<in> s)
[PROOF STEP]
by (simp add: is_interval_def Ball_def Basis_vec_def inner_axis imp_ex)


[STATEMENT]
lemma coord_partial_eval_add:
  assumes "as \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "p \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  assumes "Q \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  shows "coord_partial_eval R S as  (p \<oplus>\<^bsub>(R[\<X>\<^bsub>n\<^esub>])\<^esub> Q) =
          (coord_partial_eval R S as  p) \<oplus>\<^bsub>(R[\<X>\<^bsub>n\<^esub>])\<^esub> (coord_partial_eval R S as  Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coord_partial_eval R S as (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) = coord_partial_eval R S as p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> coord_partial_eval R S as Q
[PROOF STEP]
using assms R.poly_eval_add[of p "{..<n}" Q "(point_to_eval_map R as)" S] Pring_def[of R "{..<n}"]
  point_to_eval_map_closed[of as n]
[PROOF STATE]
proof (prove)
using this:
as \<in> carrier (R\<^bsup>n\<^esup>)
p \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
\<lbrakk>p \<in> carrier R [\<X>\<^bsub>{..<n}\<^esub>]; Q \<in> carrier R [\<X>\<^bsub>{..<n}\<^esub>]; (\<lambda>i. if i < length as then as ! i else \<zero>) \<in> UNIV \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) (p \<Oplus> Q) = poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) p \<Oplus> poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) Q
Pring R {..<n} \<equiv> \<lparr>carrier = carrier R [\<X>\<^bsub>{..<n}\<^esub>], monoid.mult = (\<Otimes>\<^sub>p), one = R.indexed_const \<one>, zero = R.indexed_const \<zero>, add = (\<Oplus>), smult = poly_scalar_mult R\<rparr>
as \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> (\<lambda>i. if i < length as then as ! i else \<zero>) \<in> UNIV \<rightarrow> carrier R

goal (1 subgoal):
 1. coord_partial_eval R S as (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) = coord_partial_eval R S as p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> coord_partial_eval R S as Q
[PROOF STEP]
unfolding coord_partial_eval_def
[PROOF STATE]
proof (prove)
using this:
as \<in> carrier (R\<^bsup>n\<^esup>)
p \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
\<lbrakk>p \<in> carrier R [\<X>\<^bsub>{..<n}\<^esub>]; Q \<in> carrier R [\<X>\<^bsub>{..<n}\<^esub>]; (\<lambda>i. if i < length as then as ! i else \<zero>) \<in> UNIV \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) (p \<Oplus> Q) = poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) p \<Oplus> poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) Q
Pring R {..<n} \<equiv> \<lparr>carrier = carrier R [\<X>\<^bsub>{..<n}\<^esub>], monoid.mult = (\<Otimes>\<^sub>p), one = R.indexed_const \<one>, zero = R.indexed_const \<zero>, add = (\<Oplus>), smult = poly_scalar_mult R\<rparr>
as \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> (\<lambda>i. if i < length as then as ! i else \<zero>) \<in> UNIV \<rightarrow> carrier R

goal (1 subgoal):
 1. poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) = poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) Q
[PROOF STEP]
by (metis R.Pring_add R.Pring_car coord_ring_def)


[STATEMENT]
lemma discrete_compact_space_eq_finite:
   "X derived_set_of (topspace X) = {} \<Longrightarrow> (compact_space X \<longleftrightarrow> finite(topspace X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X derived_set_of topspace X = {} \<Longrightarrow> compact_space X = finite (topspace X)
[PROOF STEP]
by (metis compact_space_discrete_topology discrete_topology_unique_derived_set)


[STATEMENT]
lemma (in ring) canonical_proj_ring_hom:
  assumes "ideal I R" and "ideal J R"
  shows "ring_hom_ring R (RDirProd (R Quot I) (R Quot J)) (canonical_proj I J)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_ring R (RDirProd (R Quot I) (R Quot J)) (canonical_proj I J)
[PROOF STEP]
using ring_hom_ring.intro[OF ring_axioms RDirProd_ring[OF assms[THEN ideal.quotient_is_ring]]]
[PROOF STATE]
proof (prove)
using this:
ring_hom_ring_axioms R (RDirProd (R Quot I) (R Quot J)) ?h \<Longrightarrow> ring_hom_ring R (RDirProd (R Quot I) (R Quot J)) ?h

goal (1 subgoal):
 1. ring_hom_ring R (RDirProd (R Quot I) (R Quot J)) (canonical_proj I J)
[PROOF STEP]
by (simp add: ring_hom_ring_axioms_def canonical_proj_is_hom[OF assms])


[STATEMENT]
lemma closure_cbox [simp]: "closure (cbox a b) = cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (cbox a b) = cbox a b
[PROOF STEP]
by (simp add: closed_cbox)


[STATEMENT]
lemma countable_image_inj_eq:
   "inj_on f S \<Longrightarrow> countable(f ` S) \<longleftrightarrow> countable S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f S \<Longrightarrow> countable (f ` S) = countable S
[PROOF STEP]
using countable_image_inj_on
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>countable (?f ` ?A); inj_on ?f ?A\<rbrakk> \<Longrightarrow> countable ?A

goal (1 subgoal):
 1. inj_on f S \<Longrightarrow> countable (f ` S) = countable S
[PROOF STEP]
by blast


[STATEMENT]
lemma index_mult_mat[simp]:
  "i < dim_row A \<Longrightarrow> j < dim_col B \<Longrightarrow> (A * B) $$ (i,j) = row A i \<bullet> col B j"
  "dim_row (A * B) = dim_row A" "dim_col (A * B) = dim_col B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < dim_row A; j < dim_col B\<rbrakk> \<Longrightarrow> (A * B) $$ (i, j) = row A i \<bullet> col B j) &&& dim_row (A * B) = dim_row A &&& dim_col (A * B) = dim_col B
[PROOF STEP]
by (auto simp: times_mat_def)


[STATEMENT]
lemma integral_reflect_and_add:
  fixes f :: "real \<Rightarrow> 'b::euclidean_space"
  assumes "integrable (lebesgue_on {-a..a}) f"
  shows "integral\<^sup>L (lebesgue_on {-a..a}) f = integral\<^sup>L (lebesgue_on {0..a})  (\<lambda>x. f x + f(-x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
proof (cases "a \<ge> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 \<le> a

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
have f: "integrable (lebesgue_on {0..a}) f" "integrable (lebesgue_on {-a..0}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {0..a}) f &&& integrable (lebesgue_on {- a..0}) f
[PROOF STEP]
using integrable_subinterval assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable (lebesgue_on {?a..?b}) ?f; {?c..?d} \<subseteq> {?a..?b}\<rbrakk> \<Longrightarrow> integrable (lebesgue_on {?c..?d}) ?f
integrable (lebesgue_on {- a..a}) f

goal (1 subgoal):
 1. integrable (lebesgue_on {0..a}) f &&& integrable (lebesgue_on {- a..0}) f
[PROOF STEP]
by fastforce+
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {0..a}) f
integrable (lebesgue_on {- a..0}) f

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable (lebesgue_on {0..a}) f
integrable (lebesgue_on {- a..0}) f
[PROOF STEP]
have fm: "integrable (lebesgue_on {0..a}) (\<lambda>x. f(-x))"
[PROOF STATE]
proof (prove)
using this:
integrable (lebesgue_on {0..a}) f
integrable (lebesgue_on {- a..0}) f

goal (1 subgoal):
 1. integrable (lebesgue_on {0..a}) (\<lambda>x. f (- x))
[PROOF STEP]
using integrable_reflect_real
[PROOF STATE]
proof (prove)
using this:
integrable (lebesgue_on {0..a}) f
integrable (lebesgue_on {- a..0}) f
integrable (lebesgue_on {- ?b..- ?a}) (\<lambda>x. ?f (- x)) = integrable (lebesgue_on {?a..?b}) ?f

goal (1 subgoal):
 1. integrable (lebesgue_on {0..a}) (\<lambda>x. f (- x))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {0..a}) (\<lambda>x. f (- x))

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
have "integral\<^sup>L (lebesgue_on {-a..a}) f = integral\<^sup>L (lebesgue_on {-a..0}) f + integral\<^sup>L (lebesgue_on {0..a}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {- a..a}) f = integral\<^sup>L (lebesgue_on {- a..0}) f + integral\<^sup>L (lebesgue_on {0..a}) f
[PROOF STEP]
by (simp add: True assms integral_combine)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (lebesgue_on {- a..a}) f = integral\<^sup>L (lebesgue_on {- a..0}) f + integral\<^sup>L (lebesgue_on {0..a}) f

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (lebesgue_on {- a..a}) f = integral\<^sup>L (lebesgue_on {- a..0}) f + integral\<^sup>L (lebesgue_on {0..a}) f

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
have "\<dots> = integral\<^sup>L (lebesgue_on {0..a}) (\<lambda>x. f(-x)) + integral\<^sup>L (lebesgue_on {0..a}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {- a..0}) f + integral\<^sup>L (lebesgue_on {0..a}) f = (LINT x|lebesgue_on {0..a}. f (- x)) + integral\<^sup>L (lebesgue_on {0..a}) f
[PROOF STEP]
by (metis (no_types) add.inverse_inverse add.inverse_neutral integral_reflect_real)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (lebesgue_on {- a..0}) f + integral\<^sup>L (lebesgue_on {0..a}) f = (LINT x|lebesgue_on {0..a}. f (- x)) + integral\<^sup>L (lebesgue_on {0..a}) f

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (lebesgue_on {- a..0}) f + integral\<^sup>L (lebesgue_on {0..a}) f = (LINT x|lebesgue_on {0..a}. f (- x)) + integral\<^sup>L (lebesgue_on {0..a}) f

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
have "\<dots> = integral\<^sup>L (lebesgue_on {0..a}) (\<lambda>x. f x + f(-x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LINT x|lebesgue_on {0..a}. f (- x)) + integral\<^sup>L (lebesgue_on {0..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
by (simp add: fm f)
[PROOF STATE]
proof (state)
this:
(LINT x|lebesgue_on {0..a}. f (- x)) + integral\<^sup>L (lebesgue_on {0..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
 2. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)

goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)

goal (1 subgoal):
 1. \<not> 0 \<le> a \<Longrightarrow> integral\<^sup>L (lebesgue_on {- a..a}) f = LINT x|lebesgue_on {0..a}. f x + f (- x)
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma pCons_0_as_mult:
  fixes p:: "'a :: comm_semiring_1 poly"
  shows "pCons 0 p = [:0,1:] * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pCons (0::'a) p = [:0::'a, 1::'a:] * p
[PROOF STEP]
by auto


[STATEMENT]
lemma items_le_idempotent: "items_le k (items_le k I) = items_le k I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. items_le k (items_le k I) = items_le k I
[PROOF STEP]
using items_le_def
[PROOF STATE]
proof (prove)
using this:
items_le ?k ?I = {x \<in> ?I. item_end x \<le> ?k}

goal (1 subgoal):
 1. items_le k (items_le k I) = items_le k I
[PROOF STEP]
by auto


[STATEMENT]
theorem circular:
  "[| x \<sqsubseteq> y; y \<sqsubseteq> z; z \<sqsubseteq> x |] ==> x = y & y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> z; z \<sqsubseteq> x\<rbrakk> \<Longrightarrow> x = y \<and> y = z
[PROOF STEP]
by (blast intro: trans)


[STATEMENT]
lemma mon_mono: "mono r = ((\<forall>X Y. (X\<subseteq>Y \<longrightarrow> r(X)\<subseteq>r(Y))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono r = (\<forall>X Y. X \<subseteq> Y \<longrightarrow> r X \<subseteq> r Y)
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. x \<subseteq> y \<longrightarrow> r x \<subseteq> r y) = (\<forall>X Y. X \<subseteq> Y \<longrightarrow> r X \<subseteq> r Y)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in linorder_topology) tendsto_min[tendsto_intros]:
  assumes X: "(X \<longlongrightarrow> x) net"
    and Y: "(Y \<longlongrightarrow> y) net"
  shows "((\<lambda>x. min (X x) (Y x)) \<longlongrightarrow> min x y) net"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. min (X x) (Y x)) \<longlongrightarrow> min x y) net
[PROOF STEP]
proof (rule order_tendstoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < min x y \<Longrightarrow> \<forall>\<^sub>F x in net. a < min (X x) (Y x)
 2. \<And>a. min x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < min x y \<Longrightarrow> \<forall>\<^sub>F x in net. a < min (X x) (Y x)
 2. \<And>a. min x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
assume "a < min x y"
[PROOF STATE]
proof (state)
this:
a < min x y

goal (2 subgoals):
 1. \<And>a. a < min x y \<Longrightarrow> \<forall>\<^sub>F x in net. a < min (X x) (Y x)
 2. \<And>a. min x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < min x y
[PROOF STEP]
show "eventually (\<lambda>x. a < min (X x) (Y x)) net"
[PROOF STATE]
proof (prove)
using this:
a < min x y

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. a < min (X x) (Y x)
[PROOF STEP]
using order_tendstoD(1)[OF X, of a] order_tendstoD(1)[OF Y, of a]
[PROOF STATE]
proof (prove)
using this:
a < min x y
a < x \<Longrightarrow> \<forall>\<^sub>F x in net. a < X x
a < y \<Longrightarrow> \<forall>\<^sub>F x in net. a < Y x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. a < min (X x) (Y x)
[PROOF STEP]
by (auto simp: eventually_conj_iff)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in net. a < min (X x) (Y x)

goal (1 subgoal):
 1. \<And>a. min x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. min x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. min x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
assume "min x y < a"
[PROOF STATE]
proof (state)
this:
min x y < a

goal (1 subgoal):
 1. \<And>a. min x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
min x y < a
[PROOF STEP]
show "eventually (\<lambda>x. min (X x) (Y x) < a) net"
[PROOF STATE]
proof (prove)
using this:
min x y < a

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
using order_tendstoD(2)[OF X, of a] order_tendstoD(2)[OF Y, of a]
[PROOF STATE]
proof (prove)
using this:
min x y < a
x < a \<Longrightarrow> \<forall>\<^sub>F x in net. X x < a
y < a \<Longrightarrow> \<forall>\<^sub>F x in net. Y x < a

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. min (X x) (Y x) < a
[PROOF STEP]
by (auto simp: min_less_iff_disj elim: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in net. min (X x) (Y x) < a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma jump_poly_smult_1:
  fixes p q::"real poly" and c::real
  shows "jump_poly (smult c q) p x= sign c * jump_poly q p x" (is "?L=?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
proof (cases "c=0\<or> q=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = 0 \<or> q = 0 \<Longrightarrow> jump_poly (smult c q) p x = sign c * jump_poly q p x
 2. \<not> (c = 0 \<or> q = 0) \<Longrightarrow> jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = 0 \<or> q = 0

goal (2 subgoals):
 1. c = 0 \<or> q = 0 \<Longrightarrow> jump_poly (smult c q) p x = sign c * jump_poly q p x
 2. \<not> (c = 0 \<or> q = 0) \<Longrightarrow> jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
c = 0 \<or> q = 0

goal (1 subgoal):
 1. jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
unfolding jump_poly_def
[PROOF STATE]
proof (prove)
using this:
c = 0 \<or> q = 0

goal (1 subgoal):
 1. (if p \<noteq> 0 \<and> smult c q \<noteq> 0 \<and> odd (order x p - order x (smult c q)) then if sign_r_pos (smult c q * p) x then 1 else - 1 else 0) = sign c * (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> odd (order x p - order x q) then if sign_r_pos (q * p) x then 1 else - 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jump_poly (smult c q) p x = sign c * jump_poly q p x

goal (1 subgoal):
 1. \<not> (c = 0 \<or> q = 0) \<Longrightarrow> jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (c = 0 \<or> q = 0) \<Longrightarrow> jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (c = 0 \<or> q = 0)

goal (1 subgoal):
 1. \<not> (c = 0 \<or> q = 0) \<Longrightarrow> jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
hence "c\<noteq>0" and "q\<noteq>0"
[PROOF STATE]
proof (prove)
using this:
\<not> (c = 0 \<or> q = 0)

goal (1 subgoal):
 1. c \<noteq> 0 &&& q \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
q \<noteq> 0

goal (1 subgoal):
 1. \<not> (c = 0 \<or> q = 0) \<Longrightarrow> jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
q \<noteq> 0

goal (1 subgoal):
 1. jump_poly (smult c q) p x = sign c * jump_poly q p x
[PROOF STEP]
unfolding jump_poly_def
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
q \<noteq> 0

goal (1 subgoal):
 1. (if p \<noteq> 0 \<and> smult c q \<noteq> 0 \<and> odd (order x p - order x (smult c q)) then if sign_r_pos (smult c q * p) x then 1 else - 1 else 0) = sign c * (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> odd (order x p - order x q) then if sign_r_pos (q * p) x then 1 else - 1 else 0)
[PROOF STEP]
using order_smult[OF \<open>c\<noteq>0\<close>] sign_r_pos_smult[OF \<open>c\<noteq>0\<close>, of "q*p" x] \<open>q\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
q \<noteq> 0
order ?x (smult c ?p) = order ?x ?p
q * p \<noteq> 0 \<Longrightarrow> sign_r_pos (smult c (q * p)) x = (if 0 < c then sign_r_pos (q * p) x else \<not> sign_r_pos (q * p) x)
q \<noteq> 0

goal (1 subgoal):
 1. (if p \<noteq> 0 \<and> smult c q \<noteq> 0 \<and> odd (order x p - order x (smult c q)) then if sign_r_pos (smult c q * p) x then 1 else - 1 else 0) = sign c * (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> odd (order x p - order x q) then if sign_r_pos (q * p) x then 1 else - 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jump_poly (smult c q) p x = sign c * jump_poly q p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma supremum_unique:
  "a \<in> supremum A \<Longrightarrow> b \<in> supremum A \<Longrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> supremum A; b \<in> supremum A\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
apply (simp add: supremum_def upper_bound_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<forall>x\<in>A. x \<le> a) \<and> (\<forall>x. (\<forall>xa\<in>A. xa \<le> x) \<longrightarrow> a \<le> x); (\<forall>x\<in>A. x \<le> b) \<and> (\<forall>x. (\<forall>xa\<in>A. xa \<le> x) \<longrightarrow> b \<le> x)\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(\<forall>x\<in>A. x \<le> a) \<and> (\<forall>x. (\<forall>xa\<in>A. xa \<le> x) \<longrightarrow> a \<le> x); (\<forall>x\<in>A. x \<le> b) \<and> (\<forall>x. (\<forall>xa\<in>A. xa \<le> x) \<longrightarrow> b \<le> x)\<rbrakk> \<Longrightarrow> a \<le> b
 2. \<lbrakk>(\<forall>x\<in>A. x \<le> a) \<and> (\<forall>x. (\<forall>xa\<in>A. xa \<le> x) \<longrightarrow> a \<le> x); (\<forall>x\<in>A. x \<le> b) \<and> (\<forall>x. (\<forall>xa\<in>A. xa \<le> x) \<longrightarrow> b \<le> x)\<rbrakk> \<Longrightarrow> b \<le> a
[PROOF STEP]
by auto


[STATEMENT]
lemma in_set_least_squares_approximation_eq_full_rank:
  fixes A::"real^'cols::mod_type^'rows::mod_type"
  assumes r: "rank A = ncols A"
  shows "(x \<in> set_least_squares_approximation A b) = (x = matrix_inv (transpose A ** A)**transpose A *v b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set_least_squares_approximation A b) = (x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<in> set_least_squares_approximation A b) = (x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b)
[PROOF STEP]
have int_tA: "invertible (transpose A ** A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
using invertible_transpose_mult[OF r]
[PROOF STATE]
proof (prove)
using this:
invertible (Finite_Cartesian_Product.transpose A ** A)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
invertible (Finite_Cartesian_Product.transpose A ** A)

goal (1 subgoal):
 1. (x \<in> set_least_squares_approximation A b) = (x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set_least_squares_approximation A b) = (x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> set_least_squares_approximation A b \<Longrightarrow> x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b
 2. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> set_least_squares_approximation A b \<Longrightarrow> x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b
 2. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
assume "x \<in> set_least_squares_approximation A b"
[PROOF STATE]
proof (state)
this:
x \<in> set_least_squares_approximation A b

goal (2 subgoals):
 1. x \<in> set_least_squares_approximation A b \<Longrightarrow> x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b
 2. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
hence "transpose A ** A *v x = transpose A *v b"
[PROOF STATE]
proof (prove)
using this:
x \<in> set_least_squares_approximation A b

goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b
[PROOF STEP]
using in_set_least_squares_approximation_eq
[PROOF STATE]
proof (prove)
using this:
x \<in> set_least_squares_approximation A b
(?x \<in> set_least_squares_approximation ?A ?b) = (Finite_Cartesian_Product.transpose ?A ** ?A *v ?x = Finite_Cartesian_Product.transpose ?A *v ?b)

goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b

goal (2 subgoals):
 1. x \<in> set_least_squares_approximation A b \<Longrightarrow> x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b
 2. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
thus "x = matrix_inv (transpose A ** A) ** transpose A *v b"
[PROOF STATE]
proof (prove)
using this:
Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b

goal (1 subgoal):
 1. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b
[PROOF STEP]
by (metis int_tA matrix_inv_left matrix_vector_mul_assoc matrix_vector_mul_lid)
[PROOF STATE]
proof (state)
this:
x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b

goal (1 subgoal):
 1. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
assume "x = matrix_inv (transpose A ** A) ** transpose A *v b"
[PROOF STATE]
proof (state)
this:
x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b

goal (1 subgoal):
 1. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
hence "transpose A ** A *v x = transpose A *v b"
[PROOF STATE]
proof (prove)
using this:
x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b

goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b
[PROOF STEP]
by (metis int_tA matrix_inv_right matrix_vector_mul_assoc matrix_vector_mul_lid)
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b

goal (1 subgoal):
 1. x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b \<Longrightarrow> x \<in> set_least_squares_approximation A b
[PROOF STEP]
thus "x \<in> set_least_squares_approximation A b"
[PROOF STATE]
proof (prove)
using this:
Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b

goal (1 subgoal):
 1. x \<in> set_least_squares_approximation A b
[PROOF STEP]
unfolding in_set_least_squares_approximation_eq
[PROOF STATE]
proof (prove)
using this:
Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b

goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** A *v x = Finite_Cartesian_Product.transpose A *v b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x \<in> set_least_squares_approximation A b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(x \<in> set_least_squares_approximation A b) = (x = matrix_inv (Finite_Cartesian_Product.transpose A ** A) ** Finite_Cartesian_Product.transpose A *v b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transpose_union: "transpose_board (b\<^sub>1 \<union> b\<^sub>2) = transpose_board b\<^sub>1 \<union> transpose_board b\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_board (b\<^sub>1 \<union> b\<^sub>2) = transpose_board b\<^sub>1 \<union> transpose_board b\<^sub>2
[PROOF STEP]
unfolding transpose_board_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(j, i) |i j. (i, j) \<in> b\<^sub>1 \<union> b\<^sub>2} = {(j, i) |i j. (i, j) \<in> b\<^sub>1} \<union> {(j, i) |i j. (i, j) \<in> b\<^sub>2}
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_set_has_max2:
  "\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists> max \<in> A. \<forall> a \<in> A. length a \<le> length max"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>max\<in>A. \<forall>a\<in>A. length a \<le> length max
[PROOF STEP]
apply(induct rule:finite.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {} \<noteq> {} \<Longrightarrow> \<exists>max\<in>{}. \<forall>a\<in>{}. length a \<le> length max
 2. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<Longrightarrow> \<exists>max\<in>A. \<forall>a\<in>A. length a \<le> length max; insert a A \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>max\<in>insert a A. \<forall>a\<in>insert a A. length a \<le> length max
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<Longrightarrow> \<exists>max\<in>A. \<forall>a\<in>A. length a \<le> length max; insert a A \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>max\<in>insert a A. \<forall>a\<in>insert a A. length a \<le> length max
[PROOF STEP]
by (metis (no_types) all_not_in_conv insert_iff linorder_le_cases order_trans)


[STATEMENT]
lemma content_normalize [simp]:
  fixes p :: "'a :: {factorial_semiring, idom_divide, semiring_gcd, normalization_semidom_multiplicative} poly"
  shows "content (normalize p) = content p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (normalize p) = content p
[PROOF STEP]
proof (cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> content (normalize p) = content p
 2. p \<noteq> 0 \<Longrightarrow> content (normalize p) = content p
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> content (normalize p) = content p
 2. p \<noteq> 0 \<Longrightarrow> content (normalize p) = content p
[PROOF STEP]
have "content p = content (unit_factor p * normalize p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content p = content (unit_factor p * normalize p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
content p = content (unit_factor p * normalize p)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> content (normalize p) = content p
 2. p \<noteq> 0 \<Longrightarrow> content (normalize p) = content p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
content p = content (unit_factor p * normalize p)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> content (normalize p) = content p
 2. p \<noteq> 0 \<Longrightarrow> content (normalize p) = content p
[PROOF STEP]
have "\<dots> = content (unit_factor p) * content (normalize p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (unit_factor p * normalize p) = content (unit_factor p) * content (normalize p)
[PROOF STEP]
by (rule content_mult)
[PROOF STATE]
proof (state)
this:
content (unit_factor p * normalize p) = content (unit_factor p) * content (normalize p)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> content (normalize p) = content p
 2. p \<noteq> 0 \<Longrightarrow> content (normalize p) = content p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
content (unit_factor p * normalize p) = content (unit_factor p) * content (normalize p)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> content (normalize p) = content p
 2. p \<noteq> 0 \<Longrightarrow> content (normalize p) = content p
[PROOF STEP]
have "content (unit_factor p) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (unit_factor p) = (1::'a)
[PROOF STEP]
by (auto simp: unit_factor_poly_def)
[PROOF STATE]
proof (state)
this:
content (unit_factor p) = (1::'a)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> content (normalize p) = content p
 2. p \<noteq> 0 \<Longrightarrow> content (normalize p) = content p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
content p = (1::'a) * content (normalize p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
content p = (1::'a) * content (normalize p)

goal (1 subgoal):
 1. content (normalize p) = content p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
content (normalize p) = content p

goal (1 subgoal):
 1. p = 0 \<Longrightarrow> content (normalize p) = content p
[PROOF STEP]
qed auto


[STATEMENT]
lemma complex_Re_le_cmod: "Re x \<le> cmod x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x \<le> cmod x
[PROOF STEP]
unfolding norm_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x \<le> sqrt ((Re x)\<^sup>2 + (Im x)\<^sup>2)
[PROOF STEP]
by (rule real_sqrt_sum_squares_ge1)


[STATEMENT]
lemma irreducible_pos_gcd_twice:
  fixes p q :: "int poly"
  assumes p: "irreducible p" "lead_coeff p > 0"
  and q: "irreducible q" "lead_coeff q > 0"
  shows "gcd p q = 1 \<or> p = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd p q = 1 \<or> p = q
[PROOF STEP]
proof (cases "gcd p q = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. gcd p q = 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
 2. gcd p q \<noteq> 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
gcd p q \<noteq> 1

goal (2 subgoals):
 1. gcd p q = 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
 2. gcd p q \<noteq> 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
[PROOF STEP]
note pq = this
[PROOF STATE]
proof (state)
this:
gcd p q \<noteq> 1

goal (2 subgoals):
 1. gcd p q = 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
 2. gcd p q \<noteq> 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
[PROOF STEP]
have "p = gcd p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = gcd p q
[PROOF STEP]
using irreducible_pos_gcd [OF p, of q] pq
[PROOF STATE]
proof (prove)
using this:
gcd p q \<in> {1, p}
gcd p q \<noteq> 1

goal (1 subgoal):
 1. p = gcd p q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = gcd p q

goal (2 subgoals):
 1. gcd p q = 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
 2. gcd p q \<noteq> 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p = gcd p q

goal (2 subgoals):
 1. gcd p q = 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
 2. gcd p q \<noteq> 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
[PROOF STEP]
have "\<dots> = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd p q = q
[PROOF STEP]
using irreducible_pos_gcd [OF q, of p] pq
[PROOF STATE]
proof (prove)
using this:
gcd q p \<in> {1, q}
gcd p q \<noteq> 1

goal (1 subgoal):
 1. gcd p q = q
[PROOF STEP]
by (auto simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
gcd p q = q

goal (2 subgoals):
 1. gcd p q = 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
 2. gcd p q \<noteq> 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p = q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = q

goal (1 subgoal):
 1. gcd p q = 1 \<or> p = q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gcd p q = 1 \<or> p = q

goal (1 subgoal):
 1. gcd p q = 1 \<Longrightarrow> gcd p q = 1 \<or> p = q
[PROOF STEP]
qed simp


[STATEMENT]
lemma real_of_int_div:
  "d dvd n \<Longrightarrow> real_of_int (n div d) = real_of_int n / real_of_int d" for d n :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d dvd n \<Longrightarrow> real_of_int (n div d) = real_of_int n / real_of_int d
[PROOF STEP]
by (simp add: real_of_int_div_aux)


[STATEMENT]
lemma scalar_vec_plus_distrib_right:
  assumes wf1: "vec nr u"
  assumes wf2: "vec nr v"
  assumes wf3: "vec nr w"
  shows "scalar_prod u (vec_plus v w) = plus (scalar_prod u v) (scalar_prod u w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_prod u (vec_plus v w) = scalar_prod u v + scalar_prod u w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
vec nr u
vec nr v
vec nr w

goal (1 subgoal):
 1. scalar_prod u (vec_plus v w) = scalar_prod u v + scalar_prod u w
[PROOF STEP]
unfolding vec_def scalar_prodI_def vec_plusI_def
[PROOF STATE]
proof (prove)
using this:
length u = nr
length v = nr
length w = nr

goal (1 subgoal):
 1. foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
proof (induct nr arbitrary: u v w)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>u v w. \<lbrakk>length u = 0; length v = 0; length w = 0\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
 2. \<And>nr u v w. \<lbrakk>\<And>u v w. \<lbrakk>length u = nr; length v = nr; length w = nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a); length u = Suc nr; length v = Suc nr; length w = Suc nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n

goal (2 subgoals):
 1. \<And>u v w. \<lbrakk>length u = 0; length v = 0; length w = 0\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
 2. \<And>nr u v w. \<lbrakk>\<And>u v w. \<lbrakk>length u = nr; length v = nr; length w = nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a); length u = Suc nr; length v = Suc nr; length w = Suc nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n
[PROOF STEP]
obtain a uu where u: "u = a # uu"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n

goal (1 subgoal):
 1. (\<And>a uu. u = a # uu \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases u, auto)
[PROOF STATE]
proof (state)
this:
u = a # uu

goal (2 subgoals):
 1. \<And>u v w. \<lbrakk>length u = 0; length v = 0; length w = 0\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
 2. \<And>nr u v w. \<lbrakk>\<And>u v w. \<lbrakk>length u = nr; length v = nr; length w = nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a); length u = Suc nr; length v = Suc nr; length w = Suc nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n
[PROOF STEP]
obtain b vv where v: "v = b # vv"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n

goal (1 subgoal):
 1. (\<And>b vv. v = b # vv \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases v, auto)
[PROOF STATE]
proof (state)
this:
v = b # vv

goal (2 subgoals):
 1. \<And>u v w. \<lbrakk>length u = 0; length v = 0; length w = 0\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
 2. \<And>nr u v w. \<lbrakk>\<And>u v w. \<lbrakk>length u = nr; length v = nr; length w = nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a); length u = Suc nr; length v = Suc nr; length w = Suc nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n
[PROOF STEP]
obtain c ww where w: "w = c # ww"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n

goal (1 subgoal):
 1. (\<And>c ww. w = c # ww \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases w, auto)
[PROOF STATE]
proof (state)
this:
w = c # ww

goal (2 subgoals):
 1. \<And>u v w. \<lbrakk>length u = 0; length v = 0; length w = 0\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
 2. \<And>nr u v w. \<lbrakk>\<And>u v w. \<lbrakk>length u = nr; length v = nr; length w = nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a); length u = Suc nr; length v = Suc nr; length w = Suc nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
from Suc u v w
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n
u = a # uu
v = b # vv
w = c # ww
[PROOF STEP]
have lu: "length uu = n" and lv: "length vv = n" and lw: "length ww = n"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length ?u1 = n; length ?v1 = n; length ?w1 = n\<rbrakk> \<Longrightarrow> foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 (map (\<lambda>xy. fst xy + snd xy) (zip ?v1 ?w1))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?v1) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip ?u1 ?w1) (0::'a)
length u = Suc n
length v = Suc n
length w = Suc n
u = a # uu
v = b # vv
w = c # ww

goal (1 subgoal):
 1. length uu = n &&& length vv = n &&& length ww = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length uu = n
length vv = n
length ww = n

goal (2 subgoals):
 1. \<And>u v w. \<lbrakk>length u = 0; length v = 0; length w = 0\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
 2. \<And>nr u v w. \<lbrakk>\<And>u v w. \<lbrakk>length u = nr; length v = nr; length w = nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a); length u = Suc nr; length v = Suc nr; length w = Suc nr\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
by (simp only: u v w, simp, simp only: Suc(1)[OF lu lv lw], simp add: add.commute[of _ "times a c"] distrib_left add.assoc[symmetric])
[PROOF STATE]
proof (state)
this:
foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip u w) (0::'a)

goal (1 subgoal):
 1. \<And>u v w. \<lbrakk>length u = 0; length v = 0; length w = 0\<rbrakk> \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip u (map (\<lambda>xy. fst xy + snd xy) (zip v w))) (0::'a) = foldr (\<lambda>(x, y). (+) (x * y)) (zip u v) (0::'a) + foldr (\<lambda>(x, y). (+) (x * y)) (zip u w) (0::'a)
[PROOF STEP]
qed simp


[STATEMENT]
lemma prod_relE:
  assumes "(p,p')\<in>\<langle>R1,R2\<rangle>prod_rel"
  obtains a b a' b' where "p=(a,b)" and "p'=(a',b')"
  and "(a,a')\<in>R1" and "(b,b')\<in>R2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b a' b'. \<lbrakk>p = (a, b); p' = (a', b'); (a, a') \<in> R1; (b, b') \<in> R2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(p, p') \<in> R1 \<times>\<^sub>r R2

goal (1 subgoal):
 1. (\<And>a b a' b'. \<lbrakk>p = (a, b); p' = (a', b'); (a, a') \<in> R1; (b, b') \<in> R2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: prod_rel_def)


[STATEMENT]
lemma setdist_refl: "setdist S S = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. setdist S S = 0
[PROOF STEP]
apply (cases "S = {}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> setdist S S = 0
 2. S \<noteq> {} \<Longrightarrow> setdist S S = 0
[PROOF STEP]
apply (force simp add: setdist_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> setdist S S = 0
[PROOF STEP]
apply (rule antisym [OF _ setdist_pos_le])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> setdist S S \<le> 0
[PROOF STEP]
apply (metis all_not_in_conv dist_self setdist_le_dist)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma density_simp: "density = card (E) / ((card X) * (card Y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. density = real graph_size / real (card X * card Y)
[PROOF STEP]
unfolding edge_density_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (all_edges_between X Y)) / real (card X * card Y) = real graph_size / real (card X * card Y)
[PROOF STEP]
using card_edges_between_set
[PROOF STATE]
proof (prove)
using this:
card (all_edges_between X Y) = graph_size

goal (1 subgoal):
 1. real (card (all_edges_between X Y)) / real (card X * card Y) = real graph_size / real (card X * card Y)
[PROOF STEP]
by auto


[STATEMENT]
lemma M_0[simp]: "M 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M 0 = 0
[PROOF STEP]
by (auto simp add: M_def)


[STATEMENT]
lemma fset_of_list_remdups [simp]: "fset_of_list (remdups l) = fset_of_list l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fset_of_list (remdups l) = fset_of_list l
[PROOF STEP]
apply (induct l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. fset_of_list (remdups []) = fset_of_list []
 2. \<And>a l. fset_of_list (remdups l) = fset_of_list l \<Longrightarrow> fset_of_list (remdups (a # l)) = fset_of_list (a # l)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. fset_of_list (remdups l) = fset_of_list l \<Longrightarrow> fset_of_list (remdups (a # l)) = fset_of_list (a # l)
[PROOF STEP]
by (simp add: finsert_absorb fset_of_list_elem)


[STATEMENT]
lemma upper_triangular_Z_eq_Q:
  "upper_triangular (map_matrix rat_of_int A) = upper_triangular A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular (map_matrix rat_of_int A) = upper_triangular A
[PROOF STEP]
unfolding upper_triangular_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i j. j < i \<longrightarrow> map_matrix rat_of_int A $ i $ j = 0) = (\<forall>i j. j < i \<longrightarrow> A $ i $ j = 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma split_shortest_path: "isShortestPath u (p1@p2) v
  \<Longrightarrow> (\<exists>w. isShortestPath u p1 w \<and> isShortestPath w p2 v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isShortestPath u (p1 @ p2) v \<Longrightarrow> \<exists>w. isShortestPath u p1 w \<and> isShortestPath w p2 v
[PROOF STEP]
apply (auto simp: isShortestPath_min_dist_def isPath_append)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; isPath u p1 w; isPath w p2 v\<rbrakk> \<Longrightarrow> \<exists>w. isPath u p1 w \<and> length p1 = min_dist u w \<and> isPath w p2 v \<and> length p2 = min_dist w v
[PROOF STEP]
apply (rule exI; intro conjI; assumption?)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; isPath u p1 w; isPath w p2 v\<rbrakk> \<Longrightarrow> length p1 = min_dist u w
 2. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; isPath u p1 w; isPath w p2 v\<rbrakk> \<Longrightarrow> length p2 = min_dist w v
[PROOF STEP]
apply (drule isPath_distD)+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; dist u (length p1) w; dist w (length p2) v\<rbrakk> \<Longrightarrow> length p1 = min_dist u w
 2. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; isPath u p1 w; isPath w p2 v\<rbrakk> \<Longrightarrow> length p2 = min_dist w v
[PROOF STEP]
using min_dist_split
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dist ?u ?d1.0 ?w; dist ?w ?d2.0 ?v; min_dist ?u ?v = ?d1.0 + ?d2.0\<rbrakk> \<Longrightarrow> min_dist ?u ?w = ?d1.0
\<lbrakk>dist ?u ?d1.0 ?w; dist ?w ?d2.0 ?v; min_dist ?u ?v = ?d1.0 + ?d2.0\<rbrakk> \<Longrightarrow> min_dist ?w ?v = ?d2.0

goal (2 subgoals):
 1. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; dist u (length p1) w; dist w (length p2) v\<rbrakk> \<Longrightarrow> length p1 = min_dist u w
 2. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; isPath u p1 w; isPath w p2 v\<rbrakk> \<Longrightarrow> length p2 = min_dist w v
[PROOF STEP]
apply auto []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; isPath u p1 w; isPath w p2 v\<rbrakk> \<Longrightarrow> length p2 = min_dist w v
[PROOF STEP]
apply (drule isPath_distD)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; dist u (length p1) w; dist w (length p2) v\<rbrakk> \<Longrightarrow> length p2 = min_dist w v
[PROOF STEP]
using min_dist_split
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dist ?u ?d1.0 ?w; dist ?w ?d2.0 ?v; min_dist ?u ?v = ?d1.0 + ?d2.0\<rbrakk> \<Longrightarrow> min_dist ?u ?w = ?d1.0
\<lbrakk>dist ?u ?d1.0 ?w; dist ?w ?d2.0 ?v; min_dist ?u ?v = ?d1.0 + ?d2.0\<rbrakk> \<Longrightarrow> min_dist ?w ?v = ?d2.0

goal (1 subgoal):
 1. \<And>w. \<lbrakk>length p1 + length p2 = min_dist u v; dist u (length p1) w; dist w (length p2) v\<rbrakk> \<Longrightarrow> length p2 = min_dist w v
[PROOF STEP]
apply auto []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma degree_pochhammer_poly [simp]: "degree (pochhammer_poly n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (pochhammer_poly n) = n
[PROOF STEP]
by (simp add: degree_eq_length_coeffs pochhammer_poly_def)


[STATEMENT]
lemma symmetric_condition_2: "\<Lambda> * (\<v> - 1) = \<k> * (\<k> - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Lambda> * (\<v> - 1) = \<k> * (\<k> - 1)
[PROOF STEP]
using necessary_condition_one rep_value_sym
[PROOF STATE]
proof (prove)
using this:
\<r> * (\<k> - 1) = \<Lambda> * (\<v> - 1)
\<r> = \<k>

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


[STATEMENT]
lemma dep_path_card_2: "dep_path T S \<Longrightarrow> card S \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dep_path T S \<Longrightarrow> 2 \<le> card S
[PROOF STEP]
by (induct rule: dep_path.induct, simp add: dep3_def dep3_event_old, linarith)


[STATEMENT]
lemma factorization_lattice_as_sylvester:
  fixes p :: "'a :: semidom poly"
  assumes dj: "d \<le> j" and d: "degree p = d"
  shows "mat_of_rows j (factorization_lattice p (j-d) m) = sylvester_mat_sub d (j-d) p [:m:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
proof (cases "p=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
 2. p \<noteq> 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
 2. p \<noteq> 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
have deg_p: "d = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d = 0
[PROOF STEP]
using True d
[PROOF STATE]
proof (prove)
using this:
p = 0
degree p = d

goal (1 subgoal):
 1. d = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
d = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
 2. p \<noteq> 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
by (auto simp add: factorization_lattice_def True deg_p mat_of_rows_def d)
[PROOF STATE]
proof (state)
this:
mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
case p0: False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
note 1 = degree_mult_eq[OF p0, of "monom _ _", unfolded monom_eq_0_iff, OF one_neq_zero]
[PROOF STATE]
proof (state)
this:
degree (p * monom (1::'a) ?uua3) = degree p + degree (monom (1::'a) ?uua3)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
from dj
[PROOF STATE]
proof (chain)
picking this:
d \<le> j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
d \<le> j

goal (1 subgoal):
 1. mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
apply (cases "m = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>d \<le> j; m = (0::'a)\<rbrakk> \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
 2. \<lbrakk>d \<le> j; m \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]
[PROOF STEP]
apply (auto simp: mat_eq_iff d[symmetric] 1 coeff_mult_monom
 sylvester_mat_sub_index mat_of_rows_index nth_factorization_lattice vec_index_of_poly_n
 degree_monom_eq coeff_const)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
mat_of_rows j (factorization_lattice p (j - d) m) = sylvester_mat_sub d (j - d) p [:m:]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hcpow_mult: "(r * s) pow n = (r pow n) * (s pow n)"
  for r s :: hcomplex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r * s) pow n = r pow n * s pow n
[PROOF STEP]
by (fact hyperpow_mult)


[STATEMENT]
lemma vimage2p_rel_prod:
  "(\<lambda>x y. rel_prod R S (BNF_Def.convol f1 g1 x) (BNF_Def.convol f2 g2 y)) =
   (inf (BNF_Def.vimage2p f1 f2 R) (BNF_Def.vimage2p g1 g2 S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. rel_prod R S (BNF_Def.convol f1 g1 x) (BNF_Def.convol f2 g2 y)) = inf (BNF_Def.vimage2p f1 f2 R) (BNF_Def.vimage2p g1 g2 S)
[PROOF STEP]
unfolding vimage2p_def rel_prod.simps convol_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. \<exists>a b c d. (f1 x, g1 x) = (a, c) \<and> (f2 y, g2 y) = (b, d) \<and> R a b \<and> S c d) = inf (\<lambda>x y. R (f1 x) (f2 y)) (\<lambda>x y. S (g1 x) (g2 y))
[PROOF STEP]
by auto


[STATEMENT]
lemma (in prob_space) normal_standard_normal_convert:
  assumes pos_var[simp, arith]: "0 < \<sigma>"
  shows "distributed M lborel X (normal_density  \<mu> \<sigma>) = distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) std_normal_density"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x)) = distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))
[PROOF STEP]
proof auto
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x)) \<Longrightarrow> distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))
 2. distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
assume "distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))"
[PROOF STATE]
proof (state)
this:
distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))

goal (2 subgoals):
 1. distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x)) \<Longrightarrow> distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))
 2. distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
have "distributed M lborel (\<lambda>x. -\<mu> / \<sigma> + (1/\<sigma>) * X x) (\<lambda>x. ennreal (normal_density (-\<mu> / \<sigma> + (1/\<sigma>)* \<mu>) (\<bar>1/\<sigma>\<bar> * \<sigma>) x))"
[PROOF STATE]
proof (prove)
using this:
distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. - \<mu> / \<sigma> + 1 / \<sigma> * X x) (\<lambda>x. ennreal (normal_density (- \<mu> / \<sigma> + 1 / \<sigma> * \<mu>) (\<bar>1 / \<sigma>\<bar> * \<sigma>) x))
[PROOF STEP]
by(rule normal_density_affine) auto
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. - \<mu> / \<sigma> + 1 / \<sigma> * X x) (\<lambda>x. ennreal (normal_density (- \<mu> / \<sigma> + 1 / \<sigma> * \<mu>) (\<bar>1 / \<sigma>\<bar> * \<sigma>) x))

goal (2 subgoals):
 1. distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x)) \<Longrightarrow> distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))
 2. distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distributed M lborel (\<lambda>x. - \<mu> / \<sigma> + 1 / \<sigma> * X x) (\<lambda>x. ennreal (normal_density (- \<mu> / \<sigma> + 1 / \<sigma> * \<mu>) (\<bar>1 / \<sigma>\<bar> * \<sigma>) x))
[PROOF STEP]
show "distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))"
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. - \<mu> / \<sigma> + 1 / \<sigma> * X x) (\<lambda>x. ennreal (normal_density (- \<mu> / \<sigma> + 1 / \<sigma> * \<mu>) (\<bar>1 / \<sigma>\<bar> * \<sigma>) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))
[PROOF STEP]
by (simp add: diff_divide_distrib[symmetric] field_simps)
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
assume *: "distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))"
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
have "distributed M lborel (\<lambda>x. \<mu> + \<sigma> * ((X x - \<mu>) / \<sigma>)) (\<lambda>x. ennreal (normal_density \<mu> \<bar>\<sigma>\<bar> x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. \<mu> + \<sigma> * ((X x - \<mu>) / \<sigma>)) (\<lambda>x. ennreal (normal_density \<mu> \<bar>\<sigma>\<bar> x))
[PROOF STEP]
using normal_density_affine[OF *, of \<sigma> \<mu>]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 1; \<sigma> \<noteq> 0\<rbrakk> \<Longrightarrow> distributed M lborel (\<lambda>x. \<mu> + \<sigma> * ((X x - \<mu>) / \<sigma>)) (\<lambda>x. ennreal (normal_density (\<mu> + \<sigma> * 0) (\<bar>\<sigma>\<bar> * 1) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. \<mu> + \<sigma> * ((X x - \<mu>) / \<sigma>)) (\<lambda>x. ennreal (normal_density \<mu> \<bar>\<sigma>\<bar> x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. \<mu> + \<sigma> * ((X x - \<mu>) / \<sigma>)) (\<lambda>x. ennreal (normal_density \<mu> \<bar>\<sigma>\<bar> x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. (X x - \<mu>) / \<sigma>) (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distributed M lborel (\<lambda>x. \<mu> + \<sigma> * ((X x - \<mu>) / \<sigma>)) (\<lambda>x. ennreal (normal_density \<mu> \<bar>\<sigma>\<bar> x))
[PROOF STEP]
show "distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))"
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. \<mu> + \<sigma> * ((X x - \<mu>) / \<sigma>)) (\<lambda>x. ennreal (normal_density \<mu> \<bar>\<sigma>\<bar> x))

goal (1 subgoal):
 1. distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distributed M lborel X (\<lambda>x. ennreal (normal_density \<mu> \<sigma> x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uminus_add_in_Ker_eq_eq_im:
  "g\<in>G \<Longrightarrow> h\<in>G \<Longrightarrow> (-g + h \<in> Ker) = (T g = T h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> G; h \<in> G\<rbrakk> \<Longrightarrow> (- g + h \<in> Ker) = (T g = T h)
[PROOF STEP]
using neg_equal_iff_equal
[PROOF STATE]
proof (prove)
using this:
(- ?a = - ?b) = (?a = ?b)

goal (1 subgoal):
 1. \<lbrakk>g \<in> G; h \<in> G\<rbrakk> \<Longrightarrow> (- g + h \<in> Ker) = (T g = T h)
[PROOF STEP]
by    (simp add: uminus_add_closed ker_def im_uminus_add eq_neg_iff_add_eq_0)


[STATEMENT]
theorem left_coset_equality:
  assumes eq: "a \<cdot>| L = b \<cdot>| L" and [simp]: "a \<in> G" and b: "b \<in> G"
  shows "\<eta> a = \<eta> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<eta> a = \<eta> b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<eta> a = \<eta> b
[PROOF STEP]
obtain l where l: "b = a \<cdot> l" "l \<in> L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l. \<lbrakk>b = a \<cdot> l; l \<in> L\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis b contained.Class_is_Left_Coset contained.Class_self eq kernel.Left_Coset_memE)
[PROOF STATE]
proof (state)
this:
b = a \<cdot> l
l \<in> L

goal (1 subgoal):
 1. \<eta> a = \<eta> b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = a \<cdot> l
l \<in> L
[PROOF STEP]
have "\<eta> a = \<eta> a \<cdot>' \<eta> l"
[PROOF STATE]
proof (prove)
using this:
b = a \<cdot> l
l \<in> L

goal (1 subgoal):
 1. \<eta> a = \<eta> a \<cdot>' \<eta> l
[PROOF STEP]
using Ker_image monoid_homomorphism.commutes_with_composition subset
[PROOF STATE]
proof (prove)
using this:
b = a \<cdot> l
l \<in> L
?a \<in> Ker \<Longrightarrow> \<eta> ?a = \<one>'
\<lbrakk>monoid_homomorphism ?\<eta> ?M ?composition ?unit ?M' ?composition' ?unit'; ?x \<in> ?M; ?y \<in> ?M\<rbrakk> \<Longrightarrow> ?\<eta> (?composition ?x ?y) = ?composition' (?\<eta> ?x) (?\<eta> ?y)
L \<subseteq> Ker

goal (1 subgoal):
 1. \<eta> a = \<eta> a \<cdot>' \<eta> l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<eta> a = \<eta> a \<cdot>' \<eta> l

goal (1 subgoal):
 1. \<eta> a = \<eta> b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<eta> a = \<eta> a \<cdot>' \<eta> l

goal (1 subgoal):
 1. \<eta> a = \<eta> b
[PROOF STEP]
have "\<dots> = \<eta> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<eta> a \<cdot>' \<eta> l = \<eta> b
[PROOF STEP]
by (simp add: commutes_with_composition l)
[PROOF STATE]
proof (state)
this:
\<eta> a \<cdot>' \<eta> l = \<eta> b

goal (1 subgoal):
 1. \<eta> a = \<eta> b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<eta> a = \<eta> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<eta> a = \<eta> b

goal (1 subgoal):
 1. \<eta> a = \<eta> b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<eta> a = \<eta> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_MPLS_contains_supremum:
  fixes PROB
  assumes "finite PROB" "(\<exists>k. \<forall>x \<in> MPLS PROB. x < k)"
  shows "Sup (MPLS PROB) \<in> MPLS PROB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
obtain k where "\<forall>x \<in> MPLS PROB. x < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<forall>x\<in>MPLS PROB. x < k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<exists>k. \<forall>x\<in>MPLS PROB. x < k

goal (1 subgoal):
 1. (\<And>k. \<forall>x\<in>MPLS PROB. x < k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>MPLS PROB. x < k

goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>MPLS PROB. x < k

goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
have "finite (MPLS PROB)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (MPLS PROB)
[PROOF STEP]
using assms(2) finite_nat_set_iff_bounded
[PROOF STATE]
proof (prove)
using this:
\<exists>k. \<forall>x\<in>MPLS PROB. x < k
finite ?N = (\<exists>m. \<forall>n\<in>?N. n < m)

goal (1 subgoal):
 1. finite (MPLS PROB)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
finite (MPLS PROB)

goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (MPLS PROB)

goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
have "MPLS PROB \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPLS PROB \<noteq> {}
[PROOF STEP]
using assms(1) MPLS_nempty
[PROOF STATE]
proof (prove)
using this:
finite PROB
finite ?PROB \<Longrightarrow> MPLS ?PROB \<noteq> {}

goal (1 subgoal):
 1. MPLS PROB \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
MPLS PROB \<noteq> {}

goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>MPLS PROB. x < k
finite (MPLS PROB)
MPLS PROB \<noteq> {}
[PROOF STEP]
show "Sup (MPLS PROB) \<in> MPLS PROB"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>MPLS PROB. x < k
finite (MPLS PROB)
MPLS PROB \<noteq> {}

goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
unfolding Sup_nat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>MPLS PROB. x < k
finite (MPLS PROB)
MPLS PROB \<noteq> {}

goal (1 subgoal):
 1. (if MPLS PROB = {} then 0 else Max (MPLS PROB)) \<in> MPLS PROB
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sup (MPLS PROB) \<in> MPLS PROB

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_sum_upto_altdef2:
  "prime_sum_upto f x = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto f x = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. f p)
[PROOF STEP]
unfolding sum_upto_altdef prime_sum_upto_altdef1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>{0<..nat \<lfloor>x\<rfloor>}. ind prime p * f p) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. f p)
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) (auto simp: ind_def dest: prime_gt_1_nat)