[STATEMENT]
lemma mat_mult_sub_lattice: assumes fs: "set fs \<subseteq> carrier_vec n"
  and gs: "set gs \<subseteq> carrier_vec n"
  and A: "A \<in> carrier_mat (length fs) (length gs)"
  and prod: "mat_of_rows n fs = map_mat of_int A * mat_of_rows n gs"
  shows "lattice_of fs \<subseteq> lattice_of gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of fs \<subseteq> lattice_of gs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
let ?m = "length fs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
let ?m' = "length gs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
let ?i = "of_int :: int \<Rightarrow> 'a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
let ?I = "map_mat ?i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
let ?A = "?I A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have gsC: "mat_of_rows n gs \<in> carrier_mat ?m' n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows n gs \<in> carrier_mat (length gs) n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_of_rows n gs \<in> carrier_mat (length gs) n

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
A \<in> carrier_mat (length fs) (length gs)
[PROOF STEP]
have A: "?A \<in> carrier_mat ?m ?m'"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat (length fs) (length gs)

goal (1 subgoal):
 1. of_int_hom.mat_hom A \<in> carrier_mat (length fs) (length gs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom A \<in> carrier_mat (length fs) (length gs)

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
from fs
[PROOF STATE]
proof (chain)
picking this:
set fs \<subseteq> carrier_vec n
[PROOF STEP]
have fsi[simp]: "\<And> i. i < ?m \<Longrightarrow> fs ! i \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
set fs \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<And>i. i < length fs \<Longrightarrow> fs ! i \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i2 < length fs \<Longrightarrow> fs ! ?i2 \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
hence fsi'[simp]: "\<And> i. i < ?m \<Longrightarrow> dim_vec (fs ! i) = n"
[PROOF STATE]
proof (prove)
using this:
?i2 < length fs \<Longrightarrow> fs ! ?i2 \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>i. i < length fs \<Longrightarrow> dim_vec (fs ! i) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i2 < length fs \<Longrightarrow> dim_vec (fs ! ?i2) = n

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
from gs
[PROOF STATE]
proof (chain)
picking this:
set gs \<subseteq> carrier_vec n
[PROOF STEP]
have fsi[simp]: "\<And> i. i < ?m' \<Longrightarrow> gs ! i \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
set gs \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<And>i. i < length gs \<Longrightarrow> gs ! i \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i2 < length gs \<Longrightarrow> gs ! ?i2 \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
hence gsi'[simp]: "\<And> i. i < ?m' \<Longrightarrow> dim_vec (gs ! i) = n"
[PROOF STATE]
proof (prove)
using this:
?i2 < length gs \<Longrightarrow> gs ! ?i2 \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>i. i < length gs \<Longrightarrow> dim_vec (gs ! i) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i2 < length gs \<Longrightarrow> dim_vec (gs ! ?i2) = n

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
assume "v \<in> lattice_of fs"
[PROOF STATE]
proof (state)
this:
v \<in> lattice_of fs

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
from in_latticeE[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>c. v = M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs]) \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain c where v: "v = M.sumlist (map (\<lambda>i. ?i (c i) \<cdot>\<^sub>v fs ! i) [0..<?m])"
[PROOF STATE]
proof (prove)
using this:
(\<And>c. v = M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs]) \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>c. v = M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs]) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v = M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs])

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
let ?c = "vec ?m (\<lambda> i. ?i (c i))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
let ?d = "A\<^sup>T *\<^sub>v vec ?m c"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
note v
[PROOF STATE]
proof (state)
this:
v = M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs])

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v = M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs])

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "\<dots> = mat_of_cols n fs *\<^sub>v ?c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs]) = mat_of_cols n fs *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i))
[PROOF STEP]
by (rule eq_vecI, auto intro!: dim_sumlist sum.cong
      simp: sumlist_nth scalar_prod_def mat_of_cols_def)
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs]) = mat_of_cols n fs *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i))

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. of_int (c i) \<cdot>\<^sub>v fs ! i) [0..<length fs]) = mat_of_cols n fs *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i))

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "mat_of_cols n fs = (mat_of_rows n fs)\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cols n fs = (mat_of_rows n fs)\<^sup>T
[PROOF STEP]
by (simp add: transpose_mat_of_rows)
[PROOF STATE]
proof (state)
this:
mat_of_cols n fs = (mat_of_rows n fs)\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_cols n fs = (mat_of_rows n fs)\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "\<dots> = (?A * mat_of_rows n gs)\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_rows n fs)\<^sup>T = (of_int_hom.mat_hom A * mat_of_rows n gs)\<^sup>T
[PROOF STEP]
unfolding prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_int_hom.mat_hom A * mat_of_rows n gs)\<^sup>T = (of_int_hom.mat_hom A * mat_of_rows n gs)\<^sup>T
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(mat_of_rows n fs)\<^sup>T = (of_int_hom.mat_hom A * mat_of_rows n gs)\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(mat_of_rows n fs)\<^sup>T = (of_int_hom.mat_hom A * mat_of_rows n gs)\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "\<dots> = (mat_of_rows n gs)\<^sup>T * ?A\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_int_hom.mat_hom A * mat_of_rows n gs)\<^sup>T = (mat_of_rows n gs)\<^sup>T * (of_int_hom.mat_hom A)\<^sup>T
[PROOF STEP]
by (rule transpose_mult[OF A gsC])
[PROOF STATE]
proof (state)
this:
(of_int_hom.mat_hom A * mat_of_rows n gs)\<^sup>T = (mat_of_rows n gs)\<^sup>T * (of_int_hom.mat_hom A)\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(of_int_hom.mat_hom A * mat_of_rows n gs)\<^sup>T = (mat_of_rows n gs)\<^sup>T * (of_int_hom.mat_hom A)\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "(mat_of_rows n gs)\<^sup>T = mat_of_cols n gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_rows n gs)\<^sup>T = mat_of_cols n gs
[PROOF STEP]
by (simp add: transpose_mat_of_rows)
[PROOF STATE]
proof (state)
this:
(mat_of_rows n gs)\<^sup>T = mat_of_cols n gs

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
v = mat_of_cols n gs * (of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i))
[PROOF STEP]
have "v = (mat_of_cols n gs * ?A\<^sup>T) *\<^sub>v ?c"
[PROOF STATE]
proof (prove)
using this:
v = mat_of_cols n gs * (of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i))

goal (1 subgoal):
 1. v = mat_of_cols n gs * (of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
v = mat_of_cols n gs * (of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i))

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v = mat_of_cols n gs * (of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i))

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "\<dots> = mat_of_cols n gs *\<^sub>v (?A\<^sup>T *\<^sub>v ?c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cols n gs * (of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i)) = mat_of_cols n gs *\<^sub>v ((of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i)))
[PROOF STEP]
by (rule assoc_mult_mat_vec, insert A, auto)
[PROOF STATE]
proof (state)
this:
mat_of_cols n gs * (of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i)) = mat_of_cols n gs *\<^sub>v ((of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i)))

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_cols n gs * (of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i)) = mat_of_cols n gs *\<^sub>v ((of_int_hom.mat_hom A)\<^sup>T *\<^sub>v vec (length fs) (\<lambda>i. of_int (c i)))

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "?A\<^sup>T = ?I (A\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_int_hom.mat_hom A)\<^sup>T = of_int_hom.mat_hom A\<^sup>T
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(of_int_hom.mat_hom A)\<^sup>T = of_int_hom.mat_hom A\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(of_int_hom.mat_hom A)\<^sup>T = of_int_hom.mat_hom A\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "?c = map_vec ?i (vec ?m c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (length fs) (\<lambda>i. of_int (c i)) = of_int_hom.vec_hom (vec (length fs) c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec (length fs) (\<lambda>i. of_int (c i)) = of_int_hom.vec_hom (vec (length fs) c)

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec (length fs) (\<lambda>i. of_int (c i)) = of_int_hom.vec_hom (vec (length fs) c)

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "?I (A\<^sup>T) *\<^sub>v \<dots> = map_vec ?i ?d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_hom.mat_hom A\<^sup>T *\<^sub>v of_int_hom.vec_hom (vec (length fs) c) = of_int_hom.vec_hom (A\<^sup>T *\<^sub>v vec (length fs) c)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
of_int_hom.mat_hom A \<in> carrier_mat (length fs) (length gs)

goal (1 subgoal):
 1. of_int_hom.mat_hom A\<^sup>T *\<^sub>v of_int_hom.vec_hom (vec (length fs) c) = of_int_hom.vec_hom (A\<^sup>T *\<^sub>v vec (length fs) c)
[PROOF STEP]
by (simp add: of_int_hom.mult_mat_vec_hom)
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom A\<^sup>T *\<^sub>v of_int_hom.vec_hom (vec (length fs) c) = of_int_hom.vec_hom (A\<^sup>T *\<^sub>v vec (length fs) c)

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
v = mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom (A\<^sup>T *\<^sub>v vec (length fs) c)
[PROOF STEP]
have "v = mat_of_cols n gs *\<^sub>v map_vec ?i ?d"
[PROOF STATE]
proof (prove)
using this:
v = mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom (A\<^sup>T *\<^sub>v vec (length fs) c)

goal (1 subgoal):
 1. v = mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom (A\<^sup>T *\<^sub>v vec (length fs) c)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
v = mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom (A\<^sup>T *\<^sub>v vec (length fs) c)

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
define d where "d = ?d"
[PROOF STATE]
proof (state)
this:
d = A\<^sup>T *\<^sub>v vec (length fs) c

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have d: "d \<in> carrier_vec ?m'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<in> carrier_vec (length gs)
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>T *\<^sub>v vec (length fs) c \<in> carrier_vec (length gs)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
of_int_hom.mat_hom A \<in> carrier_mat (length fs) (length gs)

