[STATEMENT]
lemma newton_coefficients_main:
  "k < n \<Longrightarrow> newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k]))
    = rev (map (\<lambda> i. map (\<lambda> j. xij_f j i) [0..<Suc i]) [0..<Suc k])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k])
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc 0])) (rev (map x [0..<Suc 0])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc 0])
 2. \<And>k. \<lbrakk>k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]); Suc k < n\<rbrakk> \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc 0])) (rev (map x [0..<Suc 0])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc 0])
 2. \<And>k. \<lbrakk>k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]); Suc k < n\<rbrakk> \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.newton_coefficients_main (rev (map f [0..<Suc 0])) (rev (map x [0..<Suc 0])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc 0])
[PROOF STEP]
by (simp add: xij_f.simps)
[PROOF STATE]
proof (state)
this:
local.newton_coefficients_main (rev (map f [0..<Suc 0])) (rev (map x [0..<Suc 0])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc 0])

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]); Suc k < n\<rbrakk> \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]); Suc k < n\<rbrakk> \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k])
Suc k < n

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]); Suc k < n\<rbrakk> \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
hence "k < n"
[PROOF STATE]
proof (prove)
using this:
k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k])
Suc k < n

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

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]); Suc k < n\<rbrakk> \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
note IH = Suc(1)[OF this]
[PROOF STATE]
proof (state)
this:
local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k])

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]); Suc k < n\<rbrakk> \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
have id: "\<And> f. rev (map f [0..<Suc (Suc k)]) = f (Suc k) # f k # rev (map f [0..< k])"
    and id2: "\<And> f. f k # rev (map f [0..<k]) = rev (map f [0..< Suc k])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. rev (map f [0..<Suc (Suc k)]) = f (Suc k) # f k # rev (map f [0..<k])) &&& (\<And>f. f k # rev (map f [0..<k]) = rev (map f [0..<Suc k]))
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
rev (map ?f [0..<Suc (Suc k)]) = ?f (Suc k) # ?f k # rev (map ?f [0..<k])
?f k # rev (map ?f [0..<k]) = rev (map ?f [0..<Suc k])

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc k])) (rev (map x [0..<Suc k])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]); Suc k < n\<rbrakk> \<Longrightarrow> local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])
[PROOF STEP]
unfolding id newton_coefficients_main.simps Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.divided_differences_impl (hd (local.newton_coefficients_main (f k # rev (map f [0..<k])) (x k # rev (map x [0..<k])))) (f (Suc k)) (x (Suc k)) xs # local.newton_coefficients_main (f k # rev (map f [0..<k])) (x k # rev (map x [0..<k])) = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)] # map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
unfolding id2 IH
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.divided_differences_impl (hd (rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]))) (f (Suc k)) (x (Suc k)) xs # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc k]) = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)] # map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
unfolding list.simps id2[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)] \<and> map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
proof (rule conjI, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
have xs: "xs = map x [0 ..< n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = map x [0..<n]
[PROOF STEP]
using xs
[PROOF STATE]
proof (prove)
using this:
length xs = n

goal (1 subgoal):
 1. xs = map x [0..<n]
[PROOF STEP]
unfolding x_def[abs_def]
[PROOF STATE]
proof (prove)
using this:
length xs = n

goal (1 subgoal):
 1. xs = map ((!) xs) [0..<n]
[PROOF STEP]
by (intro nth_equalityI, auto)
[PROOF STATE]
proof (state)
this:
xs = map x [0..<n]

goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
define nn where "nn = (0 :: nat)"
[PROOF STATE]
proof (state)
this:
nn = 0

goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
define m where "m = Suc k - nn"
[PROOF STATE]
proof (state)
this:
m = Suc k - nn

goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
have prems: "m = Suc k - nn" "nn < Suc (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = Suc k - nn &&& nn < Suc (Suc k)
[PROOF STEP]
unfolding m_def nn_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k - 0 = Suc k - 0 &&& 0 < Suc (Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m = Suc k - nn
nn < Suc (Suc k)

goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
have "?case = (divided_differences_impl (map ((\<lambda>j. xij_f j k)) [nn..< Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn ..< n]) =
      map ((\<lambda>j. xij_f j (Suc k))) [nn..<Suc (Suc k)])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]) = (local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)])
[PROOF STEP]
unfolding nn_def xs[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]) = (local.divided_differences_impl (map (\<lambda>j. xij_f j k) [0..<Suc k]) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]) = (local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)])

goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]) = (local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)])

goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
have "\<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
using prems
[PROOF STATE]
proof (prove)
using this:
m = Suc k - nn
nn < Suc (Suc k)

goal (1 subgoal):
 1. local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
proof (induct m arbitrary: nn)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>nn. \<lbrakk>0 = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
 2. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = Suc k - nn
nn < Suc (Suc k)

goal (2 subgoals):
 1. \<And>nn. \<lbrakk>0 = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
 2. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
hence nn: "nn = Suc k"
[PROOF STATE]
proof (prove)
using this:
0 = Suc k - nn
nn < Suc (Suc k)

goal (1 subgoal):
 1. nn = Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nn = Suc k

goal (2 subgoals):
 1. \<And>nn. \<lbrakk>0 = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
 2. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
unfolding nn
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.divided_differences_impl (map (\<lambda>j. xij_f j k) [Suc k..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [Suc k..<n]) = map (\<lambda>j. xij_f j (Suc k)) [Suc k..<Suc (Suc k)]
[PROOF STEP]
by (simp add: xij_f.simps)
[PROOF STATE]
proof (state)
this:
local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]

goal (1 subgoal):
 1. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
\<lbrakk>m = Suc k - ?nn1; ?nn1 < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [?nn1..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [?nn1..<n]) = map (\<lambda>j. xij_f j (Suc k)) [?nn1..<Suc (Suc k)]
Suc m = Suc k - nn
nn < Suc (Suc k)

goal (1 subgoal):
 1. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
with \<open>Suc k < n\<close>
[PROOF STATE]
proof (chain)
picking this:
Suc k < n
\<lbrakk>m = Suc k - ?nn1; ?nn1 < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [?nn1..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [?nn1..<n]) = map (\<lambda>j. xij_f j (Suc k)) [?nn1..<Suc (Suc k)]
Suc m = Suc k - nn
nn < Suc (Suc k)
[PROOF STEP]
have "nn < n" and le: "nn < Suc k"
[PROOF STATE]
proof (prove)
using this:
Suc k < n
\<lbrakk>m = Suc k - ?nn1; ?nn1 < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [?nn1..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [?nn1..<n]) = map (\<lambda>j. xij_f j (Suc k)) [?nn1..<Suc (Suc k)]
Suc m = Suc k - nn
nn < Suc (Suc k)

goal (1 subgoal):
 1. nn < n &&& nn < Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nn < n
nn < Suc k

goal (1 subgoal):
 1. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
with Suc(2-)
[PROOF STATE]
proof (chain)
picking this:
Suc m = Suc k - nn
nn < Suc (Suc k)
nn < n
nn < Suc k
[PROOF STEP]
have id:
        "[nn..<Suc k] = nn # [Suc nn..< Suc k]"
        "[nn..<n] = nn # [Suc nn..< n]"
      and id2: "[nn..<Suc (Suc k)] = nn # [Suc nn..<Suc (Suc k)]"
        "[Suc nn..<Suc (Suc k)] = Suc nn # [Suc (Suc nn)..<Suc (Suc k)]"
