[STATEMENT]
lemma cindex_path_linepath:
  assumes "z\<notin>path_image (linepath a b)"
  shows "cindex_path (linepath a b) z = (
    let c1=Re(a)-Re(z) ; c2=Re(b)-Re(z) ;
        c3 = Im(a)*Re(b)+Re(z)*Im(b)+Im(z)*Re(a) -Im(z)*Re(b) - Im(b)*Re(a) - Re(z)*Im(a)
    in if (c1>0 \<and> c2<0) \<or> (c1<0 \<and> c2>0) then (if c3>0 then 1 else -1) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
define c1 c2 where "c1=Re(a)-Re(z)" and "c2=Re(b)-Re(z)"
[PROOF STATE]
proof (state)
this:
c1 = Re a - Re z
c2 = Re b - Re z

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
let ?g = "linepath a b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have ?thesis when "\<not> ((c1>0 \<and> c2<0) \<or> (c1<0 \<and> c2>0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have "Re a= Re z \<and> Re b=Re z"
      when "0<t" "t<1" and asm:"(1-t)*Re a + t * Re b = Re z" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
unfolding c1_def c2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < t
t < 1
(1 - t) * Re a + t * Re b = Re z

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have ?thesis when "c1\<le>0" "c1\<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have "Re a=Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re a = Re z
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
c1 \<le> 0
0 \<le> c1

goal (1 subgoal):
 1. Re a = Re z
[PROOF STEP]
unfolding c1_def
[PROOF STATE]
proof (prove)
using this:
Re a - Re z \<le> 0
0 \<le> Re a - Re z

goal (1 subgoal):
 1. Re a = Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re a = Re z

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Re a = Re z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re a = Re z

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
using \<open>0<t\<close> \<open>t<1\<close> asm
[PROOF STATE]
proof (prove)
using this:
Re a = Re z
0 < t
t < 1
(1 - t) * Re a + t * Re b = Re z

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
apply (cases "Re b" "Re z" rule:linorder_cases)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>Re a = Re z; 0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z; Re b < Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
 2. \<lbrakk>Re a = Re z; 0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z; Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
 3. \<lbrakk>Re a = Re z; 0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z; Re z < Re b\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
apply (auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Re a = Re z \<and> Re b = Re z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>c1 \<le> 0; 0 \<le> c1\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>c1 \<le> 0; 0 \<le> c1\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have ?thesis when "c1\<le>0" "c2\<le>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have False when "c1<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have "(1 - t) * Re a < (1 - t) * Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - t) * Re a < (1 - t) * Re z
[PROOF STEP]
using \<open>t<1\<close> \<open>c1<0\<close>
[PROOF STATE]
proof (prove)
using this:
t < 1
c1 < 0

goal (1 subgoal):
 1. (1 - t) * Re a < (1 - t) * Re z
[PROOF STEP]
unfolding c1_def
[PROOF STATE]
proof (prove)
using this:
t < 1
Re a - Re z < 0

goal (1 subgoal):
 1. (1 - t) * Re a < (1 - t) * Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - t) * Re a < (1 - t) * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 - t) * Re a < (1 - t) * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
have "t * Re b \<le> t* Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t * Re b \<le> t * Re z
[PROOF STEP]
using \<open>t>0\<close> \<open>c2\<le>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < t
c2 \<le> 0

goal (1 subgoal):
 1. t * Re b \<le> t * Re z
[PROOF STEP]
unfolding c2_def
[PROOF STATE]
proof (prove)
using this:
0 < t
Re b - Re z \<le> 0

goal (1 subgoal):
 1. t * Re b \<le> t * Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t * Re b \<le> t * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 - t) * Re a < (1 - t) * Re z
t * Re b \<le> t * Re z
[PROOF STEP]
have "(1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z"
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re a < (1 - t) * Re z
t * Re b \<le> t * Re z

goal (1 subgoal):
 1. (1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z
(1 - t) * Re a + t * Re b = Re z

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c1 < 0 \<Longrightarrow> False

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c1 < 0 \<Longrightarrow> False

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have False when "c2<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have "(1 - t) * Re a \<le> (1 - t) * Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - t) * Re a \<le> (1 - t) * Re z
[PROOF STEP]
using \<open>t<1\<close> \<open>c1\<le>0\<close>
[PROOF STATE]
proof (prove)
using this:
t < 1
c1 \<le> 0

goal (1 subgoal):
 1. (1 - t) * Re a \<le> (1 - t) * Re z
[PROOF STEP]
unfolding c1_def
[PROOF STATE]
proof (prove)
using this:
t < 1
Re a - Re z \<le> 0

goal (1 subgoal):
 1. (1 - t) * Re a \<le> (1 - t) * Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - t) * Re a \<le> (1 - t) * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 - t) * Re a \<le> (1 - t) * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
have "t * Re b < t* Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t * Re b < t * Re z
[PROOF STEP]
using \<open>t>0\<close> \<open>c2<0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < t
c2 < 0

goal (1 subgoal):
 1. t * Re b < t * Re z
[PROOF STEP]
unfolding c2_def
[PROOF STATE]
proof (prove)
using this:
0 < t
Re b - Re z < 0

goal (1 subgoal):
 1. t * Re b < t * Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t * Re b < t * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 - t) * Re a \<le> (1 - t) * Re z
t * Re b < t * Re z
[PROOF STEP]
have "(1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z"
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re a \<le> (1 - t) * Re z
t * Re b < t * Re z

goal (1 subgoal):
 1. (1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z

goal (1 subgoal):
 1. False
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re a + t * Re b < (1 - t) * Re z + t * Re z
(1 - t) * Re a + t * Re b = Re z

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c2 < 0 \<Longrightarrow> False

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
c1 < 0 \<Longrightarrow> False
c2 < 0 \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c1 < 0 \<Longrightarrow> False
c2 < 0 \<Longrightarrow> False

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
c1 < 0 \<Longrightarrow> False
c2 < 0 \<Longrightarrow> False
c1 \<le> 0
c2 \<le> 0

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
unfolding c1_def c2_def
[PROOF STATE]
proof (prove)
using this:
Re a - Re z < 0 \<Longrightarrow> False
Re b - Re z < 0 \<Longrightarrow> False
Re a - Re z \<le> 0
Re b - Re z \<le> 0

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>c1 \<le> 0; c2 \<le> 0\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>c1 \<le> 0; c2 \<le> 0\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have ?thesis when "c2\<le>0" "c2\<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have "Re b=Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re b = Re z
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
c2 \<le> 0
0 \<le> c2

goal (1 subgoal):
 1. Re b = Re z
[PROOF STEP]
unfolding c2_def
[PROOF STATE]
proof (prove)
using this:
Re b - Re z \<le> 0
0 \<le> Re b - Re z

goal (1 subgoal):
 1. Re b = Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re b = Re z

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Re b = Re z
[PROOF STEP]
have "(1 - t) * Re a = (1-t)*Re z"
[PROOF STATE]
proof (prove)
using this:
Re b = Re z

goal (1 subgoal):
 1. (1 - t) * Re a = (1 - t) * Re z
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
Re b = Re z
(1 - t) * Re a + t * Re b = Re z

goal (1 subgoal):
 1. (1 - t) * Re a = (1 - t) * Re z
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
(1 - t) * Re a = (1 - t) * Re z

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 - t) * Re a = (1 - t) * Re z
[PROOF STEP]
have "Re a= Re z"
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re a = (1 - t) * Re z

