[STATEMENT]
lemma pderiv_coeff:
  assumes "subring K R"
  assumes "f \<in> carrier (K[X])"
  shows "coeff (pderiv f) k = int_embed R (Suc k) \<otimes> coeff f (Suc k)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
proof (cases "k + 1  < length f")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k + 1 < length f

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
define j where "j = length f - k - 2"
[PROOF STATE]
proof (state)
this:
j = length f - k - 2

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
define d where
    "d = map (\<lambda>i. int_embed R i \<otimes> coeff f i) (rev [1..<length f])"
[PROOF STATE]
proof (state)
this:
d = map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f])

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have a: "j+1 < length f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + 1 < length f
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
k + 1 < length f

goal (1 subgoal):
 1. j + 1 < length f
[PROOF STEP]
unfolding j_def
[PROOF STATE]
proof (prove)
using this:
k + 1 < length f

goal (1 subgoal):
 1. length f - k - 2 + 1 < length f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j + 1 < length f

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
hence b: "j < length [1..<length f]"
[PROOF STATE]
proof (prove)
using this:
j + 1 < length f

goal (1 subgoal):
 1. j < length [1..<length f]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j < length [1..<length f]

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have c: "k < length d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < length d
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < length (map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f]))
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
k + 1 < length f

goal (1 subgoal):
 1. k < length (map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k < length d

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have d: "degree d - k = j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree d - k = j
[PROOF STEP]
unfolding d_def j_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f])) - k = length f - k - 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree d - k = j

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have e: "rev [Suc 0..<length f] ! j = length f - 1 - j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev [Suc 0..<length f] ! j = degree f - j
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
j < length [1..<length f]

goal (1 subgoal):
 1. rev [Suc 0..<length f] ! j = degree f - j
[PROOF STEP]
by (subst rev_nth, auto)
[PROOF STATE]
proof (state)
this:
rev [Suc 0..<length f] ! j = degree f - j

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have f: "length f - j - 1 = k+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length f - j - 1 = k + 1
[PROOF STEP]
unfolding j_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length f - (length f - k - 2) - 1 = k + 1
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
k + 1 < length f

goal (1 subgoal):
 1. length f - (length f - k - 2) - 1 = k + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length f - j - 1 = k + 1

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have "coeff (pderiv f ) k = coeff (normalize d) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (pderiv f) k = local.coeff (local.normalize d) k
[PROOF STEP]
unfolding pderiv_def d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (local.normalize (map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f]))) k = local.coeff (local.normalize (map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f]))) k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.coeff (pderiv f) k = local.coeff (local.normalize d) k

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.coeff (pderiv f) k = local.coeff (local.normalize d) k

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have "... = coeff d k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (local.normalize d) k = local.coeff d k
[PROOF STEP]
using normalize_coeff
[PROOF STATE]
proof (prove)
using this:
local.coeff ?p = local.coeff (local.normalize ?p)

goal (1 subgoal):
 1. local.coeff (local.normalize d) k = local.coeff d k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.coeff (local.normalize d) k = local.coeff d k

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.coeff (local.normalize d) k = local.coeff d k

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have "... = d ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff d k = d ! j
[PROOF STEP]
using c d
[PROOF STATE]
proof (prove)
using this:
k < length d
degree d - k = j

goal (1 subgoal):
 1. local.coeff d k = d ! j
[PROOF STEP]
by (subst coeff_nth, auto)
[PROOF STATE]
proof (state)
this:
local.coeff d k = d ! j

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.coeff d k = d ! j

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have
    "... = int_embed R (length f - j - 1) \<otimes> coeff f (length f - j - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d ! j = int_embed R (int (length f - j - 1)) \<otimes> local.coeff f (length f - j - 1)
[PROOF STEP]
using b e
[PROOF STATE]
proof (prove)
using this:
j < length [1..<length f]
rev [Suc 0..<length f] ! j = degree f - j

goal (1 subgoal):
 1. d ! j = int_embed R (int (length f - j - 1)) \<otimes> local.coeff f (length f - j - 1)
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
using this:
j < length [1..<length f]
rev [Suc 0..<length f] ! j = degree f - j

goal (1 subgoal):
 1. map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f]) ! j = int_embed R (int (length f - j - 1)) \<otimes> local.coeff f (length f - j - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
d ! j = int_embed R (int (length f - j - 1)) \<otimes> local.coeff f (length f - j - 1)

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d ! j = int_embed R (int (length f - j - 1)) \<otimes> local.coeff f (length f - j - 1)

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have "... = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int_embed R (int (length f - j - 1)) \<otimes> local.coeff f (length f - j - 1) = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
length f - j - 1 = k + 1

goal (1 subgoal):
 1. int_embed R (int (length f - j - 1)) \<otimes> local.coeff f (length f - j - 1) = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int_embed R (int (length f - j - 1)) \<otimes> local.coeff f (length f - j - 1) = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)

goal (2 subgoals):
 1. k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
 2. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)

goal (1 subgoal):
 1. local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)

goal (1 subgoal):
 1. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> k + 1 < length f

goal (1 subgoal):
 1. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
hence "Suc k \<ge> length f"
[PROOF STATE]
proof (prove)
using this:
\<not> k + 1 < length f

goal (1 subgoal):
 1. length f \<le> Suc k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length f \<le> Suc k

goal (1 subgoal):
 1. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
hence a:"coeff f (Suc k) = \<zero>"
[PROOF STATE]
proof (prove)
using this:
length f \<le> Suc k

goal (1 subgoal):
 1. local.coeff f (Suc k) = \<zero>
[PROOF STEP]
using coeff_img
[PROOF STATE]
proof (prove)
using this:
length f \<le> Suc k
local.coeff ?p ` {..<length ?p} = set ?p
local.coeff ?p ` {length ?p..} = {\<zero>}
range (local.coeff ?p) = set ?p \<union> {\<zero>}

goal (1 subgoal):
 1. local.coeff f (Suc k) = \<zero>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
local.coeff f (Suc k) = \<zero>

goal (1 subgoal):
 1. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
have b:"coeff (pderiv f) k = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (pderiv f) k = \<zero>
[PROOF STEP]
unfolding pderiv_def normalize_coeff[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f])) k = \<zero>
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> k + 1 < length f

goal (1 subgoal):
 1. local.coeff (map (\<lambda>i. int_embed R (int i) \<otimes> local.coeff f i) (rev [1..<length f])) k = \<zero>
[PROOF STEP]
by (intro coeff_length, simp)
[PROOF STATE]
proof (state)
this:
local.coeff (pderiv f) k = \<zero>

goal (1 subgoal):
 1. \<not> k + 1 < length f \<Longrightarrow> local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
using int_embed_range[OF carrier_is_subring]
[PROOF STATE]
proof (prove)
using this:
int_embed R ?k \<in> carrier R

goal (1 subgoal):
 1. local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)
