[STATEMENT]
lemma root_newton_int_main_upper:
  shows "y ^ p \<ge> n \<Longrightarrow> y \<ge> 0 \<Longrightarrow> n \<ge> 0 \<Longrightarrow> root_newton_int_main y n = (x,b) \<Longrightarrow> n < (x + 1) ^ p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> y ^ p; 0 \<le> y; 0 \<le> n; root_newton_int_main y n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
proof (induct y n rule: root_newton_int_main.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
case (1 y n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> (y < 0 \<or> n < 0); \<not> y ^ p \<le> n; n \<le> ((n div y ^ pm + y * int pm) div int p) ^ p; 0 \<le> (n div y ^ pm + y * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div y ^ pm + y * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
n \<le> y ^ p
0 \<le> y
0 \<le> n
root_newton_int_main y n = (x, b)

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from 1(3)
[PROOF STATE]
proof (chain)
picking this:
0 \<le> y
[PROOF STEP]
have y0: "y \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> y

goal (1 subgoal):
 1. 0 \<le> y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
0 \<le> y

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> y
[PROOF STEP]
have "y > 0 \<or> y = 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> y

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

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from 1(4)
[PROOF STATE]
proof (chain)
picking this:
0 \<le> n
[PROOF STEP]
have n0: "n \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> n

goal (1 subgoal):
 1. 0 \<le> n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
0 \<le> n

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
define y' where "y' = (n div (y ^ pm) + y * int pm) div (int p)"
[PROOF STATE]
proof (state)
this:
y' = (n div y ^ pm + y * int pm) div int p

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from \<open>y > 0 \<or> y = 0\<close> \<open>n \<ge> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < y \<or> y = 0
0 \<le> n
[PROOF STEP]
have y'0: "y' \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 < y \<or> y = 0
0 \<le> n

goal (1 subgoal):
 1. 0 \<le> y'
[PROOF STEP]
by (auto simp add: y'_def p algebra_simps pos_imp_zdiv_nonneg_iff power_0_left)
[PROOF STATE]
proof (state)
this:
0 \<le> y'

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
let ?rt = "root_newton_int_main"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from 1(5)
[PROOF STATE]
proof (chain)
picking this:
root_newton_int_main y n = (x, b)
[PROOF STEP]
have rt: "?rt y n = (x,b)"
[PROOF STATE]
proof (prove)
using this:
root_newton_int_main y n = (x, b)

goal (1 subgoal):
 1. root_newton_int_main y n = (x, b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
root_newton_int_main y n = (x, b)

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from y0 n0
[PROOF STATE]
proof (chain)
picking this:
0 \<le> y
0 \<le> n
[PROOF STEP]
have not: "\<not> (y < 0 \<or> n < 0)" "(y < 0 \<or> n < 0) = False"
[PROOF STATE]
proof (prove)
using this:
0 \<le> y
0 \<le> n

goal (1 subgoal):
 1. \<not> (y < 0 \<or> n < 0) &&& (y < 0 \<or> n < 0) = False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> (y < 0 \<or> n < 0)
(y < 0 \<or> n < 0) = False

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
note rt = rt[unfolded root_newton_int_main.simps[of y n] not(2) if_False, folded y'_def]
[PROOF STATE]
proof (state)
this:
(if y ^ p \<le> n then (y, y ^ p = n) else root_newton_int_main y' n) = (x, b)

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
note IH = 1(1)[folded y'_def, OF not(1) _ _ y'0 n0]
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> y ^ p \<le> n; n \<le> y' ^ p; root_newton_int_main y' n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p

goal (1 subgoal):
 1. \<And>xa n. \<lbrakk>\<lbrakk>\<not> (xa < 0 \<or> n < 0); \<not> xa ^ p \<le> n; n \<le> ((n div xa ^ pm + xa * int pm) div int p) ^ p; 0 \<le> (n div xa ^ pm + xa * int pm) div int p; 0 \<le> n; root_newton_int_main ((n div xa ^ pm + xa * int pm) div int p) n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p; n \<le> xa ^ p; 0 \<le> xa; 0 \<le> n; root_newton_int_main xa n = (x, b)\<rbrakk> \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < (x + 1) ^ p
[PROOF STEP]
proof (cases "y ^ p \<le> n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
 2. \<not> y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> y ^ p \<le> n

goal (2 subgoals):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
 2. \<not> y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
note yyn = this
[PROOF STATE]
proof (state)
this:
\<not> y ^ p \<le> n

goal (2 subgoals):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
 2. \<not> y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
with rt
[PROOF STATE]
proof (chain)
picking this:
(if y ^ p \<le> n then (y, y ^ p = n) else root_newton_int_main y' n) = (x, b)
\<not> y ^ p \<le> n
[PROOF STEP]
have rt: "?rt y' n = (x,b)"
[PROOF STATE]
proof (prove)
using this:
(if y ^ p \<le> n then (y, y ^ p = n) else root_newton_int_main y' n) = (x, b)
\<not> y ^ p \<le> n

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

goal (2 subgoals):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
 2. \<not> y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < (x + 1) ^ p
[PROOF STEP]
proof (cases "n \<le> y' ^ p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
 2. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n \<le> y' ^ p

goal (2 subgoals):
 1. n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
 2. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < (x + 1) ^ p
[PROOF STEP]
by (rule IH[OF False True rt])
[PROOF STATE]
proof (state)
this:
n < (x + 1) ^ p

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> n \<le> y' ^ p

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
with rt
[PROOF STATE]
proof (chain)
picking this:
root_newton_int_main y' n = (x, b)
\<not> n \<le> y' ^ p
[PROOF STEP]
have x: "x = y'"
[PROOF STATE]
proof (prove)
using this:
root_newton_int_main y' n = (x, b)
\<not> n \<le> y' ^ p

goal (1 subgoal):
 1. x = y'
[PROOF STEP]
unfolding root_newton_int_main.simps[of y' n]
[PROOF STATE]
proof (prove)
using this:
(if y' < 0 \<or> n < 0 then (0, False) else if y' ^ p \<le> n then (y', y' ^ p = n) else root_newton_int_main ((n div y' ^ pm + y' * int pm) div int p) n) = (x, b)
\<not> n \<le> y' ^ p

goal (1 subgoal):
 1. x = y'
[PROOF STEP]
using n0 y'0
[PROOF STATE]
proof (prove)
using this:
(if y' < 0 \<or> n < 0 then (0, False) else if y' ^ p \<le> n then (y', y' ^ p = n) else root_newton_int_main ((n div y' ^ pm + y' * int pm) div int p) n) = (x, b)
\<not> n \<le> y' ^ p
0 \<le> n
0 \<le> y'

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

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from yyn
[PROOF STATE]
proof (chain)
picking this:
\<not> y ^ p \<le> n
[PROOF STEP]
have yyn: "y^p > n"
[PROOF STATE]
proof (prove)
using this:
\<not> y ^ p \<le> n

goal (1 subgoal):
 1. n < y ^ p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n < y ^ p

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> y' ^ p
[PROOF STEP]
have yyn': "n > y' ^ p"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> y' ^ p

goal (1 subgoal):
 1. y' ^ p < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y' ^ p < n

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
y' ^ p < n

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
assume pm: "pm = 0"
[PROOF STATE]
proof (state)
this:
pm = 0

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have y': "y' = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y' = n
[PROOF STEP]
unfolding y'_def p pm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n div y ^ 0 + y * int 0) div int (Suc 0) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y' = n

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
with yyn'
[PROOF STATE]
proof (chain)
picking this:
y' ^ p < n
y' = n
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
y' ^ p < n
y' = n

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding p pm
[PROOF STATE]
proof (prove)
using this:
y' ^ Suc 0 < n
y' = n

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

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
pm = 0 \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
hence pm0: "pm > 0"
[PROOF STATE]
proof (prove)
using this:
pm = 0 \<Longrightarrow> False

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

goal (1 subgoal):
 1. \<not> n \<le> y' ^ p \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < (x + 1) ^ p
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> n < (x + 1) ^ p
 2. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> n < (x + 1) ^ p
 2. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. n < (x + 1) ^ p
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. n < (x + 1) ^ Suc pm
[PROOF STEP]
by (metis False y'0 zero_le_power)
[PROOF STATE]
proof (state)
this:
n < (x + 1) ^ p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
note n00 = this
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
let ?y = "of_int y :: real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
let ?n = "of_int n :: real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from yyn n0
[PROOF STATE]
proof (chain)
picking this:
n < y ^ p
0 \<le> n
[PROOF STEP]
have y00: "y \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
n < y ^ p
0 \<le> n

goal (1 subgoal):
 1. y \<noteq> 0
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
using this:
n < y ^ Suc pm
0 \<le> n

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

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from y00 y0
[PROOF STATE]
proof (chain)
picking this:
y \<noteq> 0
0 \<le> y
[PROOF STEP]
have y0: "?y > 0"
[PROOF STATE]
proof (prove)
using this:
y \<noteq> 0
0 \<le> y

goal (1 subgoal):
 1. 0 < real_of_int y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < real_of_int y

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from n0 False
[PROOF STATE]
proof (chain)
picking this:
0 \<le> n
n \<noteq> 0
[PROOF STEP]
have n0: "?n > 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> n
n \<noteq> 0

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

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
define Y where "Y = ?y * of_int pm"
[PROOF STATE]
proof (state)
this:
Y = real_of_int y * real_of_int (int pm)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
define NY where "NY = ?n / ?y ^ pm"
[PROOF STATE]
proof (state)
this:
NY = real_of_int n / real_of_int y ^ pm

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
note pos_intro = divide_nonneg_pos add_nonneg_nonneg mult_nonneg_nonneg
[PROOF STATE]
proof (state)
this:
\<lbrakk>(0::?'a) \<le> ?x; (0::?'a) < ?y\<rbrakk> \<Longrightarrow> (0::?'a) \<le> ?x / ?y
\<lbrakk>(0::?'a) \<le> ?a; (0::?'a) \<le> ?b\<rbrakk> \<Longrightarrow> (0::?'a) \<le> ?a + ?b
\<lbrakk>(0::?'a) \<le> ?a; (0::?'a) \<le> ?b\<rbrakk> \<Longrightarrow> (0::?'a) \<le> ?a * ?b

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have NY0: "NY > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < NY
[PROOF STEP]
unfolding NY_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real_of_int n / real_of_int y ^ pm
[PROOF STEP]
using y0 n0
[PROOF STATE]
proof (prove)
using this:
0 < real_of_int y
0 < real_of_int n

goal (1 subgoal):
 1. 0 < real_of_int n / real_of_int y ^ pm
[PROOF STEP]
by (metis NY_def zero_less_divide_iff zero_less_power)
[PROOF STATE]
proof (state)
this:
0 < NY

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
let ?ls = "NY # replicate pm ?y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have prod: "\<Prod>:replicate pm ?y = ?y ^ pm "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (replicate pm (real_of_int y)) = real_of_int y ^ pm
[PROOF STEP]
by (induct pm, auto)
[PROOF STATE]
proof (state)
this:
prod_list (replicate pm (real_of_int y)) = real_of_int y ^ pm

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have sum: "\<Sum>:replicate pm ?y = Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate pm (real_of_int y)) = Y
[PROOF STEP]
unfolding Y_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate pm (real_of_int y)) = real_of_int y * real_of_int (int pm)
[PROOF STEP]
by (induct pm, auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
sum_list (replicate pm (real_of_int y)) = Y

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have pos: "pos ?ls"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pos (NY # replicate pm (real_of_int y))
[PROOF STEP]
unfolding pos_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. if NY # replicate pm (real_of_int y) = [] then False else \<forall>e. e \<in> set (NY # replicate pm (real_of_int y)) \<longrightarrow> 0 < e
[PROOF STEP]
using NY0 y0
[PROOF STATE]
proof (prove)
using this:
0 < NY
0 < real_of_int y

goal (1 subgoal):
 1. if NY # replicate pm (real_of_int y) = [] then False else \<forall>e. e \<in> set (NY # replicate pm (real_of_int y)) \<longrightarrow> 0 < e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pos (NY # replicate pm (real_of_int y))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have "root p ?n = gmean ?ls"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root p (real_of_int n) = gmean (NY # replicate pm (real_of_int y))
[PROOF STEP]
unfolding gmean_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root p (real_of_int n) = root (length (NY # replicate pm (real_of_int y))) (prod_list (NY # replicate pm (real_of_int y)))
[PROOF STEP]
using y0
[PROOF STATE]
proof (prove)
using this:
0 < real_of_int y

goal (1 subgoal):
 1. root p (real_of_int n) = root (length (NY # replicate pm (real_of_int y))) (prod_list (NY # replicate pm (real_of_int y)))
[PROOF STEP]
by (auto simp: p NY_def prod)
[PROOF STATE]
proof (state)
this:
root p (real_of_int n) = gmean (NY # replicate pm (real_of_int y))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
root p (real_of_int n) = gmean (NY # replicate pm (real_of_int y))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have "\<dots> < mean ?ls"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gmean (NY # replicate pm (real_of_int y)) < mean (NY # replicate pm (real_of_int y))
[PROOF STEP]
proof (rule CauchysMeanTheorem_Less[OF pos het_gt_0I])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?a1 \<in> set (NY # replicate pm (real_of_int y))
 2. ?b1 \<in> set (NY # replicate pm (real_of_int y))
 3. ?a1 \<noteq> ?b1
[PROOF STEP]
show "NY \<in> set ?ls"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NY \<in> set (NY # replicate pm (real_of_int y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
NY \<in> set (NY # replicate pm (real_of_int y))

goal (2 subgoals):
 1. ?b1 \<in> set (NY # replicate pm (real_of_int y))
 2. NY \<noteq> ?b1
[PROOF STEP]
from pm0
[PROOF STATE]
proof (chain)
picking this:
0 < pm
[PROOF STEP]
show "?y \<in> set ?ls"
[PROOF STATE]
proof (prove)
using this:
0 < pm

goal (1 subgoal):
 1. real_of_int y \<in> set (NY # replicate pm (real_of_int y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int y \<in> set (NY # replicate pm (real_of_int y))

goal (1 subgoal):
 1. NY \<noteq> real_of_int y
[PROOF STEP]
have "NY < ?y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NY < real_of_int y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. NY < real_of_int y
[PROOF STEP]
from yyn
[PROOF STATE]
proof (chain)
picking this:
n < y ^ p
[PROOF STEP]
have less: "?n < ?y ^ Suc pm"
[PROOF STATE]
proof (prove)
using this:
n < y ^ p

goal (1 subgoal):
 1. real_of_int n < real_of_int y ^ Suc pm
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
using this:
n < y ^ Suc pm

goal (1 subgoal):
 1. real_of_int n < real_of_int y ^ Suc pm
[PROOF STEP]
by (metis of_int_less_iff of_int_power)
[PROOF STATE]
proof (state)
this:
real_of_int n < real_of_int y ^ Suc pm

goal (1 subgoal):
 1. NY < real_of_int y
[PROOF STEP]
have "NY < ?y ^ Suc pm / ?y ^ pm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NY < real_of_int y ^ Suc pm / real_of_int y ^ pm
[PROOF STEP]
unfolding NY_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int n / real_of_int y ^ pm < real_of_int y ^ Suc pm / real_of_int y ^ pm
[PROOF STEP]
by (rule divide_strict_right_mono[OF less], insert y0, auto)
[PROOF STATE]
proof (state)
this:
NY < real_of_int y ^ Suc pm / real_of_int y ^ pm

goal (1 subgoal):
 1. NY < real_of_int y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
NY < real_of_int y ^ Suc pm / real_of_int y ^ pm

goal (1 subgoal):
 1. NY < real_of_int y
[PROOF STEP]
using y0
[PROOF STATE]
proof (prove)
using this:
NY < real_of_int y ^ Suc pm / real_of_int y ^ pm
0 < real_of_int y

goal (1 subgoal):
 1. NY < real_of_int y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
NY < real_of_int y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
NY < real_of_int y

goal (1 subgoal):
 1. NY \<noteq> real_of_int y
[PROOF STEP]
thus "NY \<noteq> ?y"
[PROOF STATE]
proof (prove)
using this:
NY < real_of_int y

goal (1 subgoal):
 1. NY \<noteq> real_of_int y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
NY \<noteq> real_of_int y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
gmean (NY # replicate pm (real_of_int y)) < mean (NY # replicate pm (real_of_int y))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gmean (NY # replicate pm (real_of_int y)) < mean (NY # replicate pm (real_of_int y))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have "\<dots> = (NY + Y) / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mean (NY # replicate pm (real_of_int y)) = (NY + Y) / real p
[PROOF STEP]
by (simp add: mean_def sum p)
[PROOF STATE]
proof (state)
this:
mean (NY # replicate pm (real_of_int y)) = (NY + Y) / real p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
root p (real_of_int n) < (NY + Y) / real p
[PROOF STEP]
have *: "root p ?n < (NY + Y) / real p"
[PROOF STATE]
proof (prove)
using this:
root p (real_of_int n) < (NY + Y) / real p

goal (1 subgoal):
 1. root p (real_of_int n) < (NY + Y) / real p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
root p (real_of_int n) < (NY + Y) / real p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have "?n = (root p ?n)^p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int n = root p (real_of_int n) ^ p
[PROOF STEP]
using n0
[PROOF STATE]
proof (prove)
using this:
0 < real_of_int n

goal (1 subgoal):
 1. real_of_int n = root p (real_of_int n) ^ p
[PROOF STEP]
by (metis neq0_conv p0 real_root_pow_pos)
[PROOF STATE]
proof (state)
this:
real_of_int n = root p (real_of_int n) ^ p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int n = root p (real_of_int n) ^ p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have "\<dots> < ((NY + Y) / real p)^p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root p (real_of_int n) ^ p < ((NY + Y) / real p) ^ p
[PROOF STEP]
by (rule power_strict_mono[OF *], insert n0 p, auto)
[PROOF STATE]
proof (state)
this:
root p (real_of_int n) ^ p < ((NY + Y) / real p) ^ p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int n < ((NY + Y) / real p) ^ p
[PROOF STEP]
have ineq1: "?n < ((NY + Y) / real p)^p"
[PROOF STATE]
proof (prove)
using this:
real_of_int n < ((NY + Y) / real p) ^ p

goal (1 subgoal):
 1. real_of_int n < ((NY + Y) / real p) ^ p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_int n < ((NY + Y) / real p) ^ p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
real_of_int n < ((NY + Y) / real p) ^ p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
define s where "s = n div y ^ pm + y * int pm"
[PROOF STATE]
proof (state)
this:
s = n div y ^ pm + y * int pm

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
define S where "S = NY + Y"
[PROOF STATE]
proof (state)
this:
S = NY + Y

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have Y0: "Y \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Y
[PROOF STEP]
using y0
[PROOF STATE]
proof (prove)
using this:
0 < real_of_int y

goal (1 subgoal):
 1. 0 \<le> Y
[PROOF STEP]
unfolding Y_def
[PROOF STATE]
proof (prove)
using this:
0 < real_of_int y

goal (1 subgoal):
 1. 0 \<le> real_of_int y * real_of_int (int pm)
[PROOF STEP]
by (metis "1.prems"(2) mult_nonneg_nonneg of_int_0_le_iff of_nat_0_le_iff)
[PROOF STATE]
proof (state)
this:
0 \<le> Y

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have S0: "S > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < S
[PROOF STEP]
using NY0 Y0
[PROOF STATE]
proof (prove)
using this:
0 < NY
0 \<le> Y

goal (1 subgoal):
 1. 0 < S
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
using this:
0 < NY
0 \<le> Y

goal (1 subgoal):
 1. 0 < NY + Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < S

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
p = Suc pm
[PROOF STEP]
have p0: "p > 0"
[PROOF STATE]
proof (prove)
using this:
p = Suc pm

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

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have "?n / ?y ^ pm  < of_int (floor (?n / ?y^pm)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int n / real_of_int y ^ pm < real_of_int \<lfloor>real_of_int n / real_of_int y ^ pm\<rfloor> + 1
[PROOF STEP]
by (rule divide_less_floor1)
[PROOF STATE]
proof (state)
this:
real_of_int n / real_of_int y ^ pm < real_of_int \<lfloor>real_of_int n / real_of_int y ^ pm\<rfloor> + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int n / real_of_int y ^ pm < real_of_int \<lfloor>real_of_int n / real_of_int y ^ pm\<rfloor> + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have "floor (?n / ?y ^ pm) = n div y^pm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>real_of_int n / real_of_int y ^ pm\<rfloor> = n div y ^ pm
[PROOF STEP]
unfolding div_is_floor_divide_real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>real_of_int n / real_of_int y ^ pm\<rfloor> = \<lfloor>real_of_int n / real_of_int (y ^ pm)\<rfloor>
[PROOF STEP]
by (metis of_int_power)
[PROOF STATE]
proof (state)
this:
\<lfloor>real_of_int n / real_of_int y ^ pm\<rfloor> = n div y ^ pm

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int n / real_of_int y ^ pm < real_of_int (n div y ^ pm) + 1
[PROOF STEP]
have "NY < of_int (n div y ^ pm) + 1"
[PROOF STATE]
proof (prove)
using this:
real_of_int n / real_of_int y ^ pm < real_of_int (n div y ^ pm) + 1

goal (1 subgoal):
 1. NY < real_of_int (n div y ^ pm) + 1
[PROOF STEP]
unfolding NY_def
[PROOF STATE]
proof (prove)
using this:
real_of_int n / real_of_int y ^ pm < real_of_int (n div y ^ pm) + 1

goal (1 subgoal):
 1. real_of_int n / real_of_int y ^ pm < real_of_int (n div y ^ pm) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
NY < real_of_int (n div y ^ pm) + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
hence less: "S < of_int s + 1"
[PROOF STATE]
proof (prove)
using this:
NY < real_of_int (n div y ^ pm) + 1

goal (1 subgoal):
 1. S < real_of_int s + 1
[PROOF STEP]
unfolding Y_def s_def S_def
[PROOF STATE]
proof (prove)
using this:
NY < real_of_int (n div y ^ pm) + 1

goal (1 subgoal):
 1. NY + real_of_int y * real_of_int (int pm) < real_of_int (n div y ^ pm + y * int pm) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
S < real_of_int s + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
S < real_of_int s + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
(* by sledgehammer *)
[PROOF STATE]
proof (state)
this:
S < real_of_int s + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have f1: "\<forall>x\<^sub>0. rat_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = rat_of_nat x\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<^sub>0. rat_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = rat_of_nat x\<^sub>0
[PROOF STEP]
using of_int_of_nat_eq
[PROOF STATE]
proof (prove)
using this:
of_int (int ?n) = of_nat ?n

goal (1 subgoal):
 1. \<forall>x\<^sub>0. rat_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = rat_of_nat x\<^sub>0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x\<^sub>0. rat_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = rat_of_nat x\<^sub>0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have f2: "\<forall>x\<^sub>0. real_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = real x\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<^sub>0. real_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = real x\<^sub>0
[PROOF STEP]
using of_int_of_nat_eq
[PROOF STATE]
proof (prove)
using this:
of_int (int ?n) = of_nat ?n

goal (1 subgoal):
 1. \<forall>x\<^sub>0. real_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = real x\<^sub>0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<^sub>0. real_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = real x\<^sub>0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have f3: "\<forall>x\<^sub>0 x\<^sub>1. \<lfloor>rat_of_int x\<^sub>0 / rat_of_int x\<^sub>1\<rfloor> = \<lfloor>real_of_int x\<^sub>0 / real_of_int x\<^sub>1\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<^sub>0 x\<^sub>1. \<lfloor>rat_of_int x\<^sub>0 / rat_of_int x\<^sub>1\<rfloor> = \<lfloor>real_of_int x\<^sub>0 / real_of_int x\<^sub>1\<rfloor>
[PROOF STEP]
using div_is_floor_divide_rat div_is_floor_divide_real
[PROOF STATE]
proof (prove)
using this:
?n div ?y = \<lfloor>rat_of_int ?n / rat_of_int ?y\<rfloor>
?n div ?y = \<lfloor>real_of_int ?n / real_of_int ?y\<rfloor>

goal (1 subgoal):
 1. \<forall>x\<^sub>0 x\<^sub>1. \<lfloor>rat_of_int x\<^sub>0 / rat_of_int x\<^sub>1\<rfloor> = \<lfloor>real_of_int x\<^sub>0 / real_of_int x\<^sub>1\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x\<^sub>0 x\<^sub>1. \<lfloor>rat_of_int x\<^sub>0 / rat_of_int x\<^sub>1\<rfloor> = \<lfloor>real_of_int x\<^sub>0 / real_of_int x\<^sub>1\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have f4: "0 < \<lfloor>rat_of_nat p\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<lfloor>rat_of_nat p\<rfloor>
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p = Suc pm

goal (1 subgoal):
 1. 0 < \<lfloor>rat_of_nat p\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < \<lfloor>rat_of_nat p\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have "\<lfloor>S\<rfloor> \<le> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>S\<rfloor> \<le> s
[PROOF STEP]
using less floor_le_iff
[PROOF STATE]
proof (prove)
using this:
S < real_of_int s + 1
(\<lfloor>?x\<rfloor> \<le> ?z) = (?x < of_int ?z + (1::?'a))

goal (1 subgoal):
 1. \<lfloor>S\<rfloor> \<le> s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lfloor>S\<rfloor> \<le> s

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
hence "\<lfloor>rat_of_int \<lfloor>S\<rfloor> / rat_of_nat p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
\<lfloor>S\<rfloor> \<le> s

goal (1 subgoal):
 1. \<lfloor>rat_of_int \<lfloor>S\<rfloor> / rat_of_nat p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>
[PROOF STEP]
using f1 f3 f4
[PROOF STATE]
proof (prove)
using this:
\<lfloor>S\<rfloor> \<le> s
\<forall>x\<^sub>0. rat_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = rat_of_nat x\<^sub>0
\<forall>x\<^sub>0 x\<^sub>1. \<lfloor>rat_of_int x\<^sub>0 / rat_of_int x\<^sub>1\<rfloor> = \<lfloor>real_of_int x\<^sub>0 / real_of_int x\<^sub>1\<rfloor>
0 < \<lfloor>rat_of_nat p\<rfloor>

goal (1 subgoal):
 1. \<lfloor>rat_of_int \<lfloor>S\<rfloor> / rat_of_nat p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>
[PROOF STEP]
by (metis div_is_floor_divide_real zdiv_mono1)
[PROOF STATE]
proof (state)
this:
\<lfloor>rat_of_int \<lfloor>S\<rfloor> / rat_of_nat p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
hence "\<lfloor>S / real p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
\<lfloor>rat_of_int \<lfloor>S\<rfloor> / rat_of_nat p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>

goal (1 subgoal):
 1. \<lfloor>S / real p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>
[PROOF STEP]
using f1 f2 f3 f4
[PROOF STATE]
proof (prove)
using this:
\<lfloor>rat_of_int \<lfloor>S\<rfloor> / rat_of_nat p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>
\<forall>x\<^sub>0. rat_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = rat_of_nat x\<^sub>0
\<forall>x\<^sub>0. real_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = real x\<^sub>0
\<forall>x\<^sub>0 x\<^sub>1. \<lfloor>rat_of_int x\<^sub>0 / rat_of_int x\<^sub>1\<rfloor> = \<lfloor>real_of_int x\<^sub>0 / real_of_int x\<^sub>1\<rfloor>
0 < \<lfloor>rat_of_nat p\<rfloor>

goal (1 subgoal):
 1. \<lfloor>S / real p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>
[PROOF STEP]
by (metis div_is_floor_divide_real floor_div_pos_int)
[PROOF STATE]
proof (state)
this:
\<lfloor>S / real p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
hence "S / real p \<le> real_of_int (s div int p) + 1"
[PROOF STATE]
proof (prove)
using this:
\<lfloor>S / real p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>

goal (1 subgoal):
 1. S / real p \<le> real_of_int (s div int p) + 1
[PROOF STEP]
using f1 f3
[PROOF STATE]
proof (prove)
using this:
\<lfloor>S / real p\<rfloor> \<le> \<lfloor>rat_of_int s / rat_of_nat p\<rfloor>
\<forall>x\<^sub>0. rat_of_int \<lfloor>rat_of_nat x\<^sub>0\<rfloor> = rat_of_nat x\<^sub>0
\<forall>x\<^sub>0 x\<^sub>1. \<lfloor>rat_of_int x\<^sub>0 / rat_of_int x\<^sub>1\<rfloor> = \<lfloor>real_of_int x\<^sub>0 / real_of_int x\<^sub>1\<rfloor>

goal (1 subgoal):
 1. S / real p \<le> real_of_int (s div int p) + 1
[PROOF STEP]
by (metis div_is_floor_divide_real floor_le_iff floor_of_nat less_eq_real_def)
[PROOF STATE]
proof (state)
this:
S / real p \<le> real_of_int (s div int p) + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
S / real p \<le> real_of_int (s div int p) + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
hence "S / real p \<le> of_int(s div p) + 1"
[PROOF STATE]
proof (prove)
using this:
S / real p \<le> real_of_int (s div int p) + 1

goal (1 subgoal):
 1. S / real p \<le> real_of_int (s div int p) + 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
S / real p \<le> real_of_int (s div int p) + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
note this[unfolded S_def s_def]
[PROOF STATE]
proof (state)
this:
(NY + Y) / real p \<le> real_of_int ((n div y ^ pm + y * int pm) div int p) + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(NY + Y) / real p \<le> real_of_int ((n div y ^ pm + y * int pm) div int p) + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
hence ge: "of_int y' + 1 \<ge> (NY + Y) / p"
[PROOF STATE]
proof (prove)
using this:
(NY + Y) / real p \<le> real_of_int ((n div y ^ pm + y * int pm) div int p) + 1

goal (1 subgoal):
 1. (NY + Y) / real p \<le> real_of_int y' + 1
[PROOF STEP]
unfolding y'_def
[PROOF STATE]
proof (prove)
using this:
(NY + Y) / real p \<le> real_of_int ((n div y ^ pm + y * int pm) div int p) + 1

goal (1 subgoal):
 1. (NY + Y) / real p \<le> real_of_int ((n div y ^ pm + y * int pm) div int p) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(NY + Y) / real p \<le> real_of_int y' + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have pos1: "(NY + Y) / p \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (NY + Y) / real p
[PROOF STEP]
unfolding Y_def NY_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (real_of_int n / real_of_int y ^ pm + real_of_int y * real_of_int (int pm)) / real p
[PROOF STEP]
by (intro divide_nonneg_pos add_nonneg_nonneg mult_nonneg_nonneg,
          insert y0 n0 p0, auto)
[PROOF STATE]
proof (state)
this:
0 \<le> (NY + Y) / real p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have pos2: "of_int y' + (1 :: rat) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> rat_of_int y' + 1
[PROOF STEP]
using y'0
[PROOF STATE]
proof (prove)
using this:
0 \<le> y'

goal (1 subgoal):
 1. 0 \<le> rat_of_int y' + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> rat_of_int y' + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
have ineq2: "(of_int y' + 1) ^ p \<ge> ((NY + Y) / p) ^ p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((NY + Y) / real p) ^ p \<le> (real_of_int y' + 1) ^ p
[PROOF STEP]
by (rule power_mono[OF ge pos1])
[PROOF STATE]
proof (state)
this:
((NY + Y) / real p) ^ p \<le> (real_of_int y' + 1) ^ p

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
from order.strict_trans2[OF ineq1 ineq2]
[PROOF STATE]
proof (chain)
picking this:
real_of_int n < (real_of_int y' + 1) ^ p
[PROOF STEP]
have "?n < of_int ((x + 1) ^ p)"
[PROOF STATE]
proof (prove)
using this:
real_of_int n < (real_of_int y' + 1) ^ p

goal (1 subgoal):
 1. real_of_int n < real_of_int ((x + 1) ^ p)
[PROOF STEP]
unfolding x
[PROOF STATE]
proof (prove)
using this:
real_of_int n < (real_of_int y' + 1) ^ p

goal (1 subgoal):
 1. real_of_int n < real_of_int ((y' + 1) ^ p)
[PROOF STEP]
by (metis of_int_1 of_int_add of_int_power)
[PROOF STATE]
proof (state)
this:
real_of_int n < real_of_int ((x + 1) ^ p)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
thus "n < (x + 1) ^ p"
[PROOF STATE]
proof (prove)
using this:
real_of_int n < real_of_int ((x + 1) ^ p)

goal (1 subgoal):
 1. n < (x + 1) ^ p
[PROOF STEP]
using of_int_less_iff
[PROOF STATE]
proof (prove)
using this:
real_of_int n < real_of_int ((x + 1) ^ p)
(of_int ?w < of_int ?z) = (?w < ?z)

goal (1 subgoal):
 1. n < (x + 1) ^ p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
n < (x + 1) ^ p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
n < (x + 1) ^ p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
n < (x + 1) ^ p

goal (1 subgoal):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y ^ p \<le> n

goal (1 subgoal):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
with rt
[PROOF STATE]
proof (chain)
picking this:
(if y ^ p \<le> n then (y, y ^ p = n) else root_newton_int_main y' n) = (x, b)
y ^ p \<le> n
[PROOF STEP]
have x: "x = y"
[PROOF STATE]
proof (prove)
using this:
(if y ^ p \<le> n then (y, y ^ p = n) else root_newton_int_main y' n) = (x, b)
y ^ p \<le> n

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

goal (1 subgoal):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
with 1(2) True
[PROOF STATE]
proof (chain)
picking this:
n \<le> y ^ p
y ^ p \<le> n
x = y
[PROOF STEP]
have n: "n = y ^ p"
[PROOF STATE]
proof (prove)
using this:
n \<le> y ^ p
y ^ p \<le> n
x = y

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

goal (1 subgoal):
 1. y ^ p \<le> n \<Longrightarrow> n < (x + 1) ^ p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < (x + 1) ^ p
[PROOF STEP]
unfolding n x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y ^ p < (y + 1) ^ p
[PROOF STEP]
using y0
[PROOF STATE]
proof (prove)
using this:
0 \<le> y

goal (1 subgoal):
 1. y ^ p < (y + 1) ^ p
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
using this:
0 \<le> y

goal (1 subgoal):
 1. y ^ Suc pm < (y + 1) ^ Suc pm
[PROOF STEP]
by (metis add_le_less_mono add_less_cancel_left lessI less_add_one add.right_neutral le_iff_add power_strict_mono)
[PROOF STATE]
proof (state)
this:
n < (x + 1) ^ p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
n < (x + 1) ^ p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_replace_coeff:
assumes "f 0 = 0"
shows "coeff (replace_coeff f p) m = f (coeff p m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (replace_coeff f p) m = f (coeff p m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff (replace_coeff f p) m = f (coeff p m)
[PROOF STEP]
have 0:"finite {m. f (lookup (mapping_of p) m) \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {m. f (lookup (mapping_of p) m) \<noteq> (0::'a)}
[PROOF STEP]
unfolding coeff_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {m. f (coeff p m) \<noteq> (0::'a)}
[PROOF STEP]
by (metis (mono_tags, lifting) Collect_mono assms(1) coeff_def finite_lookup finite_subset)+
[PROOF STATE]
proof (state)
this:
finite {m. f (lookup (mapping_of p) m) \<noteq> (0::'a)}

goal (1 subgoal):
 1. coeff (replace_coeff f p) m = f (coeff p m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {m. f (lookup (mapping_of p) m) \<noteq> (0::'a)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {m. f (lookup (mapping_of p) m) \<noteq> (0::'a)}

goal (1 subgoal):
 1. coeff (replace_coeff f p) m = f (coeff p m)
[PROOF STEP]
unfolding replace_coeff_def coeff_def
[PROOF STATE]
proof (prove)
using this:
finite {m. f (lookup (mapping_of p) m) \<noteq> (0::'a)}

goal (1 subgoal):
 1. lookup (mapping_of (MPoly (Abs_poly_mapping (\<lambda>m. f (lookup (mapping_of p) m))))) m = f (lookup (mapping_of p) m)
[PROOF STEP]
using lookup_Abs_poly_mapping[OF 0]
[PROOF STATE]
proof (prove)
using this:
finite {m. f (lookup (mapping_of p) m) \<noteq> (0::'a)}
lookup (Abs_poly_mapping (\<lambda>m. f (lookup (mapping_of p) m))) = (\<lambda>m. f (lookup (mapping_of p) m))

goal (1 subgoal):
 1. lookup (mapping_of (MPoly (Abs_poly_mapping (\<lambda>m. f (lookup (mapping_of p) m))))) m = f (lookup (mapping_of p) m)
[PROOF STEP]
by (metis (mono_tags, lifting) Quotient_mpoly Quotient_rep_abs_fold_unmap)
[PROOF STATE]
proof (state)
this:
coeff (replace_coeff f p) m = f (coeff p m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma collision_excluded: "(\<And>t. t \<in> T \<Longrightarrow> ego.s t \<noteq> other.s t) \<Longrightarrow> collision S \<longleftrightarrow> collision (S - T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. t \<in> T \<Longrightarrow> ego.s t \<noteq> other.s t) \<Longrightarrow> collision S = collision (S - T)
[PROOF STEP]
by (auto simp: collision_def)


[STATEMENT]
lemma Polys_closed_uminus: "p \<in> P[X] \<Longrightarrow> -p \<in> P[X]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> P[X] \<Longrightarrow> - p \<in> P[X]
[PROOF STEP]
by (simp add: Polys_def keys_uminus)


[STATEMENT]
lemma hoare_apply:
  assumes "R U *\<^sub>S pre \<le> post"
  shows "hoare pre [apply U R] post"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hoare pre [apply U R] post
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
R U *\<^sub>S pre \<le> post

goal (1 subgoal):
 1. hoare pre [apply U R] post
[PROOF STEP]
apply (auto simp: hoare_def program_def apply_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>\<psi>. \<lbrakk>R U *\<^sub>S pre \<le> post; \<psi> \<in> space_as_set pre\<rbrakk> \<Longrightarrow> R U *\<^sub>V \<psi> \<in> space_as_set post
[PROOF STEP]
by (metis (no_types, lifting) cblinfun_image.rep_eq closure_subset imageI less_eq_ccsubspace.rep_eq subsetD)


[STATEMENT]
lemma col123__nos:
  assumes "Col P Q A"
  shows "\<not> P Q OS A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> P Q OS A B
[PROOF STEP]
using assms one_side_not_col123
[PROOF STATE]
proof (prove)
using this:
Col P Q A
?A ?B OS ?X ?Y \<Longrightarrow> \<not> Col ?A ?B ?X

goal (1 subgoal):
 1. \<not> P Q OS A B
[PROOF STEP]
by blast


[STATEMENT]
lemma i_aggregate_i_drop_mod: "
  n mod k = 0 \<Longrightarrow>
  i_aggregate (f \<Up> n) k ag = i_aggregate f k ag \<Up> (n div k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n mod k = 0 \<Longrightarrow> i_aggregate (f \<Up> n) k ag = i_aggregate f k ag \<Up> (n div k)
[PROOF STEP]
by (clarsimp simp: mult.commute[of k] i_aggregate_i_drop_mult ilist_eq_iff elim!: dvdE)


[STATEMENT]
lemma apply_swap\<^sub>w [simp]: "apply_wiring swap\<^sub>w (res1 \<oplus>\<^sub>O res2) = res2 \<oplus>\<^sub>O res1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_wiring swap\<^sub>w (res1 \<oplus>\<^sub>O res2) = res2 \<oplus>\<^sub>O res1
[PROOF STEP]
by(simp add: apply_wiring_def swap\<^sub>w_def map_swap_sum_plus_oracle)


[STATEMENT]
lemma qPsubstInp_preserves_alphaInp:
assumes "qGoodInp qinp \<or> qGoodInp qinp'" and "qGoodEnv qrho" and "qinp %= qinp'"
shows "(qinp %[[qrho]]) %= (qinp' %[[qrho]])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (qinp %[[qrho]], qinp' %[[qrho]]) \<in> alphaInp
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
qGoodInp qinp \<or> qGoodInp qinp'
qGoodEnv qrho
(qinp, qinp') \<in> alphaInp

goal (1 subgoal):
 1. (qinp %[[qrho]], qinp' %[[qrho]]) \<in> alphaInp
[PROOF STEP]
unfolding alphaInp_def qPsubstInp_def sameDom_def liftAll2_def
[PROOF STATE]
proof (prove)
using this:
qGoodInp qinp \<or> qGoodInp qinp'
qGoodEnv qrho
(qinp, qinp') \<in> {(qinp, qinp'). (\<forall>i. (qinp i = None) = (qinp' i = None)) \<and> (\<forall>i v1 v2. qinp i = Some v1 \<and> qinp' i = Some v2 \<longrightarrow> v1 #= v2)}

goal (1 subgoal):
 1. (lift (qPsubst qrho) qinp, lift (qPsubst qrho) qinp') \<in> {(qinp, qinp'). (\<forall>i. (qinp i = None) = (qinp' i = None)) \<and> (\<forall>i v1 v2. qinp i = Some v1 \<and> qinp' i = Some v2 \<longrightarrow> v1 #= v2)}
[PROOF STEP]
by (simp add: lift_None)
   (smt liftAll_def lift_def option.case_eq_if option.exhaust_sel
       option.sel qGoodInp_def qPsubst_preserves_alpha1)


[STATEMENT]
lemma x_zero_add_closed: "x \<cdot> 0 + y \<cdot> 0 = (x + y) \<cdot> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<cdot> (0::'a) + y \<cdot> (0::'a) = (x + y) \<cdot> (0::'a)
[PROOF STEP]
by (simp add: local.s_prod_distr)


[STATEMENT]
lemma open_vimage_fst: "open S \<Longrightarrow> open (fst -` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S \<Longrightarrow> open (fst -` S)
[PROOF STEP]
by (simp add: fst_vimage_eq_Times open_Times)


[STATEMENT]
lemma smods_smult_length:
  assumes "a\<noteq>0" "b\<noteq>0"
  shows "length (smods p q) = length (smods (smult a p) (smult b q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (smods p q) = length (smods (smult a p) (smult b q))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
b \<noteq> 0

goal (1 subgoal):
 1. length (smods p q) = length (smods (smult a p) (smult b q))
[PROOF STEP]
proof (induct "smods p q"  arbitrary:p q a b )
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p q a b. \<lbrakk>[] = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q))
 2. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
[] = smods p q
a \<noteq> 0
b \<noteq> 0

goal (2 subgoals):
 1. \<And>p q a b. \<lbrakk>[] = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q))
 2. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
[] = smods p q
a \<noteq> 0
b \<noteq> 0

goal (1 subgoal):
 1. length (smods p q) = length (smods (smult a p) (smult b q))
[PROOF STEP]
by (simp split:if_splits)
[PROOF STATE]
proof (state)
this:
length (smods p q) = length (smods (smult a p) (smult b q))

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>xs = smods ?p ?q; ?a \<noteq> 0; ?b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods ?p ?q) = length (smods (smult ?a ?p) (smult ?b ?q))
x # xs = smods p q
a \<noteq> 0
b \<noteq> 0

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
hence "p\<noteq>0"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>xs = smods ?p ?q; ?a \<noteq> 0; ?b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods ?p ?q) = length (smods (smult ?a ?p) (smult ?b ?q))
x # xs = smods p q
a \<noteq> 0
b \<noteq> 0

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

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
define r where "r\<equiv>- (p mod q)"
[PROOF STATE]
proof (state)
this:
r \<equiv> - (p mod q)

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
have "smods q r = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smods q r = xs
[PROOF STEP]
using Cons.hyps(2) `p\<noteq>0`
[PROOF STATE]
proof (prove)
using this:
x # xs = smods p q
p \<noteq> 0

goal (1 subgoal):
 1. smods q r = xs
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
using this:
x # xs = smods p q
p \<noteq> 0

goal (1 subgoal):
 1. smods q (- (p mod q)) = xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
smods q r = xs

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
hence "length (smods q r) = length (smods (smult b q) (smult a r))"
[PROOF STATE]
proof (prove)
using this:
smods q r = xs

goal (1 subgoal):
 1. length (smods q r) = length (smods (smult b q) (smult a r))
[PROOF STEP]
using Cons.hyps(1)[of q r b a] Cons
[PROOF STATE]
proof (prove)
using this:
smods q r = xs
\<lbrakk>xs = smods q r; b \<noteq> 0; a \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods q r) = length (smods (smult b q) (smult a r))
\<lbrakk>xs = smods ?p ?q; ?a \<noteq> 0; ?b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods ?p ?q) = length (smods (smult ?a ?p) (smult ?b ?q))
x # xs = smods p q
a \<noteq> 0
b \<noteq> 0

goal (1 subgoal):
 1. length (smods q r) = length (smods (smult b q) (smult a r))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (smods q r) = length (smods (smult b q) (smult a r))

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (smods q r) = length (smods (smult b q) (smult a r))

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
have "smult a p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a p \<noteq> 0
[PROOF STEP]
using `a\<noteq>0` `p\<noteq>0`
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
p \<noteq> 0

goal (1 subgoal):
 1. smult a p \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
smult a p \<noteq> 0

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
smult a p \<noteq> 0

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
have "-((smult a p) mod (smult b q)) = (smult a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (smult a p mod smult b q) = smult a r
[PROOF STEP]
by (simp add: Cons.prems(2) mod_smult_left mod_smult_right r_def)
[PROOF STATE]
proof (state)
this:
- (smult a p mod smult b q) = smult a r

goal (1 subgoal):
 1. \<And>a x p q aa b. \<lbrakk>\<And>p q a b. \<lbrakk>x = smods p q; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult a p) (smult b q)); a # x = smods p q; aa \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> length (smods p q) = length (smods (smult aa p) (smult b q))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (smods q r) = length (smods (smult b q) (smult a r))
smult a p \<noteq> 0
- (smult a p mod smult b q) = smult a r
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length (smods q r) = length (smods (smult b q) (smult a r))
smult a p \<noteq> 0
- (smult a p mod smult b q) = smult a r

goal (1 subgoal):
 1. length (smods p q) = length (smods (smult a p) (smult b q))
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
using this:
length (smods q (- (p mod q))) = length (smods (smult b q) (smult a (- (p mod q))))
smult a p \<noteq> 0
- (smult a p mod smult b q) = smult a (- (p mod q))

goal (1 subgoal):
 1. length (smods p q) = length (smods (smult a p) (smult b q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (smods p q) = length (smods (smult a p) (smult b q))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma union_less_term_w[simp]: "(\<Union>v\<in>{v. v < w}. {s. t s = v}) = {s . t s < w}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>v\<in>{v. v \<sqsubset> w}. {s. t s = v}) = {s. t s \<sqsubset> w}
[PROOF STEP]
by auto


[STATEMENT]
lemma inv_app2[simp]: "invertible\<^sub>L X \<Longrightarrow> X o\<^sub>L (inv\<^sub>L X)  = id_blinfun"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible\<^sub>L X \<Longrightarrow> X o\<^sub>L inv\<^sub>L X = id_blinfun
[PROOF STEP]
using is_inverse\<^sub>L_ex1' inv\<^sub>L_eq
[PROOF STATE]
proof (prove)
using this:
invertible\<^sub>L ?f \<Longrightarrow> \<exists>!x. is_inverse\<^sub>L ?f x
is_inverse\<^sub>L ?f ?g \<Longrightarrow> inv\<^sub>L ?f = ?g

goal (1 subgoal):
 1. invertible\<^sub>L X \<Longrightarrow> X o\<^sub>L inv\<^sub>L X = id_blinfun
[PROOF STEP]
by blast


[STATEMENT]
lemma Tree2_list_to_rbt: "Tree2.bst (list_to_rbt xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tree2.bst (list_to_rbt xs)
[PROOF STEP]
by (induction xs) (auto simp: RBT.bst_insert)


[STATEMENT]
theorem SubstFormP_Neg: "{SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')
[PROOF STEP]
obtain k1::name and s1::name and k::name and s::name
    where "atom s1 \<sharp> (v,i,x,x')"        "atom k1 \<sharp> (v,i,x,x',s1)"
      "atom s  \<sharp> (v,i,x,x',k1,s1)"  "atom k  \<sharp> (v,i,x,x',s,k1,s1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s1 k1 s k. \<lbrakk>atom s1 \<sharp> (v, i, x, x'); atom k1 \<sharp> (v, i, x, x', s1); atom s \<sharp> (v, i, x, x', k1, s1); atom k \<sharp> (v, i, x, x', s, k1, s1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis obtain_fresh)
[PROOF STATE]
proof (state)
this:
atom s1 \<sharp> (v, i, x, x')
atom k1 \<sharp> (v, i, x, x', s1)
atom s \<sharp> (v, i, x, x', k1, s1)
atom k \<sharp> (v, i, x, x', s, k1, s1)

goal (1 subgoal):
 1. {SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
atom s1 \<sharp> (v, i, x, x')
atom k1 \<sharp> (v, i, x, x', s1)
atom s \<sharp> (v, i, x, x', k1, s1)
atom k \<sharp> (v, i, x, x', s, k1, s1)

goal (1 subgoal):
 1. {SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')
[PROOF STEP]
by (force simp: SubstFormP.simps [of s v i "Q_Neg x" _ k] SubstFormP.simps [of s1 v i x x' k1]
        intro: SeqSubstFormP_Neg [THEN cut3])
[PROOF STATE]
proof (state)
this:
{SubstFormP v i x x'} \<turnstile> SubstFormP v i (Q_Neg x) (Q_Neg x')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Mempty_Bag [code]: "{#} = Bag (DAList.empty)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#} = Bag DAList.empty
[PROOF STEP]
by (simp add: multiset_eq_iff alist.Alist_inverse DAList.empty_def)


[STATEMENT]
lemma twisted_cartesian_product_swap:
  shows "(Prod\<^bsub>S,S'\<^esub> A B) = (Prod\<^bsub>S',S\<^esub> B A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Prod\<^bsub>S, S'\<^esub> A B = Prod\<^bsub>S', S\<^esub> B A
[PROOF STEP]
unfolding twisted_cartesian_product_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a. length a = card S + card S' \<and> nths a S \<in> A \<and> nths a S' \<in> B} = {a. length a = card S' + card S \<and> nths a S' \<in> B \<and> nths a S \<in> A}
[PROOF STEP]
by (metis add.commute)


[STATEMENT]
lemma p_prod_iff: "(a,A) \<in> R \<parallel> S \<longleftrightarrow> (\<exists>B C. A = B \<union> C \<and> (a,B) \<in> R \<and> (a,C) \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((a, A) \<in> R \<parallel> S) = (\<exists>B C. A = B \<union> C \<and> (a, B) \<in> R \<and> (a, C) \<in> S)
[PROOF STEP]
by (clarsimp simp add: p_prod_def)


[STATEMENT]
lemma finite_characters [intro]: "finite (characters G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (characters G)
[PROOF STEP]
proof (rule finite_subset)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. characters G \<subseteq> ?B
 2. finite ?B
[PROOF STEP]
show "characters G \<subseteq> (\<lambda>f x. if x \<in> carrier G then f x else 0) `
                          Pi\<^sub>E (carrier G) (\<lambda>_. {z. z ^ order G = 1})" (is "_ \<subseteq> ?h ` ?Chars")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. characters G \<subseteq> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
proof (intro subsetI, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> characters G \<Longrightarrow> x \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
case (1 \<chi>)
[PROOF STATE]
proof (state)
this:
\<chi> \<in> characters G

goal (1 subgoal):
 1. \<And>x. x \<in> characters G \<Longrightarrow> x \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<chi> \<in> characters G
[PROOF STEP]
interpret \<chi>: character G \<chi>
[PROOF STATE]
proof (prove)
using this:
\<chi> \<in> characters G

goal (1 subgoal):
 1. character G \<chi>
[PROOF STEP]
by (simp add: characters_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> characters G \<Longrightarrow> x \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
have "?h (restrict \<chi> (carrier G)) \<in> ?h ` ?Chars"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> carrier G then restrict \<chi> (carrier G) x else 0) \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
by (intro imageI) (auto simp: \<chi>.char_root')
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> carrier G then restrict \<chi> (carrier G) x else 0) \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})

goal (1 subgoal):
 1. \<And>x. x \<in> characters G \<Longrightarrow> x \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> carrier G then restrict \<chi> (carrier G) x else 0) \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})

goal (1 subgoal):
 1. \<And>x. x \<in> characters G \<Longrightarrow> x \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
have "?h (restrict \<chi> (carrier G)) = \<chi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> carrier G then restrict \<chi> (carrier G) x else 0) = \<chi>
[PROOF STEP]
by (simp add: fun_eq_iff \<chi>.char_eq_0)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> carrier G then restrict \<chi> (carrier G) x else 0) = \<chi>

goal (1 subgoal):
 1. \<And>x. x \<in> characters G \<Longrightarrow> x \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<chi> \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<chi> \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})

goal (1 subgoal):
 1. \<chi> \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<chi> \<in> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
characters G \<subseteq> (\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1})

goal (1 subgoal):
 1. finite ((\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1}))
[PROOF STEP]
show "finite (?h ` ?Chars)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1}))
[PROOF STEP]
by (intro finite_imageI finite_PiE finite_roots_unity) (auto simp: Suc_le_eq)
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>f x. if x \<in> carrier G then f x else 0) ` (carrier G \<rightarrow>\<^sub>E {z. z ^ order G = 1}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nz_impl_b_least_less: "\<lbrakk>y<x; (f x y) \<noteq> 0\<rbrakk> \<Longrightarrow> (b_least f x) < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x < x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x < x
[PROOF STEP]
assume A1: "y < x"
[PROOF STATE]
proof (state)
this:
y < x

goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x < x
[PROOF STEP]
assume "f x y \<noteq> 0"
[PROOF STATE]
proof (state)
this:
f x y \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x < x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f x y \<noteq> 0
[PROOF STEP]
have "b_least f x \<le> y"
[PROOF STATE]
proof (prove)
using this:
f x y \<noteq> 0

goal (1 subgoal):
 1. b_least f x \<le> y
[PROOF STEP]
by (rule nz_impl_b_least_le)
[PROOF STATE]
proof (state)
this:
b_least f x \<le> y

goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x < x
[PROOF STEP]
with A1
[PROOF STATE]
proof (chain)
picking this:
y < x
b_least f x \<le> y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y < x
b_least f x \<le> y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zdiv_pos_pos_l:"\<lbrakk> (0::int) < w; 0 \<le> z * w\<rbrakk> \<Longrightarrow> 0 \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < w; 0 \<le> z * w\<rbrakk> \<Longrightarrow> 0 \<le> z
[PROOF STEP]
by (simp add:mult.commute, frule zdiv_pos_mono_r[of "w" "0" "z"], simp,
        assumption)


[STATEMENT]
lemma Abs_inj_on: "inj_on Abs A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on Abs A
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>A. Abs x = Abs y \<longrightarrow> x = y
[PROOF STEP]
by (auto dest: Abs_inject [THEN iffD1])


[STATEMENT]
lemma r\<^sub>M_nonneg: "0 \<le> r\<^sub>M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> r\<^sub>M
[PROOF STEP]
using abs_r\<^sub>M_eq_r\<^sub>M
[PROOF STATE]
proof (prove)
using this:
\<bar>r\<^sub>M\<bar> = r\<^sub>M

goal (1 subgoal):
 1. 0 \<le> r\<^sub>M
[PROOF STEP]
by linarith


[STATEMENT]
lemma lookup_append[simp]: "lookup n (w1@w2 :: 'a::len word list)
    \<longleftrightarrow> (
      if n < LENGTH('a) * length w1 then
        lookup n w1
      else lookup (n - LENGTH('a) * length w1) w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup n (w1 @ w2) = (if n < LENGTH('a) * length w1 then lookup n w1 else lookup (n - LENGTH('a) * length w1) w2)
[PROOF STEP]
by (induction w1 arbitrary: n) auto


[STATEMENT]
lemma (in ring) algebraicI:
  assumes "p \<in> carrier (K[X])" "p \<noteq> []" and "eval p x = \<zero>" shows "(algebraic over K) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (algebraic over K) x
[PROOF STEP]
using assms non_trivial_ker_imp_algebraic
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (K [X])
p \<noteq> []
local.eval p x = \<zero>
a_kernel (?K [X]) R (\<lambda>p. local.eval p ?x) \<noteq> {[]} \<Longrightarrow> (algebraic over ?K) ?x

goal (1 subgoal):
 1. (algebraic over K) x
[PROOF STEP]
unfolding a_kernel_def'
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (K [X])
p \<noteq> []
local.eval p x = \<zero>
{x \<in> carrier (?K [X]). local.eval x ?x = \<zero>} \<noteq> {[]} \<Longrightarrow> (algebraic over ?K) ?x

goal (1 subgoal):
 1. (algebraic over K) x
[PROOF STEP]
by auto


[STATEMENT]
lemma V_of_image_times: "V_of ` (X \<times> Y) \<approx> (V_of ` X) \<times> (V_of ` Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y
[PROOF STEP]
have "V_of ` (X \<times> Y) \<approx> X \<times> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V_of ` (X \<times> Y) \<approx> X \<times> Y
[PROOF STEP]
by (meson inj_V_of inj_eq inj_onI inj_on_image_eqpoll_self)
[PROOF STATE]
proof (state)
this:
V_of ` (X \<times> Y) \<approx> X \<times> Y

goal (1 subgoal):
 1. V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
V_of ` (X \<times> Y) \<approx> X \<times> Y

goal (1 subgoal):
 1. V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y
[PROOF STEP]
have "\<dots> \<approx> (V_of ` X) \<times> (V_of ` Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<times> Y \<approx> V_of ` X \<times> V_of ` Y
[PROOF STEP]
by (metis eqpoll_sym inj_V_of inj_eq inj_onI inj_on_image_eqpoll_self times_eqpoll_cong)
[PROOF STATE]
proof (state)
this:
X \<times> Y \<approx> V_of ` X \<times> V_of ` Y

goal (1 subgoal):
 1. V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y

goal (1 subgoal):
 1. V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
V_of ` (X \<times> Y) \<approx> V_of ` X \<times> V_of ` Y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm128:
  assumes "\<forall>n. (set (perm2 l n) = set l)"
  shows "set (perm2 (x#l) n) = {x} \<union> set l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (perm2 (x # l) n) = {x} \<union> set l
[PROOF STEP]
using assms lm126
[PROOF STATE]
proof (prove)
using this:
\<forall>n. set (perm2 l n) = set l
set (rotateLeft (length (?x # rotateLeft ?n ?l) - ?n mod length (?x # rotateLeft ?n ?l)) (?x # rotateLeft ?n ?l)) = {?x} \<union> set ?l

goal (1 subgoal):
 1. set (perm2 (x # l) n) = {x} \<union> set l
[PROOF STEP]
by force


[STATEMENT]
lemma case_nat_case_nat: "case_nat x n (case_nat y m i) = case_nat (case_nat x n y) (\<lambda>i'. case_nat x n (m i')) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case case i of 0 \<Rightarrow> y | Suc x \<Rightarrow> m x of 0 \<Rightarrow> x | Suc x \<Rightarrow> n x) = (case i of 0 \<Rightarrow> case y of 0 \<Rightarrow> x | Suc x \<Rightarrow> n x | Suc i' \<Rightarrow> case m i' of 0 \<Rightarrow> x | Suc x \<Rightarrow> n x)
[PROOF STEP]
by (rule nat.case_distrib)


[STATEMENT]
lemma forall_coeffs_conv:
  "(\<forall>n. P (coeff p n)) \<longleftrightarrow> (\<forall>c \<in> set (coeffs p). P c)" if "P 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n. P (coeff p n)) = (\<forall>c\<in>set (coeffs p). P c)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
P (0::'a)

goal (1 subgoal):
 1. (\<forall>n. P (coeff p n)) = (\<forall>c\<in>set (coeffs p). P c)
[PROOF STEP]
by (auto simp add: coeffs_def)
    (metis atLeastLessThan_iff coeff_eq_0 not_less_iff_gr_or_eq zero_le)


[STATEMENT]
theorem is_sup_related [elim?]: "x \<sqsubseteq> y \<Longrightarrow> is_sup x y y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> y \<Longrightarrow> is_sup x y y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<sqsubseteq> y \<Longrightarrow> is_sup x y y
[PROOF STEP]
assume "x \<sqsubseteq> y"
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> y

goal (1 subgoal):
 1. x \<sqsubseteq> y \<Longrightarrow> is_sup x y y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_sup x y y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. x \<sqsubseteq> y
 2. y \<sqsubseteq> y
 3. \<And>z. \<lbrakk>x \<sqsubseteq> z; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> y \<sqsubseteq> z
[PROOF STEP]
show "x \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> y
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> y

goal (2 subgoals):
 1. y \<sqsubseteq> y
 2. \<And>z. \<lbrakk>x \<sqsubseteq> z; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> y \<sqsubseteq> z
[PROOF STEP]
show "y \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<sqsubseteq> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
y \<sqsubseteq> y

goal (1 subgoal):
 1. \<And>z. \<lbrakk>x \<sqsubseteq> z; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> y \<sqsubseteq> z
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z. \<lbrakk>x \<sqsubseteq> z; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> y \<sqsubseteq> z
[PROOF STEP]
assume "x \<sqsubseteq> z" and "y \<sqsubseteq> z"
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> z
y \<sqsubseteq> z

goal (1 subgoal):
 1. \<And>z. \<lbrakk>x \<sqsubseteq> z; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> y \<sqsubseteq> z
[PROOF STEP]
show "y \<sqsubseteq> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<sqsubseteq> z
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
y \<sqsubseteq> z

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

goal:
No subgoals!
[PROOF STEP]
qed