[STATEMENT]
lemma Ord_Inter [intro,simp]: "\<lbrakk> \<And>i. i\<^bold>\<in>A \<Longrightarrow> Ord(i) \<rbrakk>  \<Longrightarrow> Ord(\<Sqinter> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<^bold>\<in> A \<Longrightarrow> Ord i) \<Longrightarrow> Ord (\<Sqinter>A)
[PROOF STEP]
apply (case_tac "A=0", auto simp: Ord_def Transset_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y x ya. \<lbrakk>\<And>i. i \<^bold>\<in> A \<Longrightarrow> (\<forall>y. y \<^bold>\<in> i \<longrightarrow> y \<le> i) \<and> (\<forall>x\<^bold>\<in>i. \<forall>y. y \<^bold>\<in> x \<longrightarrow> y \<le> x); A \<noteq> 0; \<forall>ya. ya \<^bold>\<in> A \<longrightarrow> y \<^bold>\<in> ya; x \<^bold>\<in> y; ya \<^bold>\<in> A\<rbrakk> \<Longrightarrow> x \<^bold>\<in> ya
 2. \<And>x y xa. \<lbrakk>\<And>i. i \<^bold>\<in> A \<Longrightarrow> (\<forall>y. y \<^bold>\<in> i \<longrightarrow> y \<le> i) \<and> (\<forall>x\<^bold>\<in>i. \<forall>y. y \<^bold>\<in> x \<longrightarrow> y \<le> x); A \<noteq> 0; \<forall>y. y \<^bold>\<in> A \<longrightarrow> x \<^bold>\<in> y; y \<^bold>\<in> x; xa \<^bold>\<in> y\<rbrakk> \<Longrightarrow> xa \<^bold>\<in> x
[PROOF STEP]
apply (force simp add: hf_ext)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Lim_measure_incseq:
  assumes A: "range A \<subseteq> sets M" "incseq A" and fin: "emeasure M (\<Union>i. A i) \<noteq> \<infinity>"
  shows "(\<lambda>i. measure M (A i)) \<longlonglongrightarrow> measure M (\<Union>i. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. Sigma_Algebra.measure M (A i)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
proof (rule tendsto_ennrealD)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<lambda>x. ennreal (Sigma_Algebra.measure M (A x))) \<longlonglongrightarrow> ennreal (Sigma_Algebra.measure M (\<Union> (range A)))
 2. \<forall>\<^sub>F x in sequentially. 0 \<le> Sigma_Algebra.measure M (A x)
 3. 0 \<le> Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
have "ennreal (measure M (\<Union>i. A i)) = emeasure M (\<Union>i. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
emeasure M (\<Union> (range A)) \<noteq> \<infinity>

goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))
[PROOF STEP]
by (auto simp: emeasure_eq_ennreal_measure)
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))

goal (3 subgoals):
 1. (\<lambda>x. ennreal (Sigma_Algebra.measure M (A x))) \<longlonglongrightarrow> ennreal (Sigma_Algebra.measure M (\<Union> (range A)))
 2. \<forall>\<^sub>F x in sequentially. 0 \<le> Sigma_Algebra.measure M (A x)
 3. 0 \<le> Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))

goal (3 subgoals):
 1. (\<lambda>x. ennreal (Sigma_Algebra.measure M (A x))) \<longlonglongrightarrow> ennreal (Sigma_Algebra.measure M (\<Union> (range A)))
 2. \<forall>\<^sub>F x in sequentially. 0 \<le> Sigma_Algebra.measure M (A x)
 3. 0 \<le> Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
have "ennreal (measure M (A i)) = emeasure M (A i)" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure M (A i)) = emeasure M (A i)
[PROOF STEP]
using assms emeasure_mono[of "A _" "\<Union>i. A i" M]
[PROOF STATE]
proof (prove)
using this:
range A \<subseteq> sets M
incseq A
emeasure M (\<Union> (range A)) \<noteq> \<infinity>
\<lbrakk>A ?uu3 \<subseteq> \<Union> (range A); \<Union> (range A) \<in> sets M\<rbrakk> \<Longrightarrow> emeasure M (A ?uu3) \<le> emeasure M (\<Union> (range A))

goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure M (A i)) = emeasure M (A i)
[PROOF STEP]
by (intro emeasure_eq_ennreal_measure[symmetric]) (auto simp: less_top UN_upper intro: le_less_trans)
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure M (A ?i)) = emeasure M (A ?i)

goal (3 subgoals):
 1. (\<lambda>x. ennreal (Sigma_Algebra.measure M (A x))) \<longlonglongrightarrow> ennreal (Sigma_Algebra.measure M (\<Union> (range A)))
 2. \<forall>\<^sub>F x in sequentially. 0 \<le> Sigma_Algebra.measure M (A x)
 3. 0 \<le> Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))
ennreal (Sigma_Algebra.measure M (A ?i)) = emeasure M (A ?i)
[PROOF STEP]
show "(\<lambda>x. ennreal (measure M (A x))) \<longlonglongrightarrow> ennreal (measure M (\<Union>i. A i))"
[PROOF STATE]
proof (prove)
using this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))
ennreal (Sigma_Algebra.measure M (A ?i)) = emeasure M (A ?i)

goal (1 subgoal):
 1. (\<lambda>x. ennreal (Sigma_Algebra.measure M (A x))) \<longlonglongrightarrow> ennreal (Sigma_Algebra.measure M (\<Union> (range A)))
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))
ennreal (Sigma_Algebra.measure M (A ?i)) = emeasure M (A ?i)
range A \<subseteq> sets M
incseq A

goal (1 subgoal):
 1. (\<lambda>x. ennreal (Sigma_Algebra.measure M (A x))) \<longlonglongrightarrow> ennreal (Sigma_Algebra.measure M (\<Union> (range A)))
[PROOF STEP]
by (auto intro!: Lim_emeasure_incseq)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ennreal (Sigma_Algebra.measure M (A x))) \<longlonglongrightarrow> ennreal (Sigma_Algebra.measure M (\<Union> (range A)))

goal (2 subgoals):
 1. \<forall>\<^sub>F x in sequentially. 0 \<le> Sigma_Algebra.measure M (A x)
 2. 0 \<le> Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
qed auto


[STATEMENT]
lemma smallI:
  "(\<And>c. c > 0 \<Longrightarrow> eventually (\<lambda>x. R (norm (f x)) (c * (norm (g x)))) F) \<Longrightarrow> f \<in> l F (g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in F. R (norm (f x)) (c * norm (g x))) \<Longrightarrow> f \<in> l F g
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in F. R (norm (f x)) (c * norm (g x))) \<Longrightarrow> f \<in> {f. \<forall>c>0. \<forall>\<^sub>F x in F. R (norm (f x)) (c * norm (g x))}
[PROOF STEP]
by blast


[STATEMENT]
lemma merge_true_star_ctx: "true * (true * P) = true * P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. true * (true * P) = true * P
[PROOF STEP]
by (simp add: mult.left_ac)


[STATEMENT]
lemma indicator_times:
  "indicator (A \<times> B) x = indicator A (fst x) * (indicator B (snd x) :: 'a::semiring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indicator (A \<times> B) x = indicator A (fst x) * indicator B (snd x)
[PROOF STEP]
unfolding indicator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_bool (x \<in> A \<times> B) = of_bool (fst x \<in> A) * of_bool (snd x \<in> B)
[PROOF STEP]
by (cases x) auto


[STATEMENT]
lemma is_process3: "is_process P \<Longrightarrow> \<forall> s t. (s @ t,{}) \<in> FAILURES P \<longrightarrow> (s, {}) \<in> FAILURES P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_process P \<Longrightarrow> \<forall>s t. (s @ t, {}) \<in> FAILURES P \<longrightarrow> (s, {}) \<in> FAILURES P
[PROOF STEP]
by(simp only: is_process_spec, metis)


[STATEMENT]
theorem Janiszewski:
  fixes a b :: complex
  assumes "compact S" "closed T" and conST: "connected (S \<inter> T)"
      and ccS: "connected_component (- S) a b" and ccT: "connected_component (- T) a b"
    shows "connected_component (- (S \<union> T)) a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
have "path_component(- T) a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_component (- T) a b
[PROOF STEP]
by (simp add: \<open>closed T\<close> ccT open_Compl open_path_connected_component)
[PROOF STATE]
proof (state)
this:
path_component (- T) a b

goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path_component (- T) a b
[PROOF STEP]
obtain g where g: "path g" "path_image g \<subseteq> - T" "pathstart g = a" "pathfinish g = b"
[PROOF STATE]
proof (prove)
using this:
path_component (- T) a b

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>path g; path_image g \<subseteq> - T; pathstart g = a; pathfinish g = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: path_component_def)
[PROOF STATE]
proof (state)
this:
path g
path_image g \<subseteq> - T
pathstart g = a
pathfinish g = b

goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
obtain C where C: "compact C" "connected C" "a \<in> C" "b \<in> C" "C \<inter> T = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> compact ?C2
 2. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> connected ?C2
 3. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> a \<in> ?C2
 4. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> b \<in> ?C2
 5. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> ?C2 \<inter> T = {}
[PROOF STEP]
show "compact (path_image g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (path_image g)
[PROOF STEP]
by (simp add: \<open>path g\<close> compact_path_image)
[PROOF STATE]
proof (state)
this:
compact (path_image g)

goal (4 subgoals):
 1. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> connected (path_image g)
 2. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> a \<in> path_image g
 3. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> b \<in> path_image g
 4. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> path_image g \<inter> T = {}
[PROOF STEP]
show "connected (path_image g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected (path_image g)
[PROOF STEP]
by (simp add: \<open>path g\<close> connected_path_image)
[PROOF STATE]
proof (state)
this:
connected (path_image g)

goal (3 subgoals):
 1. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> a \<in> path_image g
 2. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> b \<in> path_image g
 3. (\<And>C. \<lbrakk>compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> path_image g \<inter> T = {}
[PROOF STEP]
qed (use g in auto)
[PROOF STATE]
proof (state)
this:
compact C
connected C
a \<in> C
b \<in> C
C \<inter> T = {}

goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
obtain r where "0 < r" and r: "C \<union> S \<subseteq> ball 0 r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; C \<union> S \<subseteq> ball 0 r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis \<open>compact C\<close> \<open>compact S\<close> bounded_Un compact_imp_bounded bounded_subset_ballD)
[PROOF STATE]
proof (state)
this:
0 < r
C \<union> S \<subseteq> ball 0 r

goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
have "connected_component (- (S \<union> (T \<inter> cball 0 r \<union> sphere 0 r))) a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_component (- (S \<union> (T \<inter> cball 0 r \<union> sphere 0 r))) a b
[PROOF STEP]
proof (rule Janiszewski_weak [OF \<open>compact S\<close>])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. compact (T \<inter> cball 0 r \<union> sphere 0 r)
 2. connected (S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r))
 3. connected_component (- S) a b
 4. connected_component (- (T \<inter> cball 0 r \<union> sphere 0 r)) a b
[PROOF STEP]
show comT': "compact ((T \<inter> cball 0 r) \<union> sphere 0 r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (T \<inter> cball 0 r \<union> sphere 0 r)
[PROOF STEP]
by (simp add: \<open>closed T\<close> closed_Int_compact compact_Un)
[PROOF STATE]
proof (state)
this:
compact (T \<inter> cball 0 r \<union> sphere 0 r)

goal (3 subgoals):
 1. connected (S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r))
 2. connected_component (- S) a b
 3. connected_component (- (T \<inter> cball 0 r \<union> sphere 0 r)) a b
[PROOF STEP]
have "S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r) = S \<inter> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r) = S \<inter> T
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
C \<union> S \<subseteq> ball 0 r

goal (1 subgoal):
 1. S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r) = S \<inter> T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r) = S \<inter> T

goal (3 subgoals):
 1. connected (S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r))
 2. connected_component (- S) a b
 3. connected_component (- (T \<inter> cball 0 r \<union> sphere 0 r)) a b
[PROOF STEP]
with conST
[PROOF STATE]
proof (chain)
picking this:
connected (S \<inter> T)
S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r) = S \<inter> T
[PROOF STEP]
show "connected (S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r))"
[PROOF STATE]
proof (prove)
using this:
connected (S \<inter> T)
S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r) = S \<inter> T

goal (1 subgoal):
 1. connected (S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
connected (S \<inter> (T \<inter> cball 0 r \<union> sphere 0 r))

goal (2 subgoals):
 1. connected_component (- S) a b
 2. connected_component (- (T \<inter> cball 0 r \<union> sphere 0 r)) a b
[PROOF STEP]
show "connected_component (- (T \<inter> cball 0 r \<union> sphere 0 r)) a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_component (- (T \<inter> cball 0 r \<union> sphere 0 r)) a b
[PROOF STEP]
using conST C r
[PROOF STATE]
proof (prove)
using this:
connected (S \<inter> T)
compact C
connected C
a \<in> C
b \<in> C
C \<inter> T = {}
C \<union> S \<subseteq> ball 0 r

goal (1 subgoal):
 1. connected_component (- (T \<inter> cball 0 r \<union> sphere 0 r)) a b
[PROOF STEP]
apply (simp add: connected_component_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connected (S \<inter> T); compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}; C \<subseteq> ball 0 r \<and> S \<subseteq> ball 0 r\<rbrakk> \<Longrightarrow> \<exists>Ta. connected Ta \<and> Ta \<subseteq> - T \<union> - cball 0 r \<and> Ta \<subseteq> - sphere 0 r \<and> a \<in> Ta \<and> b \<in> Ta
[PROOF STEP]
apply (rule_tac x=C in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connected (S \<inter> T); compact C; connected C; a \<in> C; b \<in> C; C \<inter> T = {}; C \<subseteq> ball 0 r \<and> S \<subseteq> ball 0 r\<rbrakk> \<Longrightarrow> connected C \<and> C \<subseteq> - T \<union> - cball 0 r \<and> C \<subseteq> - sphere 0 r \<and> a \<in> C \<and> b \<in> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
connected_component (- (T \<inter> cball 0 r \<union> sphere 0 r)) a b

goal (1 subgoal):
 1. connected_component (- S) a b
[PROOF STEP]
qed (simp add: ccS)
[PROOF STATE]
proof (state)
this:
connected_component (- (S \<union> (T \<inter> cball 0 r \<union> sphere 0 r))) a b

goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
connected_component (- (S \<union> (T \<inter> cball 0 r \<union> sphere 0 r))) a b
[PROOF STEP]
obtain U where U: "connected U" "U \<subseteq> - S" "U \<subseteq> - T \<union> - cball 0 r" "U \<subseteq> - sphere 0 r" "a \<in> U" "b \<in> U"
[PROOF STATE]
proof (prove)
using this:
connected_component (- (S \<union> (T \<inter> cball 0 r \<union> sphere 0 r))) a b

goal (1 subgoal):
 1. (\<And>U. \<lbrakk>connected U; U \<subseteq> - S; U \<subseteq> - T \<union> - cball 0 r; U \<subseteq> - sphere 0 r; a \<in> U; b \<in> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: connected_component_def)
[PROOF STATE]
proof (state)
this:
connected U
U \<subseteq> - S
U \<subseteq> - T \<union> - cball 0 r
U \<subseteq> - sphere 0 r
a \<in> U
b \<in> U

goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_component (- (S \<union> T)) a b
[PROOF STEP]
unfolding connected_component_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Ta. connected Ta \<and> Ta \<subseteq> - (S \<union> T) \<and> a \<in> Ta \<and> b \<in> Ta
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. connected ?T
 2. ?T \<subseteq> - (S \<union> T)
 3. a \<in> ?T
 4. b \<in> ?T
[PROOF STEP]
show "U \<subseteq> - (S \<union> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<subseteq> - (S \<union> T)
[PROOF STEP]
using U r \<open>0 < r\<close> \<open>a \<in> C\<close> connected_Int_frontier [of U "cball 0 r"]
[PROOF STATE]
proof (prove)
using this:
connected U
U \<subseteq> - S
U \<subseteq> - T \<union> - cball 0 r
U \<subseteq> - sphere 0 r
a \<in> U
b \<in> U
C \<union> S \<subseteq> ball 0 r
0 < r
a \<in> C
\<lbrakk>connected U; U \<inter> cball 0 r \<noteq> {}; U - cball 0 r \<noteq> {}\<rbrakk> \<Longrightarrow> U \<inter> frontier (cball 0 r) \<noteq> {}

goal (1 subgoal):
 1. U \<subseteq> - (S \<union> T)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connected U; U \<subseteq> - S; U \<subseteq> - T \<union> - cball 0 r; U \<subseteq> - sphere 0 r; a \<in> U; b \<in> U; C \<subseteq> ball 0 r \<and> S \<subseteq> ball 0 r; 0 < r; a \<in> C; \<lbrakk>U \<inter> cball 0 r \<noteq> {}; \<not> U \<subseteq> cball 0 r\<rbrakk> \<Longrightarrow> U \<inter> sphere 0 r \<noteq> {}\<rbrakk> \<Longrightarrow> U \<subseteq> - T
[PROOF STEP]
by (metis ball_subset_cball compl_inf disjoint_eq_subset_Compl disjoint_iff_not_equal inf.orderE inf_sup_aci(3) subsetCE)
[PROOF STATE]
proof (state)
this:
U \<subseteq> - (S \<union> T)

goal (3 subgoals):
 1. connected U
 2. a \<in> U
 3. b \<in> U
[PROOF STEP]
qed (auto simp: U)
[PROOF STATE]
proof (state)
this:
connected_component (- (S \<union> T)) a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem rotate_inv:"rotate w1 w2 \<Longrightarrow> (kauff_mat w1) = (kauff_mat w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tangle_Moves.rotate w1 w2 \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
unfolding rotate_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rotate_toppos w1 w2 \<or> rotate_topneg w1 w2 \<or> rotate_downpos w1 w2 \<or> rotate_downneg w1 w2 \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
using rotate_downneg_inv rotate_downpos_inv rotate_topneg_inv
           rotate_toppos_inv
[PROOF STATE]
proof (prove)
using this:
rotate_downneg ?w1.0 ?w2.0 \<Longrightarrow> kauff_mat ?w1.0 = kauff_mat ?w2.0
rotate_downpos ?w1.0 ?w2.0 \<Longrightarrow> kauff_mat ?w1.0 = kauff_mat ?w2.0
rotate_topneg ?w1.0 ?w2.0 \<Longrightarrow> kauff_mat ?w1.0 = kauff_mat ?w2.0
rotate_toppos ?w1.0 ?w2.0 \<Longrightarrow> kauff_mat ?w1.0 = kauff_mat ?w2.0

goal (1 subgoal):
 1. rotate_toppos w1 w2 \<or> rotate_topneg w1 w2 \<or> rotate_downpos w1 w2 \<or> rotate_downneg w1 w2 \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
by auto


[STATEMENT]
lemma list_slice_div_eq_Suc[rule_format]: "
  length xs div k = Suc n \<Longrightarrow>
  list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs div k = Suc n \<Longrightarrow> list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]
[PROOF STEP]
apply (case_tac "k = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs div k = Suc n; k \<noteq> 0\<rbrakk> \<Longrightarrow> list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]
[PROOF STEP]
apply (subgoal_tac "n * k < length xs")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>length xs div k = Suc n; k \<noteq> 0; n * k < length xs\<rbrakk> \<Longrightarrow> list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]
 2. \<lbrakk>length xs div k = Suc n; k \<noteq> 0\<rbrakk> \<Longrightarrow> n * k < length xs
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>length xs div k = Suc n; k \<noteq> 0\<rbrakk> \<Longrightarrow> n * k < length xs
 2. \<lbrakk>length xs div k = Suc n; k \<noteq> 0; n * k < length xs\<rbrakk> \<Longrightarrow> list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]
