[STATEMENT]
theorem JF2set_simps:
  "JF2set a = F2set1 (dtor2 a) \<union>
    ((\<Union> b \<in> F2set2 (dtor2 a). JF1set b) \<union>
     (\<Union> b \<in> F2set3 (dtor2 a). JF2set b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. JF2set a = F2set1 (dtor2 a) \<union> (\<Union> (JF1set ` F2set2 (dtor2 a)) \<union> \<Union> (JF2set ` F2set3 (dtor2 a)))
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. JF2set a \<subseteq> F2set1 (dtor2 a) \<union> (\<Union> (JF1set ` F2set2 (dtor2 a)) \<union> \<Union> (JF2set ` F2set3 (dtor2 a)))
 2. F2set1 (dtor2 a) \<union> (\<Union> (JF1set ` F2set2 (dtor2 a)) \<union> \<Union> (JF2set ` F2set3 (dtor2 a))) \<subseteq> JF2set a
[PROOF STEP]
apply (rule conjunct2[OF JFset_le])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F2set1 (dtor2 a) \<union> (\<Union> (JF1set ` F2set2 (dtor2 a)) \<union> \<Union> (JF2set ` F2set3 (dtor2 a))) \<subseteq> JF2set a
[PROOF STEP]
apply (rule Un_least)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. F2set1 (dtor2 a) \<subseteq> JF2set a
 2. \<Union> (JF1set ` F2set2 (dtor2 a)) \<union> \<Union> (JF2set ` F2set3 (dtor2 a)) \<subseteq> JF2set a
[PROOF STEP]
apply (rule F2set1_incl_JF2set)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (JF1set ` F2set2 (dtor2 a)) \<union> \<Union> (JF2set ` F2set3 (dtor2 a)) \<subseteq> JF2set a
[PROOF STEP]
apply (rule Un_least)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Union> (JF1set ` F2set2 (dtor2 a)) \<subseteq> JF2set a
 2. \<Union> (JF2set ` F2set3 (dtor2 a)) \<subseteq> JF2set a
[PROOF STEP]
apply (rule UN_least)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. b \<in> F2set2 (dtor2 a) \<Longrightarrow> JF1set b \<subseteq> JF2set a
 2. \<Union> (JF2set ` F2set3 (dtor2 a)) \<subseteq> JF2set a
[PROOF STEP]
apply (erule F2set2_JF1set_incl_JF2set)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (JF2set ` F2set3 (dtor2 a)) \<subseteq> JF2set a
[PROOF STEP]
apply (rule UN_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. b \<in> F2set3 (dtor2 a) \<Longrightarrow> JF2set b \<subseteq> JF2set a
[PROOF STEP]
apply (erule F2set3_JF2set_incl_JF2set)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma suminf_enn2ereal[simp]: "(\<Sum>i. enn2ereal (f i)) = enn2ereal (suminf f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. enn2ereal (f i)) = enn2ereal (suminf f)
[PROOF STEP]
by (rule sums_unique[symmetric]) (simp add: summable_sums)


[STATEMENT]
lemma sum_tail_nat: "0 < b \<Longrightarrow> a \<le> (b::nat) \<Longrightarrow> sum f {a..b} = f b + sum f {a..b - 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b; a \<le> b\<rbrakk> \<Longrightarrow> sum f {a..b} = f b + sum f {a..b - 1}
[PROOF STEP]
by (metis One_nat_def Suc_pred add.commute not_le sum.cl_ivl_Suc)


[STATEMENT]
lemma list_of_vec_plus:
  fixes v1 v2 :: \<open>complex vec\<close>
  assumes \<open>dim_vec v1 = dim_vec v2\<close>
  shows \<open>list_of_vec (v1 + v2) = map2 (+) (list_of_vec v1) (list_of_vec v2)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_of_vec (v1 + v2) = map2 (+) (list_of_vec v1) (list_of_vec v2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. list_of_vec (v1 + v2) = map2 (+) (list_of_vec v1) (list_of_vec v2)
[PROOF STEP]
have \<open>i < dim_vec v1 \<Longrightarrow> (list_of_vec (v1 + v2)) ! i = (map2 (+) (list_of_vec v1) (list_of_vec v2)) ! i\<close>
    for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec v1 \<Longrightarrow> list_of_vec (v1 + v2) ! i = map2 (+) (list_of_vec v1) (list_of_vec v2) ! i
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
?i < dim_vec v1 \<Longrightarrow> list_of_vec (v1 + v2) ! ?i = map2 (+) (list_of_vec v1) (list_of_vec v2) ! ?i

goal (1 subgoal):
 1. list_of_vec (v1 + v2) = map2 (+) (list_of_vec v1) (list_of_vec v2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?i < dim_vec v1 \<Longrightarrow> list_of_vec (v1 + v2) ! ?i = map2 (+) (list_of_vec v1) (list_of_vec v2) ! ?i

goal (1 subgoal):
 1. list_of_vec (v1 + v2) = map2 (+) (list_of_vec v1) (list_of_vec v2)
[PROOF STEP]
by (metis assms index_add_vec(2) length_list_of_vec length_map map_fst_zip nth_equalityI)
[PROOF STATE]
proof (state)
this:
list_of_vec (v1 + v2) = map2 (+) (list_of_vec v1) (list_of_vec v2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NSLIMSEQ_cos_one: "(\<lambda>n. cos (pi / real n))\<longlonglongrightarrow>\<^sub>N\<^sub>S 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. cos (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. cos (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 1
[PROOF STEP]
have "(*f* cos) ((*f* (\<lambda>x. pi / real x)) N) \<approx> 1"
    if "N \<in> HNatInfinite" for N
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*f* cos) ((*f* (\<lambda>x. pi / real x)) N) \<approx> 1
[PROOF STEP]
using that STAR_cos_Infinitesimal starfunNat_pi_divide_n_Infinitesimal
[PROOF STATE]
proof (prove)
using this:
N \<in> HNatInfinite
?x \<in> Infinitesimal \<Longrightarrow> (*f* cos) ?x \<approx> 1
?N \<in> HNatInfinite \<Longrightarrow> (*f* (\<lambda>x. pi / real x)) ?N \<in> Infinitesimal

goal (1 subgoal):
 1. (*f* cos) ((*f* (\<lambda>x. pi / real x)) N) \<approx> 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?N \<in> HNatInfinite \<Longrightarrow> (*f* cos) ((*f* (\<lambda>x. pi / real x)) ?N) \<approx> 1

goal (1 subgoal):
 1. (\<lambda>n. cos (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?N \<in> HNatInfinite \<Longrightarrow> (*f* cos) ((*f* (\<lambda>x. pi / real x)) ?N) \<approx> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?N \<in> HNatInfinite \<Longrightarrow> (*f* cos) ((*f* (\<lambda>x. pi / real x)) ?N) \<approx> 1

goal (1 subgoal):
 1. (\<lambda>n. cos (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 1
[PROOF STEP]
by (simp add: NSLIMSEQ_def) (metis STAR_cos_Infinitesimal starfunNat_pi_divide_n_Infinitesimal starfun_o2)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cos (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_ordertype_eq_card:
  assumes "small A" "wf r" "trans r" "total_on A r"
  shows "ordertype A r = ord_of_nat m \<longleftrightarrow> finite A \<and> card A = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)
[PROOF STEP]
using ordermap_bij [OF \<open>wf r\<close>]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>total_on ?A r; small ?A\<rbrakk> \<Longrightarrow> bij_betw (ordermap ?A r) ?A (elts (ordertype ?A r))

goal (1 subgoal):
 1. (ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>A. \<lbrakk>total_on A r; small A\<rbrakk> \<Longrightarrow> bij_betw (ordermap A r) A (elts (ordertype A r))) \<Longrightarrow> (ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)
[PROOF STEP]
have *: "bij_betw (ordermap A r) A (elts (ordertype A r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (ordermap A r) A (elts (ordertype A r))
[PROOF STEP]
by (simp add: assms ordermap_bij)
[PROOF STATE]
proof (state)
this:
bij_betw (ordermap A r) A (elts (ordertype A r))

goal (1 subgoal):
 1. (\<And>A. \<lbrakk>total_on A r; small A\<rbrakk> \<Longrightarrow> bij_betw (ordermap A r) A (elts (ordertype A r))) \<Longrightarrow> (ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bij_betw (ordermap A r) A (elts (ordertype A r))

goal (1 subgoal):
 1. (\<And>A. \<lbrakk>total_on A r; small A\<rbrakk> \<Longrightarrow> bij_betw (ordermap A r) A (elts (ordertype A r))) \<Longrightarrow> (ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)
[PROOF STEP]
have "card (ordermap A r ` A) = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (ordermap A r ` A) = card A
[PROOF STEP]
by (meson bij_betw_def * card_image)
[PROOF STATE]
proof (state)
this:
card (ordermap A r ` A) = card A

goal (1 subgoal):
 1. (\<And>A. \<lbrakk>total_on A r; small A\<rbrakk> \<Longrightarrow> bij_betw (ordermap A r) A (elts (ordertype A r))) \<Longrightarrow> (ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bij_betw (ordermap A r) A (elts (ordertype A r))
card (ordermap A r ` A) = card A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw (ordermap A r) A (elts (ordertype A r))
card (ordermap A r ` A) = card A

goal (1 subgoal):
 1. (ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)
[PROOF STEP]
using assms bij_betw_finite bij_betw_imp_surj_on finite_Ord_omega ordertype_VWF_finite_nat wf_Ord_ordertype
[PROOF STATE]
proof (prove)
using this:
bij_betw (ordermap A r) A (elts (ordertype A r))
card (ordermap A r ` A) = card A
small A
wf r
trans r
total_on A r
bij_betw ?f ?A ?B \<Longrightarrow> finite ?A = finite ?B
bij_betw ?f ?A ?B \<Longrightarrow> ?f ` ?A = ?B
?\<alpha> \<in> elts \<omega> \<Longrightarrow> finite (elts ?\<alpha>)
finite ?A \<Longrightarrow> ordertype ?A VWF = ord_of_nat (card ?A)
\<lbrakk>wf ?r; trans ?r\<rbrakk> \<Longrightarrow> Ord (ordertype ?A ?r)

goal (1 subgoal):
 1. (ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(ordertype A r = ord_of_nat m) = (finite A \<and> card A = m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_line_intersect_S:
  assumes "T \<subseteq> S" and "proj2_set_Col T"
  shows "card T \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
from \<open>proj2_set_Col T\<close>
[PROOF STATE]
proof (chain)
picking this:
proj2_set_Col T
[PROOF STEP]
obtain l where "\<forall> p\<in>T. proj2_incident p l"
[PROOF STATE]
proof (prove)
using this:
proj2_set_Col T

goal (1 subgoal):
 1. (\<And>l. \<forall>p\<in>T. proj2_incident p l \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding proj2_set_Col_def
[PROOF STATE]
proof (prove)
using this:
\<exists>l. \<forall>p\<in>T. proj2_incident p l

goal (1 subgoal):
 1. (\<And>l. \<forall>p\<in>T. proj2_incident p l \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>T. proj2_incident p l

goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
from line_intersect_S_at_most_twice [of l]
[PROOF STATE]
proof (chain)
picking this:
\<exists>p q. \<forall>r\<in>S. proj2_incident r l \<longrightarrow> r = p \<or> r = q
[PROOF STEP]
obtain b and c where "\<forall> a\<in>S. proj2_incident a l \<longrightarrow> a = b \<or> a = c"
[PROOF STATE]
proof (prove)
using this:
\<exists>p q. \<forall>r\<in>S. proj2_incident r l \<longrightarrow> r = p \<or> r = q

goal (1 subgoal):
 1. (\<And>b c. \<forall>a\<in>S. proj2_incident a l \<longrightarrow> a = b \<or> a = c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>S. proj2_incident a l \<longrightarrow> a = b \<or> a = c

goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
with \<open>\<forall> p\<in>T. proj2_incident p l\<close> and \<open>T \<subseteq> S\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>p\<in>T. proj2_incident p l
T \<subseteq> S
\<forall>a\<in>S. proj2_incident a l \<longrightarrow> a = b \<or> a = c
[PROOF STEP]
have "T \<subseteq> {b,c}"
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>T. proj2_incident p l
T \<subseteq> S
\<forall>a\<in>S. proj2_incident a l \<longrightarrow> a = b \<or> a = c

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

goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
hence "card T \<le> card {b,c}"
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> {b, c}

goal (1 subgoal):
 1. card T \<le> card {b, c}
[PROOF STEP]
by (simp add: card_mono)
[PROOF STATE]
proof (state)
this:
card T \<le> card {b, c}

goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card T \<le> card {b, c}

goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
from card_suc_ge_insert [of b "{c}"]
[PROOF STATE]
proof (chain)
picking this:
card {b, c} \<le> card {c} + 1
[PROOF STEP]
have "\<dots> \<le> 2"
[PROOF STATE]
proof (prove)
using this:
card {b, c} \<le> card {c} + 1

goal (1 subgoal):
 1. card {b, c} \<le> 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {b, c} \<le> 2

goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card T \<le> 2
[PROOF STEP]
show "card T \<le> 2"
[PROOF STATE]
proof (prove)
using this:
card T \<le> 2

goal (1 subgoal):
 1. card T \<le> 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card T \<le> 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ORD_OF_EQ_diff: "x \<noteq> y \<Longrightarrow> {ORD_OF x EQ ORD_OF y} \<turnstile> Fls"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> {ORD_OF x EQ ORD_OF y} \<turnstile> Fls
[PROOF STEP]
proof (induct x arbitrary: y)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>y. 0 \<noteq> y \<Longrightarrow> {ORD_OF 0 EQ ORD_OF y} \<turnstile> Fls
 2. \<And>x y. \<lbrakk>\<And>y. x \<noteq> y \<Longrightarrow> {ORD_OF x EQ ORD_OF y} \<turnstile> Fls; Suc x \<noteq> y\<rbrakk> \<Longrightarrow> {ORD_OF (Suc x) EQ ORD_OF y} \<turnstile> Fls
[PROOF STEP]
case (Suc x)
[PROOF STATE]
proof (state)
this:
x \<noteq> ?y \<Longrightarrow> {ORD_OF x EQ ORD_OF ?y} \<turnstile> Fls
Suc x \<noteq> y

goal (2 subgoals):
 1. \<And>y. 0 \<noteq> y \<Longrightarrow> {ORD_OF 0 EQ ORD_OF y} \<turnstile> Fls
 2. \<And>x y. \<lbrakk>\<And>y. x \<noteq> y \<Longrightarrow> {ORD_OF x EQ ORD_OF y} \<turnstile> Fls; Suc x \<noteq> y\<rbrakk> \<Longrightarrow> {ORD_OF (Suc x) EQ ORD_OF y} \<turnstile> Fls
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> ?y \<Longrightarrow> {ORD_OF x EQ ORD_OF ?y} \<turnstile> Fls
Suc x \<noteq> y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
x \<noteq> ?y \<Longrightarrow> {ORD_OF x EQ ORD_OF ?y} \<turnstile> Fls
Suc x \<noteq> y

goal (1 subgoal):
 1. {ORD_OF (Suc x) EQ ORD_OF y} \<turnstile> Fls
[PROOF STEP]
using SUCC_inject_E
[PROOF STATE]
proof (prove)
using this:
x \<noteq> ?y \<Longrightarrow> {ORD_OF x EQ ORD_OF ?y} \<turnstile> Fls
Suc x \<noteq> y
insert (?x EQ ?y) ?H \<turnstile> ?A \<Longrightarrow> insert (SUCC ?x EQ SUCC ?y) ?H \<turnstile> ?A

goal (1 subgoal):
 1. {ORD_OF (Suc x) EQ ORD_OF y} \<turnstile> Fls
[PROOF STEP]
by (cases y) (auto simp: gr0_conv_Suc Eats_EQ_Zero_E SUCC_def)
[PROOF STATE]
proof (state)
this:
{ORD_OF (Suc x) EQ ORD_OF y} \<turnstile> Fls

goal (1 subgoal):
 1. \<And>y. 0 \<noteq> y \<Longrightarrow> {ORD_OF 0 EQ ORD_OF y} \<turnstile> Fls
[PROOF STEP]
qed (auto simp: gr0_conv_Suc SUCC_def)


[STATEMENT]
lemma id_take_nth_drop:
  "i < length xs \<Longrightarrow> xs = take i xs @ xs!i # drop (Suc i) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length xs \<Longrightarrow> xs = take i xs @ xs ! i # drop (Suc i) xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i < length xs \<Longrightarrow> xs = take i xs @ xs ! i # drop (Suc i) xs
[PROOF STEP]
assume si: "i < length xs"
[PROOF STATE]
proof (state)
this:
i < length xs

goal (1 subgoal):
 1. i < length xs \<Longrightarrow> xs = take i xs @ xs ! i # drop (Suc i) xs
[PROOF STEP]
hence "xs = take (Suc i) xs @ drop (Suc i) xs"
[PROOF STATE]
proof (prove)
using this:
i < length xs

goal (1 subgoal):
 1. xs = take (Suc i) xs @ drop (Suc i) xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs = take (Suc i) xs @ drop (Suc i) xs

goal (1 subgoal):
 1. i < length xs \<Longrightarrow> xs = take i xs @ xs ! i # drop (Suc i) xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
xs = take (Suc i) xs @ drop (Suc i) xs

goal (1 subgoal):
 1. i < length xs \<Longrightarrow> xs = take i xs @ xs ! i # drop (Suc i) xs
[PROOF STEP]
from si
[PROOF STATE]
proof (chain)
picking this:
i < length xs
[PROOF STEP]
have "take (Suc i) xs = take i xs @ [xs!i]"
[PROOF STATE]
proof (prove)
using this:
i < length xs

goal (1 subgoal):
 1. take (Suc i) xs = take i xs @ [xs ! i]
[PROOF STEP]
using take_Suc_conv_app_nth
[PROOF STATE]
proof (prove)
using this:
i < length xs
?i < length ?xs \<Longrightarrow> take (Suc ?i) ?xs = take ?i ?xs @ [?xs ! ?i]

goal (1 subgoal):
 1. take (Suc i) xs = take i xs @ [xs ! i]
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
take (Suc i) xs = take i xs @ [xs ! i]

goal (1 subgoal):
 1. i < length xs \<Longrightarrow> xs = take i xs @ xs ! i # drop (Suc i) xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
xs = take (Suc i) xs @ drop (Suc i) xs
take (Suc i) xs = take i xs @ [xs ! i]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
xs = take (Suc i) xs @ drop (Suc i) xs
take (Suc i) xs = take i xs @ [xs ! i]

goal (1 subgoal):
 1. xs = take i xs @ xs ! i # drop (Suc i) xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs = take i xs @ xs ! i # drop (Suc i) xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_segment_Re_equal:
  assumes "Re x = Re y" "Im x\<noteq>Im y"
  shows "open_segment x y = {z. Re z = Re x
                                  \<and> Im z \<in> open_segment (Im x) (Im y)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
have "open_segment x y = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment x y = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}
[PROOF STEP]
unfolding open_segment_image_interval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x = y then {} else (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}) = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re x = Re y
Im x \<noteq> Im y

goal (1 subgoal):
 1. (if x = y then {} else (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}) = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
open_segment x y = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}

goal (1 subgoal):
 1. open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
open_segment x y = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}

goal (1 subgoal):
 1. open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
have "... = (\<lambda>u. Complex (Re y)  (Im x + u * (Im y - Im x))
                      ) ` {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1} = (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1}
[PROOF STEP]
apply (subst (1 2 3 4) complex_surj[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>u. Complex (Re (Complex (Re ((1 - u) *\<^sub>R Complex (Re x) (Im x))) (Im ((1 - u) *\<^sub>R Complex (Re x) (Im x))) + Complex (Re (u *\<^sub>R y)) (Im (u *\<^sub>R y)))) (Im ((1 - u) *\<^sub>R x + Complex (Re (u *\<^sub>R y)) (Im (u *\<^sub>R y))))) ` {0<..<1} = (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re x = Re y
Im x \<noteq> Im y

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re (Complex (Re ((1 - u) *\<^sub>R Complex (Re x) (Im x))) (Im ((1 - u) *\<^sub>R Complex (Re x) (Im x))) + Complex (Re (u *\<^sub>R y)) (Im (u *\<^sub>R y)))) (Im ((1 - u) *\<^sub>R x + Complex (Re (u *\<^sub>R y)) (Im (u *\<^sub>R y))))) ` {0<..<1} = (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1}
[PROOF STEP]
by (simp add:scaleR_conv_of_real algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1} = (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1}

goal (1 subgoal):
 1. open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1} = (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1}

goal (1 subgoal):
 1. open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
have "... = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
have "Im x + u * (Im y - Im x) \<in> open_segment (Im x) (Im y)"
      if "Im x \<noteq> Im y" "Re x = Re y"  "0 < u" "u < 1" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im x + u * (Im y - Im x) \<in> open_segment (Im x) (Im y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im x + u * (Im y - Im x) \<in> open_segment (Im x) (Im y)
[PROOF STEP]
define yx where "yx = Im y - Im x"
[PROOF STATE]
proof (state)
this:
yx = Im y - Im x

goal (1 subgoal):
 1. Im x + u * (Im y - Im x) \<in> open_segment (Im x) (Im y)
[PROOF STEP]
have "Im y = yx + Im x" "yx >0 \<or> yx<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im y = yx + Im x &&& 0 < yx \<or> yx < 0
[PROOF STEP]
unfolding yx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im y = Im y - Im x + Im x &&& 0 < Im y - Im x \<or> Im y - Im x < 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Im x \<noteq> Im y
Re x = Re y
0 < u
u < 1

goal (1 subgoal):
 1. Im y = Im y - Im x + Im x &&& 0 < Im y - Im x \<or> Im y - Im x < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im y = yx + Im x
0 < yx \<or> yx < 0

goal (1 subgoal):
 1. Im x + u * (Im y - Im x) \<in> open_segment (Im x) (Im y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Im y = yx + Im x
0 < yx \<or> yx < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Im y = yx + Im x
0 < yx \<or> yx < 0

goal (1 subgoal):
 1. Im x + u * (Im y - Im x) \<in> open_segment (Im x) (Im y)
[PROOF STEP]
unfolding open_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
Im y = yx + Im x
0 < yx \<or> yx < 0

goal (1 subgoal):
 1. Im x + u * (Im y - Im x) \<in> (if Im x \<le> Im y then {Im x<..<Im y} else {Im y<..<Im x})
[PROOF STEP]
using that mult_pos_neg
[PROOF STATE]
proof (prove)
using this:
Im y = yx + Im x
0 < yx \<or> yx < 0
Im x \<noteq> Im y
Re x = Re y
0 < u
u < 1
\<lbrakk>(0::?'a) < ?a; ?b < (0::?'a)\<rbrakk> \<Longrightarrow> ?a * ?b < (0::?'a)

goal (1 subgoal):
 1. Im x + u * (Im y - Im x) \<in> (if Im x \<le> Im y then {Im x<..<Im y} else {Im y<..<Im x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im x + u * (Im y - Im x) \<in> open_segment (Im x) (Im y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Im x \<noteq> Im y; Re x = Re y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Im x + ?u * (Im y - Im x) \<in> open_segment (Im x) (Im y)

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>Im x \<noteq> Im y; Re x = Re y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Im x + ?u * (Im y - Im x) \<in> open_segment (Im x) (Im y)

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
have "z \<in> (\<lambda>xa. Complex (Re y) (Im x + xa * (Im y -  Im x)) )
                          ` {0<..<1}"
      if "Re x = Re y" "Re z = Re y" "Im z \<in> open_segment (Im x) (Im y)" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> (\<lambda>xa. Complex (Re y) (Im x + xa * (Im y - Im x))) ` {0<..<1}
[PROOF STEP]
apply (rule rev_image_eqI[of "(Im z - Im x)/(Im y - Im x)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (Im z - Im x) / (Im y - Im x) \<in> {0<..<1}
 2. z = Complex (Re y) (Im x + (Im z - Im x) / (Im y - Im x) * (Im y - Im x))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Im z - Im x) / (Im y - Im x) \<in> {0<..<1}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re x = Re y
Re z = Re y
Im z \<in> open_segment (Im x) (Im y)

goal (1 subgoal):
 1. (Im z - Im x) / (Im y - Im x) \<in> {0<..<1}
[PROOF STEP]
unfolding open_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
Re x = Re y
Re z = Re y
Im z \<in> (if Im x \<le> Im y then {Im x<..<Im y} else {Im y<..<Im x})

goal (1 subgoal):
 1. (Im z - Im x) / (Im y - Im x) \<in> {0<..<1}
[PROOF STEP]
by (auto simp:divide_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = Complex (Re y) (Im x + (Im z - Im x) / (Im y - Im x) * (Im y - Im x))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = Complex (Re y) (Im x + (Im z - Im x) / (Im y - Im x) * (Im y - Im x))
[PROOF STEP]
using \<open>Im x \<noteq> Im y\<close> complex_eq_iff that(2)
[PROOF STATE]
proof (prove)
using this:
Im x \<noteq> Im y
(?x = ?y) = (Re ?x = Re ?y \<and> Im ?x = Im ?y)
Re z = Re y

goal (1 subgoal):
 1. z = Complex (Re y) (Im x + (Im z - Im x) / (Im y - Im x) * (Im y - Im x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re x = Re y; Re ?z = Re y; Im ?z \<in> open_segment (Im x) (Im y)\<rbrakk> \<Longrightarrow> ?z \<in> (\<lambda>xa. Complex (Re y) (Im x + xa * (Im y - Im x))) ` {0<..<1}

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>Im x \<noteq> Im y; Re x = Re y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Im x + ?u * (Im y - Im x) \<in> open_segment (Im x) (Im y)
\<lbrakk>Re x = Re y; Re ?z = Re y; Im ?z \<in> open_segment (Im x) (Im y)\<rbrakk> \<Longrightarrow> ?z \<in> (\<lambda>xa. Complex (Re y) (Im x + xa * (Im y - Im x))) ` {0<..<1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Im x \<noteq> Im y; Re x = Re y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Im x + ?u * (Im y - Im x) \<in> open_segment (Im x) (Im y)
\<lbrakk>Re x = Re y; Re ?z = Re y; Im ?z \<in> open_segment (Im x) (Im y)\<rbrakk> \<Longrightarrow> ?z \<in> (\<lambda>xa. Complex (Re y) (Im x + xa * (Im y - Im x))) ` {0<..<1}

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Im x \<noteq> Im y; Re x = Re y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Im x + ?u * (Im y - Im x) \<in> open_segment (Im x) (Im y)
\<lbrakk>Re x = Re y; Re ?z = Re y; Im ?z \<in> open_segment (Im x) (Im y)\<rbrakk> \<Longrightarrow> ?z \<in> (\<lambda>xa. Complex (Re y) (Im x + xa * (Im y - Im x))) ` {0<..<1}
Re x = Re y
Im x \<noteq> Im y

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>u. Complex (Re y) (Im x + u * (Im y - Im x))) ` {0<..<1} = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}

goal (1 subgoal):
 1. open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}

goal (1 subgoal):
 1. open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
open_segment x y = {z. Re z = Re x \<and> Im z \<in> open_segment (Im x) (Im y)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_sgnx_identity[intro,sgnx_intros]:
  shows "x\<ge>0 \<Longrightarrow>((\<lambda>x. x) has_sgnx 1) (at_right x)"
        "x\<le>0 \<Longrightarrow> ((\<lambda>x. x) has_sgnx -1) (at_left x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> x \<Longrightarrow> ((\<lambda>x. x) has_sgnx 1) (at_right x)) &&& (x \<le> 0 \<Longrightarrow> ((\<lambda>x. x) has_sgnx - 1) (at_left x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> ((\<lambda>x. x) has_sgnx 1) (at_right x)
 2. x \<le> 0 \<Longrightarrow> ((\<lambda>x. x) has_sgnx - 1) (at_left x)
[PROOF STEP]
show "x\<ge>0 \<Longrightarrow> ((\<lambda>x. x) has_sgnx 1) (at_right x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> ((\<lambda>x. x) has_sgnx 1) (at_right x)
[PROOF STEP]
unfolding has_sgnx_def eventually_at_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> \<exists>b>x. \<forall>y>x. y < b \<longrightarrow> sgn y = 1
[PROOF STEP]
apply (intro exI[where x="x+1"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> x < x + 1 \<and> (\<forall>y>x. y < x + 1 \<longrightarrow> sgn y = 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> x \<Longrightarrow> ((\<lambda>x. x) has_sgnx 1) (at_right x)

goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> ((\<lambda>x. x) has_sgnx - 1) (at_left x)
[PROOF STEP]
show "x\<le>0 \<Longrightarrow> ((\<lambda>x. x) has_sgnx -1) (at_left x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> ((\<lambda>x. x) has_sgnx - 1) (at_left x)
[PROOF STEP]
unfolding has_sgnx_def eventually_at_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> \<exists>b<x. \<forall>y>b. y < x \<longrightarrow> sgn y = - 1
[PROOF STEP]
apply (intro exI[where x="x-1"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> x - 1 < x \<and> (\<forall>y>x - 1. y < x \<longrightarrow> sgn y = - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<le> 0 \<Longrightarrow> ((\<lambda>x. x) has_sgnx - 1) (at_left x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosh_converges: "(\<lambda>n. if even n then x ^ n /\<^sub>R fact n else 0) sums cosh x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x
[PROOF STEP]
have "(\<lambda>n. (x ^ n /\<^sub>R fact n + (-x) ^ n /\<^sub>R fact n) /\<^sub>R 2) sums cosh x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (x ^ n /\<^sub>R fact n + (- x) ^ n /\<^sub>R fact n) /\<^sub>R 2) sums cosh x
[PROOF STEP]
unfolding cosh_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (x ^ n /\<^sub>R fact n + (- x) ^ n /\<^sub>R fact n) /\<^sub>R 2) sums ((exp x + exp (- x)) /\<^sub>R 2)
[PROOF STEP]
by (intro sums_scaleR_right sums_add exp_converges)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (x ^ n /\<^sub>R fact n + (- x) ^ n /\<^sub>R fact n) /\<^sub>R 2) sums cosh x

goal (1 subgoal):
 1. (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (x ^ n /\<^sub>R fact n + (- x) ^ n /\<^sub>R fact n) /\<^sub>R 2) sums cosh x

goal (1 subgoal):
 1. (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x
[PROOF STEP]
have "(\<lambda>n. (x ^ n /\<^sub>R fact n + (-x) ^ n /\<^sub>R fact n) /\<^sub>R 2) =
               (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (x ^ n /\<^sub>R fact n + (- x) ^ n /\<^sub>R fact n) /\<^sub>R 2) = (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (x ^ n /\<^sub>R fact n + (- x) ^ n /\<^sub>R fact n) /\<^sub>R 2) = (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a))

goal (1 subgoal):
 1. (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x

goal (1 subgoal):
 1. (\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if even n then x ^ n /\<^sub>R fact n else (0::'a)) sums cosh x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma landau_ln_3:
  assumes "eventually (\<lambda>x. (1::real) \<le> f x) F"
  assumes "f \<in> O[F](g)"
  shows "(\<lambda>x. ln (f x)) \<in> O[F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (f x)) \<in> O[F](g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. ln (f x)) \<in> O[F](g)
[PROOF STEP]
have "1 \<le> x \<Longrightarrow> \<bar>ln x\<bar> \<le> \<bar>x\<bar>" for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> x \<Longrightarrow> \<bar>ln x\<bar> \<le> \<bar>x\<bar>
[PROOF STEP]
using ln_bound
[PROOF STATE]
proof (prove)
using this:
0 < ?x \<Longrightarrow> ln ?x \<le> ?x

goal (1 subgoal):
 1. 1 \<le> x \<Longrightarrow> \<bar>ln x\<bar> \<le> \<bar>x\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 \<le> ?x \<Longrightarrow> \<bar>ln ?x\<bar> \<le> \<bar>?x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. ln (f x)) \<in> O[F](g)
[PROOF STEP]
hence "(\<lambda>x. ln (f x)) \<in> O[F](f)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> ?x \<Longrightarrow> \<bar>ln ?x\<bar> \<le> \<bar>?x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. ln (f x)) \<in> O[F](f)
[PROOF STEP]
by (intro landau_o.big_mono eventually_mono[OF assms(1)]) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (f x)) \<in> O[F](f)

goal (1 subgoal):
 1. (\<lambda>x. ln (f x)) \<in> O[F](g)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ln (f x)) \<in> O[F](f)

goal (1 subgoal):
 1. (\<lambda>x. ln (f x)) \<in> O[F](g)
[PROOF STEP]
using assms(2) landau_o.big_trans
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ln (f x)) \<in> O[F](f)
f \<in> O[F](g)
\<lbrakk>?f \<in> O[?F](?g); ?g \<in> O[?F](?h)\<rbrakk> \<Longrightarrow> ?f \<in> O[?F](?h)

goal (1 subgoal):
 1. (\<lambda>x. ln (f x)) \<in> O[F](g)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (f x)) \<in> O[F](g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_monotone_minus_pi_0:
  assumes "- pi \<le> y" and "y < x" and "x \<le> 0"
  shows "cos y < cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos y < cos x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos y < cos x
[PROOF STEP]
have "0 \<le> - x" and "- x < - y" and "- y \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> - x &&& - x < - y &&& - y \<le> pi
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- pi \<le> y
y < x
x \<le> 0

goal (1 subgoal):
 1. 0 \<le> - x &&& - x < - y &&& - y \<le> pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> - x
- x < - y
- y \<le> pi

goal (1 subgoal):
 1. cos y < cos x
[PROOF STEP]
from cos_monotone_0_pi[OF this]
[PROOF STATE]
proof (chain)
picking this:
cos (- y) < cos (- x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos (- y) < cos (- x)

goal (1 subgoal):
 1. cos y < cos x
[PROOF STEP]
unfolding cos_minus
[PROOF STATE]
proof (prove)
using this:
cos y < cos x

goal (1 subgoal):
 1. cos y < cos x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cos y < cos x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma simple_path_image_uncountable:
  fixes g :: "real \<Rightarrow> 'a::metric_space"
  assumes "simple_path g"
  shows "uncountable (path_image g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncountable (path_image g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uncountable (path_image g)
[PROOF STEP]
have "g 0 \<in> path_image g" "g (1/2) \<in> path_image g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g 0 \<in> path_image g &&& g (1 / 2) \<in> path_image g
[PROOF STEP]
by (simp_all add: path_defs)
[PROOF STATE]
proof (state)
this:
g 0 \<in> path_image g
g (1 / 2) \<in> path_image g

goal (1 subgoal):
 1. uncountable (path_image g)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g 0 \<in> path_image g
g (1 / 2) \<in> path_image g

goal (1 subgoal):
 1. uncountable (path_image g)
[PROOF STEP]
have "g 0 \<noteq> g (1/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g 0 \<noteq> g (1 / 2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
simple_path g

goal (1 subgoal):
 1. g 0 \<noteq> g (1 / 2)
[PROOF STEP]
by (fastforce simp add: simple_path_def)
[PROOF STATE]
proof (state)
this:
g 0 \<noteq> g (1 / 2)

goal (1 subgoal):
 1. uncountable (path_image g)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g 0 \<in> path_image g
g (1 / 2) \<in> path_image g
g 0 \<noteq> g (1 / 2)
[PROOF STEP]
have "\<forall>a. \<not> path_image g \<subseteq> {a}"
[PROOF STATE]
proof (prove)
using this:
g 0 \<in> path_image g
g (1 / 2) \<in> path_image g
g 0 \<noteq> g (1 / 2)

goal (1 subgoal):
 1. \<forall>a. \<not> path_image g \<subseteq> {a}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>a. \<not> path_image g \<subseteq> {a}

goal (1 subgoal):
 1. uncountable (path_image g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>a. \<not> path_image g \<subseteq> {a}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>a. \<not> path_image g \<subseteq> {a}

goal (1 subgoal):
 1. uncountable (path_image g)
[PROOF STEP]
using assms connected_simple_path_image connected_uncountable
[PROOF STATE]
proof (prove)
using this:
\<forall>a. \<not> path_image g \<subseteq> {a}
simple_path g
simple_path ?g \<Longrightarrow> connected (path_image ?g)
\<lbrakk>connected ?S; ?a \<in> ?S; ?b \<in> ?S; ?a \<noteq> ?b\<rbrakk> \<Longrightarrow> uncountable ?S

goal (1 subgoal):
 1. uncountable (path_image g)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
uncountable (path_image g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_field_derivative_Lambert_W_gen [derivative_intros]:
  assumes "(f has_real_derivative f') (at x within A)" "f x > -exp (-1)"
  shows   "((\<lambda>x. Lambert_W (f x)) has_real_derivative
             (f' / (f x + exp (Lambert_W (f x))))) (at x within A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W (f x)) has_real_derivative f' / (f x + exp (Lambert_W (f x)))) (at x within A)
[PROOF STEP]
using DERIV_chain2[OF has_field_derivative_Lambert_W[OF assms(2)] assms(1)]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. Lambert_W (f x)) has_real_derivative inverse (f x + exp (Lambert_W (f x))) * f') (at x within A)

goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W (f x)) has_real_derivative f' / (f x + exp (Lambert_W (f x)))) (at x within A)
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma is_gcd_some_gcd: "is_gcd (some_gcd a b) a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_gcd (some_gcd a b) a b
[PROOF STEP]
by (insert is_gcd_gcd, auto intro!: is_gcd_some_gcdI)


[STATEMENT]
theorem transcendental_pi: "\<not>algebraic pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> algebraic pi
[PROOF STEP]
using transcendental_i_pi
[PROOF STATE]
proof (prove)
using this:
\<not> algebraic (\<i> * complex_of_real pi)

goal (1 subgoal):
 1. \<not> algebraic pi
[PROOF STEP]
by (simp add: algebraic_times_i_iff)


[STATEMENT]
lemma ennreal_escape_rate: "ennreal (escape_rate x) = (\<integral>\<^sup>+y. R x y \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (escape_rate x) = \<integral>\<^sup>+ xa. ennreal (R x xa) \<partial>count_space UNIV
[PROOF STEP]
using finite_weight[of x]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ xa. ennreal (R x xa) \<partial>count_space UNIV < \<infinity>

goal (1 subgoal):
 1. ennreal (escape_rate x) = \<integral>\<^sup>+ xa. ennreal (R x xa) \<partial>count_space UNIV
[PROOF STEP]
unfolding escape_rate_def
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ xa. ennreal (R x xa) \<partial>count_space UNIV < \<infinity>

goal (1 subgoal):
 1. ennreal (integral\<^sup>L (count_space UNIV) (R x)) = \<integral>\<^sup>+ xa. ennreal (R x xa) \<partial>count_space UNIV
[PROOF STEP]
by (intro nn_integral_eq_integral[symmetric]) (auto simp: integrable_iff_bounded)


[STATEMENT]
lemma sin_2npi [simp]: "sin (2 * real n * pi) = 0"
  for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (2 * real n * pi) = 0
[PROOF STEP]
by (auto simp: mult.assoc sin_double)


[STATEMENT]
lemma dist_eq_dist_code_abs_le:
  fixes p\<^sub>0 :: point
  shows "dist p\<^sub>0 p\<^sub>1 \<le> \<bar>c\<bar> \<longleftrightarrow> dist_code p\<^sub>0 p\<^sub>1 \<le> c\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist (case p\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case p\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) \<le> \<bar>real_of_int c\<bar>) = (dist_code p\<^sub>0 p\<^sub>1 \<le> c\<^sup>2)
[PROOF STEP]
using dist_eq_sqrt_dist_code
[PROOF STATE]
proof (prove)
using this:
dist (case ?p\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case ?p\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) = sqrt (real_of_int (dist_code ?p\<^sub>0 ?p\<^sub>1))

goal (1 subgoal):
 1. (dist (case p\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case p\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) \<le> \<bar>real_of_int c\<bar>) = (dist_code p\<^sub>0 p\<^sub>1 \<le> c\<^sup>2)
[PROOF STEP]
by (metis of_int_power_le_of_int_cancel_iff real_sqrt_abs real_sqrt_le_iff)


[STATEMENT]
lemma less_imp_Suc_mult_le: "m < n \<Longrightarrow> Suc m * k \<le> n * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < n \<Longrightarrow> Suc m * k \<le> n * k
[PROOF STEP]
by (rule mult_le_mono1, simp)


[STATEMENT]
lemma arith_modZero1:
  "(t + n * t) mod Suc n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t + n * t) mod Suc n = 0
[PROOF STEP]
by (metis mod_mult_self1_is_0 mult_Suc)


[STATEMENT]
theorem squarefree_asymptotics':
  "(\<lambda>x. card {n. real n \<le> x \<and> squarefree n}) =o (\<lambda>x. 6 / pi\<^sup>2 * x) +o O(\<lambda>x. sqrt x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (card {n. real n \<le> x \<and> squarefree n})) \<in> (*) (6 / pi\<^sup>2) +o O(sqrt)
[PROOF STEP]
using squarefree_asymptotics
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. real (card {n. real n \<le> x \<and> squarefree n}) - 6 / pi\<^sup>2 * x) \<in> O(sqrt)

goal (1 subgoal):
 1. (\<lambda>x. real (card {n. real n \<le> x \<and> squarefree n})) \<in> (*) (6 / pi\<^sup>2) +o O(sqrt)
[PROOF STEP]
by (subst set_minus_plus [symmetric]) (simp_all add: fun_diff_def)


[STATEMENT]
lemma Lp_space_numeral:
  assumes "numeral n > (0::int)"
  shows "space\<^sub>N (\<LL> (numeral n) M) = {f \<in> borel_measurable M. integrable M (\<lambda>x. \<bar>f x\<bar> ^ numeral n)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lspace M (numeral n) = {f \<in> borel_measurable M. integrable M (\<lambda>x. \<bar>f x\<bar> ^ numeral n)}
[PROOF STEP]
using Lp_space [of "numeral n" M] assms
[PROOF STATE]
proof (prove)
using this:
0 < numeral n \<Longrightarrow> lspace M (ennreal (numeral n)) = {f \<in> borel_measurable M. integrable M (\<lambda>x. \<bar>f x\<bar> powr numeral n)}
0 < numeral n

goal (1 subgoal):
 1. lspace M (numeral n) = {f \<in> borel_measurable M. integrable M (\<lambda>x. \<bar>f x\<bar> ^ numeral n)}
[PROOF STEP]
by simp


[STATEMENT]
lemma "(Odd_Succ (Even_Succ (Odd_Succ Even_Zero))) \<otimes> (Odd_Succ Even_Zero)
       = Odd_Succ (Even_Succ (Odd_Succ Even_Zero))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Odd_Succ (Even_Succ (Odd_Succ Even_Zero)) \<otimes> Odd_Succ Even_Zero = Odd_Succ (Even_Succ (Odd_Succ Even_Zero))
[PROOF STEP]
by eval


[STATEMENT]
lemma lin_indpt_set_card_lt_dim:
  fixes A :: "'a vec set"
  assumes "A \<subseteq> carrier_vec n"
  assumes "lin_indpt A"
  shows "card A \<le> dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A \<le> local.dim
[PROOF STEP]
using assms(1) assms(2) fin_dim li_le_dim(2)
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier_vec n
lin_indpt A
fin_dim
\<lbrakk>fin_dim; ?A \<subseteq> carrier_vec n; lin_indpt ?A\<rbrakk> \<Longrightarrow> card ?A \<le> local.dim

goal (1 subgoal):
 1. card A \<le> local.dim
[PROOF STEP]
by blast


[STATEMENT]
lemma pochhammer_rec: "pochhammer a (Suc n) = a * pochhammer (a + 1) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer a (Suc n) = a * pochhammer (a + (1::'a)) n
[PROOF STEP]
by (simp add: pochhammer_prod prod.atLeast0_lessThan_Suc_shift ac_simps del: prod.op_ivl_Suc)


[STATEMENT]
lemma UNIV_4: "UNIV = {1::4, 2::4, 3::4, 4::4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = {1, 2, 3, 4}
[PROOF STEP]
using exhaust_4
[PROOF STATE]
proof (prove)
using this:
?x = 1 \<or> ?x = 2 \<or> ?x = 3 \<or> ?x = 4

goal (1 subgoal):
 1. UNIV = {1, 2, 3, 4}
[PROOF STEP]
by auto


[STATEMENT]
lemma integral_measure_spmf:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  assumes A: "finite A"
  shows "(\<And>a. a \<in> set_spmf M \<Longrightarrow> f a \<noteq> 0 \<Longrightarrow> a \<in> A) \<Longrightarrow> (LINT x|measure_spmf M. f x) = (\<Sum>a\<in>A. spmf M a *\<^sub>R f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> set_spmf M; f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> a \<in> A) \<Longrightarrow> integral\<^sup>L (measure_spmf M) f = (\<Sum>a\<in>A. spmf M a *\<^sub>R f a)
[PROOF STEP]
unfolding measure_spmf_eq_density
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> set_spmf M; f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> a \<in> A) \<Longrightarrow> integral\<^sup>L (density (count_space UNIV) (\<lambda>x. ennreal (spmf M x))) f = (\<Sum>a\<in>A. spmf M a *\<^sub>R f a)
[PROOF STEP]
apply (simp add: integral_density)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> set_spmf M; f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> a \<in> A) \<Longrightarrow> LINT x|count_space UNIV. spmf M x *\<^sub>R f x = (\<Sum>a\<in>A. spmf M a *\<^sub>R f a)
[PROOF STEP]
apply (subst lebesgue_integral_count_space_finite_support)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>a. \<lbrakk>a \<in> set_spmf M; f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> a \<in> A) \<Longrightarrow> finite {a \<in> UNIV. spmf M a *\<^sub>R f a \<noteq> (0::'b)}
 2. (\<And>a. \<lbrakk>a \<in> set_spmf M; f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> a \<in> A) \<Longrightarrow> (\<Sum>a | a \<in> UNIV \<and> spmf M a *\<^sub>R f a \<noteq> (0::'b). spmf M a *\<^sub>R f a) = (\<Sum>a\<in>A. spmf M a *\<^sub>R f a)
[PROOF STEP]
by (auto intro!: finite_subset[OF _ \<open>finite A\<close>] sum.mono_neutral_left simp: spmf_eq_0_set_spmf)


[STATEMENT]
lemma count_image_mset_Pair:
  "count (image_mset (Pair a) B) (x, b) = (if x = a then count B b else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (image_mset (Pair a) B) (x, b) = (if x = a then count B b else 0)
[PROOF STEP]
by (induction B) auto


[STATEMENT]
lemma abc_SucTr0:"\<lbrakk>(0::nat) < a; c \<le> b; a - Suc 0 = b - c\<rbrakk> \<Longrightarrow> a = (Suc b) - c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; c \<le> b; a - Suc 0 = b - c\<rbrakk> \<Longrightarrow> a = Suc b - c
[PROOF STEP]
apply (subgoal_tac "Suc 0 \<le> a")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < a; c \<le> b; a - Suc 0 = b - c; Suc 0 \<le> a\<rbrakk> \<Longrightarrow> a = Suc b - c
 2. \<lbrakk>0 < a; c \<le> b; a - Suc 0 = b - c\<rbrakk> \<Longrightarrow> Suc 0 \<le> a
[PROOF STEP]
apply (frule le_add_diff_inverse2 [of "Suc 0" "a", THEN sym])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < a; c \<le> b; a - Suc 0 = b - c; Suc 0 \<le> a; a = a - Suc 0 + Suc 0\<rbrakk> \<Longrightarrow> a = Suc b - c
 2. \<lbrakk>0 < a; c \<le> b; a - Suc 0 = b - c\<rbrakk> \<Longrightarrow> Suc 0 \<le> a
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma infdist_pos_not_in_closed:
  assumes "closed S" "S \<noteq> {}" "x \<notin> S"
  shows "infdist x S > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < infdist x S
[PROOF STEP]
using in_closed_iff_infdist_zero[OF assms(1) assms(2), of x] assms(3) infdist_nonneg le_less
[PROOF STATE]
proof (prove)
using this:
(x \<in> S) = (infdist x S = 0)
x \<notin> S
0 \<le> infdist ?x ?A
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

goal (1 subgoal):
 1. 0 < infdist x S
[PROOF STEP]
by fastforce


[STATEMENT]
lemma limsup_ereal_mult_right:
  "(c::real) \<ge> 0 \<Longrightarrow> limsup (\<lambda>n. f n * ereal c) = limsup f * ereal c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> c \<Longrightarrow> limsup (\<lambda>n. f n * ereal c) = limsup f * ereal c
[PROOF STEP]
by (rule Limsup_ereal_mult_right) simp_all


[STATEMENT]
lemma size_mset_tree:
  assumes "bheap t"
  shows "size (mset_tree t) = 2^rank t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (mset_tree t) = 2 ^ rank t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bheap t

goal (1 subgoal):
 1. size (mset_tree t) = 2 ^ rank t
[PROOF STEP]
unfolding bheap_def
[PROOF STATE]
proof (prove)
using this:
btree t \<and> heap t

goal (1 subgoal):
 1. size (mset_tree t) = 2 ^ rank t
[PROOF STEP]
by (simp add: size_mset_btree)


[STATEMENT]
lemma powr_less_cancel: "x powr a < x powr b \<Longrightarrow> 1 < x \<Longrightarrow> a < b"
  for a b x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x powr a < x powr b; 1 < x\<rbrakk> \<Longrightarrow> a < b
[PROOF STEP]
by (simp add: powr_def)


[STATEMENT]
lemma sets_negligible_symdiff:
   "\<lbrakk>S \<in> sets lebesgue; negligible((S - T) \<union> (T - S))\<rbrakk> \<Longrightarrow> T \<in> sets lebesgue"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<in> sets lebesgue; negligible (S - T \<union> (T - S))\<rbrakk> \<Longrightarrow> T \<in> sets lebesgue
[PROOF STEP]
by (metis Diff_Diff_Int Int_Diff_Un inf_commute negligible_Un_eq negligible_imp_sets sets.Diff sets.Un)


[STATEMENT]
lemma bounded_linear_Eps12: "bounded_linear Eps12"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear Eps12
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>b1 b2. Eps12 (b1 + b2) = Eps12 b1 + Eps12 b2
 2. \<And>r b. Eps12 (r *\<^sub>R b) = r *\<^sub>R Eps12 b
 3. \<exists>K. \<forall>x. norm (Eps12 x) \<le> norm x * K
[PROOF STEP]
show "\<And>b1 b2. Eps12 (b1 + b2) = Eps12 b1 + Eps12 b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b1 b2. Eps12 (b1 + b2) = Eps12 b1 + Eps12 b2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Eps12 (?b1.0 + ?b2.0) = Eps12 ?b1.0 + Eps12 ?b2.0

goal (2 subgoals):
 1. \<And>r b. Eps12 (r *\<^sub>R b) = r *\<^sub>R Eps12 b
 2. \<exists>K. \<forall>x. norm (Eps12 x) \<le> norm x * K
[PROOF STEP]
show "\<And>r b. Eps12 (r *\<^sub>R b) = r *\<^sub>R Eps12 b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r b. Eps12 (r *\<^sub>R b) = r *\<^sub>R Eps12 b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Eps12 (?r1 *\<^sub>R ?b1) = ?r1 *\<^sub>R Eps12 ?b1

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Eps12 x) \<le> norm x * K
[PROOF STEP]
have "\<forall>x. norm (Eps12 x) \<le> norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. norm (Eps12 x) \<le> norm x
[PROOF STEP]
by (simp add: inner_hyperdual_def norm_eq_sqrt_inner)
[PROOF STATE]
proof (state)
this:
\<forall>x. norm (Eps12 x) \<le> norm x

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Eps12 x) \<le> norm x * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. norm (Eps12 x) \<le> norm x
[PROOF STEP]
show "\<exists>K. \<forall>x. norm (Eps12 x) \<le> norm x * K"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. norm (Eps12 x) \<le> norm x

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Eps12 x) \<le> norm x * K
[PROOF STEP]
by (metis mult.commute mult.left_neutral)
[PROOF STATE]
proof (state)
this:
\<exists>K. \<forall>x. norm (Eps12 x) \<le> norm x * K

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_less_zero [simp]: "\<lfloor>x\<rfloor> < 0 \<longleftrightarrow> x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> < 0) = (x < (0::'a))
[PROOF STEP]
by (simp add: floor_less_iff)


[STATEMENT]
lemma index_of_const_at_suc: "index_of_const (Suc u) = c_pair 4 (c_pair 2 (index_of_const u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. index_of_const (Suc u) = c_pair 4 (c_pair 2 (index_of_const u))
[PROOF STEP]
by (unfold index_of_const_def, induct u, auto)


[STATEMENT]
lemma out_degree_eq_card_arc_blocks: "out_degree G v = card (arc_to_block ` (out_arcs G v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. out_degree G v = card (arc_to_block ` out_arcs G v)
[PROOF STEP]
apply (simp add: out_degree_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (out_arcs G v) = card (arc_to_block ` out_arcs G v)
[PROOF STEP]
using no_multi_arcs arc_to_block_is_inj_out_arcs
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?e1.0 \<in> arcs G; ?e2.0 \<in> arcs G; arc_to_ends G ?e1.0 = arc_to_ends G ?e2.0\<rbrakk> \<Longrightarrow> ?e1.0 = ?e2.0
inj_on arc_to_block (out_arcs G ?v)

goal (1 subgoal):
 1. card (out_arcs G v) = card (arc_to_block ` out_arcs G v)
[PROOF STEP]
by (simp add: card_image)


[STATEMENT]
lemma suminf_emeasure:
  "range A \<subseteq> sets M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Sum>i. emeasure M (A i)) = emeasure M (\<Union>i. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>range A \<subseteq> sets M; disjoint_family A\<rbrakk> \<Longrightarrow> (\<Sum>i. emeasure M (A i)) = emeasure M (\<Union> (range A))
[PROOF STEP]
using sets.countable_UN[of A UNIV M] emeasure_countably_additive[of M]
[PROOF STATE]
proof (prove)
using this:
range A \<subseteq> sets M \<Longrightarrow> \<Union> (range A) \<in> sets M
countably_additive (sets M) (emeasure M)

goal (1 subgoal):
 1. \<lbrakk>range A \<subseteq> sets M; disjoint_family A\<rbrakk> \<Longrightarrow> (\<Sum>i. emeasure M (A i)) = emeasure M (\<Union> (range A))
[PROOF STEP]
by (simp add: countably_additive_def)


[STATEMENT]
lemma [simp]: "dim_row (mat_adjoint m) = dim_col m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_adjoint m) = dim_col m
[PROOF STEP]
unfolding mat_adjoint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_of_rows (dim_row m) (map conjugate (cols m))) = dim_col m
[PROOF STEP]
by simp


[STATEMENT]
lemma f''_le0_imp_concave:
  fixes f :: "real \<Rightarrow> real"
  assumes "convex C"
    and "\<And>x. x \<in> C \<Longrightarrow> DERIV f x :> (f' x)"
    and "\<And>x. x \<in> C \<Longrightarrow> DERIV f' x :> (f'' x)"
    and "\<And>x. x \<in> C \<Longrightarrow> f'' x \<le> 0"
  shows "concave_on C f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concave_on C f
[PROOF STEP]
unfolding concave_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on C (\<lambda>x. - f x)
[PROOF STEP]
by (rule assms f''_ge0_imp_convex derivative_eq_intros | simp)+


[STATEMENT]
lemma lem1:
  fixes f :: "'a \<Rightarrow> 'b::field"
  shows "(\<Sum>x\<in>A. f x * (a * g x)) = a * (\<Sum>x\<in>A. f x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>A. f x * (a * g x)) = a * (\<Sum>x\<in>A. f x * g x)
[PROOF STEP]
by (simp add: sum_distrib_left field_simps)


[STATEMENT]
lemma finite_enumerate_mono: "\<lbrakk>m < n; finite S; n < card S\<rbrakk> \<Longrightarrow> enumerate S m < enumerate S n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m < n; finite S; n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S m < wellorder_class.enumerate S n
[PROOF STEP]
by (induct m n rule: less_Suc_induct) (auto intro: finite_enumerate_step)


[STATEMENT]
lemma integer_of_nat_0: "integer_of_nat 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integer_of_nat 0 = 0
[PROOF STEP]
by transfer simp