[STATEMENT]
lemma sum_coprime_conv_dirichlet_prod_moebius_mu:
  fixes F S :: "nat \<Rightarrow> complex" and f :: "nat \<Rightarrow> nat \<Rightarrow> complex"
  defines "F \<equiv> (\<lambda>n. (\<Sum>k \<in> {1..n}. f k n))"
  defines "S \<equiv> (\<lambda>n. (\<Sum>k | k \<in> {1..n} \<and> coprime k n . f k n))"
  assumes "\<And>a b d. d dvd a \<Longrightarrow> d dvd b \<Longrightarrow> f (a div d) (b div d) = f a b"
  shows "S n = dirichlet_prod moebius_mu F n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
 2. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
 2. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
n = 0
S \<equiv> \<lambda>n. \<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n

goal (1 subgoal):
 1. S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
unfolding dirichlet_prod_def
[PROOF STATE]
proof (prove)
using this:
n = 0
S \<equiv> \<lambda>n. \<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n

goal (1 subgoal):
 1. S n = (\<Sum>d | d dvd n. moebius_mu d * F (n div d))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
S n = dirichlet_prod moebius_mu F n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "S(n) = (\<Sum>k | k \<in> {1..n} \<and> coprime k n . (f k n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S n = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
F \<equiv> \<lambda>n. \<Sum>k = 1..n. f k n
S \<equiv> \<lambda>n. \<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n
\<lbrakk>?d dvd ?a; ?d dvd ?b\<rbrakk> \<Longrightarrow> f (?a div ?d) (?b div ?d) = f ?a ?b

goal (1 subgoal):
 1. S n = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S n = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S n = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = (\<Sum>k \<in> {1..n}. (f k n)* dirichlet_prod_neutral (gcd k n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n) = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
using dirichlet_prod_neutral_intro
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k | k \<in> {1..?n} \<and> coprime k ?n. ?f k ?n) = (\<Sum>k = 1..?n. ?f k ?n * dirichlet_prod_neutral (gcd k ?n))

goal (1 subgoal):
 1. (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n) = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n) = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n) = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = (\<Sum>k \<in> {1..n}. (f k n)* (\<Sum>d | d dvd (gcd k n). moebius_mu d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
have "dirichlet_prod_neutral (gcd k n) = (if gcd k n = 1 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod_neutral (gcd k n) = (if gcd k n = 1 then 1::'a else (0::'a))
[PROOF STEP]
using dirichlet_prod_neutral_def[of "gcd k n"]
[PROOF STATE]
proof (prove)
using this:
dirichlet_prod_neutral (gcd k n) = (if gcd k n = 1 then 1::?'a else (0::?'a))

goal (1 subgoal):
 1. dirichlet_prod_neutral (gcd k n) = (if gcd k n = 1 then 1::'a else (0::'a))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
dirichlet_prod_neutral (gcd k n) = (if gcd k n = 1 then 1::?'a1 else (0::?'a1))

goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dirichlet_prod_neutral (gcd k n) = (if gcd k n = 1 then 1::?'a1 else (0::?'a1))

goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd gcd k n. moebius_mu d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if gcd k n = 1 then 1::'a else (0::'a)) = (\<Sum>d | d dvd gcd k n. moebius_mu d)
[PROOF STEP]
using sum_moebius_mu_divisors'[of "gcd k n"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d | d dvd gcd k n. moebius_mu d) = (if gcd k n = 1 then 1::?'a else (0::?'a))

goal (1 subgoal):
 1. (if gcd k n = 1 then 1::'a else (0::'a)) = (\<Sum>d | d dvd gcd k n. moebius_mu d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if gcd k n = 1 then 1::?'a2 else (0::?'a2)) = (\<Sum>d | d dvd gcd k n. moebius_mu d)

goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dirichlet_prod_neutral (gcd k n) = (\<Sum>d | d dvd gcd k n. moebius_mu d)
[PROOF STEP]
have "dirichlet_prod_neutral (gcd k n) = (\<Sum>d | d dvd gcd k n. moebius_mu d)"
[PROOF STATE]
proof (prove)
using this:
dirichlet_prod_neutral (gcd k n) = (\<Sum>d | d dvd gcd k n. moebius_mu d)

goal (1 subgoal):
 1. dirichlet_prod_neutral (gcd k n) = (\<Sum>d | d dvd gcd k n. moebius_mu d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dirichlet_prod_neutral (gcd k n) = (\<Sum>d | d dvd gcd k n. moebius_mu d)

goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
dirichlet_prod_neutral (gcd ?k6 n) = (\<Sum>d | d dvd gcd ?k6 n. moebius_mu d)

goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
note summand = this
[PROOF STATE]
proof (state)
this:
dirichlet_prod_neutral (gcd ?k6 n) = (\<Sum>d | d dvd gcd ?k6 n. moebius_mu d)

goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dirichlet_prod_neutral (gcd ?k6 n) = (\<Sum>d | d dvd gcd ?k6 n. moebius_mu d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dirichlet_prod_neutral (gcd ?k6 n) = (\<Sum>d | d dvd gcd ?k6 n. moebius_mu d)

goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))
[PROOF STEP]
by (simp add: summand)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = (\<Sum>k = 1..n. (\<Sum>d | d dvd gcd k n. (f k n) *  moebius_mu d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d)) = (\<Sum>k = 1..n. \<Sum>d | d dvd gcd k n. f k n * moebius_mu d)
[PROOF STEP]
by (simp add: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d)) = (\<Sum>k = 1..n. \<Sum>d | d dvd gcd k n. f k n * moebius_mu d)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. f k n * (\<Sum>d | d dvd gcd k n. moebius_mu d)) = (\<Sum>k = 1..n. \<Sum>d | d dvd gcd k n. f k n * moebius_mu d)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = (\<Sum>k = 1..n. (\<Sum>d | d dvd gcd n k. (f k n) *  moebius_mu d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>d | d dvd gcd k n. f k n * moebius_mu d) = (\<Sum>k = 1..n. \<Sum>d | d dvd gcd n k. f k n * moebius_mu d)
[PROOF STEP]
using gcd.commute[of _ n]
[PROOF STATE]
proof (prove)
using this:
gcd ?a n = gcd n ?a

goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>d | d dvd gcd k n. f k n * moebius_mu d) = (\<Sum>k = 1..n. \<Sum>d | d dvd gcd n k. f k n * moebius_mu d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>d | d dvd gcd k n. f k n * moebius_mu d) = (\<Sum>k = 1..n. \<Sum>d | d dvd gcd n k. f k n * moebius_mu d)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>d | d dvd gcd k n. f k n * moebius_mu d) = (\<Sum>k = 1..n. \<Sum>d | d dvd gcd n k. f k n * moebius_mu d)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd n. \<Sum>k | k \<in> {1..n} \<and> d dvd k. (f k n) * moebius_mu d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>d | d dvd gcd n k. f k n * moebius_mu d) = (\<Sum>d | d dvd n. \<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n * moebius_mu d)
[PROOF STEP]
using sum.swap_restrict[of "{1..n}" "{d. d dvd n}"
             "\<lambda>k d. (f k n)*moebius_mu d" "\<lambda>k d. d dvd k"] False
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {1..n}; finite {d. d dvd n}\<rbrakk> \<Longrightarrow> (\<Sum>x = 1..n. \<Sum>d\<in>{y \<in> {d. d dvd n}. y dvd x}. f x n * moebius_mu d) = (\<Sum>y\<in>{d. d dvd n}. \<Sum>x | x \<in> {1..n} \<and> y dvd x. f x n * moebius_mu y)
n \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>d | d dvd gcd n k. f k n * moebius_mu d) = (\<Sum>d | d dvd n. \<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n * moebius_mu d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>d | d dvd gcd n k. f k n * moebius_mu d) = (\<Sum>d | d dvd n. \<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n * moebius_mu d)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>d | d dvd gcd n k. f k n * moebius_mu d) = (\<Sum>d | d dvd n. \<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n * moebius_mu d)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. (f k n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. \<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n * moebius_mu d) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n))
[PROOF STEP]
by (simp add: sum_distrib_left mult.commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. \<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n * moebius_mu d) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. \<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n * moebius_mu d) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q \<in> {1..n div d}. (f q (n div d))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n)) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n)) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d)))
[PROOF STEP]
have st: "
      (\<Sum>k | k \<in> {1..n} \<and> d dvd k. (f k n)) =
        (\<Sum>q \<in> {1..n div d}. (f q (n div d)))"
      if "d dvd n" "d > 0" for d :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n) = (\<Sum>q = 1..n div d. f q (n div d))
[PROOF STEP]
by (rule sum.reindex_bij_witness[of _ "\<lambda>k. k * d" "\<lambda>k. k div d"])
         (use assms(3) that in \<open>fastforce simp: div_le_mono\<close>)+
