[STATEMENT]
lemma fsize_finsert_notin[simp]:
  assumes v12_t: "(v1,v2) |\<notin>| t"
  shows "fsize (finsert (v1,v2) t) = vsize v1 + vsize v2 + fsize t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
let ?f = "vadd \<circ> vprod_size"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
have "fsize (finsert (v1,v2) t) = 1 + ffold ?f 0 (finsert (v1,v2) t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = 1 + ffold (vadd \<circ> vprod_size) 0 (finsert (v1, v2) t)
[PROOF STEP]
using fsize_def2[of "finsert (v1,v2) t"]
[PROOF STATE]
proof (prove)
using this:
fsize (finsert (v1, v2) t) = 1 + ffold (vadd \<circ> vprod_size) 0 (finsert (v1, v2) t)

goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = 1 + ffold (vadd \<circ> vprod_size) 0 (finsert (v1, v2) t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fsize (finsert (v1, v2) t) = 1 + ffold (vadd \<circ> vprod_size) 0 (finsert (v1, v2) t)

goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fsize (finsert (v1, v2) t) = 1 + ffold (vadd \<circ> vprod_size) 0 (finsert (v1, v2) t)

goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
from v12_t
[PROOF STATE]
proof (chain)
picking this:
(v1, v2) |\<notin>| t
[PROOF STEP]
have "... = 1 + ?f (v1,v2) (ffold ?f 0 t)"
[PROOF STATE]
proof (prove)
using this:
(v1, v2) |\<notin>| t

goal (1 subgoal):
 1. 1 + ffold (vadd \<circ> vprod_size) 0 (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 + ffold (vadd \<circ> vprod_size) 0 (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)

goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fsize (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)
[PROOF STEP]
have "fsize (finsert (v1,v2) t) = 1 + ?f (v1,v2) (ffold ?f 0 t)"
[PROOF STATE]
proof (prove)
using this:
fsize (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)

goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fsize (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)

goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
fsize (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fsize (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)

goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
using fsize_def2[of t]
[PROOF STATE]
proof (prove)
using this:
fsize (finsert (v1, v2) t) = 1 + (vadd \<circ> vprod_size) (v1, v2) (ffold (vadd \<circ> vprod_size) 0 t)
fsize t = 1 + ffold (vadd \<circ> vprod_size) 0 t

goal (1 subgoal):
 1. fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fsize (finsert (v1, v2) t) = vsize v1 + vsize v2 + fsize t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma algebraic_complex_iff: "algebraic x = (algebraic (Re x) \<and> algebraic (Im x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic x = (algebraic (Re x) \<and> algebraic (Im x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. algebraic x \<Longrightarrow> algebraic (Re x) \<and> algebraic (Im x)
 2. algebraic (Re x) \<and> algebraic (Im x) \<Longrightarrow> algebraic x
[PROOF STEP]
assume "algebraic x"
[PROOF STATE]
proof (state)
this:
algebraic x

goal (2 subgoals):
 1. algebraic x \<Longrightarrow> algebraic (Re x) \<and> algebraic (Im x)
 2. algebraic (Re x) \<and> algebraic (Im x) \<Longrightarrow> algebraic x
[PROOF STEP]
from this[unfolded algebraic_altdef_ipoly]
[PROOF STATE]
proof (chain)
picking this:
\<exists>p. poly (complex_of_int_poly p) x = 0 \<and> p \<noteq> 0
[PROOF STEP]
obtain p where "ipoly p x = 0" "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>p. poly (complex_of_int_poly p) x = 0 \<and> p \<noteq> 0

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>poly (complex_of_int_poly p) x = 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly (complex_of_int_poly p) x = 0
p \<noteq> 0

goal (2 subgoals):
 1. algebraic x \<Longrightarrow> algebraic (Re x) \<and> algebraic (Im x)
 2. algebraic (Re x) \<and> algebraic (Im x) \<Longrightarrow> algebraic x
[PROOF STEP]
from represents_root_poly[OF this]
[PROOF STATE]
proof (chain)
picking this:
root_poly_Re p represents Re x
\<exists>q\<in>set (root_poly_Im p). q represents Im x
[PROOF STEP]
show "algebraic (Re x) \<and> algebraic (Im x)"
[PROOF STATE]
proof (prove)
using this:
root_poly_Re p represents Re x
\<exists>q\<in>set (root_poly_Im p). q represents Im x

goal (1 subgoal):
 1. algebraic (Re x) \<and> algebraic (Im x)
[PROOF STEP]
unfolding represents_def algebraic_altdef_ipoly
[PROOF STATE]
proof (prove)
using this:
poly (real_of_int_poly (root_poly_Re p)) (Re x) = 0 \<and> root_poly_Re p \<noteq> 0
\<exists>q\<in>set (root_poly_Im p). poly (real_of_int_poly q) (Im x) = 0 \<and> q \<noteq> 0

goal (1 subgoal):
 1. (\<exists>p. poly (real_of_int_poly p) (Re x) = 0 \<and> p \<noteq> 0) \<and> (\<exists>p. poly (real_of_int_poly p) (Im x) = 0 \<and> p \<noteq> 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
algebraic (Re x) \<and> algebraic (Im x)

goal (1 subgoal):
 1. algebraic (Re x) \<and> algebraic (Im x) \<Longrightarrow> algebraic x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. algebraic (Re x) \<and> algebraic (Im x) \<Longrightarrow> algebraic x
[PROOF STEP]
assume "algebraic (Re x) \<and> algebraic (Im x)"
[PROOF STATE]
proof (state)
this:
algebraic (Re x) \<and> algebraic (Im x)

goal (1 subgoal):
 1. algebraic (Re x) \<and> algebraic (Im x) \<Longrightarrow> algebraic x
[PROOF STEP]
from this[unfolded algebraic_altdef_ipoly]
[PROOF STATE]
proof (chain)
picking this:
(\<exists>p. poly (real_of_int_poly p) (Re x) = 0 \<and> p \<noteq> 0) \<and> (\<exists>p. poly (real_of_int_poly p) (Im x) = 0 \<and> p \<noteq> 0)
[PROOF STEP]
obtain re im where
    "re represents (Re x)" "im represents (Im x)"
[PROOF STATE]
proof (prove)
using this:
(\<exists>p. poly (real_of_int_poly p) (Re x) = 0 \<and> p \<noteq> 0) \<and> (\<exists>p. poly (real_of_int_poly p) (Im x) = 0 \<and> p \<noteq> 0)

goal (1 subgoal):
 1. (\<And>re im. \<lbrakk>re represents Re x; im represents Im x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
re represents Re x
im represents Im x

goal (1 subgoal):
 1. algebraic (Re x) \<and> algebraic (Im x) \<Longrightarrow> algebraic x
[PROOF STEP]
from complex_poly[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>f\<in>set (complex_poly re im). f represents x
?f \<in> set (complex_poly re im) \<Longrightarrow> poly_cond ?f
[PROOF STEP]
show "algebraic x"
[PROOF STATE]
proof (prove)
using this:
\<exists>f\<in>set (complex_poly re im). f represents x
?f \<in> set (complex_poly re im) \<Longrightarrow> poly_cond ?f

goal (1 subgoal):
 1. algebraic x
[PROOF STEP]
unfolding represents_def algebraic_altdef_ipoly
[PROOF STATE]
proof (prove)
using this:
\<exists>f\<in>set (complex_poly re im). poly (complex_of_int_poly f) x = 0 \<and> f \<noteq> 0
?f \<in> set (complex_poly re im) \<Longrightarrow> poly_cond ?f

goal (1 subgoal):
 1. \<exists>p. poly (complex_of_int_poly p) x = 0 \<and> p \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
algebraic x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem chain_union_closed:
  assumes \<open>finite_char C\<close> and \<open>is_chain f\<close> and \<open>\<forall>n. f n \<in> C\<close>
  shows \<open>(\<Union>n. f n) \<in> C\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (range f) \<in> C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> (range f) \<in> C
[PROOF STEP]
have \<open>subset_closed C\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subset_closed C
[PROOF STEP]
using finite_char_closed \<open>finite_char C\<close>
[PROOF STATE]
proof (prove)
using this:
finite_char ?C \<Longrightarrow> subset_closed ?C
finite_char C

goal (1 subgoal):
 1. subset_closed C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
subset_closed C

goal (1 subgoal):
 1. \<Union> (range f) \<in> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subset_closed C
[PROOF STEP]
have \<open>\<forall>S' \<in> C. \<forall>S \<subseteq> S'. S \<in> C\<close>
[PROOF STATE]
proof (prove)
using this:
subset_closed C

goal (1 subgoal):
 1. \<forall>S'\<in>C. \<forall>S\<subseteq>S'. S \<in> C
[PROOF STEP]
using subset_closed_def
[PROOF STATE]
proof (prove)
using this:
subset_closed C
subset_closed ?C = (\<forall>S'\<in>?C. \<forall>S\<subseteq>S'. S \<in> ?C)

goal (1 subgoal):
 1. \<forall>S'\<in>C. \<forall>S\<subseteq>S'. S \<in> C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>S'\<in>C. \<forall>S\<subseteq>S'. S \<in> C

goal (1 subgoal):
 1. \<Union> (range f) \<in> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>S'\<in>C. \<forall>S\<subseteq>S'. S \<in> C
[PROOF STEP]
have \<open>\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> (\<Union>n. f n) \<longrightarrow> S' \<in> C\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>S'\<in>C. \<forall>S\<subseteq>S'. S \<in> C

goal (1 subgoal):
 1. \<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C
[PROOF STEP]
using chain_union_closed' assms
[PROOF STATE]
proof (prove)
using this:
\<forall>S'\<in>C. \<forall>S\<subseteq>S'. S \<in> C
\<lbrakk>is_chain ?f; \<forall>n. ?f n \<in> ?C; \<forall>S'\<in>?C. \<forall>S\<subseteq>S'. S \<in> ?C; finite ?S'; ?S' \<subseteq> \<Union> (range ?f)\<rbrakk> \<Longrightarrow> ?S' \<in> ?C
finite_char C
is_chain f
\<forall>n. f n \<in> C

goal (1 subgoal):
 1. \<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C

goal (1 subgoal):
 1. \<Union> (range f) \<in> C
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C

goal (1 subgoal):
 1. \<Union> (range f) \<in> C
[PROOF STEP]
have \<open>((\<Union>n. f n) \<in> C) = (\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> (\<Union>n. f n) \<longrightarrow> S' \<in> C)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union> (range f) \<in> C) = (\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C)
[PROOF STEP]
using \<open>finite_char C\<close>
[PROOF STATE]
proof (prove)
using this:
finite_char C

goal (1 subgoal):
 1. (\<Union> (range f) \<in> C) = (\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C)
[PROOF STEP]
unfolding finite_char_def
[PROOF STATE]
proof (prove)
using this:
\<forall>S. (S \<in> C) = (\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> S \<longrightarrow> S' \<in> C)

goal (1 subgoal):
 1. (\<Union> (range f) \<in> C) = (\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Union> (range f) \<in> C) = (\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C)

goal (1 subgoal):
 1. \<Union> (range f) \<in> C
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C
(\<Union> (range f) \<in> C) = (\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C
(\<Union> (range f) \<in> C) = (\<forall>S'. finite S' \<longrightarrow> S' \<subseteq> \<Union> (range f) \<longrightarrow> S' \<in> C)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma piecewise_differentiable_on_subset:
    "f piecewise_differentiable_on S \<Longrightarrow> T \<le> S \<Longrightarrow> f piecewise_differentiable_on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f piecewise_differentiable_on S; T \<subseteq> S\<rbrakk> \<Longrightarrow> f piecewise_differentiable_on T
[PROOF STEP]
using continuous_on_subset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f

goal (1 subgoal):
 1. \<lbrakk>f piecewise_differentiable_on S; T \<subseteq> S\<rbrakk> \<Longrightarrow> f piecewise_differentiable_on T
[PROOF STEP]
unfolding piecewise_differentiable_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f

goal (1 subgoal):
 1. \<lbrakk>continuous_on S f \<and> (\<exists>Sa. finite Sa \<and> (\<forall>x\<in>S - Sa. f differentiable at x within S)); T \<subseteq> S\<rbrakk> \<Longrightarrow> continuous_on T f \<and> (\<exists>S. finite S \<and> (\<forall>x\<in>T - S. f differentiable at x within T))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>Sa. \<lbrakk>T \<subseteq> S; \<And>s f t. \<lbrakk>continuous_on s f; t \<subseteq> s\<rbrakk> \<Longrightarrow> continuous_on t f; continuous_on S f; finite Sa; \<forall>x\<in>S - Sa. f differentiable at x within S\<rbrakk> \<Longrightarrow> continuous_on T f
 2. \<And>Sa. \<lbrakk>T \<subseteq> S; \<And>s f t. \<lbrakk>continuous_on s f; t \<subseteq> s\<rbrakk> \<Longrightarrow> continuous_on t f; continuous_on S f; finite Sa; \<forall>x\<in>S - Sa. f differentiable at x within S\<rbrakk> \<Longrightarrow> \<exists>S. finite S \<and> (\<forall>x\<in>T - S. f differentiable at x within T)
[PROOF STEP]
apply (blast elim: continuous_on_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Sa. \<lbrakk>T \<subseteq> S; \<And>s f t. \<lbrakk>continuous_on s f; t \<subseteq> s\<rbrakk> \<Longrightarrow> continuous_on t f; continuous_on S f; finite Sa; \<forall>x\<in>S - Sa. f differentiable at x within S\<rbrakk> \<Longrightarrow> \<exists>S. finite S \<and> (\<forall>x\<in>T - S. f differentiable at x within T)
[PROOF STEP]
by (meson Diff_iff differentiable_within_subset subsetCE)


[STATEMENT]
lemma pointwise_less_imp_\<sigma>:
  assumes "xs \<lhd> ys" shows "\<sigma> xs < \<sigma> ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> xs < \<sigma> ys
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<sigma> xs < \<sigma> ys
[PROOF STEP]
have eq: "length ys = length xs" and "xs \<unlhd> ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys = length xs &&& xs \<unlhd> ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs \<lhd> ys

goal (1 subgoal):
 1. length ys = length xs &&& xs \<unlhd> ys
[PROOF STEP]
by (auto simp: pointwise_le_iff pointwise_less_iff)
[PROOF STATE]
proof (state)
this:
length ys = length xs
xs \<unlhd> ys

goal (1 subgoal):
 1. \<sigma> xs < \<sigma> ys
[PROOF STEP]
have "\<forall>k<length xs. xs!k \<le> ys!k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k<length xs. xs ! k \<le> ys ! k
[PROOF STEP]
using \<open>xs \<unlhd> ys\<close> list_all2_nthD pointwise_le_def
[PROOF STATE]
proof (prove)
using this:
xs \<unlhd> ys
\<lbrakk>list_all2 ?P ?xs ?ys; ?p < length ?xs\<rbrakk> \<Longrightarrow> ?P (?xs ! ?p) (?ys ! ?p)
?x \<unlhd> ?y \<equiv> list_all2 (\<le>) ?x ?y

goal (1 subgoal):
 1. \<forall>k<length xs. xs ! k \<le> ys ! k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>k<length xs. xs ! k \<le> ys ! k

goal (1 subgoal):
 1. \<sigma> xs < \<sigma> ys
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>k<length xs. xs ! k \<le> ys ! k

goal (1 subgoal):
 1. \<sigma> xs < \<sigma> ys
[PROOF STEP]
have "\<exists>k<length xs. xs!k < ys!k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k<length xs. xs ! k < ys ! k
[PROOF STEP]
using assms pointwise_less_iff2
[PROOF STATE]
proof (prove)
using this:
xs \<lhd> ys
(?x \<lhd> ?y) = (?x \<unlhd> ?y \<and> (\<exists>k<length ?x. ?x ! k < ?y ! k))

goal (1 subgoal):
 1. \<exists>k<length xs. xs ! k < ys ! k
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>k<length xs. xs ! k < ys ! k

goal (1 subgoal):
 1. \<sigma> xs < \<sigma> ys
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>k<length xs. xs ! k \<le> ys ! k
\<exists>k<length xs. xs ! k < ys ! k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>k<length xs. xs ! k \<le> ys ! k
\<exists>k<length xs. xs ! k < ys ! k

goal (1 subgoal):
 1. \<sigma> xs < \<sigma> ys
[PROOF STEP]
by (force simp add: eq sum_list_sum_nth intro: sum_strict_mono_ex1)
[PROOF STATE]
proof (state)
this:
\<sigma> xs < \<sigma> ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_flipped_reflections:
  assumes "w\<in>W"
  shows "card (flipped_reflections w) = S_length w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (flipped_reflections w) = S_length w
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (flipped_reflections w) = S_length w
[PROOF STEP]
define ss where "ss = arg_min length (word_for S w)"
[PROOF STATE]
proof (state)
this:
ss = arg_min length (word_for S w)

goal (1 subgoal):
 1. card (flipped_reflections w) = S_length w
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
w \<in> W
ss = arg_min length (word_for S w)
[PROOF STEP]
have "S_reduced_for w ss"
[PROOF STATE]
proof (prove)
using this:
w \<in> W
ss = arg_min length (word_for S w)

goal (1 subgoal):
 1. S_reduced_for w ss
[PROOF STEP]
using genby_S_reduced_word_for_arg_min
[PROOF STATE]
proof (prove)
using this:
w \<in> W
ss = arg_min length (word_for S w)
\<lbrakk>?A \<subseteq> S; ?a \<in> \<langle>?A\<rangle>\<rbrakk> \<Longrightarrow> reduced_word_for ?A ?a (arg_min length (word_for ?A ?a))

goal (1 subgoal):
 1. S_reduced_for w ss
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
S_reduced_for w ss

goal (1 subgoal):
 1. card (flipped_reflections w) = S_length w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
S_reduced_for w ss

goal (1 subgoal):
 1. card (flipped_reflections w) = S_length w
[PROOF STEP]
using reduced_word_for_sum_list flipped_reflections_reduced_eq_lconjseq
          S_reduced_imp_distinct_lconjseq distinct_card length_lconjseq[of ss]
          reduced_word_for_length
[PROOF STATE]
proof (prove)
using this:
S_reduced_for w ss
reduced_word_for ?A ?a ?as \<Longrightarrow> sum_list ?as = ?a
S_reduced ?ss \<Longrightarrow> flipped_reflections (sum_list ?ss) = set (lconjseq ?ss)
S_reduced ?ss \<Longrightarrow> distinct (lconjseq ?ss)
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs
length (lconjseq ss) = length ss
reduced_word_for ?A ?a ?as \<Longrightarrow> length ?as = word_length ?A ?a

goal (1 subgoal):
 1. card (flipped_reflections w) = S_length w
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
card (flipped_reflections w) = S_length w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ct_list_eq_concat:
  assumes "ct_list_eq xs ys"
          "ct_list_eq xs' ys'"
  shows "ct_list_eq (xs@xs') (ys@ys')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ct_list_eq (xs @ xs') (ys @ ys')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ct_list_eq xs ys
ct_list_eq xs' ys'

goal (1 subgoal):
 1. ct_list_eq (xs @ xs') (ys @ ys')
[PROOF STEP]
unfolding ct_list_eq_def
[PROOF STATE]
proof (prove)
using this:
list_all2 ct_eq xs ys
list_all2 ct_eq xs' ys'

goal (1 subgoal):
 1. list_all2 ct_eq (xs @ xs') (ys @ ys')
[PROOF STEP]
by (simp add: list_all2_appendI)


[STATEMENT]
lemma inf_mono_right: "c \<sqsubseteq> d \<Longrightarrow> a \<sqinter> c \<sqsubseteq> a \<sqinter> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<sqsubseteq> d \<Longrightarrow> a \<sqinter> c \<sqsubseteq> a \<sqinter> d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
a, c, d :: 'a
less_eq :: 'a \<Rightarrow> 'a \<Rightarrow> bool
type variables:
'a :: type
[PROOF STEP]
using inf_mono
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?a::'a::type) \<sqsubseteq> (?c::'a::type); (?b::'a::type) \<sqsubseteq> (?d::'a::type)\<rbrakk> \<Longrightarrow> ?a \<sqinter> ?b \<sqsubseteq> ?c \<sqinter> ?d

goal (1 subgoal):
 1. c \<sqsubseteq> d \<Longrightarrow> a \<sqinter> c \<sqsubseteq> a \<sqinter> d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
a, c, d :: 'a
less_eq :: 'a \<Rightarrow> 'a \<Rightarrow> bool
type variables:
'a :: type
[PROOF STEP]
by auto


[STATEMENT]
lemma set_take: "set (take n s) = { s ! i | i. i < n \<and> i < length s}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (take n s) = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
proof (cases "n \<le> length s")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n \<le> length s \<Longrightarrow> set (take n s) = {s ! i |i. i < n \<and> i < length s}
 2. \<not> n \<le> length s \<Longrightarrow> set (take n s) = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n \<le> length s

goal (2 subgoals):
 1. n \<le> length s \<Longrightarrow> set (take n s) = {s ! i |i. i < n \<and> i < length s}
 2. \<not> n \<le> length s \<Longrightarrow> set (take n s) = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<le> length s

goal (1 subgoal):
 1. set (take n s) = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
by (subst List.nth_image[symmetric], auto)
[PROOF STATE]
proof (state)
this:
set (take n s) = {s ! i |i. i < n \<and> i < length s}

goal (1 subgoal):
 1. \<not> n \<le> length s \<Longrightarrow> set (take n s) = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> n \<le> length s \<Longrightarrow> set (take n s) = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> n \<le> length s

goal (1 subgoal):
 1. \<not> n \<le> length s \<Longrightarrow> set (take n s) = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> length s

goal (1 subgoal):
 1. set (take n s) = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
apply (subst set_conv_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> n \<le> length s \<Longrightarrow> {take n s ! i |i. i < length (take n s)} = {s ! i |i. i < n \<and> i < length s}
[PROOF STEP]
by (metis less_trans linear not_le take_all)
[PROOF STATE]
proof (state)
this:
set (take n s) = {s ! i |i. i < n \<and> i < length s}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldl_foldr_o_id:
  "foldl (\<circ>) id fs = foldr (\<circ>) fs id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (\<circ>) id fs = foldr (\<circ>) fs id
[PROOF STEP]
proof (induct fs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. foldl (\<circ>) id [] = foldr (\<circ>) [] id
 2. \<And>a fs. foldl (\<circ>) id fs = foldr (\<circ>) fs id \<Longrightarrow> foldl (\<circ>) id (a # fs) = foldr (\<circ>) (a # fs) id
[PROOF STEP]
case (Cons f fs)
[PROOF STATE]
proof (state)
this:
foldl (\<circ>) id fs = foldr (\<circ>) fs id

goal (2 subgoals):
 1. foldl (\<circ>) id [] = foldr (\<circ>) [] id
 2. \<And>a fs. foldl (\<circ>) id fs = foldr (\<circ>) fs id \<Longrightarrow> foldl (\<circ>) id (a # fs) = foldr (\<circ>) (a # fs) id
[PROOF STEP]
have "id \<circ> f = f \<circ> id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. id \<circ> f = f \<circ> id
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
id \<circ> f = f \<circ> id

goal (2 subgoals):
 1. foldl (\<circ>) id [] = foldr (\<circ>) [] id
 2. \<And>a fs. foldl (\<circ>) id fs = foldr (\<circ>) fs id \<Longrightarrow> foldl (\<circ>) id (a # fs) = foldr (\<circ>) (a # fs) id
[PROOF STEP]
with Cons [symmetric]
[PROOF STATE]
proof (chain)
picking this:
foldr (\<circ>) fs id = foldl (\<circ>) id fs
id \<circ> f = f \<circ> id
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
foldr (\<circ>) fs id = foldl (\<circ>) id fs
id \<circ> f = f \<circ> id

goal (1 subgoal):
 1. foldl (\<circ>) id (f # fs) = foldr (\<circ>) (f # fs) id
[PROOF STEP]
by (simp only: foldl_Cons foldr_Cons o_apply [of _ _ id] foldl_assoc o_assoc)
[PROOF STATE]
proof (state)
this:
foldl (\<circ>) id (f # fs) = foldr (\<circ>) (f # fs) id

goal (1 subgoal):
 1. foldl (\<circ>) id [] = foldr (\<circ>) [] id
[PROOF STEP]
qed simp


[STATEMENT]
lemma lemma_LIMSEQ_powrat_diff_inverse:
  assumes "1 \<le> a"
  and "(\<lambda>n. a pow\<^sub>\<rat> (s n))\<longlonglongrightarrow> y"
  shows "(\<lambda>n. a pow\<^sub>\<rat> (s n - 1/of_nat(Suc n))) \<longlonglongrightarrow> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<rat> (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<rat> (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
have "(\<lambda>x. a pow\<^sub>\<rat> (1 / rat_of_nat (Suc x))) \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. a pow\<^sub>\<rat> (1 / rat_of_nat (Suc x))) \<longlonglongrightarrow> 1
[PROOF STEP]
using assms(1) LIMSEQ_powrat_inverse_of_nat
[PROOF STATE]
proof (prove)
using this:
1 \<le> a
0 < ?a \<Longrightarrow> (\<lambda>n. ?a pow\<^sub>\<rat> inverse (rat_of_nat n)) \<longlonglongrightarrow> 1

goal (1 subgoal):
 1. (\<lambda>x. a pow\<^sub>\<rat> (1 / rat_of_nat (Suc x))) \<longlonglongrightarrow> 1
[PROOF STEP]
by (auto intro!: LIMSEQ_Suc simp only: divide_inverse mult_1_left)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. a pow\<^sub>\<rat> (1 / rat_of_nat (Suc x))) \<longlonglongrightarrow> 1

goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<rat> (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. a pow\<^sub>\<rat> (1 / rat_of_nat (Suc x))) \<longlonglongrightarrow> 1
[PROOF STEP]
have " (\<lambda>n. a pow\<^sub>\<rat> s n / a pow\<^sub>\<rat> (1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. a pow\<^sub>\<rat> (1 / rat_of_nat (Suc x))) \<longlonglongrightarrow> 1

goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<rat> s n / a pow\<^sub>\<rat> (1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
using assms(2) tendsto_divide
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. a pow\<^sub>\<rat> (1 / rat_of_nat (Suc x))) \<longlonglongrightarrow> 1
(\<lambda>n. a pow\<^sub>\<rat> s n) \<longlonglongrightarrow> y
\<lbrakk>(?f \<longlongrightarrow> ?a) ?F; (?g \<longlongrightarrow> ?b) ?F; ?b \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. ?f x / ?g x) \<longlongrightarrow> ?a / ?b) ?F

goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<rat> s n / a pow\<^sub>\<rat> (1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<lambda>n. a pow\<^sub>\<rat> s n / a pow\<^sub>\<rat> (1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y

goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<rat> (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. a pow\<^sub>\<rat> s n / a pow\<^sub>\<rat> (1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. a pow\<^sub>\<rat> s n / a pow\<^sub>\<rat> (1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y

goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<rat> (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
using powrat_diff assms(1)
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. a pow\<^sub>\<rat> s n / a pow\<^sub>\<rat> (1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
0 < ?x \<Longrightarrow> ?x pow\<^sub>\<rat> (?a - ?b) = ?x pow\<^sub>\<rat> ?a / ?x pow\<^sub>\<rat> ?b
1 \<le> a

goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<rat> (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. a pow\<^sub>\<rat> (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dlo_qe_nolb[no_atp]:
  assumes ne: "U \<noteq> {}"
    and fU: "finite U"
  shows "(\<exists>x. (\<forall>y \<in> {}. y < x) \<and> (\<forall>y \<in> U. x < y)) \<equiv> True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (\<forall>y\<in>{}. y < x) \<and> (\<forall>y\<in>U. x < y) \<equiv> True
[PROOF STEP]
proof (simp add: atomize_eq)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. Ball U ((<) x)
[PROOF STEP]
from lt_ex[of "Min U"]
[PROOF STATE]
proof (chain)
picking this:
\<exists>y. y < Min U
[PROOF STEP]
obtain M where M: "M < Min U"
[PROOF STATE]
proof (prove)
using this:
\<exists>y. y < Min U

goal (1 subgoal):
 1. (\<And>M. M < Min U \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M < Min U

goal (1 subgoal):
 1. \<exists>x. Ball U ((<) x)
[PROOF STEP]
from ne fU
[PROOF STATE]
proof (chain)
picking this:
U \<noteq> {}
finite U
[PROOF STEP]
have "\<forall>x \<in> U. Min U \<le> x"
[PROOF STATE]
proof (prove)
using this:
U \<noteq> {}
finite U

goal (1 subgoal):
 1. \<forall>x\<in>U. Min U \<le> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>U. Min U \<le> x

goal (1 subgoal):
 1. \<exists>x. Ball U ((<) x)
[PROOF STEP]
with M
[PROOF STATE]
proof (chain)
picking this:
M < Min U
\<forall>x\<in>U. Min U \<le> x
[PROOF STEP]
have "\<forall>x\<in>U. M < x"
[PROOF STATE]
proof (prove)
using this:
M < Min U
\<forall>x\<in>U. Min U \<le> x

goal (1 subgoal):
 1. \<forall>x\<in>U. M < x
[PROOF STEP]
by (auto intro: less_le_trans)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>U. M < x

goal (1 subgoal):
 1. \<exists>x. Ball U ((<) x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>U. M < x
[PROOF STEP]
show "\<exists>x. \<forall>y\<in>U. x < y"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>U. M < x

goal (1 subgoal):
 1. \<exists>x. \<forall>y\<in>U. x < y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>x. \<forall>y\<in>U. x < y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma drop_strict_suffix: "strict_suffix xs ys \<Longrightarrow> strict_suffix (drop n xs) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_suffix xs ys \<Longrightarrow> strict_suffix (drop n xs) ys
[PROOF STEP]
proof (induct n arbitrary: xs ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs ys. strict_suffix xs ys \<Longrightarrow> strict_suffix (drop 0 xs) ys
 2. \<And>n xs ys. \<lbrakk>\<And>xs ys. strict_suffix xs ys \<Longrightarrow> strict_suffix (drop n xs) ys; strict_suffix xs ys\<rbrakk> \<Longrightarrow> strict_suffix (drop (Suc n) xs) ys
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
strict_suffix xs ys

goal (2 subgoals):
 1. \<And>xs ys. strict_suffix xs ys \<Longrightarrow> strict_suffix (drop 0 xs) ys
 2. \<And>n xs ys. \<lbrakk>\<And>xs ys. strict_suffix xs ys \<Longrightarrow> strict_suffix (drop n xs) ys; strict_suffix xs ys\<rbrakk> \<Longrightarrow> strict_suffix (drop (Suc n) xs) ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
strict_suffix xs ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
strict_suffix xs ys

goal (1 subgoal):
 1. strict_suffix (drop 0 xs) ys
[PROOF STEP]
by (cases ys) simp_all
[PROOF STATE]
proof (state)
this:
strict_suffix (drop 0 xs) ys

goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. strict_suffix xs ys \<Longrightarrow> strict_suffix (drop n xs) ys; strict_suffix xs ys\<rbrakk> \<Longrightarrow> strict_suffix (drop (Suc n) xs) ys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. strict_suffix xs ys \<Longrightarrow> strict_suffix (drop n xs) ys; strict_suffix xs ys\<rbrakk> \<Longrightarrow> strict_suffix (drop (Suc n) xs) ys
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
strict_suffix ?xs ?ys \<Longrightarrow> strict_suffix (drop n ?xs) ?ys
strict_suffix xs ys

goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. strict_suffix xs ys \<Longrightarrow> strict_suffix (drop n xs) ys; strict_suffix xs ys\<rbrakk> \<Longrightarrow> strict_suffix (drop (Suc n) xs) ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
strict_suffix ?xs ?ys \<Longrightarrow> strict_suffix (drop n ?xs) ?ys
strict_suffix xs ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
strict_suffix ?xs ?ys \<Longrightarrow> strict_suffix (drop n ?xs) ?ys
strict_suffix xs ys

goal (1 subgoal):
 1. strict_suffix (drop (Suc n) xs) ys
[PROOF STEP]
by (cases xs) (auto intro: Suc dest: suffix_ConsD' suffix_order.less_imp_le)
[PROOF STATE]
proof (state)
this:
strict_suffix (drop (Suc n) xs) ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma biexp01_well_formed_an:
  assumes "biexp01_well_formed a"
  shows "r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = a n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = a n
[PROOF STEP]
proof(rule nat_complete_induction[of _ n])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) 0 = a 0
 2. \<And>n. (\<And>m. m \<le> n \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) m = a m) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
show "r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) 0 = a 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) 0 = a 0
[PROOF STEP]
proof (auto simp add: r01_binary_expansion'_def)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2 \<Longrightarrow> Suc 0 = a 0
 2. \<not> 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2 \<Longrightarrow> a 0 = 0
[PROOF STEP]
assume h:"1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2"
[PROOF STATE]
proof (state)
this:
1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2

goal (2 subgoals):
 1. 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2 \<Longrightarrow> Suc 0 = a 0
 2. \<not> 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2 \<Longrightarrow> a 0 = 0
[PROOF STEP]
show "Suc 0 = a 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 = a 0
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc 0 \<noteq> a 0 \<Longrightarrow> False
[PROOF STEP]
assume "Suc 0 \<noteq> a 0"
[PROOF STATE]
proof (state)
this:
Suc 0 \<noteq> a 0

goal (1 subgoal):
 1. Suc 0 \<noteq> a 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc 0 \<noteq> a 0
[PROOF STEP]
have "a 0 = 0"
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<noteq> a 0

goal (1 subgoal):
 1. a 0 = 0
[PROOF STEP]
using assms(1) biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<noteq> a 0
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

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

goal (1 subgoal):
 1. Suc 0 \<noteq> a 0 \<Longrightarrow> False
[PROOF STEP]
hence "(\<Sum>m. real (a m) * (1 / 2) ^ (Suc m)) = (\<Sum>m. real (a (Suc m)) * (1 / 2) ^ (Suc (Suc m)))"
[PROOF STATE]
proof (prove)
using this:
a 0 = 0

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>m. real (a (Suc m)) * (1 / 2) ^ Suc (Suc m))
[PROOF STEP]
using suminf_split_head[of "\<lambda>m. real (a m) * (1 / 2) ^ (Suc m)"] binary_expression_summable[of a] assms biexp01_well_formedE
[PROOF STATE]
proof (prove)
using this:
a 0 = 0
summable (\<lambda>m. real (a m) * (1 / 2) ^ Suc m) \<Longrightarrow> (\<Sum>n. real (a (Suc n)) * (1 / 2) ^ Suc (Suc n)) = (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) - real (a 0) * (1 / 2) ^ Suc 0
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
biexp01_well_formed a
biexp01_well_formed ?a \<Longrightarrow> (\<forall>n. ?a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. ?a m = 0)

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>m. real (a (Suc m)) * (1 / 2) ^ Suc (Suc m))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>m. real (a (Suc m)) * (1 / 2) ^ Suc (Suc m))

goal (1 subgoal):
 1. Suc 0 \<noteq> a 0 \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>m. real (a (Suc m)) * (1 / 2) ^ Suc (Suc m))

goal (1 subgoal):
 1. Suc 0 \<noteq> a 0 \<Longrightarrow> False
[PROOF STEP]
have "... < 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m. real (a (Suc m)) * (1 / 2) ^ Suc (Suc m)) < 1 / 2
[PROOF STEP]
using ai_exists0_less_than_sum[of a 1] assms biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>n. a n \<in> {0, 1}; 1 \<le> ?i; a ?i = 0\<rbrakk> \<Longrightarrow> (\<Sum>n. real (a (n + 1)) * (1 / 2) ^ Suc (n + 1)) < (1 / 2) ^ 1
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. (\<Sum>m. real (a (Suc m)) * (1 / 2) ^ Suc (Suc m)) < 1 / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a (Suc m)) * (1 / 2) ^ Suc (Suc m)) < 1 / 2

goal (1 subgoal):
 1. Suc 0 \<noteq> a 0 \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) < 1 / 2
[PROOF STEP]
have "(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < 1/2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) < 1 / 2

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < 1 / 2

goal (1 subgoal):
 1. Suc 0 \<noteq> a 0 \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < 1 / 2

goal (1 subgoal):
 1. False
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < 1 / 2
1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Suc 0 = a 0

goal (1 subgoal):
 1. \<not> 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2 \<Longrightarrow> a 0 = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2 \<Longrightarrow> a 0 = 0
[PROOF STEP]
assume h:"\<not> 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2"
[PROOF STATE]
proof (state)
this:
\<not> 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2

goal (1 subgoal):
 1. \<not> 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2 \<Longrightarrow> a 0 = 0
[PROOF STEP]
show "a 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a 0 = 0
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a 0 \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
assume "a 0 \<noteq> 0"
[PROOF STATE]
proof (state)
this:
a 0 \<noteq> 0

goal (1 subgoal):
 1. a 0 \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a 0 \<noteq> 0
[PROOF STEP]
have "a 0 = 1"
[PROOF STATE]
proof (prove)
using this:
a 0 \<noteq> 0

goal (1 subgoal):
 1. a 0 = 1
[PROOF STEP]
using assms(1) biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
a 0 \<noteq> 0
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. a 0 = 1
[PROOF STEP]
by (meson insertE singletonD)
[PROOF STATE]
proof (state)
this:
a 0 = 1

goal (1 subgoal):
 1. a 0 \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
hence "1/2 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ (Suc m))"
[PROOF STATE]
proof (prove)
using this:
a 0 = 1

goal (1 subgoal):
 1. 1 / 2 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m)
[PROOF STEP]
using ai_1_gt[of a 0] assms(1) biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
a 0 = 1
\<lbrakk>\<And>n. a n \<in> {0, 1}; a 0 = 1\<rbrakk> \<Longrightarrow> (1 / 2) ^ Suc 0 \<le> (\<Sum>n. real (a (n + 0)) * (1 / 2) ^ Suc (n + 0))
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. 1 / 2 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / 2 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m)

goal (1 subgoal):
 1. a 0 \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m)

goal (1 subgoal):
 1. False
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m)
\<not> 1 \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a 0 = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) 0 = a 0

goal (1 subgoal):
 1. \<And>n. (\<And>m. m \<le> n \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) m = a m) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<And>m. m \<le> n \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) m = a m) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<And>m. m \<le> n \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) m = a m) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
assume ih:"(\<And>m. m \<le> n \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) m = a m)"
[PROOF STATE]
proof (state)
this:
?m \<le> n \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) ?m = a ?m

goal (1 subgoal):
 1. \<And>n. (\<And>m. m \<le> n \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) m = a m) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
show "r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
proof(cases "r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n")
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa b c. r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (aa, b, c) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
case h:(fields bn ur lr)
[PROOF STATE]
proof (state)
this:
r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (bn, ur, lr)

goal (1 subgoal):
 1. \<And>aa b c. r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (aa, b, c) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (bn, ur, lr)
[PROOF STEP]
have hlr:"lr = (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k)"
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (bn, ur, lr)

goal (1 subgoal):
 1. lr = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k)
[PROOF STEP]
using r01_binary_expression_eq_lr[of "\<Sum>m. real (a m) * (1 / 2) ^ Suc m" n] ih
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (bn, ur, lr)
snd (snd (r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n)) = r01_binary_expression (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n
?m \<le> n \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) ?m = a ?m

goal (1 subgoal):
 1. lr = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k)
[PROOF STEP]
by(simp add: r01_binary_expression_def r01_binary_sum_def)
[PROOF STATE]
proof (state)
this:
lr = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k)

goal (1 subgoal):
 1. \<And>aa b c. r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (aa, b, c) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
have hlr2:"(ur + lr) / 2 = lr + (1/2)^(Suc (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
have "(ur + lr) / 2 = lr + (1/2)^(Suc (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
using r01_binary_expansion_diff[of "\<Sum>m. real (a m) * (1 / 2) ^ Suc m" n] h
[PROOF STATE]
proof (prove)
using this:
fst (snd (r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n)) - snd (snd (r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n)) = (1 / 2) ^ Suc n
r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (bn, ur, lr)

goal (1 subgoal):
 1. (ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. (ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
by (simp add: \<open>(ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)\<close> of_rat_add of_rat_divide of_rat_power)
[PROOF STATE]
proof (state)
this:
(ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. \<And>aa b c. r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (aa, b, c) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) n = (bn, ur, lr)

goal (1 subgoal):
 1. r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)
[PROOF STEP]
proof(auto simp add: r01_binary_expansion'_def Let_def)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) n = (bn, ur, lr); ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2\<rbrakk> \<Longrightarrow> Suc 0 = a (Suc n)
 2. \<lbrakk>r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) n = (bn, ur, lr); \<not> ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2\<rbrakk> \<Longrightarrow> a (Suc n) = 0
[PROOF STEP]
assume h1: "(ur + lr) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2"
[PROOF STATE]
proof (state)
this:
ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2

goal (2 subgoals):
 1. \<lbrakk>r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) n = (bn, ur, lr); ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2\<rbrakk> \<Longrightarrow> Suc 0 = a (Suc n)
 2. \<lbrakk>r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) n = (bn, ur, lr); \<not> ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2\<rbrakk> \<Longrightarrow> a (Suc n) = 0
[PROOF STEP]
show "Suc 0 = a (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 = a (Suc n)
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc 0 \<noteq> a (Suc n) \<Longrightarrow> False
[PROOF STEP]
assume "Suc 0 \<noteq> a (Suc n)"
[PROOF STATE]
proof (state)
this:
Suc 0 \<noteq> a (Suc n)

goal (1 subgoal):
 1. Suc 0 \<noteq> a (Suc n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc 0 \<noteq> a (Suc n)
[PROOF STEP]
have "a (Suc n) = 0"
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<noteq> a (Suc n)

goal (1 subgoal):
 1. a (Suc n) = 0
[PROOF STEP]
using assms(1) biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<noteq> a (Suc n)
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. a (Suc n) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a (Suc n) = 0

goal (1 subgoal):
 1. Suc 0 \<noteq> a (Suc n) \<Longrightarrow> False
[PROOF STEP]
have "(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (1/2)^(Suc (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
have "(\<Sum>m. real (a m) * (1 / 2) ^ (Suc m)) = (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m+Suc n)) * (1 / 2) ^ Suc (m + Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
have "{0..n} = {..<Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..n} = {..<Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..n} = {..<Suc n}

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{0..n} = {..<Suc n}

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
using suminf_split_initial_segment[of "\<lambda>m. real (a m) * (1 / 2) ^ (Suc m)" "Suc n"] binary_expression_summable[of a] assms(1) biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
{0..n} = {..<Suc n}
summable (\<lambda>m. real (a m) * (1 / 2) ^ Suc m) \<Longrightarrow> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>n. real (a (n + Suc n)) * (1 / 2) ^ Suc (n + Suc n)) + (\<Sum>i<Suc n. real (a i) * (1 / 2) ^ Suc i)
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
have "... = (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n))
[PROOF STEP]
using suminf_split_head[of "\<lambda>m. real (a (m + Suc n)) * (1 / 2) ^ (Suc (m + Suc n))"] binary_expression_summable[of a] assms(1) biexp01_well_formedE[of a] Series.summable_iff_shift[of "\<lambda>m. real (a m) * (1 / 2) ^ (Suc m)" "Suc n"] \<open>a (Suc n) = 0\<close>
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) \<Longrightarrow> (\<Sum>n. real (a (Suc n + Suc n)) * (1 / 2) ^ Suc (Suc n + Suc n)) = (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) - real (a (0 + Suc n)) * (1 / 2) ^ Suc (0 + Suc n)
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)
summable (\<lambda>n. real (a (n + Suc n)) * (1 / 2) ^ Suc (n + Suc n)) = summable (\<lambda>m. real (a m) * (1 / 2) ^ Suc m)
a (Suc n) = 0

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n))

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n))

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
have "... = (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n)))

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n)))

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
have "... < (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (1/2)^Suc (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
using ai_exists0_less_than_sum[of a "Suc (Suc n)"] assms(1) biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>n. a n \<in> {0, 1}; Suc (Suc n) \<le> ?i; a ?i = 0\<rbrakk> \<Longrightarrow> (\<Sum>n. real (a (n + Suc (Suc n))) * (1 / 2) ^ Suc (n + Suc (Suc n))) < (1 / 2) ^ Suc (Suc n)
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. Suc 0 \<noteq> a (Suc n) \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. False
[PROOF STEP]
using h1 hlr2 hlr
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m. real (a m) * (1 / 2) ^ m / 2) < (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)
ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2
(ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)
lr = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Suc 0 = a (Suc n)