goal (1 subgoal):
 1. Re a = Re z
[PROOF STEP]
using \<open>t<1\<close>
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re a = (1 - t) * Re z
t < 1

goal (1 subgoal):
 1. Re a = Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re a = Re z

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Re a = Re z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re a = Re z

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
using \<open>Re b=Re z\<close>
[PROOF STATE]
proof (prove)
using this:
Re a = Re z
Re b = Re z

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>c2 \<le> 0; 0 \<le> c2\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>c2 \<le> 0; 0 \<le> c2\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have ?thesis when "c1\<ge>0" "c2\<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have False when "c1>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have "(1 - t) * Re a > (1 - t) * Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - t) * Re z < (1 - t) * Re a
[PROOF STEP]
using \<open>t<1\<close> \<open>c1>0\<close>
[PROOF STATE]
proof (prove)
using this:
t < 1
0 < c1

goal (1 subgoal):
 1. (1 - t) * Re z < (1 - t) * Re a
[PROOF STEP]
unfolding c1_def
[PROOF STATE]
proof (prove)
using this:
t < 1
0 < Re a - Re z

goal (1 subgoal):
 1. (1 - t) * Re z < (1 - t) * Re a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - t) * Re z < (1 - t) * Re a

goal (1 subgoal):
 1. False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 - t) * Re z < (1 - t) * Re a

goal (1 subgoal):
 1. False
[PROOF STEP]
have "t * Re b \<ge> t* Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t * Re z \<le> t * Re b
[PROOF STEP]
using \<open>t>0\<close> \<open>c2\<ge>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < t
0 \<le> c2

goal (1 subgoal):
 1. t * Re z \<le> t * Re b
[PROOF STEP]
unfolding c2_def
[PROOF STATE]
proof (prove)
using this:
0 < t
0 \<le> Re b - Re z

goal (1 subgoal):
 1. t * Re z \<le> t * Re b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t * Re z \<le> t * Re b

goal (1 subgoal):
 1. False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 - t) * Re z < (1 - t) * Re a
t * Re z \<le> t * Re b
[PROOF STEP]
have "(1 - t) * Re a + t * Re b > (1 - t) * Re z + t * Re z"
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re z < (1 - t) * Re a
t * Re z \<le> t * Re b

goal (1 subgoal):
 1. (1 - t) * Re z + t * Re z < (1 - t) * Re a + t * Re b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - t) * Re z + t * Re z < (1 - t) * Re a + t * Re b

goal (1 subgoal):
 1. False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re z + t * Re z < (1 - t) * Re a + t * Re b

goal (1 subgoal):
 1. False
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re z + t * Re z < (1 - t) * Re a + t * Re b
(1 - t) * Re a + t * Re b = Re z

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < c1 \<Longrightarrow> False

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < c1 \<Longrightarrow> False

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have False when "c2>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have "(1 - t) * Re a \<ge> (1 - t) * Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - t) * Re z \<le> (1 - t) * Re a
[PROOF STEP]
using \<open>t<1\<close> \<open>c1\<ge>0\<close>
[PROOF STATE]
proof (prove)
using this:
t < 1
0 \<le> c1

goal (1 subgoal):
 1. (1 - t) * Re z \<le> (1 - t) * Re a
[PROOF STEP]
unfolding c1_def
[PROOF STATE]
proof (prove)
using this:
t < 1
0 \<le> Re a - Re z

goal (1 subgoal):
 1. (1 - t) * Re z \<le> (1 - t) * Re a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - t) * Re z \<le> (1 - t) * Re a

goal (1 subgoal):
 1. False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 - t) * Re z \<le> (1 - t) * Re a

goal (1 subgoal):
 1. False
[PROOF STEP]
have "t * Re b > t* Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t * Re z < t * Re b
[PROOF STEP]
using \<open>t>0\<close> \<open>c2>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < t
0 < c2

goal (1 subgoal):
 1. t * Re z < t * Re b
[PROOF STEP]
unfolding c2_def
[PROOF STATE]
proof (prove)
using this:
0 < t
0 < Re b - Re z

goal (1 subgoal):
 1. t * Re z < t * Re b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t * Re z < t * Re b

goal (1 subgoal):
 1. False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 - t) * Re z \<le> (1 - t) * Re a
t * Re z < t * Re b
[PROOF STEP]
have "(1 - t) * Re a + t * Re b > (1 - t) * Re z + t * Re z"
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re z \<le> (1 - t) * Re a
t * Re z < t * Re b

goal (1 subgoal):
 1. (1 - t) * Re z + t * Re z < (1 - t) * Re a + t * Re b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - t) * Re z + t * Re z < (1 - t) * Re a + t * Re b

goal (1 subgoal):
 1. False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re z + t * Re z < (1 - t) * Re a + t * Re b

goal (1 subgoal):
 1. False
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
(1 - t) * Re z + t * Re z < (1 - t) * Re a + t * Re b
(1 - t) * Re a + t * Re b = Re z

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < c2 \<Longrightarrow> False

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < c1 \<Longrightarrow> False
0 < c2 \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < c1 \<Longrightarrow> False
0 < c2 \<Longrightarrow> False

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < c1 \<Longrightarrow> False
0 < c2 \<Longrightarrow> False
0 \<le> c1
0 \<le> c2

goal (1 subgoal):
 1. Re a = Re z \<and> Re b = Re z
[PROOF STEP]
unfolding c1_def c2_def
[PROOF STATE]
proof (prove)
using this:
0 < Re a - Re z \<Longrightarrow> False
0 < Re b - Re z \<Longrightarrow> False
0 \<le> Re a - Re z
0 \<le> Re b - Re z

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> c1; 0 \<le> c2\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> c1; 0 \<le> c2\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have "c1\<le>0 \<or> c2\<ge>0" "c1\<ge>0 \<or> c2\<le>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c1 \<le> 0 \<or> 0 \<le> c2 &&& 0 \<le> c1 \<or> c2 \<le> 0
[PROOF STEP]
using \<open>\<not> ((c1>0 \<and> c2<0) \<or> (c1<0 \<and> c2>0))\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2)

goal (1 subgoal):
 1. c1 \<le> 0 \<or> 0 \<le> c2 &&& 0 \<le> c1 \<or> c2 \<le> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c1 \<le> 0 \<or> 0 \<le> c2
0 \<le> c1 \<or> c2 \<le> 0

goal (1 subgoal):
 1. \<lbrakk>0 < t; t < 1; (1 - t) * Re a + t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>c1 \<le> 0; 0 \<le> c1\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
