[STATEMENT]
lemma jumpF_pathfinish_linepath:
  "jumpF_pathfinish (linepath a b) z =
    (if Re b = Re z \<and> Im b \<noteq>Im z \<and> Re b \<noteq> Re a then
        if (Im b>Im z \<and> Re a > Re b) \<or> (Im b<Im z \<and> Re a < Re b) then 1/2 else -1/2
     else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
define f where "f=(\<lambda>t. (Im b - Im a )* t + (Im a - Im z))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>t. (Im b - Im a) * t + (Im a - Im z))

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
define g where "g=(\<lambda>t. (Re b - Re a )* t + (Re a - Re z))"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>t. (Re b - Re a) * t + (Re a - Re z))

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have jump_eq:"jumpF_pathfinish (linepath a b) z = jumpF (\<lambda>t. f t/g t) (at_left 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = jumpF (\<lambda>t. f t / g t) (at_left 1)
[PROOF STEP]
unfolding jumpF_pathfinish_def f_def linepath_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF (\<lambda>t. Im ((1 - t) *\<^sub>R a + t *\<^sub>R b - z) / Re ((1 - t) *\<^sub>R a + t *\<^sub>R b - z)) (at_left 1) = jumpF (\<lambda>t. ((Im b - Im a) * t + (Im a - Im z)) / ((Re b - Re a) * t + (Re a - Re z))) (at_left 1)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
jumpF_pathfinish (linepath a b) z = jumpF (\<lambda>t. f t / g t) (at_left 1)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have ?thesis when "Re b\<noteq>Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have "jumpF_pathfinish (linepath a b) z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = 0
[PROOF STEP]
unfolding jumpF_pathfinish_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) (at_left 1) = 0
[PROOF STEP]
apply (rule jumpF_im_divide_Re_0)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. path (\<lambda>t. linepath a b t - z)
 2. Re (linepath a b 1 - z) \<noteq> 0
 3. 0 < 1
 4. 1 \<le> 1
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (linepath a b 1) = Re z \<Longrightarrow> False
[PROOF STEP]
by (auto simp add:linepath_def that)
[PROOF STATE]
proof (state)
this:
jumpF_pathfinish (linepath a b) z = 0

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
jumpF_pathfinish (linepath a b) z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jumpF_pathfinish (linepath a b) z = 0

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
jumpF_pathfinish (linepath a b) z = 0
Re b \<noteq> Re z

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Re b \<noteq> Re z \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Re b \<noteq> Re z \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have ?thesis when "Re z=Re b" "Im z = Im b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
define c where "c=(Im a - Im b) / (Re a - Re b)"
[PROOF STATE]
proof (state)
this:
c = (Im a - Im b) / (Re a - Re b)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have "jumpF (\<lambda>t. f t/g t) (at_left 1) = jumpF (\<lambda>_. c) (at_left 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. c) (at_left 1)
[PROOF STEP]
proof (rule jumpF_cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. at_left 1 = at_left 1
 2. \<forall>\<^sub>F x in at_left 1. f x / g x = c
[PROOF STEP]
have "f x / g x = c" when "x<1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x / g x = c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x / g x = c
[PROOF STEP]
have "f x / g x = ((Im a - Im b)*(1-x))/((Re a - Re b)*(1-x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x / g x = (Im a - Im b) * (1 - x) / ((Re a - Re b) * (1 - x))
[PROOF STEP]
unfolding f_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((Im b - Im a) * x + (Im a - Im z)) / ((Re b - Re a) * x + (Re a - Re z)) = (Im a - Im b) * (1 - x) / ((Re a - Re b) * (1 - x))
[PROOF STEP]
by (auto simp add:algebra_simps \<open>Re z=Re b\<close> \<open>Im z = Im b\<close>)
[PROOF STATE]
proof (state)
this:
f x / g x = (Im a - Im b) * (1 - x) / ((Re a - Re b) * (1 - x))

goal (1 subgoal):
 1. f x / g x = c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f x / g x = (Im a - Im b) * (1 - x) / ((Re a - Re b) * (1 - x))

goal (1 subgoal):
 1. f x / g x = c
[PROOF STEP]
have "... = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Im a - Im b) * (1 - x) / ((Re a - Re b) * (1 - x)) = c
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x < 1

goal (1 subgoal):
 1. (Im a - Im b) * (1 - x) / ((Re a - Re b) * (1 - x)) = c
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
using this:
x < 1

goal (1 subgoal):
 1. (Im a - Im b) * (1 - x) / ((Re a - Re b) * (1 - x)) = (Im a - Im b) / (Re a - Re b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Im a - Im b) * (1 - x) / ((Re a - Re b) * (1 - x)) = c

goal (1 subgoal):
 1. f x / g x = c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f x / g x = c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f x / g x = c

goal (1 subgoal):
 1. f x / g x = c
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f x / g x = c

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x < 1 \<Longrightarrow> f ?x / g ?x = c

goal (2 subgoals):
 1. at_left 1 = at_left 1
 2. \<forall>\<^sub>F x in at_left 1. f x / g x = c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x < 1 \<Longrightarrow> f ?x / g ?x = c
[PROOF STEP]
show "\<forall>\<^sub>F x in at_left 1. f x / g x = c"
[PROOF STATE]
proof (prove)
using this:
?x < 1 \<Longrightarrow> f ?x / g ?x = c

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_left 1. f x / g x = c
[PROOF STEP]
unfolding eventually_at_left
[PROOF STATE]
proof (prove)
using this:
?x < 1 \<Longrightarrow> f ?x / g ?x = c

goal (1 subgoal):
 1. \<exists>b<1. \<forall>y>b. y < 1 \<longrightarrow> f y / g y = c
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?x < 1 \<Longrightarrow> f ?x / g ?x = c
Re z = Re b
Im z = Im b

goal (1 subgoal):
 1. \<exists>b<1. \<forall>y>b. y < 1 \<longrightarrow> f y / g y = c
[PROOF STEP]
apply (intro exI[where x=0])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x < 1 \<Longrightarrow> f x / g x = c; Re z = Re b; Im z = Im b\<rbrakk> \<Longrightarrow> 0 < 1 \<and> (\<forall>y>0. y < 1 \<longrightarrow> f y / g y = c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_left 1. f x / g x = c

goal (1 subgoal):
 1. at_left 1 = at_left 1
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. c) (at_left 1)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. c) (at_left 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. c) (at_left 1)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
using jump_eq that
[PROOF STATE]
proof (prove)
using this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. c) (at_left 1)
jumpF_pathfinish (linepath a b) z = jumpF (\<lambda>t. f t / g t) (at_left 1)
Re z = Re b
Im z = Im b

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re z = Re b; Im z = Im b\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re z = Re b; Im z = Im b\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have ?thesis when "Re a=Re z" "Re b = Re a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have "(\<lambda>t. f t/g t) = (\<lambda>_. 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. f t / g t) = (\<lambda>_. 0)
[PROOF STEP]
unfolding f_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. ((Im b - Im a) * t + (Im a - Im z)) / ((Re b - Re a) * t + (Re a - Re z))) = (\<lambda>_. 0)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re a = Re z
Re b = Re a

goal (1 subgoal):
 1. (\<lambda>t. ((Im b - Im a) * t + (Im a - Im z)) / ((Re b - Re a) * t + (Re a - Re z))) = (\<lambda>_. 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>t. f t / g t) = (\<lambda>_. 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>t. f t / g t) = (\<lambda>_. 0)
[PROOF STEP]
have "jumpF (\<lambda>t. f t/g t) (at_left 1) = jumpF (\<lambda>_. 0) (at_left 1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>t. f t / g t) = (\<lambda>_. 0)

