[STATEMENT]
lemma proots_cball_card_code1[code]:
  "proots_cball_card p z0 r =
                ( if r=0 then
                      (if poly p z0=0 then 1 else 0)
                  else if r < 0 \<or> p=0 then
                      0
                  else
                    ( let pp=fcompose (p \<circ>\<^sub>p [:z0, of_real r:]) [:\<i>,-1:] [:\<i>,1:]
                      in
                        (if poly p (z0-r) =0 then 1 else 0)
                        + proots_unbounded_line_card pp 0 1
                        + proots_upper_card pp
                    )
                )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have ?thesis when "r=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have "proots_within p {z0} = (if poly p z0 = 0 then {z0} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within p {z0} = (if poly p z0 = 0 then {z0} else {})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within p {z0} = (if poly p z0 = 0 then {z0} else {})

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proots_within p {z0} = (if poly p z0 = 0 then {z0} else {})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_within p {z0} = (if poly p z0 = 0 then {z0} else {})

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
unfolding proots_cball_card_def
[PROOF STATE]
proof (prove)
using this:
proots_within p {z0} = (if poly p z0 = 0 then {z0} else {})

goal (1 subgoal):
 1. card (proots_within p (cball z0 r)) = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
proots_within p {z0} = (if poly p z0 = 0 then {z0} else {})
r = 0

goal (1 subgoal):
 1. card (proots_within p (cball z0 r)) = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
r = 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r = 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have ?thesis when "r\<noteq>0" "r < 0 \<or> p=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have ?thesis when "r<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have "proots_within p (cball z0 r) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within p (cball z0 r) = {}
[PROOF STEP]
by (auto simp add: ball_empty that)
[PROOF STATE]
proof (state)
this:
proots_within p (cball z0 r) = {}

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proots_within p (cball z0 r) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_within p (cball z0 r) = {}

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
unfolding proots_cball_card_def
[PROOF STATE]
proof (prove)
using this:
proots_within p (cball z0 r) = {}

goal (1 subgoal):
 1. card (proots_within p (cball z0 r)) = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
proots_within p (cball z0 r) = {}
r < 0

goal (1 subgoal):
 1. card (proots_within p (cball z0 r)) = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
r < 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r < 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have ?thesis when "r>0" "p=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
unfolding proots_cball_card_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (cball z0 r)) = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
using that infinite_cball[of r z0]
[PROOF STATE]
proof (prove)
using this:
0 < r
p = 0
0 < r \<Longrightarrow> infinite (cball z0 r)

goal (1 subgoal):
 1. card (proots_within p (cball z0 r)) = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < r; p = 0\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r < 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
\<lbrakk>0 < r; p = 0\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r < 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
\<lbrakk>0 < r; p = 0\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
r < 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
\<lbrakk>0 < r; p = 0\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
r \<noteq> 0
r < 0 \<or> p = 0

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>r \<noteq> 0; r < 0 \<or> p = 0\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>r \<noteq> 0; r < 0 \<or> p = 0\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have ?thesis when "p\<noteq>0" "r>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
define pp where "pp=fcompose (p \<circ>\<^sub>p [:z0, of_real r:]) [:\<i>,-1:] [:\<i>,1:]"
[PROOF STATE]
proof (state)
this:
pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:]

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have "proots_cball_card p z0 r = card (proots_within p (sphere z0 r)
                                        \<union> proots_within p (ball z0 r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_cball_card p z0 r = card (proots_within p (sphere z0 r) \<union> proots_within p (ball z0 r))
[PROOF STEP]
unfolding proots_cball_card_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (cball z0 r)) = card (proots_within p (sphere z0 r) \<union> proots_within p (ball z0 r))
[PROOF STEP]
apply (simp add:proots_within_union)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (cball z0 r)) = card (proots_within p (sphere z0 r \<union> ball z0 r))
[PROOF STEP]
by (metis Diff_partition cball_diff_sphere sphere_cball)
[PROOF STATE]
proof (state)
this:
proots_cball_card p z0 r = card (proots_within p (sphere z0 r) \<union> proots_within p (ball z0 r))

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_cball_card p z0 r = card (proots_within p (sphere z0 r) \<union> proots_within p (ball z0 r))

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have "... = card (proots_within p (sphere z0 r)) + card (proots_within p (ball z0 r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (sphere z0 r) \<union> proots_within p (ball z0 r)) = card (proots_within p (sphere z0 r)) + card (proots_within p (ball z0 r))
[PROOF STEP]
apply (rule card_Un_disjoint)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite (proots_within p (sphere z0 r))
 2. finite (proots_within p (ball z0 r))
 3. proots_within p (sphere z0 r) \<inter> proots_within p (ball z0 r) = {}
[PROOF STEP]
using \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (3 subgoals):
 1. finite (proots_within p (sphere z0 r))
 2. finite (proots_within p (ball z0 r))
 3. proots_within p (sphere z0 r) \<inter> proots_within p (ball z0 r) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within p (sphere z0 r) \<union> proots_within p (ball z0 r)) = card (proots_within p (sphere z0 r)) + card (proots_within p (ball z0 r))

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (proots_within p (sphere z0 r) \<union> proots_within p (ball z0 r)) = card (proots_within p (sphere z0 r)) + card (proots_within p (ball z0 r))

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
have "... = (if poly p (z0-r) =0 then 1 else 0) + proots_unbounded_line_card pp 0 1
                        + proots_upper_card pp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (sphere z0 r)) + card (proots_within p (ball z0 r)) = (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp
[PROOF STEP]
using proots_sphere_card_code1[of p z0 r,folded pp_def,unfolded proots_sphere_card_def]
        proots_ball_card_code1[of p z0 r,folded pp_def,unfolded proots_ball_card_def]
        that
[PROOF STATE]
proof (prove)
using this:
card (proots_within p (sphere z0 r)) = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1)
card (proots_within p (ball z0 r)) = (if r \<le> 0 \<or> p = 0 then 0 else proots_upper_card pp)
p \<noteq> 0
0 < r