\<lbrakk>c1 \<le> 0; c2 \<le> 0\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
\<lbrakk>c2 \<le> 0; 0 \<le> c2\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
\<lbrakk>0 \<le> c1; 0 \<le> c2\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
c1 \<le> 0 \<or> 0 \<le> c2
0 \<le> c1 \<or> c2 \<le> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>c1 \<le> 0; 0 \<le> c1\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
\<lbrakk>c1 \<le> 0; c2 \<le> 0\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
\<lbrakk>c2 \<le> 0; 0 \<le> c2\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
\<lbrakk>0 \<le> c1; 0 \<le> c2\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
c1 \<le> 0 \<or> 0 \<le> c2
0 \<le> c1 \<or> c2 \<le> 0

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?t; ?t < 1; (1 - ?t) * Re a + ?t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < ?t; ?t < 1; (1 - ?t) * Re a + ?t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
have "(\<forall>t. 0<t \<and> t<1 \<longrightarrow> Re(linepath a b t - z) \<noteq> 0) \<or> (Re a= Re z \<and> Re b=Re z)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?t; ?t < 1; (1 - ?t) * Re a + ?t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. (\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0) \<or> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?t; ?t < 1; (1 - ?t) * Re a + ?t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2)

goal (1 subgoal):
 1. (\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0) \<or> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
unfolding linepath_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?t; ?t < 1; (1 - ?t) * Re a + ?t * Re b = Re z\<rbrakk> \<Longrightarrow> Re a = Re z \<and> Re b = Re z
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2)

goal (1 subgoal):
 1. (\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re ((1 - t) *\<^sub>R a + t *\<^sub>R b - z) \<noteq> 0) \<or> Re a = Re z \<and> Re b = Re z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0) \<or> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0) \<or> Re a = Re z \<and> Re b = Re z

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have ?thesis when asm:"\<forall>t. 0<t \<and> t<1 \<longrightarrow> Re(linepath a b t - z) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have "jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) t = 0"
        when "0<t" "t<1" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) t = 0
[PROOF STEP]
apply (rule jump_Im_divide_Re_0[of "\<lambda>t. linepath a b t - z",
              OF _ asm[rule_format]])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. path (\<lambda>t. linepath a b t - z)
 2. 0 < t \<and> t < 1
 3. 0 < t
 4. t < 1
[PROOF STEP]
by (auto simp add:path_offset that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) ?t = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) ?t = 0
[PROOF STEP]
have "cindex_path (linepath a b) z = 0"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) ?t = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = 0
[PROOF STEP]
unfolding cindex_path_def cindex_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) ?t = 0

goal (1 subgoal):
 1. sum (jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z))) {x. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) x \<noteq> 0 \<and> 0 < x \<and> x < 1} = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex_path (linepath a b) z = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
using \<open>\<not> ((c1>0 \<and> c2<0) \<or> (c1<0 \<and> c2>0))\<close>
[PROOF STATE]
proof (prove)
using this:
cindex_path (linepath a b) z = 0
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
apply (fold c1_def c2_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cindex_path (linepath a b) z = 0; \<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2)\<rbrakk> \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = c1; c2 = c2; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0 \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0 \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have ?thesis when "Re a= Re z" "Re b=Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have "(\<lambda>t. Re (linepath a b t - z)) = (\<lambda>_. 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. Re (linepath a b t - z)) = (\<lambda>_. 0)
[PROOF STEP]
unfolding linepath_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. Re ((1 - t) *\<^sub>R a + t *\<^sub>R b - z)) = (\<lambda>_. 0)
[PROOF STEP]
using \<open>Re a= Re z\<close> \<open>Re b=Re z\<close>
[PROOF STATE]
proof (prove)
using this:
Re a = Re z
Re b = Re z

goal (1 subgoal):
 1. (\<lambda>t. Re ((1 - t) *\<^sub>R a + t *\<^sub>R b - z)) = (\<lambda>_. 0)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>t. Re (linepath a b t - z)) = (\<lambda>_. 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>t. Re (linepath a b t - z)) = (\<lambda>_. 0)
[PROOF STEP]
have "(\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) = (\<lambda>_. 0)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>t. Re (linepath a b t - z)) = (\<lambda>_. 0)

goal (1 subgoal):
 1. (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) = (\<lambda>_. 0)
[PROOF STEP]
by (metis div_by_0)
[PROOF STATE]
proof (state)
this:
(\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) = (\<lambda>_. 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) = (\<lambda>_. 0)
[PROOF STEP]
have "jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) t = 0" for t
[PROOF STATE]
proof (prove)
using this:
(\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) = (\<lambda>_. 0)

goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) t = 0
[PROOF STEP]
using jump_const
[PROOF STATE]
proof (prove)
using this:
(\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) = (\<lambda>_. 0)
jump (\<lambda>_. ?c) ?a = 0

goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) t = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) ?t = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) ?t = 0
[PROOF STEP]
have "cindex_path (linepath a b) z = 0"
[PROOF STATE]
proof (prove)
using this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) ?t = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = 0
[PROOF STEP]
unfolding cindex_path_def cindex_def
[PROOF STATE]
proof (prove)
using this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) ?t = 0

goal (1 subgoal):
 1. sum (jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z))) {x. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) x \<noteq> 0 \<and> 0 < x \<and> x < 1} = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex_path (linepath a b) z = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
using \<open>\<not> ((c1>0 \<and> c2<0) \<or> (c1<0 \<and> c2>0))\<close>
[PROOF STATE]
proof (prove)
using this:
cindex_path (linepath a b) z = 0
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
apply (fold c1_def c2_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cindex_path (linepath a b) z = 0; \<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2)\<rbrakk> \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = c1; c2 = c2; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re a = Re z; Re b = Re z\<rbrakk> \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0) \<or> Re a = Re z \<and> Re b = Re z
\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0 \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
\<lbrakk>Re a = Re z; Re b = Re z\<rbrakk> \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0) \<or> Re a = Re z \<and> Re b = Re z
\<forall>t. 0 < t \<and> t < 1 \<longrightarrow> Re (linepath a b t - z) \<noteq> 0 \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
\<lbrakk>Re a = Re z; Re b = Re z\<rbrakk> \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2) \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2) \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have ?thesis when c1c2_diff_sgn:"(c1>0 \<and> c2<0) \<or> (c1<0 \<and> c2>0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
define c3 where "c3=Im(a)*Re(b)+Re(z)*Im(b)+Im(z)*Re(a) -Im(z)*Re(b) - Im(b)*Re(a) - Re(z)*Im(a)"
[PROOF STATE]
proof (state)
this:
c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
define u where "u = (Re z - Re a) / (Re b - Re a)"
[PROOF STATE]
proof (state)
this:
u = (Re z - Re a) / (Re b - Re a)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
let ?g = "\<lambda>t. linepath a b t - z"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have "0<u" "u<1" "Re b - Re a\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < u &&& u < 1 &&& Re b - Re a \<noteq> 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2

goal (1 subgoal):
 1. 0 < u &&& u < 1 &&& Re b - Re a \<noteq> 0
[PROOF STEP]
unfolding u_def c1_def c2_def
[PROOF STATE]
proof (prove)
using this:
0 < Re a - Re z \<and> Re b - Re z < 0 \<or> Re a - Re z < 0 \<and> 0 < Re b - Re z