[PROOF STEP]
apply (case_tac "length xs = 0", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>length xs div k = Suc n; k \<noteq> 0; length xs \<noteq> 0\<rbrakk> \<Longrightarrow> n * k < length xs
 2. \<lbrakk>length xs div k = Suc n; k \<noteq> 0; n * k < length xs\<rbrakk> \<Longrightarrow> list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]
[PROOF STEP]
apply (drule_tac arg_cong[where f="\<lambda>x. x - Suc 0"], drule sym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>k \<noteq> 0; length xs \<noteq> 0; Suc n - Suc 0 = length xs div k - Suc 0\<rbrakk> \<Longrightarrow> n * k < length xs
 2. \<lbrakk>length xs div k = Suc n; k \<noteq> 0; n * k < length xs\<rbrakk> \<Longrightarrow> list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]
[PROOF STEP]
apply (simp add: diff_mult_distrib div_mult_cancel)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs div k = Suc n; k \<noteq> 0; n * k < length xs\<rbrakk> \<Longrightarrow> list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]
[PROOF STEP]
apply (insert list_slice_append_mult[of "take (n * k) xs" n k "drop (n * k) xs"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs div k = Suc n; k \<noteq> 0; n * k < length xs; length (xs \<down> (n * k)) = n * k \<Longrightarrow> list_slice (xs \<down> (n * k) @ xs \<up> (n * k)) k = list_slice (xs \<down> (n * k)) k @ list_slice (xs \<up> (n * k)) k\<rbrakk> \<Longrightarrow> list_slice xs k = list_slice (xs \<down> (n * k)) k @ [xs \<up> (n * k) \<down> k]
[PROOF STEP]
apply (simp add: min_eqR)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs div k = Suc n; 0 < k; n * k < length xs; list_slice xs k = list_slice (xs \<down> (n * k)) k @ list_slice (xs \<up> (n * k)) k\<rbrakk> \<Longrightarrow> list_slice (xs \<up> (n * k)) k = [xs \<up> (n * k) \<down> k]
[PROOF STEP]
apply (rule list_slice_div_eq_1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs div k = Suc n; 0 < k; n * k < length xs; list_slice xs k = list_slice (xs \<down> (n * k)) k @ list_slice (xs \<up> (n * k)) k\<rbrakk> \<Longrightarrow> length (xs \<up> (n * k)) div k = Suc 0
[PROOF STEP]
apply (simp add: div_diff_mult_self1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma imult_infinity_right: "(0::enat) < n \<Longrightarrow> n * \<infinity> = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> n * \<infinity> = \<infinity>
[PROOF STEP]
by (simp add: zero_enat_def less_enat_def split: enat.splits)


[STATEMENT]
lemma pow_res_is_univ_semialgebraic':
  assumes "n > 0"
  assumes "b \<in> carrier Q\<^sub>p"
  shows "is_univ_semialgebraic {x \<in> carrier Q\<^sub>p. pow_res n x = pow_res n b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_univ_semialgebraic {x \<in> carrier Q\<^sub>p. pow_res n x = pow_res n b}
[PROOF STEP]
using assms pow_res_eq_rel pow_res_is_univ_semialgebraic
[PROOF STATE]
proof (prove)
using this:
0 < n
b \<in> carrier Q\<^sub>p
\<lbrakk>0 < ?n; ?b \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> {x \<in> carrier Q\<^sub>p. pow_res ?n x = pow_res ?n ?b} = pow_res ?n ?b
?x \<in> carrier Q\<^sub>p \<Longrightarrow> is_univ_semialgebraic (pow_res ?n ?x)

goal (1 subgoal):
 1. is_univ_semialgebraic {x \<in> carrier Q\<^sub>p. pow_res n x = pow_res n b}
[PROOF STEP]
by presburger


[STATEMENT]
theorem isin_set_inorder:
  assumes "sorted_less (leaves t)"
    and "aligned l t u"
  shows "isin t x = (x \<in> set (leaves t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isin t x = (x \<in> set (leaves t))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sorted_less (leaves t)
aligned l t u

goal (1 subgoal):
 1. isin t x = (x \<in> set (leaves t))
[PROOF STEP]
proof(induction t x arbitrary: l u rule: isin.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ks x l u. \<lbrakk>sorted_less (leaves (Leaf ks)); aligned l (Leaf ks) u\<rbrakk> \<Longrightarrow> isin (Leaf ks) x = (x \<in> set (leaves (Leaf ks)))
 2. \<And>ts t x l u. \<lbrakk>\<And>xa y l u. \<lbrakk>(xa, y) = split ts x; y = []; sorted_less (leaves t); aligned l t u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t)); \<And>xa y x21 x22 xaa ya l u. \<lbrakk>(xa, y) = split ts x; y = x21 # x22; (xaa, ya) = x21; sorted_less (leaves xaa); aligned l xaa u\<rbrakk> \<Longrightarrow> isin xaa x = (x \<in> set (leaves xaa)); sorted_less (leaves (Node ts t)); aligned l (Node ts t) u\<rbrakk> \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
case (2 ts t x)
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?xa, ?y) = split ts x; ?y = []; sorted_less (leaves t); aligned ?l t ?u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t))
\<lbrakk>(?xa, ?y) = split ts x; ?y = ?x21.0 # ?x22.0; (?xaa, ?ya) = ?x21.0; sorted_less (leaves ?xaa); aligned ?l ?xaa ?u\<rbrakk> \<Longrightarrow> isin ?xaa x = (x \<in> set (leaves ?xaa))
sorted_less (leaves (Node ts t))
aligned l (Node ts t) u

goal (2 subgoals):
 1. \<And>ks x l u. \<lbrakk>sorted_less (leaves (Leaf ks)); aligned l (Leaf ks) u\<rbrakk> \<Longrightarrow> isin (Leaf ks) x = (x \<in> set (leaves (Leaf ks)))
 2. \<And>ts t x l u. \<lbrakk>\<And>xa y l u. \<lbrakk>(xa, y) = split ts x; y = []; sorted_less (leaves t); aligned l t u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t)); \<And>xa y x21 x22 xaa ya l u. \<lbrakk>(xa, y) = split ts x; y = x21 # x22; (xaa, ya) = x21; sorted_less (leaves xaa); aligned l xaa u\<rbrakk> \<Longrightarrow> isin xaa x = (x \<in> set (leaves xaa)); sorted_less (leaves (Node ts t)); aligned l (Node ts t) u\<rbrakk> \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>(?xa, ?y) = split ts x; ?y = []; sorted_less (leaves t); aligned ?l t ?u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t))