goal (1 subgoal):
 1. card (proots_within p (sphere z0 r)) + card (proots_within p (ball z0 r)) = (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (proots_within p (sphere z0 r)) + card (proots_within p (ball z0 r)) = (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
proots_cball_card p z0 r = (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_cball_card p z0 r = (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
apply (fold pp_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_cball_card p z0 r = (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = pp in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
0 < r

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = pp in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>p \<noteq> 0; 0 < r\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r = 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
\<lbrakk>r \<noteq> 0; r < 0 \<or> p = 0\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
\<lbrakk>p \<noteq> 0; 0 < r\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r = 0 \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
\<lbrakk>r \<noteq> 0; r < 0 \<or> p = 0\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
\<lbrakk>p \<noteq> 0; 0 < r\<rbrakk> \<Longrightarrow> proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal (1 subgoal):
 1. proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_cball_card p z0 r = (if r = 0 then if poly p z0 = 0 then 1 else 0 else if r < 0 \<or> p = 0 then 0 else let pp = fcompose (p \<circ>\<^sub>p [:z0, complex_of_real r:]) [:\<i>, - 1:] [:\<i>, 1:] in (if poly p (z0 - complex_of_real r) = 0 then 1 else 0) + proots_unbounded_line_card pp 0 1 + proots_upper_card pp)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma a''_calc_i_0: "$a''^{m}_n = n" if "m \<noteq> 0" "i = 0" for n m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $a''^{m}_n = real n
[PROOF STEP]
unfolding ann_due_def v_pres_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 / (1 + i)) .^ (real k / real m) / real m) = real n
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0
i = 0

goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 / (1 + i)) .^ (real k / real m) / real m) = real n
[PROOF STEP]
by simp


[STATEMENT]
lemma is_unit_gcd [simp]:
  "is_unit (gcd a b) \<longleftrightarrow> coprime a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (gcd a b) = coprime a b
[PROOF STEP]
by (simp add: coprime_iff_gcd_eq_1)


[STATEMENT]
lemma NSLIMSEQ_pow [rule_format]: "(X \<longlonglongrightarrow>\<^sub>N\<^sub>S a) \<longrightarrow> ((\<lambda>n. (X n) ^ m) \<longlonglongrightarrow>\<^sub>N\<^sub>S a ^ m)"
  for a :: "'a::{real_normed_algebra,power}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<longrightarrow> (\<lambda>n. X n ^ m) \<longlonglongrightarrow>\<^sub>N\<^sub>S a ^ m
[PROOF STEP]
by (induct m) (auto intro: NSLIMSEQ_mult NSLIMSEQ_const)


[STATEMENT]
lemma bidual_embedding_isometric[simp]: \<open>norm (bidual_embedding *\<^sub>V x) = norm x\<close> for x :: \<open>'a::complex_inner\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (bidual_embedding *\<^sub>V x) = norm x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (bidual_embedding *\<^sub>V x) = norm x
[PROOF STEP]
define f :: \<open>'a \<Rightarrow>\<^sub>C\<^sub>L complex\<close> where \<open>f = CBlinfun (\<lambda>y. cinner x y)\<close>
[PROOF STATE]
proof (state)
this:
f = CBlinfun ((\<bullet>\<^sub>C) x)

goal (1 subgoal):
 1. norm (bidual_embedding *\<^sub>V x) = norm x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f = CBlinfun ((\<bullet>\<^sub>C) x)
[PROOF STEP]
have [simp]: \<open>f *\<^sub>V y = cinner x y\<close> for y
[PROOF STATE]
proof (prove)
using this:
f = CBlinfun ((\<bullet>\<^sub>C) x)

goal (1 subgoal):
 1. f *\<^sub>V y = x \<bullet>\<^sub>C y
[PROOF STEP]
by (simp add: bounded_clinear_CBlinfun_apply bounded_clinear_cinner_right)
[PROOF STATE]
proof (state)
this:
f *\<^sub>V ?y = x \<bullet>\<^sub>C ?y

goal (1 subgoal):
 1. norm (bidual_embedding *\<^sub>V x) = norm x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f *\<^sub>V ?y = x \<bullet>\<^sub>C ?y
[PROOF STEP]
have [simp]: \<open>norm f = norm x\<close>
[PROOF STATE]
proof (prove)
using this:
f *\<^sub>V ?y = x \<bullet>\<^sub>C ?y

goal (1 subgoal):
 1. norm f = norm x
[PROOF STEP]
apply (auto intro!: norm_cblinfun_eqI[where x=x] simp: power2_norm_eq_cinner[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. norm x \<le> cmod ((complex_of_real (norm x))\<^sup>2) / norm x
 2. \<And>xa. cmod (x \<bullet>\<^sub>C xa) \<le> norm x * norm xa
[PROOF STEP]
apply (smt (verit, best) norm_eq_sqrt_cinner norm_ge_zero power2_norm_eq_cinner real_div_sqrt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. cmod (x \<bullet>\<^sub>C xa) \<le> norm x * norm xa
[PROOF STEP]
using Cauchy_Schwarz_ineq2
[PROOF STATE]
proof (prove)
using this:
cmod (?x \<bullet>\<^sub>C ?y) \<le> norm ?x * norm ?y

goal (1 subgoal):
 1. \<And>xa. cmod (x \<bullet>\<^sub>C xa) \<le> norm x * norm xa
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
norm f = norm x

goal (1 subgoal):
 1. norm (bidual_embedding *\<^sub>V x) = norm x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (bidual_embedding *\<^sub>V x) = norm x
[PROOF STEP]
apply (auto intro!: norm_cblinfun_eqI[where x=f])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. norm x \<le> cmod (x \<bullet>\<^sub>C x) / norm x
 2. \<And>xa. cmod (xa *\<^sub>V x) \<le> norm x * norm xa
[PROOF STEP]
apply (metis norm_eq_sqrt_cinner norm_imp_pos_and_ge real_div_sqrt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. cmod (xa *\<^sub>V x) \<le> norm x * norm xa
[PROOF STEP]
by (metis norm_cblinfun ordered_field_class.sign_simps(33))
[PROOF STATE]
proof (state)
this:
norm (bidual_embedding *\<^sub>V x) = norm x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eSuc_minus_1 [simp]: "eSuc n - 1 = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eSuc n - 1 = n
[PROOF STEP]
by (simp add: one_enat_def flip: eSuc_enat zero_enat_def)


[STATEMENT]
lemma order_1_eq_0 [simp]:"order x 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order x 1 = 0
[PROOF STEP]
by (metis order_root poly_1 zero_neq_one)


[STATEMENT]
lemma integral_component_le:
  fixes g f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "k \<in> Basis"
    and "f integrable_on S" "g integrable_on S"
    and "\<And>x. x \<in> S \<Longrightarrow> (f x)\<bullet>k \<le> (g x)\<bullet>k"
  shows "(integral S f)\<bullet>k \<le> (integral S g)\<bullet>k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral S f \<bullet> k \<le> integral S g \<bullet> k
[PROOF STEP]
using has_integral_component_le assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?k \<in> Basis; (?f has_integral ?i) ?S; (?g has_integral ?j) ?S; \<And>x. x \<in> ?S \<Longrightarrow> ?f x \<bullet> ?k \<le> ?g x \<bullet> ?k\<rbrakk> \<Longrightarrow> ?i \<bullet> ?k \<le> ?j \<bullet> ?k
k \<in> Basis
f integrable_on S
g integrable_on S
?x \<in> S \<Longrightarrow> f ?x \<bullet> k \<le> g ?x \<bullet> k

goal (1 subgoal):
 1. integral S f \<bullet> k \<le> integral S g \<bullet> k
[PROOF STEP]
by blast


[STATEMENT]
lemma index_one_mat[simp]: "i < n \<Longrightarrow> j < n \<Longrightarrow> 1\<^sub>m n $$ (i,j) = (if i = j then 1 else 0)"
  "dim_row (1\<^sub>m n) = n" "dim_col (1\<^sub>m n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> 1\<^sub>m n $$ (i, j) = (if i = j then 1::'a else (0::'a))) &&& dim_row (1\<^sub>m n) = n &&& dim_col (1\<^sub>m n) = n
[PROOF STEP]
unfolding one_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> mat n n (\<lambda>(i, j). if i = j then 1::'a else (0::'a)) $$ (i, j) = (if i = j then 1::'a else (0::'a))) &&& dim_row (mat n n (\<lambda>(i, j). if i = j then 1::'b else (0::'b))) = n &&& dim_col (mat n n (\<lambda>(i, j). if i = j then 1::'c else (0::'c))) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma analz_Un: "analz(G) \<union> analz(H) \<subseteq> analz(G \<union> H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. analz G \<union> analz H \<subseteq> analz (G \<union> H)
[PROOF STEP]
by (intro Un_least analz_mono Un_upper1 Un_upper2)


[STATEMENT]
lemma all_set_conv_nth: "(\<forall>x\<in>set l. P x) \<longleftrightarrow> (\<forall>i<length l. P (l!i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>set l. P x) = (\<forall>i<length l. P (l ! i))
[PROOF STEP]
by (auto intro: all_nth_imp_all_set)


[STATEMENT]
lemma multiset_inter_assoc: "A \<inter># (B \<inter># C) = A \<inter># B \<inter># C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter># (B \<inter># C) = A \<inter># B \<inter># C
[PROOF STEP]
by (fact subset_mset.inf.assoc [symmetric])


[STATEMENT]
theorem IK_card:
  shows "card {f. IK f} \<le> 7"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f. IK f} \<le> 7