goal (1 subgoal):
 1. \<lbrakk>r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) n = (bn, ur, lr); \<not> ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2\<rbrakk> \<Longrightarrow> a (Suc n) = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) n = (bn, ur, lr); \<not> ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2\<rbrakk> \<Longrightarrow> a (Suc n) = 0
[PROOF STEP]
assume h2:"\<not> ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2"
[PROOF STATE]
proof (state)
this:
\<not> ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2

goal (1 subgoal):
 1. \<lbrakk>r01_binary_expansion'' (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) n = (bn, ur, lr); \<not> ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2\<rbrakk> \<Longrightarrow> a (Suc n) = 0
[PROOF STEP]
show "a (Suc n) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a (Suc n) = 0
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a (Suc n) \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
assume "a (Suc n) \<noteq> 0"
[PROOF STATE]
proof (state)
this:
a (Suc n) \<noteq> 0

goal (1 subgoal):
 1. a (Suc n) \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a (Suc n) \<noteq> 0
[PROOF STEP]
have "a (Suc n) = 1"
[PROOF STATE]
proof (prove)
using this:
a (Suc n) \<noteq> 0

goal (1 subgoal):
 1. a (Suc n) = 1
[PROOF STEP]
using biexp01_well_formedE[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
a (Suc n) \<noteq> 0
(\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. a (Suc n) = 1
[PROOF STEP]
by (meson insertE singletonD)
[PROOF STATE]
proof (state)
this:
a (Suc n) = 1

goal (1 subgoal):
 1. a (Suc n) \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
have "(\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (1/2)^(Suc (Suc n)) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
have "(\<Sum>m. real (a m) * (1 / 2) ^ (Suc m)) = (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m+Suc n)) * (1 / 2) ^ Suc (m + Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
have "{0..n} = {..<Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..n} = {..<Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..n} = {..<Suc n}

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{0..n} = {..<Suc n}

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
using suminf_split_initial_segment[of "\<lambda>m. real (a m) * (1 / 2) ^ (Suc m)" "Suc n"] binary_expression_summable[of a] assms(1) biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
{0..n} = {..<Suc n}
summable (\<lambda>m. real (a m) * (1 / 2) ^ Suc m) \<Longrightarrow> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>n. real (a (n + Suc n)) * (1 / 2) ^ Suc (n + Suc n)) + (\<Sum>i<Suc n. real (a i) * (1 / 2) ^ Suc i)
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m. real (a m) * (1 / 2) ^ Suc m) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
have "... = (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) + (1 / 2) ^ Suc (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
using suminf_split_head[of "\<lambda>m. real (a (m + Suc n)) * (1 / 2) ^ (Suc (m + Suc n))"] binary_expression_summable[of a] assms(1) biexp01_well_formedE[of a] Series.summable_iff_shift[of "\<lambda>m. real (a m) * (1 / 2) ^ (Suc m)" "Suc n"] \<open>a (Suc n) = 1\<close>
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) \<Longrightarrow> (\<Sum>n. real (a (Suc n + Suc n)) * (1 / 2) ^ Suc (Suc n + Suc n)) = (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) - real (a (0 + Suc n)) * (1 / 2) ^ Suc (0 + Suc n)
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)
summable (\<lambda>n. real (a (n + Suc n)) * (1 / 2) ^ Suc (n + Suc n)) = summable (\<lambda>m. real (a m) * (1 / 2) ^ Suc m)
a (Suc n) = 1

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc n)) * (1 / 2) ^ Suc (m + Suc n)) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
have "... = (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + (Suc (Suc n)))) + (1 / 2) ^ Suc (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) + (1 / 2) ^ Suc (Suc n) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) + (1 / 2) ^ Suc (Suc n) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (Suc m + Suc n)) * (1 / 2) ^ Suc (Suc m + Suc n)) + (1 / 2) ^ Suc (Suc n) = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
have "... \<ge> (\<Sum>k=0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
using binary_expression_gteq0[of a "Suc (Suc n)"] assms(1) biexp01_well_formedE[of a]
[PROOF STATE]
proof (prove)
using this:
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> 0 \<le> (\<Sum>n. real (a (n + Suc (Suc n))) * (1 / 2) ^ Suc (n + Suc (Suc n)))
biexp01_well_formed a
biexp01_well_formed a \<Longrightarrow> (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) + (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (\<Sum>m. real (a (m + Suc (Suc n))) * (1 / 2) ^ Suc (m + Suc (Suc n))) + (1 / 2) ^ Suc (Suc n)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ Suc m)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)