\<lbrakk>(?xa, ?y) = split ts x; ?y = ?x21.0 # ?x22.0; (?xaa, ?ya) = ?x21.0; sorted_less (leaves ?xaa); aligned ?l ?xaa ?u\<rbrakk> \<Longrightarrow> isin ?xaa x = (x \<in> set (leaves ?xaa))
sorted_less (leaves (Node ts t))
aligned l (Node ts t) u
[PROOF STEP]
obtain ls rs where list_split: "split ts x = (ls, rs)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?xa, ?y) = split ts x; ?y = []; sorted_less (leaves t); aligned ?l t ?u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t))
\<lbrakk>(?xa, ?y) = split ts x; ?y = ?x21.0 # ?x22.0; (?xaa, ?ya) = ?x21.0; sorted_less (leaves ?xaa); aligned ?l ?xaa ?u\<rbrakk> \<Longrightarrow> isin ?xaa x = (x \<in> set (leaves ?xaa))
sorted_less (leaves (Node ts t))
aligned l (Node ts t) u

goal (1 subgoal):
 1. (\<And>ls rs. split ts x = (ls, rs) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson surj_pair)
[PROOF STATE]
proof (state)
this:
split ts x = (ls, rs)

goal (2 subgoals):
 1. \<And>ks x l u. \<lbrakk>sorted_less (leaves (Leaf ks)); aligned l (Leaf ks) u\<rbrakk> \<Longrightarrow> isin (Leaf ks) x = (x \<in> set (leaves (Leaf ks)))
 2. \<And>ts t x l u. \<lbrakk>\<And>xa y l u. \<lbrakk>(xa, y) = split ts x; y = []; sorted_less (leaves t); aligned l t u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t)); \<And>xa y x21 x22 xaa ya l u. \<lbrakk>(xa, y) = split ts x; y = x21 # x22; (xaa, ya) = x21; sorted_less (leaves xaa); aligned l xaa u\<rbrakk> \<Longrightarrow> isin xaa x = (x \<in> set (leaves xaa)); sorted_less (leaves (Node ts t)); aligned l (Node ts t) u\<rbrakk> \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
split ts x = (ls, rs)
[PROOF STEP]
have list_conc: "ts = ls @ rs"
[PROOF STATE]
proof (prove)
using this:
split ts x = (ls, rs)

goal (1 subgoal):
 1. ts = ls @ rs
[PROOF STEP]
using split_conc
[PROOF STATE]
proof (prove)
using this:
split ts x = (ls, rs)
split ?xs ?p = (?ls, ?rs) \<Longrightarrow> ?xs = ?ls @ ?rs

goal (1 subgoal):
 1. ts = ls @ rs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ts = ls @ rs

goal (2 subgoals):
 1. \<And>ks x l u. \<lbrakk>sorted_less (leaves (Leaf ks)); aligned l (Leaf ks) u\<rbrakk> \<Longrightarrow> isin (Leaf ks) x = (x \<in> set (leaves (Leaf ks)))
 2. \<And>ts t x l u. \<lbrakk>\<And>xa y l u. \<lbrakk>(xa, y) = split ts x; y = []; sorted_less (leaves t); aligned l t u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t)); \<And>xa y x21 x22 xaa ya l u. \<lbrakk>(xa, y) = split ts x; y = x21 # x22; (xaa, ya) = x21; sorted_less (leaves xaa); aligned l xaa u\<rbrakk> \<Longrightarrow> isin xaa x = (x \<in> set (leaves xaa)); sorted_less (leaves (Node ts t)); aligned l (Node ts t) u\<rbrakk> \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
proof (cases rs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rs = [] \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
 2. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
rs = []

goal (2 subgoals):
 1. rs = [] \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
 2. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rs = []
[PROOF STEP]
have "isin (Node ts t) x = isin t x"
[PROOF STATE]
proof (prove)
using this:
rs = []

goal (1 subgoal):
 1. isin (Node ts t) x = isin t x
[PROOF STEP]
by (simp add: list_split)
[PROOF STATE]
proof (state)
this:
isin (Node ts t) x = isin t x

goal (2 subgoals):
 1. rs = [] \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
 2. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
isin (Node ts t) x = isin t x

goal (2 subgoals):
 1. rs = [] \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
 2. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
have "\<dots> = (x \<in> set (leaves t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isin t x = (x \<in> set (leaves t))
[PROOF STEP]
using "2.IH"(1)[of ls rs] list_split Nil
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(ls, rs) = split ts x; rs = []; sorted_less (leaves t); aligned ?l t ?u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t))
split ts x = (ls, rs)
rs = []

goal (1 subgoal):
 1. isin t x = (x \<in> set (leaves t))
[PROOF STEP]
using "2.prems" sorted_leaves_induct_last align_last'
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(ls, rs) = split ts x; rs = []; sorted_less (leaves t); aligned ?l t ?u\<rbrakk> \<Longrightarrow> isin t x = (x \<in> set (leaves t))
split ts x = (ls, rs)
rs = []
sorted_less (leaves (Node ts t))
aligned l (Node ts t) u
sorted_less (leaves (Node ?ts ?t)) \<Longrightarrow> sorted_less (leaves ?t)
aligned ?l (Node ?ts ?t) ?u \<Longrightarrow> \<exists>l'\<in>set (separators ?ts) \<union> {?l}. aligned l' ?t ?u

goal (1 subgoal):
 1. isin t x = (x \<in> set (leaves t))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
isin t x = (x \<in> set (leaves t))

goal (2 subgoals):
 1. rs = [] \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
 2. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
isin t x = (x \<in> set (leaves t))

goal (2 subgoals):
 1. rs = [] \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
 2. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
have "\<dots> = (x \<in> set (leaves (Node ts t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set (leaves t)) = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
using isin_sorted_split
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Laligned (Node ?ts ?t) ?u; sorted_less (leaves (Node ?ts ?t)); split ?ts ?x = (?ls, ?rs)\<rbrakk> \<Longrightarrow> (?x \<in> set (leaves (Node ?ts ?t))) = (?x \<in> set (leaves_list ?rs @ leaves ?t))

goal (1 subgoal):
 1. (x \<in> set (leaves t)) = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
using "2.prems" list_split list_conc Nil
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Laligned (Node ?ts ?t) ?u; sorted_less (leaves (Node ?ts ?t)); split ?ts ?x = (?ls, ?rs)\<rbrakk> \<Longrightarrow> (?x \<in> set (leaves (Node ?ts ?t))) = (?x \<in> set (leaves_list ?rs @ leaves ?t))
sorted_less (leaves (Node ts t))
aligned l (Node ts t) u
split ts x = (ls, rs)
ts = ls @ rs
rs = []

goal (1 subgoal):
 1. (x \<in> set (leaves t)) = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
by (metis aligned_imp_Laligned leaves.simps(2) leaves_conc same_append_eq self_append_conv)
[PROOF STATE]
proof (state)
this:
(x \<in> set (leaves t)) = (x \<in> set (leaves (Node ts t)))

goal (2 subgoals):
 1. rs = [] \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
 2. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))

goal (1 subgoal):
 1. isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))

goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
case (Cons a list)
[PROOF STATE]
proof (state)
this:
rs = a # list

goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rs = a # list
[PROOF STEP]
obtain sub sep where a_split: "a = (sub,sep)"
[PROOF STATE]
proof (prove)
using this:
rs = a # list

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

goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = (sub, sep)
[PROOF STEP]
have "isin (Node ts t) x = isin sub x"
[PROOF STATE]
proof (prove)
using this:
a = (sub, sep)

goal (1 subgoal):
 1. isin (Node ts t) x = isin sub x
[PROOF STEP]
using list_split Cons a_split
[PROOF STATE]
proof (prove)
using this:
a = (sub, sep)
split ts x = (ls, rs)
rs = a # list
a = (sub, sep)

goal (1 subgoal):
 1. isin (Node ts t) x = isin sub x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isin (Node ts t) x = isin sub x

goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
isin (Node ts t) x = isin sub x

goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
have "\<dots> = (x \<in> set (leaves sub))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isin sub x = (x \<in> set (leaves sub))
[PROOF STEP]
using "2.IH"(2)[of ls rs "(sub,sep)" list sub sep]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(ls, rs) = split ts x; rs = (sub, sep) # list; (sub, sep) = (sub, sep); sorted_less (leaves sub); aligned ?l sub ?u\<rbrakk> \<Longrightarrow> isin sub x = (x \<in> set (leaves sub))

goal (1 subgoal):
 1. isin sub x = (x \<in> set (leaves sub))
[PROOF STEP]
using "2.prems" a_split list_conc list_split local.Cons sorted_leaves_induct_subtree
              align_sub
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(ls, rs) = split ts x; rs = (sub, sep) # list; (sub, sep) = (sub, sep); sorted_less (leaves sub); aligned ?l sub ?u\<rbrakk> \<Longrightarrow> isin sub x = (x \<in> set (leaves sub))
sorted_less (leaves (Node ts t))
aligned l (Node ts t) u
a = (sub, sep)
ts = ls @ rs
split ts x = (ls, rs)
rs = a # list
sorted_less (leaves (Node (?ls @ (?sub, ?sep) # ?rs) ?t)) \<Longrightarrow> sorted_less (leaves ?sub)
\<lbrakk>aligned ?l (Node ?ts ?t) ?u; (?sub, ?sep) \<in> set ?ts\<rbrakk> \<Longrightarrow> \<exists>l'\<in>set (separators ?ts) \<union> {?l}. aligned l' ?sub ?sep

goal (1 subgoal):
 1. isin sub x = (x \<in> set (leaves sub))
[PROOF STEP]
by (metis in_set_conv_decomp)
[PROOF STATE]
proof (state)
this:
isin sub x = (x \<in> set (leaves sub))

goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
isin sub x = (x \<in> set (leaves sub))

goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
have "\<dots> = (x \<in> set (leaves (Node ts t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set (leaves sub)) = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
using isin_sorted_split
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Laligned (Node ?ts ?t) ?u; sorted_less (leaves (Node ?ts ?t)); split ?ts ?x = (?ls, ?rs)\<rbrakk> \<Longrightarrow> (?x \<in> set (leaves (Node ?ts ?t))) = (?x \<in> set (leaves_list ?rs @ leaves ?t))

goal (1 subgoal):
 1. (x \<in> set (leaves sub)) = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
using isin_sorted_split_right "2.prems" list_split Cons a_split
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Laligned (Node ?ts ?t) ?u; sorted_less (leaves (Node ?ts ?t)); split ?ts ?x = (?ls, ?rs)\<rbrakk> \<Longrightarrow> (?x \<in> set (leaves (Node ?ts ?t))) = (?x \<in> set (leaves_list ?rs @ leaves ?t))
\<lbrakk>split ?ts ?x = (?ls, (?sub, ?sep) # ?rs); sorted_less (leaves (Node ?ts ?t)); Laligned (Node ?ts ?t) ?u\<rbrakk> \<Longrightarrow> (?x \<in> set (leaves_list ((?sub, ?sep) # ?rs) @ leaves ?t)) = (?x \<in> set (leaves ?sub))
sorted_less (leaves (Node ts t))
aligned l (Node ts t) u
split ts x = (ls, rs)
rs = a # list
a = (sub, sep)

goal (1 subgoal):
 1. (x \<in> set (leaves sub)) = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
using aligned_imp_Laligned
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Laligned (Node ?ts ?t) ?u; sorted_less (leaves (Node ?ts ?t)); split ?ts ?x = (?ls, ?rs)\<rbrakk> \<Longrightarrow> (?x \<in> set (leaves (Node ?ts ?t))) = (?x \<in> set (leaves_list ?rs @ leaves ?t))
\<lbrakk>split ?ts ?x = (?ls, (?sub, ?sep) # ?rs); sorted_less (leaves (Node ?ts ?t)); Laligned (Node ?ts ?t) ?u\<rbrakk> \<Longrightarrow> (?x \<in> set (leaves_list ((?sub, ?sep) # ?rs) @ leaves ?t)) = (?x \<in> set (leaves ?sub))
sorted_less (leaves (Node ts t))
aligned l (Node ts t) u
split ts x = (ls, rs)
rs = a # list
a = (sub, sep)
aligned ?l ?t ?u \<Longrightarrow> Laligned ?t ?u

goal (1 subgoal):
 1. (x \<in> set (leaves sub)) = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(x \<in> set (leaves sub)) = (x \<in> set (leaves (Node ts t)))

goal (1 subgoal):
 1. \<And>a list. rs = a # list \<Longrightarrow> isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))

goal (1 subgoal):
 1. isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
isin (Node ts t) x = (x \<in> set (leaves (Node ts t)))

goal (1 subgoal):
 1. \<And>ks x l u. \<lbrakk>sorted_less (leaves (Leaf ks)); aligned l (Leaf ks) u\<rbrakk> \<Longrightarrow> isin (Leaf ks) x = (x \<in> set (leaves (Leaf ks)))
[PROOF STEP]
qed (auto simp add: insert_list_req)


[STATEMENT]
lemma append_constant_length_induct: "
  \<lbrakk> \<And>ys. k = 0 \<or> length ys < k \<Longrightarrow> P ys;
    \<And>xs ys. \<lbrakk> length xs = k; P ys \<rbrakk> \<Longrightarrow> P (xs @ ys) \<rbrakk> \<Longrightarrow> P xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>ys. k = 0 \<or> length ys < k \<Longrightarrow> P ys; \<And>xs ys. \<lbrakk>length xs = k; P ys\<rbrakk> \<Longrightarrow> P (xs @ ys)\<rbrakk> \<Longrightarrow> P xs
[PROOF STEP]
by (simp add: append_constant_length_induct_aux[of _ _ "length xs div k"])


[STATEMENT]
lemma concat_suc: "Suc as \<le> length xs \<Longrightarrow>
       concat (take (Suc as) xs) = concat (take as xs) @ xs! as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc as \<le> length xs \<Longrightarrow> concat (take (Suc as) xs) = concat (take as xs) @ xs ! as
[PROOF STEP]
apply(subgoal_tac "take (Suc as) xs = take as xs @ [xs ! as]", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc as \<le> length xs \<Longrightarrow> take (Suc as) xs = take as xs @ [xs ! as]
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_divide_X_power':
  fixes   f :: "'a::{semiring_1,inverse,uminus} fps"
  assumes "inverse (1::'a) = 1"
  shows   "f / (fps_X ^ n) = fps_shift n f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f / fps_X ^ n = fps_shift n f
[PROOF STEP]
using   fps_inverse_one'[OF assms] fps_one_mult(2)[of f]
[PROOF STATE]
proof (prove)
using this:
inverse 1 = 1
f * 1 = f

goal (1 subgoal):
 1. f / fps_X ^ n = fps_shift n f
[PROOF STEP]
by      (simp add: fps_divide_def fps_X_power_subdegree)


[STATEMENT]
lemma no_self_loop: "\<forall>u. (u, u) \<notin> E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u. (u, u) \<notin> E
[PROOF STEP]
using no_parallel_edge
[PROOF STATE]
proof (prove)
using this:
\<forall>u v. (u, v) \<in> E \<longrightarrow> (v, u) \<notin> E

goal (1 subgoal):
 1. \<forall>u. (u, u) \<notin> E
[PROOF STEP]
by auto


[STATEMENT]
lemma integrable_cmul_real:
  fixes K::real
  shows "f integrable_on X \<Longrightarrow> (\<lambda>x. K * f x) integrable_on X "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on X \<Longrightarrow> (\<lambda>x. K * f x) integrable_on X
[PROOF STEP]
unfolding real_scaleR_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on X \<Longrightarrow> (\<lambda>x. K *\<^sub>R f x) integrable_on X
[PROOF STEP]
by (rule integrable_cmul)


[STATEMENT]
lemma has_vector_derivative_mult_left[derivative_intros]:
  fixes a :: "'a::real_normed_algebra"
  shows "(f has_vector_derivative x) F \<Longrightarrow> ((\<lambda>x. f x * a) has_vector_derivative (x * a)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_vector_derivative x) F \<Longrightarrow> ((\<lambda>x. f x * a) has_vector_derivative x * a) F
[PROOF STEP]
by (rule bounded_linear.has_vector_derivative[OF bounded_linear_mult_left])


[STATEMENT]
lemma normal_poly_coeff_mult:
    "normal_poly p \<Longrightarrow> coeff p i * coeff p (i+2) \<le> (coeff p (i+1))^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normal_poly p \<Longrightarrow> coeff p i * coeff p (i + 2) \<le> (coeff p (i + 1))\<^sup>2
[PROOF STEP]
using normal_poly_def
[PROOF STATE]
proof (prove)
using this:
normal_poly ?p \<equiv> ?p \<noteq> 0 \<and> (\<forall>i. (0::?'a) \<le> coeff ?p i) \<and> (\<forall>i. coeff ?p i * coeff ?p (i + 2) \<le> (coeff ?p (i + 1))\<^sup>2) \<and> (\<forall>i j k. i \<le> j \<longrightarrow> j \<le> k \<longrightarrow> (0::?'a) < coeff ?p i \<longrightarrow> (0::?'a) < coeff ?p k \<longrightarrow> (0::?'a) < coeff ?p j)

goal (1 subgoal):
 1. normal_poly p \<Longrightarrow> coeff p i * coeff p (i + 2) \<le> (coeff p (i + 1))\<^sup>2
[PROOF STEP]
by blast


[STATEMENT]
lemma mem_affine_3:
  assumes "affine S" "x \<in> S" "y \<in> S" "z \<in> S" "u + v + w = 1"
  shows "u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S
[PROOF STEP]
have "u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}
[PROOF STEP]
using affine_hull_3[of x y z] assms
[PROOF STATE]
proof (prove)
using this:
affine hull {x, y, z} = {u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z |u v w. u + v + w = 1}
affine S
x \<in> S
y \<in> S
z \<in> S
u + v + w = 1

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S
[PROOF STEP]
have "affine hull {x, y, z} \<subseteq> affine hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull {x, y, z} \<subseteq> affine hull S
[PROOF STEP]
using hull_mono[of "{x, y, z}" "S"] assms
[PROOF STATE]
proof (prove)
using this:
{x, y, z} \<subseteq> S \<Longrightarrow> ?S hull {x, y, z} \<subseteq> ?S hull S
affine S
x \<in> S
y \<in> S
z \<in> S
u + v + w = 1

goal (1 subgoal):
 1. affine hull {x, y, z} \<subseteq> affine hull S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull {x, y, z} \<subseteq> affine hull S

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
affine hull {x, y, z} \<subseteq> affine hull S

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S
[PROOF STEP]
have "affine hull S = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull S = S
[PROOF STEP]
using assms affine_hull_eq[of S]
[PROOF STATE]
proof (prove)
using this:
affine S
x \<in> S
y \<in> S
z \<in> S
u + v + w = 1
(affine hull S = S) = affine S

goal (1 subgoal):
 1. affine hull S = S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull S = S

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}
affine hull {x, y, z} \<subseteq> affine hull S
affine hull S = S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}
affine hull {x, y, z} \<subseteq> affine hull S
affine hull S = S

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in program) last_action_of_thread:
assumes trace: "trace c 0 k"
shows
  "\<comment> \<open>thread i never executes\<close>
  (\<forall>l \<le> k. fst (c l)!i = fst (c k)!i)  \<or>
  \<comment> \<open>thread i has a last step in the trace\<close>
  (\<exists>last <  k.
    fst (c last)!i \<noteq> fst (c (Suc last))!i \<and>
    (\<forall>l. last < l \<longrightarrow> l \<le> k \<longrightarrow> fst (c l)!i = fst (c k)!i)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i))
[PROOF STEP]
using trace
[PROOF STATE]
proof (prove)
using this:
trace c 0 k

goal (1 subgoal):
 1. (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i))
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. trace c 0 0 \<Longrightarrow> (\<forall>l\<le>0. fst (c l) ! i = fst (c 0) ! i) \<or> (\<exists>last<0. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> 0 \<longrightarrow> fst (c l) ! i = fst (c 0) ! i))
 2. \<And>k. \<lbrakk>trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i)); trace c 0 (Suc k)\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