[PROOF STEP]
by (auto simp: IK_nf IK_nf_set card.insert_remove intro!: le_trans[OF card_Diff1_le])


[STATEMENT]
lemma nonneg_infsum_complete:
  fixes f :: \<open>'a \<Rightarrow> 'b :: {complete_linorder, ordered_comm_monoid_add, linorder_topology}\<close>
  assumes \<open>\<And>x. x\<in>A \<Longrightarrow> f x \<ge> 0\<close>
  shows \<open>infsum f A = (SUP F\<in>{F. finite F \<and> F\<subseteq>A}. sum f F)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsum f A = Sup (sum f ` {F. finite F \<and> F \<subseteq> A})
[PROOF STEP]
using assms nonneg_bdd_above_infsum
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> (0::'b) \<le> f ?x
\<lbrakk>\<And>x. x \<in> ?A \<Longrightarrow> (0::?'b) \<le> ?f x; bdd_above (sum ?f ` {F. F \<subseteq> ?A \<and> finite F})\<rbrakk> \<Longrightarrow> infsum ?f ?A = Sup (sum ?f ` {F. finite F \<and> F \<subseteq> ?A})

goal (1 subgoal):
 1. infsum f A = Sup (sum f ` {F. finite F \<and> F \<subseteq> A})
[PROOF STEP]
by blast