[PROOF STATE]
proof (state)
this:
\<lbrakk>?d dvd n; 0 < ?d\<rbrakk> \<Longrightarrow> (\<Sum>k | k \<in> {1..n} \<and> ?d dvd k. f k n) = (\<Sum>q = 1..n div ?d. f q (n div ?d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n)) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n)) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d)))
[PROOF STEP]
by (intro sum.cong) (use st False in fastforce)+
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n)) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n)) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d)))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d * (\<Sum>k | k \<in> {1..n} \<and> d dvd k. f k n)) = (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d)))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd n. moebius_mu d * F(n div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d))) = (\<Sum>d | d dvd n. moebius_mu d * F (n div d))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d))) = (\<Sum>d | d dvd n. moebius_mu d * F (n div d))
[PROOF STEP]
have "F (n div d) = (\<Sum>q \<in> {1..n div d}. (f q (n div d)))"
      if "d dvd n" for d
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F (n div d) = (\<Sum>q = 1..n div d. f q (n div d))
[PROOF STEP]
by (simp add: F_def real_of_nat_div that)
[PROOF STATE]
proof (state)
this:
?d dvd n \<Longrightarrow> F (n div ?d) = (\<Sum>q = 1..n div ?d. f q (n div ?d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d))) = (\<Sum>d | d dvd n. moebius_mu d * F (n div d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?d dvd n \<Longrightarrow> F (n div ?d) = (\<Sum>q = 1..n div ?d. f q (n div ?d))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?d dvd n \<Longrightarrow> F (n div ?d) = (\<Sum>q = 1..n div ?d. f q (n div ?d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d))) = (\<Sum>d | d dvd n. moebius_mu d * F (n div d))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d))) = (\<Sum>d | d dvd n. moebius_mu d * F (n div d))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d))) = (\<Sum>d | d dvd n. moebius_mu d * F (n div d))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d * (\<Sum>q = 1..n div d. f q (n div d))) = (\<Sum>d | d dvd n. moebius_mu d * F (n div d))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
have "\<dots> = dirichlet_prod moebius_mu F n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * F (n div d)) = dirichlet_prod moebius_mu F n
[PROOF STEP]
by (simp add: dirichlet_prod_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d * F (n div d)) = dirichlet_prod moebius_mu F n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S n = dirichlet_prod moebius_mu F n

goal (1 subgoal):
 1. S n = dirichlet_prod moebius_mu F n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