trace c 0 0

goal (2 subgoals):
 1. trace c 0 0 \<Longrightarrow> (\<forall>l\<le>0. fst (c l) ! i = fst (c 0) ! i) \<or> (\<exists>last<0. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> 0 \<longrightarrow> fst (c l) ! i = fst (c 0) ! i))
 2. \<And>k. \<lbrakk>trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i)); trace c 0 (Suc k)\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
trace c 0 0

goal (1 subgoal):
 1. (\<forall>l\<le>0. fst (c l) ! i = fst (c 0) ! i) \<or> (\<exists>last<0. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> 0 \<longrightarrow> fst (c l) ! i = fst (c 0) ! i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>l\<le>0. fst (c l) ! i = fst (c 0) ! i) \<or> (\<exists>last<0. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> 0 \<longrightarrow> fst (c l) ! i = fst (c 0) ! i))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i)); trace c 0 (Suc k)\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i)); trace c 0 (Suc k)\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i))
trace c 0 (Suc k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i)); trace c 0 (Suc k)\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
hence "trace c 0 (Suc k)"
[PROOF STATE]
proof (prove)
using this:
trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i))
trace c 0 (Suc k)

goal (1 subgoal):
 1. trace c 0 (Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
trace c 0 (Suc k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i)); trace c 0 (Suc k)\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
trace c 0 (Suc k)
[PROOF STEP]
obtain
    trace_k: "trace c 0 k" and
    last_step: "c k \<Rightarrow>\<^sub>d c (Suc k) "
[PROOF STATE]
proof (prove)
using this:
trace c 0 (Suc k)

goal (1 subgoal):
 1. (\<lbrakk>trace c 0 k; c k \<Rightarrow>\<^sub>d c (Suc k)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (clarsimp simp add: program_trace_def)
[PROOF STATE]
proof (state)
this:
trace c 0 k
c k \<Rightarrow>\<^sub>d c (Suc k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>trace c 0 k \<Longrightarrow> (\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i)); trace c 0 (Suc k)\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
proof (cases "fst (c k)!i = fst (c (Suc k))!i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
 2. fst (c k) ! i \<noteq> fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
fst (c k) ! i \<noteq> fst (c (Suc k)) ! i

goal (2 subgoals):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
 2. fst (c k) ! i \<noteq> fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fst (c k) ! i \<noteq> fst (c (Suc k)) ! i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fst (c k) ! i \<noteq> fst (c (Suc k)) ! i

goal (1 subgoal):
 1. (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (c k) ! i \<noteq> fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
apply (rule disjI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (c k) ! i \<noteq> fst (c (Suc k)) ! i \<Longrightarrow> \<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i)
[PROOF STEP]
apply (rule_tac x=k in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (c k) ! i \<noteq> fst (c (Suc k)) ! i \<Longrightarrow> k < Suc k \<and> fst (c k) ! i \<noteq> fst (c (Suc k)) ! i \<and> (\<forall>l>k. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. \<lbrakk>fst (c k) ! i \<noteq> fst (c (Suc k)) ! i; k < l; l \<le> Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply (subgoal_tac "l=Suc k")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>l. \<lbrakk>fst (c k) ! i \<noteq> fst (c (Suc k)) ! i; k < l; l \<le> Suc k; l = Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
 2. \<And>l. \<lbrakk>fst (c k) ! i \<noteq> fst (c (Suc k)) ! i; k < l; l \<le> Suc k\<rbrakk> \<Longrightarrow> l = Suc k
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
fst (c k) ! i = fst (c (Suc k)) ! i

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
note idle_i = this
[PROOF STATE]
proof (state)
this:
fst (c k) ! i = fst (c (Suc k)) ! i

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
fst (c k) ! i = fst (c (Suc k)) ! i

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
assume same: "(\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i)"
[PROOF STATE]
proof (state)
this:
\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
apply (rule disjI1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. l \<le> Suc k \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply (case_tac "l=Suc k")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>l. \<lbrakk>l \<le> Suc k; l = Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
 2. \<And>l. \<lbrakk>l \<le> Suc k; l \<noteq> Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply  (simp add: idle_i)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. \<lbrakk>l \<le> Suc k; l \<noteq> Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply (rule same [simplified idle_i, rule_format])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. \<lbrakk>l \<le> Suc k; l \<noteq> Suc k\<rbrakk> \<Longrightarrow> l \<le> k
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
fix last
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
assume last_k: "last < k"
[PROOF STATE]
proof (state)
this:
last < k

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
assume last_step: "fst (c last) ! i \<noteq> fst (c (Suc last)) ! i"
[PROOF STATE]
proof (state)
this:
fst (c last) ! i \<noteq> fst (c (Suc last)) ! i

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
assume idle: "(\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i)"
[PROOF STATE]
proof (state)
this:
\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
apply (rule disjI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i)
[PROOF STEP]
apply (rule_tac x=last in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last < Suc k \<and> fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i)
[PROOF STEP]
using last_k
[PROOF STATE]
proof (prove)
using this:
last < k

goal (1 subgoal):
 1. last < Suc k \<and> fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i)
[PROOF STEP]
apply (simp add:  last_step)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last < k \<Longrightarrow> \<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
using idle [simplified idle_i]
[PROOF STATE]
proof (prove)
using this:
\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i

goal (1 subgoal):
 1. last < k \<Longrightarrow> \<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. \<lbrakk>last < k; \<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i; last < l; l \<le> Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply (case_tac "l=Suc k")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>l. \<lbrakk>last < k; \<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i; last < l; l \<le> Suc k; l = Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
 2. \<And>l. \<lbrakk>last < k; \<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i; last < l; l \<le> Suc k; l \<noteq> Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply  clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. \<lbrakk>last < k; \<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i; last < l; l \<le> Suc k; l \<noteq> Suc k\<rbrakk> \<Longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?last2 < k; fst (c ?last2) ! i \<noteq> fst (c (Suc ?last2)) ! i; \<forall>l>?last2. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?last2 < k; fst (c ?last2) ! i \<noteq> fst (c (Suc ?last2)) ! i; \<forall>l>?last2. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
note Suc.hyps [OF trace_k]
[PROOF STATE]
proof (state)
this:
(\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i))

goal (1 subgoal):
 1. fst (c k) ! i = fst (c (Suc k)) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
\<lbrakk>?last2 < k; fst (c ?last2) ! i \<noteq> fst (c (Suc ?last2)) ! i; \<forall>l>?last2. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
(\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
\<lbrakk>?last2 < k; fst (c ?last2) ! i \<noteq> fst (c (Suc ?last2)) ! i; \<forall>l>?last2. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i\<rbrakk> \<Longrightarrow> (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
(\<forall>l\<le>k. fst (c l) ! i = fst (c k) ! i) \<or> (\<exists>last<k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> k \<longrightarrow> fst (c l) ! i = fst (c k) ! i))

goal (1 subgoal):
 1. (\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<forall>l\<le>Suc k. fst (c l) ! i = fst (c (Suc k)) ! i) \<or> (\<exists>last<Suc k. fst (c last) ! i \<noteq> fst (c (Suc last)) ! i \<and> (\<forall>l>last. l \<le> Suc k \<longrightarrow> fst (c l) ! i = fst (c (Suc k)) ! i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nterm_to_term_wellformed: "wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t)
[PROOF STEP]
proof (induction t arbitrary: \<Gamma>)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x \<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (Nconst x))
 2. \<And>x \<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (Nvar x))
 3. \<And>x1a t \<Gamma>. (\<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t)) \<Longrightarrow> wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (\<Lambda>\<^sub>n x1a. t))
 4. \<And>t1 t2 \<Gamma>. \<lbrakk>\<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t1); \<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t2)\<rbrakk> \<Longrightarrow> wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (t1 $\<^sub>n t2))
[PROOF STEP]
case (Nabs x t)
[PROOF STATE]
proof (state)
this:
wellformed' (length ?\<Gamma>) (nterm_to_term ?\<Gamma> t)

goal (4 subgoals):
 1. \<And>x \<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (Nconst x))
 2. \<And>x \<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (Nvar x))
 3. \<And>x1a t \<Gamma>. (\<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t)) \<Longrightarrow> wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (\<Lambda>\<^sub>n x1a. t))
 4. \<And>t1 t2 \<Gamma>. \<lbrakk>\<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t1); \<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t2)\<rbrakk> \<Longrightarrow> wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (t1 $\<^sub>n t2))
[PROOF STEP]
hence "wellformed' (Suc (length \<Gamma>)) (nterm_to_term (x # \<Gamma>) t)"
[PROOF STATE]
proof (prove)
using this:
wellformed' (length ?\<Gamma>) (nterm_to_term ?\<Gamma> t)

goal (1 subgoal):
 1. wellformed' (Suc (length \<Gamma>)) (nterm_to_term (x # \<Gamma>) t)
[PROOF STEP]
by (metis length_Cons)
[PROOF STATE]
proof (state)
this:
wellformed' (Suc (length \<Gamma>)) (nterm_to_term (x # \<Gamma>) t)

goal (4 subgoals):
 1. \<And>x \<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (Nconst x))
 2. \<And>x \<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (Nvar x))
 3. \<And>x1a t \<Gamma>. (\<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t)) \<Longrightarrow> wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (\<Lambda>\<^sub>n x1a. t))
 4. \<And>t1 t2 \<Gamma>. \<lbrakk>\<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t1); \<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t2)\<rbrakk> \<Longrightarrow> wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (t1 $\<^sub>n t2))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wellformed' (Suc (length \<Gamma>)) (nterm_to_term (x # \<Gamma>) t)

goal (1 subgoal):
 1. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (\<Lambda>\<^sub>n x. t))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (\<Lambda>\<^sub>n x. t))

goal (3 subgoals):
 1. \<And>x \<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (Nconst x))
 2. \<And>x \<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (Nvar x))
 3. \<And>t1 t2 \<Gamma>. \<lbrakk>\<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t1); \<And>\<Gamma>. wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> t2)\<rbrakk> \<Longrightarrow> wellformed' (length \<Gamma>) (nterm_to_term \<Gamma> (t1 $\<^sub>n t2))
[PROOF STEP]
qed (auto simp: find_first_correct split: option.splits)


[STATEMENT]
lemma (in CRR_market)
  assumes "q = (1 + r - d)/(u -d)"
  and "viable_market Mkt"
  shows gt_param: "0 < q"
    and lt_param: "q < 1"
    and risk_neutral_param: "u * q + d * (1 - q) = 1 + r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < q &&& q < 1 &&& u * q + d * (1 - q) = 1 + r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < q
 2. q < 1
 3. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
show "0 < q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < q
[PROOF STEP]
using  down_lt_up viable_only_if_d assms
[PROOF STATE]
proof (prove)
using this:
d < u
viable_market Mkt \<Longrightarrow> d < 1 + r
q = (1 + r - d) / (u - d)
viable_market Mkt

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

goal (2 subgoals):
 1. q < 1
 2. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