[PROOF STATE]
proof (prove)
using this:
Suc m = Suc k - nn
nn < Suc (Suc k)
nn < n
nn < Suc k

goal (1 subgoal):
 1. ([nn..<Suc k] = nn # [Suc nn..<Suc k] &&& [nn..<n] = nn # [Suc nn..<n]) &&& [nn..<Suc (Suc k)] = nn # [Suc nn..<Suc (Suc k)] &&& [Suc nn..<Suc (Suc k)] = Suc nn # [Suc (Suc nn)..<Suc (Suc k)]
[PROOF STEP]
by (auto simp: upt_rec)
[PROOF STATE]
proof (state)
this:
[nn..<Suc k] = nn # [Suc nn..<Suc k]
[nn..<n] = nn # [Suc nn..<n]
[nn..<Suc (Suc k)] = nn # [Suc nn..<Suc (Suc k)]
[Suc nn..<Suc (Suc k)] = Suc nn # [Suc (Suc nn)..<Suc (Suc k)]

goal (1 subgoal):
 1. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
from Suc(2-)
[PROOF STATE]
proof (chain)
picking this:
Suc m = Suc k - nn
nn < Suc (Suc k)
[PROOF STEP]
have "m = Suc k - Suc nn" "Suc nn < Suc (Suc k)"
[PROOF STATE]
proof (prove)
using this:
Suc m = Suc k - nn
nn < Suc (Suc k)

goal (1 subgoal):
 1. m = Suc k - Suc nn &&& Suc nn < Suc (Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m = Suc k - Suc nn
Suc nn < Suc (Suc k)

goal (1 subgoal):
 1. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
note IH = Suc(1)[OF this]
[PROOF STATE]
proof (state)
this:
local.divided_differences_impl (map (\<lambda>j. xij_f j k) [Suc nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [Suc nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [Suc nn..<Suc (Suc k)]

goal (1 subgoal):
 1. \<And>m nn. \<lbrakk>\<And>nn. \<lbrakk>m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]; Suc m = Suc k - nn; nn < Suc (Suc k)\<rbrakk> \<Longrightarrow> local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
unfolding id list.simps divided_differences_impl.simps IH Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (hd (map (\<lambda>j. xij_f j (Suc k)) [Suc nn..<Suc (Suc k)]) - xij_f nn k) / (x (Suc k) - x nn) # map (\<lambda>j. xij_f j (Suc k)) [Suc nn..<Suc (Suc k)] = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]
[PROOF STEP]
unfolding id2 list.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (hd (xij_f (Suc nn) (Suc k) # map (\<lambda>j. xij_f j (Suc k)) [Suc (Suc nn)..<Suc (Suc k)]) - xij_f nn k) / (x (Suc k) - x nn) = xij_f nn (Suc k) \<and> xij_f (Suc nn) (Suc k) = xij_f (Suc nn) (Suc k) \<and> map (\<lambda>j. xij_f j (Suc k)) [Suc (Suc nn)..<Suc (Suc k)] = map (\<lambda>j. xij_f j (Suc k)) [Suc (Suc nn)..<Suc (Suc k)]
[PROOF STEP]
using le
[PROOF STATE]
proof (prove)
using this:
nn < Suc k

goal (1 subgoal):
 1. (hd (xij_f (Suc nn) (Suc k) # map (\<lambda>j. xij_f j (Suc k)) [Suc (Suc nn)..<Suc (Suc k)]) - xij_f nn k) / (x (Suc k) - x nn) = xij_f nn (Suc k) \<and> xij_f (Suc nn) (Suc k) = xij_f (Suc nn) (Suc k) \<and> map (\<lambda>j. xij_f j (Suc k)) [Suc (Suc nn)..<Suc (Suc k)] = map (\<lambda>j. xij_f j (Suc k)) [Suc (Suc nn)..<Suc (Suc k)]
[PROOF STEP]
by (simp add: xij_f.simps[of nn "Suc k"] xd_def)
[PROOF STATE]
proof (state)
this:
local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.divided_differences_impl (map (\<lambda>j. xij_f j k) [nn..<Suc k]) (f (Suc k)) (x (Suc k)) (map x [nn..<n]) = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)]

goal (2 subgoals):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
 2. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]) = (map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)] = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]) = (map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)] = map (\<lambda>j. xij_f j (Suc k)) [nn..<Suc (Suc k)])

goal (1 subgoal):
 1. local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.divided_differences_impl (hd (map (\<lambda>j. xij_f j k) [0..<Suc k] # rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]))) (f (Suc k)) (x (Suc k)) xs = map (\<lambda>j. xij_f j (Suc k)) [0..<Suc (Suc k)]

goal (1 subgoal):
 1. map (\<lambda>j. xij_f j k) [0..<Suc k] = map (\<lambda>j. xij_f j k) [0..<Suc k] \<and> rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k]) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<k])
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
local.newton_coefficients_main (rev (map f [0..<Suc (Suc k)])) (rev (map x [0..<Suc (Suc k)])) = rev (map (\<lambda>i. map (\<lambda>j. xij_f j i) [0..<Suc i]) [0..<Suc (Suc k)])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interval_lebesgue_integral_add [intro, simp]:
  fixes M a b f
  assumes "interval_lebesgue_integrable M a b f" "interval_lebesgue_integrable M a b g"
  shows "interval_lebesgue_integrable M a b (\<lambda>x. f x + g x)" and
    "interval_lebesgue_integral M a b (\<lambda>x. f x + g x) =
   interval_lebesgue_integral M a b f + interval_lebesgue_integral M a b g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integrable M a b (\<lambda>x. f x + g x) &&& LINT x=a..b|M. (f x + g x) = interval_lebesgue_integral M a b f + interval_lebesgue_integral M a b g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
interval_lebesgue_integrable M a b f
interval_lebesgue_integrable M a b g

goal (1 subgoal):
 1. interval_lebesgue_integrable M a b (\<lambda>x. f x + g x) &&& LINT x=a..b|M. (f x + g x) = interval_lebesgue_integral M a b f + interval_lebesgue_integral M a b g
[PROOF STEP]
by (auto simp: interval_lebesgue_integral_def interval_lebesgue_integrable_def
    field_simps)


[STATEMENT]
lemma fref_nest: "fref P1 R1 (fref P2 R2 S)
    \<equiv> CURRY (fref (\<lambda>(a,b). P1 a \<and> P2 b) (R1\<times>\<^sub>rR2) S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [P1]\<^sub>f R1 \<rightarrow> [P2]\<^sub>f R2 \<rightarrow> S \<equiv> CURRY ([\<lambda>(a, b). P1 a \<and> P2 b]\<^sub>f R1 \<times>\<^sub>r R2 \<rightarrow> S)
[PROOF STEP]
apply (rule eq_reflection)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [P1]\<^sub>f R1 \<rightarrow> [P2]\<^sub>f R2 \<rightarrow> S = CURRY ([\<lambda>(a, b). P1 a \<and> P2 b]\<^sub>f R1 \<times>\<^sub>r R2 \<rightarrow> S)
[PROOF STEP]
by (auto simp: fref_def CURRY_def)


[STATEMENT]
lemma has_integral_powr_from_0:
  assumes a: "a > (-1::real)" and c: "c \<ge> 0"
  shows   "((\<lambda>x. x powr a) has_integral (c powr (a+1) / (a+1))) {0..c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
proof (cases "c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> 0

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
define f where "f = (\<lambda>k x. if x \<in> {inverse (of_nat (Suc k))..c} then x powr a else 0)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>k x. if x \<in> {inverse (real (Suc k))..c} then x powr a else 0)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
define F where "F = (\<lambda>k. if inverse (of_nat (Suc k)) \<le> c then
                             c powr (a+1)/(a+1) - inverse (real (Suc k)) powr (a+1)/(a+1) else 0)"
[PROOF STATE]
proof (state)
this:
F = (\<lambda>k. if inverse (real (Suc k)) \<le> c then c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) else 0)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
F = (\<lambda>k. if inverse (real (Suc k)) \<le> c then c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) else 0)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
fix k :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
have "(f k has_integral F k) {0..c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f k has_integral F k) {0..c}
[PROOF STEP]
proof (cases "inverse (of_nat (Suc k)) \<le> c")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
inverse (real (Suc k)) \<le> c

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
inverse (real (Suc k)) \<le> c

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
assume x: "x \<ge> inverse (1 + real k)"
[PROOF STATE]
proof (state)
this:
inverse (1 + real k) \<le> x

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
have "0 < inverse (1 + real k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < inverse (1 + real k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < inverse (1 + real k)

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 < inverse (1 + real k)

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
note x
[PROOF STATE]
proof (state)
this:
inverse (1 + real k) \<le> x

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have "x > 0"
[PROOF STATE]
proof (prove)
using this:
0 < x

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

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
inverse (1 + real k) \<le> ?x2 \<Longrightarrow> 0 < ?x2

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
note x = this
[PROOF STATE]
proof (state)
this:
inverse (1 + real k) \<le> ?x2 \<Longrightarrow> 0 < ?x2

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
hence "((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) -
               inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}"
[PROOF STATE]
proof (prove)
using this:
inverse (1 + real k) \<le> ?x2 \<Longrightarrow> 0 < ?x2

goal (1 subgoal):
 1. ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}
[PROOF STEP]
using True a
[PROOF STATE]
proof (prove)
using this:
inverse (1 + real k) \<le> ?x2 \<Longrightarrow> 0 < ?x2
inverse (real (Suc k)) \<le> c
- 1 < a

goal (1 subgoal):
 1. ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}
[PROOF STEP]
by (intro fundamental_theorem_of_calculus)
           (auto intro!: derivative_eq_intros continuous_on_powr' continuous_on_const
              simp: has_real_derivative_iff_has_vector_derivative [symmetric])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}

goal (2 subgoals):
 1. inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
 2. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
inverse (real (Suc k)) \<le> c
((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inverse (real (Suc k)) \<le> c
((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}

goal (1 subgoal):
 1. (f k has_integral F k) {0..c}
[PROOF STEP]
unfolding f_def F_def
[PROOF STATE]
proof (prove)
using this:
inverse (real (Suc k)) \<le> c
((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}

goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> {inverse (real (Suc k))..c} then x powr a else 0) has_integral (if inverse (real (Suc k)) \<le> c then c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) else 0)) {0..c}
[PROOF STEP]
by (subst has_integral_restrict) simp_all
[PROOF STATE]
proof (state)
this:
(f k has_integral F k) {0..c}

goal (1 subgoal):
 1. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> inverse (real (Suc k)) \<le> c

goal (1 subgoal):
 1. \<not> inverse (real (Suc k)) \<le> c \<Longrightarrow> (f k has_integral F k) {0..c}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> inverse (real (Suc k)) \<le> c

goal (1 subgoal):
 1. (f k has_integral F k) {0..c}
[PROOF STEP]
unfolding f_def F_def
[PROOF STATE]
proof (prove)
using this:
\<not> inverse (real (Suc k)) \<le> c

goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> {inverse (real (Suc k))..c} then x powr a else 0) has_integral (if inverse (real (Suc k)) \<le> c then c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) else 0)) {0..c}
[PROOF STEP]
by (subst has_integral_restrict) auto
[PROOF STATE]
proof (state)
this:
(f k has_integral F k) {0..c}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f k has_integral F k) {0..c}

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(f ?k2 has_integral F ?k2) {0..c}

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
note has_integral_f = this
[PROOF STATE]
proof (state)
this:
(f ?k2 has_integral F ?k2) {0..c}

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
have integral_f: "integral {0..c} (f k) = F k" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..c} (f k) = F k
[PROOF STEP]
using has_integral_f[of k]
[PROOF STATE]
proof (prove)
using this:
(f k has_integral F k) {0..c}

goal (1 subgoal):
 1. integral {0..c} (f k) = F k
[PROOF STEP]
by (rule integral_unique)
[PROOF STATE]
proof (state)
this:
integral {0..c} (f ?k) = F ?k

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
have A: "(\<lambda>x. x powr a) integrable_on {0..c} \<and>
           (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x powr a) integrable_on {0..c} \<and> (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)