goal (1 subgoal):
 1. a (Suc n) \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)

goal (1 subgoal):
 1. False
[PROOF STEP]
using h2 hlr2 hlr
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k) + (1 / 2) ^ Suc (Suc n) \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2)
\<not> ur + lr \<le> (\<Sum>m. real (a m) * (1 / 2) ^ m / 2) * 2
(ur + lr) / 2 = lr + (1 / 2) ^ Suc (Suc n)
lr = (\<Sum>k = 0..n. real (a k) * (1 / 2) ^ Suc k)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a (Suc n) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
r01_binary_expansion' (\<Sum>m. real (a m) * (1 / 2) ^ Suc m) (Suc n) = a (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_take_deg:
assumes "i<n"
shows "poly.coeff (take_deg n f) i = poly.coeff (f::'a mod_ring poly) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff (take_deg n f) i = poly.coeff f i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. poly.coeff (take_deg n f) i = poly.coeff f i
[PROOF STEP]
unfolding take_deg_def
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. poly.coeff (Poly (take n (coeffs f))) i = poly.coeff f i
[PROOF STEP]
by (simp add: nth_default_coeffs_eq nth_default_take)


[STATEMENT]
lemma tendsto_rabs [tendsto_intros]: "(f \<longlongrightarrow> l) F \<Longrightarrow> ((\<lambda>x. \<bar>f x\<bar>) \<longlongrightarrow> \<bar>l\<bar>) F"
  for l :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> l) F \<Longrightarrow> ((\<lambda>x. \<bar>f x\<bar>) \<longlongrightarrow> \<bar>l\<bar>) F