goal (1 subgoal):
 1. jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. 0) (at_left 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. 0) (at_left 1)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. 0) (at_left 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. 0) (at_left 1)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
using jump_eq that
[PROOF STATE]
proof (prove)
using this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = jumpF (\<lambda>_. 0) (at_left 1)
jumpF_pathfinish (linepath a b) z = jumpF (\<lambda>t. f t / g t) (at_left 1)
Re a = Re z
Re b = Re a

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re a = Re z; Re b = Re a\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re a = Re z; Re b = Re a\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have ?thesis when "Re b = Re z" "(Im b>Im z \<and> Re a > Re b) \<or> (Im b<Im z \<and> Re a < Re b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have "LIM x at_left 1. f x / g x :> at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_top
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_top
[PROOF STEP]
have "(g has_real_derivative Re b - Re a) (at 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_real_derivative Re b - Re a) (at 1)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_real_derivative Re b - Re a) (at 1)
[PROOF STEP]
by (auto intro!:derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
(g has_real_derivative Re b - Re a) (at 1)

goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_top
[PROOF STEP]
from has_sgnx_derivative_at_left[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>g 1 = 0; Re b - Re a \<noteq> 0\<rbrakk> \<Longrightarrow> (g has_sgnx - sgn (Re b - Re a)) (at_left 1)
[PROOF STEP]
have "(g has_sgnx sgn (Im b - Im z)) (at_left 1)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>g 1 = 0; Re b - Re a \<noteq> 0\<rbrakk> \<Longrightarrow> (g has_sgnx - sgn (Re b - Re a)) (at_left 1)

goal (1 subgoal):
 1. (g has_sgnx sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>g 1 = 0; Re b - Re a \<noteq> 0\<rbrakk> \<Longrightarrow> (g has_sgnx - sgn (Re b - Re a)) (at_left 1)
Re b = Re z
Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b

goal (1 subgoal):
 1. (g has_sgnx sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(Re b - Re a) * 1 + (Re a - Re z) = 0; Re b - Re a \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Re b - Re a)) (at_left 1)
Re b = Re z
Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b

goal (1 subgoal):
 1. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(g has_sgnx sgn (Im b - Im z)) (at_left 1)

goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_top
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(g has_sgnx sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(g has_sgnx sgn (Im b - Im z)) (at_left 1)

goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_top
[PROOF STEP]
apply (subst filterlim_divide_at_bot_at_top_iff[of _ "Im b - Im z"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (g has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> (f \<longlongrightarrow> Im b - Im z) (at_left 1)
 2. (g has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> Im b - Im z \<noteq> 0
 3. (g has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> (g \<longlongrightarrow> 0) (at_left 1) \<and> (g has_sgnx sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
unfolding f_def g_def
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> ((\<lambda>t. (Im b - Im a) * t + (Im a - Im z)) \<longlongrightarrow> Im b - Im z) (at_left 1)
 2. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> Im b - Im z \<noteq> 0
 3. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) \<longlongrightarrow> 0) (at_left 1) \<and> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re b = Re z
Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b

goal (3 subgoals):
 1. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> ((\<lambda>t. (Im b - Im a) * t + (Im a - Im z)) \<longlongrightarrow> Im b - Im z) (at_left 1)
 2. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> Im b - Im z \<noteq> 0
 3. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) \<longlongrightarrow> 0) (at_left 1) \<and> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
by (auto intro!:tendsto_eq_intros)
[PROOF STATE]
proof (state)
this:
LIM x at_left 1. f x / g x :> at_top

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LIM x at_left 1. f x / g x :> at_top

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x at_left 1. f x / g x :> at_top
[PROOF STEP]
have "jumpF (\<lambda>t. f t/g t) (at_left 1) = 1/2"
[PROOF STATE]
proof (prove)
using this:
LIM x at_left 1. f x / g x :> at_top

goal (1 subgoal):
 1. jumpF (\<lambda>t. f t / g t) (at_left 1) = 1 / 2
[PROOF STEP]
unfolding jumpF_def
[PROOF STATE]
proof (prove)
using this:
LIM x at_left 1. f x / g x :> at_top

goal (1 subgoal):
 1. (if LIM t at_left 1. f t / g t :> at_top then 1 / 2 else if LIM t at_left 1. f t / g t :> at_bot then - 1 / 2 else 0) = 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = 1 / 2

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = 1 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = 1 / 2

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
using jump_eq that
[PROOF STATE]
proof (prove)
using this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = 1 / 2
jumpF_pathfinish (linepath a b) z = jumpF (\<lambda>t. f t / g t) (at_left 1)
Re b = Re z
Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re b = Re z; Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re b = Re z; Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have ?thesis when "Re b = Re z" "Im b\<noteq>Im z" "Re b \<noteq> Re a"
      "\<not> ((Im b>Im z \<and> Re a > Re b) \<or> (Im b<Im z \<and> Re a < Re b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have "(Im b>Im z \<and> Re a < Re b) \<or> (Im b<Im z \<and> Re a > Re b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im z < Im b \<and> Re a < Re b \<or> Im b < Im z \<and> Re b < Re a
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re b = Re z
Im b \<noteq> Im z
Re b \<noteq> Re a
\<not> (Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b)

goal (1 subgoal):
 1. Im z < Im b \<and> Re a < Re b \<or> Im b < Im z \<and> Re b < Re a
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
Im z < Im b \<and> Re a < Re b \<or> Im b < Im z \<and> Re b < Re a

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have "LIM x at_left 1. f x / g x :> at_bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_bot
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_bot
[PROOF STEP]
have "(g has_real_derivative Re b - Re a) (at 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_real_derivative Re b - Re a) (at 1)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_real_derivative Re b - Re a) (at 1)
[PROOF STEP]
by (auto intro!:derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
(g has_real_derivative Re b - Re a) (at 1)

goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_bot
[PROOF STEP]
from has_sgnx_derivative_at_left[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>g 1 = 0; Re b - Re a \<noteq> 0\<rbrakk> \<Longrightarrow> (g has_sgnx - sgn (Re b - Re a)) (at_left 1)
[PROOF STEP]
have "(g has_sgnx - sgn (Im b - Im z)) (at_left 1)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>g 1 = 0; Re b - Re a \<noteq> 0\<rbrakk> \<Longrightarrow> (g has_sgnx - sgn (Re b - Re a)) (at_left 1)

goal (1 subgoal):
 1. (g has_sgnx - sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>g 1 = 0; Re b - Re a \<noteq> 0\<rbrakk> \<Longrightarrow> (g has_sgnx - sgn (Re b - Re a)) (at_left 1)
Re b = Re z
Im b \<noteq> Im z
Re b \<noteq> Re a
\<not> (Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b)

goal (1 subgoal):
 1. (g has_sgnx - sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(Re b - Re a) * 1 + (Re a - Re z) = 0; Re b - Re a \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Re b - Re a)) (at_left 1)
Re b = Re z
Im b \<noteq> Im z
Re b \<noteq> Re a
\<not> (Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b)

goal (1 subgoal):
 1. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(g has_sgnx - sgn (Im b - Im z)) (at_left 1)

goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_bot
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(g has_sgnx - sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(g has_sgnx - sgn (Im b - Im z)) (at_left 1)

goal (1 subgoal):
 1. LIM x at_left 1. f x / g x :> at_bot
[PROOF STEP]
apply (subst filterlim_divide_at_bot_at_top_iff[of _ "Im b - Im z"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (g has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> (f \<longlongrightarrow> Im b - Im z) (at_left 1)
 2. (g has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> Im b - Im z \<noteq> 0
 3. (g has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> (g \<longlongrightarrow> 0) (at_left 1) \<and> (g has_sgnx - sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
unfolding f_def g_def
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> ((\<lambda>t. (Im b - Im a) * t + (Im a - Im z)) \<longlongrightarrow> Im b - Im z) (at_left 1)
 2. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> Im b - Im z \<noteq> 0
 3. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) \<longlongrightarrow> 0) (at_left 1) \<and> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re b = Re z
Im b \<noteq> Im z
Re b \<noteq> Re a
\<not> (Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b)

goal (3 subgoals):
 1. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> ((\<lambda>t. (Im b - Im a) * t + (Im a - Im z)) \<longlongrightarrow> Im b - Im z) (at_left 1)
 2. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> Im b - Im z \<noteq> 0
 3. ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1) \<Longrightarrow> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) \<longlongrightarrow> 0) (at_left 1) \<and> ((\<lambda>t. (Re b - Re a) * t + (Re a - Re z)) has_sgnx - sgn (Im b - Im z)) (at_left 1)
[PROOF STEP]
by (auto intro!:tendsto_eq_intros )
[PROOF STATE]
proof (state)
this:
LIM x at_left 1. f x / g x :> at_bot

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LIM x at_left 1. f x / g x :> at_bot

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
LIM x at_left 1. f x / g x :> at_bot

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x at_left 1. f x / g x :> at_bot
[PROOF STEP]
have "\<not> (LIM x at_left 1. f x / g x :> at_top)"
[PROOF STATE]
proof (prove)
using this:
LIM x at_left 1. f x / g x :> at_bot

goal (1 subgoal):
 1. \<not> (LIM x at_left 1. f x / g x :> at_top)
[PROOF STEP]
using filterlim_at_top_at_bot
[PROOF STATE]
proof (prove)
using this:
LIM x at_left 1. f x / g x :> at_bot
\<lbrakk>filterlim ?f at_top ?F; filterlim ?f at_bot ?F; ?F \<noteq> bot\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> (LIM x at_left 1. f x / g x :> at_top)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<not> (LIM x at_left 1. f x / g x :> at_top)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
LIM x at_left 1. f x / g x :> at_bot
\<not> (LIM x at_left 1. f x / g x :> at_top)
[PROOF STEP]
have "jumpF (\<lambda>t. f t/g t) (at_left 1) = - 1/2"
[PROOF STATE]
proof (prove)
using this:
LIM x at_left 1. f x / g x :> at_bot
\<not> (LIM x at_left 1. f x / g x :> at_top)

goal (1 subgoal):
 1. jumpF (\<lambda>t. f t / g t) (at_left 1) = - 1 / 2
[PROOF STEP]
unfolding jumpF_def
[PROOF STATE]
proof (prove)
using this:
LIM x at_left 1. f x / g x :> at_bot
\<not> (LIM x at_left 1. f x / g x :> at_top)

goal (1 subgoal):
 1. (if LIM t at_left 1. f t / g t :> at_top then 1 / 2 else if LIM t at_left 1. f t / g t :> at_bot then - 1 / 2 else 0) = - 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = - 1 / 2

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = - 1 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = - 1 / 2

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
using jump_eq that
[PROOF STATE]
proof (prove)
using this:
jumpF (\<lambda>t. f t / g t) (at_left 1) = - 1 / 2
jumpF_pathfinish (linepath a b) z = jumpF (\<lambda>t. f t / g t) (at_left 1)
Re b = Re z
Im b \<noteq> Im z
Re b \<noteq> Re a
\<not> (Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re b = Re z; Im b \<noteq> Im z; Re b \<noteq> Re a; \<not> (Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b)\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Re b \<noteq> Re z \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
\<lbrakk>Re z = Re b; Im z = Im b\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
\<lbrakk>Re a = Re z; Re b = Re a\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
\<lbrakk>Re b = Re z; Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
\<lbrakk>Re b = Re z; Im b \<noteq> Im z; Re b \<noteq> Re a; \<not> (Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b)\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re b \<noteq> Re z \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
\<lbrakk>Re z = Re b; Im z = Im b\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
\<lbrakk>Re a = Re z; Re b = Re a\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
\<lbrakk>Re b = Re z; Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
\<lbrakk>Re b = Re z; Im b \<noteq> Im z; Re b \<noteq> Re a; \<not> (Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b)\<rbrakk> \<Longrightarrow> jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
jumpF_pathfinish (linepath a b) z = (if Re b = Re z \<and> Im b \<noteq> Im z \<and> Re b \<noteq> Re a then if Im z < Im b \<and> Re b < Re a \<or> Im b < Im z \<and> Re a < Re b then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wf_less_multiset: "wf {(M :: 'a multiset, N). M < N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(M, N). M < N}
[PROOF STEP]
unfolding less_multiset_def multp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(M, N). (M, N) \<in> mult {(x, y). x < y}}
[PROOF STEP]
by (auto intro: wf_mult wf)


[STATEMENT]
theorem hoare_fixpoint_mbt:
  "F x = x
     \<Longrightarrow> (!! (w::'a::well_founded) f . (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q)
     \<Longrightarrow> hoare (p u) x q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F x = x; \<And>w f. (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q\<rbrakk> \<Longrightarrow> hoare (p u) x q
[PROOF STEP]
apply (rule less_induct1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>F x = x; \<And>w f. (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q; \<And>y. y < xa \<Longrightarrow> hoare (p y) x q\<rbrakk> \<Longrightarrow> hoare (p xa) x q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>F x = x; \<And>w f. (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q; \<And>y. y < xa \<Longrightarrow> hoare (p y) x q\<rbrakk> \<Longrightarrow> hoare (p xa) x q
[PROOF STEP]
fix xa
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>F x = x; \<And>w f. (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q; \<And>y. y < xa \<Longrightarrow> hoare (p y) x q\<rbrakk> \<Longrightarrow> hoare (p xa) x q
[PROOF STEP]
assume A: "\<And> w f. (\<And> v . v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q"
[PROOF STATE]
proof (state)
this:
(\<And>v. v < ?w \<Longrightarrow> hoare (p v) ?f q) \<Longrightarrow> hoare (p ?w) (F ?f) q

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>F x = x; \<And>w f. (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q; \<And>y. y < xa \<Longrightarrow> hoare (p y) x q\<rbrakk> \<Longrightarrow> hoare (p xa) x q
[PROOF STEP]
assume B: "F x  = x"
[PROOF STATE]
proof (state)
this:
F x = x

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>F x = x; \<And>w f. (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q; \<And>y. y < xa \<Longrightarrow> hoare (p y) x q\<rbrakk> \<Longrightarrow> hoare (p xa) x q
[PROOF STEP]
assume C: "\<And>y . y < xa \<Longrightarrow> hoare (p y) x q"
[PROOF STATE]
proof (state)
this:
?y < xa \<Longrightarrow> hoare (p ?y) x q

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>F x = x; \<And>w f. (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q; \<And>y. y < xa \<Longrightarrow> hoare (p y) x q\<rbrakk> \<Longrightarrow> hoare (p xa) x q
[PROOF STEP]
have D: "hoare (p xa) (F x) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hoare (p xa) (F x) q
[PROOF STEP]
apply (rule A)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. v < xa \<Longrightarrow> hoare (p v) x q
[PROOF STEP]
by (rule C, simp)
[PROOF STATE]
proof (state)
this:
hoare (p xa) (F x) q

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>F x = x; \<And>w f. (\<And>v. v < w \<Longrightarrow> hoare (p v) f q) \<Longrightarrow> hoare (p w) (F f) q; \<And>y. y < xa \<Longrightarrow> hoare (p y) x q\<rbrakk> \<Longrightarrow> hoare (p xa) x q
[PROOF STEP]
show "hoare (p xa) x q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hoare (p xa) x q
[PROOF STEP]
by (cut_tac D, simp add: B)
[PROOF STATE]
proof (state)
this:
hoare (p xa) x q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fold_coeffs_monom [simp]: "a \<noteq> 0 \<Longrightarrow> fold_coeffs f (monom a n) = f 0 ^^ n \<circ> f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> fold_coeffs f (monom a n) = f (0::'a) ^^ n \<circ> f a
[PROOF STEP]
by (simp add: fold_coeffs_def coeffs_monom fun_eq_iff)


[STATEMENT]
lemma (in Order) gt_than_any_outside:"\<lbrakk>A \<subseteq> carrier D; b \<in> carrier D;
       \<forall>x\<in>A. x \<prec> b\<rbrakk> \<Longrightarrow> b \<notin> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> carrier D; b \<in> carrier D; \<forall>x\<in>A. x \<prec> b\<rbrakk> \<Longrightarrow> b \<notin> A
[PROOF STEP]
apply (rule contrapos_pp, simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> carrier D; b \<in> carrier D; \<forall>x\<in>A. x \<prec> b; b \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (frule_tac x = b in bspec)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<subseteq> carrier D; b \<in> carrier D; \<forall>x\<in>A. x \<prec> b; b \<in> A\<rbrakk> \<Longrightarrow> b \<in> A
 2. \<lbrakk>A \<subseteq> carrier D; b \<in> carrier D; \<forall>x\<in>A. x \<prec> b; b \<in> A; b \<prec> b\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply  (assumption,
       thin_tac "\<forall>x\<in>A. x \<prec> b", simp add:oless_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma size_lower_result': "size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)
[PROOF STEP]
define f where "f = (\<lambda>C. image_mset (\<lambda>z. if z = y then x else z) C)"
[PROOF STATE]
proof (state)
this:
f = image_mset (\<lambda>z. if z = y then x else z)

goal (1 subgoal):
 1. size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)
[PROOF STEP]
have "size (lower_result C) = size (f C - {#x#})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (lower_result C) = size (f C - {#x#})
[PROOF STEP]
by (simp add: lower_result_def f_def)
[PROOF STATE]
proof (state)
this:
size (lower_result C) = size (f C - {#x#})

goal (1 subgoal):
 1. size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size (lower_result C) = size (f C - {#x#})

goal (1 subgoal):
 1. size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)
[PROOF STEP]
have "\<dots> = size (f C) - (if x \<in># f C then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (f C - {#x#}) = size (f C) - (if x \<in># f C then 1 else 0)
[PROOF STEP]
by (simp add: diff_single_trivial size_Diff_singleton)
[PROOF STATE]
proof (state)
this:
size (f C - {#x#}) = size (f C) - (if x \<in># f C then 1 else 0)

goal (1 subgoal):
 1. size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size (lower_result C) = size (f C) - (if x \<in># f C then 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size (lower_result C) = size (f C) - (if x \<in># f C then 1 else 0)

goal (1 subgoal):
 1. size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)
[PROOF STEP]
by (auto simp: f_def)
[PROOF STATE]
proof (state)
this:
size (lower_result C) = size C - (if x \<in># C \<or> y \<in># C then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subspace_substandard_cart: "vec.subspace {x. (\<forall>i. P i \<longrightarrow> x$i = 0)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.subspace {x. \<forall>i. P i \<longrightarrow> x $ i = (0::'a)}
[PROOF STEP]
unfolding vec.subspace_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<in> {x. \<forall>i. P i \<longrightarrow> x $ i = (0::'a)} \<and> (\<forall>x\<in>{x. \<forall>i. P i \<longrightarrow> x $ i = (0::'a)}. \<forall>y\<in>{x. \<forall>i. P i \<longrightarrow> x $ i = (0::'a)}. x + y \<in> {x. \<forall>i. P i \<longrightarrow> x $ i = (0::'a)}) \<and> (\<forall>c. \<forall>x\<in>{x. \<forall>i. P i \<longrightarrow> x $ i = (0::'a)}. c *s x \<in> {x. \<forall>i. P i \<longrightarrow> x $ i = (0::'a)})
[PROOF STEP]
by auto


[STATEMENT]
lemma sublist_list_if_length: "
  length (sublist_list_if xs ys) = length (filter (\<lambda>i. i < length xs) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (sublist_list_if xs ys) = length (filter (\<lambda>i. i < length xs) ys)
[PROOF STEP]
by (simp add: sublist_list_if_sublist_list_filter_conv sublist_list_length)


[STATEMENT]
lemma strong_reduction_simulations_iff_bisimulation:
  fixes Rel :: "('proc \<times> 'proc) set"
    and Cal :: "'proc processCalculus"
  shows "(strong_reduction_simulation Rel Cal \<and> strong_reduction_simulation (Rel\<inverse>) Cal)
         = strong_reduction_bisimulation Rel Cal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (strong_reduction_simulation Rel Cal \<and> strong_reduction_simulation (Rel\<inverse>) Cal) = (strong_reduction_simulation Rel Cal \<and> (\<forall>P Q Q'. (P, Q) \<in> Rel \<and> Q \<longmapsto>Cal Q' \<longrightarrow> (\<exists>P'. P \<longmapsto>Cal P' \<and> (P', Q') \<in> Rel)))
[PROOF STEP]
using strong_reduction_simulations_impl_bisimulation[where Rel="Rel" and Cal="Cal"]
            strong_reduction_bisimulations_impl_inverse_is_simulation[where Rel="Rel"]
[PROOF STATE]
proof (prove)
using this:
strong_reduction_simulation Rel Cal \<and> strong_reduction_simulation (Rel\<inverse>) Cal \<Longrightarrow> strong_reduction_simulation Rel Cal \<and> (\<forall>P Q Q'. (P, Q) \<in> Rel \<and> Q \<longmapsto>Cal Q' \<longrightarrow> (\<exists>P'. P \<longmapsto>Cal P' \<and> (P', Q') \<in> Rel))
strong_reduction_simulation Rel ?Cal \<and> (\<forall>P Q Q'. (P, Q) \<in> Rel \<and> Q \<longmapsto>?Cal Q' \<longrightarrow> (\<exists>P'. P \<longmapsto>?Cal P' \<and> (P', Q') \<in> Rel)) \<Longrightarrow> strong_reduction_simulation (Rel\<inverse>) ?Cal

goal (1 subgoal):
 1. (strong_reduction_simulation Rel Cal \<and> strong_reduction_simulation (Rel\<inverse>) Cal) = (strong_reduction_simulation Rel Cal \<and> (\<forall>P Q Q'. (P, Q) \<in> Rel \<and> Q \<longmapsto>Cal Q' \<longrightarrow> (\<exists>P'. P \<longmapsto>Cal P' \<and> (P', Q') \<in> Rel)))
[PROOF STEP]
by blast


[STATEMENT]
lemma butlast_power: "(butlast ^^ n) xs = take (length xs - n) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (butlast ^^ n) xs = take (length xs - n) xs
[PROOF STEP]
by (induct n) (auto simp: butlast_take)


[STATEMENT]
lemma lcm_list_dvd_iff:
  "lcm_list xs dvd b  \<longleftrightarrow> (\<forall>a\<in>set xs. a dvd b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lcm_list xs dvd b) = (\<forall>a\<in>set xs. a dvd b)
[PROOF STEP]
by (simp add: Lcm_fin_dvd_iff)


[STATEMENT]
theorem size_less_than_median_of_medians:
  fixes xs :: "'a :: linorder list" and d :: nat
  assumes median: "\<And>xs. xs \<noteq> [] \<Longrightarrow> length xs \<le> Suc (2 * d) \<Longrightarrow> is_median (med xs) xs"
  assumes median': "is_median x (map med (chop (Suc (2*d)) xs))"
  defines "n \<equiv> length xs"
  defines "c \<equiv> (3 * real d + 1) / (2 * (2 * d + 1))"
  shows   "size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * n\<rceil> + (5 * d) div 2 + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
proof (cases "xs = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
xs \<noteq> []

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
define m where "m = length (chop (Suc (2*d)) xs)"
[PROOF STATE]
proof (state)
this:
m = length (chop (Suc (2 * d)) xs)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "real (m div 2) \<le> real (nat \<lceil>real n / (1 + 2 * real d)\<rceil>) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (m div 2) \<le> real (nat \<lceil>real n / (1 + 2 * real d)\<rceil>) / 2
[PROOF STEP]
by (simp add: m_def length_chop n_def)
[PROOF STATE]
proof (state)
this:
real (m div 2) \<le> real (nat \<lceil>real n / (1 + 2 * real d)\<rceil>) / 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (m div 2) \<le> real (nat \<lceil>real n / (1 + 2 * real d)\<rceil>) / 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "real (nat \<lceil>real n / (1 + 2 * real d)\<rceil>) =
               of_int \<lceil>real n / (1 + 2 * real d)\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (nat \<lceil>real n / (1 + 2 * real d)\<rceil>) = real_of_int \<lceil>real n / (1 + 2 * real d)\<rceil>
[PROOF STEP]
by (intro of_nat_nat) (auto simp: divide_simps)
[PROOF STATE]
proof (state)
this:
real (nat \<lceil>real n / (1 + 2 * real d)\<rceil>) = real_of_int \<lceil>real n / (1 + 2 * real d)\<rceil>

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (nat \<lceil>real n / (1 + 2 * real d)\<rceil>) = real_of_int \<lceil>real n / (1 + 2 * real d)\<rceil>

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> / 2 \<le> (real n / (1 + 2 * real d) + 1) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lceil>real n / (1 + 2 * real d)\<rceil> / 2 \<le> (real n / (1 + 2 * real d) + 1) / 2
[PROOF STEP]
by (intro divide_right_mono) linarith+
[PROOF STATE]
proof (state)
this:
real_of_int \<lceil>real n / (1 + 2 * real d)\<rceil> / 2 \<le> (real n / (1 + 2 * real d) + 1) / 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<lceil>real n / (1 + 2 * real d)\<rceil> / 2 \<le> (real n / (1 + 2 * real d) + 1) / 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> = n / (2 * (2 * real d + 1)) + 1 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real n / (1 + 2 * real d) + 1) / 2 = real n / (2 * (2 * real d + 1)) + 1 / 2
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(real n / (1 + 2 * real d) + 1) / 2 = real n / (2 * (2 * real d + 1)) + 1 / 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (m div 2) \<le> real n / (2 * (2 * real d + 1)) + 1 / 2
[PROOF STEP]
have m: "real (m div 2) \<le> \<dots>"
[PROOF STATE]
proof (prove)
using this:
real (m div 2) \<le> real n / (2 * (2 * real d + 1)) + 1 / 2

goal (1 subgoal):
 1. real (m div 2) \<le> real n / (2 * (2 * real d + 1)) + 1 / 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (m div 2) \<le> real n / (2 * (2 * real d + 1)) + 1 / 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "size {#y \<in># mset xs. y < x#} \<le> d * m + Suc d * (m div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size {#y \<in># mset xs. y < x#} \<le> d * m + Suc d * (m div 2)
[PROOF STEP]
using size_less_than_median_of_medians_strong[of "Suc (2 * d)" med x xs] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < Suc (2 * d); \<And>xs. \<lbrakk>xs \<noteq> []; length xs \<le> Suc (2 * d)\<rbrakk> \<Longrightarrow> is_median (med xs) xs; is_median x (map med (chop (Suc (2 * d)) xs))\<rbrakk> \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> length (chop (Suc (2 * d)) xs) * (Suc (2 * d) div 2) + length (chop (Suc (2 * d)) xs) div 2 * ((Suc (2 * d) + 1) div 2)
\<lbrakk>?xs \<noteq> []; length ?xs \<le> Suc (2 * d)\<rbrakk> \<Longrightarrow> is_median (med ?xs) ?xs
is_median x (map med (chop (Suc (2 * d)) xs))
n \<equiv> length xs
c \<equiv> (3 * real d + 1) / real (2 * (2 * d + 1))

goal (1 subgoal):
 1. size {#y \<in># mset xs. y < x#} \<le> d * m + Suc d * (m div 2)
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < Suc (2 * d); \<And>xs. \<lbrakk>xs \<noteq> []; length xs \<le> Suc (2 * d)\<rbrakk> \<Longrightarrow> is_median (med xs) xs; is_median x (map med (chop (Suc (2 * d)) xs))\<rbrakk> \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> length (chop (Suc (2 * d)) xs) * (Suc (2 * d) div 2) + length (chop (Suc (2 * d)) xs) div 2 * ((Suc (2 * d) + 1) div 2)
\<lbrakk>?xs \<noteq> []; length ?xs \<le> Suc (2 * d)\<rbrakk> \<Longrightarrow> is_median (med ?xs) ?xs
is_median x (map med (chop (Suc (2 * d)) xs))
n \<equiv> length xs
c \<equiv> (3 * real d + 1) / real (2 * (2 * d + 1))

goal (1 subgoal):
 1. size {#y \<in># mset xs. y < x#} \<le> d * length (chop (Suc (2 * d)) xs) + Suc d * (length (chop (Suc (2 * d)) xs) div 2)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
size {#y \<in># mset xs. y < x#} \<le> d * m + Suc d * (m div 2)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size {#y \<in># mset xs. y < x#} \<le> d * m + Suc d * (m div 2)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> \<le> d * (2 * (m div 2) + 1) + Suc d * (m div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d * m + Suc d * (m div 2) \<le> d * (2 * (m div 2) + 1) + Suc d * (m div 2)
[PROOF STEP]
by (intro add_mono mult_left_mono) linarith+
[PROOF STATE]
proof (state)
this:
d * m + Suc d * (m div 2) \<le> d * (2 * (m div 2) + 1) + Suc d * (m div 2)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d * m + Suc d * (m div 2) \<le> d * (2 * (m div 2) + 1) + Suc d * (m div 2)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> = (3 * d + 1) * (m div 2) + d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d * (2 * (m div 2) + 1) + Suc d * (m div 2) = (3 * d + 1) * (m div 2) + d
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
d * (2 * (m div 2) + 1) + Suc d * (m div 2) = (3 * d + 1) * (m div 2) + d

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size {#y \<in># mset xs. y < x#} \<le> (3 * d + 1) * (m div 2) + d
[PROOF STEP]
have "real (size {#y \<in># mset xs. y < x#}) \<le> real \<dots>"
[PROOF STATE]
proof (prove)
using this:
size {#y \<in># mset xs. y < x#} \<le> (3 * d + 1) * (m div 2) + d

goal (1 subgoal):
 1. real (size {#y \<in># mset xs. y < x#}) \<le> real ((3 * d + 1) * (m div 2) + d)
[PROOF STEP]
by (subst of_nat_le_iff)
[PROOF STATE]
proof (state)
this:
real (size {#y \<in># mset xs. y < x#}) \<le> real ((3 * d + 1) * (m div 2) + d)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (size {#y \<in># mset xs. y < x#}) \<le> real ((3 * d + 1) * (m div 2) + d)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> \<le> (3 * real d + 1) * (n / (2 * (2 * d + 1)) + 1/2) + real d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real ((3 * d + 1) * (m div 2) + d) \<le> (3 * real d + 1) * (real n / real (2 * (2 * d + 1)) + 1 / 2) + real d
[PROOF STEP]
unfolding of_nat_add of_nat_mult of_nat_1 of_nat_numeral
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (3 * real d + 1) * real (m div 2) + real d \<le> (3 * real d + 1) * (real n / (2 * (2 * real d + 1)) + 1 / 2) + real d
[PROOF STEP]
by (intro add_mono mult_mono order.refl m) (auto simp: m_def length_chop n_def add_ac)
[PROOF STATE]
proof (state)
this:
real ((3 * d + 1) * (m div 2) + d) \<le> (3 * real d + 1) * (real n / real (2 * (2 * d + 1)) + 1 / 2) + real d

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real ((3 * d + 1) * (m div 2) + d) \<le> (3 * real d + 1) * (real n / real (2 * (2 * d + 1)) + 1 / 2) + real d

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> = c * real n + (5 * real d + 1) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (3 * real d + 1) * (real n / real (2 * (2 * d + 1)) + 1 / 2) + real d = c * real n + (5 * real d + 1) / 2
[PROOF STEP]
by (simp add: field_simps c_def)
[PROOF STATE]
proof (state)
this:
(3 * real d + 1) * (real n / real (2 * (2 * d + 1)) + 1 / 2) + real d = c * real n + (5 * real d + 1) / 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(3 * real d + 1) * (real n / real (2 * (2 * d + 1)) + 1 / 2) + real d = c * real n + (5 * real d + 1) / 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> \<le> real (nat \<lceil>c * n\<rceil> + ((5 * d) div 2 + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * real n + (5 * real d + 1) / 2 \<le> real (nat \<lceil>c * real n\<rceil> + (5 * d div 2 + 1))
[PROOF STEP]
unfolding of_nat_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * real n + (5 * real d + 1) / 2 \<le> real (nat \<lceil>c * real n\<rceil>) + (real (5 * d div 2) + real 1)
[PROOF STEP]
by (intro add_mono) (linarith, simp add: field_simps)
[PROOF STATE]
proof (state)
this:
c * real n + (5 * real d + 1) / 2 \<le> real (nat \<lceil>c * real n\<rceil> + (5 * d div 2 + 1))

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
 2. xs \<noteq> [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (size {#y \<in># mset xs. y < x#}) \<le> real (nat \<lceil>c * real n\<rceil> + (5 * d div 2 + 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (size {#y \<in># mset xs. y < x#}) \<le> real (nat \<lceil>c * real n\<rceil> + (5 * d div 2 + 1))

goal (1 subgoal):
 1. size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
by (subst (asm) of_nat_le_iff) (simp_all add: add_ac)
[PROOF STATE]
proof (state)
this:
size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1

goal (1 subgoal):
 1. xs = [] \<Longrightarrow> size {#y \<in># mset xs. y < x#} \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
qed auto


[STATEMENT]
lemma smap_less_trans[trans]: "\<lbrakk> m1 \<subseteq>. m2; m2 \<subseteq>. m3 \<rbrakk> \<Longrightarrow> m1 \<subseteq>. m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m1 \<subseteq>. m2; m2 \<subseteq>. m3\<rbrakk> \<Longrightarrow> m1 \<subseteq>. m3
[PROOF STEP]
unfolding smap_less_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>k. m1 k \<subseteq> m2 k; \<forall>k. m2 k \<subseteq> m3 k\<rbrakk> \<Longrightarrow> \<forall>k. m1 k \<subseteq> m3 k
[PROOF STEP]
by auto


[STATEMENT]
lemma concat_parts:
assumes "\<And>xs. xs\<in>set xss \<Longrightarrow> length xs = d" and "i<length xss"
shows "fixed_length_sublist (concat xss) d i = xss ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fixed_length_sublist (concat xss) d i = xss ! i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set xss \<Longrightarrow> length ?xs = d
i < length xss

goal (1 subgoal):
 1. fixed_length_sublist (concat xss) d i = xss ! i
[PROOF STEP]
proof (induction xss arbitrary:i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. \<lbrakk>\<And>xs. xs \<in> set [] \<Longrightarrow> length xs = d; i < length []\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat []) d i = [] ! i
 2. \<And>a xss i. \<lbrakk>\<And>i. \<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d i = xss ! i; \<And>xs. xs \<in> set (a # xss) \<Longrightarrow> length xs = d; i < length (a # xss)\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat (a # xss)) d i = (a # xss) ! i
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
?xs \<in> set [] \<Longrightarrow> length ?xs = d
i < length []

goal (2 subgoals):
 1. \<And>i. \<lbrakk>\<And>xs. xs \<in> set [] \<Longrightarrow> length xs = d; i < length []\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat []) d i = [] ! i
 2. \<And>a xss i. \<lbrakk>\<And>i. \<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d i = xss ! i; \<And>xs. xs \<in> set (a # xss) \<Longrightarrow> length xs = d; i < length (a # xss)\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat (a # xss)) d i = (a # xss) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?xs \<in> set [] \<Longrightarrow> length ?xs = d
i < length []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set [] \<Longrightarrow> length ?xs = d
i < length []

goal (1 subgoal):
 1. fixed_length_sublist (concat []) d i = [] ! i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fixed_length_sublist (concat []) d i = [] ! i

goal (1 subgoal):
 1. \<And>a xss i. \<lbrakk>\<And>i. \<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d i = xss ! i; \<And>xs. xs \<in> set (a # xss) \<Longrightarrow> length xs = d; i < length (a # xss)\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat (a # xss)) d i = (a # xss) ! i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xss i. \<lbrakk>\<And>i. \<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d i = xss ! i; \<And>xs. xs \<in> set (a # xss) \<Longrightarrow> length xs = d; i < length (a # xss)\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat (a # xss)) d i = (a # xss) ! i
[PROOF STEP]
case (Cons xs xss)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; ?i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d ?i = xss ! ?i
?xs \<in> set (xs # xss) \<Longrightarrow> length ?xs = d
i < length (xs # xss)

goal (1 subgoal):
 1. \<And>a xss i. \<lbrakk>\<And>i. \<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d i = xss ! i; \<And>xs. xs \<in> set (a # xss) \<Longrightarrow> length xs = d; i < length (a # xss)\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat (a # xss)) d i = (a # xss) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; ?i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d ?i = xss ! ?i
?xs \<in> set (xs # xss) \<Longrightarrow> length ?xs = d
i < length (xs # xss)
[PROOF STEP]
have "length (concat xss) = length xss * d"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; ?i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d ?i = xss ! ?i
?xs \<in> set (xs # xss) \<Longrightarrow> length ?xs = d
i < length (xs # xss)

goal (1 subgoal):
 1. length (concat xss) = length xss * d
[PROOF STEP]
by (simp add: Cons.prems(1) concat_equal_length)
[PROOF STATE]
proof (state)
this:
length (concat xss) = length xss * d

goal (1 subgoal):
 1. \<And>a xss i. \<lbrakk>\<And>i. \<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d i = xss ! i; \<And>xs. xs \<in> set (a # xss) \<Longrightarrow> length xs = d; i < length (a # xss)\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat (a # xss)) d i = (a # xss) ! i
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
 2. \<And>nat. i = Suc nat \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
 2. \<And>nat. i = Suc nat \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = 0
[PROOF STEP]
have "fixed_length_sublist (concat (xs # xss)) d i = xs"
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. fixed_length_sublist (concat (xs # xss)) d i = xs
[PROOF STEP]
unfolding fixed_length_sublist_def
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. take d (drop (d * i) (concat (xs # xss))) = xs
[PROOF STEP]
by (simp add: Cons.prems(1))
[PROOF STATE]
proof (state)
this:
fixed_length_sublist (concat (xs # xss)) d i = xs

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
 2. \<And>nat. i = Suc nat \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fixed_length_sublist (concat (xs # xss)) d i = xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fixed_length_sublist (concat (xs # xss)) d i = xs

goal (1 subgoal):
 1. fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
fixed_length_sublist (concat (xs # xss)) d i = xs
i = 0

goal (1 subgoal):
 1. fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
case (Suc i')
[PROOF STATE]
proof (state)
this:
i = Suc i'

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = Suc i'
[PROOF STEP]
have "fixed_length_sublist (concat xss) d i' = xss ! i'"
[PROOF STATE]
proof (prove)
using this:
i = Suc i'

goal (1 subgoal):
 1. fixed_length_sublist (concat xss) d i' = xss ! i'
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
i = Suc i'
\<lbrakk>\<And>xs. xs \<in> set xss \<Longrightarrow> length xs = d; ?i < length xss\<rbrakk> \<Longrightarrow> fixed_length_sublist (concat xss) d ?i = xss ! ?i
?xs \<in> set (xs # xss) \<Longrightarrow> length ?xs = d
i < length (xs # xss)

goal (1 subgoal):
 1. fixed_length_sublist (concat xss) d i' = xss ! i'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fixed_length_sublist (concat xss) d i' = xss ! i'

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fixed_length_sublist (concat xss) d i' = xss ! i'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fixed_length_sublist (concat xss) d i' = xss ! i'

goal (1 subgoal):
 1. fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i
[PROOF STEP]
unfolding fixed_length_sublist_def
[PROOF STATE]
proof (prove)
using this:
take d (drop (d * i') (concat xss)) = xss ! i'

goal (1 subgoal):
 1. take d (drop (d * i) (concat (xs # xss))) = (xs # xss) ! i
[PROOF STEP]
using Suc Cons.prems(1)
[PROOF STATE]
proof (prove)
using this:
take d (drop (d * i') (concat xss)) = xss ! i'
i = Suc i'
?xs \<in> set (xs # xss) \<Longrightarrow> length ?xs = d

goal (1 subgoal):
 1. take d (drop (d * i) (concat (xs # xss))) = (xs # xss) ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fixed_length_sublist (concat (xs # xss)) d i = (xs # xss) ! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stake_snth_charact:
  assumes "stake n w = stake n x"
  shows "\<forall>i < n. snth w i = snth x i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<n. w !! i = x !! i
[PROOF STEP]
proof (intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> w !! i = x !! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> w !! i = x !! i
[PROOF STEP]
assume "i < n"
[PROOF STATE]
proof (state)
this:
i < n

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> w !! i = x !! i
[PROOF STEP]
thus "snth w i = snth x i"
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. w !! i = x !! i
[PROOF STEP]
using Suc_leI assms stake_snth
[PROOF STATE]
proof (prove)
using this:
i < n
?m < ?n \<Longrightarrow> Suc ?m \<le> ?n
stake n w = stake n x
\<lbrakk>stake ?n ?w = stake ?n ?x; Suc ?i \<le> ?n\<rbrakk> \<Longrightarrow> ?w !! ?i = ?x !! ?i

goal (1 subgoal):
 1. w !! i = x !! i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
w !! i = x !! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_preimage_nth:
  "open S \<Longrightarrow> open {s::('a::real_normed_vector^'n::finite). s $ i \<in> S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S \<Longrightarrow> open {s. s $ i \<in> S}
[PROOF STEP]
unfolding open_contains_ball
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S \<Longrightarrow> \<forall>x\<in>{s. s $ i \<in> S}. \<exists>e>0. ball x e \<subseteq> {s. s $ i \<in> S}
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S; x $ i \<in> S\<rbrakk> \<Longrightarrow> \<exists>e>0. ball x e \<subseteq> {s. s $ i \<in> S}
[PROOF STEP]
apply(erule_tac x="x$i" in ballE; clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x e. \<lbrakk>x $ i \<in> S; 0 < e; ball (x $ i) e \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>e>0. ball x e \<subseteq> {s. s $ i \<in> S}
[PROOF STEP]
apply(rule_tac x=e in exI; clarsimp simp: dist_norm subset_eq ball_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x e xa. \<lbrakk>0 < e; \<forall>xa. \<parallel>x $ i - xa\<parallel> < e \<longrightarrow> xa \<in> S; \<parallel>x - xa\<parallel> < e\<rbrakk> \<Longrightarrow> xa $ i \<in> S
[PROOF STEP]
apply(rename_tac x e y, erule_tac x="y$i" in allE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x e y. \<lbrakk>0 < e; \<parallel>x - y\<parallel> < e; \<parallel>x $ i - y $ i\<parallel> < e \<longrightarrow> y $ i \<in> S\<rbrakk> \<Longrightarrow> y $ i \<in> S
[PROOF STEP]
using Finite_Cartesian_Product.norm_nth_le
[PROOF STATE]
proof (prove)
using this:
\<parallel>?x $ ?i\<parallel> \<le> \<parallel>?x\<parallel>

goal (1 subgoal):
 1. \<And>x e y. \<lbrakk>0 < e; \<parallel>x - y\<parallel> < e; \<parallel>x $ i - y $ i\<parallel> < e \<longrightarrow> y $ i \<in> S\<rbrakk> \<Longrightarrow> y $ i \<in> S
[PROOF STEP]
by (metis le_less_trans vector_minus_component)


[STATEMENT]
lemma degree_mult_eq_0:
  "degree (p * q) = 0 \<longleftrightarrow> p = 0 \<or> q = 0 \<or> (p \<noteq> 0 \<and> q \<noteq> 0 \<and> degree p = 0 \<and> degree q = 0)"
  for p q :: "'a::{comm_semiring_0,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (degree (p * q) = 0) = (p = 0 \<or> q = 0 \<or> p \<noteq> 0 \<and> q \<noteq> 0 \<and> degree p = 0 \<and> degree q = 0)
[PROOF STEP]
by (auto simp: degree_mult_eq)


[STATEMENT]
lemma smult_exact_sdiv_poly: assumes "\<And> c. c \<in> set (coeffs p) \<Longrightarrow> a dvd c"
  shows "smult a (sdiv_poly p a) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a (sdiv_poly p a) = p
[PROOF STEP]
unfolding smult_map_poly sdiv_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly ((*) a) (map_poly (\<lambda>c. c div a) p) = p
[PROOF STEP]
by (subst map_poly_map_poly,simp,rule map_poly_idI, insert assms, auto)


[STATEMENT]
lemma summable_iff_shift [simp]: "summable (\<lambda>n. f (n + k)) \<longleftrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. f (n + k)) = summable f
[PROOF STEP]
by (metis diff_add_cancel summable_def sums_iff_shift [abs_def])


[STATEMENT]
lemma (in jozsa) prob0_jozsa_algo_of_const_1:
  assumes "const 1"
  shows "prob0_fst_qubits n jozsa_algo = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
have "prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0,1}. (cmod(jozsa_algo $$ (j,0)))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)
[PROOF STEP]
using prob0_fst_qubits_of_jozsa_algo
[PROOF STATE]
proof (prove)
using this:
prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
have "(cmod(jozsa_algo $$ (0,0)))\<^sup>2 = 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
have "k<2^n \<longrightarrow> ((0 div 2) \<cdot>\<^bsub>n\<^esub>  k) = 0" for k::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < 2 ^ n \<longrightarrow> 0 div 2 \<cdot>\<^bsub>n\<^esub>  k = 0
[PROOF STEP]
using bitwise_inner_prod_with_zero
[PROOF STATE]
proof (prove)
using this:
?m < 2 ^ ?n \<Longrightarrow> 0 \<cdot>\<^bsub>?n\<^esub>  ?m = 0

goal (1 subgoal):
 1. k < 2 ^ n \<longrightarrow> 0 div 2 \<cdot>\<^bsub>n\<^esub>  k = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?k < 2 ^ n \<longrightarrow> 0 div 2 \<cdot>\<^bsub>n\<^esub>  ?k = 0

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < 2 ^ n \<longrightarrow> 0 div 2 \<cdot>\<^bsub>n\<^esub>  ?k = 0
[PROOF STEP]
have "(cmod(jozsa_algo $$ (0,0)))\<^sup>2 = (cmod(\<Sum>k::nat<2^n. 1/(sqrt(2)^n * sqrt(2)^(n+1))))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
?k < 2 ^ n \<longrightarrow> 0 div 2 \<cdot>\<^bsub>n\<^esub>  ?k = 0

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2
[PROOF STEP]
using jozsa_algo_result const_def assms
[PROOF STATE]
proof (prove)
using this:
?k < 2 ^ n \<longrightarrow> 0 div 2 \<cdot>\<^bsub>n\<^esub>  ?k = 0
jozsa_algo = Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then \<Sum>k<2 ^ n. (- 1) ^ (f k + i div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)) else \<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + i div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1))))
const ?c = (\<forall>x\<in>{i. i < 2 ^ n}. f x = ?c)
const 1

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
have "... = (cmod((-1)/(sqrt(2))))\<^sup>2 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2 = (cmod (complex_of_real (- 1 / sqrt 2)))\<^sup>2
[PROOF STEP]
using aux_comp_with_sqrt2_bis
[PROOF STATE]
proof (prove)
using this:
2 ^ ?n / (sqrt 2 ^ ?n * sqrt 2 ^ (?n + 1)) = 1 / sqrt 2

goal (1 subgoal):
 1. (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2 = (cmod (complex_of_real (- 1 / sqrt 2)))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2 = (cmod (complex_of_real (- 1 / sqrt 2)))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2 = (cmod (complex_of_real (- 1 / sqrt 2)))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
have "... = 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real (- 1 / sqrt 2)))\<^sup>2 = 1 / 2
[PROOF STEP]
by (simp add: norm_divide power2_eq_square)
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real (- 1 / sqrt 2)))\<^sup>2 = 1 / 2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
show "?thesis"
[PROOF STATE]
proof (prove)
using this:
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
have "(cmod(jozsa_algo $$ (1,0)))\<^sup>2 = 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
have "k<2^n \<longrightarrow> ((1 div 2) \<cdot>\<^bsub>n\<^esub>  k) = 0" for k::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < 2 ^ n \<longrightarrow> 1 div 2 \<cdot>\<^bsub>n\<^esub>  k = 0
[PROOF STEP]
using bitwise_inner_prod_with_zero
[PROOF STATE]
proof (prove)
using this:
?m < 2 ^ ?n \<Longrightarrow> 0 \<cdot>\<^bsub>?n\<^esub>  ?m = 0

goal (1 subgoal):
 1. k < 2 ^ n \<longrightarrow> 1 div 2 \<cdot>\<^bsub>n\<^esub>  k = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?k < 2 ^ n \<longrightarrow> 1 div 2 \<cdot>\<^bsub>n\<^esub>  ?k = 0

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < 2 ^ n \<longrightarrow> 1 div 2 \<cdot>\<^bsub>n\<^esub>  ?k = 0
[PROOF STEP]
have "(\<Sum>k::nat<2^n. (-1)^(f k +1 + ((1 div 2) \<cdot>\<^bsub>n\<^esub>  k))/(sqrt(2)^n * sqrt(2)^(n+1)))
             = (\<Sum>k::nat<2^n. 1/(sqrt(2)^n * sqrt(2)^(n+1)))"
[PROOF STATE]
proof (prove)
using this:
?k < 2 ^ n \<longrightarrow> 1 div 2 \<cdot>\<^bsub>n\<^esub>  ?k = 0

goal (1 subgoal):
 1. (\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1))) = (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))
[PROOF STEP]
using const_def assms
[PROOF STATE]
proof (prove)
using this:
?k < 2 ^ n \<longrightarrow> 1 div 2 \<cdot>\<^bsub>n\<^esub>  ?k = 0
const ?c = (\<forall>x\<in>{i. i < 2 ^ n}. f x = ?c)
const 1

goal (1 subgoal):
 1. (\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1))) = (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1))) = (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1))) = (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
have "(cmod(jozsa_algo $$ (1,0)))\<^sup>2
    = (cmod (\<Sum>k::nat<2^n. (-1)^(f k + 1 + ((1 div 2) \<cdot>\<^bsub>n\<^esub>  k))/(sqrt(2)^n * sqrt(2)^(n+1))))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2
[PROOF STEP]
using  \<psi>\<^sub>3_dim
[PROOF STATE]
proof (prove)
using this:
1 < dim_row (Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then \<Sum>k<2 ^ n. (- 1) ^ (f k + i div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)) else \<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + i div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1))) = (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2
[PROOF STEP]
have "(cmod(jozsa_algo $$ (1,0)))\<^sup>2 = (cmod(\<Sum>k::nat<2^n. 1/(sqrt(2)^n * sqrt(2)^(n+1))))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1))) = (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. (- 1) ^ (f k + 1 + 1 div 2 \<cdot>\<^bsub>n\<^esub>  k) / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
have "... = (cmod(1/(sqrt(2))))\<^sup>2 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2 = (cmod (complex_of_real (1 / sqrt 2)))\<^sup>2
[PROOF STEP]
using aux_comp_with_sqrt2_bis
[PROOF STATE]
proof (prove)
using this:
2 ^ ?n / (sqrt 2 ^ ?n * sqrt 2 ^ (?n + 1)) = 1 / sqrt 2

goal (1 subgoal):
 1. (cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2 = (cmod (complex_of_real (1 / sqrt 2)))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2 = (cmod (complex_of_real (1 / sqrt 2)))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real (\<Sum>k<2 ^ n. 1 / (sqrt 2 ^ n * sqrt 2 ^ (n + 1)))))\<^sup>2 = (cmod (complex_of_real (1 / sqrt 2)))\<^sup>2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
have "... = 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real (1 / sqrt 2)))\<^sup>2 = 1 / 2
[PROOF STEP]
by (simp add: norm_divide power2_eq_square)
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real (1 / sqrt 2)))\<^sup>2 = 1 / 2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
show "?thesis"
[PROOF STATE]
proof (prove)
using this:
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2

goal (1 subgoal):
 1. (cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2
[PROOF STEP]
have "prob0_fst_qubits n jozsa_algo = 1/2 + 1/2"
[PROOF STATE]
proof (prove)
using this:
prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)
(cmod (jozsa_algo $$ (0, 0)))\<^sup>2 = 1 / 2
(cmod (jozsa_algo $$ (1, 0)))\<^sup>2 = 1 / 2

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1 / 2 + 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob0_fst_qubits n jozsa_algo = 1 / 2 + 1 / 2

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prob0_fst_qubits n jozsa_algo = 1 / 2 + 1 / 2
[PROOF STEP]
show  "?thesis"
[PROOF STATE]
proof (prove)
using this:
prob0_fst_qubits n jozsa_algo = 1 / 2 + 1 / 2

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob0_fst_qubits n jozsa_algo = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stermsl_before_dtermsl [simp]:
  "(\<Union>x\<in>stermsl p. dtermsl x) = dtermsl p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (dtermsl ` stermsl p) = dtermsl p
[PROOF STEP]
by (induct p) simp_all