[PROOF STEP]
proof (intro monotone_convergence_increasing ballI allI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>k. f k integrable_on {0..c}
 2. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 3. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 4. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>k. f k integrable_on {0..c}
 2. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 3. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 4. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
from has_integral_f[of k]
[PROOF STATE]
proof (chain)
picking this:
(f k has_integral F k) {0..c}
[PROOF STEP]
show "f k integrable_on {0..c}"
[PROOF STATE]
proof (prove)
using this:
(f k has_integral F k) {0..c}

goal (1 subgoal):
 1. f k integrable_on {0..c}
[PROOF STEP]
by (auto simp: integrable_on_def)
[PROOF STATE]
proof (state)
this:
f k integrable_on {0..c}

goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
fix k :: nat and x :: real
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
assume x: "inverse (real (Suc k)) \<le> x"
[PROOF STATE]
proof (state)
this:
inverse (real (Suc k)) \<le> x

goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
have "inverse (real (Suc (Suc k))) \<le> inverse (real (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (real (Suc (Suc k))) \<le> inverse (real (Suc k))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
inverse (real (Suc (Suc k))) \<le> inverse (real (Suc k))

goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse (real (Suc (Suc k))) \<le> inverse (real (Suc k))

goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
note x
[PROOF STATE]
proof (state)
this:
inverse (real (Suc k)) \<le> x

goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
inverse (real (Suc (Suc k))) \<le> x
[PROOF STEP]
have "inverse (real (Suc (Suc k))) \<le> x"
[PROOF STATE]
proof (prove)
using this:
inverse (real (Suc (Suc k))) \<le> x

goal (1 subgoal):
 1. inverse (real (Suc (Suc k))) \<le> x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
inverse (real (Suc (Suc k))) \<le> x

goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
inverse (real (Suc k)) \<le> x \<Longrightarrow> inverse (real (Suc (Suc k))) \<le> x

goal (3 subgoals):
 1. \<And>k x. x \<in> {0..c} \<Longrightarrow> f k x \<le> f (Suc k) x
 2. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 3. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
thus "f k x \<le> f (Suc k) x"
[PROOF STATE]
proof (prove)
using this:
inverse (real (Suc k)) \<le> x \<Longrightarrow> inverse (real (Suc (Suc k))) \<le> x

goal (1 subgoal):
 1. f k x \<le> f (Suc k) x
[PROOF STEP]
by (auto simp: f_def simp del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
f k x \<le> f (Suc k) x

goal (2 subgoals):
 1. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
assume x: "x \<in> {0..c}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..c}

goal (2 subgoals):
 1. \<And>x. x \<in> {0..c} \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
show "(\<lambda>k. f k x) \<longlonglongrightarrow> x powr a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0..c}
x \<noteq> 0
[PROOF STEP]
have "x > 0"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..c}
x \<noteq> 0

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

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
from order_tendstoD(2)[OF LIMSEQ_inverse_real_of_nat this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F xa in sequentially. inverse (real (Suc xa)) < x
[PROOF STEP]
have "eventually (\<lambda>k. x powr a = f k x) sequentially"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F xa in sequentially. inverse (real (Suc xa)) < x

goal (1 subgoal):
 1. \<forall>\<^sub>F k in sequentially. x powr a = f k x
[PROOF STEP]
by eventually_elim (insert x, simp add: f_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F k in sequentially. x powr a = f k x

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F k in sequentially. x powr a = f k x

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
have "(\<lambda>_. x powr a) \<longlonglongrightarrow> x powr a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. x powr a) \<longlonglongrightarrow> x powr a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>_. x powr a) \<longlonglongrightarrow> x powr a

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F k in sequentially. x powr a = f k x
(\<lambda>_. x powr a) \<longlonglongrightarrow> x powr a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F k in sequentially. x powr a = f k x
(\<lambda>_. x powr a) \<longlonglongrightarrow> x powr a

goal (1 subgoal):
 1. (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
by (blast intro: Lim_transform_eventually)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. f k x) \<longlonglongrightarrow> x powr a

goal (1 subgoal):
 1. x = 0 \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> x powr a
[PROOF STEP]
qed (simp_all add: f_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. f k x) \<longlonglongrightarrow> x powr a

goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
- 1 < a
[PROOF STEP]
have "F k \<le> c powr (a + 1) / (a + 1)"
[PROOF STATE]
proof (prove)
using this:
- 1 < a

goal (1 subgoal):
 1. F k \<le> c powr (a + 1) / (a + 1)
[PROOF STEP]
by (auto simp add: F_def divide_simps)
[PROOF STATE]
proof (state)
this:
F k \<le> c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
F k \<le> c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
- 1 < a
[PROOF STEP]
have "F k \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
- 1 < a

goal (1 subgoal):
 1. 0 \<le> F k
[PROOF STEP]
by (auto simp: F_def divide_simps simp del: of_nat_Suc intro!: powr_mono2)
[PROOF STATE]
proof (state)
this:
0 \<le> F k

goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
hence "F k = abs (F k)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> F k

goal (1 subgoal):
 1. F k = \<bar>F k\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
F k = \<bar>F k\<bar>

goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>F k\<bar> \<le> c powr (a + 1) / (a + 1)
[PROOF STEP]
have "abs (F k) \<le>  c powr (a + 1) / (a + 1)"
[PROOF STATE]
proof (prove)
using this:
\<bar>F k\<bar> \<le> c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. \<bar>F k\<bar> \<le> c powr (a + 1) / (a + 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>F k\<bar> \<le> c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<bar>F ?k2\<bar> \<le> c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
thus "bounded (range(\<lambda>k. integral {0..c} (f k)))"
[PROOF STATE]
proof (prove)
using this:
\<bar>F ?k2\<bar> \<le> c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral {0..c} (f k)))
[PROOF STEP]
by (intro boundedI[of _ "c powr (a+1) / (a+1)"]) (auto simp: integral_f)
[PROOF STATE]
proof (state)
this:
bounded (range (\<lambda>k. integral {0..c} (f k)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x powr a) integrable_on {0..c} \<and> (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
from False c
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> 0
0 \<le> c
[PROOF STEP]
have "c > 0"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
0 \<le> c

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

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
from order_tendstoD(2)[OF LIMSEQ_inverse_real_of_nat this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in sequentially. inverse (real (Suc x)) < c
[PROOF STEP]
have "eventually (\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a+1) / (a+1) =
            integral {0..c} (f k)) sequentially"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in sequentially. inverse (real (Suc x)) < c

goal (1 subgoal):
 1. \<forall>\<^sub>F k in sequentially. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) = integral {0..c} (f k)
[PROOF STEP]
by eventually_elim (simp add: integral_f F_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F k in sequentially. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) = integral {0..c} (f k)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F k in sequentially. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) = integral {0..c} (f k)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
have "(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1))
                   \<longlonglongrightarrow> c powr (a + 1) / (a + 1) - 0 powr (a + 1) / (a + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1) - 0 powr (a + 1) / (a + 1)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
- 1 < a

goal (1 subgoal):
 1. (\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1) - 0 powr (a + 1) / (a + 1)
[PROOF STEP]
by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1) - 0 powr (a + 1) / (a + 1)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
hence "(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1))
          \<longlonglongrightarrow> c powr (a + 1) / (a + 1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1) - 0 powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. (\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F k in sequentially. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) = integral {0..c} (f k)
(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1)
[PROOF STEP]
have "(\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> c powr (a+1) / (a+1)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F k in sequentially. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1) = integral {0..c} (f k)
(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1)
[PROOF STEP]
by (blast intro: Lim_transform_eventually)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. x powr a) integrable_on {0..c} \<and> (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)
(\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1)
[PROOF STEP]
have "integral {0..c} (\<lambda>x. x powr a) = c powr (a+1) / (a+1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x powr a) integrable_on {0..c} \<and> (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)
(\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. integral {0..c} (\<lambda>x. x powr a) = c powr (a + 1) / (a + 1)
[PROOF STEP]
by (blast intro: LIMSEQ_unique)
[PROOF STATE]
proof (state)
this:
integral {0..c} (\<lambda>x. x powr a) = c powr (a + 1) / (a + 1)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. x powr a) integrable_on {0..c} \<and> (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)
integral {0..c} (\<lambda>x. x powr a) = c powr (a + 1) / (a + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x powr a) integrable_on {0..c} \<and> (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)
integral {0..c} (\<lambda>x. x powr a) = c powr (a + 1) / (a + 1)

goal (1 subgoal):
 1. ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
by (simp add: has_integral_integral)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}

goal (1 subgoal):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}
[PROOF STEP]
qed (simp_all add: has_integral_refl)


[STATEMENT]
lemma diag_jordan_block_pow: "diag_mat (jordan_block n (a :: 'a) ^\<^sub>m k) = replicate n (a ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_mat (jordan_block n a ^\<^sub>m k) = replicate n (a ^ k)
[PROOF STEP]
unfolding diag_mat_def jordan_block_pow
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a)) $$ (i, i)) [0..<dim_row (mat n n (\<lambda>(i, j). if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a)))] = replicate n (a ^ k)
[PROOF STEP]
by (intro nth_equalityI, auto)


[STATEMENT]
lemma pos_succ:
  assumes "x \<noteq> last_el"
  shows "pos (succ x) = pos x + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pos (succ x) = pos x + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pos (succ x) = pos x + 1
[PROOF STEP]
have "x \<le> last_el"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> last_el
[PROOF STEP]
by (rule last_el_greatest)
[PROOF STATE]
proof (state)
this:
x \<le> last_el

goal (1 subgoal):
 1. pos (succ x) = pos x + 1
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> last_el
x \<le> last_el
[PROOF STEP]
have "x < last_el"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> last_el
x \<le> last_el

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

goal (1 subgoal):
 1. pos (succ x) = pos x + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x < last_el