[PROOF STEP]
by (fold real_norm_def) (rule tendsto_norm)


[STATEMENT]
lemma correctDeCompositionVARempty:
  assumes "correctCompositionVAR S"
          and "VAR S = {}"
  shows    "\<forall> C \<in>  subcomp S. VAR C = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>C\<in>subcomp S. VAR C = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
correctCompositionVAR S
VAR S = {}

goal (1 subgoal):
 1. \<forall>C\<in>subcomp S. VAR C = {}
[PROOF STEP]
by (metis all_not_in_conv correctCompositionVAR_def)

\<comment> \<open>function OUTfrom maps channel ID to the set of input channels it depends from,\<close>
\<comment> \<open>directly (OUTfromCh) or via local variables (VARfrom)\<close>
\<comment> \<open>an empty set means that the channel is either input of the system or\<close>
\<comment> \<open>its values are generated within some component independently\<close>


[STATEMENT]
lemma subspace_sum: "subspace A \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> f x \<in> A) \<Longrightarrow> sum f B \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subspace A; \<And>x. x \<in> B \<Longrightarrow> f x \<in> A\<rbrakk> \<Longrightarrow> sum f B \<in> A
[PROOF STEP]
by (induct B rule: infinite_finite_induct) (auto simp add: subspace_add subspace_0)