goal (1 subgoal):
 1. 0 < (Re z - Re a) / (Re b - Re a) &&& (Re z - Re a) / (Re b - Re a) < 1 &&& Re b - Re a \<noteq> 0
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
0 < u
u < 1
Re b - Re a \<noteq> 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have "Re(?g u) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (linepath a b u - z) = 0
[PROOF STEP]
unfolding linepath_def u_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ((1 - (Re z - Re a) / (Re b - Re a)) *\<^sub>R a + ((Re z - Re a) / (Re b - Re a)) *\<^sub>R b - z) = 0
[PROOF STEP]
apply (auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re a + (Re b * Re z - Re a * Re b) / (Re b - Re a) = Re z + (Re a * Re z - Re a * Re a) / (Re b - Re a)
[PROOF STEP]
using \<open>Re b - Re a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
Re b - Re a \<noteq> 0

goal (1 subgoal):
 1. Re a + (Re b * Re z - Re a * Re b) / (Re b - Re a) = Re z + (Re a * Re z - Re a * Re a) / (Re b - Re a)
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
Re (linepath a b u - z) = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Re (linepath a b u - z) = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have "u1 = u2" when "Re(?g u1) = 0" "Re(?g u2) = 0" for u1 u2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u1 = u2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u1 = u2
[PROOF STEP]
have " (u1 - u2) * (Re b - Re a) = Re(?g u1) - Re(?g u2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u1 - u2) * (Re b - Re a) = Re (linepath a b u1 - z) - Re (linepath a b u2 - z)
[PROOF STEP]
unfolding linepath_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u1 - u2) * (Re b - Re a) = Re ((1 - u1) *\<^sub>R a + u1 *\<^sub>R b - z) - Re ((1 - u2) *\<^sub>R a + u2 *\<^sub>R b - z)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
(u1 - u2) * (Re b - Re a) = Re (linepath a b u1 - z) - Re (linepath a b u2 - z)

goal (1 subgoal):
 1. u1 = u2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(u1 - u2) * (Re b - Re a) = Re (linepath a b u1 - z) - Re (linepath a b u2 - z)

goal (1 subgoal):
 1. u1 = u2
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (linepath a b u1 - z) - Re (linepath a b u2 - z) = 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re (linepath a b u1 - z) = 0
Re (linepath a b u2 - z) = 0

goal (1 subgoal):
 1. Re (linepath a b u1 - z) - Re (linepath a b u2 - z) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re (linepath a b u1 - z) - Re (linepath a b u2 - z) = 0

goal (1 subgoal):
 1. u1 = u2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(u1 - u2) * (Re b - Re a) = 0
[PROOF STEP]
have "(u1 - u2) * (Re b - Re a) = 0"
[PROOF STATE]
proof (prove)
using this:
(u1 - u2) * (Re b - Re a) = 0

goal (1 subgoal):
 1. (u1 - u2) * (Re b - Re a) = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(u1 - u2) * (Re b - Re a) = 0

goal (1 subgoal):
 1. u1 = u2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(u1 - u2) * (Re b - Re a) = 0

goal (1 subgoal):
 1. u1 = u2
[PROOF STEP]
using \<open>Re b - Re a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
(u1 - u2) * (Re b - Re a) = 0
Re b - Re a \<noteq> 0

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re (linepath a b ?u1.0 - z) = 0; Re (linepath a b ?u2.0 - z) = 0\<rbrakk> \<Longrightarrow> ?u1.0 = ?u2.0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Re (linepath a b u - z) = 0
\<lbrakk>Re (linepath a b ?u1.0 - z) = 0; Re (linepath a b ?u2.0 - z) = 0\<rbrakk> \<Longrightarrow> ?u1.0 = ?u2.0
[PROOF STEP]
have re_g_iff:"Re(?g t) = 0 \<longleftrightarrow> t=u" for t
[PROOF STATE]
proof (prove)
using this:
Re (linepath a b u - z) = 0
\<lbrakk>Re (linepath a b ?u1.0 - z) = 0; Re (linepath a b ?u2.0 - z) = 0\<rbrakk> \<Longrightarrow> ?u1.0 = ?u2.0

goal (1 subgoal):
 1. (Re (linepath a b t - z) = 0) = (t = u)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(Re (linepath a b ?t - z) = 0) = (?t = u)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have "cindex_path (linepath a b) z = jump (\<lambda>t. Im (?g t)/Re(?g t)) u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
[PROOF STEP]
define f where "f=(\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z))

goal (1 subgoal):
 1. cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
[PROOF STEP]
have "jump f t =0" when "t\<noteq>u" "0<t" "t<1" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump f t = 0
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) t = 0
[PROOF STEP]
apply (rule jump_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 t - z) \<noteq> 0
 3. 0 < t
 4. t < 1
[PROOF STEP]
using that re_g_iff
[PROOF STATE]
proof (prove)
using this:
t \<noteq> u
0 < t
t < 1
(Re (linepath a b ?t - z) = 0) = (?t = u)

goal (4 subgoals):
 1. path (\<lambda>t. linepath a b t - z)
 2. Re (linepath a b t - z) \<noteq> 0
 3. 0 < t
 4. t < 1
[PROOF STEP]
by (auto simp add: path_offset)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?t \<noteq> u; 0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> jump f ?t = 0

goal (1 subgoal):
 1. cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?t \<noteq> u; 0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> jump f ?t = 0
[PROOF STEP]
have "{x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = (if jump f u=0 then {} else {u})"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t \<noteq> u; 0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> jump f ?t = 0

goal (1 subgoal):
 1. {x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = (if jump f u = 0 then {} else {u})
[PROOF STEP]
using \<open>0<u\<close> \<open>u<1\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t \<noteq> u; 0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> jump f ?t = 0
0 < u
u < 1

goal (1 subgoal):
 1. {x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = (if jump f u = 0 then {} else {u})
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>t. \<lbrakk>t \<noteq> u; 0 < t; t < 1\<rbrakk> \<Longrightarrow> jump f t = 0; 0 < u; u < 1; jump f u = 0; 0 < x; jump f x \<noteq> 0; x < 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = (if jump f u = 0 then {} else {u})

goal (1 subgoal):
 1. cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = (if jump f u = 0 then {} else {u})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = (if jump f u = 0 then {} else {u})

goal (1 subgoal):
 1. cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
[PROOF STEP]
unfolding cindex_path_def cindex_def
[PROOF STATE]
proof (prove)
using this:
{x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = (if jump f u = 0 then {} else {u})

goal (1 subgoal):
 1. sum (jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z))) {x. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) x \<noteq> 0 \<and> 0 < x \<and> x < 1} = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