[STATEMENT]
lemma ls_update_fst_map_set: "set (map fst (fst (ls_update k v l))) = insert k (set (map fst l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map fst (fst (ls_update k v l))) = insert k (set (map fst l))
[PROOF STEP]
apply (induct l rule: ls_update.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k v. set (map fst (fst (ls_update k v []))) = insert k (set (map fst []))
 2. \<And>k v l w ls. (k \<noteq> l \<Longrightarrow> set (map fst (fst (ls_update k v ls))) = insert k (set (map fst ls))) \<Longrightarrow> set (map fst (fst (ls_update k v ((l, w) # ls)))) = insert k (set (map fst ((l, w) # ls)))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k v l w ls. (k \<noteq> l \<Longrightarrow> set (map fst (fst (ls_update k v ls))) = insert k (set (map fst ls))) \<Longrightarrow> set (map fst (fst (ls_update k v ((l, w) # ls)))) = insert k (set (map fst ((l, w) # ls)))
[PROOF STEP]
apply (auto simp add: Let_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eexp_0[simp]: "eexp 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eexp 0 = 1
[PROOF STEP]
by (simp add: zero_ereal_def)


[STATEMENT]
lemma "OAlist_tc_map2_val_rneutr (\<lambda>_. minus)
                (oalist_tc_of_list [(1, 4), (0::nat, 4::int), (1, 3), (0, 2), (3, 1)])
                (oalist_tc_of_list [(0, 4), (1, 3), (2, 2), (1, 1)]) =
             oalist_tc_of_list [(1, 1), (2, - 2), (3, 1)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OAlist_tc_map2_val_rneutr (\<lambda>_. (-)) (oalist_tc_of_list [(1, 4), (0, 4), (1, 3), (0, 2), (3, 1)]) (oalist_tc_of_list [(0, 4), (1, 3), (2, 2), (1, 1)]) = oalist_tc_of_list [(1, 1), (2, - 2), (3, 1)]
[PROOF STEP]
by eval


[STATEMENT]
lemma downset_Sup_pres_var: "\<down> (\<Squnion>X) = (\<down> \<circ> Sup) (\<Down> (X::'a::quantale set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<down> (\<Squnion> X) = (\<down> \<circ> Sup) (\<Down> X)
[PROOF STEP]
unfolding comp_def downset_prop downset_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. y \<le> \<Squnion> X} = {y. y \<le> \<Squnion> {y. Bex X ((\<le>) y)}}
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<le> \<Squnion> X \<Longrightarrow> x \<le> \<Squnion> {y. Bex X ((\<le>) y)}
 2. \<And>x. x \<le> \<Squnion> {y. Bex X ((\<le>) y)} \<Longrightarrow> x \<le> \<Squnion> X
[PROOF STEP]
apply (smt Sup_subset_mono dual_order.refl mem_Collect_eq order_subst1 subset_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<le> \<Squnion> {y. Bex X ((\<le>) y)} \<Longrightarrow> x \<le> \<Squnion> X
[PROOF STEP]
by (smt Sup_mono le_iff_inf le_infI2 mem_Collect_eq)


[STATEMENT]
lemma lfp_while':
  fixes f::"'a set \<Rightarrow> 'a set" and M::"'a set"
  defines "N \<equiv> while (\<lambda>A. f A \<noteq> A) f {}"
  assumes f_mono: "mono f"
    and N_finite: "finite N"
    and N_supset: "f N \<subseteq> N"
  shows "lfp f = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp f = N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lfp f = N
[PROOF STEP]
have *: "f X \<subseteq> N" when "X \<subseteq> N" for X
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f X \<subseteq> N
[PROOF STEP]
using N_supset monoD[OF f_mono that]
[PROOF STATE]
proof (prove)
using this:
f N \<subseteq> N
f X \<subseteq> f N

goal (1 subgoal):
 1. f X \<subseteq> N
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?X \<subseteq> N \<Longrightarrow> f ?X \<subseteq> N

goal (1 subgoal):
 1. lfp f = N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp f = N
[PROOF STEP]
using lfp_while[OF f_mono * N_finite]
[PROOF STATE]
proof (prove)
using this:
(\<And>X. X \<subseteq> N \<Longrightarrow> X \<subseteq> N) \<Longrightarrow> lfp f = while (\<lambda>A. f A \<noteq> A) f {}

goal (1 subgoal):
 1. lfp f = N
[PROOF STEP]
by (simp add: N_def)
[PROOF STATE]
proof (state)
this:
lfp f = N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem find_path_splitting:
  "VARS p t y
  [ find_set_precondition p x \<and> p0 = p ]
  y := x;
  WHILE y \<noteq> p[[y]]
    INV { path_splitting_invariant p x y p0 }
    VAR { (p\<^sup>T\<^sup>\<star> * y)\<down> }
     DO t := p[[y]];
        p[y] := p[[p[[y]]]];
        y := t
     OD
  [ path_splitting_postcondition p x y p0 ]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [find_set_precondition p x \<and> p0 = p]
y := x; WHILE y \<noteq> p[[y]] INV {path_splitting_invariant p x y p0}  VAR {(p\<^sup>T\<^sup>\<star> * y)\<down>}
DO t := p[[y]]; p := (p[y\<longmapsto>p[[p[[y]]]]]); y := t OD
[path_splitting_postcondition p x y p0]
[PROOF STEP]
apply vcg_tc_simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. find_set_precondition p0 x \<Longrightarrow> path_splitting_invariant p0 x x p0
 2. \<And>p y. path_splitting_invariant p x y p0 \<and> y \<noteq> p[[y]] \<Longrightarrow> path_splitting_invariant (p[y\<longmapsto>p[[p[[y]]]]]) x (p[[y]]) p0 \<and> ((p[y\<longmapsto>p[[p[[y]]]]])\<^sup>T\<^sup>\<star> * (p[[y]]))\<down> < (p\<^sup>T\<^sup>\<star> * y)\<down>
 3. \<And>p y. path_splitting_invariant p x y p0 \<and> y = p[[y]] \<Longrightarrow> path_splitting_postcondition p x y p0
[PROOF STEP]
apply (fact path_splitting_1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>p y. path_splitting_invariant p x y p0 \<and> y \<noteq> p[[y]] \<Longrightarrow> path_splitting_invariant (p[y\<longmapsto>p[[p[[y]]]]]) x (p[[y]]) p0 \<and> ((p[y\<longmapsto>p[[p[[y]]]]])\<^sup>T\<^sup>\<star> * (p[[y]]))\<down> < (p\<^sup>T\<^sup>\<star> * y)\<down>
 2. \<And>p y. path_splitting_invariant p x y p0 \<and> y = p[[y]] \<Longrightarrow> path_splitting_postcondition p x y p0
[PROOF STEP]
apply (fact path_splitting_2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p y. path_splitting_invariant p x y p0 \<and> y = p[[y]] \<Longrightarrow> path_splitting_postcondition p x y p0
[PROOF STEP]
by (fact path_splitting_3)


[STATEMENT]
lemma transpose_infmatrix_inject: "(transpose_infmatrix A = transpose_infmatrix B) = (A = B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (transpose_infmatrix A = transpose_infmatrix B) = (A = B)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_infmatrix A = transpose_infmatrix B \<Longrightarrow> A = B
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. transpose_infmatrix A = transpose_infmatrix B \<Longrightarrow> A x xa = B x xa
[PROOF STEP]
apply (simp add: transpose_infmatrix)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. (\<lambda>i j. A j i) = (\<lambda>i j. B j i) \<Longrightarrow> A x xa = B x xa
[PROOF STEP]
apply (drule infmatrixforward)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<forall>a b. A b a = B b a \<Longrightarrow> A x xa = B x xa
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cis_3_pi_2[simp]: "cis (pi * 3 / 2) = - \<i>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (pi * 3 / 2) = - \<i>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cis (pi * 3 / 2) = - \<i>
[PROOF STEP]
have "cis (pi * 3 / 2) = cis (pi + pi / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (pi * 3 / 2) = cis (pi + pi / 2)
[PROOF STEP]
by (rule arg_cong[of _ _ cis], simp)
[PROOF STATE]
proof (state)
this:
cis (pi * 3 / 2) = cis (pi + pi / 2)

goal (1 subgoal):
 1. cis (pi * 3 / 2) = - \<i>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cis (pi * 3 / 2) = cis (pi + pi / 2)

goal (1 subgoal):
 1. cis (pi * 3 / 2) = - \<i>
[PROOF STEP]
have "\<dots> = - \<i>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (pi + pi / 2) = - \<i>
[PROOF STEP]
unfolding cis_add_pi
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - cis (pi / 2) = - \<i>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cis (pi + pi / 2) = - \<i>

goal (1 subgoal):
 1. cis (pi * 3 / 2) = - \<i>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cis (pi * 3 / 2) = - \<i>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cis (pi * 3 / 2) = - \<i>

goal (1 subgoal):
 1. cis (pi * 3 / 2) = - \<i>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cis (pi * 3 / 2) = - \<i>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma edge_size_degree_sumY: "card E = (\<Sum>y \<in> Y . degree y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph_size = sum degree Y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. graph_size = sum degree Y
[PROOF STEP]
have "(\<Sum>y \<in> Y . degree y) = (\<Sum>y \<in> Y . card(neighbors_ss y X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum degree Y = (\<Sum>y\<in>Y. card (neighbors_ss y X))
[PROOF STEP]
using degree_neighbors_ssY
[PROOF STATE]
proof (prove)
using this:
?v \<in> Y \<Longrightarrow> degree ?v = card (neighbors_ss ?v X)

goal (1 subgoal):
 1. sum degree Y = (\<Sum>y\<in>Y. card (neighbors_ss y X))
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
sum degree Y = (\<Sum>y\<in>Y. card (neighbors_ss y X))

goal (1 subgoal):
 1. graph_size = sum degree Y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum degree Y = (\<Sum>y\<in>Y. card (neighbors_ss y X))

goal (1 subgoal):
 1. graph_size = sum degree Y
[PROOF STEP]
have "... = card (all_edges_between X Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>y\<in>Y. card (neighbors_ss y X)) = card (all_edges_between X Y)
[PROOF STEP]
using card_all_edges_betw_neighbor
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?X; finite ?Y\<rbrakk> \<Longrightarrow> card (all_edges_between ?X ?Y) = (\<Sum>x\<in>?X. card (neighbors_ss x ?Y))

goal (1 subgoal):
 1. (\<Sum>y\<in>Y. card (neighbors_ss y X)) = card (all_edges_between X Y)
[PROOF STEP]
by (metis card_all_edges_between_commute partitions_finite(1) partitions_finite(2))
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>Y. card (neighbors_ss y X)) = card (all_edges_between X Y)

goal (1 subgoal):
 1. graph_size = sum degree Y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum degree Y = card (all_edges_between X Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum degree Y = card (all_edges_between X Y)

goal (1 subgoal):
 1. graph_size = sum degree Y
[PROOF STEP]
by (simp add: card_edges_between_set)
[PROOF STATE]
proof (state)
this:
graph_size = sum degree Y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_mset_trees:
  assumes "invar ts"
  shows "length ts \<le> log 2 (size (mset_trees ts) + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
from \<open>invar ts\<close>
[PROOF STATE]
proof (chain)
picking this:
invar ts
[PROOF STEP]
have
    ASC: "sorted_wrt (<) (map rank ts)" and
    TINV: "\<forall>t\<in>set ts. bheap t"
[PROOF STATE]
proof (prove)
using this:
invar ts

goal (1 subgoal):
 1. sorted_wrt (<) (map rank ts) &&& \<forall>t\<in>set ts. bheap t
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
using this:
Ball (set ts) bheap \<and> sorted_wrt (<) (map rank ts)

goal (1 subgoal):
 1. sorted_wrt (<) (map rank ts) &&& \<forall>t\<in>set ts. bheap t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sorted_wrt (<) (map rank ts)
\<forall>t\<in>set ts. bheap t

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
have "(2::nat)^length ts = (\<Sum>i\<in>{0..<length ts}. 2^i) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ length ts = sum ((^) 2) {0..<length ts} + 1
[PROOF STEP]
by (simp add: sum_power2)
[PROOF STATE]
proof (state)
this:
2 ^ length ts = sum ((^) 2) {0..<length ts} + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ length ts = sum ((^) 2) {0..<length ts} + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
have "\<dots> = (\<Sum>i\<leftarrow>[0..<length ts]. 2^i) + 1" (is "_ = ?S + 1")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {0..<length ts} + 1 = sum_list (map ((^) 2) [0..<length ts]) + 1
[PROOF STEP]
by (simp add: interv_sum_list_conv_sum_set_nat)
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {0..<length ts} + 1 = sum_list (map ((^) 2) [0..<length ts]) + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {0..<length ts} + 1 = sum_list (map ((^) 2) [0..<length ts]) + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
have "?S \<le> (\<Sum>t\<leftarrow>ts. 2^rank t)" (is "_ \<le> ?T")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ((^) 2) [0..<length ts]) \<le> (\<Sum>t\<leftarrow>ts. 2 ^ rank t)
[PROOF STEP]
using sorted_wrt_less_idx[OF ASC]
[PROOF STATE]
proof (prove)
using this:
?i < length (map rank ts) \<Longrightarrow> ?i \<le> map rank ts ! ?i

goal (1 subgoal):
 1. sum_list (map ((^) 2) [0..<length ts]) \<le> (\<Sum>t\<leftarrow>ts. 2 ^ rank t)
[PROOF STEP]
by(simp add: sum_list_mono2)
[PROOF STATE]
proof (state)
this:
sum_list (map ((^) 2) [0..<length ts]) \<le> (\<Sum>t\<leftarrow>ts. 2 ^ rank t)

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ((^) 2) [0..<length ts]) \<le> (\<Sum>t\<leftarrow>ts. 2 ^ rank t)

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
have "?T + 1 \<le> (\<Sum>t\<leftarrow>ts. size (mset_tree t)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>ts. 2 ^ rank t) + 1 \<le> (\<Sum>t\<leftarrow>ts. size (mset_tree t)) + 1
[PROOF STEP]
using TINV
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>set ts. bheap t

goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>ts. 2 ^ rank t) + 1 \<le> (\<Sum>t\<leftarrow>ts. size (mset_tree t)) + 1
[PROOF STEP]
by (auto cong: map_cong simp: size_mset_tree)
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>ts. 2 ^ rank t) + 1 \<le> (\<Sum>t\<leftarrow>ts. size (mset_tree t)) + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>ts. 2 ^ rank t) + 1 \<le> (\<Sum>t\<leftarrow>ts. size (mset_tree t)) + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
have "\<dots> = size (mset_trees ts) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>ts. size (mset_tree t)) + 1 = size (mset_trees ts) + 1
[PROOF STEP]
unfolding mset_trees_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>ts. size (mset_tree t)) + 1 = size (\<Sum>\<^sub># (image_mset mset_tree (mset ts))) + 1
[PROOF STEP]
by (induction ts) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>ts. size (mset_tree t)) + 1 = size (mset_trees ts) + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> x + 1 \<le> y + 1) \<Longrightarrow> 2 ^ length ts \<le> size (mset_trees ts) + 1
[PROOF STEP]
have "2^length ts \<le> size (mset_trees ts) + 1"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x + 1 \<le> y + 1) \<Longrightarrow> 2 ^ length ts \<le> size (mset_trees ts) + 1

goal (1 subgoal):
 1. 2 ^ length ts \<le> size (mset_trees ts) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ length ts \<le> size (mset_trees ts) + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ length ts \<le> size (mset_trees ts) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 ^ length ts \<le> size (mset_trees ts) + 1

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
using le_log2_of_power
[PROOF STATE]
proof (prove)
using this:
2 ^ length ts \<le> size (mset_trees ts) + 1
2 ^ ?n \<le> ?m \<Longrightarrow> real ?n \<le> log 2 (real ?m)

goal (1 subgoal):
 1. real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real (length ts) \<le> log 2 (real (size (mset_trees ts) + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) pow_eq_nat_mod:
  assumes "a \<in> carrier G" "a [^] n = a [^] m"
  shows "n mod (ord a) = m mod (ord a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n mod ord a = m mod ord a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n mod ord a = m mod ord a
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<in> carrier G
a [^] n = a [^] m
[PROOF STEP]
have "a [^] (n - m) = \<one>"
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
a [^] n = a [^] m

goal (1 subgoal):
 1. a [^] (n - m) = \<one>
[PROOF STEP]
using pow_eq_div2
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
a [^] n = a [^] m
\<lbrakk>?x \<in> carrier G; ?x [^] ?m = ?x [^] ?n\<rbrakk> \<Longrightarrow> ?x [^] (?m - ?n) = \<one>

goal (1 subgoal):
 1. a [^] (n - m) = \<one>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a [^] (n - m) = \<one>

goal (1 subgoal):
 1. n mod ord a = m mod ord a
[PROOF STEP]
hence "ord a dvd n - m"
[PROOF STATE]
proof (prove)
using this:
a [^] (n - m) = \<one>

goal (1 subgoal):
 1. ord a dvd n - m
[PROOF STEP]
using assms(1) pow_eq_id
[PROOF STATE]
proof (prove)
using this:
a [^] (n - m) = \<one>
a \<in> carrier G
?x \<in> carrier G \<Longrightarrow> (?x [^] ?n = \<one>) = (ord ?x dvd ?n)

goal (1 subgoal):
 1. ord a dvd n - m
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ord a dvd n - m

goal (1 subgoal):
 1. n mod ord a = m mod ord a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ord a dvd n - m

goal (1 subgoal):
 1. n mod ord a = m mod ord a
[PROOF STEP]
by (metis assms mod_eq_dvd_iff_nat nat_le_linear pow_eq_div2 pow_eq_id)
[PROOF STATE]
proof (state)
this:
n mod ord a = m mod ord a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power_inductl: "z + x \<cdot> y \<le> y \<Longrightarrow> (x ^ n) \<cdot> z \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z + x \<cdot> y \<le> y \<Longrightarrow> x ^ n \<cdot> z \<le> y
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z + x \<cdot> y \<le> y \<Longrightarrow> x ^ 0 \<cdot> z \<le> y
 2. \<And>n. \<lbrakk>z + x \<cdot> y \<le> y \<Longrightarrow> x ^ n \<cdot> z \<le> y; z + x \<cdot> y \<le> y\<rbrakk> \<Longrightarrow> x ^ Suc n \<cdot> z \<le> y
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
z + x \<cdot> y \<le> y

goal (2 subgoals):
 1. z + x \<cdot> y \<le> y \<Longrightarrow> x ^ 0 \<cdot> z \<le> y
 2. \<And>n. \<lbrakk>z + x \<cdot> y \<le> y \<Longrightarrow> x ^ n \<cdot> z \<le> y; z + x \<cdot> y \<le> y\<rbrakk> \<Longrightarrow> x ^ Suc n \<cdot> z \<le> y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 0 \<cdot> z \<le> y
[PROOF STEP]
using "0.prems"
[PROOF STATE]
proof (prove)
using this:
z + x \<cdot> y \<le> y

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>z + x \<cdot> y \<le> y \<Longrightarrow> x ^ n \<cdot> z \<le> y; z + x \<cdot> y \<le> y\<rbrakk> \<Longrightarrow> x ^ Suc n \<cdot> z \<le> y
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
z + x \<cdot> y \<le> y \<Longrightarrow> x ^ n_ \<cdot> z \<le> y
z + x \<cdot> y \<le> y

goal (1 subgoal):
 1. \<And>n. \<lbrakk>z + x \<cdot> y \<le> y \<Longrightarrow> x ^ n \<cdot> z \<le> y; z + x \<cdot> y \<le> y\<rbrakk> \<Longrightarrow> x ^ Suc n \<cdot> z \<le> y
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
z + x \<cdot> y \<le> y \<Longrightarrow> x ^ n_ \<cdot> z \<le> y
z + x \<cdot> y \<le> y

goal (1 subgoal):
 1. x ^ Suc n_ \<cdot> z \<le> y
[PROOF STEP]
by (auto, metis mult.assoc mult_isol order_trans)
[PROOF STATE]
proof (state)
this:
x ^ Suc n_ \<cdot> z \<le> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma even_plus_one_odd[simp]: "x mod 2 = 0 \<Longrightarrow> Suc x mod 2 = Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_even x \<Longrightarrow> Suc x mod 2 = Suc 0
[PROOF STEP]
by arith


[STATEMENT]
lemma i_even_power [simp]: "\<i> ^ (n * 2) = (-1) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> ^ (n * 2) = (- 1) ^ n
[PROOF STEP]
by (metis mult.commute power2_i power_mult)


[STATEMENT]
lemma dlex_pm_plus_monotone: "dlex_pm s t \<Longrightarrow> dlex_pm (s + u) (t + u)"
  for s t::"_ \<Rightarrow>\<^sub>0 _::{ordered_ab_semigroup_add_imp_le, ordered_cancel_comm_monoid_add}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dlex_pm s t \<Longrightarrow> dlex_pm (s + u) (t + u)
[PROOF STEP]
unfolding dlex_pm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dord_pm lex_pm s t \<Longrightarrow> dord_pm lex_pm (s + u) (t + u)
[PROOF STEP]
using lex_pm_plus_monotone
[PROOF STATE]
proof (prove)
using this:
lex_pm ?s ?t \<Longrightarrow> lex_pm (?s + ?u) (?t + ?u)

goal (1 subgoal):
 1. dord_pm lex_pm s t \<Longrightarrow> dord_pm lex_pm (s + u) (t + u)
[PROOF STEP]
by (rule dord_pm_plus_monotone)


[STATEMENT]
lemma lemma_Infinitesimal: "(\<forall>r. 0 < r \<longrightarrow> x < r) \<longleftrightarrow> (\<forall>n. x < inverse (real (Suc n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>r>0. x < r) = (\<forall>n. x < inverse (real (Suc n)))
[PROOF STEP]
by (meson inverse_positive_iff_positive less_trans of_nat_0_less_iff reals_Archimedean zero_less_Suc)


[STATEMENT]
lemma "(\<not> (a::nat) < b) = (a \<ge> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> a < b) = (b \<le> a)
[PROOF STEP]
by (metis not_le)


[STATEMENT]
lemma continuous_within_tan [continuous_intros]:
  fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
  shows "continuous (at x within s) f \<Longrightarrow>
    cos (f x) \<noteq> 0 \<Longrightarrow> continuous (at x within s) (\<lambda>x. tan (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous (at x within s) f; cos (f x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> continuous (at x within s) (\<lambda>x. tan (f x))
[PROOF STEP]
unfolding continuous_within
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f x) (at x within s); cos (f x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. tan (f x)) \<longlongrightarrow> tan (f x)) (at x within s)
[PROOF STEP]
by (rule tendsto_tan)


[STATEMENT]
lemma effective_matrix_match_condn_1:
 assumes "(matrix_match A1 A2 B1 B2) "
 shows "\<forall>i j.((i<(row_length A1)*(row_length B1))
             \<and>(j<(length A2)*(length B2))
              \<longrightarrow>   ((A1 \<circ>  A2)\<otimes>(B1 \<circ> B2))!j!i
                        =  f
                            (scalar_product
                                  (row A1 (i div (row_length B1)))
                                  (col A2  (j div (length B2))))
                            (scalar_product
                                  (row B1 (i mod (row_length B1)))
                                  (col B2 (j mod (length B2)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i j. i < row_length A1 * row_length B1 \<and> j < length A2 * length B2 \<longrightarrow> (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
using assms matrix_match_condn_1
[PROOF STATE]
proof (prove)
using this:
matrix_match A1 A2 B1 B2
matrix_match ?A1.0 ?A2.0 ?B1.0 ?B2.0 \<and> ?i < row_length ?A1.0 * row_length ?B1.0 \<and> ?j < length ?A2.0 * length ?B2.0 \<Longrightarrow> (?A1.0 \<circ> ?A2.0 \<otimes> ?B1.0 \<circ> ?B2.0) ! ?j ! ?i = scalar_product (row ?A1.0 (?i div row_length ?B1.0)) (col ?A2.0 (?j div length ?B2.0)) * scalar_product (row ?B1.0 (?i mod row_length ?B1.0)) (col ?B2.0 (?j mod length ?B2.0))

goal (1 subgoal):
 1. \<forall>i j. i < row_length A1 * row_length B1 \<and> j < length A2 * length B2 \<longrightarrow> (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
unfolding matrix_match_def
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1) (length A1) A1 \<and> mat (row_length A2) (length A2) A2 \<and> mat (row_length B1) (length B1) B1 \<and> mat (row_length B2) (length B2) B2 \<and> length A1 = row_length A2 \<and> length B1 = row_length B2 \<and> A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
(mat (row_length ?A1.0) (length ?A1.0) ?A1.0 \<and> mat (row_length ?A2.0) (length ?A2.0) ?A2.0 \<and> mat (row_length ?B1.0) (length ?B1.0) ?B1.0 \<and> mat (row_length ?B2.0) (length ?B2.0) ?B2.0 \<and> length ?A1.0 = row_length ?A2.0 \<and> length ?B1.0 = row_length ?B2.0 \<and> ?A1.0 \<noteq> [] \<and> ?A2.0 \<noteq> [] \<and> ?B1.0 \<noteq> [] \<and> ?B2.0 \<noteq> []) \<and> ?i < row_length ?A1.0 * row_length ?B1.0 \<and> ?j < length ?A2.0 * length ?B2.0 \<Longrightarrow> (?A1.0 \<circ> ?A2.0 \<otimes> ?B1.0 \<circ> ?B2.0) ! ?j ! ?i = scalar_product (row ?A1.0 (?i div row_length ?B1.0)) (col ?A2.0 (?j div length ?B2.0)) * scalar_product (row ?B1.0 (?i mod row_length ?B1.0)) (col ?B2.0 (?j mod length ?B2.0))

goal (1 subgoal):
 1. \<forall>i j. i < row_length A1 * row_length B1 \<and> j < length A2 * length B2 \<longrightarrow> (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
by auto


[STATEMENT]
lemma Conjunctive_distr_disj:
  assumes "Conjunctive(HC)"
  shows "HC(P \<or> Q) = (HC(P) \<or> HC(Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HC (P \<or> Q) = (HC P \<or> HC Q)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Conjunctive HC

goal (1 subgoal):
 1. HC (P \<or> Q) = (HC P \<or> HC Q)
[PROOF STEP]
unfolding Conjunctive_def
[PROOF STATE]
proof (prove)
using this:
\<exists>Q. \<forall>P. HC P = (P \<and> Q)

goal (1 subgoal):
 1. HC (P \<or> Q) = (HC P \<or> HC Q)
[PROOF STEP]
using utp_pred_laws.inf_sup_distrib2
[PROOF STATE]
proof (prove)
using this:
\<exists>Q. \<forall>P. HC P = (P \<and> Q)
((?y \<or> ?z) \<and> ?x) = (?y \<and> ?x \<or> ?z \<and> ?x)

goal (1 subgoal):
 1. HC (P \<or> Q) = (HC P \<or> HC Q)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma le_div_conv: "0 < (m::nat) \<Longrightarrow> (n \<le> k div m) = (n * m \<le> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (n \<le> k div m) = (n * m \<le> k)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; n \<le> k div m\<rbrakk> \<Longrightarrow> n * m \<le> k
 2. \<lbrakk>0 < m; n * m \<le> k\<rbrakk> \<Longrightarrow> n \<le> k div m
[PROOF STEP]
apply (drule mult_le_mono1[of _ _ m])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; n * m \<le> k div m * m\<rbrakk> \<Longrightarrow> n * m \<le> k
 2. \<lbrakk>0 < m; n * m \<le> k\<rbrakk> \<Longrightarrow> n \<le> k div m
[PROOF STEP]
apply (simp add: div_mult_cancel)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; n * m \<le> k\<rbrakk> \<Longrightarrow> n \<le> k div m
[PROOF STEP]
apply (drule div_le_mono[of _ _ m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; n * m div m \<le> k div m\<rbrakk> \<Longrightarrow> n \<le> k div m
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gen_binomial_complex'':
  fixes x y :: real and a :: complex
  assumes "\<bar>y\<bar> < \<bar>x\<bar>"
  shows   "(\<lambda>n. (a gchoose n) * of_real x powr (a - of_nat n) * of_real y ^ n) sums
               of_real (x + y) powr a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (a gchoose n) * complex_of_real x powr (a - of_nat n) * complex_of_real y ^ n) sums complex_of_real (x + y) powr a
[PROOF STEP]
using gen_binomial_complex'[OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (?a gchoose n) * complex_of_real y ^ n * complex_of_real x powr (?a - of_nat n)) sums complex_of_real (y + x) powr ?a

goal (1 subgoal):
 1. (\<lambda>n. (a gchoose n) * complex_of_real x powr (a - of_nat n) * complex_of_real y ^ n) sums complex_of_real (x + y) powr a
[PROOF STEP]
by (simp add: mult_ac add.commute)


[STATEMENT]
lemma E_bernoulli: "0\<le>p \<Longrightarrow> p\<le>1 \<Longrightarrow>
        E (map_pmf f (bernoulli_pmf p)) = p*(f True) + (1-p)*(f False)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> p; p \<le> 1\<rbrakk> \<Longrightarrow> E (map_pmf f (bernoulli_pmf p)) = p * f True + (1 - p) * f False
[PROOF STEP]
unfolding E_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> p; p \<le> 1\<rbrakk> \<Longrightarrow> measure_pmf.expectation (map_pmf f (bernoulli_pmf p)) (\<lambda>x. x) = p * f True + (1 - p) * f False
[PROOF STEP]
by (auto)


[STATEMENT]
lemma EM_remainder'_conv_Suc:
  "EM_remainder' n f a b =
     ((-1) ^ Suc n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (f b - f a) +
     EM_remainder' (Suc n) f' a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EM_remainder' n f (real_of_int a) (real_of_int b) = ((- 1) ^ Suc n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) + EM_remainder' (Suc n) f' (real_of_int a) (real_of_int b)
[PROOF STEP]
by (simp add: EM_remainder'_def EM_remainder'_integral_conv_Suc scaleR_diff_right
                scaleR_add_right field_simps del: of_nat_Suc)


[STATEMENT]
lemma permutep_comp: "bij f \<Longrightarrow> bij g \<Longrightarrow> permutep (f \<circ> g) = permutep g \<circ> permutep f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij f; bij g\<rbrakk> \<Longrightarrow> permutep (f \<circ> g) = permutep g \<circ> permutep f
[PROOF STEP]
by transfer' (auto simp: fun_eq_iff bij_comp)


[STATEMENT]
lemma geom_nat:
  fixes q :: nat
  fixes x :: "_ :: {comm_ring,monoid_mult}"
  shows "(x-1) * (\<Sum>i \<in> {..<q}. x^i) = x^q-1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - (1::'d)) * sum ((^) x) {..<q} = x ^ q - (1::'d)
[PROOF STEP]
by (induction q, auto simp:algebra_simps)