[STATEMENT]
lemma dist_in_closed_segment:
  fixes a :: "'a :: euclidean_space"
  assumes "x \<in> closed_segment a b"
    shows "dist x a \<le> dist a b \<and> dist x b \<le> dist a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x a \<le> dist a b \<and> dist x b \<le> dist a b
[PROOF STEP]
proof (intro conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dist x a \<le> dist a b
 2. dist x b \<le> dist a b
[PROOF STEP]
obtain u where u: "0 \<le> u" "u \<le> 1" and x: "x = (1 - u) *\<^sub>R a + u *\<^sub>R b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u. \<lbrakk>0 \<le> u; u \<le> 1; x = (1 - u) *\<^sub>R a + u *\<^sub>R b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> closed_segment a b

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>0 \<le> u; u \<le> 1; x = (1 - u) *\<^sub>R a + u *\<^sub>R b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: in_segment algebra_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> u
u \<le> 1
x = (1 - u) *\<^sub>R a + u *\<^sub>R b

goal (2 subgoals):
 1. dist x a \<le> dist a b
 2. dist x b \<le> dist a b
[PROOF STEP]
have "dist x a = u * dist a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x a = u * dist a b
[PROOF STEP]
apply (simp add: dist_norm algebra_simps x)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (u *\<^sub>R b - u *\<^sub>R a) = u * norm (a - b)
[PROOF STEP]
by (metis \<open>0 \<le> u\<close> abs_of_nonneg norm_minus_commute norm_scaleR real_vector.scale_right_diff_distrib)
[PROOF STATE]
proof (state)
this:
dist x a = u * dist a b

goal (2 subgoals):
 1. dist x a \<le> dist a b
 2. dist x b \<le> dist a b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist x a = u * dist a b

goal (2 subgoals):
 1. dist x a \<le> dist a b
 2. dist x b \<le> dist a b
[PROOF STEP]
have "...  \<le> dist a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * dist a b \<le> dist a b
[PROOF STEP]
by (simp add: mult_left_le_one_le u)
[PROOF STATE]
proof (state)
this:
u * dist a b \<le> dist a b

goal (2 subgoals):
 1. dist x a \<le> dist a b
 2. dist x b \<le> dist a b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist x a \<le> dist a b
[PROOF STEP]
show "dist x a \<le> dist a b"
[PROOF STATE]
proof (prove)
using this:
dist x a \<le> dist a b

goal (1 subgoal):
 1. dist x a \<le> dist a b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist x a \<le> dist a b

goal (1 subgoal):
 1. dist x b \<le> dist a b
[PROOF STEP]
have "dist x b = norm ((1-u) *\<^sub>R a - (1-u) *\<^sub>R b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x b = norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b)
[PROOF STEP]
by (simp add: dist_norm algebra_simps x)
[PROOF STATE]
proof (state)
this:
dist x b = norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b)