[PROOF STEP]
apply (fold f_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = (if jump f u = 0 then {} else {u}) \<Longrightarrow> sum (jump f) {x. jump f x \<noteq> 0 \<and> 0 < x \<and> x < 1} = jump f u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
have "jump (\<lambda>t. Im (?g t)/Re(?g t)) u = (if c3>0 then 1 else -1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
[PROOF STEP]
have "Re b-Re a\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re b - Re a \<noteq> 0
[PROOF STEP]
using c1c2_diff_sgn
[PROOF STATE]
proof (prove)
using this:
0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2

goal (1 subgoal):
 1. Re b - Re a \<noteq> 0
[PROOF STEP]
unfolding c1_def c2_def
[PROOF STATE]
proof (prove)
using this:
0 < Re a - Re z \<and> Re b - Re z < 0 \<or> Re a - Re z < 0 \<and> 0 < Re b - Re z

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

goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
[PROOF STEP]
have "jump (\<lambda>t. Im(?g t) / Re(?g t)) u
          = (if sgn (Re b -Re a) = sgn (Im(?g u)) then 1 else - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if sgn (Re b - Re a) = sgn (Im (linepath a b u - z)) then 1 else - 1)
[PROOF STEP]
proof (rule jump_divide_derivative)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. isCont (\<lambda>t. Im (linepath a b t - z)) u
 2. Re (linepath a b u - z) = 0
 3. Im (linepath a b u - z) \<noteq> 0
 4. ((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)
 5. Re b - Re a \<noteq> 0
[PROOF STEP]
have "path ?g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path (\<lambda>t. linepath a b t - z)
[PROOF STEP]
using path_offset
[PROOF STATE]
proof (prove)
using this:
path (\<lambda>t. ?g t - ?z) = path ?g

goal (1 subgoal):
 1. path (\<lambda>t. linepath a b t - z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path (\<lambda>t. linepath a b t - z)

goal (5 subgoals):
 1. isCont (\<lambda>t. Im (linepath a b t - z)) u
 2. Re (linepath a b u - z) = 0
 3. Im (linepath a b u - z) \<noteq> 0
 4. ((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)
 5. Re b - Re a \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path (\<lambda>t. linepath a b t - z)
[PROOF STEP]
have "continuous_on {0..1} (\<lambda>t. Im(?g t))"
[PROOF STATE]
proof (prove)
using this:
path (\<lambda>t. linepath a b t - z)

goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>t. Im (linepath a b t - z))
[PROOF STEP]
using continuous_on_Im path_def
[PROOF STATE]
proof (prove)
using this:
path (\<lambda>t. linepath a b t - z)
continuous_on ?s ?g \<Longrightarrow> continuous_on ?s (\<lambda>x. Im (?g x))
path ?g = continuous_on {0..1} ?g

goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>t. Im (linepath a b t - z))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>t. Im (linepath a b t - z))

goal (5 subgoals):
 1. isCont (\<lambda>t. Im (linepath a b t - z)) u
 2. Re (linepath a b u - z) = 0
 3. Im (linepath a b u - z) \<noteq> 0
 4. ((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)
 5. Re b - Re a \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} (\<lambda>t. Im (linepath a b t - z))
[PROOF STEP]
show "isCont (\<lambda>t. Im (?g t)) u"
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>t. Im (linepath a b t - z))

goal (1 subgoal):
 1. isCont (\<lambda>t. Im (linepath a b t - z)) u
[PROOF STEP]
unfolding path_def
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>t. Im (linepath a b t - z))

goal (1 subgoal):
 1. isCont (\<lambda>t. Im (linepath a b t - z)) u
[PROOF STEP]
apply (elim continuous_on_interior)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> interior {0..1}
[PROOF STEP]
using \<open>0<u\<close> \<open>u<1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < u
u < 1

goal (1 subgoal):
 1. u \<in> interior {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>t. Im (linepath a b t - z)) u