[PROOF STEP]
have "pos x < pos last_el"
[PROOF STATE]
proof (prove)
using this:
x < last_el

goal (1 subgoal):
 1. pos x < pos last_el
[PROOF STEP]
by (simp add: less_pos)
[PROOF STATE]
proof (state)
this:
pos x < pos last_el

goal (1 subgoal):
 1. pos (succ x) = pos x + 1
[PROOF STEP]
with rangeI [of pos x]
[PROOF STATE]
proof (chain)
picking this:
pos x \<in> range pos
pos x < pos last_el
[PROOF STEP]
have "pos x + 1 \<in> range pos"
[PROOF STATE]
proof (prove)
using this:
pos x \<in> range pos
pos x < pos last_el

goal (1 subgoal):
 1. pos x + 1 \<in> range pos
[PROOF STEP]
by (simp add: range_pos last_el_def pos_val)
[PROOF STATE]
proof (state)
this:
pos x + 1 \<in> range pos

goal (1 subgoal):
 1. pos (succ x) = pos x + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pos x + 1 \<in> range pos
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pos x + 1 \<in> range pos

goal (1 subgoal):
 1. pos (succ x) = pos x + 1
[PROOF STEP]
by (simp add: succ_def pos_val)
[PROOF STATE]
proof (state)
this:
pos (succ x) = pos x + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem c_cons_is_pr: "c_cons \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_cons \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_cons \<in> PrimRec2
[PROOF STEP]
have "c_cons = (\<lambda> x u. (sgn2 u)*((c_pair 0 x)+1) + (sgn1 u)*((c_pair (c_len u) (c_pair x (c_snd (u-(1::nat))))) + 1))" (is "_ = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_cons = (\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1))
[PROOF STEP]
by (simp add: c_cons_aux3)
[PROOF STATE]
proof (state)
this:
c_cons = (\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1))

goal (1 subgoal):
 1. c_cons \<in> PrimRec2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c_cons = (\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1))

goal (1 subgoal):
 1. c_cons \<in> PrimRec2
[PROOF STEP]
from c_pair_is_pr c_len_is_pr
[PROOF STATE]
proof (chain)
picking this:
c_pair \<in> PrimRec2
c_len \<in> PrimRec1
[PROOF STEP]
have "?R \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
c_pair \<in> PrimRec2
c_len \<in> PrimRec1

goal (1 subgoal):
 1. (\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1)) \<in> PrimRec2
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1)) \<in> PrimRec2

goal (1 subgoal):
 1. c_cons \<in> PrimRec2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
c_cons = (\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1))
(\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1)) \<in> PrimRec2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_cons = (\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1))
(\<lambda>x u. sgn2 u * (c_pair 0 x + 1) + sgn1 u * (c_pair (c_len u) (c_pair x (c_snd (u - 1))) + 1)) \<in> PrimRec2

goal (1 subgoal):
 1. c_cons \<in> PrimRec2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_cons \<in> PrimRec2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Right_Cosets_cardinality:
  "\<lbrakk> x \<in> G; y \<in> G \<rbrakk> \<Longrightarrow> card (H |\<cdot> x) = card (H |\<cdot> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> G; y \<in> G\<rbrakk> \<Longrightarrow> card (H |\<cdot> x) = card (H |\<cdot> y)
[PROOF STEP]
by (fast intro: bij_betw_same_card Right_Coset_bij)


[STATEMENT]
lemma finprod_reindex_bij_betw: "bij_betw h S T
  \<Longrightarrow> g \<in> h ` S \<rightarrow> carrier G
  \<Longrightarrow> finprod G (\<lambda>x. g (h x)) S = finprod G g T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij_betw h S T; g \<in> h ` S \<rightarrow> carrier G\<rbrakk> \<Longrightarrow> (\<Otimes>x\<in>S. g (h x)) = finprod G g T
[PROOF STEP]
using finprod_reindex[of g h S]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>g \<in> h ` S \<rightarrow> carrier G; inj_on h S\<rbrakk> \<Longrightarrow> finprod G g (h ` S) = (\<Otimes>x\<in>S. g (h x))