goal (1 subgoal):
 1. dist x b \<le> dist a b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist x b = norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b)

goal (1 subgoal):
 1. dist x b \<le> dist a b
[PROOF STEP]
have "... = (1-u) * dist a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b) = (1 - u) * dist a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b) = (1 - u) * dist a b
[PROOF STEP]
have "norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)
[PROOF STEP]
using \<open>u \<le> 1\<close>
[PROOF STATE]
proof (prove)
using this:
u \<le> 1

goal (1 subgoal):
 1. norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)

goal (1 subgoal):
 1. norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b) = (1 - u) * dist a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)

goal (1 subgoal):
 1. norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b) = (1 - u) * dist a b
[PROOF STEP]
by (simp add: dist_norm real_vector.scale_right_diff_distrib)
[PROOF STATE]
proof (state)
this:
norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b) = (1 - u) * dist a b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b) = (1 - u) * dist a b

goal (1 subgoal):
 1. dist x b \<le> dist a b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((1 - u) *\<^sub>R a - (1 - u) *\<^sub>R b) = (1 - u) * dist a b

goal (1 subgoal):
 1. dist x b \<le> dist a b
[PROOF STEP]
have "... \<le> dist a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) * dist a b \<le> dist a b
[PROOF STEP]
by (simp add: mult_left_le_one_le u)
[PROOF STATE]
proof (state)
this:
(1 - u) * dist a b \<le> dist a b