goal (4 subgoals):
 1. Re (linepath a b u - z) = 0
 2. Im (linepath a b u - z) \<noteq> 0
 3. ((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)
 4. Re b - Re a \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. Re (linepath a b u - z) = 0
 2. Im (linepath a b u - z) \<noteq> 0
 3. ((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)
 4. Re b - Re a \<noteq> 0
[PROOF STEP]
show "Re(?g u) = 0" "Re b - Re a \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (linepath a b u - z) = 0 &&& Re b - Re a \<noteq> 0
[PROOF STEP]
using \<open>Re(?g u) = 0\<close> \<open>Re b - Re a \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
Re (linepath a b u - z) = 0
Re b - Re a \<noteq> 0

goal (1 subgoal):
 1. Re (linepath a b u - z) = 0 &&& Re b - Re a \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re (linepath a b u - z) = 0
Re b - Re a \<noteq> 0

goal (2 subgoals):
 1. Im (linepath a b u - z) \<noteq> 0
 2. ((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)
[PROOF STEP]
show "Im(?g u) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (linepath a b u - z) \<noteq> 0
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> Im (linepath a b u - z) \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
assume "\<not> Im (linepath a b u - z) \<noteq> 0 "
[PROOF STATE]
proof (state)
this:
\<not> Im (linepath a b u - z) \<noteq> 0

goal (1 subgoal):
 1. \<not> Im (linepath a b u - z) \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> Im (linepath a b u - z) \<noteq> 0
[PROOF STEP]
have "?g u = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> Im (linepath a b u - z) \<noteq> 0

goal (1 subgoal):
 1. linepath a b u - z = 0
[PROOF STEP]
using \<open>Re(?g u) = 0\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> Im (linepath a b u - z) \<noteq> 0
Re (linepath a b u - z) = 0

goal (1 subgoal):
 1. linepath a b u - z = 0
[PROOF STEP]
by (simp add: complex_eq_iff)
[PROOF STATE]
proof (state)
this:
linepath a b u - z = 0

goal (1 subgoal):
 1. \<not> Im (linepath a b u - z) \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
linepath a b u - z = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms \<open>0<u\<close> \<open>u<1\<close>
[PROOF STATE]
proof (prove)
using this:
linepath a b u - z = 0
z \<notin> path_image (linepath a b)
0 < u
u < 1

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding path_image_def
[PROOF STATE]
proof (prove)
using this:
linepath a b u - z = 0
z \<notin> linepath a b ` {0..1}
0 < u
u < 1

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Im (linepath a b u - z) \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)
[PROOF STEP]
show "((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)
[PROOF STEP]
unfolding linepath_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. Re ((1 - t) *\<^sub>R a + t *\<^sub>R b - z)) has_real_derivative Re b - Re a) (at u)
[PROOF STEP]
by (auto intro!:derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. Re (linepath a b t - z)) has_real_derivative Re b - Re a) (at u)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if sgn (Re b - Re a) = sgn (Im (linepath a b u - z)) then 1 else - 1)

goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if sgn (Re b - Re a) = sgn (Im (linepath a b u - z)) then 1 else - 1)

goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
[PROOF STEP]
have "sgn (Re b - Re a) = sgn (Im(?g u)) \<longleftrightarrow> c3 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
have "Im(?g u) = c3/(Re b-Re a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (linepath a b u - z) = c3 / (Re b - Re a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im (linepath a b u - z) = c3 / (Re b - Re a)
[PROOF STEP]
define ba where "ba = Re b-Re a"
[PROOF STATE]
proof (state)
this:
ba = Re b - Re a

goal (1 subgoal):
 1. Im (linepath a b u - z) = c3 / (Re b - Re a)
[PROOF STEP]
have "ba\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ba \<noteq> 0
[PROOF STEP]
using \<open>Re b - Re a \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
Re b - Re a \<noteq> 0

goal (1 subgoal):
 1. ba \<noteq> 0
[PROOF STEP]
unfolding ba_def
[PROOF STATE]
proof (prove)
using this:
Re b - Re a \<noteq> 0

goal (1 subgoal):
 1. Re b - Re a \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ba \<noteq> 0

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

goal (1 subgoal):
 1. Im (linepath a b u - z) = c3 / (Re b - Re a)
[PROOF STEP]
unfolding linepath_def u_def c3_def
[PROOF STATE]
proof (prove)
using this:
ba \<noteq> 0

goal (1 subgoal):
 1. Im ((1 - (Re z - Re a) / (Re b - Re a)) *\<^sub>R a + ((Re z - Re a) / (Re b - Re a)) *\<^sub>R b - z) = (Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a) / (Re b - Re a)
[PROOF STEP]
apply (fold ba_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ba \<noteq> 0 \<Longrightarrow> Im ((1 - (Re z - Re a) / ba) *\<^sub>R a + ((Re z - Re a) / ba) *\<^sub>R b - z) = (Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a) / ba
[PROOF STEP]
apply (auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ba \<noteq> 0 \<Longrightarrow> ba * Im a + (Im a * Re a + Im z * Re b) = ba * Im z + (Im a * Re b + Im z * Re a)
[PROOF STEP]
by (auto simp add:algebra_simps ba_def)
[PROOF STATE]
proof (state)
this:
Im (linepath a b u - z) = c3 / (Re b - Re a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Im (linepath a b u - z) = c3 / (Re b - Re a)

goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Im (linepath a b u - z) = c3 / (Re b - Re a)
[PROOF STEP]
have "sgn (Re b - Re a) = sgn (Im(?g u)) \<longleftrightarrow> sgn (Re b - Re a) = sgn (c3/(Re b-Re a))"
[PROOF STATE]
proof (prove)
using this:
Im (linepath a b u - z) = c3 / (Re b - Re a)

goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (sgn (Re b - Re a) = sgn (c3 / (Re b - Re a)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (sgn (Re b - Re a) = sgn (c3 / (Re b - Re a)))

goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (sgn (Re b - Re a) = sgn (c3 / (Re b - Re a)))

goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
have "... \<longleftrightarrow> c3>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (c3 / (Re b - Re a))) = (0 < c3)
[PROOF STEP]
using \<open>Re b-Re a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
Re b - Re a \<noteq> 0

goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (c3 / (Re b - Re a))) = (0 < c3)
[PROOF STEP]
apply (cases "0::real" c3 rule:linorder_cases)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>Re b - Re a \<noteq> 0; 0 < c3\<rbrakk> \<Longrightarrow> (sgn (Re b - Re a) = sgn (c3 / (Re b - Re a))) = (0 < c3)
 2. \<lbrakk>Re b - Re a \<noteq> 0; 0 = c3\<rbrakk> \<Longrightarrow> (sgn (Re b - Re a) = sgn (c3 / (Re b - Re a))) = (0 < c3)
 3. \<lbrakk>Re b - Re a \<noteq> 0; c3 < 0\<rbrakk> \<Longrightarrow> (sgn (Re b - Re a) = sgn (c3 / (Re b - Re a))) = (0 < c3)
[PROOF STEP]
by (auto simp add:sgn_zero_iff)
[PROOF STATE]
proof (state)
this:
(sgn (Re b - Re a) = sgn (c3 / (Re b - Re a))) = (0 < c3)

goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)

goal (1 subgoal):
 1. (sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)

goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if sgn (Re b - Re a) = sgn (Im (linepath a b u - z)) then 1 else - 1)
(sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if sgn (Re b - Re a) = sgn (Im (linepath a b u - z)) then 1 else - 1)
(sgn (Re b - Re a) = sgn (Im (linepath a b u - z))) = (0 < c3)

goal (1 subgoal):
 1. jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
using c1c2_diff_sgn
[PROOF STATE]
proof (prove)
using this:
cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u
jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1)
0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
apply (fold c1_def c2_def c3_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cindex_path (linepath a b) z = jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u; jump (\<lambda>t. Im (linepath a b t - z) / Re (linepath a b t - z)) u = (if 0 < c3 then 1 else - 1); 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2\<rbrakk> \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = c1; c2 = c2; c3 = c3 in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2) \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2) \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 \<Longrightarrow> cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal (1 subgoal):
 1. cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cindex_path (linepath a b) z = (let c1 = Re a - Re z; c2 = Re b - Re z; c3 = Im a * Re b + Re z * Im b + Im z * Re a - Im z * Re b - Im b * Re a - Re z * Im a in if 0 < c1 \<and> c2 < 0 \<or> c1 < 0 \<and> 0 < c2 then if 0 < c3 then 1 else - 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma RR1_difference:
  assumes "RR1_spec A T" "RR1_spec B U"
  shows "RR1_spec (difference_reg A B) (T - U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RR1_spec (difference_reg A B) (T - U)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
RR1_spec A T
RR1_spec B U

goal (1 subgoal):
 1. RR1_spec (difference_reg A B) (T - U)
[PROOF STEP]
by (auto simp: RR1_spec_def \<L>_difference_reg)


[STATEMENT]
lemma rel_fun_trans2':
  "rel_fun R (=) f1 f1' \<Longrightarrow> rel_fun R (=) f2 f2' \<Longrightarrow>
    rel_fun R (=) (\<lambda>x. g (f1 x) (f2 x)) (\<lambda>y. g (f1' y) (f2' y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rel_fun R (=) f1 f1'; rel_fun R (=) f2 f2'\<rbrakk> \<Longrightarrow> rel_fun R (=) (\<lambda>x. g (f1 x) (f2 x)) (\<lambda>y. g (f1' y) (f2' y))
[PROOF STEP]
by (auto simp: rel_fun_def)


[STATEMENT]
lemma prime_not_2_order_not_1_mod:
 assumes "prime p "
         "p > 2 "
         "ord p g > 2"
 shows   "[g \<noteq> 1] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [g \<noteq> 1::'a] (mod p)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [g = 1::'a] (mod p) \<Longrightarrow> False
[PROOF STEP]
assume "[g = 1] (mod p)"
[PROOF STATE]
proof (state)
this:
[g = 1::'a] (mod p)

goal (1 subgoal):
 1. [g = 1::'a] (mod p) \<Longrightarrow> False
[PROOF STEP]
hence "ord p g = 1"
[PROOF STATE]
proof (prove)
using this:
[g = 1::'a] (mod p)

goal (1 subgoal):
 1. ord p g = 1
[PROOF STEP]
unfolding ord_def
[PROOF STATE]
proof (prove)
using this:
[g = 1::'a] (mod p)

goal (1 subgoal):
 1. (if coprime p g then LEAST d. 0 < d \<and> [g ^ d = 1::'a] (mod p) else 0) = 1
[PROOF STEP]
by(split if_split, metis assms(1) assms(2) assms(3) ord_cong prime_not_2_order_not_1)
[PROOF STATE]
proof (state)
this:
ord p g = 1

goal (1 subgoal):
 1. [g = 1::'a] (mod p) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ord p g = 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
ord p g = 1

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ord p g = 1
prime p
(2::'a) < p
2 < ord p g

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prob_Max_IID_geometric_atMost:
  assumes "p \<in> {0..1}"
  shows "measure_pmf.prob (H\<^sub>N n) {..i}
       = (measure_pmf.prob (geometric_pmf p) {..i}) ^ n" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
note SL_def[simp] SL\<^sub>N_def[simp] H_def[simp] H\<^sub>N_def[simp]
[PROOF STATE]
proof (state)
this:
SL ?A = Pi_pmf.Pi_pmf ?A 0 (\<lambda>_. geometric_pmf p)
SL\<^sub>N ?n = SL {..<?n}
H ?A = map_pmf (\<lambda>f. Max (f ` ?A \<union> {0})) (SL ?A)
H\<^sub>N ?n = H {..<?n}

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
have "{f. Max\<^sub>0 (f ` {..<n}) \<le> i}  = {..<n} \<rightarrow> {..i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. Max (f ` {..<n} \<union> {0}) \<le> i} = {..<n} \<rightarrow> {..i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f. Max (f ` {..<n} \<union> {0}) \<le> i} = {..<n} \<rightarrow> {..i}

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{f. Max (f ` {..<n} \<union> {0}) \<le> i} = {..<n} \<rightarrow> {..i}
[PROOF STEP]
have "?lhs = measure_pmf.prob (SL\<^sub>N n) ({..<n} \<rightarrow> {..i})"
[PROOF STATE]
proof (prove)
using this:
{f. Max (f ` {..<n} \<union> {0}) \<le> i} = {..<n} \<rightarrow> {..i}

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (SL\<^sub>N n) ({..<n} \<rightarrow> {..i})
[PROOF STEP]
by (simp add: vimage_def)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (SL\<^sub>N n) ({..<n} \<rightarrow> {..i})

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (SL\<^sub>N n) ({..<n} \<rightarrow> {..i})

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
have "\<dots> = measure_pmf.prob (SL\<^sub>N n) (PiE_dflt {..<n} 0 (\<lambda>_. {..i}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (SL\<^sub>N n) ({..<n} \<rightarrow> {..i}) = measure_pmf.prob (SL\<^sub>N n) (Pi_pmf.PiE_dflt {..<n} 0 (\<lambda>_. {..i}))
[PROOF STEP]
by (intro measure_prob_cong_0) (auto simp add: PiE_dflt_def pmf_Pi split: if_splits)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (SL\<^sub>N n) ({..<n} \<rightarrow> {..i}) = measure_pmf.prob (SL\<^sub>N n) (Pi_pmf.PiE_dflt {..<n} 0 (\<lambda>_. {..i}))

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (SL\<^sub>N n) ({..<n} \<rightarrow> {..i}) = measure_pmf.prob (SL\<^sub>N n) (Pi_pmf.PiE_dflt {..<n} 0 (\<lambda>_. {..i}))

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
have "\<dots> = measure_pmf.prob (geometric_pmf p) {..i} ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (SL\<^sub>N n) (Pi_pmf.PiE_dflt {..<n} 0 (\<lambda>_. {..i})) = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. measure_pmf.prob (SL\<^sub>N n) (Pi_pmf.PiE_dflt {..<n} 0 (\<lambda>_. {..i})) = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
by (auto simp add: measure_Pi_pmf_PiE_dflt)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (SL\<^sub>N n) (Pi_pmf.PiE_dflt {..<n} 0 (\<lambda>_. {..i})) = measure_pmf.prob (geometric_pmf p) {..i} ^ n

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n

goal (1 subgoal):
 1. measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (H\<^sub>N n) {..i} = measure_pmf.prob (geometric_pmf p) {..i} ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_subset_ex:
  assumes "finite A" "n \<le> card A"
  shows "\<exists>B \<subseteq> A. card B = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B\<subseteq>A. card B = n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
n \<le> card A

goal (1 subgoal):
 1. \<exists>B\<subseteq>A. card B = n
[PROOF STEP]
proof (induction A arbitrary: n rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. n \<le> card {} \<Longrightarrow> \<exists>B\<subseteq>{}. card B = n
 2. \<And>x F n. \<lbrakk>finite F; x \<notin> F; \<And>n. n \<le> card F \<Longrightarrow> \<exists>B\<subseteq>F. card B = n; n \<le> card (insert x F)\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>insert x F. card B = n
[PROOF STEP]
case (insert x A)
[PROOF STATE]
proof (state)
this:
finite A
x \<notin> A
?n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = ?n
n \<le> card (insert x A)

goal (2 subgoals):
 1. \<And>n. n \<le> card {} \<Longrightarrow> \<exists>B\<subseteq>{}. card B = n
 2. \<And>x F n. \<lbrakk>finite F; x \<notin> F; \<And>n. n \<le> card F \<Longrightarrow> \<exists>B\<subseteq>F. card B = n; n \<le> card (insert x F)\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>insert x F. card B = n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
using card.empty
[PROOF STATE]
proof (prove)
using this:
n = 0
card {} = 0

goal (1 subgoal):
 1. \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>B\<subseteq>insert x A. card B = n

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
n = Suc k

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = Suc k
[PROOF STEP]
have "\<exists>B \<subseteq> A. card B = k"
[PROOF STATE]
proof (prove)
using this:
n = Suc k

goal (1 subgoal):
 1. \<exists>B\<subseteq>A. card B = k
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
n = Suc k
finite A
x \<notin> A
?n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = ?n
n \<le> card (insert x A)

goal (1 subgoal):
 1. \<exists>B\<subseteq>A. card B = k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>B\<subseteq>A. card B = k

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>B\<subseteq>A. card B = k
[PROOF STEP]
obtain B where "B \<subseteq> A" "card B = k"
[PROOF STATE]
proof (prove)
using this:
\<exists>B\<subseteq>A. card B = k

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<subseteq> A; card B = k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<subseteq> A
card B = k

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
B \<subseteq> A
card B = k

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
B \<subseteq> A
card B = k
[PROOF STEP]
have "finite B"
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A
card B = k

goal (1 subgoal):
 1. finite B
[PROOF STEP]
using insert.hyps finite_subset
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A
card B = k
finite A
x \<notin> A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

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

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
B \<subseteq> A
card B = k
finite B
[PROOF STEP]
have "card (insert x B) = n"
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A
card B = k
finite B

goal (1 subgoal):
 1. card (insert x B) = n
[PROOF STEP]
using Suc insert.hyps card_insert_disjoint
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A
card B = k
finite B
n = Suc k
finite A
x \<notin> A
\<lbrakk>finite ?A; ?x \<notin> ?A\<rbrakk> \<Longrightarrow> card (insert ?x ?A) = Suc (card ?A)

goal (1 subgoal):
 1. card (insert x B) = n
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card (insert x B) = n

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (insert x B) = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (insert x B) = n

goal (1 subgoal):
 1. \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
using \<open>B \<subseteq> A\<close>
[PROOF STATE]
proof (prove)
using this:
card (insert x B) = n
B \<subseteq> A

goal (1 subgoal):
 1. \<exists>B\<subseteq>insert x A. card B = n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>B\<subseteq>insert x A. card B = n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>B\<subseteq>insert x A. card B = n

goal (1 subgoal):
 1. \<And>n. n \<le> card {} \<Longrightarrow> \<exists>B\<subseteq>{}. card B = n
[PROOF STEP]
qed auto


[STATEMENT]
lemma inj_congruence:
  assumes "mat_det M \<noteq> 0" and "congruence M H = congruence M H'"
  shows "H = H'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H = H'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. H = H'
[PROOF STEP]
have "H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mat_det M \<noteq> 0
congruence M H = congruence M H'

goal (1 subgoal):
 1. H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M
[PROOF STEP]
using mult_mm_cancel_l[of "mat_adj M" "H *\<^sub>m\<^sub>m M" "H' *\<^sub>m\<^sub>m M"]
[PROOF STATE]
proof (prove)
using this:
mat_det M \<noteq> 0
congruence M H = congruence M H'
\<lbrakk>mat_det (mat_adj M) \<noteq> 0; mat_adj M *\<^sub>m\<^sub>m (H *\<^sub>m\<^sub>m M) = mat_adj M *\<^sub>m\<^sub>m (H' *\<^sub>m\<^sub>m M)\<rbrakk> \<Longrightarrow> H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M

goal (1 subgoal):
 1. H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M
[PROOF STEP]
by (simp add: mat_det_adj mult_mm_assoc)
[PROOF STATE]
proof (state)
this:
H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M

goal (1 subgoal):
 1. H = H'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M

goal (1 subgoal):
 1. H = H'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M
mat_det M \<noteq> 0
congruence M H = congruence M H'

goal (1 subgoal):
 1. H = H'
[PROOF STEP]
using mult_mm_cancel_r[of "M" "H" "H'"]
[PROOF STATE]
proof (prove)
using this:
H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M
mat_det M \<noteq> 0
congruence M H = congruence M H'
\<lbrakk>mat_det M \<noteq> 0; H *\<^sub>m\<^sub>m M = H' *\<^sub>m\<^sub>m M\<rbrakk> \<Longrightarrow> H = H'

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inside_inside:
    assumes "S \<subseteq> inside T"
    shows "inside S - T \<subseteq> inside T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inside S - T \<subseteq> inside T
[PROOF STEP]
unfolding inside_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x \<notin> S \<and> bounded (connected_component_set (- S) x)} - T \<subseteq> {x. x \<notin> T \<and> bounded (connected_component_set (- T) x)}
[PROOF STEP]
proof clarify
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<notin> T; x \<notin> S; bounded (connected_component_set (- S) x)\<rbrakk> \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<notin> T; x \<notin> S; bounded (connected_component_set (- S) x)\<rbrakk> \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
assume x: "x \<notin> T" "x \<notin> S" and bo: "bounded (connected_component_set (- S) x)"
[PROOF STATE]
proof (state)
this:
x \<notin> T
x \<notin> S
bounded (connected_component_set (- S) x)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<notin> T; x \<notin> S; bounded (connected_component_set (- S) x)\<rbrakk> \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
show "bounded (connected_component_set (- T) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (connected_component_set (- T) x)
[PROOF STEP]
proof (cases "S \<inter> connected_component_set (- T) x = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S \<inter> connected_component_set (- T) x = {} \<Longrightarrow> bounded (connected_component_set (- T) x)
 2. S \<inter> connected_component_set (- T) x \<noteq> {} \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S \<inter> connected_component_set (- T) x = {}

goal (2 subgoals):
 1. S \<inter> connected_component_set (- T) x = {} \<Longrightarrow> bounded (connected_component_set (- T) x)
 2. S \<inter> connected_component_set (- T) x \<noteq> {} \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<inter> connected_component_set (- T) x = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<inter> connected_component_set (- T) x = {}

goal (1 subgoal):
 1. bounded (connected_component_set (- T) x)
[PROOF STEP]
by (metis bounded_subset [OF bo] compl_le_compl_iff connected_component_idemp connected_component_mono disjoint_eq_subset_Compl double_compl)
[PROOF STATE]
proof (state)
this:
bounded (connected_component_set (- T) x)

goal (1 subgoal):
 1. S \<inter> connected_component_set (- T) x \<noteq> {} \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<inter> connected_component_set (- T) x \<noteq> {} \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<inter> connected_component_set (- T) x \<noteq> {}

goal (1 subgoal):
 1. S \<inter> connected_component_set (- T) x \<noteq> {} \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<inter> connected_component_set (- T) x \<noteq> {}
[PROOF STEP]
obtain y where y: "y  \<in> S" "y \<in> connected_component_set (- T) x"
[PROOF STATE]
proof (prove)
using this:
S \<inter> connected_component_set (- T) x \<noteq> {}

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> S; y \<in> connected_component_set (- T) x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson disjoint_iff)
[PROOF STATE]
proof (state)
this:
y \<in> S
y \<in> connected_component_set (- T) x

goal (1 subgoal):
 1. S \<inter> connected_component_set (- T) x \<noteq> {} \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> S
y \<in> connected_component_set (- T) x
[PROOF STEP]
have "bounded (connected_component_set (- T) y)"
[PROOF STATE]
proof (prove)
using this:
y \<in> S
y \<in> connected_component_set (- T) x

goal (1 subgoal):
 1. bounded (connected_component_set (- T) y)
[PROOF STEP]
using assms [unfolded inside_def]
[PROOF STATE]
proof (prove)
using this:
y \<in> S
y \<in> connected_component_set (- T) x
S \<subseteq> {x. x \<notin> T \<and> bounded (connected_component_set (- T) x)}

goal (1 subgoal):
 1. bounded (connected_component_set (- T) y)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bounded (connected_component_set (- T) y)

goal (1 subgoal):
 1. S \<inter> connected_component_set (- T) x \<noteq> {} \<Longrightarrow> bounded (connected_component_set (- T) x)
[PROOF STEP]
with y
[PROOF STATE]
proof (chain)
picking this:
y \<in> S
y \<in> connected_component_set (- T) x
bounded (connected_component_set (- T) y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<in> S
y \<in> connected_component_set (- T) x
bounded (connected_component_set (- T) y)

goal (1 subgoal):
 1. bounded (connected_component_set (- T) x)
[PROOF STEP]
by (metis connected_component_eq)
[PROOF STATE]
proof (state)
this:
bounded (connected_component_set (- T) x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bounded (connected_component_set (- T) x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_fold_remove1_distinct:
  assumes "distinct xs" shows "set (fold remove1 ys xs) = set xs - set ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (fold remove1 ys xs) = set xs - set ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. set (fold remove1 ys xs) = set xs - set ys
[PROOF STEP]
by (induct ys arbitrary: xs) auto