goal (1 subgoal):
 1. \<lbrakk>bij_betw h S T; g \<in> h ` S \<rightarrow> carrier G\<rbrakk> \<Longrightarrow> (\<Otimes>x\<in>S. g (h x)) = finprod G g T
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>g \<in> h ` S \<rightarrow> carrier G; inj_on h S\<rbrakk> \<Longrightarrow> finprod G g (h ` S) = (\<Otimes>x\<in>S. g (h x))

goal (1 subgoal):
 1. \<lbrakk>inj_on h S \<and> h ` S = T; g \<in> h ` S \<rightarrow> carrier G\<rbrakk> \<Longrightarrow> (\<Otimes>x\<in>S. g (h x)) = finprod G g T
[PROOF STEP]
by auto


[STATEMENT]
lemma irreducible_monic_factor: fixes p :: "'a :: field poly"
  assumes "degree p > 0"
  shows "\<exists> q r. irreducible q \<and> p = q * r \<and> monic q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q r. irreducible q \<and> p = q * r \<and> monic q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>q r. irreducible q \<and> p = q * r \<and> monic q
[PROOF STEP]
from irreducible\<^sub>d_factorization_exists[OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>fs. fs \<noteq> [] \<and> (\<forall>f\<in>set fs. irreducible\<^sub>d f \<and> degree f \<le> degree p) \<and> p = prod_list fs
\<not> irreducible\<^sub>d p \<Longrightarrow> \<exists>fs. 1 < length fs \<and> (\<forall>f\<in>set fs. irreducible\<^sub>d f \<and> degree f < degree p) \<and> p = prod_list fs
[PROOF STEP]
obtain fs where "fs \<noteq> []" and "set fs \<subseteq> Collect irreducible" and "p = prod_list fs"
[PROOF STATE]
proof (prove)
using this:
\<exists>fs. fs \<noteq> [] \<and> (\<forall>f\<in>set fs. irreducible\<^sub>d f \<and> degree f \<le> degree p) \<and> p = prod_list fs
\<not> irreducible\<^sub>d p \<Longrightarrow> \<exists>fs. 1 < length fs \<and> (\<forall>f\<in>set fs. irreducible\<^sub>d f \<and> degree f < degree p) \<and> p = prod_list fs

goal (1 subgoal):
 1. (\<And>fs. \<lbrakk>fs \<noteq> []; set fs \<subseteq> Collect irreducible; p = prod_list fs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fs \<noteq> []
set fs \<subseteq> Collect irreducible
p = prod_list fs

goal (1 subgoal):
 1. \<exists>q r. irreducible q \<and> p = q * r \<and> monic q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fs \<noteq> []
set fs \<subseteq> Collect irreducible
p = prod_list fs
[PROOF STEP]
have q: "irreducible (hd fs)" and p: "p = hd fs * prod_list (tl fs)"
[PROOF STATE]
proof (prove)
using this:
fs \<noteq> []
set fs \<subseteq> Collect irreducible
p = prod_list fs

goal (1 subgoal):
 1. irreducible (hd fs) &&& p = hd fs * prod_list (tl fs)
[PROOF STEP]
by (atomize(full), cases fs, auto)
[PROOF STATE]
proof (state)
this:
irreducible (hd fs)
p = hd fs * prod_list (tl fs)

goal (1 subgoal):
 1. \<exists>q r. irreducible q \<and> p = q * r \<and> monic q
[PROOF STEP]
define c where "c = coeff (hd fs) (degree (hd fs))"
[PROOF STATE]
proof (state)
this:
c = lead_coeff (hd fs)

goal (1 subgoal):
 1. \<exists>q r. irreducible q \<and> p = q * r \<and> monic q
[PROOF STEP]
from q
[PROOF STATE]
proof (chain)
picking this:
irreducible (hd fs)
[PROOF STEP]
have c: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
irreducible (hd fs)

goal (1 subgoal):
 1. c \<noteq> (0::'a)
[PROOF STEP]
unfolding c_def irreducible\<^sub>d_def
[PROOF STATE]
proof (prove)
using this:
irreducible (hd fs)

goal (1 subgoal):
 1. lead_coeff (hd fs) \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>q r. irreducible q \<and> p = q * r \<and> monic q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q r. irreducible q \<and> p = q * r \<and> monic q
[PROOF STEP]
by (rule exI[of _ "smult (1/c) (hd fs)"], rule exI[of _ "smult c (prod_list (tl fs))"], unfold p,
    insert q c, auto simp: c_def)
[PROOF STATE]
proof (state)
this:
\<exists>q r. irreducible q \<and> p = q * r \<and> monic q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_gt_1:
  assumes "x > (3 :: real)"
  shows   "ln x > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < ln x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < ln x
[PROOF STEP]
have "x > exp 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp 1 < x
[PROOF STEP]
using exp_le assms
[PROOF STATE]
proof (prove)
using this:
exp 1 \<le> 3
3 < x

goal (1 subgoal):
 1. exp 1 < x
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
exp 1 < x

goal (1 subgoal):
 1. 1 < ln x
[PROOF STEP]
hence "ln x > ln (exp 1)"
[PROOF STATE]
proof (prove)
using this:
exp 1 < x

goal (1 subgoal):
 1. ln (exp 1) < ln x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
exp 1 < x
3 < x

goal (1 subgoal):
 1. ln (exp 1) < ln x
[PROOF STEP]
by (subst ln_less_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln (exp 1) < ln x

goal (1 subgoal):
 1. 1 < ln x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (exp 1) < ln x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem integer_partitions_enum_correct:
  "set (map mset (integer_partitions_enum n)) = integer_partitions n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map mset (integer_partitions_enum n)) = integer_partitions n
[PROOF STEP]
proof(standard)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (map mset (integer_partitions_enum n)) \<subseteq> integer_partitions n
 2. integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
have "\<lbrakk>xs \<in> set (integer_partitions_enum_aux n n)\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset xs) = n" for xs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> \<Sum>\<^sub># (mset xs) = n
[PROOF STEP]
by (simp add: integer_partitions_enum_aux_sum sum_mset_sum_list)
[PROOF STATE]
proof (state)
this:
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> \<Sum>\<^sub># (mset ?xs) = n

goal (2 subgoals):
 1. set (map mset (integer_partitions_enum n)) \<subseteq> integer_partitions n
 2. integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> \<Sum>\<^sub># (mset ?xs) = n

goal (2 subgoals):
 1. set (map mset (integer_partitions_enum n)) \<subseteq> integer_partitions n
 2. integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
have "xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> 0 \<notin># mset xs" for xs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> 0 \<notin># mset xs
[PROOF STEP]
using integer_partitions_enum_aux_not_null
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?xs \<in> set (integer_partitions_enum_aux ?n ?m); ?x \<in> set ?xs\<rbrakk> \<Longrightarrow> ?x \<noteq> 0

goal (1 subgoal):
 1. xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> 0 \<notin># mset xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> 0 \<notin># mset ?xs

goal (2 subgoals):
 1. set (map mset (integer_partitions_enum n)) \<subseteq> integer_partitions n
 2. integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> \<Sum>\<^sub># (mset ?xs) = n
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> 0 \<notin># mset ?xs
[PROOF STEP]
show "set (map mset (integer_partitions_enum n)) \<subseteq> integer_partitions n"
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> \<Sum>\<^sub># (mset ?xs) = n
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> 0 \<notin># mset ?xs

goal (1 subgoal):
 1. set (map mset (integer_partitions_enum n)) \<subseteq> integer_partitions n
[PROOF STEP]
unfolding integer_partitions_def
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> \<Sum>\<^sub># (mset ?xs) = n
?xs \<in> set (integer_partitions_enum_aux n n) \<Longrightarrow> 0 \<notin># mset ?xs

goal (1 subgoal):
 1. set (map mset (integer_partitions_enum n)) \<subseteq> {A. \<Sum>\<^sub># A = n \<and> 0 \<notin># A}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (map mset (integer_partitions_enum n)) \<subseteq> integer_partitions n

goal (1 subgoal):
 1. integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
have "0 \<notin># A \<Longrightarrow> A \<in> mset ` set (integer_partitions_enum_aux (\<Sum>\<^sub># A) (\<Sum>\<^sub># A))" for A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin># A \<Longrightarrow> A \<in> mset ` set (integer_partitions_enum_aux (\<Sum>\<^sub># A) (\<Sum>\<^sub># A))
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin># A \<Longrightarrow> A \<in> {y. \<exists>x\<in>set (integer_partitions_enum_aux (\<Sum>\<^sub># A) (\<Sum>\<^sub># A)). y = mset x}
[PROOF STEP]
using integer_partitions_enum_correct_aux1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<notin># ?A; \<forall>x\<in>#?A. x \<le> ?m\<rbrakk> \<Longrightarrow> \<exists>xs\<in>set (integer_partitions_enum_aux (\<Sum>\<^sub># ?A) ?m). ?A = mset xs

goal (1 subgoal):
 1. 0 \<notin># A \<Longrightarrow> A \<in> {y. \<exists>x\<in>set (integer_partitions_enum_aux (\<Sum>\<^sub># A) (\<Sum>\<^sub># A)). y = mset x}
[PROOF STEP]
by (simp add: sum_mset.remove)
[PROOF STATE]
proof (state)
this:
0 \<notin># ?A \<Longrightarrow> ?A \<in> mset ` set (integer_partitions_enum_aux (\<Sum>\<^sub># ?A) (\<Sum>\<^sub># ?A))

goal (1 subgoal):
 1. integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<notin># ?A \<Longrightarrow> ?A \<in> mset ` set (integer_partitions_enum_aux (\<Sum>\<^sub># ?A) (\<Sum>\<^sub># ?A))
[PROOF STEP]
show "integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))"
[PROOF STATE]
proof (prove)
using this:
0 \<notin># ?A \<Longrightarrow> ?A \<in> mset ` set (integer_partitions_enum_aux (\<Sum>\<^sub># ?A) (\<Sum>\<^sub># ?A))

goal (1 subgoal):
 1. integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
unfolding integer_partitions_def
[PROOF STATE]
proof (prove)
using this:
0 \<notin># ?A \<Longrightarrow> ?A \<in> mset ` set (integer_partitions_enum_aux (\<Sum>\<^sub># ?A) (\<Sum>\<^sub># ?A))

goal (1 subgoal):
 1. {A. \<Sum>\<^sub># A = n \<and> 0 \<notin># A} \<subseteq> set (map mset (integer_partitions_enum n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integer_partitions n \<subseteq> set (map mset (integer_partitions_enum n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma adjoint_mat_incr:
  "adjoint (mat_incr n) = mat n n (\<lambda>(i,j). if j = 0 then (if i = n - 1 then 1 else 0) else (if j = i + 1 then 1 else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (mat_incr n) = mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)
[PROOF STEP]
apply (rule eq_matI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)); j < dim_col (mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0))\<rbrakk> \<Longrightarrow> adjoint (mat_incr n) $$ (i, j) = mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) $$ (i, j)
 2. dim_row (adjoint (mat_incr n)) = dim_row (mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0))
 3. dim_col (adjoint (mat_incr n)) = dim_col (mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0))