goal (1 subgoal):
 1. A\<^sup>T *\<^sub>v vec (length fs) c \<in> carrier_vec (length gs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d \<in> carrier_vec (length gs)

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "v = mat_of_cols n gs *\<^sub>v map_vec ?i d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom d
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom (A\<^sup>T *\<^sub>v vec (length fs) c)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
v = mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom d

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v = mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom d

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
have "\<dots> =  M.sumlist (map (\<lambda>i. ?i (d $ i) \<cdot>\<^sub>v gs ! i) [0..<?m'])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom d = M.sumlist (map (\<lambda>i. of_int (d $ i) \<cdot>\<^sub>v gs ! i) [0..<length gs])
[PROOF STEP]
by (rule sym, rule eq_vecI, insert d, auto intro!: dim_sumlist sum.cong
      simp: sumlist_nth scalar_prod_def mat_of_cols_def)
[PROOF STATE]
proof (state)
this:
mat_of_cols n gs *\<^sub>v of_int_hom.vec_hom d = M.sumlist (map (\<lambda>i. of_int (d $ i) \<cdot>\<^sub>v gs ! i) [0..<length gs])

goal (1 subgoal):
 1. \<And>x. x \<in> lattice_of fs \<Longrightarrow> x \<in> lattice_of gs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
v = M.sumlist (map (\<lambda>i. of_int (d $ i) \<cdot>\<^sub>v gs ! i) [0..<length gs])
[PROOF STEP]
show "v \<in> lattice_of gs"
[PROOF STATE]
proof (prove)
using this:
v = M.sumlist (map (\<lambda>i. of_int (d $ i) \<cdot>\<^sub>v gs ! i) [0..<length gs])

goal (1 subgoal):
 1. v \<in> lattice_of gs
[PROOF STEP]
by (intro in_latticeI, auto)
[PROOF STATE]
proof (state)
this:
v \<in> lattice_of gs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_L_star_mult_below:
  "(x * L)\<^sup>\<star> * y \<le> y \<squnion> x * L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * L)\<^sup>\<star> * y \<le> y \<squnion> x * L
[PROOF STEP]
by (metis sup_right_isotone mult_assoc mult_right_isotone n_L_below_L star_left_induct)


[STATEMENT]
lemma pop_pow: "m \<le> k \<Longrightarrow>u\<^sup>@m \<cdot> u\<^sup>@(k-m) =  u\<^sup>@k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> k \<Longrightarrow> u \<^sup>@ m \<cdot> u \<^sup>@ (k - m) = u \<^sup>@ k
[PROOF STEP]
using le_add_diff_inverse add_exps
[PROOF STATE]
proof (prove)
using this:
?b \<le> ?a \<Longrightarrow> ?b + (?a - ?b) = ?a
?a \<^sup>@ (?m + ?n) = ?a \<^sup>@ ?m \<cdot> ?a \<^sup>@ ?n

goal (1 subgoal):
 1. m \<le> k \<Longrightarrow> u \<^sup>@ m \<cdot> u \<^sup>@ (k - m) = u \<^sup>@ k
[PROOF STEP]
by metis


[STATEMENT]
lemma fps_XDN_linear:
  "(fps_XD ^^ n) (fps_const c * a + fps_const d * b) =
    fps_const c * (fps_XD ^^ n) a + fps_const d * (fps_XD ^^ n) (b :: 'a::comm_ring_1 fps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_XD ^^ n) (fps_const c * a + fps_const d * b) = fps_const c * (fps_XD ^^ n) a + fps_const d * (fps_XD ^^ n) b
[PROOF STEP]
by (induct n) simp_all


[STATEMENT]
lemma Poly_list_of_vec_0[simp]: "Poly (list_of_vec (0\<^sub>v 0)) = [:0:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly (list_of_vec (0\<^sub>v 0)) = [:0::'b:]
[PROOF STEP]
by (simp add: poly_eq_iff nth_default_def)


[STATEMENT]
lemma is_convexE:
  assumes "is_convex A"
  assumes "x \<in> A"
  assumes "y \<in> A"
  assumes "x \<le> a"
  assumes "a \<le> y"
  shows "a \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> A
[PROOF STEP]
using assms is_convex_def
[PROOF STATE]
proof (prove)
using this:
is_convex A
x \<in> A
y \<in> A
x \<le> a
a \<le> y
is_convex ?A = (\<forall>x\<in>?A. \<forall>y\<in>?A. \<forall>c. x \<le> c \<and> c \<le> y \<longrightarrow> c \<in> ?A)

goal (1 subgoal):
 1. a \<in> A
[PROOF STEP]
by blast


[STATEMENT]
lemma register_tensor_is_register:
  fixes F :: "'a::finite update \<Rightarrow> 'b::finite update" and G :: "'c::finite update \<Rightarrow> 'd::finite update"
  shows "register F \<Longrightarrow> register G \<Longrightarrow> register (F \<otimes>\<^sub>r G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (F \<otimes>\<^sub>r G)
[PROOF STEP]
unfolding register_tensor_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>a. F a \<otimes>\<^sub>u id_cblinfun;\<lambda>b. id_cblinfun \<otimes>\<^sub>u G b)
[PROOF STEP]
apply (rule register_pair_is_register)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>a. F a \<otimes>\<^sub>u id_cblinfun)
 2. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>b. id_cblinfun \<otimes>\<^sub>u G b)
 3. \<And>a b. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> F a \<otimes>\<^sub>u id_cblinfun *\<^sub>u id_cblinfun \<otimes>\<^sub>u G b = id_cblinfun \<otimes>\<^sub>u G b *\<^sub>u F a \<otimes>\<^sub>u id_cblinfun
[PROOF STEP]
by (simp_all add: comp_tensor_op)


[STATEMENT]
lemma sorted_del_list: "sorted xs \<Longrightarrow> sorted(del_list x xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted xs \<Longrightarrow> sorted (del_list x xs)
[PROOF STEP]
apply(induction xs rule: induct_list012)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. sorted [] \<Longrightarrow> sorted (del_list x [])
 2. \<And>xa. sorted [xa] \<Longrightarrow> sorted (del_list x [xa])
 3. \<And>xa y zs. \<lbrakk>sorted zs \<Longrightarrow> sorted (del_list x zs); sorted (y # zs) \<Longrightarrow> sorted (del_list x (y # zs)); sorted (xa # y # zs)\<rbrakk> \<Longrightarrow> sorted (del_list x (xa # y # zs))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa zs. \<lbrakk>sorted (del_list x zs); sorted zs; xa < x; sorted (x # zs); x \<noteq> xa\<rbrakk> \<Longrightarrow> sorted (xa # zs)
[PROOF STEP]
by (meson order.strict_trans sorted_Cons_iff)


[STATEMENT]
lemma poly_subst_zero [simp]: "poly_subst f 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_subst f 0 = 0
[PROOF STEP]
by (simp add: poly_subst_def)


[STATEMENT]
lemma polymul_eq0_iff:
  assumes "SORT_CONSTRAINT('a::field_char_0)"
  shows "isnpolyh p n0 \<Longrightarrow> isnpolyh q n1 \<Longrightarrow> p *\<^sub>p q = 0\<^sub>p \<longleftrightarrow> p = 0\<^sub>p \<or> q = 0\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isnpolyh p n0; isnpolyh q n1\<rbrakk> \<Longrightarrow> (p *\<^sub>p q = 0\<^sub>p) = (p = 0\<^sub>p \<or> q = 0\<^sub>p)
[PROOF STEP]
using polymul_properties(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>isnpolyh ?p ?n0.0; isnpolyh ?q ?n1.0; ?m \<le> min ?n0.0 ?n1.0\<rbrakk> \<Longrightarrow> (?p *\<^sub>p ?q = 0\<^sub>p) = (?p = 0\<^sub>p \<or> ?q = 0\<^sub>p)

goal (1 subgoal):
 1. \<lbrakk>isnpolyh p n0; isnpolyh q n1\<rbrakk> \<Longrightarrow> (p *\<^sub>p q = 0\<^sub>p) = (p = 0\<^sub>p \<or> q = 0\<^sub>p)
[PROOF STEP]
by blast


[STATEMENT]
lemma QR_mono: "d \<in> D\<^sub>D \<Longrightarrow> u \<le> v \<Longrightarrow> (inv\<^sub>L (Q d) o\<^sub>L R d) u \<le> (inv\<^sub>L (Q d) o\<^sub>L R d) v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d \<in> D\<^sub>D; u \<le> v\<rbrakk> \<Longrightarrow> blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) u \<le> blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) v
[PROOF STEP]
using QR_nonneg[of d "v - u"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>d \<in> D\<^sub>D; 0 \<le> v - u\<rbrakk> \<Longrightarrow> 0 \<le> blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)

goal (1 subgoal):
 1. \<lbrakk>d \<in> D\<^sub>D; u \<le> v\<rbrakk> \<Longrightarrow> blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) u \<le> blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) v
[PROOF STEP]
by (auto simp: blinfun.bilinear_simps)


[STATEMENT]
lemma In1_UN1: "In1(UN x. f(x)) = (UN x. In1(f(x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. In1 (\<Union> (range f)) = (\<Union>x. In1 (f x))
[PROOF STEP]
by (simp add: In1_def Scons_UN1_y)


[STATEMENT]
lemma defined_by_str:
  assumes "s \<in> X" "X \<in> UNIV // \<approx>A"
  shows "X = \<approx>A `` {s}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X = \<approx>A `` {s}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s \<in> X
X \<in> UNIV // \<approx>A

goal (1 subgoal):
 1. X = \<approx>A `` {s}
[PROOF STEP]
unfolding quotient_def Image_def str_eq_def
[PROOF STATE]
proof (prove)
using this:
s \<in> X
X \<in> (\<Union>x. {{y. \<exists>x\<in>{x}. (x, y) \<in> {(x, y). \<forall>z. (x @ z \<in> A) = (y @ z \<in> A)}}})

goal (1 subgoal):
 1. X = {y. \<exists>x\<in>{s}. (x, y) \<in> {(x, y). \<forall>z. (x @ z \<in> A) = (y @ z \<in> A)}}
[PROOF STEP]
by auto


[STATEMENT]
theorem RP_saturated_if_fair_new_statement:
  assumes
    deriv: "chain (\<leadsto>RP) Sts" and
    init: "FL.active_subset (lclss_of_state (lhd Sts)) = {}" and
    final: "FL.passive_subset (Liminf_llist (lmap lclss_of_state Sts)) = {}"
  shows "FL.saturated (Liminf_llist (lmap lclss_of_state Sts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FL.empty_ord.saturated (Liminf_llist (lmap lclss_of_state Sts))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. FL.empty_ord.saturated (Liminf_llist (lmap lclss_of_state Sts))
[PROOF STEP]
note nnil = chain_not_lnull[OF deriv]
[PROOF STATE]
proof (state)
this:
\<not> lnull Sts

goal (1 subgoal):
 1. FL.empty_ord.saturated (Liminf_llist (lmap lclss_of_state Sts))
[PROOF STEP]
have gc_deriv: "chain (\<leadsto>GC) (lmap lclss_of_state Sts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain (\<leadsto>GC) (lmap lclss_of_state Sts)
[PROOF STEP]
by (rule RP_derivation_imp_GC_derivation[OF deriv])
[PROOF STATE]
proof (state)
this:
chain (\<leadsto>GC) (lmap lclss_of_state Sts)

goal (1 subgoal):
 1. FL.empty_ord.saturated (Liminf_llist (lmap lclss_of_state Sts))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FL.empty_ord.saturated (Liminf_llist (lmap lclss_of_state Sts))
[PROOF STEP]
using nnil init final
      FL.fair_implies_Liminf_saturated[OF FL.gc_to_red[OF gc_deriv] FL.gc_fair[OF gc_deriv]]
[PROOF STATE]
proof (prove)
using this:
\<not> lnull Sts
FL.active_subset (lclss_of_state (lhd Sts)) = {}
FL.passive_subset (Liminf_llist (lmap lclss_of_state Sts)) = {}
\<lbrakk>FL.active_subset (lhd (lmap lclss_of_state Sts)) = {}; FL.passive_subset (Liminf_llist (lmap lclss_of_state Sts)) = {}\<rbrakk> \<Longrightarrow> FL.empty_ord.saturated (Liminf_llist (lmap lclss_of_state Sts))

goal (1 subgoal):
 1. FL.empty_ord.saturated (Liminf_llist (lmap lclss_of_state Sts))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
FL.empty_ord.saturated (Liminf_llist (lmap lclss_of_state Sts))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iIN_iTILL_subset_conv: "([n'\<dots>,d'] \<subseteq> [\<dots>n]) = (n' + d' \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([n'\<dots>,d'] \<subseteq> [\<dots>n]) = (n' + d' \<le> n)
[PROOF STEP]
by (fastforce simp: subset_iff iT_iff)


[STATEMENT]
lemma Inf_closed_clop:
  fixes X :: "'a::complete_lattice set"
  shows "Inf_closed_set X \<Longrightarrow> clop (\<lambda>y. \<Sqinter>{x \<in> X. y \<le> x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_closed_set X \<Longrightarrow> clop (\<lambda>y. \<Sqinter> {x \<in> X. y \<le> x})
[PROOF STEP]
by (smt Collect_mono_iff Inf_superset_mono clop_alt dual_order.trans le_Inf_iff mem_Collect_eq)


[STATEMENT]
lemma le_mask_high_bits:
  "w \<le> mask n \<longleftrightarrow> (\<forall>i \<in> {n ..< size w}. \<not> bit w i)"
  for w :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w \<le> mask n) = (\<forall>i\<in>{n..<size w}. \<not> bit w i)
[PROOF STEP]
apply (auto simp add: bit_simps word_size less_eq_mask_iff_take_bit_eq_self)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. \<lbrakk>take_bit n w = w; bit w i; n \<le> i; i < LENGTH('a)\<rbrakk> \<Longrightarrow> False
 2. \<forall>i\<in>{n..<LENGTH('a)}. \<not> bit w i \<Longrightarrow> take_bit n w = w
[PROOF STEP]
apply (metis bit_take_bit_iff leD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{n..<LENGTH('a)}. \<not> bit w i \<Longrightarrow> take_bit n w = w
[PROOF STEP]
apply (metis atLeastLessThan_iff leI take_bit_word_eq_self_iff upper_bits_unset_is_l2p)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma \<psi>\<^sub>1_values_odd [simp]:
  fixes i j n
  assumes "i < dim_row (\<psi>\<^sub>1 n)" and "j < dim_col (\<psi>\<^sub>1 n)" and "odd i"
  shows "(\<psi>\<^sub>1 n) $$ (i,j) = -1/(sqrt 2)^(n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then 1 / sqrt 2 ^ (n + 1) else - 1 / sqrt 2 ^ (n + 1))) $$ (i, j) = complex_of_real (- 1 / sqrt 2 ^ (n + 1))
[PROOF STEP]
using assms case_prod_conv
[PROOF STATE]
proof (prove)
using this:
i < dim_row (Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then 1 / sqrt 2 ^ (n + 1) else - 1 / sqrt 2 ^ (n + 1))))
j < dim_col (Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then 1 / sqrt 2 ^ (n + 1) else - 1 / sqrt 2 ^ (n + 1))))
odd i
(case (?a, ?b) of (c, d) \<Rightarrow> ?f c d) = ?f ?a ?b

goal (1 subgoal):
 1. Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then 1 / sqrt 2 ^ (n + 1) else - 1 / sqrt 2 ^ (n + 1))) $$ (i, j) = complex_of_real (- 1 / sqrt 2 ^ (n + 1))
[PROOF STEP]
by simp


[STATEMENT]
lemma eq_intro:
"-(x \<squnion> -(y \<squnion> z)) = -(y \<squnion> -(x \<squnion> z)) \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x \<squnion> - (y \<squnion> z)) = - (y \<squnion> - (x \<squnion> z)) \<Longrightarrow> x = y
[PROOF STEP]
by (metis robbins sup_assoc sup_comm)


[STATEMENT]
lemma darcs_child_count_ge1:
  "\<lbrakk>(t1,e1) \<in> fset xs; e2 \<in> darcs t1\<rbrakk> \<Longrightarrow> count (\<Sum>(t, e)\<in>fset xs. darcs_mset t) e2 \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(t1, e1) \<in> fset xs; e2 \<in> darcs t1\<rbrakk> \<Longrightarrow> 1 \<le> count (\<Sum>(t, e)\<in>fset xs. darcs_mset t) e2
[PROOF STEP]
by (simp add: mset_sum_elemI)


[STATEMENT]
lemma lesspoll_trans1 [trans]: "\<lbrakk>X \<lesssim> Y; Y \<prec> Z\<rbrakk> \<Longrightarrow> X \<prec> Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<lesssim> Y; Y \<prec> Z\<rbrakk> \<Longrightarrow> X \<prec> Z
[PROOF STEP]
by (meson eqpoll_sym lepoll_antisym lepoll_trans lepoll_trans1 lesspoll_def)


[STATEMENT]
lemma dualFNot: "dual invSign id id (FNot A) = FNot (dual invSign id id A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual invSign id id (FNot A) = FNot (dual invSign id id A)
[PROOF STEP]
by(induct A) (auto simp: id_def)


[STATEMENT]
lemma sorted_wrt_many:
  assumes "trans R"
  shows   "sorted_wrt R (x # y # xs) \<longleftrightarrow> (x,y) \<in> R \<and> sorted_wrt R (y # xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (x # y # xs) = ((x, y) \<in> R \<and> Linorder_Relations.sorted_wrt R (y # xs))
[PROOF STEP]
by (force intro: sorted_wrt.intros transD[OF assms] elim: sorted_wrt.cases)


[STATEMENT]
lemma emv_subsumeseq_term_imp_num_unique_vars_le:
  assumes "emv s t"
    and "s \<cdot>\<ge> t"
  shows "num_unique_vars s \<le> num_unique_vars t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. num_unique_vars s \<le> num_unique_vars t