goal (1 subgoal):
 1. dist x b \<le> dist a b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist x b \<le> dist a b
[PROOF STEP]
show "dist x b \<le> dist a b"
[PROOF STATE]
proof (prove)
using this:
dist x b \<le> dist a b

goal (1 subgoal):
 1. dist x b \<le> dist a b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist x b \<le> dist a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_add_monom:
  assumes "set p \<subseteq> carrier R" and "a \<in> carrier R - { \<zero> }"
  shows "poly_add (monom a (length p)) p = a # p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add (local.monom a (length p)) p = a # p
[PROOF STEP]
unfolding monom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add (a # replicate (length p) \<zero>) p = a # p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set p \<subseteq> carrier R
a \<in> carrier R - {\<zero>}

goal (1 subgoal):
 1. poly_add (a # replicate (length p) \<zero>) p = a # p
[PROOF STEP]
by (induction p) (auto)


[STATEMENT]
lemma midpoint_preserves_per:
  assumes "Per A B C" and
    "M Midpoint A A1" and
    "M Midpoint B B1" and
    "M Midpoint C C1"
  shows "Per A1 B1 C1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Per A1 B1 C1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Per A1 B1 C1
[PROOF STEP]
obtain C' where P1: "B Midpoint C C' \<and> Cong A C A C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C'. B Midpoint C C' \<and> Cong A C A C' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Per_def assms(1)
[PROOF STATE]
proof (prove)
using this:
Per ?A ?B ?C \<equiv> \<exists>C'. ?B Midpoint ?C C' \<and> Cong ?A ?C ?A C'
Per A B C

goal (1 subgoal):
 1. (\<And>C'. B Midpoint C C' \<and> Cong A C A C' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B Midpoint C C' \<and> Cong A C A C'

goal (1 subgoal):
 1. Per A1 B1 C1
[PROOF STEP]
obtain C1' where P2: "M Midpoint C' C1'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C1'. M Midpoint C' C1' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using symmetric_point_construction
[PROOF STATE]
proof (prove)
using this:
\<exists>P'. ?A Midpoint ?P P'

goal (1 subgoal):
 1. (\<And>C1'. M Midpoint C' C1' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M Midpoint C' C1'

goal (1 subgoal):
 1. Per A1 B1 C1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
M Midpoint C' C1'

goal (1 subgoal):
 1. Per A1 B1 C1
[PROOF STEP]
by (meson P1 Per_def assms(2) assms(3) assms(4) l7_16 symmetry_preserves_midpoint)
[PROOF STATE]
proof (state)
this:
Per A1 B1 C1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cindex_polyE_inverse_add_cross':
  fixes p q::"real poly"
  assumes "a < b" "poly p a\<noteq>0 \<or> poly q a\<noteq>0" "poly p b\<noteq>0 \<or> poly q b\<noteq>0"
  shows "cindex_polyE a b q p  + cindex_polyE a b p q = cross_alt p q a b / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
define g1 where "g1 = gcd p q"
[PROOF STATE]
proof (state)
this:
g1 = gcd p q

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
obtain p' q' where pq:"p=g1*p'" "q=g1*q'" and "coprime p' q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p' q'. \<lbrakk>p = g1 * p'; q = g1 * q'; coprime p' q'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding g1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p' q'. \<lbrakk>p = gcd p q * p'; q = gcd p q * q'; coprime p' q'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms(2) coprime_commute div_gcd_coprime dvd_mult_div_cancel gcd_dvd1
        gcd_dvd2 order_root)
[PROOF STATE]
proof (state)
this:
p = g1 * p'
q = g1 * q'
coprime p' q'

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have [simp]:"g1\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g1 \<noteq> 0
[PROOF STEP]
unfolding g1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd p q \<noteq> 0
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0 \<or> poly q a \<noteq> 0

goal (1 subgoal):
 1. gcd p q \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
g1 \<noteq> 0

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have "cindex_polyE a b q' p' + cindex_polyE a b p' q' = (cross_alt p' q' a b) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2
[PROOF STEP]
using cindex_polyE_inverse_add_cross[OF \<open>a<b\<close> \<open>coprime p' q'\<close>]
[PROOF STATE]
proof (prove)
using this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2

goal (1 subgoal):
 1. cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have "cindex_polyE a b p' q' = cindex_polyE a b p q "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b p' q' = cindex_polyE a b p q
[PROOF STEP]
unfolding pq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b p' q' = cindex_polyE a b (g1 * p') (g1 * q')
[PROOF STEP]
apply (subst cindex_polyE_mult_cancel)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g1 \<noteq> 0
 2. cindex_polyE a b p' q' = cindex_polyE a b p' q'
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
cindex_polyE a b p' q' = cindex_polyE a b p q

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_polyE a b p' q' = cindex_polyE a b p q

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have "cindex_polyE a b q' p' = cindex_polyE a b q p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q' p' = cindex_polyE a b q p
[PROOF STEP]
unfolding pq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q' p' = cindex_polyE a b (g1 * q') (g1 * p')
[PROOF STEP]
apply (subst cindex_polyE_mult_cancel)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g1 \<noteq> 0
 2. cindex_polyE a b q' p' = cindex_polyE a b q' p'
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q' p' = cindex_polyE a b q p

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q' p' = cindex_polyE a b q p

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
have "cross_alt p' q' a b = cross_alt p q a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_alt p' q' a b = cross_alt p q a b
[PROOF STEP]
unfolding pq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_alt p' q' a b = cross_alt (g1 * p') (g1 * q') a b
[PROOF STEP]
apply (subst cross_alt_cancel)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. poly g1 a \<noteq> 0
 2. poly g1 b \<noteq> 0
 3. cross_alt p' q' a b = cross_alt p' q' a b
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly g1 a \<noteq> 0
[PROOF STEP]
using assms(2) g1_def poly_gcd_0_iff
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0 \<or> poly q a \<noteq> 0
g1 = gcd p q
(poly (gcd ?p ?q) ?x = (0::?'a)) = (poly ?p ?x = (0::?'a) \<and> poly ?q ?x = (0::?'a))

goal (1 subgoal):
 1. poly g1 a \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. poly g1 b \<noteq> 0
 2. cross_alt p' q' a b = cross_alt p' q' a b
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly g1 b \<noteq> 0
[PROOF STEP]
using assms(3) g1_def poly_gcd_0_iff
[PROOF STATE]
proof (prove)
using this:
poly p b \<noteq> 0 \<or> poly q b \<noteq> 0
g1 = gcd p q
(poly (gcd ?p ?q) ?x = (0::?'a)) = (poly ?p ?x = (0::?'a) \<and> poly ?q ?x = (0::?'a))

goal (1 subgoal):
 1. poly g1 b \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_alt p' q' a b = cross_alt p' q' a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cross_alt p' q' a b = cross_alt p q a b

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2
cindex_polyE a b p' q' = cindex_polyE a b p q
cindex_polyE a b q' p' = cindex_polyE a b q p
cross_alt p' q' a b = cross_alt p q a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex_polyE a b q' p' + cindex_polyE a b p' q' = real_of_int (cross_alt p' q' a b) / 2
cindex_polyE a b p' q' = cindex_polyE a b p q
cindex_polyE a b q' p' = cindex_polyE a b q p
cross_alt p' q' a b = cross_alt p q a b

goal (1 subgoal):
 1. cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2

goal:
No subgoals!
[PROOF STEP]
qed