[PROOF STEP]
unfolding mat_incr_def
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)); j < dim_col (mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0))\<rbrakk> \<Longrightarrow> adjoint (mat n n (\<lambda>(i, j). if i = 0 then if j = n - 1 then 1 else 0 else if i = j + 1 then 1 else 0)) $$ (i, j) = mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) $$ (i, j)
 2. dim_row (adjoint (mat n n (\<lambda>(i, j). if i = 0 then if j = n - 1 then 1 else 0 else if i = j + 1 then 1 else 0))) = dim_row (mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0))
 3. dim_col (adjoint (mat n n (\<lambda>(i, j). if i = 0 then if j = n - 1 then 1 else 0 else if i = j + 1 then 1 else 0))) = dim_col (mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0))
[PROOF STEP]
by (auto simp add: adjoint_eval)


[STATEMENT]
lemma coprime_crossproduct_nat:
  fixes a b c d :: nat
  assumes "coprime a d" and "coprime b c"
  shows "a * c = b * d \<longleftrightarrow> a = b \<and> c = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * c = b * d) = (a = b \<and> c = d)
[PROOF STEP]
using assms coprime_crossproduct [of a d b c]
[PROOF STATE]
proof (prove)
using this:
coprime a d
coprime b c
\<lbrakk>coprime a d; coprime b c\<rbrakk> \<Longrightarrow> (normalize a * normalize c = normalize b * normalize d) = (normalize a = normalize b \<and> normalize c = normalize d)

goal (1 subgoal):
 1. (a * c = b * d) = (a = b \<and> c = d)
[PROOF STEP]
by simp


[STATEMENT]
lemma nat_Least_mono: "
  \<lbrakk> A \<noteq> {}; mono (f::(nat\<Rightarrow>nat)) \<rbrakk> \<Longrightarrow>
  (LEAST x. x \<in> f ` A) = f (LEAST x. x \<in> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; incseq f\<rbrakk> \<Longrightarrow> (LEAST x. x \<in> f ` A) = f (LEAST x. x \<in> A)
[PROOF STEP]
unfolding iMin_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; incseq f\<rbrakk> \<Longrightarrow> iMin (f ` A) = f (iMin A)
[PROOF STEP]
by (blast intro: iMin_mono2)


[STATEMENT]
theorem card_permutations_of_multiset:
  "card (permutations_of_multiset A) = fact (size A) div (\<Prod>x\<in>set_mset A. fact (count A x))"
  "(\<Prod>x\<in>set_mset A. fact (count A x) :: nat) dvd fact (size A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (permutations_of_multiset A) = fact (size A) div (\<Prod>x\<in>set_mset A. fact (count A x)) &&& (\<Prod>x\<in>set_mset A. fact (count A x)) dvd fact (size A)
[PROOF STEP]
by (simp_all flip: card_permutations_of_multiset_aux[of A])


[STATEMENT]
lemma polytope_imp_compact:
  fixes S :: "'a::real_normed_vector set"
  shows "polytope S \<Longrightarrow> compact S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polytope S \<Longrightarrow> compact S
[PROOF STEP]
by (metis finite_imp_compact_convex_hull polytope_def)


[STATEMENT]
lemma csqrt_2_sq:
  "complex_of_real (sqrt 2) * complex_of_real (sqrt 2) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (sqrt 2) * complex_of_real (sqrt 2) = 2
[PROOF STEP]
by (smt of_real_add of_real_hom.hom_one of_real_power one_add_one power2_eq_square real_sqrt_pow2)


[STATEMENT]
lemma triangle_num_gt_0_iff [simp]: "triangle_num n > 0 \<longleftrightarrow> n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < triangle_num n) = (0 < n)
[PROOF STEP]
using triangle_num_eq_0_iff[of n]
[PROOF STATE]
proof (prove)
using this:
(triangle_num n = 0) = (n = 0)

goal (1 subgoal):
 1. (0 < triangle_num n) = (0 < n)
[PROOF STEP]
by linarith


[STATEMENT]
lemma totient_formula1:
  assumes "n > 0"
  shows   "totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)
[PROOF STEP]
by (rule prime_factorization_nat)
[PROOF STATE]
proof (state)
this:
n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
have "totient \<dots> = (\<Prod>x\<in>prime_factors n. totient (x ^ multiplicity x n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = (\<Prod>x\<in>prime_factors n. totient (x ^ multiplicity x n))
[PROOF STEP]
proof (rule totient_prod_coprime)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pairwise coprime ((\<lambda>p. p ^ multiplicity p n) ` prime_factors n)
 2. inj_on (\<lambda>p. p ^ multiplicity p n) (prime_factors n)