[PROOF STEP]
using assms(2) and emv_subst_imp_num_unique_vars_le [OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
t \<le>\<cdot> s
s = t \<cdot> ?\<sigma> \<Longrightarrow> num_unique_vars s \<le> num_unique_vars t

goal (1 subgoal):
 1. num_unique_vars s \<le> num_unique_vars t
[PROOF STEP]
by (cases) simp


[STATEMENT]
lemma mergesort_remdups_length: "length (mergesort_remdups as) \<le> length as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (mergesort_remdups as) \<le> length as
[PROOF STEP]
unfolding mergesort_remdups_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (merge_list [] (map (\<lambda>x. [x]) as)) \<le> length as
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (merge_list [] (map (\<lambda>x. [x]) as)) \<le> length as
[PROOF STEP]
have "concat ([] @ (map (\<lambda>x. [x]) as)) = as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat ([] @ map (\<lambda>x. [x]) as) = as
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
concat ([] @ map (\<lambda>x. [x]) as) = as

goal (1 subgoal):
 1. length (merge_list [] (map (\<lambda>x. [x]) as)) \<le> length as
[PROOF STEP]
with merge_list_length
[PROOF STATE]
proof (chain)
picking this:
length (merge_list ?as ?ls) \<le> length (concat (?as @ ?ls))
concat ([] @ map (\<lambda>x. [x]) as) = as
[PROOF STEP]
show "length (merge_list [] (map (\<lambda>x. [x]) as)) \<le> length as"
[PROOF STATE]
proof (prove)
using this:
length (merge_list ?as ?ls) \<le> length (concat (?as @ ?ls))
concat ([] @ map (\<lambda>x. [x]) as) = as

goal (1 subgoal):
 1. length (merge_list [] (map (\<lambda>x. [x]) as)) \<le> length as
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
length (merge_list [] (map (\<lambda>x. [x]) as)) \<le> length as

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma assign_indices_bij:
  assumes "finite xs"
  shows "bij_betw (assign_indices xs) xs {..<card xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (assign_indices xs) xs {..<card xs}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw (assign_indices xs) xs {..<card xs}
[PROOF STEP]
have *:"set (sorted_list_of_set xs) = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (sorted_list_of_set xs) = xs
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
set (sorted_list_of_set xs) = xs

goal (1 subgoal):
 1. bij_betw (assign_indices xs) xs {..<card xs}
[PROOF STEP]
have "\<And>x y . x\<in>xs \<Longrightarrow> y\<in>xs \<Longrightarrow> assign_indices xs x = assign_indices xs y \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "x\<in>xs" and "y\<in>xs" and "assign_indices xs x = assign_indices xs y"
[PROOF STATE]
proof (state)
this:
x \<in> xs
y \<in> xs
assign_indices xs x = assign_indices xs y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
obtain i where "find_index ((=)x) (sorted_list_of_set xs) = Some i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. find_index ((=) x) (sorted_list_of_set xs) = Some i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using find_index_exhaustive[of "sorted_list_of_set xs" "((=) x)"]
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<in>set (sorted_list_of_set xs). x = xa \<Longrightarrow> find_index ((=) x) (sorted_list_of_set xs) \<noteq> None

goal (1 subgoal):
 1. (\<And>i. find_index ((=) x) (sorted_list_of_set xs) = Some i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>x\<in>xs\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<in>set (sorted_list_of_set xs). x = xa \<Longrightarrow> find_index ((=) x) (sorted_list_of_set xs) \<noteq> None
x \<in> xs

goal (1 subgoal):
 1. (\<And>i. find_index ((=) x) (sorted_list_of_set xs) = Some i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<in>xs. x = xa \<Longrightarrow> find_index ((=) x) (sorted_list_of_set xs) \<noteq> None
x \<in> xs

goal (1 subgoal):
 1. (\<And>i. find_index ((=) x) (sorted_list_of_set xs) = Some i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
find_index ((=) x) (sorted_list_of_set xs) = Some i

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
find_index ((=) x) (sorted_list_of_set xs) = Some i
[PROOF STEP]
have "assign_indices xs x = i"
[PROOF STATE]
proof (prove)
using this:
find_index ((=) x) (sorted_list_of_set xs) = Some i

goal (1 subgoal):
 1. assign_indices xs x = i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
assign_indices xs x = i

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
obtain j where "find_index ((=)y) (sorted_list_of_set xs) = Some j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. find_index ((=) y) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using find_index_exhaustive[of "sorted_list_of_set xs" "((=) y)"]
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>set (sorted_list_of_set xs). y = x \<Longrightarrow> find_index ((=) y) (sorted_list_of_set xs) \<noteq> None

goal (1 subgoal):
 1. (\<And>j. find_index ((=) y) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>y\<in>xs\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>set (sorted_list_of_set xs). y = x \<Longrightarrow> find_index ((=) y) (sorted_list_of_set xs) \<noteq> None
y \<in> xs

goal (1 subgoal):
 1. (\<And>j. find_index ((=) y) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>xs. y = x \<Longrightarrow> find_index ((=) y) (sorted_list_of_set xs) \<noteq> None
y \<in> xs

goal (1 subgoal):
 1. (\<And>j. find_index ((=) y) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
find_index ((=) y) (sorted_list_of_set xs) = Some j

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
find_index ((=) y) (sorted_list_of_set xs) = Some j
[PROOF STEP]
have "assign_indices xs y = j"
[PROOF STATE]
proof (prove)
using this:
find_index ((=) y) (sorted_list_of_set xs) = Some j

goal (1 subgoal):
 1. assign_indices xs y = j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
assign_indices xs y = j

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
assign_indices xs y = j
[PROOF STEP]
have "i = j"
[PROOF STATE]
proof (prove)
using this:
assign_indices xs y = j

goal (1 subgoal):
 1. i = j
[PROOF STEP]
using \<open>assign_indices xs x = assign_indices xs y\<close> \<open>assign_indices xs x = i\<close>
[PROOF STATE]
proof (prove)
using this:
assign_indices xs y = j
assign_indices xs x = assign_indices xs y
assign_indices xs x = i

goal (1 subgoal):
 1. i = j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i = j

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = j
[PROOF STEP]
have "find_index ((=)y) (sorted_list_of_set xs) = Some i"
[PROOF STATE]
proof (prove)
using this:
i = j

goal (1 subgoal):
 1. find_index ((=) y) (sorted_list_of_set xs) = Some i
[PROOF STEP]
using \<open>find_index ((=)y) (sorted_list_of_set xs) = Some j\<close>
[PROOF STATE]
proof (prove)
using this:
i = j
find_index ((=) y) (sorted_list_of_set xs) = Some j

goal (1 subgoal):
 1. find_index ((=) y) (sorted_list_of_set xs) = Some i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
find_index ((=) y) (sorted_list_of_set xs) = Some i

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> xs; y \<in> xs; assign_indices xs x = assign_indices xs y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using find_index_index(2)[OF \<open>find_index ((=)x) (sorted_list_of_set xs) = Some i\<close>]
[PROOF STATE]
proof (prove)
using this:
x = sorted_list_of_set xs ! i

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using find_index_index(2)[OF \<open>find_index ((=)y) (sorted_list_of_set xs) = Some i\<close>]
[PROOF STATE]
proof (prove)
using this:
x = sorted_list_of_set xs ! i
y = sorted_list_of_set xs ! i

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> xs; ?y \<in> xs; assign_indices xs ?x = assign_indices xs ?y\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. bij_betw (assign_indices xs) xs {..<card xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> xs; ?y \<in> xs; assign_indices xs ?x = assign_indices xs ?y\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. bij_betw (assign_indices xs) xs {..<card xs}
[PROOF STEP]
have "(assign_indices xs) ` xs = {..<card xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. assign_indices xs ` xs = {..<card xs}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. assign_indices xs ` xs \<subseteq> {..<card xs}
 2. {..<card xs} \<subseteq> assign_indices xs ` xs
[PROOF STEP]
show "assign_indices xs ` xs \<subseteq> {..<card xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. assign_indices xs ` xs \<subseteq> {..<card xs}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> assign_indices xs ` xs \<Longrightarrow> x \<in> {..<card xs}
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> assign_indices xs ` xs \<Longrightarrow> x \<in> {..<card xs}
[PROOF STEP]
assume "i \<in> assign_indices xs ` xs"
[PROOF STATE]
proof (state)
this:
i \<in> assign_indices xs ` xs

goal (1 subgoal):
 1. \<And>x. x \<in> assign_indices xs ` xs \<Longrightarrow> x \<in> {..<card xs}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> assign_indices xs ` xs
[PROOF STEP]
obtain x where "x \<in> xs" and "i = assign_indices xs x"
[PROOF STATE]
proof (prove)
using this:
i \<in> assign_indices xs ` xs

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> xs; i = assign_indices xs x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> xs
i = assign_indices xs x

goal (1 subgoal):
 1. \<And>x. x \<in> assign_indices xs ` xs \<Longrightarrow> x \<in> {..<card xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> xs
i = assign_indices xs x

goal (1 subgoal):
 1. \<And>x. x \<in> assign_indices xs ` xs \<Longrightarrow> x \<in> {..<card xs}
[PROOF STEP]
obtain j where "find_index ((=)x) (sorted_list_of_set xs) = Some j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. find_index ((=) x) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using find_index_exhaustive[of "sorted_list_of_set xs" "((=) x)"]
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<in>set (sorted_list_of_set xs). x = xa \<Longrightarrow> find_index ((=) x) (sorted_list_of_set xs) \<noteq> None

goal (1 subgoal):
 1. (\<And>j. find_index ((=) x) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>x\<in>xs\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<in>set (sorted_list_of_set xs). x = xa \<Longrightarrow> find_index ((=) x) (sorted_list_of_set xs) \<noteq> None
x \<in> xs

goal (1 subgoal):
 1. (\<And>j. find_index ((=) x) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<in>xs. x = xa \<Longrightarrow> find_index ((=) x) (sorted_list_of_set xs) \<noteq> None
x \<in> xs

goal (1 subgoal):
 1. (\<And>j. find_index ((=) x) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
find_index ((=) x) (sorted_list_of_set xs) = Some j

goal (1 subgoal):
 1. \<And>x. x \<in> assign_indices xs ` xs \<Longrightarrow> x \<in> {..<card xs}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> xs
i = assign_indices xs x
find_index ((=) x) (sorted_list_of_set xs) = Some j
[PROOF STEP]
have "find_index ((=)x) (sorted_list_of_set xs) = Some i"
[PROOF STATE]
proof (prove)
using this:
x \<in> xs
i = assign_indices xs x
find_index ((=) x) (sorted_list_of_set xs) = Some j

goal (1 subgoal):
 1. find_index ((=) x) (sorted_list_of_set xs) = Some i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
find_index ((=) x) (sorted_list_of_set xs) = Some i

goal (1 subgoal):
 1. \<And>x. x \<in> assign_indices xs ` xs \<Longrightarrow> x \<in> {..<card xs}
[PROOF STEP]
show "i \<in> {..<card xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> {..<card xs}
[PROOF STEP]
using find_index_index(1)[OF \<open>find_index ((=)x) (sorted_list_of_set xs) = Some i\<close>]
[PROOF STATE]
proof (prove)
using this:
i < length (sorted_list_of_set xs)

goal (1 subgoal):
 1. i \<in> {..<card xs}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<in> {..<card xs}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
assign_indices xs ` xs \<subseteq> {..<card xs}

goal (1 subgoal):
 1. {..<card xs} \<subseteq> assign_indices xs ` xs
[PROOF STEP]
show "{..<card xs} \<subseteq> assign_indices xs ` xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<card xs} \<subseteq> assign_indices xs ` xs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<card xs} \<Longrightarrow> x \<in> assign_indices xs ` xs
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<card xs} \<Longrightarrow> x \<in> assign_indices xs ` xs
[PROOF STEP]
assume "i \<in> {..<card xs}"
[PROOF STATE]
proof (state)
this:
i \<in> {..<card xs}

goal (1 subgoal):
 1. \<And>x. x \<in> {..<card xs} \<Longrightarrow> x \<in> assign_indices xs ` xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> {..<card xs}
[PROOF STEP]
have "i < length (sorted_list_of_set xs)"
[PROOF STATE]
proof (prove)
using this:
i \<in> {..<card xs}

goal (1 subgoal):
 1. i < length (sorted_list_of_set xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length (sorted_list_of_set xs)

goal (1 subgoal):
 1. \<And>x. x \<in> {..<card xs} \<Longrightarrow> x \<in> assign_indices xs ` xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length (sorted_list_of_set xs)
[PROOF STEP]
have "sorted_list_of_set xs ! i \<in> xs"
[PROOF STATE]
proof (prove)
using this:
i < length (sorted_list_of_set xs)

goal (1 subgoal):
 1. sorted_list_of_set xs ! i \<in> xs
[PROOF STEP]
using "*" nth_mem
[PROOF STATE]
proof (prove)
using this:
i < length (sorted_list_of_set xs)
set (sorted_list_of_set xs) = xs
?n < length ?xs \<Longrightarrow> ?xs ! ?n \<in> set ?xs

goal (1 subgoal):
 1. sorted_list_of_set xs ! i \<in> xs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sorted_list_of_set xs ! i \<in> xs

goal (1 subgoal):
 1. \<And>x. x \<in> {..<card xs} \<Longrightarrow> x \<in> assign_indices xs ` xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sorted_list_of_set xs ! i \<in> xs
[PROOF STEP]
obtain j where "find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) = Some j"
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set xs ! i \<in> xs

goal (1 subgoal):
 1. (\<And>j. find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using find_index_exhaustive[of "sorted_list_of_set xs" "((=) (sorted_list_of_set xs ! i))"]
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set xs ! i \<in> xs
\<exists>x\<in>set (sorted_list_of_set xs). sorted_list_of_set xs ! i = x \<Longrightarrow> find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) \<noteq> None

goal (1 subgoal):
 1. (\<And>j. find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set xs ! i \<in> xs
\<exists>x\<in>xs. sorted_list_of_set xs ! i = x \<Longrightarrow> find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) \<noteq> None

goal (1 subgoal):
 1. (\<And>j. find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) = Some j

goal (1 subgoal):
 1. \<And>x. x \<in> {..<card xs} \<Longrightarrow> x \<in> assign_indices xs ` xs
[PROOF STEP]
have "i = j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = j
[PROOF STEP]
using find_index_index(1,2)[OF \<open>find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) = Some j\<close>]
[PROOF STATE]
proof (prove)
using this:
j < length (sorted_list_of_set xs)
sorted_list_of_set xs ! i = sorted_list_of_set xs ! j

goal (1 subgoal):
 1. i = j
[PROOF STEP]
using \<open>i < length (sorted_list_of_set xs)\<close> distinct_sorted_list_of_set nth_eq_iff_index_eq
[PROOF STATE]
proof (prove)
using this:
j < length (sorted_list_of_set xs)
sorted_list_of_set xs ! i = sorted_list_of_set xs ! j
i < length (sorted_list_of_set xs)
distinct (sorted_list_of_set ?A)
\<lbrakk>distinct ?xs; ?i < length ?xs; ?j < length ?xs\<rbrakk> \<Longrightarrow> (?xs ! ?i = ?xs ! ?j) = (?i = ?j)

goal (1 subgoal):
 1. i = j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i = j

goal (1 subgoal):
 1. \<And>x. x \<in> {..<card xs} \<Longrightarrow> x \<in> assign_indices xs ` xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = j
[PROOF STEP]
show "i \<in> assign_indices xs ` xs"
[PROOF STATE]
proof (prove)
using this:
i = j

goal (1 subgoal):
 1. i \<in> assign_indices xs ` xs
[PROOF STEP]
using \<open>find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) = Some j\<close>
[PROOF STATE]
proof (prove)
using this:
i = j
find_index ((=) (sorted_list_of_set xs ! i)) (sorted_list_of_set xs) = Some j

goal (1 subgoal):
 1. i \<in> assign_indices xs ` xs
[PROOF STEP]
by (metis \<open>sorted_list_of_set xs ! i \<in> xs\<close> assign_indices.elims image_iff option.sel)
[PROOF STATE]
proof (state)
this:
i \<in> assign_indices xs ` xs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{..<card xs} \<subseteq> assign_indices xs ` xs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
assign_indices xs ` xs = {..<card xs}

goal (1 subgoal):
 1. bij_betw (assign_indices xs) xs {..<card xs}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> xs; ?y \<in> xs; assign_indices xs ?x = assign_indices xs ?y\<rbrakk> \<Longrightarrow> ?x = ?y
assign_indices xs ` xs = {..<card xs}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> xs; ?y \<in> xs; assign_indices xs ?x = assign_indices xs ?y\<rbrakk> \<Longrightarrow> ?x = ?y
assign_indices xs ` xs = {..<card xs}

goal (1 subgoal):
 1. bij_betw (assign_indices xs) xs {..<card xs}
[PROOF STEP]
unfolding bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> xs; ?y \<in> xs; assign_indices xs ?x = assign_indices xs ?y\<rbrakk> \<Longrightarrow> ?x = ?y
assign_indices xs ` xs = {..<card xs}

goal (1 subgoal):
 1. (\<forall>x\<in>xs. \<forall>y\<in>xs. assign_indices xs x = assign_indices xs y \<longrightarrow> x = y) \<and> assign_indices xs ` xs = {..<card xs}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij_betw (assign_indices xs) xs {..<card xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lset_lappend: "lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
[PROOF STEP]
proof(cases "lfinite xs")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lfinite xs \<Longrightarrow> lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
 2. \<not> lfinite xs \<Longrightarrow> lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
lfinite xs

goal (2 subgoals):
 1. lfinite xs \<Longrightarrow> lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
 2. \<not> lfinite xs \<Longrightarrow> lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
lfinite xs

goal (1 subgoal):
 1. lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys

goal (1 subgoal):
 1. \<not> lfinite xs \<Longrightarrow> lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> lfinite xs \<Longrightarrow> lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> lfinite xs

goal (1 subgoal):
 1. \<not> lfinite xs \<Longrightarrow> lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> lfinite xs

goal (1 subgoal):
 1. lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys
[PROOF STEP]
by(auto simp add: lappend_inf)
[PROOF STATE]
proof (state)
this:
lset (lappend xs ys) \<subseteq> lset xs \<union> lset ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closedin_contains_derived_set:
   "closedin X S \<longleftrightarrow> X derived_set_of S \<subseteq> S \<and> S \<subseteq> topspace X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin X S = (X derived_set_of S \<subseteq> S \<and> S \<subseteq> topspace X)
[PROOF STEP]
proof (intro iffI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. closedin X S \<Longrightarrow> X derived_set_of S \<subseteq> S
 2. closedin X S \<Longrightarrow> S \<subseteq> topspace X
 3. X derived_set_of S \<subseteq> S \<and> S \<subseteq> topspace X \<Longrightarrow> closedin X S
[PROOF STEP]
show "closedin X S \<Longrightarrow> X derived_set_of S \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin X S \<Longrightarrow> X derived_set_of S \<subseteq> S
[PROOF STEP]
using closure_of_eq derived_set_of_subset_closure_of
[PROOF STATE]
proof (prove)
using this:
(?X closure_of ?S = ?S) = closedin ?X ?S
?X derived_set_of ?S \<subseteq> ?X closure_of ?S

goal (1 subgoal):
 1. closedin X S \<Longrightarrow> X derived_set_of S \<subseteq> S
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
closedin X S \<Longrightarrow> X derived_set_of S \<subseteq> S

goal (2 subgoals):
 1. closedin X S \<Longrightarrow> S \<subseteq> topspace X
 2. X derived_set_of S \<subseteq> S \<and> S \<subseteq> topspace X \<Longrightarrow> closedin X S
[PROOF STEP]
show "closedin X S \<Longrightarrow> S \<subseteq> topspace X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin X S \<Longrightarrow> S \<subseteq> topspace X
[PROOF STEP]
using closedin_subset
[PROOF STATE]
proof (prove)
using this:
closedin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. closedin X S \<Longrightarrow> S \<subseteq> topspace X
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
closedin X S \<Longrightarrow> S \<subseteq> topspace X

goal (1 subgoal):
 1. X derived_set_of S \<subseteq> S \<and> S \<subseteq> topspace X \<Longrightarrow> closedin X S
[PROOF STEP]
show "X derived_set_of S \<subseteq> S \<and> S \<subseteq> topspace X \<Longrightarrow> closedin X S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X derived_set_of S \<subseteq> S \<and> S \<subseteq> topspace X \<Longrightarrow> closedin X S
[PROOF STEP]
by (metis closure_of closure_of_eq inf.absorb_iff2 sup.orderE)
[PROOF STATE]
proof (state)
this:
X derived_set_of S \<subseteq> S \<and> S \<subseteq> topspace X \<Longrightarrow> closedin X S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bifunctor_flip_ObjMap_app'[cat_cs_simps]:
  assumes "ba = [b, a]\<^sub>\<circ>"
    and "category \<alpha> \<AA>"
    and "category \<alpha> \<BB>"
    and "\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
    and "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
  shows "bifunctor_flip \<AA> \<BB> \<FF>\<lparr>ObjMap\<rparr>\<lparr>ba\<rparr> = \<FF>\<lparr>ObjMap\<rparr>\<lparr>a, b\<rparr>\<^sub>\<bullet>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bifunctor_flip \<AA> \<BB> \<FF>\<lparr>ObjMap\<rparr>\<lparr>ba\<rparr> = a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<FF>\<^esub> b
[PROOF STEP]
using assms(2-6)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. bifunctor_flip \<AA> \<BB> \<FF>\<lparr>ObjMap\<rparr>\<lparr>ba\<rparr> = a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<FF>\<^esub> b
[PROOF STEP]
unfolding assms(1)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>bifunctor_flip \<AA> \<BB> \<FF>\<^esub> a = a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<FF>\<^esub> b
[PROOF STEP]
by (rule bifunctor_flip_ObjMap_app)


[STATEMENT]
lemma fun_eq_in_ivl:
  assumes "a \<le> b" "\<forall>x::real. a \<le> x \<and> x \<le> b \<longrightarrow> eventually (\<lambda>\<xi>. f \<xi> = f x) (at x)"
  shows "f a = f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a = f b
[PROOF STEP]
proof (rule connected_local_const)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. connected ?A
 2. a \<in> ?A
 3. b \<in> ?A
 4. \<forall>a\<in>?A. \<forall>\<^sub>F b in at a within ?A. f a = f b
[PROOF STEP]
show "connected {a..b}" "a \<in> {a..b}" "b \<in> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected {a..b} &&& a \<in> {a..b} &&& b \<in> {a..b}
[PROOF STEP]
using \<open>a \<le> b\<close>
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. connected {a..b} &&& a \<in> {a..b} &&& b \<in> {a..b}
[PROOF STEP]
by (auto intro: connected_Icc)
[PROOF STATE]
proof (state)
this:
connected {a..b}
a \<in> {a..b}
b \<in> {a..b}

goal (1 subgoal):
 1. \<forall>aa\<in>{a..b}. \<forall>\<^sub>F b in at aa within {a..b}. f aa = f b
[PROOF STEP]
show "\<forall>aa\<in>{a..b}. eventually (\<lambda>b. f aa = f b) (at aa within {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>aa\<in>{a..b}. \<forall>\<^sub>F b in at aa within {a..b}. f aa = f b
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa. aa \<in> {a..b} \<Longrightarrow> \<forall>\<^sub>F b in at aa within {a..b}. f aa = f b
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa. aa \<in> {a..b} \<Longrightarrow> \<forall>\<^sub>F b in at aa within {a..b}. f aa = f b
[PROOF STEP]
assume "x \<in> {a..b}"
[PROOF STATE]
proof (state)
this:
x \<in> {a..b}

goal (1 subgoal):
 1. \<And>aa. aa \<in> {a..b} \<Longrightarrow> \<forall>\<^sub>F b in at aa within {a..b}. f aa = f b
[PROOF STEP]
with assms(2)[rule_format, of x]
[PROOF STATE]
proof (chain)
picking this:
a \<le> x \<and> x \<le> b \<Longrightarrow> \<forall>\<^sub>F \<xi> in at x. f \<xi> = f x
x \<in> {a..b}
[PROOF STEP]
show "eventually (\<lambda>b. f x = f b) (at x within {a..b})"
[PROOF STATE]
proof (prove)
using this:
a \<le> x \<and> x \<le> b \<Longrightarrow> \<forall>\<^sub>F \<xi> in at x. f \<xi> = f x
x \<in> {a..b}

goal (1 subgoal):
 1. \<forall>\<^sub>F b in at x within {a..b}. f x = f b
[PROOF STEP]
by (auto simp: eventually_at_filter elim: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F b in at x within {a..b}. f x = f b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>aa\<in>{a..b}. \<forall>\<^sub>F b in at aa within {a..b}. f aa = f b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enumerator_not_empty[dest]: "ls \<in> set (enumerator m n) \<Longrightarrow> ls \<noteq>  []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ls \<in> set (enumerator m n) \<Longrightarrow> ls \<noteq> []
[PROOF STEP]
apply (subgoal_tac "2 \<le> length ls")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>ls \<in> set (enumerator m n); 2 \<le> |ls|\<rbrakk> \<Longrightarrow> ls \<noteq> []
 2. ls \<in> set (enumerator m n) \<Longrightarrow> 2 \<le> |ls|
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ls \<in> set (enumerator m n) \<Longrightarrow> 2 \<le> |ls|
[PROOF STEP]
by (rule enumerator_length)


[STATEMENT]
lemma lset_ldropn_subset: "lset (ldropn n xs) \<subseteq> lset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lset (ldropn n xs) \<subseteq> lset xs
[PROOF STEP]
by(induct n arbitrary: xs)(fastforce simp add: ldropn_Suc split: llist.split_asm)+


[STATEMENT]
lemma SA_minus_eval:
  assumes "f \<in> carrier (SA n)"
  assumes "g \<in> carrier (SA n)"
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "(f  \<ominus>\<^bsub>SA n\<^esub> g) x = f x \<ominus> g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<ominus>\<^bsub>SA n\<^esub> g) x = f x \<ominus> g x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
g \<in> carrier (SA n)
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. (f \<ominus>\<^bsub>SA n\<^esub> g) x = f x \<ominus> g x
[PROOF STEP]
unfolding a_minus_def
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
g \<in> carrier (SA n)
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. (f \<oplus>\<^bsub>SA n\<^esub> \<ominus>\<^bsub>SA n\<^esub> g) x = f x \<oplus> \<ominus> g x
[PROOF STEP]
using SA_a_inv_eval SA_add
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
g \<in> carrier (SA n)
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
\<lbrakk>?f \<in> carrier (SA ?n); ?x \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> (\<ominus>\<^bsub>SA ?n\<^esub> ?f) ?x = \<ominus> ?f ?x
?x \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>) \<Longrightarrow> (?f \<oplus>\<^bsub>SA ?n\<^esub> ?g) ?x = ?f ?x \<oplus> ?g ?x

goal (1 subgoal):
 1. (f \<oplus>\<^bsub>SA n\<^esub> \<ominus>\<^bsub>SA n\<^esub> g) x = f x \<oplus> \<ominus> g x
[PROOF STEP]
by metis


[STATEMENT]
lemma sym_mod_sym_div: assumes y: "y > 0" shows "x symmod y = x - sym_div x y * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
let ?z = "x - y * (x div y)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
let ?u = "y * (x div y)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
have "x = y * (x div y) + x mod y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y * (x div y) + x mod y
[PROOF STEP]
using y
[PROOF STATE]
proof (prove)
using this:
0 < y

goal (1 subgoal):
 1. x = y * (x div y) + x mod y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = y * (x div y) + x mod y

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
hence id: "x mod y = ?z"
[PROOF STATE]
proof (prove)
using this:
x = y * (x div y) + x mod y

goal (1 subgoal):
 1. x mod y = x - y * (x div y)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
x mod y = x - y * (x div y)

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
have "x symmod y = poly_mod.inv_M y ?z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x symmod y = poly_mod.inv_M y (x - y * (x div y))
[PROOF STEP]
unfolding sym_mod_def id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.inv_M y (x - y * (x div y)) = poly_mod.inv_M y (x - y * (x div y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x symmod y = poly_mod.inv_M y (x - y * (x div y))

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x symmod y = poly_mod.inv_M y (x - y * (x div y))

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
have "\<dots> = (if ?z + ?z \<le> y then ?z else ?z - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.inv_M y (x - y * (x div y)) = (if x - y * (x div y) + (x - y * (x div y)) \<le> y then x - y * (x div y) else x - y * (x div y) - y)
[PROOF STEP]
unfolding poly_mod.inv_M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x - y * (x div y) + (x - y * (x div y)) \<le> y then x - y * (x div y) else x - y * (x div y) - y) = (if x - y * (x div y) + (x - y * (x div y)) \<le> y then x - y * (x div y) else x - y * (x div y) - y)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
poly_mod.inv_M y (x - y * (x div y)) = (if x - y * (x div y) + (x - y * (x div y)) \<le> y then x - y * (x div y) else x - y * (x div y) - y)

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_mod.inv_M y (x - y * (x div y)) = (if x - y * (x div y) + (x - y * (x div y)) \<le> y then x - y * (x div y) else x - y * (x div y) - y)

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
have "\<dots> = x - (if (x mod y) + (x mod y) \<le> y then x div y else x div y + 1) * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x - y * (x div y) + (x - y * (x div y)) \<le> y then x - y * (x div y) else x - y * (x div y) - y) = x - (if x mod y + x mod y \<le> y then x div y else x div y + 1) * y
[PROOF STEP]
by (simp add: algebra_simps id)
[PROOF STATE]
proof (state)
this:
(if x - y * (x div y) + (x - y * (x div y)) \<le> y then x - y * (x div y) else x - y * (x div y) - y) = x - (if x mod y + x mod y \<le> y then x div y else x div y + 1) * y

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if x - y * (x div y) + (x - y * (x div y)) \<le> y then x - y * (x div y) else x - y * (x div y) - y) = x - (if x mod y + x mod y \<le> y then x div y else x div y + 1) * y

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
have "(if (x mod y) + (x mod y) \<le> y then x div y else x div y + 1) = sym_div x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x mod y + x mod y \<le> y then x div y else x div y + 1) = x symdiv y
[PROOF STEP]
unfolding sym_div_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x mod y + x mod y \<le> y then x div y else x div y + 1) = (if x mod y + x mod y \<le> y then x div y else x div y + 1)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(if x mod y + x mod y \<le> y then x div y else x div y + 1) = x symdiv y

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x symmod y = x - x symdiv y * y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x symmod y = x - x symdiv y * y

goal (1 subgoal):
 1. x symmod y = x - x symdiv y * y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x symmod y = x - x symdiv y * y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_from_conjugate_space: \<open>closure (from_conjugate_space ` X) = from_conjugate_space ` closure X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
have 1: \<open>from_conjugate_space ` closure X \<subseteq> closure (from_conjugate_space ` X)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_conjugate_space ` closure X \<subseteq> closure (from_conjugate_space ` X)
[PROOF STEP]
apply (rule closure_bounded_linear_image_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear from_conjugate_space
[PROOF STEP]
by (simp add: bounded_antilinear.bounded_linear)
[PROOF STATE]
proof (state)
this:
from_conjugate_space ` closure X \<subseteq> closure (from_conjugate_space ` X)

goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
have \<open>\<dots> = from_conjugate_space ` to_conjugate_space ` closure (from_conjugate_space ` X)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` to_conjugate_space ` closure (from_conjugate_space ` X)
[PROOF STEP]
by (simp add: to_conjugate_space_inverse image_image)
[PROOF STATE]
proof (state)
this:
closure (from_conjugate_space ` X) = from_conjugate_space ` to_conjugate_space ` closure (from_conjugate_space ` X)

goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
closure (from_conjugate_space ` X) = from_conjugate_space ` to_conjugate_space ` closure (from_conjugate_space ` X)

goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
have \<open>\<dots> \<subseteq> from_conjugate_space ` closure (to_conjugate_space ` from_conjugate_space ` X)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_conjugate_space ` to_conjugate_space ` closure (from_conjugate_space ` X) \<subseteq> from_conjugate_space ` closure (to_conjugate_space ` from_conjugate_space ` X)
[PROOF STEP]
apply (rule image_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_conjugate_space ` closure (from_conjugate_space ` X) \<subseteq> closure (to_conjugate_space ` from_conjugate_space ` X)
[PROOF STEP]
apply (rule closure_bounded_linear_image_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear to_conjugate_space
[PROOF STEP]
by (simp add: bounded_antilinear.bounded_linear)
[PROOF STATE]
proof (state)
this:
from_conjugate_space ` to_conjugate_space ` closure (from_conjugate_space ` X) \<subseteq> from_conjugate_space ` closure (to_conjugate_space ` from_conjugate_space ` X)

goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
from_conjugate_space ` to_conjugate_space ` closure (from_conjugate_space ` X) \<subseteq> from_conjugate_space ` closure (to_conjugate_space ` from_conjugate_space ` X)

goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
have \<open>\<dots> = from_conjugate_space ` closure X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_conjugate_space ` closure (to_conjugate_space ` from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
by (simp add: from_conjugate_space_inverse image_image)
[PROOF STATE]
proof (state)
this:
from_conjugate_space ` closure (to_conjugate_space ` from_conjugate_space ` X) = from_conjugate_space ` closure X

goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
closure (from_conjugate_space ` X) \<subseteq> from_conjugate_space ` closure X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closure (from_conjugate_space ` X) \<subseteq> from_conjugate_space ` closure X

goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
closure (from_conjugate_space ` X) \<subseteq> from_conjugate_space ` closure X
from_conjugate_space ` closure X \<subseteq> closure (from_conjugate_space ` X)

goal (1 subgoal):
 1. closure (from_conjugate_space ` X) = from_conjugate_space ` closure X
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closure (from_conjugate_space ` X) = from_conjugate_space ` closure X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_conj_bounded_by[intro,simp]:
  assumes bP: "bounded_by 1 P"
      and bQ: "bounded_by 1 Q"
  shows "bounded_by 1 (P && Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_by 1 (P && Q)
[PROOF STEP]
proof(rule bounded_byI, unfold exp_conj_def pconj_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. P x + Q x \<ominus> 1 \<le> 1
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. P x + Q x \<ominus> 1 \<le> 1
[PROOF STEP]
from bP
[PROOF STATE]
proof (chain)
picking this:
bounded_by 1 P
[PROOF STEP]
have "P x \<le> 1"
[PROOF STATE]
proof (prove)
using this:
bounded_by 1 P

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

goal (1 subgoal):
 1. \<And>x. P x + Q x \<ominus> 1 \<le> 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P x \<le> 1

goal (1 subgoal):
 1. \<And>x. P x + Q x \<ominus> 1 \<le> 1
[PROOF STEP]
from bQ
[PROOF STATE]
proof (chain)
picking this:
bounded_by 1 Q
[PROOF STEP]
have "Q x \<le> 1"
[PROOF STATE]
proof (prove)
using this:
bounded_by 1 Q

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

goal (1 subgoal):
 1. \<And>x. P x + Q x \<ominus> 1 \<le> 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P x \<le> 1
Q x \<le> 1
[PROOF STEP]
have "P x + Q x \<le> 2"
[PROOF STATE]
proof (prove)
using this:
P x \<le> 1
Q x \<le> 1

goal (1 subgoal):
 1. P x + Q x \<le> 2
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
P x + Q x \<le> 2

goal (1 subgoal):
 1. \<And>x. P x + Q x \<ominus> 1 \<le> 1
[PROOF STEP]
thus "P x + Q x \<ominus> 1 \<le> 1"
[PROOF STATE]
proof (prove)
using this:
P x + Q x \<le> 2

goal (1 subgoal):
 1. P x + Q x \<ominus> 1 \<le> 1
[PROOF STEP]
unfolding tminus_def
[PROOF STATE]
proof (prove)
using this:
P x + Q x \<le> 2

goal (1 subgoal):
 1. max (P x + Q x - 1) 0 \<le> 1
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
P x + Q x \<ominus> 1 \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smallo_trimmed_imp_eventually_less:
  fixes f g :: "real \<Rightarrow> real"
  assumes "f \<in> o(g)" "(g expands_to G) bs" "basis_wf bs" "trimmed_pos G"
  shows   "eventually (\<lambda>x. f x < g x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x < g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x < g x
[PROOF STEP]
from assms(2-4)
[PROOF STATE]
proof (chain)
picking this:
(g expands_to G) bs
basis_wf bs
trimmed_pos G
[PROOF STEP]
have pos: "eventually (\<lambda>x. g x > 0) at_top"
[PROOF STATE]
proof (prove)
using this:
(g expands_to G) bs
basis_wf bs
trimmed_pos G

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < g x
[PROOF STEP]
using expands_to_imp_eventually_pos
[PROOF STATE]
proof (prove)
using this:
(g expands_to G) bs
basis_wf bs
trimmed_pos G
\<lbrakk>basis_wf ?basis; (?f expands_to ?F) ?basis; trimmed_pos ?F\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. 0 < ?f x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < g x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 0 < g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x < g x
[PROOF STEP]
have "(1 / 2 :: real) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x < g x
[PROOF STEP]
from landau_o.smallD[OF assms(1) this] and pos
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. norm (f x) \<le> 1 / 2 * norm (g x)
\<forall>\<^sub>F x in at_top. 0 < g x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. norm (f x) \<le> 1 / 2 * norm (g x)
\<forall>\<^sub>F x in at_top. 0 < g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x < g x
[PROOF STEP]
by eventually_elim (simp add: abs_if split: if_splits)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. f x < g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_a:
  assumes "idx s x = Inr l"
  assumes "idx s y = Inr u"
  shows "(l \<le> u) = (a x \<le> a y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l \<le> u) = (a x \<le> a y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (l \<le> u) = (a x \<le> a y)
[PROOF STEP]
have "sorted_wrt (<) (map a (ext_ids s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (<) (map a (ext_ids s))
[PROOF STEP]
using associated_string_assm a_conditions_assm is_associated_string_def
[PROOF STATE]
proof (prove)
using this:
is_associated_string M s
a_conditions (insert_messages M) a
is_associated_string ?M ?s \<equiv> consistent ?M \<and> set ?s = to_woot_character ?M ` insert_messages ?M \<and> (\<forall>a. a_conditions (insert_messages ?M) a \<longrightarrow> sorted_wrt (<) (map a (ext_ids ?s)))

goal (1 subgoal):
 1. sorted_wrt (<) (map a (ext_ids s))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sorted_wrt (<) (map a (ext_ids s))

goal (1 subgoal):
 1. (l \<le> u) = (a x \<le> a y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt (<) (map a (ext_ids s))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (<) (map a (ext_ids s))

goal (1 subgoal):
 1. (l \<le> u) = (a x \<le> a y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (<) (map a (ext_ids s))
idx s x = Inr l
idx s y = Inr u

goal (1 subgoal):
 1. (l \<le> u) = (a x \<le> a y)
[PROOF STEP]
apply (simp add:filt_simp fromSingleton_simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted_wrt (<) (map a (ext_ids s)); ext_ids s ! l = x \<and> l < length (ext_ids s) \<and> (\<forall>y<length (ext_ids s). ext_ids s ! y = x \<longrightarrow> l = y); ext_ids s ! u = y \<and> u < length (ext_ids s) \<and> (\<forall>ya<length (ext_ids s). ext_ids s ! ya = y \<longrightarrow> u = ya)\<rbrakk> \<Longrightarrow> (l \<le> u) = (a x \<le> a y)
[PROOF STEP]
by (metis leD leI le_less length_map nth_map sorted_wrt_nth_less)
[PROOF STATE]
proof (state)
this:
(l \<le> u) = (a x \<le> a y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tset_tfilter: "tset (tfilter b P xs) = {x\<in>tset xs. P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tset (TLList_CCPO_Examples.tfilter b P xs) = {x \<in> tset xs. P x}
[PROOF STEP]
proof(rule equalityI[OF _ subsetI])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. tset (TLList_CCPO_Examples.tfilter b P xs) \<subseteq> {x \<in> tset xs. P x}
 2. \<And>x. x \<in> {x \<in> tset xs. P x} \<Longrightarrow> x \<in> tset (TLList_CCPO_Examples.tfilter b P xs)
[PROOF STEP]
show "tset (tfilter b P xs) \<subseteq> {x \<in> tset xs. P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tset (TLList_CCPO_Examples.tfilter b P xs) \<subseteq> {x \<in> tset xs. P x}
[PROOF STEP]
by(induct arbitrary: xs rule: tfilter.fixp_induct)(auto split: tllist.split)
[PROOF STATE]
proof (state)
this:
tset (TLList_CCPO_Examples.tfilter b P xs) \<subseteq> {x \<in> tset xs. P x}

goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> tset xs. P x} \<Longrightarrow> x \<in> tset (TLList_CCPO_Examples.tfilter b P xs)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> tset xs. P x} \<Longrightarrow> x \<in> tset (TLList_CCPO_Examples.tfilter b P xs)
[PROOF STEP]
assume "x \<in> {x \<in> tset xs. P x}"
[PROOF STATE]
proof (state)
this:
x \<in> {x \<in> tset xs. P x}

goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> tset xs. P x} \<Longrightarrow> x \<in> tset (TLList_CCPO_Examples.tfilter b P xs)
[PROOF STEP]
hence "x \<in> tset xs" "P x"
[PROOF STATE]
proof (prove)
using this:
x \<in> {x \<in> tset xs. P x}

goal (1 subgoal):
 1. x \<in> tset xs &&& P x
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
x \<in> tset xs
P x

goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> tset xs. P x} \<Longrightarrow> x \<in> tset (TLList_CCPO_Examples.tfilter b P xs)
[PROOF STEP]
thus "x \<in> tset (tfilter b P xs)"
[PROOF STATE]
proof (prove)
using this:
x \<in> tset xs
P x

goal (1 subgoal):
 1. x \<in> tset (TLList_CCPO_Examples.tfilter b P xs)
[PROOF STEP]
by(induct rule: tset_induct) simp_all
[PROOF STATE]
proof (state)
this:
x \<in> tset (TLList_CCPO_Examples.tfilter b P xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sub_branch_comp:
  \<open>sub_branch f (sub_branch g branch) = sub_branch (f o g) branch\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_branch f (sub_branch g branch) = sub_branch (f \<circ> g) branch
[PROOF STEP]
unfolding sub_branch_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (sub_block f) (map (sub_block g) branch) = map (sub_block (f \<circ> g)) branch
[PROOF STEP]
using sub_block_comp
[PROOF STATE]
proof (prove)
using this:
sub_block ?f (sub_block ?g ?block) = sub_block (?f \<circ> ?g) ?block

goal (1 subgoal):
 1. map (sub_block f) (map (sub_block g) branch) = map (sub_block (f \<circ> g)) branch
[PROOF STEP]
by (induct branch) fastforce+


[STATEMENT]
lemma factorization_lattice_diag_nonzero:
  fixes u :: "'a :: semidom poly" and d
  assumes d: "d=degree u"
    and dn: "d\<le>n"
    and u: "u\<noteq>0"
    and m0: "k\<noteq>0"
    and i: "i<n"
  shows "(factorization_lattice u (n-d) k) ! i $ i \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. factorization_lattice u (n - d) k ! i $ i \<noteq> (0::'a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. factorization_lattice u (n - d) k ! i $ i \<noteq> (0::'a)
[PROOF STEP]
have 1: "monom (1::'a) (n - Suc (degree u + i)) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (1::'a) (n - Suc (degree u + i)) \<noteq> 0
[PROOF STEP]
using m0
[PROOF STATE]
proof (prove)
using this:
k \<noteq> (0::'a)

goal (1 subgoal):
 1. monom (1::'a) (n - Suc (degree u + i)) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
monom (1::'a) (n - Suc (degree u + i)) \<noteq> 0

goal (1 subgoal):
 1. factorization_lattice u (n - d) k ! i $ i \<noteq> (0::'a)
[PROOF STEP]
have 2: "i < degree u + (n - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < degree u + (n - d)
[PROOF STEP]
using i d
[PROOF STATE]
proof (prove)
using this:
i < n
d = degree u

goal (1 subgoal):
 1. i < degree u + (n - d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < degree u + (n - d)

goal (1 subgoal):
 1. factorization_lattice u (n - d) k ! i $ i \<noteq> (0::'a)
[PROOF STEP]
let ?p = "u * monom 1 (n - Suc (degree u + i))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. factorization_lattice u (n - d) k ! i $ i \<noteq> (0::'a)
[PROOF STEP]
have 3: "i < n - degree u \<Longrightarrow> degree (?p) = n - Suc i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < n - degree u \<Longrightarrow> degree (u * monom (1::'a) (n - Suc (degree u + i))) = n - Suc i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
d = degree u
d \<le> n
u \<noteq> 0
k \<noteq> (0::'a)
i < n

goal (1 subgoal):
 1. i < n - degree u \<Longrightarrow> degree (u * monom (1::'a) (n - Suc (degree u + i))) = n - Suc i
[PROOF STEP]
by (auto simp: degree_mult_eq[OF _ 1] degree_monom_eq)
[PROOF STATE]
proof (state)
this:
i < n - degree u \<Longrightarrow> degree (u * monom (1::'a) (n - Suc (degree u + i))) = n - Suc i

goal (1 subgoal):
 1. factorization_lattice u (n - d) k ! i $ i \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. factorization_lattice u (n - d) k ! i $ i \<noteq> (0::'a)
[PROOF STEP]
apply (unfold nth_factorization_lattice[OF 2] vec_index_of_poly_n[OF 2])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i < degree u + (n - d) - Suc (degree (if i < n - d then u * monom (1::'a) (n - d - Suc i) else monom k (degree u + (n - d) - Suc i))) then 0::'a else coeff (if i < n - d then u * monom (1::'a) (n - d - Suc i) else monom k (degree u + (n - d) - Suc i)) (degree u + (n - d) - i - 1)) \<noteq> (0::'a)
[PROOF STEP]
using assms leading_coeff_0_iff[of ?p]
[PROOF STATE]
proof (prove)
using this:
d = degree u
d \<le> n
u \<noteq> 0
k \<noteq> (0::'a)
i < n
(lead_coeff (u * monom (1::'a) (n - Suc (degree u + i))) = (0::'a)) = (u * monom (1::'a) (n - Suc (degree u + i)) = 0)

goal (1 subgoal):
 1. (if i < degree u + (n - d) - Suc (degree (if i < n - d then u * monom (1::'a) (n - d - Suc i) else monom k (degree u + (n - d) - Suc i))) then 0::'a else coeff (if i < n - d then u * monom (1::'a) (n - d - Suc i) else monom k (degree u + (n - d) - Suc i)) (degree u + (n - d) - i - 1)) \<noteq> (0::'a)
[PROOF STEP]
apply (cases "i < n - degree u", auto simp: d 3 degree_monom_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
factorization_lattice u (n - d) k ! i $ i \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma C_card_eq_B: "card C = card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card C = card B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card C = card B
[PROOF STEP]
have "inj_on (\<lambda>x. x mod p) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>x. x mod int p) B
[PROOF STEP]
by (metis SR_B_inj)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>x. x mod int p) B

goal (1 subgoal):
 1. card C = card B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>x. x mod int p) B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>x. x mod int p) B

goal (1 subgoal):
 1. card C = card B
[PROOF STEP]
by (metis C_def card_image)
[PROOF STATE]
proof (state)
this:
card C = card B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_measure_spmf:
  assumes "integrable (measure_spmf p) f"
  shows "(\<integral> x. f x \<partial>measure_spmf p) = \<integral> x. spmf p x * f x \<partial>count_space UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (measure_spmf p) f = LINT x|count_space UNIV. spmf p x * f x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>L (measure_spmf p) f = LINT x|count_space UNIV. spmf p x * f x
[PROOF STEP]
have "integrable (count_space UNIV) (\<lambda>x. spmf p x * f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (count_space UNIV) (\<lambda>x. spmf p x * f x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
integrable (measure_spmf p) f

goal (1 subgoal):
 1. integrable (count_space UNIV) (\<lambda>x. spmf p x * f x)
[PROOF STEP]
by(simp add: integrable_iff_bounded nn_integral_measure_spmf abs_mult ennreal_mult'')
[PROOF STATE]
proof (state)
this:
integrable (count_space UNIV) (\<lambda>x. spmf p x * f x)

goal (1 subgoal):
 1. integral\<^sup>L (measure_spmf p) f = LINT x|count_space UNIV. spmf p x * f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable (count_space UNIV) (\<lambda>x. spmf p x * f x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable (count_space UNIV) (\<lambda>x. spmf p x * f x)

goal (1 subgoal):
 1. integral\<^sup>L (measure_spmf p) f = LINT x|count_space UNIV. spmf p x * f x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
integrable (count_space UNIV) (\<lambda>x. spmf p x * f x)
integrable (measure_spmf p) f

goal (1 subgoal):
 1. integral\<^sup>L (measure_spmf p) f = LINT x|count_space UNIV. spmf p x * f x
[PROOF STEP]
by(simp add: real_lebesgue_integral_def nn_integral_measure_spmf ennreal_mult'[symmetric])
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (measure_spmf p) f = LINT x|count_space UNIV. spmf p x * f x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_of_permute:
  assumes "\<sigma> permutes fst ` set xs"
  shows "map_of xs \<circ> \<sigma> = map_of (map (\<lambda>(x,y). (inv \<sigma> x, y)) xs)"
    (is "_ = map_of (map ?f _)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_of xs \<circ> \<sigma> = map_of (map (\<lambda>(x, y). (inv \<sigma> x, y)) xs)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (map_of xs \<circ> \<sigma>) x = map_of (map (\<lambda>(x, y). (inv \<sigma> x, y)) xs) x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<sigma> permutes fst ` set xs
[PROOF STEP]
have "inj \<sigma>" "surj \<sigma>"
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes fst ` set xs

goal (1 subgoal):
 1. inj \<sigma> &&& surj \<sigma>
[PROOF STEP]
by (simp_all add: permutes_inj permutes_surj)
[PROOF STATE]
proof (state)
this:
inj \<sigma>
surj \<sigma>

goal (1 subgoal):
 1. \<And>x. (map_of xs \<circ> \<sigma>) x = map_of (map (\<lambda>(x, y). (inv \<sigma> x, y)) xs) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj \<sigma>
surj \<sigma>
[PROOF STEP]
show "(map_of xs \<circ> \<sigma>) x = map_of (map ?f xs) x" for x
[PROOF STATE]
proof (prove)
using this:
inj \<sigma>
surj \<sigma>

goal (1 subgoal):
 1. (map_of xs \<circ> \<sigma>) x = map_of (map (\<lambda>(x, y). (inv \<sigma> x, y)) xs) x
[PROOF STEP]
by (induct xs) (auto simp: inv_f_f surj_f_inv_f)
[PROOF STATE]
proof (state)
this:
(map_of xs \<circ> \<sigma>) ?x = map_of (map (\<lambda>(x, y). (inv \<sigma> x, y)) xs) ?x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_fst_simp [simp]:
  assumes "y \<noteq> {}"
  shows "set_fst (x \<times> y) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_fst (x \<times> y) = x
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set_fst (x \<times> y) \<subseteq> x
 2. x \<subseteq> set_fst (x \<times> y)
[PROOF STEP]
show "set_fst (x \<times> y) \<subseteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_fst (x \<times> y) \<subseteq> x
[PROOF STEP]
by (smt (verit) SigmaE mem_Collect_eq prod.sel(1) set_fst_def subsetI)
[PROOF STATE]
proof (state)
this:
set_fst (x \<times> y) \<subseteq> x

goal (1 subgoal):
 1. x \<subseteq> set_fst (x \<times> y)
[PROOF STEP]
show "x \<subseteq> set_fst (x \<times> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<subseteq> set_fst (x \<times> y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> x \<Longrightarrow> xa \<in> set_fst (x \<times> y)
[PROOF STEP]
fix a::"nat"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> x \<Longrightarrow> xa \<in> set_fst (x \<times> y)
[PROOF STEP]
assume "a \<in> x"
[PROOF STATE]
proof (state)
this:
a \<in> x

goal (1 subgoal):
 1. \<And>xa. xa \<in> x \<Longrightarrow> xa \<in> set_fst (x \<times> y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> x
[PROOF STEP]
obtain b where "b \<in> y" and "(a,b) \<in> (x\<times>y)"
[PROOF STATE]
proof (prove)
using this:
a \<in> x

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>b \<in> y; (a, b) \<in> x \<times> y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> x
y \<noteq> {}

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>b \<in> y; (a, b) \<in> x \<times> y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> y
(a, b) \<in> x \<times> y

goal (1 subgoal):
 1. \<And>xa. xa \<in> x \<Longrightarrow> xa \<in> set_fst (x \<times> y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> y
(a, b) \<in> x \<times> y
[PROOF STEP]
show "a \<in> set_fst (x \<times> y)"
[PROOF STATE]
proof (prove)
using this:
b \<in> y
(a, b) \<in> x \<times> y

goal (1 subgoal):
 1. a \<in> set_fst (x \<times> y)
[PROOF STEP]
using set_fst_def
[PROOF STATE]
proof (prove)
using this:
b \<in> y
(a, b) \<in> x \<times> y
set_fst ?AB = {a. \<exists>ab\<in>?AB. a = fst ab}

goal (1 subgoal):
 1. a \<in> set_fst (x \<times> y)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
a \<in> set_fst (x \<times> y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<subseteq> set_fst (x \<times> y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma delete_node_was_path:
    assumes "is_path_undir (delete_node v G) x p y"
    shows "is_path_undir G x p y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_path_undir G x p y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_path_undir (delete_node v G) x p y

goal (1 subgoal):
 1. is_path_undir G x p y
[PROOF STEP]
unfolding delete_node_def
[PROOF STATE]
proof (prove)
using this:
is_path_undir \<lparr>nodes = V - {v}, edges = E \<inter> (- {v}) \<times> UNIV \<times> - {v}\<rparr> x p y

goal (1 subgoal):
 1. is_path_undir G x p y
[PROOF STEP]
by (induction p arbitrary: x y) auto


[STATEMENT]
lemma elements_mat_mat_of_col[simp]: "elements_mat (mat_of_col v) = vec_set v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elements_mat (mat_of_col v) = set\<^sub>v v
[PROOF STEP]
unfolding mat_of_col_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elements_mat (mat_of_row v)\<^sup>T = set\<^sub>v v
[PROOF STEP]
by auto


[STATEMENT]
lemma complex_cnj_of_nat [simp]: "cnj (of_nat n) = of_nat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (of_nat n) = of_nat n
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma set_tree_induct[consumes 1, case_names root left right]:
  assumes x: "x \<in> set_tree t"
  and root: "\<And>t. P (root t) t"
  and left: "\<And>x t. \<lbrakk> x \<in> set_tree (left t); P x (left t) \<rbrakk> \<Longrightarrow> P x t"
  and right: "\<And>x t. \<lbrakk> x \<in> set_tree (right t); P x (right t) \<rbrakk> \<Longrightarrow> P x t"
  shows "P x t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P x t
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<in> set_tree t

goal (1 subgoal):
 1. P x t
[PROOF STEP]
proof(rule tree.set_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>z1 z2 z3. P z1 (Node z1 z2 z3)
 2. \<And>z1 z2 z3 xa. \<lbrakk>xa \<in> set_tree z2; P xa z2\<rbrakk> \<Longrightarrow> P xa (Node z1 z2 z3)
 3. \<And>z1 z2 z3 xb. \<lbrakk>xb \<in> set_tree z3; P xb z3\<rbrakk> \<Longrightarrow> P xb (Node z1 z2 z3)
[PROOF STEP]
fix l x r
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>z1 z2 z3. P z1 (Node z1 z2 z3)
 2. \<And>z1 z2 z3 xa. \<lbrakk>xa \<in> set_tree z2; P xa z2\<rbrakk> \<Longrightarrow> P xa (Node z1 z2 z3)
 3. \<And>z1 z2 z3 xb. \<lbrakk>xb \<in> set_tree z3; P xb z3\<rbrakk> \<Longrightarrow> P xb (Node z1 z2 z3)
[PROOF STEP]
from root[of "Node x l r"]
[PROOF STATE]
proof (chain)
picking this:
P (root (Node x l r)) (Node x l r)
[PROOF STEP]
show "P x (Node x l r)"
[PROOF STATE]
proof (prove)
using this:
P (root (Node x l r)) (Node x l r)

goal (1 subgoal):
 1. P x (Node x l r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P x (Node x l r)

goal (2 subgoals):
 1. \<And>z1 z2 z3 xa. \<lbrakk>xa \<in> set_tree z2; P xa z2\<rbrakk> \<Longrightarrow> P xa (Node z1 z2 z3)
 2. \<And>z1 z2 z3 xb. \<lbrakk>xb \<in> set_tree z3; P xb z3\<rbrakk> \<Longrightarrow> P xb (Node z1 z2 z3)
[PROOF STEP]
qed(auto intro: left right)


[STATEMENT]
lemma transpose_index[simp]: assumes wf: "mat nr nc m"
  and i: "i < nr"
  and j: "j < nc"
  shows "transpose nr m ! i ! j = m ! j ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
have "transpose nr m ! i ! j = col (transpose nr m) i ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = col (Matrix_Legacy.transpose nr m) i ! j
[PROOF STEP]
unfolding col_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = Matrix_Legacy.transpose nr m ! i ! j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix_Legacy.transpose nr m ! i ! j = col (Matrix_Legacy.transpose nr m) i ! j

goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix_Legacy.transpose nr m ! i ! j = col (Matrix_Legacy.transpose nr m) i ! j

goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
have "\<dots> = row m i ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (Matrix_Legacy.transpose nr m) i ! j = row m i ! j
[PROOF STEP]
using col_transpose_is_row[OF wf i]
[PROOF STATE]
proof (prove)
using this:
col (Matrix_Legacy.transpose nr m) i = row m i

goal (1 subgoal):
 1. col (Matrix_Legacy.transpose nr m) i ! j = row m i ! j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
col (Matrix_Legacy.transpose nr m) i ! j = row m i ! j

goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
col (Matrix_Legacy.transpose nr m) i ! j = row m i ! j

goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
have "\<dots> = m ! j ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row m i ! j = m ! j ! i
[PROOF STEP]
unfolding row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>w. w ! i) m ! j = m ! j ! i
[PROOF STEP]
using wf j
[PROOF STATE]
proof (prove)
using this:
mat nr nc m
j < nc

goal (1 subgoal):
 1. map (\<lambda>w. w ! i) m ! j = m ! j ! i
[PROOF STEP]
unfolding mat_def
[PROOF STATE]
proof (prove)
using this:
length m = nc \<and> Ball (set m) (vec nr)
j < nc

goal (1 subgoal):
 1. map (\<lambda>w. w ! i) m ! j = m ! j ! i
[PROOF STEP]
by (auto simp: vec_def)
[PROOF STATE]
proof (state)
this:
row m i ! j = m ! j ! i

goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i

goal (1 subgoal):
 1. Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Matrix_Legacy.transpose nr m ! i ! j = m ! j ! i

goal:
No subgoals!
[PROOF STEP]
qed