show "q < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q < 1
[PROOF STEP]
using down_lt_up viable_only_if_u assms
[PROOF STATE]
proof (prove)
using this:
d < u
viable_market Mkt \<Longrightarrow> 1 + r < u
q = (1 + r - d) / (u - d)
viable_market Mkt

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

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
show "u * q + d * (1 - q) = 1 + r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "1 - q = 1 - (1 + r - d) / (u - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - q = 1 - (1 + r - d) / (u - d)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
q = (1 + r - d) / (u - d)
viable_market Mkt

goal (1 subgoal):
 1. 1 - q = 1 - (1 + r - d) / (u - d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 - q = 1 - (1 + r - d) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 - q = 1 - (1 + r - d) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "... = (u - d)/(u - d) - (1 + r - d) / (u - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (1 + r - d) / (u - d) = (u - d) / (u - d) - (1 + r - d) / (u - d)
[PROOF STEP]
using down_lt_up
[PROOF STATE]
proof (prove)
using this:
d < u

goal (1 subgoal):
 1. 1 - (1 + r - d) / (u - d) = (u - d) / (u - d) - (1 + r - d) / (u - d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 - (1 + r - d) / (u - d) = (u - d) / (u - d) - (1 + r - d) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 - (1 + r - d) / (u - d) = (u - d) / (u - d) - (1 + r - d) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "... = (u - d - (1 + r - d))/(u-d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u - d) / (u - d) - (1 + r - d) / (u - d) = (u - d - (1 + r - d)) / (u - d)
[PROOF STEP]
using  diff_divide_distrib[of "u - d" "1 + r -d" "u -d"]
[PROOF STATE]
proof (prove)
using this:
(u - d - (1 + r - d)) / (u - d) = (u - d) / (u - d) - (1 + r - d) / (u - d)

goal (1 subgoal):
 1. (u - d) / (u - d) - (1 + r - d) / (u - d) = (u - d - (1 + r - d)) / (u - d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u - d) / (u - d) - (1 + r - d) / (u - d) = (u - d - (1 + r - d)) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(u - d) / (u - d) - (1 + r - d) / (u - d) = (u - d - (1 + r - d)) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "... = (u - 1 - r)/(u-d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u - d - (1 + r - d)) / (u - d) = (u - 1 - r) / (u - d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u - d - (1 + r - d)) / (u - d) = (u - 1 - r) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 - q = (u - 1 - r) / (u - d)
[PROOF STEP]
have "1 - q = (u - 1 - r)/(u -d)"
[PROOF STATE]
proof (prove)
using this:
1 - q = (u - 1 - r) / (u - d)

goal (1 subgoal):
 1. 1 - q = (u - 1 - r) / (u - d)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
1 - q = (u - 1 - r) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
hence "u * q + d * (1 - q) = u * (1 + r - d)/(u - d) + d * (u - 1 - r)/(u - d)"
[PROOF STATE]
proof (prove)
using this:
1 - q = (u - 1 - r) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = u * (1 + r - d) / (u - d) + d * (u - 1 - r) / (u - d)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 - q = (u - 1 - r) / (u - d)
q = (1 + r - d) / (u - d)
viable_market Mkt

goal (1 subgoal):
 1. u * q + d * (1 - q) = u * (1 + r - d) / (u - d) + d * (u - 1 - r) / (u - d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u * q + d * (1 - q) = u * (1 + r - d) / (u - d) + d * (u - 1 - r) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u * q + d * (1 - q) = u * (1 + r - d) / (u - d) + d * (u - 1 - r) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "... = (u * (1 + r - d) + d * (u - 1 - r))/(u - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * (1 + r - d) / (u - d) + d * (u - 1 - r) / (u - d) = (u * (1 + r - d) + d * (u - 1 - r)) / (u - d)
[PROOF STEP]
using add_divide_distrib[of "u * (1 + r - d)"]
[PROOF STATE]
proof (prove)
using this:
(u * (1 + r - d) + ?b) / ?c = u * (1 + r - d) / ?c + ?b / ?c

goal (1 subgoal):
 1. u * (1 + r - d) / (u - d) + d * (u - 1 - r) / (u - d) = (u * (1 + r - d) + d * (u - 1 - r)) / (u - d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u * (1 + r - d) / (u - d) + d * (u - 1 - r) / (u - d) = (u * (1 + r - d) + d * (u - 1 - r)) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u * (1 + r - d) / (u - d) + d * (u - 1 - r) / (u - d) = (u * (1 + r - d) + d * (u - 1 - r)) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "... = (u * (1 + r) - u * d + d * u - d * (1 + r))/(u - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u * (1 + r - d) + d * (u - 1 - r)) / (u - d) = (u * (1 + r) - u * d + d * u - d * (1 + r)) / (u - d)
[PROOF STEP]
by (simp add: diff_diff_add right_diff_distrib')
[PROOF STATE]
proof (state)
this:
(u * (1 + r - d) + d * (u - 1 - r)) / (u - d) = (u * (1 + r) - u * d + d * u - d * (1 + r)) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(u * (1 + r - d) + d * (u - 1 - r)) / (u - d) = (u * (1 + r) - u * d + d * u - d * (1 + r)) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "... = (u * (1+r) - d * (1+r))/(u - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u * (1 + r) - u * d + d * u - d * (1 + r)) / (u - d) = (u * (1 + r) - d * (1 + r)) / (u - d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u * (1 + r) - u * d + d * u - d * (1 + r)) / (u - d) = (u * (1 + r) - d * (1 + r)) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(u * (1 + r) - u * d + d * u - d * (1 + r)) / (u - d) = (u * (1 + r) - d * (1 + r)) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "... = ((u - d) * (1+r))/(u - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u * (1 + r) - d * (1 + r)) / (u - d) = (u - d) * (1 + r) / (u - d)
[PROOF STEP]
by (simp add: left_diff_distrib)
[PROOF STATE]
proof (state)
this:
(u * (1 + r) - d * (1 + r)) / (u - d) = (u - d) * (1 + r) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(u * (1 + r) - d * (1 + r)) / (u - d) = (u - d) * (1 + r) / (u - d)

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
have "... = 1 + r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u - d) * (1 + r) / (u - d) = 1 + r
[PROOF STEP]
using down_lt_up
[PROOF STATE]
proof (prove)
using this:
d < u

goal (1 subgoal):
 1. (u - d) * (1 + r) / (u - d) = 1 + r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u - d) * (1 + r) / (u - d) = 1 + r

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
u * q + d * (1 - q) = 1 + r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u * q + d * (1 - q) = 1 + r

goal (1 subgoal):
 1. u * q + d * (1 - q) = 1 + r
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
u * q + d * (1 - q) = 1 + r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u * q + d * (1 - q) = 1 + r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iT_Div_mod_inext_nth: "
  \<lbrakk> I \<noteq> {}; \<forall>x\<in>I. \<forall>y\<in>I. x mod k = y mod k \<rbrakk> \<Longrightarrow>
  (I \<oslash> k) \<rightarrow> n = (I \<rightarrow> n) div k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; \<forall>x\<in>I. \<forall>y\<in>I. x mod k = y mod k\<rbrakk> \<Longrightarrow> (I \<oslash> k) \<rightarrow> n = (I \<rightarrow> n) div k
[PROOF STEP]
apply (case_tac "k = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>I \<noteq> {}; \<forall>x\<in>I. \<forall>y\<in>I. x mod k = y mod k; k = 0\<rbrakk> \<Longrightarrow> (I \<oslash> k) \<rightarrow> n = (I \<rightarrow> n) div k
 2. \<lbrakk>I \<noteq> {}; \<forall>x\<in>I. \<forall>y\<in>I. x mod k = y mod k; k \<noteq> 0\<rbrakk> \<Longrightarrow> (I \<oslash> k) \<rightarrow> n = (I \<rightarrow> n) div k
[PROOF STEP]
apply (simp add: iT_Div_0 iTILL_0 inext_nth_singleton)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; \<forall>x\<in>I. \<forall>y\<in>I. x mod k = y mod k; k \<noteq> 0\<rbrakk> \<Longrightarrow> (I \<oslash> k) \<rightarrow> n = (I \<rightarrow> n) div k
[PROOF STEP]
apply (simp add: iT_Div_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; \<forall>x\<in>I. \<forall>y\<in>I. x mod k = y mod k; 0 < k\<rbrakk> \<Longrightarrow> ((\<lambda>n. n div k) ` I) \<rightarrow> n = (I \<rightarrow> n) div k
[PROOF STEP]
by (rule inext_nth_image[OF _ mod_eq_div_right_strict_mono_on])


[STATEMENT]
lemma image_mset_lists [simp]:
  "mset ` lists A = multisets A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset ` lists A = multisets A
[PROOF STEP]
using surj_on_multisets_mset [of A]
[PROOF STATE]
proof (prove)
using this:
\<forall>M\<in>multisets A. \<exists>xs\<in>lists A. M = mset xs

goal (1 subgoal):
 1. mset ` lists A = multisets A
[PROOF STEP]
by auto (metis mem_Collect_eq multisets_def set_mset_mset subsetI)


[STATEMENT]
lemma distinct_lists_finite :
  assumes "finite X"
  shows "finite {xs . set xs \<subseteq> X \<and> distinct xs }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
define k where "k = card X"
[PROOF STATE]
proof (state)
this:
k = card X

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
have "\<And> xs . set xs \<subseteq> X \<Longrightarrow> distinct xs \<Longrightarrow> length xs \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>set xs \<subseteq> X; distinct xs\<rbrakk> \<Longrightarrow> length xs \<le> k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>set xs \<subseteq> X; distinct xs\<rbrakk> \<Longrightarrow> length xs \<le> k
[PROOF STEP]
unfolding \<open>k = card X\<close>
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>set xs \<subseteq> X; distinct xs\<rbrakk> \<Longrightarrow> length xs \<le> card X
[PROOF STEP]
by (metis card_mono distinct_card)
[PROOF STATE]
proof (state)
this:
\<lbrakk>set ?xs \<subseteq> X; distinct ?xs\<rbrakk> \<Longrightarrow> length ?xs \<le> k

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>set ?xs \<subseteq> X; distinct ?xs\<rbrakk> \<Longrightarrow> length ?xs \<le> k
[PROOF STEP]
have "{xs . set xs \<subseteq> X \<and> distinct xs } \<subseteq> {xs . set xs \<subseteq> X \<and> length xs \<le> k}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?xs \<subseteq> X; distinct ?xs\<rbrakk> \<Longrightarrow> length ?xs \<le> k

goal (1 subgoal):
 1. {xs. set xs \<subseteq> X \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> X \<and> length xs \<le> k}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{xs. set xs \<subseteq> X \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> X \<and> length xs \<le> k}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{xs. set xs \<subseteq> X \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> X \<and> length xs \<le> k}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
have "finite {xs . set xs \<subseteq> X \<and> length xs \<le> k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> length xs \<le> k}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> length xs \<le> k}
[PROOF STEP]
by (simp add: finite_lists_length_le)
[PROOF STATE]
proof (state)
this:
finite {xs. set xs \<subseteq> X \<and> length xs \<le> k}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{xs. set xs \<subseteq> X \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> X \<and> length xs \<le> k}
finite {xs. set xs \<subseteq> X \<and> length xs \<le> k}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{xs. set xs \<subseteq> X \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> X \<and> length xs \<le> k}
finite {xs. set xs \<subseteq> X \<and> length xs \<le> k}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
using rev_finite_subset
[PROOF STATE]
proof (prove)
using this:
{xs. set xs \<subseteq> X \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> X \<and> length xs \<le> k}
finite {xs. set xs \<subseteq> X \<and> length xs \<le> k}
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> X \<and> distinct xs}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {xs. set xs \<subseteq> X \<and> distinct xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quasinorm_intersection_commute:
  "N1 \<inter>\<^sub>N N2 = N2 \<inter>\<^sub>N N1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N1 \<inter>\<^sub>N N2 = N2 \<inter>\<^sub>N N1
[PROOF STEP]
unfolding quasinorm_intersection_def max.commute[of "defect N1"] add.commute[of "eNorm N1 _"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quasinorm_of (max (defect N2) (defect N1), \<lambda>f. eNorm N2 f + eNorm N1 f) = quasinorm_of (max (defect N2) (defect N1), \<lambda>f. eNorm N2 f + eNorm N1 f)
[PROOF STEP]
by simp


[STATEMENT]
lemma from_list_correct':
  assumes "valid_graph_rep l"
  shows "invar (from_list l)"
    and "(u,v,d)\<in>set l \<longleftrightarrow> \<alpha> (from_list l) (u,v) = enat d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar (from_list l) &&& ((u, v, d) \<in> set l) = (\<alpha> (from_list l) (u, v) = enat d)
[PROOF STEP]
unfolding from_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar (fold (\<lambda>(u, v, d). add_edge (u, v) d) l empty_graph) &&& ((u, v, d) \<in> set l) = (\<alpha> (fold (\<lambda>(u, v, d). add_edge (u, v) d) l empty_graph) (u, v) = enat d)
[PROOF STEP]
using from_list_correct_aux[OF assms, where g=empty_graph]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>edges_undef l (\<alpha> empty_graph); invar empty_graph\<rbrakk> \<Longrightarrow> invar (fold (\<lambda>(u, v, d). add_edge (u, v) d) l empty_graph)
\<lbrakk>edges_undef l (\<alpha> empty_graph); invar empty_graph\<rbrakk> \<Longrightarrow> \<forall>u v d. (\<alpha> (fold (\<lambda>(u, v, d). add_edge (u, v) d) l empty_graph) (u, v) = enat d) = (\<alpha> empty_graph (u, v) = enat d \<or> (u, v, d) \<in> set l)

goal (1 subgoal):
 1. invar (fold (\<lambda>(u, v, d). add_edge (u, v) d) l empty_graph) &&& ((u, v, d) \<in> set l) = (\<alpha> (fold (\<lambda>(u, v, d). add_edge (u, v) d) l empty_graph) (u, v) = enat d)
[PROOF STEP]
by (auto simp: wgraph_specs)