[STATEMENT]
lemma invar_step:
assumes "invar C"
and "card C < k"
shows "invar (C \<union> {furthest_from C})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
have furthest_from_C_props: "furthest_from C \<in> S \<and> distance C (furthest_from C) = radius C "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. furthest_from C \<in> S \<and> distance C (furthest_from C) = radius C
[PROOF STEP]
using someI_ex[of "\<lambda>x. x \<in> S \<and> distance C x = radius C"] radius_def2 radius_def
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x \<in> S \<and> distance C x = radius C \<Longrightarrow> (SOME x. x \<in> S \<and> distance C x = radius C) \<in> S \<and> distance C (SOME x. x \<in> S \<and> distance C x = radius C) = radius C
\<exists>s\<in>S. distance ?C s = radius ?C
radius ?C = Max (distance ?C ` S)

goal (1 subgoal):
 1. furthest_from C \<in> S \<and> distance C (furthest_from C) = radius C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
furthest_from C \<in> S \<and> distance C (furthest_from C) = radius C

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
have C_props: "finite C \<and> C \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite C \<and> C \<noteq> {}
[PROOF STEP]
using finite_subset[OF _ finite_sites] assms(1)
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> S \<Longrightarrow> finite ?A
invar C

goal (1 subgoal):
 1. finite C \<and> C \<noteq> {}
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> S \<Longrightarrow> finite ?A
C \<noteq> {} \<and> card C \<le> k \<and> C \<subseteq> S \<and> (\<forall>C'. (\<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2) \<or> (\<forall>s\<in>S. distance C s \<le> 2 * radius C'))

goal (1 subgoal):
 1. finite C \<and> C \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite C \<and> C \<noteq> {}

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite C \<and> C \<noteq> {}

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
have "card (C \<union> {furthest_from C}) \<le> card C + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (C \<union> {furthest_from C}) \<le> card C + 1
[PROOF STEP]
using assms(1) C_props
[PROOF STATE]
proof (prove)
using this:
invar C
finite C \<and> C \<noteq> {}

goal (1 subgoal):
 1. card (C \<union> {furthest_from C}) \<le> card C + 1
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
using this:
C \<noteq> {} \<and> card C \<le> k \<and> C \<subseteq> S \<and> (\<forall>C'. (\<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2) \<or> (\<forall>s\<in>S. distance C s \<le> 2 * radius C'))
finite C \<and> C \<noteq> {}

goal (1 subgoal):
 1. card (C \<union> {furthest_from C}) \<le> card C + 1
[PROOF STEP]
by (simp add: card_insert_if)
[PROOF STATE]
proof (state)
this:
card (C \<union> {furthest_from C}) \<le> card C + 1

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (C \<union> {furthest_from C}) \<le> card C + 1
[PROOF STEP]
have "card (C \<union> {furthest_from C}) < k + 1"
[PROOF STATE]
proof (prove)
using this:
card (C \<union> {furthest_from C}) \<le> card C + 1

goal (1 subgoal):
 1. card (C \<union> {furthest_from C}) < k + 1
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
card (C \<union> {furthest_from C}) \<le> card C + 1
card C < k

goal (1 subgoal):
 1. card (C \<union> {furthest_from C}) < k + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (C \<union> {furthest_from C}) < k + 1

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (C \<union> {furthest_from C}) < k + 1
[PROOF STEP]
have "card (C \<union> {furthest_from C}) \<le> k"
[PROOF STATE]
proof (prove)
using this:
card (C \<union> {furthest_from C}) < k + 1

goal (1 subgoal):
 1. card (C \<union> {furthest_from C}) \<le> k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (C \<union> {furthest_from C}) \<le> k

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
card (C \<union> {furthest_from C}) \<le> k

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (C \<union> {furthest_from C}) \<le> k

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
have "C \<union> {furthest_from C} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<union> {furthest_from C} \<noteq> {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C \<union> {furthest_from C} \<noteq> {}

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
C \<union> {furthest_from C} \<noteq> {}

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
have "(C \<union> {furthest_from C}) \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<union> {furthest_from C} \<subseteq> S
[PROOF STEP]
using assms(1) furthest_from_C_props
[PROOF STATE]
proof (prove)
using this:
invar C
furthest_from C \<in> S \<and> distance C (furthest_from C) = radius C

goal (1 subgoal):
 1. C \<union> {furthest_from C} \<subseteq> S
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
using this:
C \<noteq> {} \<and> card C \<le> k \<and> C \<subseteq> S \<and> (\<forall>C'. (\<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2) \<or> (\<forall>s\<in>S. distance C s \<le> 2 * radius C'))
furthest_from C \<in> S \<and> distance C (furthest_from C) = radius C

goal (1 subgoal):
 1. C \<union> {furthest_from C} \<subseteq> S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C \<union> {furthest_from C} \<subseteq> S

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
C \<union> {furthest_from C} \<subseteq> S

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
have "\<forall>C'. (\<forall>s \<in> S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C')
          \<or> (\<forall>c\<^sub>1 \<in> C \<union> {furthest_from C}. \<forall>c\<^sub>2 \<in> C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>C'. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C'. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
fix C'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C'. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
have "distance C (furthest_from C) > 2 * radius C' \<or> distance C (furthest_from C) \<le> 2 * radius C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * radius C' < distance C (furthest_from C) \<or> distance C (furthest_from C) \<le> 2 * radius C'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * radius C' < distance C (furthest_from C) \<or> distance C (furthest_from C) \<le> 2 * radius C'

goal (1 subgoal):
 1. \<And>C'. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * radius C' < distance C (furthest_from C) \<or> distance C (furthest_from C) \<le> 2 * radius C'
[PROOF STEP]
show "(\<forall>s \<in> S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C')
               \<or> (\<forall>c\<^sub>1 \<in> C \<union> {furthest_from C}. \<forall>c\<^sub>2 \<in> C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
2 * radius C' < distance C (furthest_from C) \<or> distance C (furthest_from C) \<le> 2 * radius C'

goal (1 subgoal):
 1. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
proof (elim disjE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 2 * radius C' < distance C (furthest_from C) \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
 2. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
assume asm: "distance C (furthest_from C) > 2 * radius C'"
[PROOF STATE]
proof (state)
this:
2 * radius C' < distance C (furthest_from C)

goal (2 subgoals):
 1. 2 * radius C' < distance C (furthest_from C) \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
 2. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * radius C' < distance C (furthest_from C)
[PROOF STEP]
have "\<not>(\<forall>s \<in> S. distance C s \<le> 2 * radius C')"
[PROOF STATE]
proof (prove)
using this:
2 * radius C' < distance C (furthest_from C)

goal (1 subgoal):
 1. \<not> (\<forall>s\<in>S. distance C s \<le> 2 * radius C')
[PROOF STEP]
using furthest_from_C_props
[PROOF STATE]
proof (prove)
using this:
2 * radius C' < distance C (furthest_from C)
furthest_from C \<in> S \<and> distance C (furthest_from C) = radius C

goal (1 subgoal):
 1. \<not> (\<forall>s\<in>S. distance C s \<le> 2 * radius C')
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>s\<in>S. distance C s \<le> 2 * radius C')

goal (2 subgoals):
 1. 2 * radius C' < distance C (furthest_from C) \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
 2. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<forall>s\<in>S. distance C s \<le> 2 * radius C')
[PROOF STEP]
have IH: "\<forall>c\<^sub>1 \<in> C. \<forall>c\<^sub>2 \<in> C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>s\<in>S. distance C s \<le> 2 * radius C')

goal (1 subgoal):
 1. \<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>s\<in>S. distance C s \<le> 2 * radius C')
invar C

goal (1 subgoal):
 1. \<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>s\<in>S. distance C s \<le> 2 * radius C')
C \<noteq> {} \<and> card C \<le> k \<and> C \<subseteq> S \<and> (\<forall>C'. (\<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2) \<or> (\<forall>s\<in>S. distance C s \<le> 2 * radius C'))

goal (1 subgoal):
 1. \<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2

goal (2 subgoals):
 1. 2 * radius C' < distance C (furthest_from C) \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
 2. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
have "(\<forall>c\<^sub>1 \<in> C \<union> {furthest_from C}. (\<forall>c\<^sub>2 \<in> C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2
[PROOF STEP]
using dist_ins[of "C" "2 * radius C'" "furthest_from C"] IH C_props asm
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2; 2 * radius C' < distance C (furthest_from C); finite C; C \<noteq> {}\<rbrakk> \<Longrightarrow> \<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2
\<forall>c\<^sub>1\<in>C. \<forall>c\<^sub>2\<in>C. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2
finite C \<and> C \<noteq> {}
2 * radius C' < distance C (furthest_from C)

goal (1 subgoal):
 1. \<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2

goal (2 subgoals):
 1. 2 * radius C' < distance C (furthest_from C) \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
 2. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2

goal (1 subgoal):
 1. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)

goal (1 subgoal):
 1. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
assume main_assm: "2 * radius C' \<ge> distance C (furthest_from C)"
[PROOF STATE]
proof (state)
this:
distance C (furthest_from C) \<le> 2 * radius C'

goal (1 subgoal):
 1. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
have "(\<forall>s \<in> S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
assume local_assm: "s \<in> S"
[PROOF STATE]
proof (state)
this:
s \<in> S

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s \<in> S
[PROOF STEP]
show "distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'"
[PROOF STATE]
proof (prove)
using this:
s \<in> S

goal (1 subgoal):
 1. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
have "distance (C \<union> {furthest_from C}) s \<le> distance C s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distance (C \<union> {furthest_from C}) s \<le> distance C s
[PROOF STEP]
using distance_mono[of C "C \<union> {furthest_from C}"] C_props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>C \<subseteq> C \<union> {furthest_from C}; C \<noteq> {}; finite (C \<union> {furthest_from C})\<rbrakk> \<Longrightarrow> distance (C \<union> {furthest_from C}) ?s \<le> distance C ?s
finite C \<and> C \<noteq> {}

goal (1 subgoal):
 1. distance (C \<union> {furthest_from C}) s \<le> distance C s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distance (C \<union> {furthest_from C}) s \<le> distance C s

goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distance (C \<union> {furthest_from C}) s \<le> distance C s

goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
have " ... \<le> distance C (furthest_from C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distance C s \<le> distance C (furthest_from C)
[PROOF STEP]
using Max.coboundedI local_assm finite_distances radius_def furthest_from_C_props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; ?a \<in> ?A\<rbrakk> \<Longrightarrow> ?a \<le> Max ?A
s \<in> S
finite (distance ?C ` S)
radius ?C = Max (distance ?C ` S)
furthest_from C \<in> S \<and> distance C (furthest_from C) = radius C

goal (1 subgoal):
 1. distance C s \<le> distance C (furthest_from C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distance C s \<le> distance C (furthest_from C)

goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distance C s \<le> distance C (furthest_from C)

goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
have " ... \<le> 2 * radius C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distance C (furthest_from C) \<le> 2 * radius C'
[PROOF STEP]
using main_assm
[PROOF STATE]
proof (prove)
using this:
distance C (furthest_from C) \<le> 2 * radius C'

goal (1 subgoal):
 1. distance C (furthest_from C) \<le> 2 * radius C'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distance C (furthest_from C) \<le> 2 * radius C'

goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'

goal (1 subgoal):
 1. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'

goal (1 subgoal):
 1. distance C (furthest_from C) \<le> 2 * radius C' \<Longrightarrow> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'

goal (1 subgoal):
 1. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>C'. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (C \<union> {furthest_from C}) \<le> k
C \<union> {furthest_from C} \<noteq> {}
C \<union> {furthest_from C} \<subseteq> S
\<forall>C'. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (C \<union> {furthest_from C}) \<le> k
C \<union> {furthest_from C} \<noteq> {}
C \<union> {furthest_from C} \<subseteq> S
\<forall>C'. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
using this:
card (C \<union> {furthest_from C}) \<le> k
C \<union> {furthest_from C} \<noteq> {}
C \<union> {furthest_from C} \<subseteq> S
\<forall>C'. (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C') \<or> (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2)

goal (1 subgoal):
 1. C \<union> {furthest_from C} \<noteq> {} \<and> card (C \<union> {furthest_from C}) \<le> k \<and> C \<union> {furthest_from C} \<subseteq> S \<and> (\<forall>C'. (\<forall>c\<^sub>1\<in>C \<union> {furthest_from C}. \<forall>c\<^sub>2\<in>C \<union> {furthest_from C}. c\<^sub>1 \<noteq> c\<^sub>2 \<longrightarrow> 2 * radius C' < dist c\<^sub>1 c\<^sub>2) \<or> (\<forall>s\<in>S. distance (C \<union> {furthest_from C}) s \<le> 2 * radius C'))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
invar (C \<union> {furthest_from C})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_col_to_block_wf: "\<And>c. c \<in> set (cols M) \<Longrightarrow> map_col_to_block c \<subseteq> {0..<dim_row M}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c. c \<in> set (cols M) \<Longrightarrow> map_col_to_block c \<subseteq> {0..<dim_row M}
[PROOF STEP]
by (auto simp add: map_col_to_block_def)(metis dim_col obtain_col_index)


[STATEMENT]
lemma integrable_on_scaleR_left:
  assumes "f integrable_on A"
  shows "(\<lambda>x. f x *\<^sub>R y) integrable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x *\<^sub>R y) integrable_on A
[PROOF STEP]
using assms has_integral_scaleR_left
[PROOF STATE]
proof (prove)
using this:
f integrable_on A
(?f has_integral ?y) ?S \<Longrightarrow> ((\<lambda>x. ?f x *\<^sub>R ?c) has_integral ?y *\<^sub>R ?c) ?S

goal (1 subgoal):
 1. (\<lambda>x. f x *\<^sub>R y) integrable_on A
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
using this:
\<exists>y. (f has_integral y) A
(?f has_integral ?y) ?S \<Longrightarrow> ((\<lambda>x. ?f x *\<^sub>R ?c) has_integral ?y *\<^sub>R ?c) ?S

goal (1 subgoal):
 1. \<exists>ya. ((\<lambda>x. f x *\<^sub>R y) has_integral ya) A
[PROOF STEP]
by blast


[STATEMENT]
lemma in_abs_intervalI1:
  "lx < 0 \<Longrightarrow> 0 < ux \<Longrightarrow> 0 \<le> xa \<Longrightarrow> xa \<le> max (- lx) (ux) \<Longrightarrow> xa \<in> abs ` {lx..ux}"
  for xa::"'a::linordered_idom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>lx < (0::'a); (0::'a) < ux; (0::'a) \<le> xa; xa \<le> max (- lx) ux\<rbrakk> \<Longrightarrow> xa \<in> abs ` {lx..ux}
[PROOF STEP]
by (metis abs_minus_cancel abs_of_nonneg atLeastAtMost_iff image_eqI le_less le_max_iff_disj
      le_minus_iff neg_le_0_iff_le order_trans)


[STATEMENT]
lemma l9_9_bis:
  assumes "P Q OS A B"
  shows "\<not> P Q TS A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> P Q TS A B
[PROOF STEP]
using assms l9_9
[PROOF STATE]
proof (prove)
using this:
P Q OS A B
?P ?Q TS ?A ?B \<Longrightarrow> \<not> ?P ?Q OS ?A ?B

goal (1 subgoal):
 1. \<not> P Q TS A B
[PROOF STEP]
by blast


[STATEMENT]
lemma acomplete_Node_if_wbal1:
assumes "acomplete l" "acomplete r" "size l = size r + 1"
shows "acomplete \<langle>l, x, r\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
from assms(3)
[PROOF STATE]
proof (chain)
picking this:
size l = size r + 1
[PROOF STEP]
have [simp]: "size1 l = size1 r + 1"
[PROOF STATE]
proof (prove)
using this:
size l = size r + 1

goal (1 subgoal):
 1. size1 l = size1 r + 1
[PROOF STEP]
by(simp add: size1_size)
[PROOF STATE]
proof (state)
this:
size1 l = size1 r + 1

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
have "nat \<lceil>log 2 (1 + size1 r)\<rceil> \<ge> nat \<lceil>log 2 (size1 r)\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat \<lceil>log 2 (real (size1 r))\<rceil> \<le> nat \<lceil>log 2 (real (1 + size1 r))\<rceil>
[PROOF STEP]
by(rule nat_mono[OF ceiling_mono]) simp
[PROOF STATE]
proof (state)
this:
nat \<lceil>log 2 (real (size1 r))\<rceil> \<le> nat \<lceil>log 2 (real (1 + size1 r))\<rceil>

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
hence 1: "height(Node l x r) = nat \<lceil>log 2 (1 + size1 r)\<rceil> + 1"
[PROOF STATE]
proof (prove)
using this:
nat \<lceil>log 2 (real (size1 r))\<rceil> \<le> nat \<lceil>log 2 (real (1 + size1 r))\<rceil>

goal (1 subgoal):
 1. height \<langle>l, x, r\<rangle> = nat \<lceil>log 2 (real (1 + size1 r))\<rceil> + 1
[PROOF STEP]
using height_acomplete[OF assms(1)] height_acomplete[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
nat \<lceil>log 2 (real (size1 r))\<rceil> \<le> nat \<lceil>log 2 (real (1 + size1 r))\<rceil>
height l = nat \<lceil>log 2 (real (size1 l))\<rceil>
height r = nat \<lceil>log 2 (real (size1 r))\<rceil>

goal (1 subgoal):
 1. height \<langle>l, x, r\<rangle> = nat \<lceil>log 2 (real (1 + size1 r))\<rceil> + 1
[PROOF STEP]
by (simp del: nat_ceiling_le_eq add: max_def)
[PROOF STATE]
proof (state)
this:
height \<langle>l, x, r\<rangle> = nat \<lceil>log 2 (real (1 + size1 r))\<rceil> + 1

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
have "nat \<lfloor>log 2 (1 + size1 r)\<rfloor> \<ge> nat \<lfloor>log 2 (size1 r)\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat \<lfloor>log 2 (real (size1 r))\<rfloor> \<le> nat \<lfloor>log 2 (real (1 + size1 r))\<rfloor>
[PROOF STEP]
by(rule nat_mono[OF floor_mono]) simp
[PROOF STATE]
proof (state)
this:
nat \<lfloor>log 2 (real (size1 r))\<rfloor> \<le> nat \<lfloor>log 2 (real (1 + size1 r))\<rfloor>

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
hence 2: "min_height(Node l x r) = nat \<lfloor>log 2 (size1 r)\<rfloor> + 1"
[PROOF STATE]
proof (prove)
using this:
nat \<lfloor>log 2 (real (size1 r))\<rfloor> \<le> nat \<lfloor>log 2 (real (1 + size1 r))\<rfloor>

goal (1 subgoal):
 1. min_height \<langle>l, x, r\<rangle> = nat \<lfloor>log 2 (real (size1 r))\<rfloor> + 1
[PROOF STEP]
using min_height_acomplete[OF assms(1)] min_height_acomplete[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
nat \<lfloor>log 2 (real (size1 r))\<rfloor> \<le> nat \<lfloor>log 2 (real (1 + size1 r))\<rfloor>
min_height l = nat \<lfloor>log 2 (real (size1 l))\<rfloor>
min_height r = nat \<lfloor>log 2 (real (size1 r))\<rfloor>

goal (1 subgoal):
 1. min_height \<langle>l, x, r\<rangle> = nat \<lfloor>log 2 (real (size1 r))\<rfloor> + 1
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
min_height \<langle>l, x, r\<rangle> = nat \<lfloor>log 2 (real (size1 r))\<rfloor> + 1

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
have "size1 r \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> size1 r
[PROOF STEP]
by(simp add: size1_size)
[PROOF STATE]
proof (state)
this:
1 \<le> size1 r

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> size1 r
[PROOF STEP]
obtain i where i: "2 ^ i \<le> size1 r" "size1 r < 2 ^ (i + 1)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> size1 r

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>2 ^ i \<le> size1 r; size1 r < 2 ^ (i + 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_power_ivl1[of 2 "size1 r"]
[PROOF STATE]
proof (prove)
using this:
1 \<le> size1 r
\<lbrakk>2 \<le> 2; 1 \<le> size1 r\<rbrakk> \<Longrightarrow> \<exists>n. 2 ^ n \<le> size1 r \<and> size1 r < 2 ^ (n + 1)

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>2 ^ i \<le> size1 r; size1 r < 2 ^ (i + 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ i \<le> size1 r
size1 r < 2 ^ (i + 1)

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
hence i1: "2 ^ i < size1 r + 1" "size1 r + 1 \<le> 2 ^ (i + 1)"
[PROOF STATE]
proof (prove)
using this:
2 ^ i \<le> size1 r
size1 r < 2 ^ (i + 1)

goal (1 subgoal):
 1. 2 ^ i < size1 r + 1 &&& size1 r + 1 \<le> 2 ^ (i + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ i < size1 r + 1
size1 r + 1 \<le> 2 ^ (i + 1)

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
from 1 2 floor_log_nat_eq_if[OF i] ceiling_log_nat_eq_if[OF i1]
[PROOF STATE]
proof (chain)
picking this:
height \<langle>l, x, r\<rangle> = nat \<lceil>log 2 (real (1 + size1 r))\<rceil> + 1
min_height \<langle>l, x, r\<rangle> = nat \<lfloor>log 2 (real (size1 r))\<rfloor> + 1
2 \<le> 2 \<Longrightarrow> \<lfloor>log (real 2) (real (size1 r))\<rfloor> = int i
2 \<le> 2 \<Longrightarrow> \<lceil>log (real 2) (real (size1 r + 1))\<rceil> = int i + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
height \<langle>l, x, r\<rangle> = nat \<lceil>log 2 (real (1 + size1 r))\<rceil> + 1
min_height \<langle>l, x, r\<rangle> = nat \<lfloor>log 2 (real (size1 r))\<rfloor> + 1
2 \<le> 2 \<Longrightarrow> \<lfloor>log (real 2) (real (size1 r))\<rfloor> = int i
2 \<le> 2 \<Longrightarrow> \<lceil>log (real 2) (real (size1 r + 1))\<rceil> = int i + 1

goal (1 subgoal):
 1. acomplete \<langle>l, x, r\<rangle>
[PROOF STEP]
by(simp add:acomplete_def)
[PROOF STATE]
proof (state)
this:
acomplete \<langle>l, x, r\<rangle>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_smallest[simp]:
assumes "j \<in> Field r" shows "(zero, j) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (zero, j) \<in> r
[PROOF STEP]
unfolding zero_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (local.minim (Field r), j) \<in> r
[PROOF STEP]
by (metis AboveS_Field assms subset_AboveS_UnderS subset_antisym subset_refl suc_def suc_least_AboveS)


[STATEMENT]
theorem wls_psubstEnv_vsubstEnv_compose:
assumes "wlsEnv rho" and "wlsEnv rho'"
shows "((rho &[y1 // y]_ys) &[rho']) = (rho &[(rho' [y \<leftarrow> ((Var ys y1) #[rho'])]_ys)])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[y1 // y]_ys &[rho'] = rho &[rho' [y \<leftarrow> Var ys y1 #[rho']]_ys]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho
wlsEnv rho'

goal (1 subgoal):
 1. rho &[y1 // y]_ys &[rho'] = rho &[rho' [y \<leftarrow> Var ys y1 #[rho']]_ys]
[PROOF STEP]
by(simp add: psubstEnv_vsubstEnv_compose)


[STATEMENT]
lemma (in order_topology) decreasing_tendsto:
  assumes bdd: "eventually (\<lambda>n. l \<le> f n) F"
    and en: "\<And>x. l < x \<Longrightarrow> eventually (\<lambda>n. f n < x) F"
  shows "(f \<longlongrightarrow> l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> l) F
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. l \<le> f n
l < ?x \<Longrightarrow> \<forall>\<^sub>F n in F. f n < ?x

goal (1 subgoal):
 1. (f \<longlongrightarrow> l) F
[PROOF STEP]
by (intro order_tendstoI) (auto elim!: eventually_mono)


[STATEMENT]
lemma val_ring_times_closed:
  assumes "a \<in> \<O>\<^sub>p"
  assumes "b \<in> \<O>\<^sub>p"
  shows "a \<otimes> b \<in> \<O>\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes> b \<in> \<O>\<^sub>p
[PROOF STEP]
using val_ring_subring subringE(6)
[PROOF STATE]
proof (prove)
using this:
subring \<O>\<^sub>p Q\<^sub>p
\<lbrakk>subring ?H ?R; ?h1.0 \<in> ?H; ?h2.0 \<in> ?H\<rbrakk> \<Longrightarrow> ?h1.0 \<otimes>\<^bsub>?R\<^esub> ?h2.0 \<in> ?H

goal (1 subgoal):
 1. a \<otimes> b \<in> \<O>\<^sub>p
[PROOF STEP]
by (metis assms(1) assms(2))


[STATEMENT]
lemma odot_\<G>: "X \<subseteq> \<G> \<Longrightarrow> Y \<subseteq> \<G> \<Longrightarrow> X \<odot> Y \<subseteq> \<G>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<subseteq> \<G>; Y \<subseteq> \<G>\<rbrakk> \<Longrightarrow> X \<odot> Y \<subseteq> \<G>
[PROOF STEP]
unfolding odot_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<subseteq> \<G>; Y \<subseteq> \<G>\<rbrakk> \<Longrightarrow> {D \<union> E |D E. D \<in> X \<and> E \<in> Y} \<subseteq> \<G>
[PROOF STEP]
by auto


[STATEMENT]
lemma well_base_image_inj: "well_base M \<Longrightarrow> inj_on f (set_mset M) \<Longrightarrow> well_base (image_mset f M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.well_base M; inj_on f (set_mset M)\<rbrakk> \<Longrightarrow> local.well_base (image_mset f M)
[PROOF STEP]
unfolding well_base.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>Ma. M = Ma \<and> (\<forall>n. count Ma n < base); inj_on f (set_mset M)\<rbrakk> \<Longrightarrow> \<exists>Ma. image_mset f M = Ma \<and> (\<forall>n. count Ma n < base)
[PROOF STEP]
by (metis count_image_mset_le_count_inj_on le_less_trans)


[STATEMENT]
lemma bound_on_all_plans_bounds_problem_plan_bound_charles_i:
  fixes PROB :: "'a problem"
  assumes "finite PROB" "\<forall>x \<in> MPLS_charles PROB. x < k"
  shows "Sup (MPLS_charles PROB) \<in> MPLS_charles PROB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (MPLS_charles PROB) \<in> MPLS_charles PROB
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup (MPLS_charles PROB) \<in> MPLS_charles PROB
[PROOF STEP]
have 1: "MPLS_charles PROB \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPLS_charles PROB \<noteq> {}
[PROOF STEP]
using assms(1) bound_main_lemma_charles_3
[PROOF STATE]
proof (prove)
using this:
finite PROB
finite ?PROB \<Longrightarrow> MPLS_charles ?PROB \<noteq> {}

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

goal (1 subgoal):
 1. Sup (MPLS_charles PROB) \<in> MPLS_charles PROB
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
MPLS_charles PROB \<noteq> {}
[PROOF STEP]
have "finite (MPLS_charles PROB)"
[PROOF STATE]
proof (prove)
using this:
MPLS_charles PROB \<noteq> {}

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

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

goal (1 subgoal):
 1. Sup (MPLS_charles PROB) \<in> MPLS_charles PROB
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (MPLS_charles PROB)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (MPLS_charles PROB)

goal (1 subgoal):
 1. Sup (MPLS_charles PROB) \<in> MPLS_charles PROB
[PROOF STEP]
unfolding Sup_nat_def
[PROOF STATE]
proof (prove)
using this:
finite (MPLS_charles PROB)

goal (1 subgoal):
 1. (if MPLS_charles PROB = {} then 0 else Max (MPLS_charles PROB)) \<in> MPLS_charles PROB
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
finite (MPLS_charles PROB)
MPLS_charles PROB \<noteq> {}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_sesquilinear_cinner:
  "bounded_sesquilinear (cinner::'a::complex_inner \<Rightarrow> 'a \<Rightarrow> complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_sesquilinear cinner
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>a a' b. cinner (a + a') b = cinner a b + cinner a' b
 2. \<And>a b b'. cinner a (b + b') = cinner a b + cinner a b'
 3. \<And>r a b. cinner (r *\<^sub>C a) b = cnj r *\<^sub>C cinner a b
 4. \<And>a r b. cinner a (r *\<^sub>C b) = r *\<^sub>C cinner a b
 5. \<exists>K. \<forall>a b. cmod (cinner a b) \<le> norm a * norm b * K
[PROOF STEP]
fix x y z :: 'a and r :: complex
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>a a' b. cinner (a + a') b = cinner a b + cinner a' b
 2. \<And>a b b'. cinner a (b + b') = cinner a b + cinner a b'
 3. \<And>r a b. cinner (r *\<^sub>C a) b = cnj r *\<^sub>C cinner a b
 4. \<And>a r b. cinner a (r *\<^sub>C b) = r *\<^sub>C cinner a b
 5. \<exists>K. \<forall>a b. cmod (cinner a b) \<le> norm a * norm b * K
[PROOF STEP]
show "cinner (x + y) z = cinner x z + cinner y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner (x + y) z = cinner x z + cinner y z
[PROOF STEP]
by (rule cinner_add_left)
[PROOF STATE]
proof (state)
this:
cinner (x + y) z = cinner x z + cinner y z

goal (4 subgoals):
 1. \<And>a b b'. cinner a (b + b') = cinner a b + cinner a b'
 2. \<And>r a b. cinner (r *\<^sub>C a) b = cnj r *\<^sub>C cinner a b
 3. \<And>a r b. cinner a (r *\<^sub>C b) = r *\<^sub>C cinner a b
 4. \<exists>K. \<forall>a b. cmod (cinner a b) \<le> norm a * norm b * K
[PROOF STEP]
show "cinner x (y + z) = cinner x y + cinner x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner x (y + z) = cinner x y + cinner x z
[PROOF STEP]
by (rule cinner_add_right)
[PROOF STATE]
proof (state)
this:
cinner x (y + z) = cinner x y + cinner x z

goal (3 subgoals):
 1. \<And>r a b. cinner (r *\<^sub>C a) b = cnj r *\<^sub>C cinner a b
 2. \<And>a r b. cinner a (r *\<^sub>C b) = r *\<^sub>C cinner a b
 3. \<exists>K. \<forall>a b. cmod (cinner a b) \<le> norm a * norm b * K
[PROOF STEP]
show "cinner (scaleC r x) y = scaleC (cnj r) (cinner x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner (r *\<^sub>C x) y = cnj r *\<^sub>C cinner x y
[PROOF STEP]
unfolding complex_scaleC_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner (r *\<^sub>C x) y = cnj r * cinner x y
[PROOF STEP]
by (rule cinner_scaleC_left)
[PROOF STATE]
proof (state)
this:
cinner (r *\<^sub>C x) y = cnj r *\<^sub>C cinner x y

goal (2 subgoals):
 1. \<And>a r b. cinner a (r *\<^sub>C b) = r *\<^sub>C cinner a b
 2. \<exists>K. \<forall>a b. cmod (cinner a b) \<le> norm a * norm b * K
[PROOF STEP]
show "cinner x (scaleC r y) = scaleC r (cinner x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner x (r *\<^sub>C y) = r *\<^sub>C cinner x y
[PROOF STEP]
unfolding complex_scaleC_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner x (r *\<^sub>C y) = r * cinner x y
[PROOF STEP]
by (rule cinner_scaleC_right)
[PROOF STATE]
proof (state)
this:
cinner x (r *\<^sub>C y) = r *\<^sub>C cinner x y

goal (1 subgoal):
 1. \<exists>K. \<forall>a b. cmod (cinner a b) \<le> norm a * norm b * K
[PROOF STEP]
have "\<forall>x y::'a. norm (cinner x y) \<le> norm x * norm y * 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. cmod (cinner x y) \<le> norm x * norm y * 1
[PROOF STEP]
by (simp add: complex_inner_class.Cauchy_Schwarz_ineq2)
[PROOF STATE]
proof (state)
this:
\<forall>x y. cmod (cinner x y) \<le> norm x * norm y * 1

goal (1 subgoal):
 1. \<exists>K. \<forall>a b. cmod (cinner a b) \<le> norm a * norm b * K
[PROOF STEP]
thus "\<exists>K. \<forall>x y::'a. norm (cinner x y) \<le> norm x * norm y * K"
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. cmod (cinner x y) \<le> norm x * norm y * 1

goal (1 subgoal):
 1. \<exists>K. \<forall>x y. cmod (cinner x y) \<le> norm x * norm y * K
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>K. \<forall>x y. cmod (cinner x y) \<le> norm x * norm y * K

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sq_norm_pos:
  assumes j: "j < m"
  shows "sq_norm (gso j) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0::'a) < \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
j < length fs
[PROOF STEP]
have jj: "j < m - 0"
[PROOF STATE]
proof (prove)
using this:
j < length fs

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

goal (1 subgoal):
 1. (0::'a) < \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
from orthogonalD[OF orthogonal_gso, unfolded length_map length_upt, OF jj jj] assms
[PROOF STATE]
proof (chain)
picking this:
(map gso [0..<length fs] ! j \<bullet> map gso [0..<length fs] ! j = (0::'a)) = (j \<noteq> j)
j < length fs
[PROOF STEP]
have "sq_norm (gso j) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
(map gso [0..<length fs] ! j \<bullet> map gso [0..<length fs] ! j = (0::'a)) = (j \<noteq> j)
j < length fs

goal (1 subgoal):
 1. \<parallel>gso j\<parallel>\<^sup>2 \<noteq> (0::'a)
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
(map gso [0..<length fs] ! j \<bullet> map gso [0..<length fs] ! j = (0::'a)) = (j \<noteq> j)
j < length fs
j < length fs

goal (1 subgoal):
 1. \<parallel>gso j\<parallel>\<^sup>2 \<noteq> (0::'a)
[PROOF STEP]
by (simp add: sq_norm_vec_as_cscalar_prod)
[PROOF STATE]
proof (state)
this:
\<parallel>gso j\<parallel>\<^sup>2 \<noteq> (0::'a)

goal (1 subgoal):
 1. (0::'a) < \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<parallel>gso j\<parallel>\<^sup>2 \<noteq> (0::'a)

goal (1 subgoal):
 1. (0::'a) < \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "sq_norm (gso j) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> \<parallel>gso j\<parallel>\<^sup>2

goal (1 subgoal):
 1. (0::'a) < \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<parallel>gso j\<parallel>\<^sup>2 \<noteq> (0::'a)
(0::'a) \<le> \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
show "0 < sq_norm (gso j)"
[PROOF STATE]
proof (prove)
using this:
\<parallel>gso j\<parallel>\<^sup>2 \<noteq> (0::'a)
(0::'a) \<le> \<parallel>gso j\<parallel>\<^sup>2

goal (1 subgoal):
 1. (0::'a) < \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) < \<parallel>gso j\<parallel>\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma starfunC_approx_Re_Im_iff:
  "( *f* f) x \<approx> z \<longleftrightarrow> ( *f* (\<lambda>x. Re (f x))) x \<approx> hRe z \<and> ( *f* (\<lambda>x. Im (f x))) x \<approx> hIm z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((*f* f) x \<approx> z) = ((*f* (\<lambda>x. Re (f x))) x \<approx> hRe z \<and> (*f* (\<lambda>x. Im (f x))) x \<approx> hIm z)
[PROOF STEP]
by (simp add: hcomplex_approx_iff starfun_Re starfun_Im)


[STATEMENT]
lemma contr_before_normalize1:
  "\<lbrakk>is_subtree (Node v {|(t1,e1)|}) (normalize1 t3); rank (rev (root t1)) < rank (rev v)\<rbrakk>
    \<Longrightarrow> \<exists>v' t2 e2. is_subtree (Node v' {|(t2,e2)|}) t3 \<and> rank (rev (root t2)) < rank (rev v')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_subtree (Node v {|(t1, e1)|}) (normalize1 t3); rank (rev (dtree.root t1)) < rank (rev v)\<rbrakk> \<Longrightarrow> \<exists>v' t2 e2. is_subtree (Node v' {|(t2, e2)|}) t3 \<and> rank (rev (dtree.root t2)) < rank (rev v')
[PROOF STEP]
using contr_if_normalize1_uneq
[PROOF STATE]
proof (prove)
using this:
normalize1 ?t1.0 \<noteq> ?t1.0 \<Longrightarrow> \<exists>v t2 e2. is_subtree (Node v {|(t2, e2)|}) ?t1.0 \<and> rank (rev (dtree.root t2)) < rank (rev v)

goal (1 subgoal):
 1. \<lbrakk>is_subtree (Node v {|(t1, e1)|}) (normalize1 t3); rank (rev (dtree.root t1)) < rank (rev v)\<rbrakk> \<Longrightarrow> \<exists>v' t2 e2. is_subtree (Node v' {|(t2, e2)|}) t3 \<and> rank (rev (dtree.root t2)) < rank (rev v')
[PROOF STEP]
by force


[STATEMENT]
lemma prime_cop_exp_poly_mod:
  assumes prime: "prime p" and cop: "coprime c p" and n: "n \<noteq> 0"
  shows "poly_mod.M (p^n) c \<in> {1 ..< p^n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.M (p ^ n) c \<in> {1..<p ^ n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mod.M (p ^ n) c \<in> {1..<p ^ n}
[PROOF STEP]
from prime
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have p1: "p > 1"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. 1 < p
[PROOF STEP]
by (simp add: prime_int_iff)
[PROOF STATE]
proof (state)
this:
1 < p

goal (1 subgoal):
 1. poly_mod.M (p ^ n) c \<in> {1..<p ^ n}
[PROOF STEP]
interpret poly_mod_2 "p^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod_2 (p ^ n)
[PROOF STEP]
unfolding poly_mod_2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < p ^ n
[PROOF STEP]
using p1 n
[PROOF STATE]
proof (prove)
using this:
1 < p
n \<noteq> 0

goal (1 subgoal):
 1. 1 < p ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M c \<in> {1..<p ^ n}
[PROOF STEP]
from cop p1 m1
[PROOF STATE]
proof (chain)
picking this:
comm_monoid_mult_class.coprime c p
1 < p
1 < p ^ n
[PROOF STEP]
have "M c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
comm_monoid_mult_class.coprime c p
1 < p
1 < p ^ n

goal (1 subgoal):
 1. M c \<noteq> 0
[PROOF STEP]
by (auto simp add: M_def)
[PROOF STATE]
proof (state)
this:
M c \<noteq> 0

goal (1 subgoal):
 1. M c \<in> {1..<p ^ n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
M c \<noteq> 0

goal (1 subgoal):
 1. M c \<in> {1..<p ^ n}
[PROOF STEP]
have "M c < p^n" "M c \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M c < p ^ n &&& 0 \<le> M c
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c mod p ^ n < p ^ n &&& 0 \<le> c mod p ^ n
[PROOF STEP]
using m1
[PROOF STATE]
proof (prove)
using this:
1 < p ^ n

goal (1 subgoal):
 1. c mod p ^ n < p ^ n &&& 0 \<le> c mod p ^ n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M c < p ^ n
0 \<le> M c

goal (1 subgoal):
 1. M c \<in> {1..<p ^ n}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
M c \<noteq> 0
M c < p ^ n
0 \<le> M c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
M c \<noteq> 0
M c < p ^ n
0 \<le> M c

goal (1 subgoal):
 1. M c \<in> {1..<p ^ n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M c \<in> {1..<p ^ n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma epsclo_Un [simp]: "epsclo (Q1 \<union> Q2) = epsclo Q1 \<union> epsclo Q2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. epsclo (Q1 \<union> Q2) = epsclo Q1 \<union> epsclo Q2
[PROOF STEP]
by (auto simp: epsclo_def)


[STATEMENT]
lemma lm_ball_Assoc_List_set:
  "lm.ball m P \<longleftrightarrow> (\<forall>x \<in> Assoc_List.set m. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lm.ball m P = (\<forall>x\<in>Assoc_List.set m. P x)
[PROOF STEP]
unfolding Assoc_List.set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lm.ball m P = (\<forall>x\<in>set (assoc_list.impl_of m). P x)
[PROOF STEP]
by (simp add: icf_rec_unf lm_basic.g_ball_def
    poly_map_iteratei_defs.iteratei_def it_to_it_def Assoc_List.iteratei_def
    foldli_conj)


[STATEMENT]
lemma in_set_real_times_interval[intro, simp]:
  "x * y \<in>\<^sub>r X * Y" if "x \<in>\<^sub>r X" "y \<in>\<^sub>r Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y \<in>\<^sub>r X * Y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>r X
y \<in>\<^sub>r Y

goal (1 subgoal):
 1. x * y \<in>\<^sub>r X * Y
[PROOF STEP]
by (auto simp: real_interval_times intro!: times_in_intervalI)


[STATEMENT]
lemma path_components_eq_connected_components_of:
   "locally_path_connected_space X \<Longrightarrow> (path_components_of X = connected_components_of X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally_path_connected_space X \<Longrightarrow> path_components_of X = connected_components_of X
[PROOF STEP]
by (simp add: path_components_of_def connected_components_of_def image_def path_component_eq_connected_component_of)


[STATEMENT]
lemma cont_custom_arccos:
  assumes "S \<subseteq> {-1..1}"
  shows "continuous_on S custom_arccos"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_on S (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)
[PROOF STEP]
have "continuous_on ({-1..1} \<union> {}) custom_arccos"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({- 1..1} \<union> {}) (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)
[PROOF STEP]
by (auto intro!: continuous_on_cases continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on ({- 1..1} \<union> {}) (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)

goal (1 subgoal):
 1. continuous_on S (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> {- 1..1}
continuous_on ({- 1..1} \<union> {}) (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {- 1..1}
continuous_on ({- 1..1} \<union> {}) (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)

goal (1 subgoal):
 1. continuous_on S (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)
[PROOF STEP]
using continuous_on_subset
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {- 1..1}
continuous_on ({- 1..1} \<union> {}) (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f

goal (1 subgoal):
 1. continuous_on S (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
continuous_on S (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma maxi_last [rule_format]:
 "xs \<noteq> [] \<longrightarrow> maxi xs key < i \<longrightarrow> i < length xs \<longrightarrow>
    key (xs ! i) < key (xs ! maxi xs key)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<longrightarrow> maxi xs key < i \<longrightarrow> i < length xs \<longrightarrow> key (xs ! i) < key (xs ! maxi xs key)
[PROOF STEP]
by (induction xs arbitrary: i, simp_all add: Let_def, (rule impI)+,
 rule le_less_trans, rule maxi_ub, rule nth_mem, simp)


[STATEMENT]
lemma diag_el_to_idx_bij:
  shows "bij_betw (diag_el_to_idx B) (diag_elems B) {..< dist_el_card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (diag_el_to_idx B) (diag_elems B) {..<dist_el_card B}
[PROOF STEP]
unfolding diag_el_to_idx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (inv_into {..<dist_el_card B} (diag_idx_to_el B)) (diag_elems B) {..<dist_el_card B}
[PROOF STEP]
proof (rule bij_betw_inv_into_subset[of _ _ "diag_elems B"], (simp add: diag_idx_to_el_bij)+)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. diag_idx_to_el B ` {..<dist_el_card B} = diag_elems B
[PROOF STEP]
show "diag_idx_to_el B ` {..<dist_el_card B} = diag_elems B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_idx_to_el B ` {..<dist_el_card B} = diag_elems B
[PROOF STEP]
by (simp add: diag_idx_to_el_bij bij_betw_imp_surj_on)
[PROOF STATE]
proof (state)
this:
diag_idx_to_el B ` {..<dist_el_card B} = diag_elems B

goal:
No subgoals!
[PROOF STEP]
qed


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

goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator g s = Skip x2 \<Longrightarrow> unstream (splice_trans g h) (Left_only x2) = unstream g x2; \<And>x31 x32. generator g s = Yield x31 x32 \<Longrightarrow> unstream (splice_trans g h) (Left_only x32) = unstream g x32\<rbrakk> \<Longrightarrow> unstream (splice_trans g h) (Left_only s) = unstream g s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
generator g sg = Skip ?x2.0 \<Longrightarrow> unstream (splice_trans g h) (Left_only ?x2.0) = unstream g ?x2.0
generator g sg = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (splice_trans g h) (Left_only ?x32.0) = unstream g ?x32.0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
generator g sg = Skip ?x2.0 \<Longrightarrow> unstream (splice_trans g h) (Left_only ?x2.0) = unstream g ?x2.0
generator g sg = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (splice_trans g h) (Left_only ?x32.0) = unstream g ?x32.0

goal (1 subgoal):
 1. unstream (splice_trans g h) (Left_only sg) = unstream g sg
[PROOF STEP]
by (cases "generator g sg")(simp_all add: splice_trans.rep_eq)
[PROOF STATE]
proof (state)
this:
unstream (splice_trans g h) (Left_only sg) = unstream g sg

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_all2_upt_append: "list_all2 P [a..<b] xs \<Longrightarrow> list_all2 P [b..<c] ys \<Longrightarrow>
  a \<le> b \<Longrightarrow> b \<le> c \<Longrightarrow> list_all2 P [a..<c] (xs @ ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 P [a..<b] xs; list_all2 P [b..<c] ys; a \<le> b; b \<le> c\<rbrakk> \<Longrightarrow> list_all2 P [a..<c] (xs @ ys)
[PROOF STEP]
by (induction xs arbitrary: a) (auto simp add: list_all2_Cons2 upt_eq_Cons_conv)


[STATEMENT]
lemma has_derivative_in_compose2:
  assumes "\<And>x. x \<in> t \<Longrightarrow> (g has_derivative g' x) (at x within t)"
  assumes "f ` s \<subseteq> t" "x \<in> s"
  assumes "(f has_derivative f') (at x within s)"
  shows "((\<lambda>x. g (f x)) has_derivative (\<lambda>y. g' (f x) (f' y))) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g (f x)) has_derivative (\<lambda>y. g' (f x) (f' y))) (at x within s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> t \<Longrightarrow> (g has_derivative g' ?x) (at ?x within t)
f ` s \<subseteq> t
x \<in> s
(f has_derivative f') (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. g (f x)) has_derivative (\<lambda>y. g' (f x) (f' y))) (at x within s)
[PROOF STEP]
by (auto intro: has_derivative_subset intro!: has_derivative_in_compose[of f f' x s g])


[STATEMENT]
lemma agg_sum_not_bot:
  fixes f :: "('a::finite,'b::aggregation_order) square"
  assumes "f (i,j) \<noteq> bot"
    shows "(\<Sum>\<^sub>k \<Sum>\<^sub>l f (k,l)) \<noteq> bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. aggregation.sum_0 (\<lambda>l. f (k, l)) {l. True}) {k. True} \<noteq> bot
[PROOF STEP]
by (metis assms agg_sum_not_bot_1)


[STATEMENT]
lemma le1_SucE: assumes "1 \<le> n"
  obtains k where "n = Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. n = Suc k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc_le_D[OF assms[unfolded One_nat_def]]
[PROOF STATE]
proof (prove)
using this:
\<exists>m. n = Suc m

goal (1 subgoal):
 1. (\<And>k. n = Suc k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma evimage_eq [simp]: "a \<in> f \<inverse>\<^bsub>n\<^esub> B \<longleftrightarrow> a \<in> carrier (R\<^bsup>n\<^esup>) \<and> f a \<in> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> f \<inverse>\<^bsub>n\<^esub> B) = (a \<in> carrier (R\<^bsup>n\<^esup>) \<and> f a \<in> B)
[PROOF STEP]
unfolding evimage_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> f -` B \<inter> carrier (R\<^bsup>n\<^esup>)) = (a \<in> carrier (R\<^bsup>n\<^esup>) \<and> f a \<in> B)
[PROOF STEP]
by blast


[STATEMENT]
lemma star_mono: "L1 \<subseteq> L2 \<Longrightarrow> star L1 \<subseteq> star L2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L1 \<subseteq> L2 \<Longrightarrow> star L1 \<subseteq> star L2
[PROOF STEP]
apply (simp add: star_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L1 \<subseteq> L2 \<Longrightarrow> \<Union> (range ((^^) L1)) \<subseteq> \<Union> (range ((^^) L2))
[PROOF STEP]
apply (rule UN_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. L1 \<subseteq> L2 \<Longrightarrow> UNIV \<subseteq> UNIV
 2. \<And>n. \<lbrakk>L1 \<subseteq> L2; n \<in> UNIV\<rbrakk> \<Longrightarrow> L1 ^^ n \<subseteq> L2 ^^ n
[PROOF STEP]
apply (auto simp: power_mono)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma card_of_Times_assoc: "|(A \<times> B) \<times> C| =o |A \<times> B \<times> C|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |(A \<times> B) \<times> C| =o |A \<times> B \<times> C|
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |(A \<times> B) \<times> C| =o |A \<times> B \<times> C|
[PROOF STEP]
let ?f = "\<lambda>((a,b),c). (a,(b,c))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |(A \<times> B) \<times> C| =o |A \<times> B \<times> C|
[PROOF STEP]
have "A \<times> B \<times> C \<subseteq> ?f ` ((A \<times> B) \<times> C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<times> B \<times> C \<subseteq> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> B \<times> C \<Longrightarrow> x \<in> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> B \<times> C \<Longrightarrow> x \<in> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)
[PROOF STEP]
assume "x \<in> A \<times> B \<times> C"
[PROOF STATE]
proof (state)
this:
x \<in> A \<times> B \<times> C

goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> B \<times> C \<Longrightarrow> x \<in> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> A \<times> B \<times> C
[PROOF STEP]
obtain a b c where *: "a \<in> A" "b \<in> B" "c \<in> C" "x = (a, b, c)"
[PROOF STATE]
proof (prove)
using this:
x \<in> A \<times> B \<times> C

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

goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> B \<times> C \<Longrightarrow> x \<in> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)
[PROOF STEP]
let ?x = "((a, b), c)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> B \<times> C \<Longrightarrow> x \<in> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
b \<in> B
c \<in> C
x = (a, b, c)
[PROOF STEP]
have "?x \<in> (A \<times> B) \<times> C" "x = ?f ?x"
[PROOF STATE]
proof (prove)
using this:
a \<in> A
b \<in> B
c \<in> C
x = (a, b, c)

goal (1 subgoal):
 1. ((a, b), c) \<in> (A \<times> B) \<times> C &&& x = (case ((a, b), c) of (x, xa) \<Rightarrow> (case x of (a, b) \<Rightarrow> \<lambda>c. (a, b, c)) xa)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((a, b), c) \<in> (A \<times> B) \<times> C
x = (case ((a, b), c) of (x, xa) \<Rightarrow> (case x of (a, b) \<Rightarrow> \<lambda>c. (a, b, c)) xa)

goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> B \<times> C \<Longrightarrow> x \<in> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)
[PROOF STEP]
thus "x \<in> ?f ` ((A \<times> B) \<times> C)"
[PROOF STATE]
proof (prove)
using this:
((a, b), c) \<in> (A \<times> B) \<times> C
x = (case ((a, b), c) of (x, xa) \<Rightarrow> (case x of (a, b) \<Rightarrow> \<lambda>c. (a, b, c)) xa)

goal (1 subgoal):
 1. x \<in> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A \<times> B \<times> C \<subseteq> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)

goal (1 subgoal):
 1. |(A \<times> B) \<times> C| =o |A \<times> B \<times> C|
[PROOF STEP]
hence "bij_betw ?f ((A \<times> B) \<times> C) (A \<times> B \<times> C)"
[PROOF STATE]
proof (prove)
using this:
A \<times> B \<times> C \<subseteq> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)

goal (1 subgoal):
 1. bij_betw (\<lambda>((a, b), c). (a, b, c)) ((A \<times> B) \<times> C) (A \<times> B \<times> C)
[PROOF STEP]
unfolding bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
using this:
A \<times> B \<times> C \<subseteq> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C)

goal (1 subgoal):
 1. (\<forall>x\<in>(A \<times> B) \<times> C. \<forall>y\<in>(A \<times> B) \<times> C. (case x of (x, xa) \<Rightarrow> (case x of (a, b) \<Rightarrow> \<lambda>c. (a, b, c)) xa) = (case y of (x, xa) \<Rightarrow> (case x of (a, b) \<Rightarrow> \<lambda>c. (a, b, c)) xa) \<longrightarrow> x = y) \<and> (\<lambda>((a, b), c). (a, b, c)) ` ((A \<times> B) \<times> C) = A \<times> B \<times> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>((a, b), c). (a, b, c)) ((A \<times> B) \<times> C) (A \<times> B \<times> C)

goal (1 subgoal):
 1. |(A \<times> B) \<times> C| =o |A \<times> B \<times> C|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>((a, b), c). (a, b, c)) ((A \<times> B) \<times> C) (A \<times> B \<times> C)

goal (1 subgoal):
 1. |(A \<times> B) \<times> C| =o |A \<times> B \<times> C|
[PROOF STEP]
using card_of_ordIso
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>((a, b), c). (a, b, c)) ((A \<times> B) \<times> C) (A \<times> B \<times> C)
(\<exists>f. bij_betw f ?A ?B) = (|?A| =o |?B|)

goal (1 subgoal):
 1. |(A \<times> B) \<times> C| =o |A \<times> B \<times> C|
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
|(A \<times> B) \<times> C| =o |A \<times> B \<times> C|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem updown:
  assumes p_spg: "p \<in> sparsegrid dm lm"
  shows "updown dm lm \<alpha> p = (\<Sum> p' \<in> sparsegrid dm lm. \<alpha> p' * l2 p' p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. updown dm lm \<alpha> p = (\<Sum>p'\<in>sparsegrid dm lm. \<alpha> p' * l2 p' p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. updown dm lm \<alpha> p = (\<Sum>p'\<in>sparsegrid dm lm. \<alpha> p' * l2 p' p)
[PROOF STEP]
have "p \<in> sparsegrid' dm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> sparsegrid' dm
[PROOF STEP]
using p_spg
[PROOF STATE]
proof (prove)
using this:
p \<in> sparsegrid dm lm

goal (1 subgoal):
 1. p \<in> sparsegrid' dm
[PROOF STEP]
unfolding sparsegrid_def sparsegrid'_def lgrid_def
[PROOF STATE]
proof (prove)
using this:
p \<in> {p \<in> grid (start dm) {0..<dm}. level p < lm}

goal (1 subgoal):
 1. p \<in> grid (start dm) {0..<dm}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<in> sparsegrid' dm

goal (1 subgoal):
 1. updown dm lm \<alpha> p = (\<Sum>p'\<in>sparsegrid dm lm. \<alpha> p' * l2 p' p)
[PROOF STEP]
have "!!p'. p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length p' = dm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p'. p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length p' = dm
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p'. p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length p' = dm
[PROOF STEP]
fix p'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p'. p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length p' = dm
[PROOF STEP]
assume "p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm"
[PROOF STATE]
proof (state)
this:
p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm

goal (1 subgoal):
 1. \<And>p'. p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length p' = dm
[PROOF STEP]
with base_grid[OF \<open>p \<in> sparsegrid' dm\<close>]
[PROOF STATE]
proof (chain)
picking this:
grid (base ?ds p) ?ds \<subseteq> sparsegrid' dm
p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm
[PROOF STEP]
have "p' \<in> sparsegrid' dm"
[PROOF STATE]
proof (prove)
using this:
grid (base ?ds p) ?ds \<subseteq> sparsegrid' dm
p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm

goal (1 subgoal):
 1. p' \<in> sparsegrid' dm
[PROOF STEP]
unfolding lgrid_def
[PROOF STATE]
proof (prove)
using this:
grid (base ?ds p) ?ds \<subseteq> sparsegrid' dm
p' \<in> {pa \<in> grid (base {0..<dm} p) {0..<dm}. level pa < lm}

goal (1 subgoal):
 1. p' \<in> sparsegrid' dm
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p' \<in> sparsegrid' dm

goal (1 subgoal):
 1. \<And>p'. p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length p' = dm
[PROOF STEP]
thus "length p' = dm"
[PROOF STATE]
proof (prove)
using this:
p' \<in> sparsegrid' dm

goal (1 subgoal):
 1. length p' = dm
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length p' = dm

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length ?p' = dm

goal (1 subgoal):
 1. updown dm lm \<alpha> p = (\<Sum>p'\<in>sparsegrid dm lm. \<alpha> p' * l2 p' p)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length ?p' = dm

goal (1 subgoal):
 1. updown dm lm \<alpha> p = (\<Sum>p'\<in>sparsegrid dm lm. \<alpha> p' * l2 p' p)
[PROOF STEP]
unfolding updown_def sparsegrid_def base_start_eq[OF p_spg]
[PROOF STATE]
proof (prove)
using this:
?p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length ?p' = dm

goal (1 subgoal):
 1. updown' dm lm dm \<alpha> p = (\<Sum>p'\<in>lgrid (base {0..<dm} p) {0..<dm} lm. \<alpha> p' * l2 p' p)
[PROOF STEP]
using updown'[OF _ p_spg, where d=dm] p_spg[unfolded sparsegrid_def lgrid_def]
[PROOF STATE]
proof (prove)
using this:
?p' \<in> lgrid (base {0..<dm} p) {0..<dm} lm \<Longrightarrow> length ?p' = dm
dm \<le> dm \<Longrightarrow> updown' dm lm dm ?\<alpha> p = (\<Sum>p'\<in>lgrid (base {0..<dm} p) {0..<dm} lm. ?\<alpha> p' * (\<Prod>d' = 0..<dm. l2_\<phi> (p' ! d') (p ! d')))
p \<in> {p \<in> grid (start dm) {0..<dm}. level p < lm}

goal (1 subgoal):
 1. updown' dm lm dm \<alpha> p = (\<Sum>p'\<in>lgrid (base {0..<dm} p) {0..<dm} lm. \<alpha> p' * l2 p' p)
[PROOF STEP]
by (auto simp: atLeast0LessThan p_spg[THEN sparsegrid_length] l2_eq)
[PROOF STATE]
proof (state)
this:
updown dm lm \<alpha> p = (\<Sum>p'\<in>sparsegrid dm lm. \<alpha> p' * l2 p' p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equivp_rel_prod: "equivp R \<Longrightarrow> equivp Q \<Longrightarrow> equivp (rel_prod R Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>equivp R; equivp Q\<rbrakk> \<Longrightarrow> equivp (rel_prod R Q)
[PROOF STEP]
by (auto intro!: equivpI prod.rel_symp prod.rel_transp prod.rel_reflp elim: equivpE)


[STATEMENT]
lemma map_dual_inv_func2: "map_dual_inv (f \<circ> g) = map_dual_inv f \<circ> map_dual_inv g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_dual_inv (f \<circ> g) = map_dual_inv f \<circ> map_dual_inv g
[PROOF STEP]
unfolding fun_eq_iff comp_def map_dual_inv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<partial>\<^sup>- (f (g (\<partial> x))) = \<partial>\<^sup>- (f (\<partial> (\<partial>\<^sup>- (g (\<partial> x)))))
[PROOF STEP]
by (metis dual_iff)


[STATEMENT]
lemma minimal_elements_set_tuples_finite:
  assumes Ur: "\<And>x. x \<in> U \<Longrightarrow> length x = r"
  shows "finite (minimal_elements U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (minimal_elements U)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> U \<Longrightarrow> length ?x1 = r

goal (1 subgoal):
 1. finite (minimal_elements U)
[PROOF STEP]
proof (induction r arbitrary: U)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = 0) \<Longrightarrow> finite (minimal_elements U)
 2. \<And>r U. \<lbrakk>\<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements U); \<And>x. x \<in> U \<Longrightarrow> length x = Suc r\<rbrakk> \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?x1 \<in> U \<Longrightarrow> length ?x1 = 0

goal (2 subgoals):
 1. \<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = 0) \<Longrightarrow> finite (minimal_elements U)
 2. \<And>r U. \<lbrakk>\<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements U); \<And>x. x \<in> U \<Longrightarrow> length x = Suc r\<rbrakk> \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x1 \<in> U \<Longrightarrow> length ?x1 = 0
[PROOF STEP]
have "U \<subseteq> {[]}"
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> U \<Longrightarrow> length ?x1 = 0

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

goal (2 subgoals):
 1. \<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = 0) \<Longrightarrow> finite (minimal_elements U)
 2. \<And>r U. \<lbrakk>\<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements U); \<And>x. x \<in> U \<Longrightarrow> length x = Suc r\<rbrakk> \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
U \<subseteq> {[]}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
U \<subseteq> {[]}

goal (1 subgoal):
 1. finite (minimal_elements U)
[PROOF STEP]
by (metis finite.simps minimal_elements.cases finite_subset subset_eq)
[PROOF STATE]
proof (state)
this:
finite (minimal_elements U)

goal (1 subgoal):
 1. \<And>r U. \<lbrakk>\<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements U); \<And>x. x \<in> U \<Longrightarrow> length x = Suc r\<rbrakk> \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r U. \<lbrakk>\<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements U); \<And>x. x \<in> U \<Longrightarrow> length x = Suc r\<rbrakk> \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
case (Suc r)
[PROOF STATE]
proof (state)
this:
(\<And>x. x \<in> ?U1 \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements ?U1)
?x1 \<in> U \<Longrightarrow> length ?x1 = Suc r

goal (1 subgoal):
 1. \<And>r U. \<lbrakk>\<And>U. (\<And>x. x \<in> U \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements U); \<And>x. x \<in> U \<Longrightarrow> length x = Suc r\<rbrakk> \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (minimal_elements U)
[PROOF STEP]
proof (cases "U={}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. U = {} \<Longrightarrow> finite (minimal_elements U)
 2. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
U = {}

goal (2 subgoals):
 1. U = {} \<Longrightarrow> finite (minimal_elements U)
 2. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
with Suc.IH
[PROOF STATE]
proof (chain)
picking this:
(\<And>x. x \<in> ?U1 \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements ?U1)
U = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> ?U1 \<Longrightarrow> length x = r) \<Longrightarrow> finite (minimal_elements ?U1)
U = {}

goal (1 subgoal):
 1. finite (minimal_elements U)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (minimal_elements U)

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
U \<noteq> {}

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
U \<noteq> {}
[PROOF STEP]
obtain u where u: "u \<in> U" and zmin: "\<And>y. y \<lhd> u \<Longrightarrow> y \<notin> U"
[PROOF STATE]
proof (prove)
using this:
U \<noteq> {}

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> U; \<And>y. y \<lhd> u \<Longrightarrow> y \<notin> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using wfE_min [to_pred, where Q = "U", OF WFP]
[PROOF STATE]
proof (prove)
using this:
U \<noteq> {}
\<lbrakk>?x \<in> U; \<And>z. \<lbrakk>z \<in> U; \<And>y. y \<lhd> z \<Longrightarrow> y \<notin> U\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> U; \<And>y. y \<lhd> u \<Longrightarrow> y \<notin> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u \<in> U
?y1 \<lhd> u \<Longrightarrow> ?y1 \<notin> U

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
define V where "V = {v \<in> U. \<not> u \<unlhd> v}"
[PROOF STATE]
proof (state)
this:
V = {v \<in> U. \<not> u \<unlhd> v}

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
define VF where "VF \<equiv> \<lambda>i t. {v \<in> V. v!i = t}"
[PROOF STATE]
proof (state)
this:
VF \<equiv> \<lambda>i t. {v \<in> V. v ! i = t}

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
have [simp]: "length v = Suc r" if "v \<in> VF i t" for v i t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v = Suc r
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
v \<in> VF i t

goal (1 subgoal):
 1. length v = Suc r
[PROOF STEP]
by (simp add: Suc.prems VF_def V_def)
[PROOF STATE]
proof (state)
this:
?v1 \<in> VF ?i1 ?t1 \<Longrightarrow> length ?v1 = Suc r

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
have *: "\<exists>i\<le>r. v!i < u!i" if "v \<in> V" for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i\<le>r. v ! i < u ! i
[PROOF STEP]
using that u Suc.prems
[PROOF STATE]
proof (prove)
using this:
v \<in> V
u \<in> U
?x1 \<in> U \<Longrightarrow> length ?x1 = Suc r

goal (1 subgoal):
 1. \<exists>i\<le>r. v ! i < u ! i
[PROOF STEP]
by (force simp add: V_def pointwise_le_iff_nth not_le less_Suc_eq_le)
[PROOF STATE]
proof (state)
this:
?v1 \<in> V \<Longrightarrow> \<exists>i\<le>r. ?v1 ! i < u ! i

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
with u
[PROOF STATE]
proof (chain)
picking this:
u \<in> U
?v1 \<in> V \<Longrightarrow> \<exists>i\<le>r. ?v1 ! i < u ! i
[PROOF STEP]
have "minimal_elements U \<le> insert u (\<Union>i\<le>r. \<Union>t < u!i. minimal_elements (VF i t))"
[PROOF STATE]
proof (prove)
using this:
u \<in> U
?v1 \<in> V \<Longrightarrow> \<exists>i\<le>r. ?v1 ! i < u ! i

goal (1 subgoal):
 1. minimal_elements U \<subseteq> insert u (\<Union>i\<le>r. \<Union>t<u ! i. minimal_elements (VF i t))
[PROOF STEP]
by (force simp: VF_def V_def minimal_elements.simps pointwise_less_def)
[PROOF STATE]
proof (state)
this:
minimal_elements U \<subseteq> insert u (\<Union>i\<le>r. \<Union>t<u ! i. minimal_elements (VF i t))

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
minimal_elements U \<subseteq> insert u (\<Union>i\<le>r. \<Union>t<u ! i. minimal_elements (VF i t))

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
have "finite (minimal_elements (VF i t))" if "i\<le>r" "t < u!i" for i t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
define delete where "delete \<equiv> \<lambda>v::nat list. take i v @ drop (Suc i) v" \<comment> \<open>deletion of @{term i}\<close>
[PROOF STATE]
proof (state)
this:
delete \<equiv> \<lambda>v. take i v @ drop (Suc i) v

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
have len_delete[simp]: "length (delete u) = r" if "u \<in> VF i t" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (delete u) = r
[PROOF STEP]
using Suc.prems VF_def V_def \<open>i \<le> r\<close> delete_def that
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> U \<Longrightarrow> length ?x1 = Suc r
VF \<equiv> \<lambda>i t. {v \<in> V. v ! i = t}
V = {v \<in> U. \<not> u__ \<unlhd> v}
i \<le> r
delete \<equiv> \<lambda>v. take i v @ drop (Suc i) v
u \<in> VF i t

goal (1 subgoal):
 1. length (delete u) = r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?u1 \<in> VF i t \<Longrightarrow> length (delete ?u1) = r

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
have nth_delete: "delete u!k = (if k<i then u!k else u!Suc k)" if "u \<in> VF i t" "k<r" for u k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. delete u ! k = (if k < i then u ! k else u ! Suc k)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
u \<in> VF i t
k < r

goal (1 subgoal):
 1. delete u ! k = (if k < i then u ! k else u ! Suc k)
[PROOF STEP]
by (simp add: delete_def nth_append)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?u1 \<in> VF i t; ?k1 < r\<rbrakk> \<Longrightarrow> delete ?u1 ! ?k1 = (if ?k1 < i then ?u1 ! ?k1 else ?u1 ! Suc ?k1)

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
have delete_le_iff [simp]: "delete u \<unlhd> delete v \<longleftrightarrow> u \<unlhd> v" if "u \<in> VF i t" "v \<in> VF i t" for u v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (delete u \<unlhd> delete v) = (u \<unlhd> v)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. delete u \<unlhd> delete v \<Longrightarrow> u \<unlhd> v
 2. u \<unlhd> v \<Longrightarrow> delete u \<unlhd> delete v
[PROOF STEP]
assume "delete u \<unlhd> delete v"
[PROOF STATE]
proof (state)
this:
delete u \<unlhd> delete v

goal (2 subgoals):
 1. delete u \<unlhd> delete v \<Longrightarrow> u \<unlhd> v
 2. u \<unlhd> v \<Longrightarrow> delete u \<unlhd> delete v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
delete u \<unlhd> delete v
[PROOF STEP]
have "\<forall>j. (j < i \<longrightarrow> u!j \<le> v!j) \<and> (j < r \<longrightarrow> i \<le> j \<longrightarrow> u!Suc j \<le> v!Suc j)"
[PROOF STATE]
proof (prove)
using this:
delete u \<unlhd> delete v

goal (1 subgoal):
 1. \<forall>j. (j < i \<longrightarrow> u ! j \<le> v ! j) \<and> (j < r \<longrightarrow> i \<le> j \<longrightarrow> u ! Suc j \<le> v ! Suc j)
[PROOF STEP]
using that \<open>i \<le> r\<close>
[PROOF STATE]
proof (prove)
using this:
delete u \<unlhd> delete v
u \<in> VF i t
v \<in> VF i t
i \<le> r

goal (1 subgoal):
 1. \<forall>j. (j < i \<longrightarrow> u ! j \<le> v ! j) \<and> (j < r \<longrightarrow> i \<le> j \<longrightarrow> u ! Suc j \<le> v ! Suc j)
[PROOF STEP]
by (force simp add: pointwise_le_iff_nth nth_delete split: if_split_asm cong: conj_cong)
[PROOF STATE]
proof (state)
this:
\<forall>j. (j < i \<longrightarrow> u ! j \<le> v ! j) \<and> (j < r \<longrightarrow> i \<le> j \<longrightarrow> u ! Suc j \<le> v ! Suc j)

goal (2 subgoals):
 1. delete u \<unlhd> delete v \<Longrightarrow> u \<unlhd> v
 2. u \<unlhd> v \<Longrightarrow> delete u \<unlhd> delete v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>j. (j < i \<longrightarrow> u ! j \<le> v ! j) \<and> (j < r \<longrightarrow> i \<le> j \<longrightarrow> u ! Suc j \<le> v ! Suc j)
[PROOF STEP]
show "u \<unlhd> v"
[PROOF STATE]
proof (prove)
using this:
\<forall>j. (j < i \<longrightarrow> u ! j \<le> v ! j) \<and> (j < r \<longrightarrow> i \<le> j \<longrightarrow> u ! Suc j \<le> v ! Suc j)

goal (1 subgoal):
 1. u \<unlhd> v
[PROOF STEP]
using that \<open>i \<le> r\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>j. (j < i \<longrightarrow> u ! j \<le> v ! j) \<and> (j < r \<longrightarrow> i \<le> j \<longrightarrow> u ! Suc j \<le> v ! Suc j)
u \<in> VF i t
v \<in> VF i t
i \<le> r

goal (1 subgoal):
 1. u \<unlhd> v
[PROOF STEP]
apply (simp add: pointwise_le_iff_nth VF_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>j. (j < i \<longrightarrow> u ! j \<le> v ! j) \<and> (j < r \<longrightarrow> i \<le> j \<longrightarrow> u ! Suc j \<le> v ! Suc j); u \<in> V \<and> u ! i = t; v \<in> V \<and> v ! i = t; i \<le> r\<rbrakk> \<Longrightarrow> \<forall>i<Suc r. u ! i \<le> v ! i
[PROOF STEP]
by (metis eq_iff le_Suc_eq less_Suc_eq_0_disj linorder_not_less)
[PROOF STATE]
proof (state)
this:
u \<unlhd> v

goal (1 subgoal):
 1. u \<unlhd> v \<Longrightarrow> delete u \<unlhd> delete v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u \<unlhd> v \<Longrightarrow> delete u \<unlhd> delete v
[PROOF STEP]
assume "u \<unlhd> v"
[PROOF STATE]
proof (state)
this:
u \<unlhd> v

goal (1 subgoal):
 1. u \<unlhd> v \<Longrightarrow> delete u \<unlhd> delete v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<unlhd> v
[PROOF STEP]
show "delete u \<unlhd> delete v"
[PROOF STATE]
proof (prove)
using this:
u \<unlhd> v

goal (1 subgoal):
 1. delete u \<unlhd> delete v
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
u \<unlhd> v
u \<in> VF i t
v \<in> VF i t

goal (1 subgoal):
 1. delete u \<unlhd> delete v
[PROOF STEP]
by (simp add: pointwise_le_iff_nth nth_delete)
[PROOF STATE]
proof (state)
this:
delete u \<unlhd> delete v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?u1 \<in> VF i t; ?v1 \<in> VF i t\<rbrakk> \<Longrightarrow> (delete ?u1 \<unlhd> delete ?v1) = (?u1 \<unlhd> ?v1)

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?u1 \<in> VF i t; ?v1 \<in> VF i t\<rbrakk> \<Longrightarrow> (delete ?u1 \<unlhd> delete ?v1) = (?u1 \<unlhd> ?v1)
[PROOF STEP]
have delete_eq_iff: "delete u = delete v \<longleftrightarrow> u = v" if "u \<in> VF i t" "v \<in> VF i t" for u v
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u1 \<in> VF i t; ?v1 \<in> VF i t\<rbrakk> \<Longrightarrow> (delete ?u1 \<unlhd> delete ?v1) = (?u1 \<unlhd> ?v1)

goal (1 subgoal):
 1. (delete u = delete v) = (u = v)
[PROOF STEP]
by (metis that pointwise_le_antisym pointwise_le_refl)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?u1 \<in> VF i t; ?v1 \<in> VF i t\<rbrakk> \<Longrightarrow> (delete ?u1 = delete ?v1) = (?u1 = ?v1)

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
have delete_less_iff: "delete u \<lhd> delete v \<longleftrightarrow> u \<lhd> v" if "u \<in> VF i t" "v \<in> VF i t" for u v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (delete u \<lhd> delete v) = (u \<lhd> v)
[PROOF STEP]
by (metis delete_le_iff pointwise_le_antisym pointwise_less_def that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?u1 \<in> VF i t; ?v1 \<in> VF i t\<rbrakk> \<Longrightarrow> (delete ?u1 \<lhd> delete ?v1) = (?u1 \<lhd> ?v1)

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
have "length (delete v) = r" if "v \<in> V" for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (delete v) = r
[PROOF STEP]
using id_take_nth_drop Suc.prems V_def \<open>i \<le> r\<close> delete_def that
[PROOF STATE]
proof (prove)
using this:
?i < length ?xs \<Longrightarrow> ?xs = take ?i ?xs @ ?xs ! ?i # drop (Suc ?i) ?xs
?x1 \<in> U \<Longrightarrow> length ?x1 = Suc r
V = {v \<in> U. \<not> u \<unlhd> v}
i \<le> r
delete \<equiv> \<lambda>v. take i v @ drop (Suc i) v
v \<in> V

goal (1 subgoal):
 1. length (delete v) = r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?v1 \<in> V \<Longrightarrow> length (delete ?v1) = r

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?v1 \<in> V \<Longrightarrow> length (delete ?v1) = r
[PROOF STEP]
have "finite (minimal_elements (delete ` V))"
[PROOF STATE]
proof (prove)
using this:
?v1 \<in> V \<Longrightarrow> length (delete ?v1) = r

goal (1 subgoal):
 1. finite (minimal_elements (delete ` V))
[PROOF STEP]
by (metis (mono_tags, lifting) Suc.IH image_iff)
[PROOF STATE]
proof (state)
this:
finite (minimal_elements (delete ` V))

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (minimal_elements (delete ` V))

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
have "inj_on delete (minimal_elements (VF i t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on delete (minimal_elements (VF i t))
[PROOF STEP]
by (simp add: delete_eq_iff inj_on_def minimal_elements.simps)
[PROOF STATE]
proof (state)
this:
inj_on delete (minimal_elements (VF i t))

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on delete (minimal_elements (VF i t))

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
have "delete ` (minimal_elements (VF i t)) \<subseteq> minimal_elements (delete ` (VF i t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. delete ` minimal_elements (VF i t) \<subseteq> minimal_elements (delete ` VF i t)
[PROOF STEP]
by (auto simp: delete_less_iff minimal_elements.simps)
[PROOF STATE]
proof (state)
this:
delete ` minimal_elements (VF i t) \<subseteq> minimal_elements (delete ` VF i t)

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (minimal_elements (delete ` V))
inj_on delete (minimal_elements (VF i t))
delete ` minimal_elements (VF i t) \<subseteq> minimal_elements (delete ` VF i t)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (minimal_elements (delete ` V))
inj_on delete (minimal_elements (VF i t))
delete ` minimal_elements (VF i t) \<subseteq> minimal_elements (delete ` VF i t)

goal (1 subgoal):
 1. finite (minimal_elements (VF i t))
[PROOF STEP]
by (metis (mono_tags, lifting) Suc.IH image_iff inj_on_finite len_delete)
[PROOF STATE]
proof (state)
this:
finite (minimal_elements (VF i t))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i1 \<le> r; ?t1 < u ! ?i1\<rbrakk> \<Longrightarrow> finite (minimal_elements (VF ?i1 ?t1))

goal (1 subgoal):
 1. U \<noteq> {} \<Longrightarrow> finite (minimal_elements U)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
minimal_elements U \<subseteq> insert u (\<Union>i\<le>r. \<Union>t<u ! i. minimal_elements (VF i t))
\<lbrakk>?i1 \<le> r; ?t1 < u ! ?i1\<rbrakk> \<Longrightarrow> finite (minimal_elements (VF ?i1 ?t1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
minimal_elements U \<subseteq> insert u (\<Union>i\<le>r. \<Union>t<u ! i. minimal_elements (VF i t))
\<lbrakk>?i1 \<le> r; ?t1 < u ! ?i1\<rbrakk> \<Longrightarrow> finite (minimal_elements (VF ?i1 ?t1))

goal (1 subgoal):
 1. finite (minimal_elements U)
[PROOF STEP]
by (force elim: finite_subset)
[PROOF STATE]
proof (state)
this:
finite (minimal_elements U)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite (minimal_elements U)

goal:
No subgoals!
[PROOF STEP]
qed