[PROOF STEP]
show "pairwise coprime ((\<lambda>p. p ^ multiplicity p n) ` prime_factors n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise coprime ((\<lambda>p. p ^ multiplicity p n) ` prime_factors n)
[PROOF STEP]
proof (rule pairwiseI, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y p pa. \<lbrakk>p ^ multiplicity p n \<noteq> pa ^ multiplicity pa n; p \<in># prime_factorization n; pa \<in># prime_factorization n\<rbrakk> \<Longrightarrow> coprime (p ^ multiplicity p n) (pa ^ multiplicity pa n)
[PROOF STEP]
fix p q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y p pa. \<lbrakk>p ^ multiplicity p n \<noteq> pa ^ multiplicity pa n; p \<in># prime_factorization n; pa \<in># prime_factorization n\<rbrakk> \<Longrightarrow> coprime (p ^ multiplicity p n) (pa ^ multiplicity pa n)
[PROOF STEP]
assume *: "p \<in># prime_factorization n" "q \<in># prime_factorization n"
                     "p ^ multiplicity p n \<noteq> q ^ multiplicity q n"
[PROOF STATE]
proof (state)
this:
p \<in># prime_factorization n
q \<in># prime_factorization n
p ^ multiplicity p n \<noteq> q ^ multiplicity q n

goal (1 subgoal):
 1. \<And>x y p pa. \<lbrakk>p ^ multiplicity p n \<noteq> pa ^ multiplicity pa n; p \<in># prime_factorization n; pa \<in># prime_factorization n\<rbrakk> \<Longrightarrow> coprime (p ^ multiplicity p n) (pa ^ multiplicity pa n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in># prime_factorization n
q \<in># prime_factorization n
p ^ multiplicity p n \<noteq> q ^ multiplicity q n
[PROOF STEP]
have "multiplicity p n > 0" "multiplicity q n > 0"
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization n
q \<in># prime_factorization n
p ^ multiplicity p n \<noteq> q ^ multiplicity q n

goal (1 subgoal):
 1. 0 < multiplicity p n &&& 0 < multiplicity q n
[PROOF STEP]
by (simp_all add: prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
0 < multiplicity p n
0 < multiplicity q n

goal (1 subgoal):
 1. \<And>x y p pa. \<lbrakk>p ^ multiplicity p n \<noteq> pa ^ multiplicity pa n; p \<in># prime_factorization n; pa \<in># prime_factorization n\<rbrakk> \<Longrightarrow> coprime (p ^ multiplicity p n) (pa ^ multiplicity pa n)
[PROOF STEP]
with * primes_coprime [of p q]
[PROOF STATE]
proof (chain)
picking this:
p \<in># prime_factorization n
q \<in># prime_factorization n
p ^ multiplicity p n \<noteq> q ^ multiplicity q n
\<lbrakk>prime p; prime q; p \<noteq> q\<rbrakk> \<Longrightarrow> coprime p q
0 < multiplicity p n
0 < multiplicity q n
[PROOF STEP]
show "coprime (p ^ multiplicity p n) (q ^ multiplicity q n)"
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization n
q \<in># prime_factorization n
p ^ multiplicity p n \<noteq> q ^ multiplicity q n
\<lbrakk>prime p; prime q; p \<noteq> q\<rbrakk> \<Longrightarrow> coprime p q
0 < multiplicity p n
0 < multiplicity q n

goal (1 subgoal):
 1. coprime (p ^ multiplicity p n) (q ^ multiplicity q n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime (p ^ multiplicity p n) (q ^ multiplicity q n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pairwise coprime ((\<lambda>p. p ^ multiplicity p n) ` prime_factors n)

goal (1 subgoal):
 1. inj_on (\<lambda>p. p ^ multiplicity p n) (prime_factors n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on (\<lambda>p. p ^ multiplicity p n) (prime_factors n)
[PROOF STEP]
show "inj_on (\<lambda>p. p ^ multiplicity p n) (prime_factors n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>p. p ^ multiplicity p n) (prime_factors n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in># prime_factorization n; y \<in># prime_factorization n; x ^ multiplicity x n = y ^ multiplicity y n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix p q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in># prime_factorization n; y \<in># prime_factorization n; x ^ multiplicity x n = y ^ multiplicity y n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume pq: "p \<in># prime_factorization n" "q \<in># prime_factorization n"
                         "p ^ multiplicity p n = q ^ multiplicity q n"
[PROOF STATE]
proof (state)
this:
p \<in># prime_factorization n
q \<in># prime_factorization n
p ^ multiplicity p n = q ^ multiplicity q n

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in># prime_factorization n; y \<in># prime_factorization n; x ^ multiplicity x n = y ^ multiplicity y n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from assms and pq
[PROOF STATE]
proof (chain)
picking this:
0 < n
p \<in># prime_factorization n
q \<in># prime_factorization n
p ^ multiplicity p n = q ^ multiplicity q n
[PROOF STEP]
have "prime p" "prime q" "multiplicity p n > 0"
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in># prime_factorization n
q \<in># prime_factorization n
p ^ multiplicity p n = q ^ multiplicity q n

goal (1 subgoal):
 1. prime p &&& prime q &&& 0 < multiplicity p n
[PROOF STEP]
by (simp_all add: prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
prime p
prime q
0 < multiplicity p n

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in># prime_factorization n; y \<in># prime_factorization n; x ^ multiplicity x n = y ^ multiplicity y n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from prime_power_eq_imp_eq[OF this pq(3)]
[PROOF STATE]
proof (chain)
picking this:
p = q
[PROOF STEP]
show "p = q"
[PROOF STATE]
proof (prove)
using this:
p = q

goal (1 subgoal):
 1. p = q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
p = q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>p. p ^ multiplicity p n) (prime_factors n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
totient (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = (\<Prod>x\<in>prime_factors n. totient (x ^ multiplicity x n))

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
totient (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = (\<Prod>x\<in>prime_factors n. totient (x ^ multiplicity x n))

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>prime_factors n. totient (x ^ multiplicity x n)) = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
by (intro prod.cong refl totient_prime_power) (auto simp: prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>prime_factors n. totient (x ^ multiplicity x n)) = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
totient n = (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_neq_0':
  assumes "finite {x. f x \<noteq> 0}" and "finite {x. g x \<noteq> 0}" and "h 0 0 = 0"
  shows "finite {x. h (f x) (g x) \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x. h (f x) (g x) \<noteq> (0::'d)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite {x. f x \<noteq> (0::'b)}
finite {x. g x \<noteq> (0::'c)}
h (0::'b) (0::'c) = (0::'d)

goal (1 subgoal):
 1. finite {x. h (f x) (g x) \<noteq> (0::'d)}
[PROOF STEP]
by (rule finite_neq_0)


[STATEMENT]
lemma max_reg_list_append:
  "max_reg_list (as@bs) = max (max_reg_list as) (max_reg_list bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_reg_list (as @ bs) = max (max_reg_list as) (max_reg_list bs)
[PROOF STEP]
proof(induct bs rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. max_reg_list (as @ []) = max (max_reg_list as) (max_reg_list [])
 2. \<And>x xs. max_reg_list (as @ xs) = max (max_reg_list as) (max_reg_list xs) \<Longrightarrow> max_reg_list (as @ xs @ [x]) = max (max_reg_list as) (max_reg_list (xs @ [x]))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. max_reg_list (as @ []) = max (max_reg_list as) (max_reg_list [])
 2. \<And>x xs. max_reg_list (as @ xs) = max (max_reg_list as) (max_reg_list xs) \<Longrightarrow> max_reg_list (as @ xs @ [x]) = max (max_reg_list as) (max_reg_list (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_reg_list (as @ []) = max (max_reg_list as) (max_reg_list [])
[PROOF STEP]
by (metis append_Nil2 fold_simps(1) list.simps(8) max_reg_list_def sup_None_2 sup_max)
[PROOF STATE]
proof (state)
this:
max_reg_list (as @ []) = max (max_reg_list as) (max_reg_list [])

goal (1 subgoal):
 1. \<And>x xs. max_reg_list (as @ xs) = max (max_reg_list as) (max_reg_list xs) \<Longrightarrow> max_reg_list (as @ xs @ [x]) = max (max_reg_list as) (max_reg_list (xs @ [x]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. max_reg_list (as @ xs) = max (max_reg_list as) (max_reg_list xs) \<Longrightarrow> max_reg_list (as @ xs @ [x]) = max (max_reg_list as) (max_reg_list (xs @ [x]))
[PROOF STEP]
case (snoc x xs)
[PROOF STATE]
proof (state)
this:
max_reg_list (as @ xs) = max (max_reg_list as) (max_reg_list xs)

goal (1 subgoal):
 1. \<And>x xs. max_reg_list (as @ xs) = max (max_reg_list as) (max_reg_list xs) \<Longrightarrow> max_reg_list (as @ xs @ [x]) = max (max_reg_list as) (max_reg_list (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
max_reg_list (as @ xs) = max (max_reg_list as) (max_reg_list xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
max_reg_list (as @ xs) = max (max_reg_list as) (max_reg_list xs)

goal (1 subgoal):
 1. max_reg_list (as @ xs @ [x]) = max (max_reg_list as) (max_reg_list (xs @ [x]))
[PROOF STEP]
by (metis append_assoc max.assoc max_reg_list_append_singleton)
[PROOF STATE]
proof (state)
this:
max_reg_list (as @ xs @ [x]) = max (max_reg_list as) (max_reg_list (xs @ [x]))

goal:
No subgoals!
[PROOF STEP]
qed