[STATEMENT]
lemma STAR_cos_Infinitesimal_approx2:
  fixes x :: hypreal
  assumes "x \<in> Infinitesimal"
  shows "( *f* cos) x \<approx> 1 - (x\<^sup>2)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*f* cos) x \<approx> 1 - x\<^sup>2 / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (*f* cos) x \<approx> 1 - x\<^sup>2 / 2
[PROOF STEP]
have "1 \<approx> 1 - x\<^sup>2 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<approx> 1 - x\<^sup>2 / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> Infinitesimal

goal (1 subgoal):
 1. 1 \<approx> 1 - x\<^sup>2 / 2
[PROOF STEP]
by (auto intro: Infinitesimal_SReal_divide simp add: Infinitesimal_approx_minus [symmetric] numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
1 \<approx> 1 - x\<^sup>2 / 2

goal (1 subgoal):
 1. (*f* cos) x \<approx> 1 - x\<^sup>2 / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<approx> 1 - x\<^sup>2 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<approx> 1 - x\<^sup>2 / 2

goal (1 subgoal):
 1. (*f* cos) x \<approx> 1 - x\<^sup>2 / 2
[PROOF STEP]
using STAR_cos_Infinitesimal approx_trans assms
[PROOF STATE]
proof (prove)
using this:
1 \<approx> 1 - x\<^sup>2 / 2
?x \<in> Infinitesimal \<Longrightarrow> (*f* cos) ?x \<approx> 1
\<lbrakk>?x \<approx> ?y; ?y \<approx> ?z\<rbrakk> \<Longrightarrow> ?x \<approx> ?z
x \<in> Infinitesimal

goal (1 subgoal):
 1. (*f* cos) x \<approx> 1 - x\<^sup>2 / 2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(*f* cos) x \<approx> 1 - x\<^sup>2 / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_geq_0:
  fixes l::"'a::{comm_monoid_add, ordered_ab_semigroup_add_imp_le} list"
  assumes  "l\<noteq>[]"
  and "\<forall>j < length l. 0 \<le> l!j"
shows "0 \<le> sum_list l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> sum_list l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []
\<forall>j<length l. (0::'a) \<le> l ! j

goal (1 subgoal):
 1. (0::'a) \<le> sum_list l
[PROOF STEP]
proof (induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>[] \<noteq> []; \<forall>j<length []. (0::'a) \<le> [] ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list []
 2. \<And>a l. \<lbrakk>\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l; a # l \<noteq> []; \<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
[] \<noteq> []
\<forall>j<length []. (0::'a) \<le> [] ! j

goal (2 subgoals):
 1. \<lbrakk>[] \<noteq> []; \<forall>j<length []. (0::'a) \<le> [] ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list []
 2. \<And>a l. \<lbrakk>\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l; a # l \<noteq> []; \<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[] \<noteq> []
\<forall>j<length []. (0::'a) \<le> [] ! j
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
[] \<noteq> []
\<forall>j<length []. (0::'a) \<le> [] ! j

goal (1 subgoal):
 1. (0::'a) \<le> sum_list []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum_list []

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l; a # l \<noteq> []; \<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l; a # l \<noteq> []; \<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
case (Cons a l)
[PROOF STATE]
proof (state)
this:
\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l
a # l \<noteq> []
\<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l; a # l \<noteq> []; \<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
hence "0 \<le> a"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l
a # l \<noteq> []
\<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j

goal (1 subgoal):
 1. (0::'a) \<le> a
[PROOF STEP]
by (metis length_greater_0_conv nth_Cons_0)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> a

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l; a # l \<noteq> []; \<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
proof (cases "l = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. l = [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
 2. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
l = []

goal (2 subgoals):
 1. l = [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
 2. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
hence "sum_list (a#l) = a"
[PROOF STATE]
proof (prove)
using this:
l = []

goal (1 subgoal):
 1. sum_list (a # l) = a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (a # l) = a

goal (2 subgoals):
 1. l = [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
 2. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum_list (a # l) = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_list (a # l) = a

goal (1 subgoal):
 1. (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
using \<open>0 \<le> a\<close>
[PROOF STATE]
proof (prove)
using this:
sum_list (a # l) = a
(0::'a) \<le> a

goal (1 subgoal):
 1. (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum_list (a # l)

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
l \<noteq> []

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
hence "0 \<le> sum_list l"
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []

goal (1 subgoal):
 1. (0::'a) \<le> sum_list l
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []
\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l
a # l \<noteq> []
\<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j

goal (1 subgoal):
 1. (0::'a) \<le> sum_list l
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum_list l

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum_list l

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
have "... = sum_list (tl (a#l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list l = sum_list (tl (a # l))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list l = sum_list (tl (a # l))

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list l = sum_list (tl (a # l))

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
have "... \<le> sum_list (a#l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (tl (a # l)) \<le> sum_list (a # l)
[PROOF STEP]
using sum_list_geq_tl Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?l \<noteq> []; \<forall>j<length ?l. (0::?'a) \<le> ?l ! j\<rbrakk> \<Longrightarrow> sum_list (tl ?l) \<le> sum_list ?l
\<lbrakk>l \<noteq> []; \<forall>j<length l. (0::'a) \<le> l ! j\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum_list l
a # l \<noteq> []
\<forall>j<length (a # l). (0::'a) \<le> (a # l) ! j

goal (1 subgoal):
 1. sum_list (tl (a # l)) \<le> sum_list (a # l)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
sum_list (tl (a # l)) \<le> sum_list (a # l)

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> sum_list (a # l)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> sum_list (a # l)

goal (1 subgoal):
 1. (0::'a) \<le> sum_list (a # l)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum_list (a # l)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum_list (a # l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_prefix_chars: "is_prefix a b \<Longrightarrow> is_prefix (chars a) (chars b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_prefix a b \<Longrightarrow> is_prefix (chars a) (chars b)
[PROOF STEP]
proof (induct a arbitrary: b)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>b. is_prefix [] b \<Longrightarrow> is_prefix (chars []) (chars b)
 2. \<And>a1 a2 b. \<lbrakk>\<And>b. is_prefix a2 b \<Longrightarrow> is_prefix (chars a2) (chars b); is_prefix (a1 # a2) b\<rbrakk> \<Longrightarrow> is_prefix (chars (a1 # a2)) (chars b)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
is_prefix [] b

goal (2 subgoals):
 1. \<And>b. is_prefix [] b \<Longrightarrow> is_prefix (chars []) (chars b)
 2. \<And>a1 a2 b. \<lbrakk>\<And>b. is_prefix a2 b \<Longrightarrow> is_prefix (chars a2) (chars b); is_prefix (a1 # a2) b\<rbrakk> \<Longrightarrow> is_prefix (chars (a1 # a2)) (chars b)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
is_prefix [] b

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

goal (1 subgoal):
 1. \<And>a1 a2 b. \<lbrakk>\<And>b. is_prefix a2 b \<Longrightarrow> is_prefix (chars a2) (chars b); is_prefix (a1 # a2) b\<rbrakk> \<Longrightarrow> is_prefix (chars (a1 # a2)) (chars b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a1 a2 b. \<lbrakk>\<And>b. is_prefix a2 b \<Longrightarrow> is_prefix (chars a2) (chars b); is_prefix (a1 # a2) b\<rbrakk> \<Longrightarrow> is_prefix (chars (a1 # a2)) (chars b)
[PROOF STEP]
case (Cons x a)
[PROOF STATE]
proof (state)
this:
is_prefix a ?b \<Longrightarrow> is_prefix (chars a) (chars ?b)
is_prefix (x # a) b

goal (1 subgoal):
 1. \<And>a1 a2 b. \<lbrakk>\<And>b. is_prefix a2 b \<Longrightarrow> is_prefix (chars a2) (chars b); is_prefix (a1 # a2) b\<rbrakk> \<Longrightarrow> is_prefix (chars (a1 # a2)) (chars b)
[PROOF STEP]
from Cons(2)
[PROOF STATE]
proof (chain)
picking this:
is_prefix (x # a) b
[PROOF STEP]
have "\<exists> c. b = x # c \<and> is_prefix a c"
[PROOF STATE]
proof (prove)
using this:
is_prefix (x # a) b

goal (1 subgoal):
 1. \<exists>c. b = x # c \<and> is_prefix a c
[PROOF STEP]
by (simp add: is_prefix_cons)
[PROOF STATE]
proof (state)
this:
\<exists>c. b = x # c \<and> is_prefix a c

goal (1 subgoal):
 1. \<And>a1 a2 b. \<lbrakk>\<And>b. is_prefix a2 b \<Longrightarrow> is_prefix (chars a2) (chars b); is_prefix (a1 # a2) b\<rbrakk> \<Longrightarrow> is_prefix (chars (a1 # a2)) (chars b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>c. b = x # c \<and> is_prefix a c
[PROOF STEP]
obtain c where c: "b = x # c \<and> is_prefix a c"
[PROOF STATE]
proof (prove)
using this:
\<exists>c. b = x # c \<and> is_prefix a c

goal (1 subgoal):
 1. (\<And>c. b = x # c \<and> is_prefix a c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b = x # c \<and> is_prefix a c

goal (1 subgoal):
 1. \<And>a1 a2 b. \<lbrakk>\<And>b. is_prefix a2 b \<Longrightarrow> is_prefix (chars a2) (chars b); is_prefix (a1 # a2) b\<rbrakk> \<Longrightarrow> is_prefix (chars (a1 # a2)) (chars b)
[PROOF STEP]
from c Cons(1)
[PROOF STATE]
proof (chain)
picking this:
b = x # c \<and> is_prefix a c
is_prefix a ?b \<Longrightarrow> is_prefix (chars a) (chars ?b)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
b = x # c \<and> is_prefix a c
is_prefix a ?b \<Longrightarrow> is_prefix (chars a) (chars ?b)

goal (1 subgoal):
 1. is_prefix (chars (x # a)) (chars b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_prefix (chars (x # a)) (chars b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma even_even_amicable: assumes  "m Amic n" and "m \<ge>1" and "n \<ge>1" and "even m" and "even n"
  shows "(2*m \<noteq> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * m \<noteq> n
[PROOF STEP]
proof( rule ccontr )
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 2 * m \<noteq> n \<Longrightarrow> False
[PROOF STEP]
have a: "Esigma m  = Esigma n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma m = Esigma n
[PROOF STEP]
using \<open>m Amic n\<close> Amicable_pair_equiv_def Amicable_pair_def
     assms
[PROOF STATE]
proof (prove)
using this:
m Amic n
\<lbrakk>?m Amic ?n; 1 \<le> ?m; 1 \<le> ?n\<rbrakk> \<Longrightarrow> Esigma ?m = Esigma ?n \<and> Esigma ?m = ?m + ?n
?m Amic ?n \<equiv> ?m = aliquot_sum ?n \<and> ?n = aliquot_sum ?m
m Amic n
1 \<le> m
1 \<le> n
even m
even n

goal (1 subgoal):
 1. Esigma m = Esigma n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Esigma m = Esigma n

goal (1 subgoal):
 1. \<not> 2 * m \<noteq> n \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (2*m \<noteq> n)"
[PROOF STATE]
proof (state)
this:
\<not> 2 * m \<noteq> n

goal (1 subgoal):
 1. \<not> 2 * m \<noteq> n \<Longrightarrow> False
[PROOF STEP]
have "(2*m = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * m = n
[PROOF STEP]
using \<open>\<not> (2*m \<noteq> n)\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> 2 * m \<noteq> n

goal (1 subgoal):
 1. 2 * m = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * m = n

goal (1 subgoal):
 1. \<not> 2 * m \<noteq> n \<Longrightarrow> False
[PROOF STEP]
have d:"Esigma n = Esigma (2*m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma n = Esigma (2 * m)
[PROOF STEP]
using  \<open>\<not> (2*m \<noteq> n)\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> 2 * m \<noteq> n

goal (1 subgoal):
 1. Esigma n = Esigma (2 * m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Esigma n = Esigma (2 * m)

goal (1 subgoal):
 1. \<not> 2 * m \<noteq> n \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Esigma n = Esigma (2 * m)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
Esigma n = Esigma (2 * m)

goal (1 subgoal):
 1. False
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Esigma n = Esigma (2 * m) \<Longrightarrow> False
[PROOF STEP]
have w: "2*m \<in> divisor_set (2*m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * m \<in> divisor_set (2 * m)
[PROOF STEP]
using divisor_set assms divisor_set_not_empty
[PROOF STATE]
proof (prove)
using this:
divisor_set ?m = {n. n divisor ?m}
m Amic n
1 \<le> m
1 \<le> n
even m
even n
1 \<le> ?m \<Longrightarrow> ?m \<in> divisor_set ?m

goal (1 subgoal):
 1. 2 * m \<in> divisor_set (2 * m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * m \<in> divisor_set (2 * m)

goal (1 subgoal):
 1. Esigma n = Esigma (2 * m) \<Longrightarrow> False
[PROOF STEP]
have w1: "2*m \<notin> divisor_set (m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * m \<notin> divisor_set m
[PROOF STEP]
using divisor_set assms
[PROOF STATE]
proof (prove)
using this:
divisor_set ?m = {n. n divisor ?m}
m Amic n
1 \<le> m
1 \<le> n
even m
even n

goal (1 subgoal):
 1. 2 * m \<notin> divisor_set m
[PROOF STEP]
by (simp add: divisor_def)
[PROOF STATE]
proof (state)
this:
2 * m \<notin> divisor_set m

goal (1 subgoal):
 1. Esigma n = Esigma (2 * m) \<Longrightarrow> False
[PROOF STEP]
have w2: "\<forall> n::nat. n divisor m \<longrightarrow> n divisor (2*m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. n divisor m \<longrightarrow> n divisor (2 * m)
[PROOF STEP]
using assms divisor_def
[PROOF STATE]
proof (prove)
using this:
m Amic n
1 \<le> m
1 \<le> n
even m
even n
?n divisor ?m \<equiv> 1 \<le> ?n \<and> ?n \<le> ?m \<and> ?n dvd ?m

goal (1 subgoal):
 1. \<forall>n. n divisor m \<longrightarrow> n divisor (2 * m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n. n divisor m \<longrightarrow> n divisor (2 * m)

goal (1 subgoal):
 1. Esigma n = Esigma (2 * m) \<Longrightarrow> False
[PROOF STEP]
have w3: "divisor_set (2*m) \<supset> divisor_set m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_set m \<subset> divisor_set (2 * m)
[PROOF STEP]
using divisor_set divisor_def assms w w1 w2
[PROOF STATE]
proof (prove)
using this:
divisor_set ?m = {n. n divisor ?m}
?n divisor ?m \<equiv> 1 \<le> ?n \<and> ?n \<le> ?m \<and> ?n dvd ?m
m Amic n
1 \<le> m
1 \<le> n
even m
even n
2 * m \<in> divisor_set (2 * m)
2 * m \<notin> divisor_set m
\<forall>n. n divisor m \<longrightarrow> n divisor (2 * m)

goal (1 subgoal):
 1. divisor_set m \<subset> divisor_set (2 * m)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
divisor_set m \<subset> divisor_set (2 * m)

goal (1 subgoal):
 1. Esigma n = Esigma (2 * m) \<Longrightarrow> False
[PROOF STEP]
have v: "( \<Sum> i \<in> ( divisor_set (2*m)).i)> ( \<Sum> i \<in> ( divisor_set m).i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> (divisor_set m) < \<Sum> (divisor_set (2 * m))
[PROOF STEP]
using w3  sum_strict_mono
[PROOF STATE]
proof (prove)
using this:
divisor_set m \<subset> divisor_set (2 * m)
\<lbrakk>finite ?B; ?A \<subset> ?B; 0 \<notin> ?B\<rbrakk> \<Longrightarrow> \<Sum> ?A < \<Sum> ?B

goal (1 subgoal):
 1. \<Sum> (divisor_set m) < \<Sum> (divisor_set (2 * m))
[PROOF STEP]
by (simp add: divisor_def divisor_set)
[PROOF STATE]
proof (state)
this:
\<Sum> (divisor_set m) < \<Sum> (divisor_set (2 * m))

goal (1 subgoal):
 1. Esigma n = Esigma (2 * m) \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
using v d Esigma_def a
[PROOF STATE]
proof (prove)
using this:
\<Sum> (divisor_set m) < \<Sum> (divisor_set (2 * m))
Esigma n = Esigma (2 * m)
Esigma ?n \<equiv> \<Sum> (divisor_set ?n)
Esigma m = Esigma n

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in cring) padd_in_carrierp:
  "a \<in> carrier R \<Longrightarrow> in_carrierp p\<^sub>1 \<Longrightarrow> in_carrierp p\<^sub>2 \<Longrightarrow> in_carrierp (padd a p\<^sub>1 p\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; in_carrierp p\<^sub>1; in_carrierp p\<^sub>2\<rbrakk> \<Longrightarrow> in_carrierp (padd a p\<^sub>1 p\<^sub>2)
[PROOF STEP]
by (auto simp add: padd_def Let_def pdouble_in_carrierp split: prod.split)
    (auto simp add: in_carrierp_def)


[STATEMENT]
lemma vec_to_iarray_nth':
  fixes A::"'a^'n::{mod_type}"
  shows "(vec_to_iarray A) !! (to_nat i) = A $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray A !! mod_type_class.to_nat i = A $ i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_to_iarray A !! mod_type_class.to_nat i = A $ i
[PROOF STEP]
have to_nat_less_card: "to_nat i<CARD('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat i < CARD('n)
[PROOF STEP]
using bij_to_nat[where ?'a='n]
[PROOF STATE]
proof (prove)
using this:
bij_betw mod_type_class.to_nat UNIV {0..<CARD('n)}

goal (1 subgoal):
 1. mod_type_class.to_nat i < CARD('n)
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('n)}

goal (1 subgoal):
 1. mod_type_class.to_nat i < CARD('n)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat i < CARD('n)

goal (1 subgoal):
 1. vec_to_iarray A !! mod_type_class.to_nat i = A $ i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray A !! mod_type_class.to_nat i = A $ i
[PROOF STEP]
unfolding vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat i) CARD('n) !! mod_type_class.to_nat i = A $ i
[PROOF STEP]
unfolding of_fun_nth[OF to_nat_less_card] from_nat_to_nat_id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ i = A $ i
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
vec_to_iarray A !! mod_type_class.to_nat i = A $ i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infinite_infinite_subsets:
  assumes "infinite A"
  shows   "infinite {X. X \<subseteq> A \<and> infinite X}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
have "\<forall>k. \<exists>X. X \<subseteq> A \<and> infinite X \<and> card (A - X) = k" for k :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k
[PROOF STEP]
fix k :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k
[PROOF STEP]
obtain Y where "finite Y" "card Y = k" "Y \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>finite Y; card Y = k; Y \<subseteq> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using infinite_arbitrarily_large[of A k] assms
[PROOF STATE]
proof (prove)
using this:
infinite A \<Longrightarrow> \<exists>B. finite B \<and> card B = k \<and> B \<subseteq> A
infinite A

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>finite Y; card Y = k; Y \<subseteq> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite Y
card Y = k
Y \<subseteq> A

goal (1 subgoal):
 1. \<And>k. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite Y
card Y = k
Y \<subseteq> A

goal (1 subgoal):
 1. \<And>k. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
finite Y
card Y = k
Y \<subseteq> A
[PROOF STEP]
have "A - (A - Y) = Y"
[PROOF STATE]
proof (prove)
using this:
finite Y
card Y = k
Y \<subseteq> A

goal (1 subgoal):
 1. A - (A - Y) = Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A - (A - Y) = Y

goal (1 subgoal):
 1. \<And>k. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite Y
card Y = k
Y \<subseteq> A
A - (A - Y) = Y
[PROOF STEP]
show "\<exists>X. X \<subseteq> A \<and> infinite X \<and> card (A - X) = k"
[PROOF STATE]
proof (prove)
using this:
finite Y
card Y = k
Y \<subseteq> A
A - (A - Y) = Y

goal (1 subgoal):
 1. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite Y
card Y = k
Y \<subseteq> A
A - (A - Y) = Y
infinite A

goal (1 subgoal):
 1. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k
[PROOF STEP]
by (intro exI[of _ "A - Y"]) auto
[PROOF STATE]
proof (state)
this:
\<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>k. \<exists>X\<subseteq>A. infinite X \<and> card (A - X) = k

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
from choice[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>f. \<forall>x. f x \<subseteq> A \<and> infinite (f x) \<and> card (A - f x) = x
[PROOF STEP]
obtain f
    where f: "\<And>k. f k \<subseteq> A \<and> infinite (f k) \<and> card (A - f k) = k"
[PROOF STATE]
proof (prove)
using this:
\<exists>f. \<forall>x. f x \<subseteq> A \<and> infinite (f x) \<and> card (A - f x) = x

goal (1 subgoal):
 1. (\<And>f. (\<And>k. f k \<subseteq> A \<and> infinite (f k) \<and> card (A - f k) = k) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ?k \<subseteq> A \<and> infinite (f ?k) \<and> card (A - f ?k) = ?k

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
have "k = l" if "f k = f l" for k l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = l
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k \<noteq> l \<Longrightarrow> False
[PROOF STEP]
assume "k \<noteq> l"
[PROOF STATE]
proof (state)
this:
k \<noteq> l

goal (1 subgoal):
 1. k \<noteq> l \<Longrightarrow> False
[PROOF STEP]
hence "card (A - f k) \<noteq> card (A - f l)"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> l

goal (1 subgoal):
 1. card (A - f k) \<noteq> card (A - f l)
[PROOF STEP]
using f[of k] f[of l]
[PROOF STATE]
proof (prove)
using this:
k \<noteq> l
f k \<subseteq> A \<and> infinite (f k) \<and> card (A - f k) = k
f l \<subseteq> A \<and> infinite (f l) \<and> card (A - f l) = l

goal (1 subgoal):
 1. card (A - f k) \<noteq> card (A - f l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (A - f k) \<noteq> card (A - f l)

goal (1 subgoal):
 1. k \<noteq> l \<Longrightarrow> False
[PROOF STEP]
with \<open>f k = f l\<close>
[PROOF STATE]
proof (chain)
picking this:
f k = f l
card (A - f k) \<noteq> card (A - f l)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
f k = f l
card (A - f k) \<noteq> card (A - f l)

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:
f ?k = f ?l \<Longrightarrow> ?k = ?l

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
hence "inj f"
[PROOF STATE]
proof (prove)
using this:
f ?k = f ?l \<Longrightarrow> ?k = ?l

goal (1 subgoal):
 1. inj f
[PROOF STEP]
by (auto intro: injI)
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
have "range f \<subseteq> {X. X \<subseteq> A \<and> infinite X}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range f \<subseteq> {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
f ?k \<subseteq> A \<and> infinite (f ?k) \<and> card (A - f ?k) = ?k

goal (1 subgoal):
 1. range f \<subseteq> {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range f \<subseteq> {X. X \<subseteq> A \<and> infinite X}

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj f
range f \<subseteq> {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj f
range f \<subseteq> {X. X \<subseteq> A \<and> infinite X}

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> infinite X}
[PROOF STEP]
by (subst infinite_iff_countable_subset) auto
[PROOF STATE]
proof (state)
this:
infinite {X. X \<subseteq> A \<and> infinite X}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in comm_group) set_mult_comm:
  assumes "H \<subseteq> carrier G" "J \<subseteq> carrier G"
  shows "(H <#> J) = (J <#> H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H <#> J = J <#> H
[PROOF STEP]
unfolding set_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>h\<in>J. \<Union>k\<in>H. {h \<otimes> k})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>h\<in>J. \<Union>k\<in>H. {h \<otimes> k})
[PROOF STEP]
have 1: "\<And>a b. \<lbrakk>a \<in> carrier G; b \<in> carrier G\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> carrier G; b \<in> carrier G\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}
[PROOF STEP]
using m_comm
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier G; ?y \<in> carrier G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y = ?y \<otimes> ?x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> carrier G; b \<in> carrier G\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<in> carrier G; ?b \<in> carrier G\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}

goal (1 subgoal):
 1. (\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>h\<in>J. \<Union>k\<in>H. {h \<otimes> k})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?a \<in> carrier G; ?b \<in> carrier G\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}
[PROOF STEP]
have "\<And>a b.\<lbrakk>a \<in> H; b \<in> J\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> carrier G; ?b \<in> carrier G\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> H; b \<in> J\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> carrier G; ?b \<in> carrier G\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}
H \<subseteq> carrier G
J \<subseteq> carrier G

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> H; b \<in> J\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<in> H; ?b \<in> J\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}

goal (1 subgoal):
 1. (\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>h\<in>J. \<Union>k\<in>H. {h \<otimes> k})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<in> H; ?b \<in> J\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}

goal (1 subgoal):
 1. (\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>h\<in>J. \<Union>k\<in>H. {h \<otimes> k})
[PROOF STEP]
have "\<And>a b.\<lbrakk>b \<in> H; a \<in> J\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>b \<in> H; a \<in> J\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}
[PROOF STEP]
using assms 1
[PROOF STATE]
proof (prove)
using this:
H \<subseteq> carrier G
J \<subseteq> carrier G
\<lbrakk>?a \<in> carrier G; ?b \<in> carrier G\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>b \<in> H; a \<in> J\<rbrakk> \<Longrightarrow> {a \<otimes> b} = {b \<otimes> a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?b \<in> H; ?a \<in> J\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}

goal (1 subgoal):
 1. (\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>h\<in>J. \<Union>k\<in>H. {h \<otimes> k})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?a \<in> H; ?b \<in> J\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}
\<lbrakk>?b \<in> H; ?a \<in> J\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}
[PROOF STEP]
show "(\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>k\<in>J. \<Union>h\<in>H. {k \<otimes> h})"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> H; ?b \<in> J\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}
\<lbrakk>?b \<in> H; ?a \<in> J\<rbrakk> \<Longrightarrow> {?a \<otimes> ?b} = {?b \<otimes> ?a}

goal (1 subgoal):
 1. (\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>k\<in>J. \<Union>h\<in>H. {k \<otimes> h})
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(\<Union>h\<in>H. \<Union>k\<in>J. {h \<otimes> k}) = (\<Union>k\<in>J. \<Union>h\<in>H. {k \<otimes> h})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ltake_iterates_Suc:
  "ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]
[PROOF STEP]
proof(induct n arbitrary: m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. ltake (enat 0) (iterates Suc m) = llist_of [m..<0 + m]
 2. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>m. ltake (enat 0) (iterates Suc m) = llist_of [m..<0 + m]
 2. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake (enat 0) (iterates Suc m) = llist_of [m..<0 + m]
[PROOF STEP]
by(simp add: zero_enat_def[symmetric])
[PROOF STATE]
proof (state)
this:
ltake (enat 0) (iterates Suc m) = llist_of [m..<0 + m]

goal (1 subgoal):
 1. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
ltake (enat n) (iterates Suc ?m) = llist_of [?m..<n + ?m]

goal (1 subgoal):
 1. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
have "ltake (enat (Suc n)) (iterates Suc m) =
        LCons m (ltake (enat n) (iterates Suc (Suc m)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake (enat (Suc n)) (iterates Suc m) = LCons m (ltake (enat n) (iterates Suc (Suc m)))
[PROOF STEP]
by(subst iterates)(simp add: eSuc_enat[symmetric])
[PROOF STATE]
proof (state)
this:
ltake (enat (Suc n)) (iterates Suc m) = LCons m (ltake (enat n) (iterates Suc (Suc m)))

goal (1 subgoal):
 1. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ltake (enat (Suc n)) (iterates Suc m) = LCons m (ltake (enat n) (iterates Suc (Suc m)))

goal (1 subgoal):
 1. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
note Suc
[PROOF STATE]
proof (state)
this:
ltake (enat n) (iterates Suc ?m) = llist_of [?m..<n + ?m]

goal (1 subgoal):
 1. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ltake (enat n) (iterates Suc ?m) = llist_of [?m..<n + ?m]

goal (1 subgoal):
 1. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
have "LCons m (llist_of [Suc m..<n + Suc m]) = llist_of [m..<Suc n+m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LCons m (llist_of [Suc m..<n + Suc m]) = llist_of [m..<Suc n + m]
[PROOF STEP]
unfolding llist_of.simps[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_of (m # [Suc m..<n + Suc m]) = llist_of [m..<Suc n + m]
[PROOF STEP]
by(auto simp del: llist_of.simps simp add: upt_conv_Cons)
[PROOF STATE]
proof (state)
this:
LCons m (llist_of [Suc m..<n + Suc m]) = llist_of [m..<Suc n + m]

goal (1 subgoal):
 1. \<And>n m. (\<And>m. ltake (enat n) (iterates Suc m) = llist_of [m..<n + m]) \<Longrightarrow> ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]

goal (1 subgoal):
 1. ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ltake (enat (Suc n)) (iterates Suc m) = llist_of [m..<Suc n + m]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compare_expansions_LT:
  assumes "compare_expansions F G = (LT, c, c')" "trimmed G"
          "(f expands_to F) basis" "(g expands_to G) basis" "basis_wf basis"
  shows   "f \<in> o(g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
compare_expansions F G = (LT, c, c')
trimmed G
(f expands_to F) basis
(g expands_to G) basis
basis_wf basis
[PROOF STEP]
have "f \<in> \<Theta>(eval F)"
[PROOF STATE]
proof (prove)
using this:
compare_expansions F G = (LT, c, c')
trimmed G
(f expands_to F) basis
(g expands_to G) basis
basis_wf basis

goal (1 subgoal):
 1. f \<in> \<Theta>(eval F)
[PROOF STEP]
by (auto simp: expands_to.simps eq_commute intro!: bigthetaI_cong)
[PROOF STATE]
proof (state)
this:
f \<in> \<Theta>(eval F)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f \<in> \<Theta>(eval F)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
have "eval F \<in> O(eval_monom (1, snd (dominant_term F)) basis)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval F \<in> O(eval_monom (1, snd (dominant_term F)) basis)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
compare_expansions F G = (LT, c, c')
trimmed G
(f expands_to F) basis
(g expands_to G) basis
basis_wf basis

goal (1 subgoal):
 1. eval F \<in> O(eval_monom (1, snd (dominant_term F)) basis)
[PROOF STEP]
by (intro dominant_term_bigo) (auto simp: expands_to.simps)
[PROOF STATE]
proof (state)
this:
eval F \<in> O(eval_monom (1, snd (dominant_term F)) basis)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval F \<in> O(eval_monom (1, snd (dominant_term F)) basis)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
have "eval_monom (1, snd (dominant_term F)) basis \<in>
               o(eval_monom (1, snd (dominant_term G)) basis)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_monom (1, snd (dominant_term F)) basis \<in> o(eval_monom (1, snd (dominant_term G)) basis)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
compare_expansions F G = (LT, c, c')
trimmed G
(f expands_to F) basis
(g expands_to G) basis
basis_wf basis

goal (1 subgoal):
 1. eval_monom (1, snd (dominant_term F)) basis \<in> o(eval_monom (1, snd (dominant_term G)) basis)
[PROOF STEP]
by (intro eval_monom_smallo_eval_monom)
       (auto simp: length_dominant_term expands_to.simps is_expansion_length compare_expansions_def
             split: cmp_result.splits)
[PROOF STATE]
proof (state)
this:
eval_monom (1, snd (dominant_term F)) basis \<in> o(eval_monom (1, snd (dominant_term G)) basis)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_monom (1, snd (dominant_term F)) basis \<in> o(eval_monom (1, snd (dominant_term G)) basis)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
have "eval_monom (1, snd (dominant_term G)) basis \<in> \<Theta>(eval_monom (dominant_term G) basis)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_monom (1, snd (dominant_term G)) basis \<in> \<Theta>(eval_monom (dominant_term G) basis)
[PROOF STEP]
by (subst (2) eval_monom_1_conv, subst landau_theta.cmult)
       (insert assms, simp_all add: trimmed_imp_dominant_term_nz)
[PROOF STATE]
proof (state)
this:
eval_monom (1, snd (dominant_term G)) basis \<in> \<Theta>(eval_monom (dominant_term G) basis)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_monom (1, snd (dominant_term G)) basis \<in> \<Theta>(eval_monom (dominant_term G) basis)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
have "eval_monom (dominant_term G) basis \<in> \<Theta>(g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_monom (dominant_term G) basis \<in> \<Theta>(g)
[PROOF STEP]
by (intro asymp_equiv_imp_bigtheta[OF asymp_equiv_symI] dominant_term_expands_to
              asymp_equiv_imp_bigtheta assms)
[PROOF STATE]
proof (state)
this:
eval_monom (dominant_term G) basis \<in> \<Theta>(g)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f \<in> o(g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> o(g)

goal (1 subgoal):
 1. f \<in> o(g)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f \<in> o(g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prefix_map_rightE:
  assumes "prefix xs (map f ys)"
  shows   "\<exists>xs'. prefix xs' ys \<and> xs = map f xs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xs'. prefix xs' ys \<and> xs = map f xs'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>xs'. prefix xs' ys \<and> xs = map f xs'
[PROOF STEP]
define n where "n = length xs"
[PROOF STATE]
proof (state)
this:
n = length xs

goal (1 subgoal):
 1. \<exists>xs'. prefix xs' ys \<and> xs = map f xs'
[PROOF STEP]
have "xs = take n (map f ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = take n (map f ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prefix xs (map f ys)

goal (1 subgoal):
 1. xs = take n (map f ys)
[PROOF STEP]
by (auto simp: prefix_def n_def)
[PROOF STATE]
proof (state)
this:
xs = take n (map f ys)

goal (1 subgoal):
 1. \<exists>xs'. prefix xs' ys \<and> xs = map f xs'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
xs = take n (map f ys)

goal (1 subgoal):
 1. \<exists>xs'. prefix xs' ys \<and> xs = map f xs'
[PROOF STEP]
by (intro exI[of _ "take n ys"]) (auto simp: take_map take_is_prefix)
[PROOF STATE]
proof (state)
this:
\<exists>xs'. prefix xs' ys \<and> xs = map f xs'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma monad_id [locale_witness]: "monad return_id bind_id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monad return_id bind_id
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x f g. bind_id (bind_id x f) g = bind_id x (\<lambda>y. bind_id (f y) g)
 2. \<And>x f. bind_id (return_id x) f = f x
 3. \<And>x. bind_id x return_id = x
[PROOF STEP]
show "bind_id (bind_id x f) g = bind_id x (\<lambda>x. bind_id (f x) g)"
    for x :: "'a id" and f :: "'a \<Rightarrow> 'a id" and g :: "'a \<Rightarrow> 'a id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bind_id (bind_id x f) g = bind_id x (\<lambda>x. bind_id (f x) g)
[PROOF STEP]
by(rule id.expand) simp
[PROOF STATE]
proof (state)
this:
bind_id (bind_id ?x ?f) ?g = bind_id ?x (\<lambda>x. bind_id (?f x) ?g)

goal (2 subgoals):
 1. \<And>x f. bind_id (return_id x) f = f x
 2. \<And>x. bind_id x return_id = x
[PROOF STEP]
show "bind_id (return_id x) f = f x" for f :: "'a \<Rightarrow> 'a id" and x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bind_id (return_id x) f = f x
[PROOF STEP]
by(rule id.expand) simp
[PROOF STATE]
proof (state)
this:
bind_id (return_id ?x) ?f = ?f ?x

goal (1 subgoal):
 1. \<And>x. bind_id x return_id = x
[PROOF STEP]
show "bind_id x return_id = x" for x :: "'a id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bind_id x return_id = x
[PROOF STEP]
by(rule id.expand) simp
[PROOF STATE]
proof (state)
this:
bind_id ?x return_id = ?x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zeta_partial_sum_gt_1_asymp_equiv:
  fixes s :: real
  assumes "s > 1"
  defines "\<zeta> \<equiv> Re (zeta s)"
  shows "sum_upto (\<lambda>n. n powr -s) \<sim>[at_top] (\<lambda>x. \<zeta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
have [simp]: "\<zeta> \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zeta> \<noteq> 0
[PROOF STEP]
using assms zeta_Re_gt_1_nonzero[of s] zeta_real[of s]
[PROOF STATE]
proof (prove)
using this:
1 < s
\<zeta> \<equiv> Re (zeta (complex_of_real s))
1 < Re (complex_of_real s) \<Longrightarrow> zeta (complex_of_real s) \<noteq> 0
zeta (complex_of_real s) \<in> \<real>

goal (1 subgoal):
 1. \<zeta> \<noteq> 0
[PROOF STEP]
by (auto elim!: Reals_cases)
[PROOF STATE]
proof (state)
this:
\<zeta> \<noteq> 0

goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
from zeta_partial_sum_le_pos[of s] assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < s; s \<noteq> 1\<rbrakk> \<Longrightarrow> \<exists>c>0. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - s) x - (x powr (1 - s) / (1 - s) + Re (zeta (complex_of_real s)))\<bar> \<le> c * x powr - s
1 < s
\<zeta> \<equiv> Re (zeta (complex_of_real s))
[PROOF STEP]
obtain c where
    c: "c > 0" "\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr -s) x - (x powr (1 - s) / (1 - s) + \<zeta>)\<bar> \<le>
                        c * x powr -s"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < s; s \<noteq> 1\<rbrakk> \<Longrightarrow> \<exists>c>0. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - s) x - (x powr (1 - s) / (1 - s) + Re (zeta (complex_of_real s)))\<bar> \<le> c * x powr - s
1 < s
\<zeta> \<equiv> Re (zeta (complex_of_real s))

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>0 < c; \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - s) x - (x powr (1 - s) / (1 - s) + \<zeta>)\<bar> \<le> c * x powr - s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: \<zeta>_def)
[PROOF STATE]
proof (state)
this:
0 < c
\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - s) x - (x powr (1 - s) / (1 - s) + \<zeta>)\<bar> \<le> c * x powr - s

goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
hence "(\<lambda>x. sum_upto (\<lambda>x. real x powr -s) x - \<zeta> - x powr (1 - s) / (1 - s)) \<in> O(\<lambda>x. x powr -s)"
[PROOF STATE]
proof (prove)
using this:
0 < c
\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - s) x - (x powr (1 - s) / (1 - s) + \<zeta>)\<bar> \<le> c * x powr - s

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>x. real x powr - s) x - \<zeta> - x powr (1 - s) / (1 - s)) \<in> O(\<lambda>x. x powr - s)
[PROOF STEP]
by (intro bigoI[of _ c] eventually_mono[OF eventually_ge_at_top[of 1]]) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr - s) x - \<zeta> - x powr (1 - s) / (1 - s)) \<in> O(\<lambda>x. x powr - s)

goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr - s) x - \<zeta> - x powr (1 - s) / (1 - s)) \<in> O(\<lambda>x. x powr - s)

goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
have "(\<lambda>x. x powr -s) \<in> o(\<lambda>_. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x powr - s) \<in> o(\<lambda>_. 1)
[PROOF STEP]
using \<open>s > 1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < s

goal (1 subgoal):
 1. (\<lambda>x. x powr - s) \<in> o(\<lambda>_. 1)
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x powr - s) \<in> o(\<lambda>_. 1)

goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr - s) x - \<zeta> - x powr (1 - s) / (1 - s)) \<in> o(\<lambda>_. 1)
[PROOF STEP]
have "(\<lambda>x. sum_upto (\<lambda>x. real x powr -s) x - \<zeta> - x powr (1 - s) / (1 - s) +
             x powr (1 - s) / (1 - s)) \<in> o(\<lambda>_. 1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr - s) x - \<zeta> - x powr (1 - s) / (1 - s)) \<in> o(\<lambda>_. 1)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>x. real x powr - s) x - \<zeta> - x powr (1 - s) / (1 - s) + x powr (1 - s) / (1 - s)) \<in> o(\<lambda>_. 1)
[PROOF STEP]
by (rule sum_in_smallo) (use \<open>s > 1\<close> in real_asymp)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr - s) x - \<zeta> - x powr (1 - s) / (1 - s) + x powr (1 - s) / (1 - s)) \<in> o(\<lambda>_. 1)

goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr - s) x - \<zeta> - x powr (1 - s) / (1 - s) + x powr (1 - s) / (1 - s)) \<in> o(\<lambda>_. 1)

goal (1 subgoal):
 1. sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)
[PROOF STEP]
by (simp add: smallo_imp_asymp_equiv)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>x. real x powr - s) \<sim>[at_top] (\<lambda>x. \<zeta>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma residual_eq1: "residuated f \<Longrightarrow> residual f y = \<Squnion> {x. f x \<le> y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residuated f \<Longrightarrow> residual f y = \<Squnion> {x. f x \<le> y}
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. residuated f \<Longrightarrow> residual f y \<le> \<Squnion> {x. f x \<le> y}
 2. residuated f \<Longrightarrow> \<Squnion> {x. f x \<le> y} \<le> residual f y
[PROOF STEP]
assume assm: "residuated f"
[PROOF STATE]
proof (state)
this:
residuated f

goal (2 subgoals):
 1. residuated f \<Longrightarrow> residual f y \<le> \<Squnion> {x. f x \<le> y}
 2. residuated f \<Longrightarrow> \<Squnion> {x. f x \<le> y} \<le> residual f y
[PROOF STEP]
thus "residual f y \<le> \<Squnion>{x. f x \<le> y}"
[PROOF STATE]
proof (prove)
using this:
residuated f

goal (1 subgoal):
 1. residual f y \<le> \<Squnion> {x. f x \<le> y}
[PROOF STEP]
by (auto simp: res_i1 intro!: Sup_upper)
[PROOF STATE]
proof (state)
this:
residual f y \<le> \<Squnion> {x. f x \<le> y}

goal (1 subgoal):
 1. residuated f \<Longrightarrow> \<Squnion> {x. f x \<le> y} \<le> residual f y
[PROOF STEP]
show "\<Squnion>{x. f x \<le> y} \<le> residual f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> {x. f x \<le> y} \<le> residual f y
[PROOF STEP]
by (auto simp: assm intro!: Sup_least residual_galoisI1)
[PROOF STATE]
proof (state)
this:
\<Squnion> {x. f x \<le> y} \<le> residual f y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frequently_at_top_at_topE:
  fixes P::"nat \<Rightarrow> 'a::{linorder,no_top}\<Rightarrow>_" and g::"nat\<Rightarrow>'a"
  assumes "\<forall>n. \<exists>\<^sub>F a in at_top. P n a" "filterlim g at_top sequentially"
  obtains s::"nat\<Rightarrow>'a"
  where "\<And>i. P i (s i)" "filterlim s at_top sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. \<lbrakk>\<And>i. P i (s i); filterlim s at_top sequentially\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>s. \<lbrakk>\<And>i. P i (s i); filterlim s at_top sequentially\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from frequently_at_topE'[OF assms]
[PROOF STATE]
proof (chain)
picking this:
(\<And>s. \<lbrakk>\<And>i. P i (s i); strict_mono s; \<And>n. g n \<le> s n\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain s where s: "(\<And>i. P i (s i))" "strict_mono s" "(\<And>n. g n \<le> s n)"
[PROOF STATE]
proof (prove)
using this:
(\<And>s. \<lbrakk>\<And>i. P i (s i); strict_mono s; \<And>n. g n \<le> s n\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>s. \<lbrakk>\<And>i. P i (s i); strict_mono s; \<And>n. g n \<le> s n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P ?i (s ?i)
strict_mono s
g ?n \<le> s ?n

goal (1 subgoal):
 1. (\<And>s. \<lbrakk>\<And>i. P i (s i); filterlim s at_top sequentially\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have s_at_top: "filterlim s at_top sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim s at_top sequentially
[PROOF STEP]
by (rule filterlim_at_top_mono) (use assms s in auto)
[PROOF STATE]
proof (state)
this:
filterlim s at_top sequentially

goal (1 subgoal):
 1. (\<And>s. \<lbrakk>\<And>i. P i (s i); filterlim s at_top sequentially\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with s(1)
[PROOF STATE]
proof (chain)
picking this:
P ?i (s ?i)
filterlim s at_top sequentially
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P ?i (s ?i)
filterlim s at_top sequentially

goal (1 subgoal):
 1. thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_less_of_nat_mult:
  fixes x :: "'a::archimedean_field"
  assumes "0 < x"
  shows "\<exists>n. y < of_nat n * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. y < of_nat n * x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>n. y < of_nat n * x
[PROOF STEP]
obtain n where "y / x < of_nat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. y / x < of_nat n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using reals_Archimedean2
[PROOF STATE]
proof (prove)
using this:
\<exists>n. ?x < of_nat n

goal (1 subgoal):
 1. (\<And>n. y / x < of_nat n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
y / x < of_nat n

goal (1 subgoal):
 1. \<exists>n. y < of_nat n * x
[PROOF STEP]
with \<open>0 < x\<close>
[PROOF STATE]
proof (chain)
picking this:
(0::'a) < x
y / x < of_nat n
[PROOF STEP]
have "y < of_nat n * x"
[PROOF STATE]
proof (prove)
using this:
(0::'a) < x
y / x < of_nat n

goal (1 subgoal):
 1. y < of_nat n * x
[PROOF STEP]
by (simp add: pos_divide_less_eq)
[PROOF STATE]
proof (state)
this:
y < of_nat n * x

goal (1 subgoal):
 1. \<exists>n. y < of_nat n * x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y < of_nat n * x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y < of_nat n * x

goal (1 subgoal):
 1. \<exists>n. y < of_nat n * x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>n. y < of_nat n * x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inf_glb:
  assumes "A \<subseteq> carrier L"
  shows "greatest L (\<Sqinter>A) (Lower L A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_glb L (\<Sqinter>A) A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_glb L (\<Sqinter>A) A
[PROOF STEP]
obtain i where "greatest L i (Lower L A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. is_glb L i A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms inf_exists)
[PROOF STATE]
proof (state)
this:
is_glb L i A

goal (1 subgoal):
 1. is_glb L (\<Sqinter>A) A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
is_glb L i A

goal (1 subgoal):
 1. is_glb L (\<Sqinter>A) A
[PROOF STEP]
by (metis inf_def someI_ex)
[PROOF STATE]
proof (state)
this:
is_glb L (\<Sqinter>A) A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equals_flowI:
  assumes "t0 \<in> T'"
    "is_interval T'"
    "T' \<subseteq> existence_ivl t0 x0"
    "(z solves_ode f) T' X"
    "z t0 = flow t0 x0 t0" "t \<in> T'"
  shows "z t = flow t0 x0 t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z t = flow t0 x0 t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z t = flow t0 x0 t
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
t0 \<in> T'
is_interval T'
T' \<subseteq> existence_ivl t0 x0
(z solves_ode f) T' X
z t0 = flow t0 x0 t0
t \<in> T'
[PROOF STEP]
have iv_defined: "t0 \<in> T" "x0 \<in> X"
[PROOF STATE]
proof (prove)
using this:
t0 \<in> T'
is_interval T'
T' \<subseteq> existence_ivl t0 x0
(z solves_ode f) T' X
z t0 = flow t0 x0 t0
t \<in> T'

goal (1 subgoal):
 1. t0 \<in> T &&& x0 \<in> X
[PROOF STEP]
unfolding atomize_conj
[PROOF STATE]
proof (prove)
using this:
t0 \<in> T'
is_interval T'
T' \<subseteq> existence_ivl t0 x0
(z solves_ode f) T' X
z t0 = flow t0 x0 t0
t \<in> T'

goal (1 subgoal):
 1. t0 \<in> T \<and> x0 \<in> X
[PROOF STEP]
using assms existence_ivl_subset mem_existence_ivl_iv_defined
[PROOF STATE]
proof (prove)
using this:
t0 \<in> T'
is_interval T'
T' \<subseteq> existence_ivl t0 x0
(z solves_ode f) T' X
z t0 = flow t0 x0 t0
t \<in> T'
t0 \<in> T'
is_interval T'
T' \<subseteq> existence_ivl t0 x0
(z solves_ode f) T' X
z t0 = flow t0 x0 t0
t \<in> T'
existence_ivl t0 ?x0.0 \<subseteq> T
?t \<in> existence_ivl t0 ?x0.0 \<Longrightarrow> t0 \<in> T
?t \<in> existence_ivl t0 ?x0.0 \<Longrightarrow> ?x0.0 \<in> X

goal (1 subgoal):
 1. t0 \<in> T \<and> x0 \<in> X
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
t0 \<in> T
x0 \<in> X

goal (1 subgoal):
 1. z t = flow t0 x0 t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z t = flow t0 x0 t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
t0 \<in> T'
is_interval T'
T' \<subseteq> existence_ivl t0 x0
(z solves_ode f) T' X
z t0 = flow t0 x0 t0
t \<in> T'

goal (1 subgoal):
 1. z t = flow t0 x0 t
[PROOF STEP]
by (rule usolves_odeD[OF flow_usolves_ode[OF iv_defined]])
[PROOF STATE]
proof (state)
this:
z t = flow t0 x0 t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_list_all2I:
  "\<lbrakk> length a = length b; \<And>n. n < length a \<Longrightarrow> (a!n,b!n) \<in> S \<rbrakk> \<Longrightarrow> list_all2 (fun_of S) a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length a = length b; \<And>n. n < length a \<Longrightarrow> (a ! n, b ! n) \<in> S\<rbrakk> \<Longrightarrow> list_all2 (fun_of S) a b
[PROOF STEP]
by (erule list_all2_all_nthI) simp


[STATEMENT]
lemma fold_invar:
  assumes "finite M"
    and   "P z"
    and   "\<forall>z. \<forall>x\<in>M. P z \<longrightarrow> P (f x z)"
    and   "comp_fun_commute f"
  shows   "P (Finite_Set.fold f z M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (Finite_Set.fold f z M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P (Finite_Set.fold f z M)
[PROOF STEP]
interpret commute: comp_fun_commute f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute f
[PROOF STEP]
by (fact \<open>comp_fun_commute f\<close>)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P (Finite_Set.fold f z M)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite M
P z
\<forall>z. \<forall>x\<in>M. P z \<longrightarrow> P (f x z)
comp_fun_commute f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite M
P z
\<forall>z. \<forall>x\<in>M. P z \<longrightarrow> P (f x z)
comp_fun_commute f

goal (1 subgoal):
 1. P (Finite_Set.fold f z M)
[PROOF STEP]
by (induct M arbitrary: z rule: finite_induct) auto
[PROOF STATE]
proof (state)
this:
P (Finite_Set.fold f z M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutation_permutesE:
  assumes \<open>permutation p\<close>
  obtains S where \<open>finite S\<close> \<open>p permutes S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>S. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
permutation p
[PROOF STEP]
have fin: \<open>finite {x. p x \<noteq> x}\<close>
[PROOF STATE]
proof (prove)
using this:
permutation p

goal (1 subgoal):
 1. finite {x. p x \<noteq> x}
[PROOF STEP]
by (simp add: permutation)
[PROOF STATE]
proof (state)
this:
finite {x. p x \<noteq> x}

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
permutation p
[PROOF STEP]
have \<open>bij p\<close>
[PROOF STATE]
proof (prove)
using this:
permutation p

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

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bij p

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have \<open>UNIV = {x. p x \<noteq> x} \<union> {x. p x = x}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = {x. p x \<noteq> x} \<union> {x. p x = x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
UNIV = {x. p x \<noteq> x} \<union> {x. p x = x}

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bij_betw p ({x. p x \<noteq> x} \<union> {x. p x = x}) ({x. p x \<noteq> x} \<union> {x. p x = x})
[PROOF STEP]
have \<open>bij_betw p {x. p x \<noteq> x} {x. p x \<noteq> x}\<close>
[PROOF STATE]
proof (prove)
using this:
bij_betw p ({x. p x \<noteq> x} \<union> {x. p x = x}) ({x. p x \<noteq> x} \<union> {x. p x = x})

goal (1 subgoal):
 1. bij_betw p {x. p x \<noteq> x} {x. p x \<noteq> x}
[PROOF STEP]
by (rule bij_betw_partition) (auto simp add: bij_betw_fixpoints)
[PROOF STATE]
proof (state)
this:
bij_betw p {x. p x \<noteq> x} {x. p x \<noteq> x}

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw p {x. p x \<noteq> x} {x. p x \<noteq> x}
[PROOF STEP]
have \<open>p permutes {x. p x \<noteq> x}\<close>
[PROOF STATE]
proof (prove)
using this:
bij_betw p {x. p x \<noteq> x} {x. p x \<noteq> x}

goal (1 subgoal):
 1. p permutes {x. p x \<noteq> x}
[PROOF STEP]
by (auto intro: bij_imp_permutes)
[PROOF STATE]
proof (state)
this:
p permutes {x. p x \<noteq> x}

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with fin
[PROOF STATE]
proof (chain)
picking this:
finite {x. p x \<noteq> x}
p permutes {x. p x \<noteq> x}
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
finite {x. p x \<noteq> x}
p permutes {x. p x \<noteq> x}

goal (1 subgoal):
 1. thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed