[STATEMENT]
lemma (in cpx_sq_mat) sum_mat_distrib_right:
  shows "finite I \<Longrightarrow> R\<in> fc_mats \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> (A i)\<in> fc_mats) \<Longrightarrow>
    sum_mat (\<lambda>i. (A i) * R) I = (sum_mat A I) * R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; R \<in> fc_mats; \<And>i. i \<in> I \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) I = local.sum_mat A I * R
[PROOF STEP]
proof (induct rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) {} = local.sum_mat A {} * R
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
R \<in> fc_mats
?i1 \<in> {} \<Longrightarrow> A ?i1 \<in> fc_mats

goal (2 subgoals):
 1. \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) {} = local.sum_mat A {} * R
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
hence a: "sum_mat (\<lambda>i. (A i) * R) {} = 0\<^sub>m dimR dimC"
[PROOF STATE]
proof (prove)
using this:
R \<in> fc_mats
?i1 \<in> {} \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. A i * R) {} = 0\<^sub>m dimR dimC
[PROOF STEP]
unfolding sum_mat_def
[PROOF STATE]
proof (prove)
using this:
R \<in> fc_mats
?i1 \<in> {} \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. sum_with (+) (0\<^sub>m dimR dimC) (\<lambda>i. A i * R) {} = 0\<^sub>m dimR dimC
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. A i * R) {} = 0\<^sub>m dimR dimC

goal (2 subgoals):
 1. \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) {} = local.sum_mat A {} * R
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
have "sum_mat A {} = 0\<^sub>m dimR dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum_mat A {} = 0\<^sub>m dimR dimC
[PROOF STEP]
unfolding sum_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_with (+) (0\<^sub>m dimR dimC) A {} = 0\<^sub>m dimR dimC
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.sum_mat A {} = 0\<^sub>m dimR dimC

goal (2 subgoals):
 1. \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) {} = local.sum_mat A {} * R
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
hence "(sum_mat A {}) * R = 0\<^sub>m dimR dimC"
[PROOF STATE]
proof (prove)
using this:
local.sum_mat A {} = 0\<^sub>m dimR dimC

goal (1 subgoal):
 1. local.sum_mat A {} * R = 0\<^sub>m dimR dimC
[PROOF STEP]
using  fc_mats_carrier right_mult_zero_mat[of R ]
      dim_eq empty
[PROOF STATE]
proof (prove)
using this:
local.sum_mat A {} = 0\<^sub>m dimR dimC
fc_mats = carrier_mat dimR dimC
R \<in> carrier_mat ?nr ?n \<Longrightarrow> R * 0\<^sub>m ?n ?nc = 0\<^sub>m ?nr ?nc
dimR = dimC
R \<in> fc_mats
?i1 \<in> {} \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. local.sum_mat A {} * R = 0\<^sub>m dimR dimC
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.sum_mat A {} * R = 0\<^sub>m dimR dimC

goal (2 subgoals):
 1. \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) {} = local.sum_mat A {} * R
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
local.sum_mat A {} * R = 0\<^sub>m dimR dimC

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. A i * R) {} = local.sum_mat A {} * R
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
local.sum_mat A {} * R = 0\<^sub>m dimR dimC
local.sum_mat (\<lambda>i. A i * R) {} = 0\<^sub>m dimR dimC

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. A i * R) {} = local.sum_mat A {} * R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. A i * R) {} = local.sum_mat A {} * R

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
have a: "(\<lambda>i. A i * R) ` F \<subseteq> fc_mats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. A i * R) ` F \<subseteq> fc_mats
[PROOF STEP]
using insert cpx_sq_mat_mult
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats
\<lbrakk>?A \<in> fc_mats; ?B \<in> fc_mats\<rbrakk> \<Longrightarrow> ?A * ?B \<in> fc_mats

goal (1 subgoal):
 1. (\<lambda>i. A i * R) ` F \<subseteq> fc_mats
[PROOF STEP]
by (simp add: image_subsetI)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. A i * R) ` F \<subseteq> fc_mats

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
have "A x * R \<in> fc_mats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A x * R \<in> fc_mats
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. A x * R \<in> fc_mats
[PROOF STEP]
by (metis insertI1 local.fc_mats_carrier mult_carrier_mat dim_eq)
[PROOF STATE]
proof (state)
this:
A x * R \<in> fc_mats

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
hence "sum_mat (\<lambda>i. A i * R) (insert x F) = (A x) * R + sum_mat (\<lambda>i. A i * R) F"
[PROOF STATE]
proof (prove)
using this:
A x * R \<in> fc_mats

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. A i * R) (insert x F) = A x * R + local.sum_mat (\<lambda>i. A i * R) F
[PROOF STEP]
using insert a
[PROOF STATE]
proof (prove)
using this:
A x * R \<in> fc_mats
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats
(\<lambda>i. A i * R) ` F \<subseteq> fc_mats

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. A i * R) (insert x F) = A x * R + local.sum_mat (\<lambda>i. A i * R) F
[PROOF STEP]
using sum_mat_insert[of "\<lambda>i. A i * R" x F]
[PROOF STATE]
proof (prove)
using this:
A x * R \<in> fc_mats
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats
(\<lambda>i. A i * R) ` F \<subseteq> fc_mats
\<lbrakk>A x * R \<in> fc_mats; (\<lambda>i. A i * R) ` F \<subseteq> fc_mats; finite F; x \<notin> F\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = A x * R + local.sum_mat (\<lambda>i. A i * R) F

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. A i * R) (insert x F) = A x * R + local.sum_mat (\<lambda>i. A i * R) F
[PROOF STEP]
by (simp add: image_subsetI local.fc_mats_carrier)
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. A i * R) (insert x F) = A x * R + local.sum_mat (\<lambda>i. A i * R) F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. A i * R) (insert x F) = A x * R + local.sum_mat (\<lambda>i. A i * R) F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
have "... = (A x) * R + (sum_mat A F) * R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A x * R + local.sum_mat (\<lambda>i. A i * R) F = A x * R + local.sum_mat A F * R
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. A x * R + local.sum_mat (\<lambda>i. A i * R) F = A x * R + local.sum_mat A F * R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A x * R + local.sum_mat (\<lambda>i. A i * R) F = A x * R + local.sum_mat A F * R

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A x * R + local.sum_mat (\<lambda>i. A i * R) F = A x * R + local.sum_mat A F * R

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
have "... = (A x + (sum_mat A F)) * R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A x * R + local.sum_mat A F * R = (A x + local.sum_mat A F) * R
[PROOF STEP]
proof (rule add_mult_distrib_mat[symmetric])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A x \<in> carrier_mat ?nr ?n
 2. local.sum_mat A F \<in> carrier_mat ?nr ?n
 3. R \<in> carrier_mat ?n ?nc
[PROOF STEP]
show "A x \<in> carrier_mat dimR dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A x \<in> carrier_mat dimR dimC
[PROOF STEP]
using insert fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. A x \<in> carrier_mat dimR dimC
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A x \<in> carrier_mat dimR dimC

goal (2 subgoals):
 1. local.sum_mat A F \<in> carrier_mat dimR dimC
 2. R \<in> carrier_mat dimC ?nc
[PROOF STEP]
show "sum_mat A F \<in> carrier_mat dimR dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum_mat A F \<in> carrier_mat dimR dimC
[PROOF STEP]
using insert fc_mats_carrier sum_mat_carrier
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats
fc_mats = carrier_mat dimR dimC
(\<And>i. i \<in> ?I \<Longrightarrow> ?A i \<in> fc_mats) \<Longrightarrow> local.sum_mat ?A ?I \<in> carrier_mat dimR dimC

goal (1 subgoal):
 1. local.sum_mat A F \<in> carrier_mat dimR dimC
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
local.sum_mat A F \<in> carrier_mat dimR dimC

goal (1 subgoal):
 1. R \<in> carrier_mat dimC ?nc
[PROOF STEP]
show "R \<in> carrier_mat dimC dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<in> carrier_mat dimC dimC
[PROOF STEP]
using insert fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R
R \<in> fc_mats
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. R \<in> carrier_mat dimC dimC
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
R \<in> carrier_mat dimC dimC

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A x * R + local.sum_mat A F * R = (A x + local.sum_mat A F) * R

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A x * R + local.sum_mat A F * R = (A x + local.sum_mat A F) * R

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
have "... = sum_mat A (insert x F) * R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A x + local.sum_mat A F) * R = local.sum_mat A (insert x F) * R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (A x + local.sum_mat A F) * R = local.sum_mat A (insert x F) * R
[PROOF STEP]
have "A x + (sum_mat A F) = sum_mat A (insert x F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A x + local.sum_mat A F = local.sum_mat A (insert x F)
[PROOF STEP]
by (rule sum_mat_insert[symmetric], (auto simp add: insert))
[PROOF STATE]
proof (state)
this:
A x + local.sum_mat A F = local.sum_mat A (insert x F)

goal (1 subgoal):
 1. (A x + local.sum_mat A F) * R = local.sum_mat A (insert x F) * R
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A x + local.sum_mat A F = local.sum_mat A (insert x F)

goal (1 subgoal):
 1. (A x + local.sum_mat A F) * R = local.sum_mat A (insert x F) * R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(A x + local.sum_mat A F) * R = local.sum_mat A (insert x F) * R

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(A x + local.sum_mat A F) * R = local.sum_mat A (insert x F) * R

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>R \<in> fc_mats; \<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) F = local.sum_mat A F * R; R \<in> fc_mats; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. A i * R) (insert x F) = local.sum_mat A (insert x F) * R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_nonzero_pow [eventually_nonzero_simps]:
  "eventually_nonzero F (\<lambda>x::_::linorder. f x ^ n) \<longleftrightarrow> n = 0 \<or> eventually_nonzero F f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually_nonzero F (\<lambda>x. f x ^ n) = (n = 0 \<or> eventually_nonzero F f)
[PROOF STEP]
by (induction n) (auto simp: eventually_nonzero_simps)


[STATEMENT]
lemma trss_stack_decomp_s: "\<lbrakk> ((s@r,c),e,(s',c'))\<in>trss fg; s\<noteq>[] \<rbrakk>
  \<Longrightarrow> \<exists>sp'. s'=sp'@r \<and> ((s,c),e,(sp',c'))\<in>trss fg"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>((s @ r, c), e, s', c') \<in> trss fg; s \<noteq> []\<rbrakk> \<Longrightarrow> \<exists>sp'. s' = sp' @ r \<and> ((s, c), e, sp', c') \<in> trss fg
[PROOF STEP]
by (cases s, simp) (auto intro: trss.intros elim!: trss.cases)


[STATEMENT]
theorem even_odd_induct:
  assumes "R 0"
  assumes "Q 0"
  assumes "\<And>n. Q n \<Longrightarrow> R (Suc n)"
  assumes "\<And>n. R n \<Longrightarrow> Q (Suc n)"
  shows "R n" "Q n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R n &&& Q n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
R 0
Q 0
Q ?n \<Longrightarrow> R (Suc ?n)
R ?n \<Longrightarrow> Q (Suc ?n)

goal (1 subgoal):
 1. R n &&& Q n
[PROOF STEP]
by induction_schema (pat_completeness+, lexicographic_order)


[STATEMENT]
lemma integrable_cong_AE:
  "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> AE x in M. f x = g x \<Longrightarrow>
    integrable M f \<longleftrightarrow> integrable M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M; AE x in M. f x = g x\<rbrakk> \<Longrightarrow> integrable M f = integrable M g
[PROOF STEP]
unfolding integrable.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M; AE x in M. f x = g x\<rbrakk> \<Longrightarrow> Ex (has_bochner_integral M f) = Ex (has_bochner_integral M g)
[PROOF STEP]
by (intro has_bochner_integral_cong_AE arg_cong[where f=Ex] ext)


[STATEMENT]
lemma sorted_list_of_in_tree_MPT[code] :
  "sorted_list_of_sequences_in_tree (MPT m) =
    (if Mapping.keys m = {}
      then [[]]
      else [] # concat (map (\<lambda>k . map ((#) k) (sorted_list_of_sequences_in_tree (the (Mapping.lookup m k)))) (sorted_list_of_set (Mapping.keys m))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_sequences_in_tree (MPT m) = (if Mapping.keys m = {} then [[]] else [] # concat (map (\<lambda>k. map ((#) k) (sorted_list_of_sequences_in_tree (the (Mapping.lookup m k)))) (sorted_list_of_set (Mapping.keys m))))
[PROOF STEP]
unfolding MPT_def sorted_list_of_sequences_in_tree.simps keys_dom_lookup
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if dom (Mapping.lookup m) = {} then [[]] else [] # concat (map (\<lambda>k. map ((#) k) (sorted_list_of_sequences_in_tree (the (Mapping.lookup m k)))) (sorted_list_of_set (dom (Mapping.lookup m))))) = (if dom (Mapping.lookup m) = {} then [[]] else [] # concat (map (\<lambda>k. map ((#) k) (sorted_list_of_sequences_in_tree (the (Mapping.lookup m k)))) (sorted_list_of_set (dom (Mapping.lookup m)))))
[PROOF STEP]
by simp


[STATEMENT]
lemma hlog: "hlog (star_n X) (star_n Y) = star_n (\<lambda>n. log (X n) (Y n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hlog (star_n X) (star_n Y) = star_n (\<lambda>n. log (X n) (Y n))
[PROOF STEP]
by (simp add: hlog_def starfun2_star_n)


[STATEMENT]
lemma scaleC_adj[simp]: "(a *\<^sub>C A)* = (cnj a) *\<^sub>C (A*)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a *\<^sub>C A)* = cnj a *\<^sub>C A*
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a A. bounded_clinear A \<Longrightarrow> (\<lambda>x. a *\<^sub>C A x)\<^sup>\<dagger> = (\<lambda>x. cnj a *\<^sub>C (A\<^sup>\<dagger>) x)
[PROOF STEP]
by (simp add: bounded_clinear.bounded_linear bounded_clinear_def complex_vector.linear_scale scaleC_cadjoint)


[STATEMENT]
lemma algebraic_int_of_real [intro]:
  assumes "algebraic_int x"
  shows   "algebraic_int (of_real x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_int (of_real x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. algebraic_int (of_real x)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
algebraic_int x
[PROOF STEP]
obtain p where p: "poly p x = 0" "\<forall>i. coeff p i \<in> \<int>" "lead_coeff p = 1"
[PROOF STATE]
proof (prove)
using this:
algebraic_int x

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>poly p x = 0; \<forall>i. coeff p i \<in> \<int>; lead_coeff p = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: algebraic_int.simps)
[PROOF STATE]
proof (state)
this:
poly p x = 0
\<forall>i. coeff p i \<in> \<int>
lead_coeff p = 1

goal (1 subgoal):
 1. algebraic_int (of_real x)
[PROOF STEP]
show "algebraic_int (of_real x :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_int (of_real x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. lead_coeff ?p = (1::'a)
 2. \<forall>i. coeff ?p i \<in> \<int>
 3. poly ?p (of_real x) = (0::'a)
[PROOF STEP]
have "poly (map_poly of_real p) (of_real x) = (of_real (poly p x) :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (map_poly of_real p) (of_real x) = of_real (poly p x)
[PROOF STEP]
by (induction p) (auto simp: map_poly_pCons)
[PROOF STATE]
proof (state)
this:
poly (map_poly of_real p) (of_real x) = of_real (poly p x)

goal (3 subgoals):
 1. lead_coeff ?p = (1::'a)
 2. \<forall>i. coeff ?p i \<in> \<int>
 3. poly ?p (of_real x) = (0::'a)
[PROOF STEP]
thus "poly (map_poly of_real p) (of_real x) = (0 :: 'a)"
[PROOF STATE]
proof (prove)
using this:
poly (map_poly of_real p) (of_real x) = of_real (poly p x)

goal (1 subgoal):
 1. poly (map_poly of_real p) (of_real x) = (0::'a)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
poly (map_poly of_real p) (of_real x) = of_real (poly p x)
poly p x = 0
\<forall>i. coeff p i \<in> \<int>
lead_coeff p = 1

goal (1 subgoal):
 1. poly (map_poly of_real p) (of_real x) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (map_poly of_real p) (of_real x) = (0::'a)

goal (2 subgoals):
 1. lead_coeff (map_poly of_real p) = (1::'a)
 2. \<forall>i. coeff (map_poly of_real p) i \<in> \<int>
[PROOF STEP]
qed (use p in \<open>auto simp: coeff_map_poly degree_map_poly\<close>)
[PROOF STATE]
proof (state)
this:
algebraic_int (of_real x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in vectorspace) lin_dep_iff_in_span:
  fixes A v S
  assumes  h1: "S \<subseteq> carrier V" and h2: "lin_indpt S" and h3: "v\<in> carrier V" and h4: "v\<notin>S"
  shows "v\<in> span S \<longleftrightarrow> lin_dep (S \<union> {v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<in> span S) = lin_dep (S \<union> {v})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (v \<in> span S) = lin_dep (S \<union> {v})
[PROOF STEP]
let ?T = "S \<union> {v}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (v \<in> span S) = lin_dep (S \<union> {v})
[PROOF STEP]
have 0: "v\<in>?T "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> S \<union> {v}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> S \<union> {v}

goal (1 subgoal):
 1. (v \<in> span S) = lin_dep (S \<union> {v})
[PROOF STEP]
from h1 h3
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier V
v \<in> carrier V
[PROOF STEP]
have h1_1: "?T \<subseteq> carrier V"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier V
v \<in> carrier V

goal (1 subgoal):
 1. S \<union> {v} \<subseteq> carrier V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<union> {v} \<subseteq> carrier V

goal (1 subgoal):
 1. (v \<in> span S) = lin_dep (S \<union> {v})
[PROOF STEP]
have a1:"lin_dep ?T \<Longrightarrow> v\<in> span S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
assume a11: "lin_dep ?T"
[PROOF STATE]
proof (state)
this:
lin_dep (S \<union> {v})

goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
from a11
[PROOF STATE]
proof (chain)
picking this:
lin_dep (S \<union> {v})
[PROOF STEP]
obtain a w A where a: "(finite A \<and> A\<subseteq>?T \<and> (a\<in> (A\<rightarrow>carrier K)) \<and> (lincomb a A = \<zero>\<^bsub>V\<^esub>) \<and> (w\<in>A) \<and> (a w\<noteq> \<zero>\<^bsub>K\<^esub>))"
[PROOF STATE]
proof (prove)
using this:
lin_dep (S \<union> {v})

goal (1 subgoal):
 1. (\<And>A a w. finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis lin_dep_def)
[PROOF STATE]
proof (state)
this:
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
from assms a
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
have nz2: "\<exists>v\<in>A-S. a v\<noteq>\<zero>\<^bsub>K\<^esub>"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. \<exists>v\<in>A - S. a v \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
by (intro lincomb_must_include[where ?v="w" and ?T="S\<union>{v}"], auto)
[PROOF STATE]
proof (state)
this:
\<exists>v\<in>A - S. a v \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
from a nz2
[PROOF STATE]
proof (chain)
picking this:
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>
\<exists>v\<in>A - S. a v \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
have singleton: "{v}=A-S"
[PROOF STATE]
proof (prove)
using this:
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>
\<exists>v\<in>A - S. a v \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. {v} = A - S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{v} = A - S

goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
from singleton nz2
[PROOF STATE]
proof (chain)
picking this:
{v} = A - S
\<exists>v\<in>A - S. a v \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
have nz3: "a v\<noteq>\<zero>\<^bsub>K\<^esub>"
[PROOF STATE]
proof (prove)
using this:
{v} = A - S
\<exists>v\<in>A - S. a v \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. a v \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a v \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
(*Can modularize this whole section out. "solving for one variable"*)
[PROOF STATE]
proof (state)
this:
a v \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
let ?b="(\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> (a v)) \<otimes>\<^bsub>K\<^esub> (a w))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
from singleton
[PROOF STATE]
proof (chain)
picking this:
{v} = A - S
[PROOF STEP]
have Ains: "(A\<inter>S) = A-{v}"
[PROOF STATE]
proof (prove)
using this:
{v} = A - S

goal (1 subgoal):
 1. A \<inter> S = A - {v}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<inter> S = A - {v}

goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
from assms a singleton nz3
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>
{v} = A - S
a v \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
have a31: "v= lincomb ?b (A\<inter>S)"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>
{v} = A - S
a v \<noteq> \<zero>\<^bsub>K\<^esub>

goal (1 subgoal):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A \<inter> S)
[PROOF STEP]
apply (subst Ains)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> carrier V; lin_indpt S; v \<in> carrier V; v \<notin> S; finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>; {v} = A - S; a v \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
[PROOF STEP]
by (intro lincomb_isolate(1), auto)
[PROOF STATE]
proof (state)
this:
v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A \<inter> S)

goal (1 subgoal):
 1. lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
[PROOF STEP]
from a a31 nz3 singleton
[PROOF STATE]
proof (chain)
picking this:
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>
v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A \<inter> S)
a v \<noteq> \<zero>\<^bsub>K\<^esub>
{v} = A - S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> w \<in> A \<and> a w \<noteq> \<zero>\<^bsub>K\<^esub>
v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A \<inter> S)
a v \<noteq> \<zero>\<^bsub>K\<^esub>
{v} = A - S

goal (1 subgoal):
 1. v \<in> span S
[PROOF STEP]
apply (unfold span_def, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A \<inter> S); a v \<noteq> \<zero>\<^bsub>K\<^esub>; {v} = A - S; finite A; a \<in> A \<rightarrow> carrier K; lincomb a A = \<zero>\<^bsub>V\<^esub>; w \<in> A; a w \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> \<exists>a A. v = lincomb a A \<and> finite A \<and> A \<subseteq> S \<and> a \<in> A \<rightarrow> carrier K
[PROOF STEP]
apply (rule_tac x="?b" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A \<inter> S); a v \<noteq> \<zero>\<^bsub>K\<^esub>; {v} = A - S; finite A; a \<in> A \<rightarrow> carrier K; lincomb a A = \<zero>\<^bsub>V\<^esub>; w \<in> A; a w \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> \<exists>A. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) A \<and> finite A \<and> A \<subseteq> S \<and> (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) \<in> A \<rightarrow> carrier K
[PROOF STEP]
apply (rule_tac x="A\<inter>S" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A \<inter> S); a v \<noteq> \<zero>\<^bsub>K\<^esub>; {v} = A - S; finite A; a \<in> A \<rightarrow> carrier K; lincomb a A = \<zero>\<^bsub>V\<^esub>; w \<in> A; a w \<noteq> \<zero>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A \<inter> S) \<and> finite (A \<inter> S) \<and> A \<inter> S \<subseteq> S \<and> (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) \<in> A \<inter> S \<rightarrow> carrier K
[PROOF STEP]
by (auto intro!: m_closed)
[PROOF STATE]
proof (state)
this:
v \<in> span S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S

goal (1 subgoal):
 1. (v \<in> span S) = lin_dep (S \<union> {v})
[PROOF STEP]
have a2: "v\<in> (span S) \<Longrightarrow> lin_dep ?T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})
[PROOF STEP]
assume inspan: "v\<in> (span S)"
[PROOF STATE]
proof (state)
this:
v \<in> span S

goal (1 subgoal):
 1. v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})
[PROOF STEP]
from inspan
[PROOF STATE]
proof (chain)
picking this:
v \<in> span S
[PROOF STEP]
obtain a A where a: "A\<subseteq>S \<and> finite A \<and> (v = lincomb a A)\<and> a\<in>A\<rightarrow>carrier K"
[PROOF STATE]
proof (prove)
using this:
v \<in> span S

goal (1 subgoal):
 1. (\<And>A a. A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (simp add: span_def, auto)
[PROOF STATE]
proof (state)
this:
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K

goal (1 subgoal):
 1. v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})
[PROOF STEP]
let ?b = "\<lambda> w. if (w=v) then (\<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub>) else a w"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})
[PROOF STEP]
(*consider -v + \sum a_w w*)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})
[PROOF STEP]
have lc0: " lincomb ?b (A\<union>{v})=\<zero>\<^bsub>V\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
from assms a
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K
[PROOF STEP]
have lc_ins: "lincomb ?b (A\<union>{v}) = ((?b v) \<odot>\<^bsub>V\<^esub> v) \<oplus>\<^bsub>V\<^esub> lincomb ?b A"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K

goal (1 subgoal):
 1. lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = (if v = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a v) \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) A
[PROOF STEP]
by (intro lincomb_insert, auto)
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = (if v = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a v) \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) A

goal (1 subgoal):
 1. lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
from assms a
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K
[PROOF STEP]
have lc_elim: "lincomb ?b A=lincomb a A"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K

goal (1 subgoal):
 1. lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) A = lincomb a A
[PROOF STEP]
by (intro lincomb_elim_if, auto)
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) A = lincomb a A

goal (1 subgoal):
 1. lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
from assms lc_ins lc_elim a
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = (if v = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a v) \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) A
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) A = lincomb a A
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier V
lin_indpt S
v \<in> carrier V
v \<notin> S
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = (if v = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a v) \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) A
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) A = lincomb a A
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K

goal (1 subgoal):
 1. lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
by (simp add: M.l_neg smult_minus_1)
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})
[PROOF STEP]
from  a lc0
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K
lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. lin_dep (S \<union> {v})
[PROOF STEP]
apply (unfold lin_dep_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K; lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> \<exists>A a va. finite A \<and> A \<subseteq> S \<union> {v} \<and> a \<in> A \<rightarrow> carrier K \<and> lincomb a A = \<zero>\<^bsub>V\<^esub> \<and> va \<in> A \<and> a va \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
apply (rule_tac x="A\<union>{v}" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K; lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> \<exists>a va. finite (A \<union> {v}) \<and> A \<union> {v} \<subseteq> S \<union> {v} \<and> a \<in> A \<union> {v} \<rightarrow> carrier K \<and> lincomb a (A \<union> {v}) = \<zero>\<^bsub>V\<^esub> \<and> va \<in> A \<union> {v} \<and> a va \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
apply (rule_tac x="?b" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K; lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> \<exists>va. finite (A \<union> {v}) \<and> A \<union> {v} \<subseteq> S \<union> {v} \<and> (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) \<in> A \<union> {v} \<rightarrow> carrier K \<and> lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub> \<and> va \<in> A \<union> {v} \<and> (if va = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a va) \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
apply (rule_tac x="v" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> S \<and> finite A \<and> v = lincomb a A \<and> a \<in> A \<rightarrow> carrier K; lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub>\<rbrakk> \<Longrightarrow> finite (A \<union> {v}) \<and> A \<union> {v} \<subseteq> S \<union> {v} \<and> (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) \<in> A \<union> {v} \<rightarrow> carrier K \<and> lincomb (\<lambda>w. if w = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a w) (A \<union> {v}) = \<zero>\<^bsub>V\<^esub> \<and> v \<in> A \<union> {v} \<and> (if v = v then \<ominus>\<^bsub>K\<^esub> \<one>\<^bsub>K\<^esub> else a v) \<noteq> \<zero>\<^bsub>K\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lin_dep (S \<union> {v})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})

goal (1 subgoal):
 1. (v \<in> span S) = lin_dep (S \<union> {v})
[PROOF STEP]
from a1 a2
[PROOF STATE]
proof (chain)
picking this:
lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lin_dep (S \<union> {v}) \<Longrightarrow> v \<in> span S
v \<in> span S \<Longrightarrow> lin_dep (S \<union> {v})

goal (1 subgoal):
 1. (v \<in> span S) = lin_dep (S \<union> {v})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(v \<in> span S) = lin_dep (S \<union> {v})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unstream_map_trans [stream_fusion]: "unstream (map_trans f g) s = map f (unstream g s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unstream (map_trans f g) s = map f (unstream g s)
[PROOF STEP]
proof (induction s taking: g rule: unstream.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator g s = Skip x2 \<Longrightarrow> unstream (map_trans f g) x2 = map f (unstream g x2); \<And>x31 x32. generator g s = Yield x31 x32 \<Longrightarrow> unstream (map_trans f g) x32 = map f (unstream g x32)\<rbrakk> \<Longrightarrow> unstream (map_trans f g) s = map f (unstream g s)
[PROOF STEP]
case (1 s)
[PROOF STATE]
proof (state)
this:
generator g s = Skip ?x2.0 \<Longrightarrow> unstream (map_trans f g) ?x2.0 = map f (unstream g ?x2.0)
generator g s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (map_trans f g) ?x32.0 = map f (unstream g ?x32.0)

goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator g s = Skip x2 \<Longrightarrow> unstream (map_trans f g) x2 = map f (unstream g x2); \<And>x31 x32. generator g s = Yield x31 x32 \<Longrightarrow> unstream (map_trans f g) x32 = map f (unstream g x32)\<rbrakk> \<Longrightarrow> unstream (map_trans f g) s = map f (unstream g s)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unstream (map_trans f g) s = map f (unstream g s)
[PROOF STEP]
using "1.IH"
[PROOF STATE]
proof (prove)
using this:
generator g s = Skip ?x2.0 \<Longrightarrow> unstream (map_trans f g) ?x2.0 = map f (unstream g ?x2.0)
generator g s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (map_trans f g) ?x32.0 = map f (unstream g ?x32.0)

goal (1 subgoal):
 1. unstream (map_trans f g) s = map f (unstream g s)
[PROOF STEP]
by (cases "generator g s")(simp_all add: map_trans.rep_eq map_raw_def)
[PROOF STATE]
proof (state)
this:
unstream (map_trans f g) s = map f (unstream g s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_mult_equiv_coeff:
  fixes f g :: "('a :: {euclidean_ring_cancel}) fps"
  assumes "(f, g) \<in> fpsmodrel p"
  shows "(f*h)$n mod p = (g*h)$n mod p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f * h) $ n mod p = (g * h) $ n mod p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f * h) $ n mod p = (g * h) $ n mod p
[PROOF STEP]
have "((f*h) $ n) mod p =(\<Sum>i=0..n. (f$i mod p * h$(n - i) mod p) mod p) mod p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f * h) $ n mod p = (\<Sum>i = 0..n. f $ i mod p * h $ (n - i) mod p mod p) mod p
[PROOF STEP]
using mod_sum_eq mod_mult_left_eq
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>?A. ?f i mod ?a) mod ?a = sum ?f ?A mod ?a
?a mod ?c * ?b mod ?c = ?a * ?b mod ?c

goal (1 subgoal):
 1. (f * h) $ n mod p = (\<Sum>i = 0..n. f $ i mod p * h $ (n - i) mod p mod p) mod p
[PROOF STEP]
by (simp add: fps_mult_nth mod_sum_eq mod_mult_left_eq)
[PROOF STATE]
proof (state)
this:
(f * h) $ n mod p = (\<Sum>i = 0..n. f $ i mod p * h $ (n - i) mod p mod p) mod p

goal (1 subgoal):
 1. (f * h) $ n mod p = (g * h) $ n mod p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f * h) $ n mod p = (\<Sum>i = 0..n. f $ i mod p * h $ (n - i) mod p mod p) mod p

goal (1 subgoal):
 1. (f * h) $ n mod p = (g * h) $ n mod p
[PROOF STEP]
have "... = (\<Sum>i=0..n. (g$i mod p * h$(n - i) mod p) mod p) mod p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. f $ i mod p * h $ (n - i) mod p mod p) mod p = (\<Sum>i = 0..n. g $ i mod p * h $ (n - i) mod p mod p) mod p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f, g) \<in> fpsmodrel p

goal (1 subgoal):
 1. (\<Sum>i = 0..n. f $ i mod p * h $ (n - i) mod p mod p) mod p = (\<Sum>i = 0..n. g $ i mod p * h $ (n - i) mod p mod p) mod p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. f $ i mod p * h $ (n - i) mod p mod p) mod p = (\<Sum>i = 0..n. g $ i mod p * h $ (n - i) mod p mod p) mod p

goal (1 subgoal):
 1. (f * h) $ n mod p = (g * h) $ n mod p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. f $ i mod p * h $ (n - i) mod p mod p) mod p = (\<Sum>i = 0..n. g $ i mod p * h $ (n - i) mod p mod p) mod p

goal (1 subgoal):
 1. (f * h) $ n mod p = (g * h) $ n mod p
[PROOF STEP]
have "... = ((g*h) $ n) mod p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. g $ i mod p * h $ (n - i) mod p mod p) mod p = (g * h) $ n mod p
[PROOF STEP]
by (simp add: mod_mult_left_eq mod_sum_eq fps_mult_nth)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. g $ i mod p * h $ (n - i) mod p mod p) mod p = (g * h) $ n mod p

goal (1 subgoal):
 1. (f * h) $ n mod p = (g * h) $ n mod p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..n. g $ i mod p * h $ (n - i) mod p mod p) mod p = (g * h) $ n mod p

goal (1 subgoal):
 1. (f * h) $ n mod p = (g * h) $ n mod p
[PROOF STEP]
by (simp add: calculation)
[PROOF STATE]
proof (state)
this:
(f * h) $ n mod p = (g * h) $ n mod p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inext_eq_infin_fin: "
  \<lbrakk> inext a I = inext b I; a \<noteq> Max I \<and> b \<noteq> Max I \<or> infinite I \<rbrakk> \<Longrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inext a I = inext b I; a \<noteq> Max I \<and> b \<noteq> Max I \<or> infinite I\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
by (blast intro: inext_eq_fin inext_eq_infin)+


[STATEMENT]
lemma option_map_in_optionI:
  "\<lbrakk> ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S \<rbrakk>
  \<Longrightarrow> map_option f ox \<in> opt S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S\<rbrakk> \<Longrightarrow> map_option f ox \<in> opt S
[PROOF STEP]
apply (unfold map_option_case)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S\<rbrakk> \<Longrightarrow> (case ox of None \<Rightarrow> None | Some x \<Rightarrow> Some (f x)) \<in> opt S
[PROOF STEP]
apply (simp split: option.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ox \<in> opt S; \<forall>x\<in>S. ox = Some x \<longrightarrow> f x \<in> S\<rbrakk> \<Longrightarrow> \<forall>x2. ox = Some x2 \<longrightarrow> f x2 \<in> S
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mult_assoc_5:
  shows "A *\<^sub>m\<^sub>m (B *\<^sub>m\<^sub>m C *\<^sub>m\<^sub>m D) *\<^sub>m\<^sub>m E = (A *\<^sub>m\<^sub>m B) *\<^sub>m\<^sub>m C *\<^sub>m\<^sub>m (D *\<^sub>m\<^sub>m E)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>m\<^sub>m (B *\<^sub>m\<^sub>m C *\<^sub>m\<^sub>m D) *\<^sub>m\<^sub>m E = A *\<^sub>m\<^sub>m B *\<^sub>m\<^sub>m C *\<^sub>m\<^sub>m (D *\<^sub>m\<^sub>m E)
[PROOF STEP]
by (simp only: mult_mm_assoc)


[STATEMENT]
lemma (in comm_semiring_1) poly_mulexp: "poly (mulexp n p q) x = (poly p x) ^ n * poly q x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (mulexp n p q) x = poly p x ^ n * poly q x
[PROOF STEP]
by (induct n) (auto simp add: poly_mult ac_simps)


[STATEMENT]
lemma combining_sys_satisfies_properties_helper:
  fixes p:: "real poly"
  fixes qs1 :: "real poly list"
  fixes qs2 :: "real poly list"
  fixes subsets1 subsets2 :: "nat list list"
  fixes signs1 signs2 :: "rat list list"
  fixes matrix1 matrix2:: "rat mat"
  assumes nonzero: "p \<noteq> 0"
  assumes nontriv1: "length qs1 > 0"
  assumes pairwise_rel_prime1: "\<forall>q. ((List.member qs1 q) \<longrightarrow> (coprime p q))"
  assumes nontriv2: "length qs2 > 0"
  assumes pairwise_rel_prime2: "\<forall>q. ((List.member qs2 q) \<longrightarrow> (coprime p q))"
  assumes satisfies_properties_sys1: "satisfies_properties p qs1 subsets1 signs1 matrix1"
  assumes satisfies_properties_sys2: "satisfies_properties p qs2 subsets2 signs2 matrix2"
  shows  "satisfies_properties p (qs1@qs2) (get_subsets (snd ((combine_systems p (qs1,(matrix1, (subsets1, signs1))) (qs2,(matrix2, (subsets2, signs2)))))))
  (get_signs (snd ((combine_systems p (qs1,(matrix1, (subsets1, signs1))) (qs2,(matrix2, (subsets2, signs2)))))))
  (get_matrix (snd ((combine_systems p (qs1,(matrix1, (subsets1, signs1))) (qs2,(matrix2, (subsets2, signs2)))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
let ?subsets = "(get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1)
              (qs2, matrix2, subsets2, signs2))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
let ?signs = "(get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
let ?matrix = "(get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
have h1: "all_list_constr ?subsets (length (qs1 @ qs2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_list_constr (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (length (qs1 @ qs2))
[PROOF STEP]
using well_def_step[of subsets1 qs1 subsets2 qs2] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>all_list_constr subsets1 (length qs1); all_list_constr subsets2 (length qs2)\<rbrakk> \<Longrightarrow> all_list_constr (subsets_smash (length qs1) subsets1 subsets2) (length (qs1 @ qs2))
p \<noteq> 0
0 < length qs1
\<forall>q. List.member qs1 q \<longrightarrow> coprime p q
0 < length qs2
\<forall>q. List.member qs2 q \<longrightarrow> coprime p q
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2

goal (1 subgoal):
 1. all_list_constr (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (length (qs1 @ qs2))
[PROOF STEP]
by (simp add: nontriv2 get_subsets_def satisfies_properties_def smash_systems_def)
[PROOF STATE]
proof (state)
this:
all_list_constr (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (length (qs1 @ qs2))

goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
have h2: "well_def_signs (length (qs1 @ qs2)) ?signs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_def_signs (length (qs1 @ qs2)) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using well_def_signs_step[of qs1 qs2 signs1 signs2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < length qs1; 0 < length qs2; well_def_signs (length qs1) signs1; well_def_signs (length qs2) signs2\<rbrakk> \<Longrightarrow> well_def_signs (length (qs1 @ qs2)) (signs_smash signs1 signs2)

goal (1 subgoal):
 1. well_def_signs (length (qs1 @ qs2)) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using get_signs_def nontriv1 nontriv2 satisfies_properties_def satisfies_properties_sys1 satisfies_properties_sys2 smash_systems_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < length qs1; 0 < length qs2; well_def_signs (length qs1) signs1; well_def_signs (length qs2) signs2\<rbrakk> \<Longrightarrow> well_def_signs (length (qs1 @ qs2)) (signs_smash signs1 signs2)
get_signs ?data = snd (snd ?data)
0 < length qs1
0 < length qs2
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2
smash_systems ?p ?qs1.0 ?qs2.0 ?subsets1.0 ?subsets2.0 ?signs1.0 ?signs2.0 ?mat1.0 ?mat2.0 = (?qs1.0 @ ?qs2.0, kronecker_product ?mat1.0 ?mat2.0, subsets_smash (length ?qs1.0) ?subsets1.0 ?subsets2.0, signs_smash ?signs1.0 ?signs2.0)

goal (1 subgoal):
 1. well_def_signs (length (qs1 @ qs2)) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
well_def_signs (length (qs1 @ qs2)) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
have h3: "distinct ?signs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using distinct_step[of _ signs1 _ signs2] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>well_def_signs ?n1.0 signs1; well_def_signs ?n2.0 signs2; distinct signs1; distinct signs2\<rbrakk> \<Longrightarrow> distinct (signs_smash signs1 signs2)
p \<noteq> 0
0 < length qs1
\<forall>q. List.member qs1 q \<longrightarrow> coprime p q
0 < length qs2
\<forall>q. List.member qs2 q \<longrightarrow> coprime p q
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2

goal (1 subgoal):
 1. distinct (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using combine_systems.simps get_signs_def satisfies_properties_def smash_systems_def snd_conv
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>well_def_signs ?n1.0 signs1; well_def_signs ?n2.0 signs2; distinct signs1; distinct signs2\<rbrakk> \<Longrightarrow> distinct (signs_smash signs1 signs2)
p \<noteq> 0
0 < length qs1
\<forall>q. List.member qs1 q \<longrightarrow> coprime p q
0 < length qs2
\<forall>q. List.member qs2 q \<longrightarrow> coprime p q
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2
combine_systems ?p (?qs1.0, ?m1.0, ?sub1.0, ?sgn1.0) (?qs2.0, ?m2.0, ?sub2.0, ?sgn2.0) = smash_systems ?p ?qs1.0 ?qs2.0 ?sub1.0 ?sub2.0 ?sgn1.0 ?sgn2.0 ?m1.0 ?m2.0
get_signs ?data = snd (snd ?data)
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)
smash_systems ?p ?qs1.0 ?qs2.0 ?subsets1.0 ?subsets2.0 ?signs1.0 ?signs2.0 ?mat1.0 ?mat2.0 = (?qs1.0 @ ?qs2.0, kronecker_product ?mat1.0 ?mat2.0, subsets_smash (length ?qs1.0) ?subsets1.0 ?subsets2.0, signs_smash ?signs1.0 ?signs2.0)
snd (?x1.0, ?x2.0) = ?x2.0

goal (1 subgoal):
 1. distinct (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
have h4: "satisfy_equation p (qs1 @ qs2) ?subsets ?signs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfy_equation p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using assms inductive_step[of p qs1 qs2 signs1 signs2 subsets1 subsets2]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
0 < length qs1
\<forall>q. List.member qs1 q \<longrightarrow> coprime p q
0 < length qs2
\<forall>q. List.member qs2 q \<longrightarrow> coprime p q
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2
\<lbrakk>p \<noteq> 0; 0 < length qs1; 0 < length qs2; \<forall>q. List.member qs1 q \<longrightarrow> coprime p q; \<forall>q. List.member qs2 q \<longrightarrow> coprime p q; well_def_signs (length qs1) signs1; well_def_signs (length qs2) signs2; distinct signs1; distinct signs2; set (characterize_consistent_signs_at_roots_copr p qs1) \<subseteq> set signs1; set (characterize_consistent_signs_at_roots_copr p qs2) \<subseteq> set signs2; all_list_constr subsets1 (length qs1); all_list_constr subsets2 (length qs2); invertible_mat (M_mat signs1 subsets1); invertible_mat (M_mat signs2 subsets2)\<rbrakk> \<Longrightarrow> satisfy_equation p (qs1 @ qs2) (subsets_smash (length qs1) subsets1 subsets2) (signs_smash signs1 signs2) \<and> invertible_mat (M_mat (signs_smash signs1 signs2) (subsets_smash (length qs1) subsets1 subsets2))

goal (1 subgoal):
 1. satisfy_equation p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using get_signs_def get_subsets_def satisfies_properties_def smash_systems_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
0 < length qs1
\<forall>q. List.member qs1 q \<longrightarrow> coprime p q
0 < length qs2
\<forall>q. List.member qs2 q \<longrightarrow> coprime p q
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2
\<lbrakk>p \<noteq> 0; 0 < length qs1; 0 < length qs2; \<forall>q. List.member qs1 q \<longrightarrow> coprime p q; \<forall>q. List.member qs2 q \<longrightarrow> coprime p q; well_def_signs (length qs1) signs1; well_def_signs (length qs2) signs2; distinct signs1; distinct signs2; set (characterize_consistent_signs_at_roots_copr p qs1) \<subseteq> set signs1; set (characterize_consistent_signs_at_roots_copr p qs2) \<subseteq> set signs2; all_list_constr subsets1 (length qs1); all_list_constr subsets2 (length qs2); invertible_mat (M_mat signs1 subsets1); invertible_mat (M_mat signs2 subsets2)\<rbrakk> \<Longrightarrow> satisfy_equation p (qs1 @ qs2) (subsets_smash (length qs1) subsets1 subsets2) (signs_smash signs1 signs2) \<and> invertible_mat (M_mat (signs_smash signs1 signs2) (subsets_smash (length qs1) subsets1 subsets2))
get_signs ?data = snd (snd ?data)
get_subsets ?data = fst (snd ?data)
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)
smash_systems ?p ?qs1.0 ?qs2.0 ?subsets1.0 ?subsets2.0 ?signs1.0 ?signs2.0 ?mat1.0 ?mat2.0 = (?qs1.0 @ ?qs2.0, kronecker_product ?mat1.0 ?mat2.0, subsets_smash (length ?qs1.0) ?subsets1.0 ?subsets2.0, signs_smash ?signs1.0 ?signs2.0)

goal (1 subgoal):
 1. satisfy_equation p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
satisfy_equation p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
have h5: " invertible_mat ?matrix"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using assms inductive_step[of p qs1 qs2 signs1 signs2 subsets1 subsets2]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
0 < length qs1
\<forall>q. List.member qs1 q \<longrightarrow> coprime p q
0 < length qs2
\<forall>q. List.member qs2 q \<longrightarrow> coprime p q
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2
\<lbrakk>p \<noteq> 0; 0 < length qs1; 0 < length qs2; \<forall>q. List.member qs1 q \<longrightarrow> coprime p q; \<forall>q. List.member qs2 q \<longrightarrow> coprime p q; well_def_signs (length qs1) signs1; well_def_signs (length qs2) signs2; distinct signs1; distinct signs2; set (characterize_consistent_signs_at_roots_copr p qs1) \<subseteq> set signs1; set (characterize_consistent_signs_at_roots_copr p qs2) \<subseteq> set signs2; all_list_constr subsets1 (length qs1); all_list_constr subsets2 (length qs2); invertible_mat (M_mat signs1 subsets1); invertible_mat (M_mat signs2 subsets2)\<rbrakk> \<Longrightarrow> satisfy_equation p (qs1 @ qs2) (subsets_smash (length qs1) subsets1 subsets2) (signs_smash signs1 signs2) \<and> invertible_mat (M_mat (signs_smash signs1 signs2) (subsets_smash (length qs1) subsets1 subsets2))

goal (1 subgoal):
 1. invertible_mat (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
by (metis combining_to_smash fst_conv get_matrix_def kronecker_invertible satisfies_properties_def smash_systems_def snd_conv)
[PROOF STATE]
proof (state)
this:
invertible_mat (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
have h6: "?matrix = matrix_A ?signs ?subsets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))) = M_mat (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
unfolding get_matrix_def combine_systems.simps smash_systems_def get_signs_def get_subsets_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (snd (qs1 @ qs2, kronecker_product matrix1 matrix2, subsets_smash (length qs1) subsets1 subsets2, signs_smash signs1 signs2)) = M_mat (snd (snd (snd (qs1 @ qs2, kronecker_product matrix1 matrix2, subsets_smash (length qs1) subsets1 subsets2, signs_smash signs1 signs2)))) (fst (snd (snd (qs1 @ qs2, kronecker_product matrix1 matrix2, subsets_smash (length qs1) subsets1 subsets2, signs_smash signs1 signs2))))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kronecker_product matrix1 matrix2 = M_mat (signs_smash signs1 signs2) (subsets_smash (length qs1) subsets1 subsets2)
[PROOF STEP]
apply (subst matrix_construction_is_kronecker_product[of subsets1 _ signs1 signs2 subsets2])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>l i. \<lbrakk>l \<in> set subsets1; i \<in> set l\<rbrakk> \<Longrightarrow> i < length qs1
 2. \<And>j. j \<in> set signs1 \<Longrightarrow> length j = length qs1
 3. kronecker_product matrix1 matrix2 = kronecker_product (M_mat signs1 subsets1) (M_mat signs2 subsets2)
[PROOF STEP]
apply (metis Ball_set all_list_constr_def in_set_member list_constr_def satisfies_properties_def satisfies_properties_sys1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. j \<in> set signs1 \<Longrightarrow> length j = length qs1
 2. kronecker_product matrix1 matrix2 = kronecker_product (M_mat signs1 subsets1) (M_mat signs2 subsets2)
[PROOF STEP]
using satisfies_properties_def satisfies_properties_sys1 well_def_signs_def
[PROOF STATE]
proof (prove)
using this:
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)
satisfies_properties p qs1 subsets1 signs1 matrix1
well_def_signs ?num_polys ?sign_conds \<equiv> \<forall>signs\<in>set ?sign_conds. length signs = ?num_polys

goal (2 subgoals):
 1. \<And>j. j \<in> set signs1 \<Longrightarrow> length j = length qs1
 2. kronecker_product matrix1 matrix2 = kronecker_product (M_mat signs1 subsets1) (M_mat signs2 subsets2)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kronecker_product matrix1 matrix2 = kronecker_product (M_mat signs1 subsets1) (M_mat signs2 subsets2)
[PROOF STEP]
using satisfies_properties_def satisfies_properties_sys1 satisfies_properties_sys2
[PROOF STATE]
proof (prove)
using this:
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2

goal (1 subgoal):
 1. kronecker_product matrix1 matrix2 = kronecker_product (M_mat signs1 subsets1) (M_mat signs2 subsets2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))) = M_mat (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
have h7: "set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2))
    \<subseteq> set (?signs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using subset_step[of p qs1 signs1 qs2  signs2] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set (characterize_consistent_signs_at_roots_copr p qs1) \<subseteq> set signs1; set (characterize_consistent_signs_at_roots_copr p qs2) \<subseteq> set signs2\<rbrakk> \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (signs_smash signs1 signs2)
p \<noteq> 0
0 < length qs1
\<forall>q. List.member qs1 q \<longrightarrow> coprime p q
0 < length qs2
\<forall>q. List.member qs2 q \<longrightarrow> coprime p q
satisfies_properties p qs1 subsets1 signs1 matrix1
satisfies_properties p qs2 subsets2 signs2 matrix2

goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
by (simp add: nonzero get_signs_def satisfies_properties_def smash_systems_def)
[PROOF STATE]
proof (state)
this:
set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
unfolding satisfies_properties_def
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. all_list_constr (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (length (qs1 @ qs2)) \<and> well_def_signs (length (qs1 @ qs2)) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> distinct (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> satisfy_equation p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> invertible_mat (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))) = M_mat (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
using h1 h2 h3 h4 h5 h6 h7
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
all_list_constr (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (length (qs1 @ qs2))
well_def_signs (length (qs1 @ qs2)) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
distinct (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
satisfy_equation p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
invertible_mat (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))) = M_mat (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal (1 subgoal):
 1. all_list_constr (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (length (qs1 @ qs2)) \<and> well_def_signs (length (qs1 @ qs2)) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> distinct (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> satisfy_equation p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> invertible_mat (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))) = M_mat (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) \<and> set (characterize_consistent_signs_at_roots_copr p (qs1 @ qs2)) \<subseteq> set (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
satisfies_properties p (qs1 @ qs2) (get_subsets (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_signs (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2)))) (get_matrix (snd (combine_systems p (qs1, matrix1, subsets1, signs1) (qs2, matrix2, subsets2, signs2))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_name_code[code]:
  "Name xs < Name [] \<longleftrightarrow> False"
  "Name [] < Name (x # xs) \<longleftrightarrow> True"
  "Name (x # xs) < Name (y # ys) \<longleftrightarrow> (of_char x::nat) < of_char y \<or> x = y \<and> Name xs < Name ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Name xs < Name []) = False &&& (Name [] < Name (x # xs)) = True &&& (Name (x # xs) < Name (y # ys)) = (of_char x < of_char y \<or> x = y \<and> Name xs < Name ys)
[PROOF STEP]
unfolding less_name_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((as_string (Name xs), as_string (Name [])) \<in> lexord {(u, v). of_char u < of_char v}) = False &&& ((as_string (Name []), as_string (Name (x # xs))) \<in> lexord {(u, v). of_char u < of_char v}) = True &&& ((as_string (Name (x # xs)), as_string (Name (y # ys))) \<in> lexord {(u, v). of_char u < of_char v}) = (of_char x < of_char y \<or> x = y \<and> (as_string (Name xs), as_string (Name ys)) \<in> lexord {(u, v). of_char u < of_char v})
[PROOF STEP]
by auto


[STATEMENT]
lemma homeomorphic_UNIV_UNIV:
  shows "(UNIV::'a set) homeomorphic (UNIV::'b set) \<longleftrightarrow>
    DIM('a::euclidean_space) = DIM('b::euclidean_space)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV homeomorphic UNIV = (DIM('a) = DIM('b))
[PROOF STEP]
by (simp add: homeomorphic_subspaces_eq)


[STATEMENT]
lemma interior_union_closed_intervals:
  fixes a :: "'a::ordered_euclidean_space"
  assumes "b < c"
  shows "interior ({a..b} \<union> {c..d}) = interior {a..b} \<union> interior {c..d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior ({a..b} \<union> {c..d}) = interior {a..b} \<union> interior {c..d}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
b < c

goal (1 subgoal):
 1. interior ({a..b} \<union> {c..d}) = interior {a..b} \<union> interior {c..d}
[PROOF STEP]
by (subst interior_union_boundary; auto simp: boundary_def)


[STATEMENT]
lemma IVT_simple:
  "\<lbrakk>f (a::real) \<le> (y::real); y \<le> f b; a \<le> b;
    \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x\<rbrakk>
   \<Longrightarrow> \<exists>x. f x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f a \<le> y; y \<le> f b; a \<le> b; \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> \<exists>x. f x = y
[PROOF STEP]
by (frule IVT [of f]) auto


[STATEMENT]
lemma ceiling_add_of_int [simp]: "\<lceil>x + of_int z\<rceil> = \<lceil>x\<rceil> + z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>x + of_int z\<rceil> = \<lceil>x\<rceil> + z
[PROOF STEP]
using ceiling_correct [of x]
[PROOF STATE]
proof (prove)
using this:
of_int \<lceil>x\<rceil> - (1::'a) < x \<and> x \<le> of_int \<lceil>x\<rceil>

goal (1 subgoal):
 1. \<lceil>x + of_int z\<rceil> = \<lceil>x\<rceil> + z
[PROOF STEP]
by (simp add: ceiling_def)


[STATEMENT]
lemma matchrel_rtrancl_mono:
  assumes "(x, y) \<in> matchrel\<^sup>*"
  shows "((fst x + M, snd x), (fst y + M, snd y)) \<in> matchrel\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((fst x + M, snd x), fst y + M, snd y) \<in> matchrel\<^sup>*
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> matchrel\<^sup>*

goal (1 subgoal):
 1. ((fst x + M, snd x), fst y + M, snd y) \<in> matchrel\<^sup>*
[PROOF STEP]
by (induct) (auto dest:  matchrel_mono [of _ _ M])


[STATEMENT]
lemma agg_sum_distrib_2:
  fixes f g :: "('a,'b::aggregation_order) square"
  shows "(\<Sum>\<^sub>k \<Sum>\<^sub>l f (k,l) + g (k,l)) = (\<Sum>\<^sub>k \<Sum>\<^sub>l f (k,l)) + (\<Sum>\<^sub>k \<Sum>\<^sub>l g (k,l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
have "(\<Sum>\<^sub>k \<Sum>\<^sub>l f (k,l) + g (k,l)) = (\<Sum>\<^sub>k (\<Sum>\<^sub>l f (k,l)) + (\<Sum>\<^sub>l g (k,l)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True} + aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
by (metis (no_types) aggregation.sum_0.distrib)
[PROOF STATE]
proof (state)
this:
aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True} + aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}

goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True} + aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}

goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
have "... = (\<Sum>\<^sub>k \<Sum>\<^sub>l f (k,l)) + (\<Sum>\<^sub>k \<Sum>\<^sub>l g (k,l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True} + aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
by (metis (no_types) aggregation.sum_0.distrib)
[PROOF STATE]
proof (state)
this:
aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True} + aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}

goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}

goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l) + g (k, l)) {l. True}) {k. True} = aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} + aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. g (k, l)) {l. True}) {k. True}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_fieldI:
  assumes "field R"
  assumes "finite (carrier R)"
  shows "finite_field R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_field R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
field R
finite (carrier R)

goal (1 subgoal):
 1. finite_field R
[PROOF STEP]
unfolding finite_field_def finite_field_axioms_def
[PROOF STATE]
proof (prove)
using this:
field R
finite (carrier R)

goal (1 subgoal):
 1. field R \<and> finite (carrier R)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in ring) unique_dimension:
  assumes "subfield K R" and "finite_dimension K E" shows "\<exists>!n. dimension n K E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!n. dimension n K E
[PROOF STEP]
using assms(2) dimension_is_inj[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
finite_dimension K E
\<lbrakk>dimension ?n K ?E; dimension ?m K ?E\<rbrakk> \<Longrightarrow> ?n = ?m

goal (1 subgoal):
 1. \<exists>!n. dimension n K E
[PROOF STEP]
unfolding finite_dimension_def
[PROOF STATE]
proof (prove)
using this:
\<exists>n. dimension n K E
\<lbrakk>dimension ?n K ?E; dimension ?m K ?E\<rbrakk> \<Longrightarrow> ?n = ?m

goal (1 subgoal):
 1. \<exists>!n. dimension n K E
[PROOF STEP]
by auto


[STATEMENT]
theorem in_list_induct [case_names Nil Cons]:
  assumes  "P []"
  assumes "(\<And>x. x\<in>set(xs) \<Longrightarrow> ( \<And>xs. P xs \<Longrightarrow> P (x # xs)))"
  shows "P xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P xs
[PROOF STEP]
using in_list_induct_helper[of xs "set(xs)" P]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set xs \<subseteq> set xs; P []; \<And>x xsa. \<lbrakk>x \<in> set xs; P xsa\<rbrakk> \<Longrightarrow> P (x # xsa)\<rbrakk> \<Longrightarrow> P xs

goal (1 subgoal):
 1. P xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set xs \<subseteq> set xs; P []; \<And>x xsa. \<lbrakk>x \<in> set xs; P xsa\<rbrakk> \<Longrightarrow> P (x # xsa)\<rbrakk> \<Longrightarrow> P xs
P []
\<lbrakk>?x \<in> set xs; P ?xs\<rbrakk> \<Longrightarrow> P (?x # ?xs)

goal (1 subgoal):
 1. P xs
[PROOF STEP]
by auto


[STATEMENT]
lemma MeetI [intro?]:
  "(\<And>a. a \<in> A \<Longrightarrow> inf \<sqsubseteq> a) \<Longrightarrow>
    (\<And>b. \<forall>a \<in> A. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> inf) \<Longrightarrow>
    \<Sqinter>A = inf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a. a \<in> A \<Longrightarrow> inf \<sqsubseteq> a; \<And>b. \<forall>a\<in>A. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> inf\<rbrakk> \<Longrightarrow> \<Sqinter>A = inf
[PROOF STEP]
by (rule Meet_equality, rule is_InfI) blast+


[STATEMENT]
lemma fps_neg_0 [simp]: "-(0::'a::group_add fps) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 0 = 0
[PROOF STEP]
by (rule iffD2, rule fps_eq_iff, auto)