[PROOF STEP]
by (simp add:a b)
[PROOF STATE]
proof (state)
this:
local.coeff (pderiv f) k = int_embed R (int (Suc k)) \<otimes> local.coeff f (Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem geq_noPH_confIDs:
assumes a: "reach s"
shows "phase s confID > noPH \<longrightarrow> confID \<in>\<in> confIDs s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. noPH < phase s confID \<longrightarrow> confID \<in>\<in> confIDs s
[PROOF STEP]
using geq_noPH_confIDs1[OF a]
[PROOF STATE]
proof (prove)
using this:
geq_noPH_confIDs s

goal (1 subgoal):
 1. noPH < phase s confID \<longrightarrow> confID \<in>\<in> confIDs s
[PROOF STEP]
unfolding geq_noPH_confIDs_def
[PROOF STATE]
proof (prove)
using this:
\<forall>confID. noPH < phase s confID \<longrightarrow> confID \<in>\<in> confIDs s

goal (1 subgoal):
 1. noPH < phase s confID \<longrightarrow> confID \<in>\<in> confIDs s
[PROOF STEP]
by auto


[STATEMENT]
lemma binop_G_comp_binop_\<ii>G: "g\<in>G \<Longrightarrow> x\<in>G \<Longrightarrow> binop g (binop (\<ii> g) x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> G; x \<in> G\<rbrakk> \<Longrightarrow> binop g (binop (\<ii> g) x) = x
[PROOF STEP]
using the_inverseD(1) assoc[of g "\<ii> g" x]
[PROOF STATE]
proof (prove)
using this:
?g \<in> G \<Longrightarrow> \<ii> ?g \<in> G
\<lbrakk>g \<in> G; \<ii> g \<in> G; x \<in> G\<rbrakk> \<Longrightarrow> binop (binop g (\<ii> g)) x = binop g (binop (\<ii> g) x)

goal (1 subgoal):
 1. \<lbrakk>g \<in> G; x \<in> G\<rbrakk> \<Longrightarrow> binop g (binop (\<ii> g) x) = x
[PROOF STEP]
by (simp add: identity(3) the_inverseD(2))


[STATEMENT]
lemma respect_label_fix_chamber_imp_fun_eq_on:
  assumes label  :  "label_wrt B \<phi>"
  and     chamber:  "chamber C" "f`C = g`C"
  and     respect:  "\<forall>v\<in>C. \<phi> (f v) = \<phi> v" "\<forall>v\<in>C. \<phi> (g v) = \<phi> v"
  shows   "fun_eq_on f g C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fun_eq_on f g C
[PROOF STEP]
proof (rule fun_eq_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> C \<Longrightarrow> f a = g a
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> C \<Longrightarrow> f a = g a
[PROOF STEP]
assume "v\<in>C"
[PROOF STATE]
proof (state)
this:
v \<in> C

goal (1 subgoal):
 1. \<And>a. a \<in> C \<Longrightarrow> f a = g a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
v \<in> C

goal (1 subgoal):
 1. \<And>a. a \<in> C \<Longrightarrow> f a = g a
[PROOF STEP]
with respect
[PROOF STATE]
proof (chain)
picking this:
\<forall>v\<in>C. \<phi> (f v) = \<phi> v
\<forall>v\<in>C. \<phi> (g v) = \<phi> v
v \<in> C
[PROOF STEP]
have "\<phi> (f v) = \<phi> (g v)"
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>C. \<phi> (f v) = \<phi> v
\<forall>v\<in>C. \<phi> (g v) = \<phi> v
v \<in> C

goal (1 subgoal):
 1. \<phi> (f v) = \<phi> (g v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> (f v) = \<phi> (g v)

goal (1 subgoal):
 1. \<And>a. a \<in> C \<Longrightarrow> f a = g a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
v \<in> C
\<phi> (f v) = \<phi> (g v)
[PROOF STEP]
show "f v = g v"
[PROOF STATE]
proof (prove)
using this:
v \<in> C
\<phi> (f v) = \<phi> (g v)

goal (1 subgoal):
 1. f v = g v
[PROOF STEP]
using label chamber chamber_map chamber_system_def label_wrtD[of B \<phi> "f`C"]
          bij_betw_imp_inj_on[of \<phi>] inj_onD
[PROOF STATE]
proof (prove)
using this:
v \<in> C
\<phi> (f v) = \<phi> (g v)
label_wrt B \<phi>
chamber C
f ` C = g ` C
chamber ?C \<Longrightarrow> chamber (f ` ?C)
\<C> \<equiv> Collect chamber
\<lbrakk>label_wrt B \<phi>; f ` C \<in> \<C>\<rbrakk> \<Longrightarrow> bij_betw \<phi> (f ` C) B
bij_betw \<phi> ?A ?B \<Longrightarrow> inj_on \<phi> ?A
\<lbrakk>inj_on ?f ?A; ?f ?x = ?f ?y; ?x \<in> ?A; ?y \<in> ?A\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. f v = g v
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
f v = g v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permute_with_flip_closed:
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>2::nat\<^esup>)"
  shows  "permute_list  flip x \<in> carrier (Q\<^sub>p\<^bsup>2::nat\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list flip x \<in> carrier (Q\<^sub>p\<^bsup>2\<^esup>)
[PROOF STEP]
apply(rule permute_list_closed)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<in> carrier (Q\<^sub>p\<^bsup>2\<^esup>)
 2. flip permutes {..<2}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (Q\<^sub>p\<^bsup>2\<^esup>)

goal (2 subgoals):
 1. x \<in> carrier (Q\<^sub>p\<^bsup>2\<^esup>)
 2. flip permutes {..<2}
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. flip permutes {..<2}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. flip permutes {..<2}
[PROOF STEP]
have "{0::nat, 1} = {..<2::nat}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0, 1} = {..<2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0, 1} = {..<2}

goal (1 subgoal):
 1. flip permutes {..<2}
[PROOF STEP]
thus "flip permutes {..<2}"
[PROOF STATE]
proof (prove)
using this:
{0, 1} = {..<2}

goal (1 subgoal):
 1. flip permutes {..<2}
[PROOF STEP]
using flip_permutes
[PROOF STATE]
proof (prove)
using this:
{0, 1} = {..<2}
flip permutes {0, 1}

goal (1 subgoal):
 1. flip permutes {..<2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
flip permutes {..<2}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma RG_zero_closed : "(0::('r::zero,'g) aezfun) \<in> group_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<in> group_ring
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<in> group_ring
[PROOF STEP]
have "aezfun (0::('r,'g) aezfun) = (0::'g\<Rightarrow>'r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun 0 = 0
[PROOF STEP]
using zero_aezfun.rep_eq
[PROOF STATE]
proof (prove)
using this:
aezfun 0 = 0

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

goal (1 subgoal):
 1. 0 \<in> group_ring
[PROOF STEP]
hence "supp (aezfun (0::('r,'g) aezfun)) = supp (0::'g\<Rightarrow>'r)"
[PROOF STATE]
proof (prove)
using this:
aezfun 0 = 0

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

goal (1 subgoal):
 1. 0 \<in> group_ring
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
supp (aezfun 0) = supp 0

goal (1 subgoal):
 1. 0 \<in> group_ring
[PROOF STEP]
have "supp (0::'g\<Rightarrow>'r) \<subseteq> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp 0 \<subseteq> G
[PROOF STEP]
using supp_zerofun_subset_any
[PROOF STATE]
proof (prove)
using this:
supp 0 \<subseteq> ?A

goal (1 subgoal):
 1. supp 0 \<subseteq> G
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
supp 0 \<subseteq> G

goal (1 subgoal):
 1. 0 \<in> group_ring
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
supp (aezfun 0) = supp 0
supp 0 \<subseteq> G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
supp (aezfun 0) = supp 0
supp 0 \<subseteq> G

goal (1 subgoal):
 1. 0 \<in> group_ring
[PROOF STEP]
using group_ringD
[PROOF STATE]
proof (prove)
using this:
supp (aezfun 0) = supp 0
supp 0 \<subseteq> G
group_ring = {x. supp (aezfun x) \<subseteq> G}

goal (1 subgoal):
 1. 0 \<in> group_ring
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
0 \<in> group_ring

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reflexive_conv_closed:
  "reflexive x \<Longrightarrow> reflexive (x\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflexive x \<Longrightarrow> reflexive (x\<^sup>T)
[PROOF STEP]
using conv_isotone
[PROOF STATE]
proof (prove)
using this:
?x \<le> ?y \<Longrightarrow> ?x\<^sup>T \<le> ?y\<^sup>T

goal (1 subgoal):
 1. reflexive x \<Longrightarrow> reflexive (x\<^sup>T)
[PROOF STEP]
by force


[STATEMENT]
lemma lnth_lmap_ldropn:
  "enat n < llength xs \<Longrightarrow> lnth (lmap f (ldropn n xs)) 0 = lnth (lmap f xs) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enat n < llength xs \<Longrightarrow> lnth (lmap f (ldropn n xs)) 0 = lnth (lmap f xs) n
[PROOF STEP]
by (simp add: lhd_ldropn lnth_0_conv_lhd)


[STATEMENT]
lemma AllowedActs_totalize [simp]: "AllowedActs (totalize F) = AllowedActs F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AllowedActs (totalize F) = AllowedActs F
[PROOF STEP]
by (simp add: totalize_def)


[STATEMENT]
lemma [partial_function_mono]:
  assumes F: "mono_llist F" and G: "mono_llist G"
  shows "mono_llist (\<lambda>f. lmerge (F f) (G f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone llist.le_fun lprefix (\<lambda>f. lmerge (F f) (G f))
[PROOF STEP]
by(blast intro: monotoneI lprefix_lmergeI monotoneD[OF F] monotoneD[OF G])


[STATEMENT]
lemma fps_compose_uminus: "- (a::'a::ring_1 fps) oo c = - (a oo c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a oo c = - (a oo c)
[PROOF STEP]
by (simp add: fps_eq_iff fps_compose_nth field_simps sum_negf[symmetric])


[STATEMENT]
lemma geodesic_segment_between_x_x [simp]:
  "geodesic_segment_between {x} x x"
  "geodesic_segment {x}"
  "geodesic_segment_between G x x \<longleftrightarrow> G = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between {x} x x &&& geodesic_segment {x} &&& geodesic_segment_between G x x = (G = {x})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. geodesic_segment_between {x} x x
 2. geodesic_segment {x}
 3. geodesic_segment_between G x x = (G = {x})
[PROOF STEP]
show *: "geodesic_segment_between {x} x x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between {x} x x
[PROOF STEP]
unfolding geodesic_segment_between_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. g 0 = x \<and> g (dist x x) = x \<and> isometry_on {0..dist x x} g \<and> {x} = g ` {0..dist x x}
[PROOF STEP]
apply (rule exI[of _ "\<lambda>_. x"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = x \<and> x = x \<and> isometry_on {0..dist x x} (\<lambda>_. x) \<and> {x} = (\<lambda>_. x) ` {0..dist x x}
[PROOF STEP]
unfolding isometry_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = x \<and> x = x \<and> (\<forall>xa\<in>{0..dist x x}. \<forall>y\<in>{0..dist x x}. dist x x = dist xa y) \<and> {x} = (\<lambda>_. x) ` {0..dist x x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
geodesic_segment_between {x} x x

goal (2 subgoals):
 1. geodesic_segment {x}
 2. geodesic_segment_between G x x = (G = {x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
geodesic_segment_between {x} x x
[PROOF STEP]
show "geodesic_segment {x}"
[PROOF STATE]
proof (prove)
using this:
geodesic_segment_between {x} x x

goal (1 subgoal):
 1. geodesic_segment {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
geodesic_segment {x}

goal (1 subgoal):
 1. geodesic_segment_between G x x = (G = {x})
[PROOF STEP]
show "geodesic_segment_between G x x \<longleftrightarrow> G = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between G x x = (G = {x})
[PROOF STEP]
using geodesic_segment_dist_le geodesic_segment_endpoints(2) *
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>geodesic_segment_between ?G ?x ?y; ?a \<in> ?G; ?b \<in> ?G\<rbrakk> \<Longrightarrow> dist ?a ?b \<le> dist ?x ?y
geodesic_segment_between ?G ?x ?y \<Longrightarrow> ?y \<in> ?G
geodesic_segment_between {x} x x

goal (1 subgoal):
 1. geodesic_segment_between G x x = (G = {x})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
geodesic_segment_between G x x = (G = {x})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_nominals_set: \<open>finite S \<Longrightarrow> finite (\<Union>block \<in> S. block_nominals block)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> finite (\<Union> (block_nominals ` S))
[PROOF STEP]
by (induct S rule: finite_induct) (simp_all add: finite_block_nominals)


[STATEMENT]
lemma trace_at_shift: "trace_at s (smap (\<lambda>(t, s'). (t + t', s')) \<omega>) t = trace_at s \<omega> (t - t')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace_at s (smap (\<lambda>(t, s'). (t + t', s')) \<omega>) t = trace_at s \<omega> (t - t')
[PROOF STEP]
by (induction arbitrary: s \<omega> rule: trace_at.fixp_induct) (auto split: stream.split)


[STATEMENT]
lemma elementOnCurrentLevel:
  assumes "a \<notin> set (elements M)"
  shows "elementLevel a (M @ [(a, d)]) = currentLevel  (M @ [(a, d)])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elementLevel a (M @ [(a, d)]) = currentLevel (M @ [(a, d)])
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<notin> set (elements M)

goal (1 subgoal):
 1. elementLevel a (M @ [(a, d)]) = currentLevel (M @ [(a, d)])
[PROOF STEP]
unfolding currentLevel_def
[PROOF STATE]
proof (prove)
using this:
a \<notin> set (elements M)

goal (1 subgoal):
 1. elementLevel a (M @ [(a, d)]) = length (markedElements (M @ [(a, d)]))
[PROOF STEP]
unfolding elementLevel_def
[PROOF STATE]
proof (prove)
using this:
a \<notin> set (elements M)

goal (1 subgoal):
 1. length (markedElementsTo a (M @ [(a, d)])) = length (markedElements (M @ [(a, d)]))
[PROOF STEP]
unfolding markedElementsTo_def
[PROOF STATE]
proof (prove)
using this:
a \<notin> set (elements M)

goal (1 subgoal):
 1. length (markedElements (prefixToElement a (M @ [(a, d)]))) = length (markedElements (M @ [(a, d)]))
[PROOF STEP]
by (auto simp add: prefixToElementAppend)


[STATEMENT]
lemma pochhammer_neq_0_mono:
  "pochhammer a m \<noteq> (0::'a::field_char_0) \<Longrightarrow> m \<ge> n \<Longrightarrow> pochhammer a n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pochhammer a m \<noteq> (0::'a); n \<le> m\<rbrakk> \<Longrightarrow> pochhammer a n \<noteq> (0::'a)
[PROOF STEP]
unfolding pochhammer_eq_0_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> (\<exists>k<m. a = - of_nat k); n \<le> m\<rbrakk> \<Longrightarrow> \<not> (\<exists>k<n. a = - of_nat k)
[PROOF STEP]
by auto


[STATEMENT]
lemma lossless_sample_uniform_units:
  assumes "q > 1"
  shows "lossless_spmf (sample_uniform_units q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lossless_spmf (sample_uniform_units q)
[PROOF STEP]
apply(simp add: sample_uniform_units_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> {..<q} \<subseteq> {0}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < q

goal (1 subgoal):
 1. \<not> {..<q} \<subseteq> {0}
[PROOF STEP]
by auto


[STATEMENT]
lemma kSup_distl: "f \<circ>\<^sub>K (\<Squnion>G) = (\<Squnion>g \<in> G. f \<circ>\<^sub>K g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G
[PROOF STEP]
have "f \<circ>\<^sub>K (\<Squnion>G) = ((klift \<circ> Sup) G) \<circ> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = (bd\<^sub>\<F> \<circ> Sup) G \<circ> f
[PROOF STEP]
by (simp add: kcomp_klift)
[PROOF STATE]
proof (state)
this:
f \<circ>\<^sub>K \<Squnion> G = (bd\<^sub>\<F> \<circ> Sup) G \<circ> f

goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f \<circ>\<^sub>K \<Squnion> G = (bd\<^sub>\<F> \<circ> Sup) G \<circ> f

goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G
[PROOF STEP]
have "... = (\<Squnion>g \<in> G. (klift g)) \<circ> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bd\<^sub>\<F> \<circ> Sup) G \<circ> f = \<Squnion> \<P> bd\<^sub>\<F> G \<circ> f
[PROOF STEP]
by (simp add: fbd_Sup_pres fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(bd\<^sub>\<F> \<circ> Sup) G \<circ> f = \<Squnion> \<P> bd\<^sub>\<F> G \<circ> f

goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(bd\<^sub>\<F> \<circ> Sup) G \<circ> f = \<Squnion> \<P> bd\<^sub>\<F> G \<circ> f

goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G
[PROOF STEP]
have "... = (\<Squnion>g \<in> G. (klift g) \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> \<P> bd\<^sub>\<F> G \<circ> f = (\<Squnion>g\<in>G. bd\<^sub>\<F> g \<circ> f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Squnion> \<P> bd\<^sub>\<F> G \<circ> f = (\<Squnion>g\<in>G. bd\<^sub>\<F> g \<circ> f)

goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f \<circ>\<^sub>K \<Squnion> G = (\<Squnion>g\<in>G. bd\<^sub>\<F> g \<circ> f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<circ>\<^sub>K \<Squnion> G = (\<Squnion>g\<in>G. bd\<^sub>\<F> g \<circ> f)

goal (1 subgoal):
 1. f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G
[PROOF STEP]
by (simp add: kcomp_klift)
[PROOF STATE]
proof (state)
this:
f \<circ>\<^sub>K \<Squnion> G = \<Squnion> \<P> ((\<circ>\<^sub>K) f) G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma find_remove_subset:
  "find_remove P xs = (res, xs') \<Longrightarrow> set xs' \<subseteq> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. find_remove P xs = (res, xs') \<Longrightarrow> set xs' \<subseteq> set xs
[PROOF STEP]
unfolding find_remove_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case find P xs of None \<Rightarrow> (None, xs) | Some x \<Rightarrow> (Some x, remove1 x xs)) = (res, xs') \<Longrightarrow> set xs' \<subseteq> set xs
[PROOF STEP]
using set_remove1_subset
[PROOF STATE]
proof (prove)
using this:
set (remove1 ?x ?xs) \<subseteq> set ?xs

goal (1 subgoal):
 1. (case find P xs of None \<Rightarrow> (None, xs) | Some x \<Rightarrow> (Some x, remove1 x xs)) = (res, xs') \<Longrightarrow> set xs' \<subseteq> set xs
[PROOF STEP]
by (force split: option.splits)


[STATEMENT]
lemma of_char_of [simp]:
  \<open>of_char (char_of a) = a mod 256\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_char (char_of a) = a mod (256::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_char (char_of a) = a mod (256::'a)
[PROOF STEP]
have \<open>[0..<8] = [0, Suc 0, 2, 3, 4, 5, 6, 7 :: nat]\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<8] = [0, Suc 0, 2, 3, 4, 5, 6, 7]
[PROOF STEP]
by (simp add: upt_eq_Cons_conv)
[PROOF STATE]
proof (state)
this:
[0..<8] = [0, Suc 0, 2, 3, 4, 5, 6, 7]

goal (1 subgoal):
 1. of_char (char_of a) = a mod (256::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[0..<8] = [0, Suc 0, 2, 3, 4, 5, 6, 7]
[PROOF STEP]
have \<open>[bit a 0, bit a 1, bit a 2, bit a 3, bit a 4, bit a 5, bit a 6, bit a 7] = map (bit a) [0..<8]\<close>
[PROOF STATE]
proof (prove)
using this:
[0..<8] = [0, Suc 0, 2, 3, 4, 5, 6, 7]

goal (1 subgoal):
 1. [bit a 0, bit a 1, bit a 2, bit a 3, bit a 4, bit a 5, bit a 6, bit a 7] = map (bit a) [0..<8]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[bit a 0, bit a 1, bit a 2, bit a 3, bit a 4, bit a 5, bit a 6, bit a 7] = map (bit a) [0..<8]

goal (1 subgoal):
 1. of_char (char_of a) = a mod (256::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[bit a 0, bit a 1, bit a 2, bit a 3, bit a 4, bit a 5, bit a 6, bit a 7] = map (bit a) [0..<8]
[PROOF STEP]
have \<open>of_char (char_of a) = take_bit 8 a\<close>
[PROOF STATE]
proof (prove)
using this:
[bit a 0, bit a 1, bit a 2, bit a 3, bit a 4, bit a 5, bit a 6, bit a 7] = map (bit a) [0..<8]

goal (1 subgoal):
 1. of_char (char_of a) = take_bit 8 a
[PROOF STEP]
by (simp only: char_of_def of_char_def char.sel horner_sum_bit_eq_take_bit)
[PROOF STATE]
proof (state)
this:
of_char (char_of a) = take_bit 8 a

goal (1 subgoal):
 1. of_char (char_of a) = a mod (256::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_char (char_of a) = take_bit 8 a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
of_char (char_of a) = take_bit 8 a

goal (1 subgoal):
 1. of_char (char_of a) = a mod (256::'a)
[PROOF STEP]
by (simp add: take_bit_eq_mod)
[PROOF STATE]
proof (state)
this:
of_char (char_of a) = a mod (256::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Nat_atleast_NullD [rule_format]: "s:Null \<ge> n \<longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s:Null \<ge> n \<longrightarrow> False
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. s:Null \<ge> 0 \<longrightarrow> False
 2. \<And>n. s:Null \<ge> n \<longrightarrow> False \<Longrightarrow> s:Null \<ge> Suc n \<longrightarrow> False
[PROOF STEP]
by auto


[STATEMENT]
lemma nonconstant_length: "\<not> constant (poly p) \<Longrightarrow> psize p \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> constant (poly p) \<Longrightarrow> 2 \<le> psize p
[PROOF STEP]
by (induct p) (auto simp: constant_def psize_def)


[STATEMENT]
lemma hcmod_diff_ineq [simp]: "\<And>a b. hcmod a - hcmod b \<le> hcmod (a + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. hcmod a - hcmod b \<le> hcmod (a + b)
[PROOF STEP]
by transfer (rule norm_diff_ineq)


[STATEMENT]
lemma add_diff_cancel_left[simp]: "(c \<oplus>\<^sub>a a) \<ominus>\<^sub>a (c \<oplus>\<^sub>a b) = a \<ominus>\<^sub>a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<oplus>\<^sub>a a \<ominus>\<^sub>a (c \<oplus>\<^sub>a b) = a \<ominus>\<^sub>a b
[PROOF STEP]
unfolding diff_diff_add[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<oplus>\<^sub>a a \<ominus>\<^sub>a c \<ominus>\<^sub>a b = a \<ominus>\<^sub>a b
[PROOF STEP]
by simp


[STATEMENT]
theorem "(\<forall> t . \<Turnstile> ({s . t \<in> R s}) {|S|} q) \<Longrightarrow> \<Turnstile> ({:R:} p) {| S |} q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t. \<Turnstile> {s. t \<in> R s}{| S |}q \<Longrightarrow> \<Turnstile> {: R :} p{| S |}q
[PROOF STEP]
apply (simp add: Hoare_def angelic_def subset_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t x. t \<in> R x \<longrightarrow> x \<in> S q \<Longrightarrow> \<forall>x. R x \<inter> p \<noteq> {} \<longrightarrow> x \<in> S q
[PROOF STEP]
by auto


[STATEMENT]
lemma FinPow_rep_eq [simp]:
  "fset (FinPow xs) = {ys. ys |\<subseteq>| xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>FinPow xs\<rangle>\<^sub>f = {ys. ys |\<subseteq>| xs}
[PROOF STEP]
apply (subgoal_tac "finite (Abs_fset ` Pow \<langle>xs\<rangle>\<^sub>f)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (Abs_fset ` Pow \<langle>xs\<rangle>\<^sub>f) \<Longrightarrow> \<langle>FinPow xs\<rangle>\<^sub>f = {ys. ys |\<subseteq>| xs}
 2. finite (Abs_fset ` Pow \<langle>xs\<rangle>\<^sub>f)
[PROOF STEP]
apply (auto simp add: fmember_def FinPow_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa xb. \<lbrakk>xa \<subseteq> \<langle>xs\<rangle>\<^sub>f; xb \<in> \<langle>Abs_fset xa\<rangle>\<^sub>f\<rbrakk> \<Longrightarrow> xb \<in> \<langle>xs\<rangle>\<^sub>f
 2. \<And>x. x |\<subseteq>| xs \<Longrightarrow> x \<in> Abs_fset ` Pow \<langle>xs\<rangle>\<^sub>f
[PROOF STEP]
apply (rename_tac x' y')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x' y'. \<lbrakk>x' \<subseteq> \<langle>xs\<rangle>\<^sub>f; y' \<in> \<langle>Abs_fset x'\<rangle>\<^sub>f\<rbrakk> \<Longrightarrow> y' \<in> \<langle>xs\<rangle>\<^sub>f
 2. \<And>x. x |\<subseteq>| xs \<Longrightarrow> x \<in> Abs_fset ` Pow \<langle>xs\<rangle>\<^sub>f
[PROOF STEP]
apply (subgoal_tac "finite x'")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x' y'. \<lbrakk>x' \<subseteq> \<langle>xs\<rangle>\<^sub>f; y' \<in> \<langle>Abs_fset x'\<rangle>\<^sub>f; finite x'\<rbrakk> \<Longrightarrow> y' \<in> \<langle>xs\<rangle>\<^sub>f
 2. \<And>x' y'. \<lbrakk>x' \<subseteq> \<langle>xs\<rangle>\<^sub>f; y' \<in> \<langle>Abs_fset x'\<rangle>\<^sub>f\<rbrakk> \<Longrightarrow> finite x'
 3. \<And>x. x |\<subseteq>| xs \<Longrightarrow> x \<in> Abs_fset ` Pow \<langle>xs\<rangle>\<^sub>f
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x' y'. \<lbrakk>x' \<subseteq> \<langle>xs\<rangle>\<^sub>f; y' \<in> \<langle>Abs_fset x'\<rangle>\<^sub>f\<rbrakk> \<Longrightarrow> finite x'
 2. \<And>x. x |\<subseteq>| xs \<Longrightarrow> x \<in> Abs_fset ` Pow \<langle>xs\<rangle>\<^sub>f
[PROOF STEP]
apply (metis finite_fset finite_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x |\<subseteq>| xs \<Longrightarrow> x \<in> Abs_fset ` Pow \<langle>xs\<rangle>\<^sub>f
[PROOF STEP]
apply (metis (full_types) Pow_iff fset_inverse imageI less_eq_fset.rep_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma perm_map [intro]:
  assumes p: "a <~~> b"
  shows "map f a <~~> map f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (map f a) = mset (map f b)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
mset a = mset b

goal (1 subgoal):
 1. mset (map f a) = mset (map f b)
[PROOF STEP]
by simp


[STATEMENT]
lemma singular_boundary_mono:
   "\<lbrakk>T \<subseteq> S; singular_relboundary p (subtopology X T) {} c\<rbrakk>
        \<Longrightarrow> singular_relboundary p (subtopology X S) {} c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<subseteq> S; singular_relboundary p (subtopology X T) {} c\<rbrakk> \<Longrightarrow> singular_relboundary p (subtopology X S) {} c
[PROOF STEP]
by (metis mod_subset_empty singular_chain_mono singular_relboundary_def)


[STATEMENT]
lemma proj_eq_trans:
  "in_carrierp p \<Longrightarrow> in_carrierp p' \<Longrightarrow> in_carrierp p'' \<Longrightarrow>
   proj_eq p p' \<Longrightarrow> proj_eq p' p'' \<Longrightarrow> proj_eq p p''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>in_carrierp p; in_carrierp p'; in_carrierp p''; proj_eq p p'; proj_eq p' p''\<rbrakk> \<Longrightarrow> proj_eq p p''
[PROOF STEP]
proof (induct p rule: prod_induct3)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (a, b, c); in_carrierp p'; in_carrierp p''; proj_eq (a, b, c) p'; proj_eq p' p''\<rbrakk> \<Longrightarrow> proj_eq (a, b, c) p''
[PROOF STEP]
case (fields x y z)
[PROOF STATE]
proof (state)
this:
in_carrierp (x, y, z)
in_carrierp p'
in_carrierp p''
proj_eq (x, y, z) p'
proj_eq p' p''

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (a, b, c); in_carrierp p'; in_carrierp p''; proj_eq (a, b, c) p'; proj_eq p' p''\<rbrakk> \<Longrightarrow> proj_eq (a, b, c) p''
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
in_carrierp (x, y, z)
in_carrierp p'
in_carrierp p''
proj_eq (x, y, z) p'
proj_eq p' p''
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
in_carrierp (x, y, z)
in_carrierp p'
in_carrierp p''
proj_eq (x, y, z) p'
proj_eq p' p''

goal (1 subgoal):
 1. proj_eq (x, y, z) p''
[PROOF STEP]
proof (induct p' rule: prod_induct3)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (x, y, z); in_carrierp (a, b, c); in_carrierp p''; proj_eq (x, y, z) (a, b, c); proj_eq (a, b, c) p''\<rbrakk> \<Longrightarrow> proj_eq (x, y, z) p''
[PROOF STEP]
case (fields x' y' z')
[PROOF STATE]
proof (state)
this:
in_carrierp (x, y, z)
in_carrierp (x', y', z')
in_carrierp p''
proj_eq (x, y, z) (x', y', z')
proj_eq (x', y', z') p''

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (x, y, z); in_carrierp (a, b, c); in_carrierp p''; proj_eq (x, y, z) (a, b, c); proj_eq (a, b, c) p''\<rbrakk> \<Longrightarrow> proj_eq (x, y, z) p''
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
in_carrierp (x, y, z)
in_carrierp (x', y', z')
in_carrierp p''
proj_eq (x, y, z) (x', y', z')
proj_eq (x', y', z') p''
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
in_carrierp (x, y, z)
in_carrierp (x', y', z')
in_carrierp p''
proj_eq (x, y, z) (x', y', z')
proj_eq (x', y', z') p''

goal (1 subgoal):
 1. proj_eq (x, y, z) p''
[PROOF STEP]
proof (induct p'' rule: prod_induct3)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (x, y, z); in_carrierp (x', y', z'); in_carrierp (a, b, c); proj_eq (x, y, z) (x', y', z'); proj_eq (x', y', z') (a, b, c)\<rbrakk> \<Longrightarrow> proj_eq (x, y, z) (a, b, c)
[PROOF STEP]
case (fields x'' y'' z'')
[PROOF STATE]
proof (state)
this:
in_carrierp (x, y, z)
in_carrierp (x', y', z')
in_carrierp (x'', y'', z'')
proj_eq (x, y, z) (x', y', z')
proj_eq (x', y', z') (x'', y'', z'')

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (x, y, z); in_carrierp (x', y', z'); in_carrierp (a, b, c); proj_eq (x, y, z) (x', y', z'); proj_eq (x', y', z') (a, b, c)\<rbrakk> \<Longrightarrow> proj_eq (x, y, z) (a, b, c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
in_carrierp (x, y, z)
in_carrierp (x', y', z')
in_carrierp (x'', y'', z'')
proj_eq (x, y, z) (x', y', z')
proj_eq (x', y', z') (x'', y'', z'')
[PROOF STEP]
have
        z: "(z = 0) = (z' = 0)" "(z' = 0) = (z'' = 0)" and
        "x * z' * z'' = x' * z * z''"
        "y * z' * z'' = y' * z * z''"
        and xy:
        "x' * z'' = x'' * z'"
        "y' * z'' = y'' * z'"
[PROOF STATE]
proof (prove)
using this:
in_carrierp (x, y, z)
in_carrierp (x', y', z')
in_carrierp (x'', y'', z'')
proj_eq (x, y, z) (x', y', z')
proj_eq (x', y', z') (x'', y'', z'')

goal (1 subgoal):
 1. ((z = (0::'a)) = (z' = (0::'a)) &&& (z' = (0::'a)) = (z'' = (0::'a))) &&& (x * z' * z'' = x' * z * z'' &&& y * z' * z'' = y' * z * z'') &&& x' * z'' = x'' * z' &&& y' * z'' = y'' * z'
[PROOF STEP]
by (simp_all add: proj_eq_def)
[PROOF STATE]
proof (state)
this:
(z = (0::'a)) = (z' = (0::'a))
(z' = (0::'a)) = (z'' = (0::'a))
x * z' * z'' = x' * z * z''
y * z' * z'' = y' * z * z''
x' * z'' = x'' * z'
y' * z'' = y'' * z'

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (x, y, z); in_carrierp (x', y', z'); in_carrierp (a, b, c); proj_eq (x, y, z) (x', y', z'); proj_eq (x', y', z') (a, b, c)\<rbrakk> \<Longrightarrow> proj_eq (x, y, z) (a, b, c)
[PROOF STEP]
from \<open>x * z' * z'' = x' * z * z''\<close>
[PROOF STATE]
proof (chain)
picking this:
x * z' * z'' = x' * z * z''
[PROOF STEP]
have "(x * z'') * z' = (x'' * z) * z'"
[PROOF STATE]
proof (prove)
using this:
x * z' * z'' = x' * z * z''

goal (1 subgoal):
 1. x * z'' * z' = x'' * z * z'
[PROOF STEP]
by (ring (prems) xy) (ring xy)
[PROOF STATE]
proof (state)
this:
x * z'' * z' = x'' * z * z'

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (x, y, z); in_carrierp (x', y', z'); in_carrierp (a, b, c); proj_eq (x, y, z) (x', y', z'); proj_eq (x', y', z') (a, b, c)\<rbrakk> \<Longrightarrow> proj_eq (x, y, z) (a, b, c)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x * z'' * z' = x'' * z * z'

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (x, y, z); in_carrierp (x', y', z'); in_carrierp (a, b, c); proj_eq (x, y, z) (x', y', z'); proj_eq (x', y', z') (a, b, c)\<rbrakk> \<Longrightarrow> proj_eq (x, y, z) (a, b, c)
[PROOF STEP]
from \<open>y * z' * z'' = y' * z * z''\<close>
[PROOF STATE]
proof (chain)
picking this:
y * z' * z'' = y' * z * z''
[PROOF STEP]
have "(y * z'') * z' = (y'' * z) * z'"
[PROOF STATE]
proof (prove)
using this:
y * z' * z'' = y' * z * z''

goal (1 subgoal):
 1. y * z'' * z' = y'' * z * z'
[PROOF STEP]
by (ring (prems) xy) (ring xy)
[PROOF STATE]
proof (state)
this:
y * z'' * z' = y'' * z * z'

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>in_carrierp (x, y, z); in_carrierp (x', y', z'); in_carrierp (a, b, c); proj_eq (x, y, z) (x', y', z'); proj_eq (x', y', z') (a, b, c)\<rbrakk> \<Longrightarrow> proj_eq (x, y, z) (a, b, c)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x * z'' * z' = x'' * z * z'
y * z'' * z' = y'' * z * z'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
x * z'' * z' = x'' * z * z'
y * z'' * z' = y'' * z * z'

goal (1 subgoal):
 1. proj_eq (x, y, z) (x'', y'', z'')
[PROOF STEP]
using z
[PROOF STATE]
proof (prove)
using this:
x * z'' * z' = x'' * z * z'
y * z'' * z' = y'' * z * z'
(z = (0::'a)) = (z' = (0::'a))
(z' = (0::'a)) = (z'' = (0::'a))

goal (1 subgoal):
 1. proj_eq (x, y, z) (x'', y'', z'')
[PROOF STEP]
by (auto simp add: proj_eq_def)
[PROOF STATE]
proof (state)
this:
proj_eq (x, y, z) (x'', y'', z'')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proj_eq (x, y, z) p''

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proj_eq (x, y, z) p''

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_cut_greater_finite_iff: "finite (I \<down>> (t::nat)) = finite I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (I \<down>> t) = finite I
[PROOF STEP]
by (simp only: nat_cut_ge_greater_conv[symmetric] nat_cut_ge_finite_iff)


[STATEMENT]
lemma dmu_array_cost: assumes "i \<le> m"
  shows "result (dmu_array_cost dmus i) = dmu_array fs m dmus i"
   "cost (dmu_array_cost dmus i) \<le> (\<Sum> ii \<in> {i ..< m}. 2 * n + (2 * n + 1 + 2 * ii) * ii)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. result (dmu_array_cost dmus i) = dmu_array fs m dmus i &&& cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<le> m

goal (1 subgoal):
 1. result (dmu_array_cost dmus i) = dmu_array fs m dmus i &&& cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
proof (atomize(full), induct "m - i" arbitrary: i dmus)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i dmus. \<lbrakk>0 = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
 2. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
case (0 i dmus)
[PROOF STATE]
proof (state)
this:
0 = m - i
i \<le> m

goal (2 subgoals):
 1. \<And>i dmus. \<lbrakk>0 = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
 2. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
hence i: "i = m"
[PROOF STATE]
proof (prove)
using this:
0 = m - i
i \<le> m

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

goal (2 subgoals):
 1. \<And>i dmus. \<lbrakk>0 = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
 2. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
i = m

goal (1 subgoal):
 1. result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
unfolding dmu_array_cost.simps[of _ i]
    dmu_array.simps[of _ _ _ i]
[PROOF STATE]
proof (prove)
using this:
i = m

goal (1 subgoal):
 1. result (if m \<le> i then (dmus, 0) else let (dmus', cost_row) = dmu_array_row_cost dmus i; (res, cost_rec) = dmu_array_cost dmus' (Suc i) in (res, cost_row + cost_rec)) = (if i = m then dmus else let dmus' = dmu_array_row fs dmus i in dmu_array fs m dmus' (Suc i)) \<and> cost (if m \<le> i then (dmus, 0) else let (dmus', cost_row) = dmu_array_row_cost dmus i; (res, cost_rec) = dmu_array_cost dmus' (Suc i) in (res, cost_row + cost_rec)) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
by (simp add: cost_simps)
[PROOF STATE]
proof (state)
this:
result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
case (Suc k i dmus)
[PROOF STATE]
proof (state)
this:
\<lbrakk>k = m - ?i1; ?i1 \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost ?dmus1 ?i1) = dmu_array fs m ?dmus1 ?i1 \<and> cost (dmu_array_cost ?dmus1 ?i1) \<le> (\<Sum>ii = ?i1..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
Suc k = m - i
i \<le> m

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
obtain dmus' c_row where row_c: "dmu_array_row_cost dmus i = (dmus',c_row)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>dmus' c_row. dmu_array_row_cost dmus i = (dmus', c_row) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
dmu_array_row_cost dmus i = (dmus', c_row)

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
from result_costD[OF dmu_array_row_cost row_c]
[PROOF STATE]
proof (chain)
picking this:
dmus' = dmu_array_row fs dmus i
c_row \<le> 2 * n + (2 * n + 1 + 2 * i) * i
[PROOF STEP]
have row: "dmu_array_row fs dmus i = dmus'"
    and c_row: "c_row \<le> 2 * n + (2 * n + 1 + 2 * i) * i" (is "_ \<le> ?c i")
[PROOF STATE]
proof (prove)
using this:
dmus' = dmu_array_row fs dmus i
c_row \<le> 2 * n + (2 * n + 1 + 2 * i) * i

goal (1 subgoal):
 1. dmu_array_row fs dmus i = dmus' &&& c_row \<le> 2 * n + (2 * n + 1 + 2 * i) * i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dmu_array_row fs dmus i = dmus'
c_row \<le> 2 * n + (2 * n + 1 + 2 * i) * i

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>k = m - ?i1; ?i1 \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost ?dmus1 ?i1) = dmu_array fs m ?dmus1 ?i1 \<and> cost (dmu_array_cost ?dmus1 ?i1) \<le> (\<Sum>ii = ?i1..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
Suc k = m - i
i \<le> m
[PROOF STEP]
have "k = m - Suc i" "Suc i \<le> m"
    and id: "(m \<le> i) = False" "(i = m) = False"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k = m - ?i1; ?i1 \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost ?dmus1 ?i1) = dmu_array fs m ?dmus1 ?i1 \<and> cost (dmu_array_cost ?dmus1 ?i1) \<le> (\<Sum>ii = ?i1..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
Suc k = m - i
i \<le> m

goal (1 subgoal):
 1. (k = m - Suc i &&& Suc i \<le> m) &&& (m \<le> i) = False &&& (i = m) = False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k = m - Suc i
Suc i \<le> m
(m \<le> i) = False
(i = m) = False

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
note IH = Suc(1)[OF this(1-2)]
[PROOF STATE]
proof (state)
this:
result (dmu_array_cost ?dmus1 (Suc i)) = dmu_array fs m ?dmus1 (Suc i) \<and> cost (dmu_array_cost ?dmus1 (Suc i)) \<le> (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
obtain res c_rec where rec_c: "dmu_array_cost dmus' (Suc i) = (res, c_rec)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>res c_rec. dmu_array_cost dmus' (Suc i) = (res, c_rec) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
dmu_array_cost dmus' (Suc i) = (res, c_rec)

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
from result_costD'[OF IH rec_c]
[PROOF STATE]
proof (chain)
picking this:
res = dmu_array fs m dmus' (Suc i)
c_rec \<le> (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
have rec: "dmu_array fs m dmus' (Suc i) = res"
    and c_rec: "c_rec \<le> (\<Sum>ii = Suc i..<m. ?c ii)"
[PROOF STATE]
proof (prove)
using this:
res = dmu_array fs m dmus' (Suc i)
c_rec \<le> (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. dmu_array fs m dmus' (Suc i) = res &&& c_rec \<le> (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dmu_array fs m dmus' (Suc i) = res
c_rec \<le> (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
have "c_row + c_rec \<le> ?c i + (\<Sum>ii = Suc i..<m. ?c ii)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_row + c_rec \<le> 2 * n + (2 * n + 1 + 2 * i) * i + (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
using c_rec c_row
[PROOF STATE]
proof (prove)
using this:
c_rec \<le> (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
c_row \<le> 2 * n + (2 * n + 1 + 2 * i) * i

goal (1 subgoal):
 1. c_row + c_rec \<le> 2 * n + (2 * n + 1 + 2 * i) * i + (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c_row + c_rec \<le> 2 * n + (2 * n + 1 + 2 * i) * i + (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c_row + c_rec \<le> 2 * n + (2 * n + 1 + 2 * i) * i + (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
have "\<dots> = (\<Sum>ii = i..<m. ?c ii)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * n + (2 * n + 1 + 2 * i) * i + (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii) = (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
by (subst sum.atLeast_Suc_lessThan [of i]) (use Suc in auto)
[PROOF STATE]
proof (state)
this:
2 * n + (2 * n + 1 + 2 * i) * i + (\<Sum>ii = Suc i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii) = (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. \<And>x i dmus. \<lbrakk>\<And>i dmus. \<lbrakk>x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii); Suc x = m - i; i \<le> m\<rbrakk> \<Longrightarrow> result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
c_row + c_rec \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
c_row + c_rec \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
unfolding dmu_array_cost.simps[of _ i]
    dmu_array.simps[of _ _ _ i] id if_False Let_def rec_c row_c row rec split cost_simps
[PROOF STATE]
proof (prove)
using this:
c_row + c_rec \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal (1 subgoal):
 1. res = res \<and> c_row + c_rec \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
result (dmu_array_cost dmus i) = dmu_array fs m dmus i \<and> cost (dmu_array_cost dmus i) \<le> (\<Sum>ii = i..<m. 2 * n + (2 * n + 1 + 2 * ii) * ii)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_of_uint64_012[simp]: \<open>nat_of_uint64 0 = 0\<close> \<open>nat_of_uint64 2 = 2\<close> \<open>nat_of_uint64 1 = 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_of_uint64 0 = 0 &&& nat_of_uint64 2 = 2 &&& nat_of_uint64 1 = 1
[PROOF STEP]
by (simp_all add: nat_of_uint64.rep_eq zero_uint64.rep_eq one_uint64.rep_eq)


[STATEMENT]
lemma connecting_walk_rev: "connecting_walk u v xs \<longleftrightarrow> connecting_walk v u (rev xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connecting_walk u v xs = connecting_walk v u (rev xs)
[PROOF STEP]
unfolding connecting_walk_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (is_walk xs \<and> hd xs = u \<and> last xs = v) = (is_walk (rev xs) \<and> hd (rev xs) = v \<and> last (rev xs) = u)
[PROOF STEP]
using is_walk_rev
[PROOF STATE]
proof (prove)
using this:
is_walk ?xs = is_walk (rev ?xs)

goal (1 subgoal):
 1. (is_walk xs \<and> hd xs = u \<and> last xs = v) = (is_walk (rev xs) \<and> hd (rev xs) = v \<and> last (rev xs) = u)
[PROOF STEP]
by (auto simp add: hd_rev last_rev)


[STATEMENT]
lemma fronts_mids: "bs \<in> fronts xs \<Longrightarrow> bs \<in> mids xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bs \<in> fronts xs \<Longrightarrow> bs \<in> mids xs
[PROOF STEP]
unfolding fronts_def mids_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bs \<in> {as. \<exists>bs. xs = as @ bs} \<Longrightarrow> bs \<in> {bs. \<exists>as cs. xs = as @ bs @ cs}
[PROOF STEP]
by auto


[STATEMENT]
lemma A_SET_INV_def':
  fixes G (structure)
  shows "a_set_inv H \<equiv> \<Union>h\<in>H. {\<ominus> h}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a_set_inv H \<equiv> \<Union>h\<in>H. {\<ominus> h}
[PROOF STEP]
unfolding A_SET_INV_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union>h\<in>H. {inv\<^bsub>add_monoid G\<^esub> h} \<equiv> \<Union>h\<in>H. {\<ominus> h}
[PROOF STEP]
by (fold a_inv_def)


[STATEMENT]
lemma has_sum_mono2:
  fixes f :: "'a \<Rightarrow> 'b::{topological_ab_group_add, ordered_comm_monoid_add,linorder_topology}"
  assumes "has_sum f A S" "has_sum f B S'" "A \<subseteq> B"
  assumes "\<And>x. x \<in> B - A \<Longrightarrow> f x \<ge> 0"
  shows   "S \<le> S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<le> S'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<le> S'
[PROOF STEP]
have "has_sum f (B - A) (S' - S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum f (B - A) (S' - S)
[PROOF STEP]
by (rule has_sum_Diff) fact+
[PROOF STATE]
proof (state)
this:
has_sum f (B - A) (S' - S)

goal (1 subgoal):
 1. S \<le> S'
[PROOF STEP]
hence "S' - S \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
has_sum f (B - A) (S' - S)

goal (1 subgoal):
 1. (0::'b) \<le> S' - S
[PROOF STEP]
by (rule has_sum_nonneg) (use assms(4) in auto)
[PROOF STATE]
proof (state)
this:
(0::'b) \<le> S' - S

goal (1 subgoal):
 1. S \<le> S'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(0::'b) \<le> S' - S

goal (1 subgoal):
 1. S \<le> S'
[PROOF STEP]
by (metis add_0 add_mono_thms_linordered_semiring(3) diff_add_cancel)
[PROOF STATE]
proof (state)
this:
S \<le> S'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma plus_iarray_component:
  assumes iA: "i<IArray.length A"
  and iB: "i<IArray.length B"
  shows "(A+B) !! i = A!!i + B!!i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + B) !! i = A !! i + B !! i
[PROOF STEP]
proof (unfold plus_iarray_def Let_def )
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i
[PROOF STEP]
have "IArray.of_fun
    (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else 0) (max (IArray.length A) (IArray.length B)) !! a +
    IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else 0) (max (IArray.length A) (IArray.length B)) !! a)
    (max (IArray.length A) (IArray.length B)) !!
    i = IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else 0) (max (IArray.length A) (IArray.length B)) !! i +
    IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else 0) (max (IArray.length A) (IArray.length B)) !! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i
[PROOF STEP]
by (rule of_fun_nth, metis iB less_max_iff_disj)
[PROOF STATE]
proof (state)
this:
IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i

goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i

goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i
[PROOF STEP]
have "...= (\<lambda>a. if a < IArray.length A then A !! a else 0) i +
    (\<lambda>a. if a < IArray.length B then B !! a else 0) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i = (if i < IArray.length A then A !! i else (0::'a)) + (if i < IArray.length B then B !! i else (0::'a))
[PROOF STEP]
using of_fun_nth[of i "(max (IArray.length A) (IArray.length B))"]
[PROOF STATE]
proof (prove)
using this:
i < max (IArray.length A) (IArray.length B) \<Longrightarrow> IArray.of_fun ?f (max (IArray.length A) (IArray.length B)) !! i = ?f i

goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i = (if i < IArray.length A then A !! i else (0::'a)) + (if i < IArray.length B then B !! i else (0::'a))
[PROOF STEP]
using iB
[PROOF STATE]
proof (prove)
using this:
i < max (IArray.length A) (IArray.length B) \<Longrightarrow> IArray.of_fun ?f (max (IArray.length A) (IArray.length B)) !! i = ?f i
i < IArray.length B

goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i = (if i < IArray.length A then A !! i else (0::'a)) + (if i < IArray.length B then B !! i else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i = (if i < IArray.length A then A !! i else (0::'a)) + (if i < IArray.length B then B !! i else (0::'a))

goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! i = (if i < IArray.length A then A !! i else (0::'a)) + (if i < IArray.length B then B !! i else (0::'a))

goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i
[PROOF STEP]
have "...= A!!i + B !! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i < IArray.length A then A !! i else (0::'a)) + (if i < IArray.length B then B !! i else (0::'a)) = A !! i + B !! i
[PROOF STEP]
using iA iB
[PROOF STATE]
proof (prove)
using this:
i < IArray.length A
i < IArray.length B

goal (1 subgoal):
 1. (if i < IArray.length A then A !! i else (0::'a)) + (if i < IArray.length B then B !! i else (0::'a)) = A !! i + B !! i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if i < IArray.length A then A !! i else (0::'a)) + (if i < IArray.length B then B !! i else (0::'a)) = A !! i + B !! i

goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i
[PROOF STEP]
show "IArray.of_fun
    (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else 0) (max (IArray.length A) (IArray.length B)) !! a +
    IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else 0) (max (IArray.length A) (IArray.length B)) !! a)
    (max (IArray.length A) (IArray.length B)) !!
    i =
    A !! i + B !! i"
[PROOF STATE]
proof (prove)
using this:
IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i

goal (1 subgoal):
 1. IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
IArray.of_fun (\<lambda>a. IArray.of_fun (\<lambda>a. if a < IArray.length A then A !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a + IArray.of_fun (\<lambda>a. if a < IArray.length B then B !! a else (0::'a)) (max (IArray.length A) (IArray.length B)) !! a) (max (IArray.length A) (IArray.length B)) !! i = A !! i + B !! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Trg_Subst [simp]:
    shows "\<lbrakk>Arr t; Arr u\<rbrakk> \<Longrightarrow> Trg (Subst d t u) = Subst d (Trg t) (Trg u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Arr t; Arr u\<rbrakk> \<Longrightarrow> Trg (Subst d t u) = Subst d (Trg t) (Trg u)
[PROOF STEP]
by (metis Arr_Subst Arr_Trg Arr_not_Nil resid_Arr_self resid_Subst)


[STATEMENT]
lemma Lindelof_space_continuous_map_image:
  assumes X: "Lindelof_space X" and f: "continuous_map X Y f" and fim: "f ` (topspace X) = topspace Y"
  shows "Lindelof_space Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lindelof_space Y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Lindelof_space Y
[PROOF STEP]
have "\<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union>\<V> = topspace Y"
    if \<U>: "\<And>U. U \<in> \<U> \<Longrightarrow> openin Y U" and UU: "\<Union>\<U> = topspace Y" for \<U>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
define \<V> where "\<V> \<equiv> (\<lambda>U. {x \<in> topspace X. f x \<in> U}) ` \<U>"
[PROOF STATE]
proof (state)
this:
\<V> \<equiv> (\<lambda>U. {x \<in> topspace X. f x \<in> U}) ` \<U>

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
have "\<And>V. V \<in> \<V> \<Longrightarrow> openin X V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>V. V \<in> \<V> \<Longrightarrow> openin X V
[PROOF STEP]
unfolding \<V>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>V. V \<in> (\<lambda>U. {x \<in> topspace X. f x \<in> U}) ` \<U> \<Longrightarrow> openin X V
[PROOF STEP]
using \<U> continuous_map f
[PROOF STATE]
proof (prove)
using this:
?U \<in> \<U> \<Longrightarrow> openin Y ?U
continuous_map ?X ?Y ?f = (?f ` topspace ?X \<subseteq> topspace ?Y \<and> (\<forall>U. openin ?Y U \<longrightarrow> openin ?X {x \<in> topspace ?X. ?f x \<in> U}))
continuous_map X Y f

goal (1 subgoal):
 1. \<And>V. V \<in> (\<lambda>U. {x \<in> topspace X. f x \<in> U}) ` \<U> \<Longrightarrow> openin X V
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?V \<in> \<V> \<Longrightarrow> openin X ?V

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?V \<in> \<V> \<Longrightarrow> openin X ?V

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
have "\<Union>\<V> = topspace X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> \<V> = topspace X
[PROOF STEP]
unfolding \<V>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>U\<in>\<U>. {x \<in> topspace X. f x \<in> U}) = topspace X
[PROOF STEP]
using UU fim
[PROOF STATE]
proof (prove)
using this:
\<Union> \<U> = topspace Y
f ` topspace X = topspace Y

goal (1 subgoal):
 1. (\<Union>U\<in>\<U>. {x \<in> topspace X. f x \<in> U}) = topspace X
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<Union> \<V> = topspace X

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?V \<in> \<V> \<Longrightarrow> openin X ?V
\<Union> \<V> = topspace X
[PROOF STEP]
have "\<exists>\<W>. countable \<W> \<and> \<W> \<subseteq> \<V> \<and> \<Union>\<W> = topspace X"
[PROOF STATE]
proof (prove)
using this:
?V \<in> \<V> \<Longrightarrow> openin X ?V
\<Union> \<V> = topspace X

goal (1 subgoal):
 1. \<exists>\<W>. countable \<W> \<and> \<W> \<subseteq> \<V> \<and> \<Union> \<W> = topspace X
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
?V \<in> \<V> \<Longrightarrow> openin X ?V
\<Union> \<V> = topspace X
Lindelof_space X

goal (1 subgoal):
 1. \<exists>\<W>. countable \<W> \<and> \<W> \<subseteq> \<V> \<and> \<Union> \<W> = topspace X
[PROOF STEP]
by (simp add: Lindelof_space_def)
[PROOF STATE]
proof (state)
this:
\<exists>\<W>. countable \<W> \<and> \<W> \<subseteq> \<V> \<and> \<Union> \<W> = topspace X

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>\<W>. countable \<W> \<and> \<W> \<subseteq> \<V> \<and> \<Union> \<W> = topspace X
[PROOF STEP]
obtain \<C> where "countable \<C>" "\<C> \<subseteq> \<U>" and \<C>: "(\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<W>. countable \<W> \<and> \<W> \<subseteq> \<V> \<and> \<Union> \<W> = topspace X

goal (1 subgoal):
 1. (\<And>\<C>. \<lbrakk>countable \<C>; \<C> \<subseteq> \<U>; (\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (no_types, lifting) \<V>_def countable_subset_image)
[PROOF STATE]
proof (state)
this:
countable \<C>
\<C> \<subseteq> \<U>
(\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
countable \<C>
\<C> \<subseteq> \<U>
(\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
have "\<Union>\<C> = topspace Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> \<C> = topspace Y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Union> \<C> \<subseteq> topspace Y
 2. topspace Y \<subseteq> \<Union> \<C>
[PROOF STEP]
show "\<Union>\<C> \<subseteq> topspace Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> \<C> \<subseteq> topspace Y
[PROOF STEP]
using UU \<C> \<open>\<C> \<subseteq> \<U>\<close>
[PROOF STATE]
proof (prove)
using this:
\<Union> \<U> = topspace Y
(\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X
\<C> \<subseteq> \<U>

goal (1 subgoal):
 1. \<Union> \<C> \<subseteq> topspace Y
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<Union> \<C> \<subseteq> topspace Y

goal (1 subgoal):
 1. topspace Y \<subseteq> \<Union> \<C>
[PROOF STEP]
have "y \<in> \<Union>\<C>" if "y \<in> topspace Y" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> \<Union> \<C>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<in> \<Union> \<C>
[PROOF STEP]
obtain x where "x \<in> topspace X" "y = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> topspace X; y = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using that fim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> topspace X; y = f ?x\<rbrakk> \<Longrightarrow> thesis
f ` topspace X = topspace Y

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> topspace X; y = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis \<open>y \<in> topspace Y\<close> imageE)
[PROOF STATE]
proof (state)
this:
x \<in> topspace X
y = f x

goal (1 subgoal):
 1. y \<in> \<Union> \<C>
[PROOF STEP]
with \<C>
[PROOF STATE]
proof (chain)
picking this:
(\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X
x \<in> topspace X
y = f x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X
x \<in> topspace X
y = f x

goal (1 subgoal):
 1. y \<in> \<Union> \<C>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> \<Union> \<C>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?y \<in> topspace Y \<Longrightarrow> ?y \<in> \<Union> \<C>

goal (1 subgoal):
 1. topspace Y \<subseteq> \<Union> \<C>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y \<in> topspace Y \<Longrightarrow> ?y \<in> \<Union> \<C>
[PROOF STEP]
show "topspace Y \<subseteq> \<Union>\<C>"
[PROOF STATE]
proof (prove)
using this:
?y \<in> topspace Y \<Longrightarrow> ?y \<in> \<Union> \<C>

goal (1 subgoal):
 1. topspace Y \<subseteq> \<Union> \<C>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
topspace Y \<subseteq> \<Union> \<C>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Union> \<C> = topspace Y

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
countable \<C>
\<C> \<subseteq> \<U>
(\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X
\<Union> \<C> = topspace Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
countable \<C>
\<C> \<subseteq> \<U>
(\<Union>U\<in>\<C>. {x \<in> topspace X. f x \<in> U}) = topspace X
\<Union> \<C> = topspace Y

goal (1 subgoal):
 1. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>U. U \<in> ?\<U> \<Longrightarrow> openin Y U; \<Union> ?\<U> = topspace Y\<rbrakk> \<Longrightarrow> \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> ?\<U> \<and> \<Union> \<V> = topspace Y

goal (1 subgoal):
 1. Lindelof_space Y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>U. U \<in> ?\<U> \<Longrightarrow> openin Y U; \<Union> ?\<U> = topspace Y\<rbrakk> \<Longrightarrow> \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> ?\<U> \<and> \<Union> \<V> = topspace Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>U. U \<in> ?\<U> \<Longrightarrow> openin Y U; \<Union> ?\<U> = topspace Y\<rbrakk> \<Longrightarrow> \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> ?\<U> \<and> \<Union> \<V> = topspace Y

goal (1 subgoal):
 1. Lindelof_space Y
[PROOF STEP]
unfolding Lindelof_space_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>U. U \<in> ?\<U> \<Longrightarrow> openin Y U; \<Union> ?\<U> = topspace Y\<rbrakk> \<Longrightarrow> \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> ?\<U> \<and> \<Union> \<V> = topspace Y

goal (1 subgoal):
 1. \<forall>\<U>. (\<forall>U\<in>\<U>. openin Y U) \<and> \<Union> \<U> = topspace Y \<longrightarrow> (\<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace Y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Lindelof_space Y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tinsert_d_amor:
assumes "n = size t" "insert_d a (t,dl) = (t',dl')" "bal_i (size t + dl) (height t)"
shows "T_insert3_d a (t,n,dl) + \<Phi> t' - \<Phi> t \<le> (6*e+2) * (height t + 1) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
proof (cases "ins (size t + dl) 0 a t")
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ins (size t + dl) 0 a t = Same \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 2. \<And>x2. ins (size t + dl) 0 a t = Bal x2 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 3. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
case Same
[PROOF STATE]
proof (state)
this:
ins (size t + dl) 0 a t = Same

goal (3 subgoals):
 1. ins (size t + dl) 0 a t = Same \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 2. \<And>x2. ins (size t + dl) 0 a t = Bal x2 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 3. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
have *: "5*e * real (height t) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 5 * e * real (height t)
[PROOF STEP]
using e0
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 \<le> 5 * e * real (height t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> 5 * e * real (height t)

goal (3 subgoals):
 1. ins (size t + dl) 0 a t = Same \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 2. \<And>x2. ins (size t + dl) 0 a t = Bal x2 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 3. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
using T_ins3_Same[of "size t + dl" 0 a t] Same assms
[PROOF STATE]
proof (prove)
using this:
ins3 (size t + dl) 0 a t = Same2 \<Longrightarrow> T_ins3 (size t + dl) 0 a t \<le> 2 * height t + 1
ins (size t + dl) 0 a t = Same
n = size t
insert_d a (t, dl) = (t', dl')
bal_i (size t + dl) (height t)

goal (1 subgoal):
 1. real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
apply (auto simp add: ring_distribs ins3_ins2 ins2_ins)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T_ins3 (size t' + dl') 0 a t' \<le> Suc (2 * height t'); ins (size t' + dl') 0 a t' = Same; n = size t'; bal_i (size t' + dl') (height t'); t = t'; dl = dl'\<rbrakk> \<Longrightarrow> real (T_ins3 (size t' + dl') 0 a t') \<le> 2 + (6 * e + (6 * e * real (height t') + 2 * real (height t')))
[PROOF STEP]
using * e0
[PROOF STATE]
proof (prove)
using this:
0 \<le> 5 * e * real (height t)
0 < e

goal (1 subgoal):
 1. \<lbrakk>T_ins3 (size t' + dl') 0 a t' \<le> Suc (2 * height t'); ins (size t' + dl') 0 a t' = Same; n = size t'; bal_i (size t' + dl') (height t'); t = t'; dl = dl'\<rbrakk> \<Longrightarrow> real (T_ins3 (size t' + dl') 0 a t') \<le> 2 + (6 * e + (6 * e * real (height t') + 2 * real (height t')))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T_ins3 (size t' + dl') 0 a t' \<le> Suc (2 * height t'); ins (size t' + dl') 0 a t' = Same; n = size t'; bal_i (size t' + dl') (height t'); dl = dl'; 0 \<le> 5 * e * real (height t'); 0 < e; t = t'\<rbrakk> \<Longrightarrow> real (T_ins3 (size t' + dl') 0 a t') \<le> 2 + (6 * e + (6 * e * real (height t') + 2 * real (height t')))
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1

goal (2 subgoals):
 1. \<And>x2. ins (size t + dl) 0 a t = Bal x2 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 2. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x2. ins (size t + dl) 0 a t = Bal x2 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 2. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
case (Bal t')
[PROOF STATE]
proof (state)
this:
ins (size t + dl) 0 a t = Bal t'

goal (2 subgoals):
 1. \<And>x2. ins (size t + dl) 0 a t = Bal x2 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
 2. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ins (size t + dl) 0 a t = Bal t'

goal (1 subgoal):
 1. real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
using T_ins3_Bal[of "size t + dl" 0 a t t'] Bal assms
[PROOF STATE]
proof (prove)
using this:
ins (size t + dl) 0 a t = Bal t'
\<lbrakk>ins3 (size t + dl) 0 a t = Bal2 t'; bal_i (size t + dl) (height t + 0)\<rbrakk> \<Longrightarrow> real (T_ins3 (size t + dl) 0 a t) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1)
ins (size t + dl) 0 a t = Bal t'
n = size t
insert_d a (t, dl) = (t', dl')
bal_i (size t + dl) (height t)

goal (1 subgoal):
 1. real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
by(simp add: ins_size ins3_ins2 ins2_ins)
[PROOF STATE]
proof (state)
this:
real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1

goal (1 subgoal):
 1. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
case Unbal
[PROOF STATE]
proof (state)
this:
ins (size t + dl) 0 a t = Unbal x3_

goal (1 subgoal):
 1. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
hence False
[PROOF STATE]
proof (prove)
using this:
ins (size t + dl) 0 a t = Unbal x3_

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

goal (1 subgoal):
 1. \<And>x3. ins (size t + dl) 0 a t = Unbal x3 \<Longrightarrow> real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
False

goal (1 subgoal):
 1. real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
real (T_insert3_d a (t, n, dl)) + \<Phi> t' - \<Phi> t \<le> (6 * e + 2) * real (height t + 1) + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "(999999::real) \<le> (1000001 + 1) - 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 999999 \<le> 1000001 + 1 - 2
[PROOF STEP]
by simp