S n = dirichlet_prod moebius_mu F n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_zip_with: "take n (zip_with f xs ys) = zip_with f (take n xs) (take n ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n (zip_with f xs ys) = zip_with f (take n xs) (take n ys)
[PROOF STEP]
proof (induction f xs ys arbitrary: n rule: zip_with.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>f x xs y ys n. (\<And>n. take n (zip_with f xs ys) = zip_with f (take n xs) (take n ys)) \<Longrightarrow> take n (zip_with f (x # xs) (y # ys)) = zip_with f (take n (x # xs)) (take n (y # ys))
 2. \<And>f uv_ n. take n (zip_with f [] uv_) = zip_with f (take n []) (take n uv_)
 3. \<And>f uu_ n. take n (zip_with f uu_ []) = zip_with f (take n uu_) (take n [])
[PROOF STEP]
case (1 f x xs y ys n)
[PROOF STATE]
proof (state)
this:
take ?n (zip_with f xs ys) = zip_with f (take ?n xs) (take ?n ys)

goal (3 subgoals):
 1. \<And>f x xs y ys n. (\<And>n. take n (zip_with f xs ys) = zip_with f (take n xs) (take n ys)) \<Longrightarrow> take n (zip_with f (x # xs) (y # ys)) = zip_with f (take n (x # xs)) (take n (y # ys))
 2. \<And>f uv_ n. take n (zip_with f [] uv_) = zip_with f (take n []) (take n uv_)
 3. \<And>f uu_ n. take n (zip_with f uu_ []) = zip_with f (take n uu_) (take n [])
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
take ?n (zip_with f xs ys) = zip_with f (take ?n xs) (take ?n ys)

goal (1 subgoal):
 1. take n (zip_with f (x # xs) (y # ys)) = zip_with f (take n (x # xs)) (take n (y # ys))
[PROOF STEP]
by (cases n) simp_all
[PROOF STATE]
proof (state)
this:
take n (zip_with f (x # xs) (y # ys)) = zip_with f (take n (x # xs)) (take n (y # ys))

goal (2 subgoals):
 1. \<And>f uv_ n. take n (zip_with f [] uv_) = zip_with f (take n []) (take n uv_)
 2. \<And>f uu_ n. take n (zip_with f uu_ []) = zip_with f (take n uu_) (take n [])
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma integral_smallo:
  fixes f g g' :: "real \<Rightarrow> real"
  assumes "f \<in> o(g')" and "filterlim g at_top at_top"
  assumes "\<And>a' x. a \<le> a' \<Longrightarrow> a' \<le> x \<Longrightarrow> f integrable_on {a'..x}"
  assumes deriv: "\<And>x. x \<ge> a \<Longrightarrow> (g has_field_derivative g' x) (at x)"
  assumes cont: "continuous_on {a..} g'"
  assumes nonneg: "\<And>x. x \<ge> a \<Longrightarrow> g' x \<ge> 0"
  shows   "(\<lambda>x. integral {a..x} f) \<in> o(g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. integral {a..x} f) \<in> o(g)
[PROOF STEP]
proof (rule landau_o.smallI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
fix c :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
assume c: "c > 0"
[PROOF STATE]
proof (state)
this:
0 < c

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
note [continuous_intros] = continuous_on_subset[OF cont]
[PROOF STATE]
proof (state)
this:
?t \<subseteq> {a..} \<Longrightarrow> continuous_on ?t g'

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
define c' where "c' = c / 2"
[PROOF STATE]
proof (state)
this:
c' = c / 2

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
from c
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have c': "c' > 0"
[PROOF STATE]
proof (prove)
using this:
0 < c

goal (1 subgoal):
 1. 0 < c'
[PROOF STEP]
by (simp add: c'_def)
[PROOF STATE]
proof (state)
this:
0 < c'

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
from landau_o.smallD[OF assms(1) this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. norm (f x) \<le> c' * norm (g' x)
[PROOF STEP]
obtain b where b: "\<And>x. x \<ge> b \<Longrightarrow> norm (f x) \<le> c' * norm (g' x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. norm (f x) \<le> c' * norm (g' x)

goal (1 subgoal):
 1. (\<And>b. (\<And>x. b \<le> x \<Longrightarrow> norm (f x) \<le> c' * norm (g' x)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding eventually_at_top_linorder
[PROOF STATE]
proof (prove)
using this:
\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> c' * norm (g' n)

goal (1 subgoal):
 1. (\<And>b. (\<And>x. b \<le> x \<Longrightarrow> norm (f x) \<le> c' * norm (g' x)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<le> ?x \<Longrightarrow> norm (f ?x) \<le> c' * norm (g' ?x)

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
define b' where "b' = max a b"
[PROOF STATE]
proof (state)
this:
b' = max a b

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
define D where "D = norm (integral {a..b'} f)"
[PROOF STATE]
proof (state)
this:
D = norm (integral {a..b'} f)

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "filterlim (\<lambda>x. c' * g x) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. c' * g x :> at_top
[PROOF STEP]
using c'
[PROOF STATE]
proof (prove)
using this:
0 < c'

goal (1 subgoal):
 1. LIM x at_top. c' * g x :> at_top
[PROOF STEP]
by (intro filterlim_tendsto_pos_mult_at_top[OF tendsto_const] assms)
[PROOF STATE]
proof (state)
this:
LIM x at_top. c' * g x :> at_top

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
hence "eventually (\<lambda>x. c' * g x \<ge> D - c' * g b') at_top"
[PROOF STATE]
proof (prove)
using this:
LIM x at_top. c' * g x :> at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. D - c' * g b' \<le> c' * g x
[PROOF STEP]
by (auto simp: filterlim_at_top)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. D - c' * g b' \<le> c' * g x

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
thus "eventually (\<lambda>x. norm (integral {a..x} f) \<le> c * norm (g x)) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. D - c' * g b' \<le> c' * g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
using eventually_ge_at_top[of b']
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. D - c' * g b' \<le> c' * g x
eventually ((\<le>) b') at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
D - c' * g b' \<le> c' * g x
b' \<le> x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have b': "a \<le> b'" "b \<le> b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b' &&& b \<le> b'
[PROOF STEP]
by (auto simp: b'_def)
[PROOF STATE]
proof (state)
this:
a \<le> b'
b \<le> b'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
from elim b'
[PROOF STATE]
proof (chain)
picking this:
D - c' * g b' \<le> c' * g x
b' \<le> x
a \<le> b'
b \<le> b'
[PROOF STEP]
have integrable: "(\<lambda>x. \<bar>g' x\<bar>) integrable_on {b'..x}"
[PROOF STATE]
proof (prove)
using this:
D - c' * g b' \<le> c' * g x
b' \<le> x
a \<le> b'
b \<le> b'

goal (1 subgoal):
 1. (\<lambda>x. \<bar>g' x\<bar>) integrable_on {b'..x}
[PROOF STEP]
by (intro integrable_continuous_real continuous_intros) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<bar>g' x\<bar>) integrable_on {b'..x}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "integral {a..x} f = integral {a..b'} f + integral {b'..x} f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a..x} f = integral {a..b'} f + integral {b'..x} f
[PROOF STEP]
using elim b'
[PROOF STATE]
proof (prove)
using this:
D - c' * g b' \<le> c' * g x
b' \<le> x
a \<le> b'
b \<le> b'

goal (1 subgoal):
 1. integral {a..x} f = integral {a..b'} f + integral {b'..x} f
[PROOF STEP]
by (intro Henstock_Kurzweil_Integration.integral_combine [symmetric] assms) auto
[PROOF STATE]
proof (state)
this:
integral {a..x} f = integral {a..b'} f + integral {b'..x} f

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {a..x} f = integral {a..b'} f + integral {b'..x} f

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "norm \<dots> \<le> D + norm (integral {b'..x} f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (integral {a..b'} f + integral {b'..x} f) \<le> D + norm (integral {b'..x} f)
[PROOF STEP]
unfolding D_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (integral {a..b'} f + integral {b'..x} f) \<le> norm (integral {a..b'} f) + norm (integral {b'..x} f)
[PROOF STEP]
by (rule norm_triangle_ineq)
[PROOF STATE]
proof (state)
this:
norm (integral {a..b'} f + integral {b'..x} f) \<le> D + norm (integral {b'..x} f)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (integral {a..b'} f + integral {b'..x} f) \<le> D + norm (integral {b'..x} f)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "norm (integral {b'..x} f) \<le> integral {b'..x} (\<lambda>x. c' * norm (g' x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (integral {b'..x} f) \<le> integral {b'..x} (\<lambda>x. c' * norm (g' x))
[PROOF STEP]
using b' elim assms c' integrable
[PROOF STATE]
proof (prove)
using this:
a \<le> b'
b \<le> b'
D - c' * g b' \<le> c' * g x
b' \<le> x
f \<in> o(g')
filterlim g at_top at_top
\<lbrakk>a \<le> ?a'; ?a' \<le> ?x\<rbrakk> \<Longrightarrow> f integrable_on {?a'..?x}
a \<le> ?x \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x)
continuous_on {a..} g'
a \<le> ?x \<Longrightarrow> 0 \<le> g' ?x
0 < c'
(\<lambda>x. \<bar>g' x\<bar>) integrable_on {b'..x}

goal (1 subgoal):
 1. norm (integral {b'..x} f) \<le> integral {b'..x} (\<lambda>x. c' * norm (g' x))
[PROOF STEP]
by (intro integral_norm_bound_integral b assms) auto
[PROOF STATE]
proof (state)
this:
norm (integral {b'..x} f) \<le> integral {b'..x} (\<lambda>x. c' * norm (g' x))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (integral {b'..x} f) \<le> integral {b'..x} (\<lambda>x. c' * norm (g' x))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "\<dots> = c' * integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {b'..x} (\<lambda>x. c' * norm (g' x)) = c' * integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral {b'..x} (\<lambda>x. c' * norm (g' x)) = c' * integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {b'..x} (\<lambda>x. c' * norm (g' x)) = c' * integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>) = integral {b'..x} g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>) = integral {b'..x} g'
[PROOF STEP]
using assms b'
[PROOF STATE]
proof (prove)
using this:
f \<in> o(g')
filterlim g at_top at_top
\<lbrakk>a \<le> ?a'; ?a' \<le> ?x\<rbrakk> \<Longrightarrow> f integrable_on {?a'..?x}
a \<le> ?x \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x)
continuous_on {a..} g'
a \<le> ?x \<Longrightarrow> 0 \<le> g' ?x
a \<le> b'
b \<le> b'

goal (1 subgoal):
 1. integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>) = integral {b'..x} g'
[PROOF STEP]
by (intro integral_cong) auto
[PROOF STATE]
proof (state)
this:
integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>) = integral {b'..x} g'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {b'..x} (\<lambda>x. \<bar>g' x\<bar>) = integral {b'..x} g'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "(g' has_integral (g x - g b')) {b'..x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g' has_integral g x - g b') {b'..x}
[PROOF STEP]
using b' elim
[PROOF STATE]
proof (prove)
using this:
a \<le> b'
b \<le> b'
D - c' * g b' \<le> c' * g x
b' \<le> x

goal (1 subgoal):
 1. (g' has_integral g x - g b') {b'..x}
[PROOF STEP]
by (intro fundamental_theorem_of_calculus)
         (auto simp flip: has_real_derivative_iff_has_vector_derivative
               intro!: has_field_derivative_at_within[OF deriv])
[PROOF STATE]
proof (state)
this:
(g' has_integral g x - g b') {b'..x}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
hence "integral {b'..x} g' = g x - g b'"
[PROOF STATE]
proof (prove)
using this:
(g' has_integral g x - g b') {b'..x}

goal (1 subgoal):
 1. integral {b'..x} g' = g x - g b'
[PROOF STEP]
by (simp add: has_integral_iff)
[PROOF STATE]
proof (state)
this:
integral {b'..x} g' = g x - g b'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {b'..x} g' = g x - g b'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "D + c' * (g x - g b') \<le> c * g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D + c' * (g x - g b') \<le> c * g x
[PROOF STEP]
using elim
[PROOF STATE]
proof (prove)
using this:
D - c' * g b' \<le> c' * g x
b' \<le> x

goal (1 subgoal):
 1. D + c' * (g x - g b') \<le> c * g x
[PROOF STEP]
by (simp add: field_simps c'_def)
[PROOF STATE]
proof (state)
this:
D + c' * (g x - g b') \<le> c * g x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
D + c' * (g x - g b') \<le> c * g x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
have "\<dots> \<le> c * norm (g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * g x \<le> c * norm (g x)
[PROOF STEP]
using c
[PROOF STATE]
proof (prove)
using this:
0 < c

goal (1 subgoal):
 1. c * g x \<le> c * norm (g x)
[PROOF STEP]
by (intro mult_left_mono) auto
[PROOF STATE]
proof (state)
this:
c * g x \<le> c * norm (g x)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>D - c' * g b' \<le> c' * g x; b' \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> D + x \<le> D + y) \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> D + x \<le> D + y) \<Longrightarrow> norm (integral {a..x} f) \<le> c * norm (g x)

goal (1 subgoal):
 1. norm (integral {a..x} f) \<le> c * norm (g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (integral {a..x} f) \<le> c * norm (g x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. norm (integral {a..x} f) \<le> c * norm (g x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma euclidean_size_normalize [simp]:
  "euclidean_size (normalize a) = euclidean_size a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
proof (cases "a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> euclidean_size (normalize a) = euclidean_size a
 2. a \<noteq> (0::'a) \<Longrightarrow> euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = (0::'a)

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

goal (1 subgoal):
 1. euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
euclidean_size (normalize a) = euclidean_size a

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
have "euclidean_size (normalize a) \<le> euclidean_size (normalize a * unit_factor a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euclidean_size (normalize a) \<le> euclidean_size (normalize a * unit_factor a)
[PROOF STEP]
by (rule size_mult_mono) simp
[PROOF STATE]
proof (state)
this:
euclidean_size (normalize a) \<le> euclidean_size (normalize a * unit_factor a)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
euclidean_size (normalize a) \<le> euclidean_size (normalize a * unit_factor a)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
have "euclidean_size a \<le> euclidean_size (a * (1 div unit_factor a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euclidean_size a \<le> euclidean_size (a * ((1::'a) div unit_factor a))
[PROOF STEP]
by (rule size_mult_mono) simp
[PROOF STATE]
proof (state)
this:
euclidean_size a \<le> euclidean_size (a * ((1::'a) div unit_factor a))

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
euclidean_size (normalize a) \<le> euclidean_size (normalize a * unit_factor a)
euclidean_size a \<le> euclidean_size (a * ((1::'a) div unit_factor a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
euclidean_size (normalize a) \<le> euclidean_size (normalize a * unit_factor a)
euclidean_size a \<le> euclidean_size (a * ((1::'a) div unit_factor a))

goal (1 subgoal):
 1. euclidean_size (normalize a) = euclidean_size a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
euclidean_size (normalize a) = euclidean_size a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma times_float[simp]: "x \<in> float \<Longrightarrow> y \<in> float \<Longrightarrow> x * y \<in> float"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> float; y \<in> float\<rbrakk> \<Longrightarrow> x * y \<in> float
[PROOF STEP]
apply (auto simp: float_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m ma e ea. \<lbrakk>x = real_of_int m * 2 powr real_of_int e; y = real_of_int ma * 2 powr real_of_int ea\<rbrakk> \<Longrightarrow> \<exists>mb eb. real_of_int m * 2 powr real_of_int e * (real_of_int ma * 2 powr real_of_int ea) = real_of_int mb * 2 powr real_of_int eb
[PROOF STEP]
apply hypsubst_thin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m ma e ea. \<exists>mb eb. real_of_int m * 2 powr real_of_int e * (real_of_int ma * 2 powr real_of_int ea) = real_of_int mb * 2 powr real_of_int eb
[PROOF STEP]
apply (rename_tac mx my ex ey)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>mx my ex ey. \<exists>m e. real_of_int mx * 2 powr real_of_int ex * (real_of_int my * 2 powr real_of_int ey) = real_of_int m * 2 powr real_of_int e
[PROOF STEP]
apply (rule_tac x="mx * my" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>mx my ex ey. \<exists>e. real_of_int mx * 2 powr real_of_int ex * (real_of_int my * 2 powr real_of_int ey) = real_of_int (mx * my) * 2 powr real_of_int e
[PROOF STEP]
apply (rule_tac x="ex + ey" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>mx my ex ey. real_of_int mx * 2 powr real_of_int ex * (real_of_int my * 2 powr real_of_int ey) = real_of_int (mx * my) * 2 powr real_of_int (ex + ey)
[PROOF STEP]
apply (simp add: powr_add)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma exp_lower_taylor_3_cubed:
  fixes x::real
  shows "(1 + x/3 + (1/2)*(x/3)^2 + (1/6)*(x/3)^3 + (1/24)*(x/3)^4 + (1/120)*(x/3)^5)^3 \<le> exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x
[PROOF STEP]
have "(1 + x/3 + (1/2)*(x/3)^2 + (1/6)*(x/3)^3 + (1/24)*(x/3)^4 + (1/120)*(x/3)^5) ^ 3
        \<le> exp (x/3) ^ 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp (x / 3) ^ 3
[PROOF STEP]
by (metis power_mono_odd odd_numeral exp_lower_taylor_3)
[PROOF STATE]
proof (state)
this:
(1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp (x / 3) ^ 3

goal (1 subgoal):
 1. (1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp (x / 3) ^ 3

goal (1 subgoal):
 1. (1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x
[PROOF STEP]
have "... = exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (x / 3) ^ 3 = exp x
[PROOF STEP]
by (simp add: exp_of_nat_mult [symmetric])
[PROOF STATE]
proof (state)
this:
exp (x / 3) ^ 3 = exp x

goal (1 subgoal):
 1. (1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x

goal (1 subgoal):
 1. (1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(1 + x / 3 + 1 / 2 * (x / 3)\<^sup>2 + 1 / 6 * (x / 3) ^ 3 + 1 / 24 * (x / 3) ^ 4 + 1 / 120 * (x / 3) ^ 5) ^ 3 \<le> exp x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_fst [tendsto_intros]:
  assumes "(f \<longlongrightarrow> a) F"
  shows "((\<lambda>x. fst (f x)) \<longlongrightarrow> fst a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. fst (f x)) \<longlongrightarrow> fst a) F
[PROOF STEP]
proof (rule topological_tendstoI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; fst a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. fst (f x) \<in> S
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; fst a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. fst (f x) \<in> S
[PROOF STEP]
assume "open S" and "fst a \<in> S"
[PROOF STATE]
proof (state)
this:
open S
fst a \<in> S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; fst a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. fst (f x) \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open S
fst a \<in> S
[PROOF STEP]
have "open (fst -` S)" and "a \<in> fst -` S"
[PROOF STATE]
proof (prove)
using this:
open S
fst a \<in> S

goal (1 subgoal):
 1. open (fst -` S) &&& a \<in> fst -` S
[PROOF STEP]
by (simp_all add: open_vimage_fst)
[PROOF STATE]
proof (state)
this:
open (fst -` S)
a \<in> fst -` S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; fst a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. fst (f x) \<in> S
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> a) F
open (fst -` S)
a \<in> fst -` S
[PROOF STEP]
have "eventually (\<lambda>x. f x \<in> fst -` S) F"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> a) F
open (fst -` S)
a \<in> fst -` S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<in> fst -` S
[PROOF STEP]
by (rule topological_tendstoD)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x \<in> fst -` S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; fst a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. fst (f x) \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x \<in> fst -` S
[PROOF STEP]
show "eventually (\<lambda>x. fst (f x) \<in> S) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<in> fst -` S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. fst (f x) \<in> S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. fst (f x) \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma congruence:
  assumes "b1 mod q = b2 mod q"
  shows "\<alpha> b1 n mod q = \<alpha> b2 n mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
proof (induct n rule:nat_less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
case (1 n)
[PROOF STATE]
proof (state)
this:
\<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
note hyps = \<open>\<forall>m<n. \<alpha> b1 m mod q = \<alpha> b2 m mod q\<close>
[PROOF STATE]
proof (state)
this:
\<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
have n0:"(\<alpha> b1 0) mod q = (\<alpha> b2 0) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> b1 0 mod int q = \<alpha> b2 0 mod int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<alpha> b1 0 mod int q = \<alpha> b2 0 mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
have n1:"(\<alpha> b1 1) mod q = (\<alpha> b2 1) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> b1 1 mod int q = \<alpha> b2 1 mod int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<alpha> b1 1 mod int q = \<alpha> b2 1 mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from hyps
[PROOF STATE]
proof (chain)
picking this:
\<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q
[PROOF STEP]
have s1: "n>1\<Longrightarrow>\<alpha> b1 (n-1) mod q = \<alpha> b2 (n-1) mod q"
[PROOF STATE]
proof (prove)
using this:
\<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<alpha> b1 (n - 1) mod int q = \<alpha> b2 (n - 1) mod int q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> \<alpha> b1 (n - 1) mod int q = \<alpha> b2 (n - 1) mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from hyps
[PROOF STATE]
proof (chain)
picking this:
\<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q
[PROOF STEP]
have s2: "n>1\<Longrightarrow>\<alpha> b1 (n-2) mod q = \<alpha> b2 (n-2) mod q"
[PROOF STATE]
proof (prove)
using this:
\<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<alpha> b1 (n - 2) mod int q = \<alpha> b2 (n - 2) mod int q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> \<alpha> b1 (n - 2) mod int q = \<alpha> b2 (n - 2) mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
have s3: "n>1 \<Longrightarrow> \<alpha> b1 (Suc (Suc n)) = (int b1) * (\<alpha> b1 (Suc n)) - (\<alpha> b1 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<alpha> b1 (Suc (Suc n)) = int b1 * \<alpha> b1 (Suc n) - \<alpha> b1 n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> \<alpha> b1 (Suc (Suc n)) = int b1 * \<alpha> b1 (Suc n) - \<alpha> b1 n

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from s3
[PROOF STATE]
proof (chain)
picking this:
1 < n \<Longrightarrow> \<alpha> b1 (Suc (Suc n)) = int b1 * \<alpha> b1 (Suc n) - \<alpha> b1 n
[PROOF STEP]
have s4: "n>1 \<Longrightarrow> (\<alpha> b1 n = (int b1*(\<alpha> b1 (n-1)) - \<alpha> b1 (n-2)))"
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> \<alpha> b1 (Suc (Suc n)) = int b1 * \<alpha> b1 (Suc n) - \<alpha> b1 n

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<alpha> b1 n = int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)
[PROOF STEP]
by (smt Suc_1 Suc_diff_Suc diff_Suc_1 alpha_n lessE)
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> \<alpha> b1 n = int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
have sw: "n>1 \<Longrightarrow> \<alpha> b2 (Suc (Suc n)) = (int b2) * (\<alpha> b2 (Suc n)) - (\<alpha> b2 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<alpha> b2 (Suc (Suc n)) = int b2 * \<alpha> b2 (Suc n) - \<alpha> b2 n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> \<alpha> b2 (Suc (Suc n)) = int b2 * \<alpha> b2 (Suc n) - \<alpha> b2 n

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from sw
[PROOF STATE]
proof (chain)
picking this:
1 < n \<Longrightarrow> \<alpha> b2 (Suc (Suc n)) = int b2 * \<alpha> b2 (Suc n) - \<alpha> b2 n
[PROOF STEP]
have sx: "n>1 \<Longrightarrow> (\<alpha> b2 n = (int b2*(\<alpha> b2 (n-1)) - \<alpha> b2 (n-2)))"
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> \<alpha> b2 (Suc (Suc n)) = int b2 * \<alpha> b2 (Suc n) - \<alpha> b2 n

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<alpha> b2 n = int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)
[PROOF STEP]
by (smt Suc_1 Suc_diff_Suc diff_Suc_1 alpha_n lessE)
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> \<alpha> b2 n = int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from n0 n1 s1 s2 s3 s4 assms(1) mod_mult_cong
[PROOF STATE]
proof (chain)
picking this:
\<alpha> b1 0 mod int q = \<alpha> b2 0 mod int q
\<alpha> b1 1 mod int q = \<alpha> b2 1 mod int q
1 < n \<Longrightarrow> \<alpha> b1 (n - 1) mod int q = \<alpha> b2 (n - 1) mod int q
1 < n \<Longrightarrow> \<alpha> b1 (n - 2) mod int q = \<alpha> b2 (n - 2) mod int q
1 < n \<Longrightarrow> \<alpha> b1 (Suc (Suc n)) = int b1 * \<alpha> b1 (Suc n) - \<alpha> b1 n
1 < n \<Longrightarrow> \<alpha> b1 n = int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)
b1 mod q = b2 mod q
\<lbrakk>?a mod ?c = ?a' mod ?c; ?b mod ?c = ?b' mod ?c\<rbrakk> \<Longrightarrow> ?a * ?b mod ?c = ?a' * ?b' mod ?c
[PROOF STEP]
have s5: "n>1
        \<Longrightarrow> b1*(\<alpha> b1 (n-1)) mod q =  b2*(\<alpha> b2 (n-1)) mod q "
[PROOF STATE]
proof (prove)
using this:
\<alpha> b1 0 mod int q = \<alpha> b2 0 mod int q
\<alpha> b1 1 mod int q = \<alpha> b2 1 mod int q
1 < n \<Longrightarrow> \<alpha> b1 (n - 1) mod int q = \<alpha> b2 (n - 1) mod int q
1 < n \<Longrightarrow> \<alpha> b1 (n - 2) mod int q = \<alpha> b2 (n - 2) mod int q
1 < n \<Longrightarrow> \<alpha> b1 (Suc (Suc n)) = int b1 * \<alpha> b1 (Suc n) - \<alpha> b1 n
1 < n \<Longrightarrow> \<alpha> b1 n = int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)
b1 mod q = b2 mod q
\<lbrakk>?a mod ?c = ?a' mod ?c; ?b mod ?c = ?b' mod ?c\<rbrakk> \<Longrightarrow> ?a * ?b mod ?c = ?a' * ?b' mod ?c

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> int b1 * \<alpha> b1 (n - 1) mod int q = int b2 * \<alpha> b2 (n - 1) mod int q
[PROOF STEP]
by (smt mod_mult_eq of_nat_mod)
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> int b1 * \<alpha> b1 (n - 1) mod int q = int b2 * \<alpha> b2 (n - 1) mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from hyps
[PROOF STATE]
proof (chain)
picking this:
\<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q
[PROOF STEP]
have sq: "n>1 \<Longrightarrow> \<alpha> b1 (n-2) mod q = \<alpha> b2 (n-2) mod q "
[PROOF STATE]
proof (prove)
using this:
\<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<alpha> b1 (n - 2) mod int q = \<alpha> b2 (n - 2) mod int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> \<alpha> b1 (n - 2) mod int q = \<alpha> b2 (n - 2) mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from s5 sq
[PROOF STATE]
proof (chain)
picking this:
1 < n \<Longrightarrow> int b1 * \<alpha> b1 (n - 1) mod int q = int b2 * \<alpha> b2 (n - 1) mod int q
1 < n \<Longrightarrow> \<alpha> b1 (n - 2) mod int q = \<alpha> b2 (n - 2) mod int q
[PROOF STEP]
have sd: "n>1 \<Longrightarrow>-( (\<alpha> b1 (n-2))) mod q = -((\<alpha> b2 (n-2))) mod q "
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> int b1 * \<alpha> b1 (n - 1) mod int q = int b2 * \<alpha> b2 (n - 1) mod int q
1 < n \<Longrightarrow> \<alpha> b1 (n - 2) mod int q = \<alpha> b2 (n - 2) mod int q

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> - \<alpha> b1 (n - 2) mod int q = - \<alpha> b2 (n - 2) mod int q
[PROOF STEP]
by (metis mod_minus_eq)
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> - \<alpha> b1 (n - 2) mod int q = - \<alpha> b2 (n - 2) mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from sd s5 mod_add_cong
[PROOF STATE]
proof (chain)
picking this:
1 < n \<Longrightarrow> - \<alpha> b1 (n - 2) mod int q = - \<alpha> b2 (n - 2) mod int q
1 < n \<Longrightarrow> int b1 * \<alpha> b1 (n - 1) mod int q = int b2 * \<alpha> b2 (n - 1) mod int q
\<lbrakk>?a mod ?c = ?a' mod ?c; ?b mod ?c = ?b' mod ?c\<rbrakk> \<Longrightarrow> (?a + ?b) mod ?c = (?a' + ?b') mod ?c
[PROOF STEP]
have s6: "n>1 \<Longrightarrow> ( b1*(\<alpha> b1 (n-1)) - \<alpha> b1 (n-2)) mod q
                                      =  (b2*(\<alpha> b2 (n-1)) - \<alpha> b2 (n-2)) mod q"
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> - \<alpha> b1 (n - 2) mod int q = - \<alpha> b2 (n - 2) mod int q
1 < n \<Longrightarrow> int b1 * \<alpha> b1 (n - 1) mod int q = int b2 * \<alpha> b2 (n - 1) mod int q
\<lbrakk>?a mod ?c = ?a' mod ?c; ?b mod ?c = ?b' mod ?c\<rbrakk> \<Longrightarrow> (?a + ?b) mod ?c = (?a' + ?b') mod ?c

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from s4
[PROOF STATE]
proof (chain)
picking this:
1 < n \<Longrightarrow> \<alpha> b1 n = int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)
[PROOF STEP]
have sa: "n>1 \<Longrightarrow>( b1*(\<alpha> b1 (n-1)) - \<alpha> b1 (n-2)) mod q = (\<alpha> b1 n) mod q"
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> \<alpha> b1 n = int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = \<alpha> b1 n mod int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = \<alpha> b1 n mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from sx
[PROOF STATE]
proof (chain)
picking this:
1 < n \<Longrightarrow> \<alpha> b2 n = int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)
[PROOF STEP]
have sb: "n>1 \<Longrightarrow>( b2*(\<alpha> b2 (n-1)) - \<alpha> b2 (n-2)) mod q = (\<alpha> b2 n) mod q"
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> \<alpha> b2 n = int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q = \<alpha> b2 n mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from sb sa s6 sx
[PROOF STATE]
proof (chain)
picking this:
1 < n \<Longrightarrow> (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q = \<alpha> b2 n mod int q
1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = \<alpha> b1 n mod int q
1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q
1 < n \<Longrightarrow> \<alpha> b2 n = int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)
[PROOF STEP]
have s7: "n>1 \<Longrightarrow> (\<alpha> b1 n) mod q = (b2*(\<alpha> b2 (n-1)) - \<alpha> b2 (n-2)) mod q"
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q = \<alpha> b2 n mod int q
1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = \<alpha> b1 n mod int q
1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q
1 < n \<Longrightarrow> \<alpha> b2 n = int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<alpha> b1 n mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < n \<Longrightarrow> \<alpha> b1 n mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from s7 sx s6
[PROOF STATE]
proof (chain)
picking this:
1 < n \<Longrightarrow> \<alpha> b1 n mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q
1 < n \<Longrightarrow> \<alpha> b2 n = int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)
1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q
[PROOF STEP]
have s9: "\<alpha> b1 n mod q = \<alpha> b2 n mod q"
[PROOF STATE]
proof (prove)
using this:
1 < n \<Longrightarrow> \<alpha> b1 n mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q
1 < n \<Longrightarrow> \<alpha> b2 n = int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)
1 < n \<Longrightarrow> (int b1 * \<alpha> b1 (n - 1) - \<alpha> b1 (n - 2)) mod int q = (int b2 * \<alpha> b2 (n - 1) - \<alpha> b2 (n - 2)) mod int q

goal (1 subgoal):
 1. \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
by (metis One_nat_def \<alpha>.simps(1) \<alpha>.simps(2) less_Suc0 nat_neq_iff)
[PROOF STATE]
proof (state)
this:
\<alpha> b1 n mod int q = \<alpha> b2 n mod int q

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<alpha> b1 m mod int q = \<alpha> b2 m mod int q \<Longrightarrow> \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
from s9 n0 n1
[PROOF STATE]
proof (chain)
picking this:
\<alpha> b1 n mod int q = \<alpha> b2 n mod int q
\<alpha> b1 0 mod int q = \<alpha> b2 0 mod int q
\<alpha> b1 1 mod int q = \<alpha> b2 1 mod int q
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<alpha> b1 n mod int q = \<alpha> b2 n mod int q
\<alpha> b1 0 mod int q = \<alpha> b2 0 mod int q
\<alpha> b1 1 mod int q = \<alpha> b2 1 mod int q

goal (1 subgoal):
 1. \<alpha> b1 n mod int q = \<alpha> b2 n mod int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<alpha> b1 n mod int q = \<alpha> b2 n mod int q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma locally_lipschitz_imp_lipschitz_aux:
  fixes f::"real \<Rightarrow> ('a::metric_space)"
  assumes "a \<le> b"
          "continuous_on {a..b} f"
          "\<And>x. x \<in> {a..<b} \<Longrightarrow> \<exists>y \<in> {x<..b}. dist (f y) (f x) \<le> M * (y-x)"
  shows "dist (f b) (f a) \<le> M * (b-a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
define A where "A = {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x-a)}"
[PROOF STATE]
proof (state)
this:
A = {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
have *: "A = (\<lambda>x. M * (x-a) - dist (f x) (f a))-`{0..} \<inter> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = (\<lambda>x. M * (x - a) - dist (f x) (f a)) -` {0..} \<inter> {a..b}
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)} = (\<lambda>x. M * (x - a) - dist (f x) (f a)) -` {0..} \<inter> {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = (\<lambda>x. M * (x - a) - dist (f x) (f a)) -` {0..} \<inter> {a..b}

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
have "a \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> A
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}
[PROOF STEP]
using \<open>a \<le> b\<close>
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. a \<in> {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> A

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
[PROOF STEP]
have "A \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
a \<in> A

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

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
have "bdd_above A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above A
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bdd_above A

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bdd_above A

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
have "closed A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed A
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed ((\<lambda>x. M * (x - a) - dist (f x) (f a)) -` {0..} \<inter> {a..b})
[PROOF STEP]
by (rule closed_vimage_Int, auto intro!: continuous_intros assms)
[PROOF STATE]
proof (state)
this:
closed A

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> {}
bdd_above A
closed A
[PROOF STEP]
have "Sup A \<in> A"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
bdd_above A
closed A

goal (1 subgoal):
 1. Sup A \<in> A
[PROOF STEP]
by (rule closed_contains_Sup)
[PROOF STATE]
proof (state)
this:
Sup A \<in> A

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
have "Sup A = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup A = b
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
assume "Sup A \<noteq> b"
[PROOF STATE]
proof (state)
this:
Sup A \<noteq> b

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
define x where "x = Sup A"
[PROOF STATE]
proof (state)
this:
x = Sup A

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
have I: "dist (f x) (f a) \<le> M * (x-a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f x) (f a) \<le> M * (x - a)
[PROOF STEP]
using \<open>Sup A \<in> A\<close> x_def A_def
[PROOF STATE]
proof (prove)
using this:
Sup A \<in> A
x = Sup A
A = {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}

goal (1 subgoal):
 1. dist (f x) (f a) \<le> M * (x - a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist (f x) (f a) \<le> M * (x - a)

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
have "x \<in> {a..<b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {a..<b}
[PROOF STEP]
unfolding x_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup A \<in> {a..<b}
[PROOF STEP]
using \<open>Sup A \<in> A\<close> \<open>Sup A \<noteq> b\<close> A_def
[PROOF STATE]
proof (prove)
using this:
Sup A \<in> A
Sup A \<noteq> b
A = {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}

goal (1 subgoal):
 1. Sup A \<in> {a..<b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {a..<b}

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {a..<b}
[PROOF STEP]
obtain y where J: "y \<in> {x<..b}" "dist (f y) (f x) \<le> M * (y-x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..<b}

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> {x<..b}; dist (f y) (f x) \<le> M * (y - x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..<b}
?x \<in> {a..<b} \<Longrightarrow> \<exists>y\<in>{?x<..b}. dist (f y) (f ?x) \<le> M * (y - ?x)

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> {x<..b}; dist (f y) (f x) \<le> M * (y - x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> {x<..b}
dist (f y) (f x) \<le> M * (y - x)

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
have "dist (f y) (f a) \<le> dist (f y) (f x) + dist (f x) (f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f y) (f a) \<le> dist (f y) (f x) + dist (f x) (f a)
[PROOF STEP]
by (rule dist_triangle)
[PROOF STATE]
proof (state)
this:
dist (f y) (f a) \<le> dist (f y) (f x) + dist (f x) (f a)

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist (f y) (f a) \<le> dist (f y) (f x) + dist (f x) (f a)

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
have "... \<le> M * (y-x) + M * (x-a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f y) (f x) + dist (f x) (f a) \<le> M * (y - x) + M * (x - a)
[PROOF STEP]
using I J(2)
[PROOF STATE]
proof (prove)
using this:
dist (f x) (f a) \<le> M * (x - a)
dist (f y) (f x) \<le> M * (y - x)

goal (1 subgoal):
 1. dist (f y) (f x) + dist (f x) (f a) \<le> M * (y - x) + M * (x - a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist (f y) (f x) + dist (f x) (f a) \<le> M * (y - x) + M * (x - a)

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist (f y) (f a) \<le> M * (y - x) + M * (x - a)
[PROOF STEP]
have "dist (f y) (f a) \<le> M * (y-a)"
[PROOF STATE]
proof (prove)
using this:
dist (f y) (f a) \<le> M * (y - x) + M * (x - a)

goal (1 subgoal):
 1. dist (f y) (f a) \<le> M * (y - a)
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
dist (f y) (f a) \<le> M * (y - a)

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist (f y) (f a) \<le> M * (y - a)
[PROOF STEP]
have "y \<in> A"
[PROOF STATE]
proof (prove)
using this:
dist (f y) (f a) \<le> M * (y - a)

goal (1 subgoal):
 1. y \<in> A
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
using this:
dist (f y) (f a) \<le> M * (y - a)

goal (1 subgoal):
 1. y \<in> {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}
[PROOF STEP]
using \<open>y \<in> {x<..b}\<close> \<open>x \<in> {a..<b}\<close>
[PROOF STATE]
proof (prove)
using this:
dist (f y) (f a) \<le> M * (y - a)
y \<in> {x<..b}
x \<in> {a..<b}

goal (1 subgoal):
 1. y \<in> {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> A

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> A
[PROOF STEP]
have "y \<le> Sup A"
[PROOF STATE]
proof (prove)
using this:
y \<in> A

goal (1 subgoal):
 1. y \<le> Sup A
[PROOF STEP]
by (rule cSup_upper, auto simp: A_def)
[PROOF STATE]
proof (state)
this:
y \<le> Sup A

goal (1 subgoal):
 1. Sup A \<noteq> b \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<le> Sup A
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
y \<le> Sup A

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>y \<in> {x<..b}\<close> x_def
[PROOF STATE]
proof (prove)
using this:
y \<le> Sup A
y \<in> {x<..b}
x = Sup A

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:
Sup A = b

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup A = b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sup A = b

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
using \<open>Sup A \<in> A\<close> A_def
[PROOF STATE]
proof (prove)
using this:
Sup A = b
Sup A \<in> A
A = {x \<in> {a..b}. dist (f x) (f a) \<le> M * (x - a)}

goal (1 subgoal):
 1. dist (f b) (f a) \<le> M * (b - a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist (f b) (f a) \<le> M * (b - a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_smult_right: "c \<noteq> 0 \<Longrightarrow> gcd f (smult c g) = gcd f (g :: 'b :: {field_gcd} poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> gcd f (smult c g) = gcd f g
[PROOF STEP]
using gcd_smult_left[of c g f]
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<Longrightarrow> gcd (smult c g) f = gcd g f

goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> gcd f (smult c g) = gcd f g
[PROOF STEP]
by (simp add: gcd.commute)


[STATEMENT]
lemma neg_equal_iff_equal:
  assumes x: "x \<in> carrier R" and y: "y \<in> carrier R"
  shows "\<ominus> x = \<ominus> y \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<ominus> x = \<ominus> y) = (x = y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<ominus> x = \<ominus> y \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> \<ominus> x = \<ominus> y
[PROOF STEP]
assume "\<ominus> x = \<ominus> y"
[PROOF STATE]
proof (state)
this:
\<ominus> x = \<ominus> y

goal (2 subgoals):
 1. \<ominus> x = \<ominus> y \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> \<ominus> x = \<ominus> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<ominus> x = \<ominus> y
[PROOF STEP]
have "\<ominus> (\<ominus> x) = \<ominus> (\<ominus> y)"
[PROOF STATE]
proof (prove)
using this:
\<ominus> x = \<ominus> y

goal (1 subgoal):
 1. \<ominus> (\<ominus> x) = \<ominus> (\<ominus> y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<ominus> (\<ominus> x) = \<ominus> (\<ominus> y)

goal (2 subgoals):
 1. \<ominus> x = \<ominus> y \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> \<ominus> x = \<ominus> y
[PROOF STEP]
with x y
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
\<ominus> (\<ominus> x) = \<ominus> (\<ominus> y)
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
\<ominus> (\<ominus> x) = \<ominus> (\<ominus> y)

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

goal (1 subgoal):
 1. x = y \<Longrightarrow> \<ominus> x = \<ominus> y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y \<Longrightarrow> \<ominus> x = \<ominus> y
[PROOF STEP]
assume "x = y"
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. x = y \<Longrightarrow> \<ominus> x = \<ominus> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = y
[PROOF STEP]
show "\<ominus> x = \<ominus> y"
[PROOF STATE]
proof (prove)
using this:
x = y

goal (1 subgoal):
 1. \<ominus> x = \<ominus> y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<ominus> x = \<ominus> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_on_cyclic_on_iff1:
  assumes "cyclic_on f S" "x \<in> S"
  obtains "f x \<in> S" "f x = x \<longleftrightarrow> card S = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>f x \<in> S; (f x = x) = (card S = 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lbrakk>f x \<in> S; (f x = x) = (card S = 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> f x \<in> S
 2. (\<lbrakk>f x \<in> S; (f x = x) = (card S = 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (f x = x) = (card S = 1)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
cyclic_on f S
x \<in> S
[PROOF STEP]
show "f x \<in> S"
[PROOF STATE]
proof (prove)
using this:
cyclic_on f S
x \<in> S

goal (1 subgoal):
 1. f x \<in> S
[PROOF STEP]
by (auto simp: cyclic_on_def intro: orbit.intros)
[PROOF STATE]
proof (state)
this:
f x \<in> S

goal (1 subgoal):
 1. (\<lbrakk>f x \<in> S; (f x = x) = (card S = 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (f x = x) = (card S = 1)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
cyclic_on f S
x \<in> S
[PROOF STEP]
have "S = orbit f x"
[PROOF STATE]
proof (prove)
using this:
cyclic_on f S
x \<in> S

goal (1 subgoal):
 1. S = orbit f x
[PROOF STEP]
by (auto simp: cyclic_on_alldef)
[PROOF STATE]
proof (state)
this:
S = orbit f x

goal (1 subgoal):
 1. (\<lbrakk>f x \<in> S; (f x = x) = (card S = 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (f x = x) = (card S = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = orbit f x
[PROOF STEP]
have "f x = x \<longleftrightarrow> S = {x}"
[PROOF STATE]
proof (prove)
using this:
S = orbit f x

goal (1 subgoal):
 1. (f x = x) = (S = {x})
[PROOF STEP]
by (metis orbit_eq_singleton_iff)
[PROOF STATE]
proof (state)
this:
(f x = x) = (S = {x})

goal (1 subgoal):
 1. (\<lbrakk>f x \<in> S; (f x = x) = (card S = 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (f x = x) = (card S = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f x = x) = (S = {x})
[PROOF STEP]
show "f x = x \<longleftrightarrow> card S = 1"
[PROOF STATE]
proof (prove)
using this:
(f x = x) = (S = {x})

goal (1 subgoal):
 1. (f x = x) = (card S = 1)
[PROOF STEP]
using \<open>x \<in> S\<close>
[PROOF STATE]
proof (prove)
using this:
(f x = x) = (S = {x})
x \<in> S

goal (1 subgoal):
 1. (f x = x) = (card S = 1)
[PROOF STEP]
by (auto simp: card_Suc_eq)
[PROOF STATE]
proof (state)
this:
(f x = x) = (card S = 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hd_last_sorted:
  assumes "sortedP xs" "length xs > 1"
  shows "le (hd xs) (last xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. le (hd xs) (last xs)
[PROOF STEP]
proof (cases xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> le (hd xs) (last xs)
 2. \<And>a list. xs = a # list \<Longrightarrow> le (hd xs) (last xs)
[PROOF STEP]
case (Cons y ys)
[PROOF STATE]
proof (state)
this:
xs = y # ys

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> le (hd xs) (last xs)
 2. \<And>a list. xs = a # list \<Longrightarrow> le (hd xs) (last xs)
[PROOF STEP]
note ys = this
[PROOF STATE]
proof (state)
this:
xs = y # ys

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> le (hd xs) (last xs)
 2. \<And>a list. xs = a # list \<Longrightarrow> le (hd xs) (last xs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
xs = y # ys

goal (1 subgoal):
 1. le (hd xs) (last xs)
[PROOF STEP]
using ys assms
[PROOF STATE]
proof (prove)
using this:
xs = y # ys
xs = y # ys
sortedP xs
1 < length xs

goal (1 subgoal):
 1. le (hd xs) (last xs)
[PROOF STEP]
by (auto elim!: sortedP_Cons)
[PROOF STATE]
proof (state)
this:
le (hd xs) (last xs)

goal (1 subgoal):
 1. xs = [] \<Longrightarrow> le (hd xs) (last xs)
[PROOF STEP]
qed (insert assms, simp)


[STATEMENT]
lemma epred_llcp:
  "\<lbrakk> \<not> lnull xs; \<not> lnull ys; lhd xs = lhd ys \<rbrakk>
  \<Longrightarrow>  epred (llcp xs ys) = llcp (ltl xs) (ltl ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> lnull xs; \<not> lnull ys; lhd xs = lhd ys\<rbrakk> \<Longrightarrow> epred (llcp xs ys) = llcp (ltl xs) (ltl ys)
[PROOF STEP]
by(simp add: llcp_def)


[STATEMENT]
lemma homeomorphic_empty_space_eq:
  assumes "topspace X = {}"
    shows "X homeomorphic_space Y \<longleftrightarrow> topspace Y = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X homeomorphic_space Y) = (topspace Y = {})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (X homeomorphic_space Y) = (topspace Y = {})
[PROOF STEP]
have "\<forall>f t. continuous_map X (t::'b topology) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f t. continuous_map X t f
[PROOF STEP]
using assms continuous_map_on_empty
[PROOF STATE]
proof (prove)
using this:
topspace X = {}
topspace ?X = {} \<Longrightarrow> continuous_map ?X ?Y ?f

goal (1 subgoal):
 1. \<forall>f t. continuous_map X t f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>f t. continuous_map X t f

goal (1 subgoal):
 1. (X homeomorphic_space Y) = (topspace Y = {})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>f t. continuous_map X t f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>f t. continuous_map X t f

goal (1 subgoal):
 1. (X homeomorphic_space Y) = (topspace Y = {})
[PROOF STEP]
by (metis (no_types) assms continuous_map_on_empty empty_iff homeomorphic_empty_space homeomorphic_maps_def homeomorphic_space_def)
[PROOF STATE]
proof (state)
this:
(X homeomorphic_space Y) = (topspace Y = {})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_factors_characterization_int:
  "S = {p. 0 < f (p::int)} \<Longrightarrow> finite S \<Longrightarrow>
    \<forall>p\<in>S. prime p \<Longrightarrow> abs n = (\<Prod>p\<in>S. p ^ f p) \<Longrightarrow> prime_factors n = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S = {p. 0 < f p}; finite S; \<forall>p\<in>S. prime p; \<bar>n\<bar> = (\<Prod>p\<in>S. p ^ f p)\<rbrakk> \<Longrightarrow> prime_factors n = S
[PROOF STEP]
by (rule prime_factorization_unique_int [THEN conjunct1, symmetric])


[STATEMENT]
lemma suminf_le_const: "summable f \<Longrightarrow> (\<And>n. sum f {..<n} \<le> x) \<Longrightarrow> suminf f \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>n. sum f {..<n} \<le> x\<rbrakk> \<Longrightarrow> suminf f \<le> x
[PROOF STEP]
by (metis LIMSEQ_le_const2 summable_LIMSEQ)


[STATEMENT]
lemma Borsukian_separation_compact:
  fixes S :: "complex set"
  assumes "compact S"
    shows "Borsukian S \<longleftrightarrow> connected(- S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Borsukian S = connected (- S)
[PROOF STEP]
by (simp add: Borsuk_separation_theorem Borsukian_circle assms)


[STATEMENT]
lemma aasc_seqn1:"\<lbrakk>a \<in> A; \<not> (\<exists>m. m\<in>A \<and> (\<forall>x\<in>A. x \<le> m))\<rbrakk> \<Longrightarrow>
                        (aasc_seq A a n) + 1 \<le> (aasc_seq A a (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. x \<le> m)\<rbrakk> \<Longrightarrow> aasc_seq A a n + 1 \<le> aasc_seq A a (Suc n)
[PROOF STEP]
by (frule aasc_seqn [of "a" "A" "n"], assumption+, simp)


[STATEMENT]
lemma ternary_ternary_eval_DeMorgan: "ternary_ternary_eval (TernaryNot (TernaryAnd a b)) =
    ternary_ternary_eval (TernaryOr (TernaryNot a) (TernaryNot b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ternary_ternary_eval (TernaryNot (TernaryAnd a b)) = ternary_ternary_eval (TernaryOr (TernaryNot a) (TernaryNot b))
[PROOF STEP]
by (simp add: eval_ternary_DeMorgan)


[STATEMENT]
theorem Euclid_book9_prop36:
  assumes p: "prime (2^(n+1) - (1::nat))"
  shows "perfect (2 ^ n * (2 ^ (n + 1) - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perfect (2 ^ n * (2 ^ (n + 1) - 1))
[PROOF STEP]
unfolding perfect_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 2 ^ n * (2 ^ (n + 1) - 1) \<and> 2 * (2 ^ n * (2 ^ (n + 1) - 1)) = sigma (2 ^ n * (2 ^ (n + 1) - 1))
[PROOF STEP]
proof (intro conjI; simp)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc 0 < 2 * 2 ^ n
 2. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime (2 ^ (n + 1) - 1)
[PROOF STEP]
show "2 * 2^n > Suc 0"
[PROOF STATE]
proof (prove)
using this:
prime (2 ^ (n + 1) - 1)

goal (1 subgoal):
 1. Suc 0 < 2 * 2 ^ n
[PROOF STEP]
by (auto simp add: prime_nat_iff)
[PROOF STATE]
proof (state)
this:
Suc 0 < 2 * 2 ^ n

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
have "2 \<noteq> ((2::nat)^(n+1) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<noteq> 2 ^ (n + 1) - 1
[PROOF STEP]
by simp arith
[PROOF STATE]
proof (state)
this:
2 \<noteq> 2 ^ (n + 1) - 1

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 \<noteq> 2 ^ (n + 1) - 1
[PROOF STEP]
have "coprime (2::nat) (2^(n+1) - 1)"
[PROOF STATE]
proof (prove)
using this:
2 \<noteq> 2 ^ (n + 1) - 1

goal (1 subgoal):
 1. coprime 2 (2 ^ (n + 1) - 1)
[PROOF STEP]
by (metis p primes_coprime_nat two_is_prime_nat)
[PROOF STATE]
proof (state)
this:
coprime 2 (2 ^ (n + 1) - 1)

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
coprime 2 (2 ^ (n + 1) - 1)

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
prime (2 ^ (n + 1) - 1)
coprime 2 (2 ^ (n + 1) - 1)
[PROOF STEP]
have "2^(n+1) - 1 > (0::nat)"
[PROOF STATE]
proof (prove)
using this:
prime (2 ^ (n + 1) - 1)
coprime 2 (2 ^ (n + 1) - 1)

goal (1 subgoal):
 1. 0 < 2 ^ (n + 1) - 1
[PROOF STEP]
by (auto simp add: prime_nat_iff)
[PROOF STATE]
proof (state)
this:
0 < 2 ^ (n + 1) - 1

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
coprime 2 (2 ^ (n + 1) - 1)
0 < 2 ^ (n + 1) - 1
[PROOF STEP]
have  "sigma (2^n*(2^(n+1) - 1)) = (sigma(2^n))*(sigma(2^(n+1) - 1))"
[PROOF STATE]
proof (prove)
using this:
coprime 2 (2 ^ (n + 1) - 1)
0 < 2 ^ (n + 1) - 1

goal (1 subgoal):
 1. sigma (2 ^ n * (2 ^ (n + 1) - 1)) = sigma (2 ^ n) * sigma (2 ^ (n + 1) - 1)
[PROOF STEP]
by (metis sigma_semimultiplicative two_is_prime_nat)
[PROOF STATE]
proof (state)
this:
sigma (2 ^ n * (2 ^ (n + 1) - 1)) = sigma (2 ^ n) * sigma (2 ^ (n + 1) - 1)

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sigma (2 ^ n * (2 ^ (n + 1) - 1)) = sigma (2 ^ n) * sigma (2 ^ (n + 1) - 1)

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime (2 ^ (n + 1) - 1)
[PROOF STEP]
have "... = (sigma(2^(n)))*(2^(n+1))"
[PROOF STATE]
proof (prove)
using this:
prime (2 ^ (n + 1) - 1)

goal (1 subgoal):
 1. sigma (2 ^ n) * sigma (2 ^ (n + 1) - 1) = sigma (2 ^ n) * 2 ^ (n + 1)
[PROOF STEP]
by (auto simp add: prime_imp_sigma)
[PROOF STATE]
proof (state)
this:
sigma (2 ^ n) * sigma (2 ^ (n + 1) - 1) = sigma (2 ^ n) * 2 ^ (n + 1)

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sigma (2 ^ n) * sigma (2 ^ (n + 1) - 1) = sigma (2 ^ n) * 2 ^ (n + 1)

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
have "... = (2^(n+1) - 1)*(2^(n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma (2 ^ n) * 2 ^ (n + 1) = (2 ^ (n + 1) - 1) * 2 ^ (n + 1)
[PROOF STEP]
by(simp add: sigma_prime_power_two)
[PROOF STATE]
proof (state)
this:
sigma (2 ^ n) * 2 ^ (n + 1) = (2 ^ (n + 1) - 1) * 2 ^ (n + 1)

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sigma (2 ^ n * (2 ^ (n + 1) - 1)) = (2 ^ (n + 1) - 1) * 2 ^ (n + 1)
[PROOF STEP]
show "2*(2^n * (2*2^n - Suc 0)) = sigma(2^n*(2*2^n - Suc 0))"
[PROOF STATE]
proof (prove)
using this:
sigma (2 ^ n * (2 ^ (n + 1) - 1)) = (2 ^ (n + 1) - 1) * 2 ^ (n + 1)

goal (1 subgoal):
 1. 2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * (2 ^ n * (2 * 2 ^ n - Suc 0)) = sigma (2 ^ n * (2 * 2 ^ n - Suc 0))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fincomp_Union_disjoint:
  "\<lbrakk>finite C; \<And>A. A \<in> C \<Longrightarrow> finite A \<and> (\<forall>x\<in>A. f x \<in> M); pairwise disjnt C\<rbrakk> \<Longrightarrow>
    fincomp f (\<Union>C) = fincomp (fincomp f) C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite C; \<And>A. A \<in> C \<Longrightarrow> finite A \<and> (\<forall>x\<in>A. f x \<in> M); pairwise disjnt C\<rbrakk> \<Longrightarrow> fincomp f (\<Union> C) = fincomp (fincomp f) C
[PROOF STEP]
by (frule fincomp_UN_disjoint [of C id f]) auto


[STATEMENT]
lemma atomize_plus: "atomize_poly (p + q) = atomize_poly p + atomize_poly q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atomize_poly (p + q) = atomize_poly p + atomize_poly q
[PROOF STEP]
by (rule poly_mapping_eqI, simp add: lookup_atomize_poly lookup_add)


[STATEMENT]
lemma pullback_by_permutation_of_poly_list':
  assumes "\<sigma> permutes {..< n}"
  assumes "S \<subseteq> carrier (R\<^bsup>n\<^esup>)"
  shows "poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) =
          permute_list \<sigma> ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) = permute_list \<sigma> ` S
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) = permute_list \<sigma> ` S
[PROOF STEP]
have 0: "(fun_inv (fun_inv \<sigma>)) = \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fun_inv (fun_inv \<sigma>) = \<sigma>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<n}
S \<subseteq> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. fun_inv (fun_inv \<sigma>) = \<sigma>
[PROOF STEP]
unfolding fun_inv_def
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<n}
S \<subseteq> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. inv (inv \<sigma>) = \<sigma>
[PROOF STEP]
using permutes_inv_inv
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<n}
S \<subseteq> carrier (R\<^bsup>n\<^esup>)
?p permutes ?S \<Longrightarrow> inv (inv ?p) = ?p

goal (1 subgoal):
 1. inv (inv \<sigma>) = \<sigma>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
fun_inv (fun_inv \<sigma>) = \<sigma>

goal (1 subgoal):
 1. poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) = permute_list \<sigma> ` S
[PROOF STEP]
have 1: "fun_inv \<sigma> permutes {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fun_inv \<sigma> permutes {..<n}
[PROOF STEP]
unfolding fun_inv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv \<sigma> permutes {..<n}
[PROOF STEP]
using assms permutes_inv
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<n}
S \<subseteq> carrier (R\<^bsup>n\<^esup>)
?p permutes ?S \<Longrightarrow> inv ?p permutes ?S

goal (1 subgoal):
 1. inv \<sigma> permutes {..<n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
fun_inv \<sigma> permutes {..<n}

goal (1 subgoal):
 1. poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) = permute_list \<sigma> ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fun_inv \<sigma> permutes {..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fun_inv \<sigma> permutes {..<n}

goal (1 subgoal):
 1. poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) = permute_list \<sigma> ` S
[PROOF STEP]
using 0 assms pullback_by_permutation_of_poly_list[of "fun_inv \<sigma>" n S]
[PROOF STATE]
proof (prove)
using this:
fun_inv \<sigma> permutes {..<n}
fun_inv (fun_inv \<sigma>) = \<sigma>
\<sigma> permutes {..<n}
S \<subseteq> carrier (R\<^bsup>n\<^esup>)
\<lbrakk>fun_inv \<sigma> permutes {..<n}; S \<subseteq> carrier (R\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) = permute_list (fun_inv (fun_inv \<sigma>)) ` S

goal (1 subgoal):
 1. poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) = permute_list \<sigma> ` S
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
poly_tuple_pullback n S (permute_list (fun_inv \<sigma>) (pvar_list R n)) = permute_list \<sigma> ` S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_half_open_segment:
  fixes a b::real
  shows "closure {a --< b} = (if a = b then {} else {a -- b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure {a--<b} = (if a = b then {} else {a--b})
[PROOF STEP]
unfolding closed_segment_eq_real_ivl if_distrib half_open_segment_real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. if a = b then (if a \<le> b then (=) (closure {a..<b}) else (=) (closure {b<..a})) ((if a = b then If (a \<le> b) {} else If (a \<le> b) {a..b}) {}) else (if a \<le> b then (=) (closure {a..<b}) else (=) (closure {b<..a})) ((if a = b then If (a \<le> b) {} else If (a \<le> b) {a..b}) {b..a})
[PROOF STEP]
unfolding if_distribR
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. if a = b then if a \<le> b then closure {a..<b} = (if a = b then if a \<le> b then {} else {} else if a \<le> b then {a..b} else {}) else closure {b<..a} = (if a = b then if a \<le> b then {} else {} else if a \<le> b then {a..b} else {}) else if a \<le> b then closure {a..<b} = (if a = b then if a \<le> b then {} else {b..a} else if a \<le> b then {a..b} else {b..a}) else closure {b<..a} = (if a = b then if a \<le> b then {} else {b..a} else if a \<le> b then {a..b} else {b..a})
[PROOF STEP]
by simp


[STATEMENT]
lemma mono_if: "\<lbrakk>mono S1; mono S2\<rbrakk> \<Longrightarrow>
  mono (\<lambda>F s. if b s then S1 F s else S2 F s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono S1; mono S2\<rbrakk> \<Longrightarrow> mono (\<lambda>F s. if b s then S1 F s else S2 F s)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>mono S1; mono S2; x \<le> y\<rbrakk> \<Longrightarrow> (\<lambda>s. if b s then S1 x s else S2 x s) \<le> (\<lambda>s. if b s then S1 y s else S2 y s)
[PROOF STEP]
apply (rule le_funI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa. \<lbrakk>mono S1; mono S2; x \<le> y\<rbrakk> \<Longrightarrow> (if b xa then S1 x xa else S2 x xa) \<le> (if b xa then S1 y xa else S2 y xa)
[PROOF STEP]
apply (auto dest: monoD[THEN le_funD])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ff_2: assumes dx: "dim_vec x = 2"
  and be: "x $ 0 = False \<and> x $ 1 = False"
  shows "ceros_of_boolean_input x = {0,1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input x = {0, 1}
[PROOF STEP]
using dx be
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 2
x $ 0 = False \<and> x $ 1 = False

goal (1 subgoal):
 1. ceros_of_boolean_input x = {0, 1}
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 2
x $ 0 = False \<and> x $ 1 = False

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {0, 1}
[PROOF STEP]
using less_2_cases
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 2
x $ 0 = False \<and> x $ 1 = False
?n < 2 \<Longrightarrow> ?n = 0 \<or> ?n = Suc 0

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {0, 1}
[PROOF STEP]
by auto


[STATEMENT]
lemma LIM_compose2:
  fixes a :: "'a::real_normed_vector"
  assumes f: "f \<midarrow>a\<rightarrow> b"
    and g: "g \<midarrow>b\<rightarrow> c"
    and inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < d \<longrightarrow> f x \<noteq> b"
  shows "(\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c
[PROOF STEP]
by (rule metric_LIM_compose2 [OF f g inj [folded dist_norm]])


[STATEMENT]
lemma istopology_base_alt:
   "istopology (arbitrary union_of P) \<longleftrightarrow>
    (\<forall>S T. (arbitrary union_of P) S \<and> (arbitrary union_of P) T
           \<longrightarrow> (arbitrary union_of P) (S \<inter> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. istopology (arbitrary union_of P) = (\<forall>S T. (arbitrary union_of P) S \<and> (arbitrary union_of P) T \<longrightarrow> (arbitrary union_of P) (S \<inter> T))
[PROOF STEP]
by (simp add: istopology_def) (blast intro: arbitrary_union_of_Union)


[STATEMENT]
lemma minVertex_zero1: "minVertex (Face [0..<Suc z] Final) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. minVertex (Face [0..<Suc z] Final) = 0
[PROOF STEP]
apply (induct z)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. minVertex (Face [0..<Suc 0] Final) = 0
 2. \<And>z. minVertex (Face [0..<Suc z] Final) = 0 \<Longrightarrow> minVertex (Face [0..<Suc (Suc z)] Final) = 0
[PROOF STEP]
apply (simp add: minVertex_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. minVertex (Face [0..<Suc z] Final) = 0 \<Longrightarrow> minVertex (Face [0..<Suc (Suc z)] Final) = 0
[PROOF STEP]
by (simp add: minVertex_def upt_conv_Cons del: upt_Suc)