[STATEMENT]
theorem (in valid_unMultigraph) euclerian_path_ex:
  assumes "is_Eulerian_trail v ps v'" "finite V" "finite E"
  shows "(\<forall>v\<in>V. even (degree v G)) \<or> (num_of_odd_nodes G =2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
obtain v ps v' where path:"is_Eulerian_trail v ps v'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v ps v'. is_Eulerian_trail v ps v' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_Eulerian_trail v ps v'
finite V
finite E

goal (1 subgoal):
 1. (\<And>v ps v'. is_Eulerian_trail v ps v' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_Eulerian_trail v ps v'

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence "edges (rem_unPath ps G) = {}"
[PROOF STATE]
proof (prove)
using this:
is_Eulerian_trail v ps v'

goal (1 subgoal):
 1. edges (rem_unPath ps G) = {}
[PROOF STEP]
unfolding  is_Eulerian_trail_def
[PROOF STATE]
proof (prove)
using this:
is_trail v ps v' \<and> edges (rem_unPath ps G) = {}

goal (1 subgoal):
 1. edges (rem_unPath ps G) = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
edges (rem_unPath ps G) = {}

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
edges (rem_unPath ps G) = {}

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "nodes (rem_unPath ps G)=nodes G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes (rem_unPath ps G) = V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nodes (rem_unPath ps G) = V

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
edges (rem_unPath ps G) = {}
nodes (rem_unPath ps G) = V
[PROOF STEP]
have "rem_unPath ps G = G \<lparr>edges:={}\<rparr>"
[PROOF STATE]
proof (prove)
using this:
edges (rem_unPath ps G) = {}
nodes (rem_unPath ps G) = V

goal (1 subgoal):
 1. rem_unPath ps G = G\<lparr>edges := {}\<rparr>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rem_unPath ps G = G\<lparr>edges := {}\<rparr>

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence odd_nodes: "num_of_odd_nodes (rem_unPath ps G) = 0"
[PROOF STATE]
proof (prove)
using this:
rem_unPath ps G = G\<lparr>edges := {}\<rparr>

goal (1 subgoal):
 1. num_of_odd_nodes (rem_unPath ps G) = 0
[PROOF STEP]
by (metis assms(2) odd_nodes_no_edge)
[PROOF STATE]
proof (state)
this:
num_of_odd_nodes (rem_unPath ps G) = 0

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "v\<noteq>v' \<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<noteq> v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
proof (cases "even(degree v' G)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
even (degree v' G)

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
assume "v\<noteq>v'"
[PROOF STATE]
proof (state)
this:
v \<noteq> v'

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "is_trail v ps v'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_trail v ps v'
[PROOF STEP]
by (metis is_Eulerian_trail_def path)
[PROOF STATE]
proof (state)
this:
is_trail v ps v'

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence "num_of_odd_nodes (rem_unPath ps G) = num_of_odd_nodes G
          + (if even (degree v G) then 2 else 0)"
[PROOF STATE]
proof (prove)
using this:
is_trail v ps v'

goal (1 subgoal):
 1. num_of_odd_nodes (rem_unPath ps G) = num_of_odd_nodes G + (if even (degree v G) then 2 else 0)
[PROOF STEP]
using rem_UnPath_even True \<open>finite V\<close> \<open>finite E\<close> \<open>v\<noteq>v'\<close>
[PROOF STATE]
proof (prove)
using this:
is_trail v ps v'
\<lbrakk>finite E; finite V; is_trail ?v ?ps ?v'; even (degree ?v' G)\<rbrakk> \<Longrightarrow> num_of_odd_nodes (rem_unPath ?ps G) = num_of_odd_nodes G + (if even (degree ?v G) \<and> ?v \<noteq> ?v' then 2 else 0)
even (degree v' G)
finite V
finite E
v \<noteq> v'

goal (1 subgoal):
 1. num_of_odd_nodes (rem_unPath ps G) = num_of_odd_nodes G + (if even (degree v G) then 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
num_of_odd_nodes (rem_unPath ps G) = num_of_odd_nodes G + (if even (degree v G) then 2 else 0)

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence "num_of_odd_nodes G + (if even (degree v G) then 2 else 0)=0"
[PROOF STATE]
proof (prove)
using this:
num_of_odd_nodes (rem_unPath ps G) = num_of_odd_nodes G + (if even (degree v G) then 2 else 0)

goal (1 subgoal):
 1. num_of_odd_nodes G + (if even (degree v G) then 2 else 0) = 0
[PROOF STEP]
using odd_nodes
[PROOF STATE]
proof (prove)
using this:
num_of_odd_nodes (rem_unPath ps G) = num_of_odd_nodes G + (if even (degree v G) then 2 else 0)
num_of_odd_nodes (rem_unPath ps G) = 0

goal (1 subgoal):
 1. num_of_odd_nodes G + (if even (degree v G) then 2 else 0) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
num_of_odd_nodes G + (if even (degree v G) then 2 else 0) = 0

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence "num_of_odd_nodes G = 0"
[PROOF STATE]
proof (prove)
using this:
num_of_odd_nodes G + (if even (degree v G) then 2 else 0) = 0

goal (1 subgoal):
 1. num_of_odd_nodes G = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
num_of_odd_nodes G = 0

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
num_of_odd_nodes G = 0

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "finite(odd_nodes_set G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (odd_nodes_set G)
[PROOF STEP]
using \<open>finite V\<close>
[PROOF STATE]
proof (prove)
using this:
finite V

goal (1 subgoal):
 1. finite (odd_nodes_set G)
[PROOF STEP]
unfolding odd_nodes_set_def
[PROOF STATE]
proof (prove)
using this:
finite V

goal (1 subgoal):
 1. finite {v \<in> V. odd (degree v G)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (odd_nodes_set G)

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
num_of_odd_nodes G = 0
finite (odd_nodes_set G)
[PROOF STEP]
have "odd_nodes_set G = {}"
[PROOF STATE]
proof (prove)
using this:
num_of_odd_nodes G = 0
finite (odd_nodes_set G)

goal (1 subgoal):
 1. odd_nodes_set G = {}
[PROOF STEP]
unfolding num_of_odd_nodes_def
[PROOF STATE]
proof (prove)
using this:
card (odd_nodes_set G) = 0
finite (odd_nodes_set G)

goal (1 subgoal):
 1. odd_nodes_set G = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
odd_nodes_set G = {}

goal (2 subgoals):
 1. \<lbrakk>v \<noteq> v'; even (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
 2. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
odd_nodes_set G = {}

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
unfolding odd_nodes_set_def
[PROOF STATE]
proof (prove)
using this:
{v \<in> V. odd (degree v G)} = {}

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
odd (degree v' G)

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
assume "v\<noteq>v'"
[PROOF STATE]
proof (state)
this:
v \<noteq> v'

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "is_trail v ps v'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_trail v ps v'
[PROOF STEP]
by (metis is_Eulerian_trail_def path)
[PROOF STATE]
proof (state)
this:
is_trail v ps v'

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence "num_of_odd_nodes (rem_unPath ps G) = num_of_odd_nodes G
          + (if odd (degree v G) then -2 else 0)"
[PROOF STATE]
proof (prove)
using this:
is_trail v ps v'

goal (1 subgoal):
 1. int (num_of_odd_nodes (rem_unPath ps G)) = int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0)
[PROOF STEP]
using rem_UnPath_odd False \<open>finite V\<close> \<open>finite E\<close> \<open>v\<noteq>v'\<close>
[PROOF STATE]
proof (prove)
using this:
is_trail v ps v'
\<lbrakk>finite E; finite V; is_trail ?v ?ps ?v'; odd (degree ?v' G)\<rbrakk> \<Longrightarrow> int (num_of_odd_nodes (rem_unPath ?ps G)) = int (num_of_odd_nodes G) + (if odd (degree ?v G) \<and> ?v \<noteq> ?v' then - 2 else 0)
odd (degree v' G)
finite V
finite E
v \<noteq> v'

goal (1 subgoal):
 1. int (num_of_odd_nodes (rem_unPath ps G)) = int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (num_of_odd_nodes (rem_unPath ps G)) = int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0)

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence odd_nodes_if: "num_of_odd_nodes G + (if odd (degree v G) then -2 else 0)=0"
[PROOF STATE]
proof (prove)
using this:
int (num_of_odd_nodes (rem_unPath ps G)) = int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0)

goal (1 subgoal):
 1. int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0) = 0
[PROOF STEP]
using odd_nodes
[PROOF STATE]
proof (prove)
using this:
int (num_of_odd_nodes (rem_unPath ps G)) = int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0)
num_of_odd_nodes (rem_unPath ps G) = 0

goal (1 subgoal):
 1. int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0) = 0

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "odd (degree v G) \<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. odd (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
assume "odd (degree v G)"
[PROOF STATE]
proof (state)
this:
odd (degree v G)

goal (1 subgoal):
 1. odd (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence "num_of_odd_nodes G = 2"
[PROOF STATE]
proof (prove)
using this:
odd (degree v G)

goal (1 subgoal):
 1. num_of_odd_nodes G = 2
[PROOF STEP]
using odd_nodes_if
[PROOF STATE]
proof (prove)
using this:
odd (degree v G)
int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0) = 0

goal (1 subgoal):
 1. num_of_odd_nodes G = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
num_of_odd_nodes G = 2

goal (1 subgoal):
 1. odd (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
num_of_odd_nodes G = 2

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
odd (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
odd (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "even(degree v G) \<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
assume "even (degree v G)"
[PROOF STATE]
proof (state)
this:
even (degree v G)

goal (1 subgoal):
 1. even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
hence "num_of_odd_nodes G = 0"
[PROOF STATE]
proof (prove)
using this:
even (degree v G)

goal (1 subgoal):
 1. num_of_odd_nodes G = 0
[PROOF STEP]
using odd_nodes_if
[PROOF STATE]
proof (prove)
using this:
even (degree v G)
int (num_of_odd_nodes G) + (if odd (degree v G) then - 2 else 0) = 0

goal (1 subgoal):
 1. num_of_odd_nodes G = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
num_of_odd_nodes G = 0

goal (1 subgoal):
 1. even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
num_of_odd_nodes G = 0

goal (1 subgoal):
 1. even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "finite(odd_nodes_set G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (odd_nodes_set G)
[PROOF STEP]
using \<open>finite V\<close>
[PROOF STATE]
proof (prove)
using this:
finite V

goal (1 subgoal):
 1. finite (odd_nodes_set G)
[PROOF STEP]
unfolding odd_nodes_set_def
[PROOF STATE]
proof (prove)
using this:
finite V

goal (1 subgoal):
 1. finite {v \<in> V. odd (degree v G)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (odd_nodes_set G)

goal (1 subgoal):
 1. even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
num_of_odd_nodes G = 0
finite (odd_nodes_set G)
[PROOF STEP]
have "odd_nodes_set G = {}"
[PROOF STATE]
proof (prove)
using this:
num_of_odd_nodes G = 0
finite (odd_nodes_set G)

goal (1 subgoal):
 1. odd_nodes_set G = {}
[PROOF STEP]
unfolding num_of_odd_nodes_def
[PROOF STATE]
proof (prove)
using this:
card (odd_nodes_set G) = 0
finite (odd_nodes_set G)

goal (1 subgoal):
 1. odd_nodes_set G = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
odd_nodes_set G = {}

goal (1 subgoal):
 1. even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
odd_nodes_set G = {}

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
unfolding odd_nodes_set_def
[PROOF STATE]
proof (prove)
using this:
{v \<in> V. odd (degree v G)} = {}

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. \<lbrakk>v \<noteq> v'; odd (degree v' G)\<rbrakk> \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
odd (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
odd (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
even (degree v G) \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
v \<noteq> v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
v \<noteq> v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
have "v=v'\<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
by (metis assms(2) assms(3) euclerian_cycle_ex is_Eulerian_circuit_def path)
[PROOF STATE]
proof (state)
this:
v = v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
v \<noteq> v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
v = v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
v \<noteq> v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
v = v' \<Longrightarrow> (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal (1 subgoal):
 1. (\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>v\<in>V. even (degree v G)) \<or> num_of_odd_nodes G = 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sort_map_mono:
  fixes f :: "nat \<Rightarrow> 'b :: linorder"
  shows "j < n \<Longrightarrow> i \<le> j \<Longrightarrow> sort_map f n i \<le> sort_map f n j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < n; i \<le> j\<rbrakk> \<Longrightarrow> sort_map f n i \<le> sort_map f n j
[PROOF STEP]
by (metis sort_map_strict_mono eq_iff le_imp_less_or_eq)


[STATEMENT]
lemma cmod_add_squared:
  fixes r1 r2::real
  assumes "r1 \<ge> 0" "r2 \<ge> 0"
  shows "(cmod (r1 * exp (\<i> * \<theta>1) + r2 * exp (\<i> * \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)" (is "(cmod (?z1 + ?z2))\<^sup>2 = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
have "(cmod (?z1 + ?z2))\<^sup>2 = (?z1 + ?z2) * cnj (?z1 + ?z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2) = (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))
[PROOF STEP]
by (rule complex_norm_square)
[PROOF STATE]
proof (state)
this:
complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2) = (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2) = (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
have "\<dots> = (?z1 * cnj ?z1 + ?z2 * cnj ?z2) + (?z1 * cnj ?z2 + cnj ?z1 * ?z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) = complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) * (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) = complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) * (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) = complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) * (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
have "\<dots> = (norm ?z1)\<^sup>2 + (norm ?z2)\<^sup>2 + 2 * Re (?z1 * cnj ?z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) * (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))) = complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)))\<^sup>2 + (cmod (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 + 2 * Re (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))))
[PROOF STEP]
unfolding complex_norm_square [symmetric] cnj_add_mult_eq_Re
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)))\<^sup>2) + complex_of_real ((cmod (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2) + complex_of_real (2 * Re (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))) = complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)))\<^sup>2 + (cmod (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 + 2 * Re (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) * (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))) = complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)))\<^sup>2 + (cmod (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 + 2 * Re (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)) + cnj (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)) * (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))) = complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)))\<^sup>2 + (cmod (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 + 2 * Re (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2))))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)))\<^sup>2 + (cmod (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 + 2 * Re (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))) = complex_of_real (r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2))
[PROOF STEP]
by (simp add: norm_mult) (simp add: exp_Euler complex_is_Real_iff [THEN iffD1] cos_diff algebra_simps)
[PROOF STATE]
proof (state)
this:
complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1)))\<^sup>2 + (cmod (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 + 2 * Re (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) * cnj (complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))) = complex_of_real (r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2) = complex_of_real (r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2) = complex_of_real (r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
using of_real_eq_iff
[PROOF STATE]
proof (prove)
using this:
complex_of_real ((cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2) = complex_of_real (r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2))
(of_real ?x = of_real ?y) = (?x = ?y)

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_converter_map_converter'2:
  "rel_converter A B C R conv1 (map_converter' f g conv2) = rel_converter A (\<lambda>x y. B x (f y)) (\<lambda>x y. C x (g y)) R conv1 conv2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_converter A B C R conv1 (map_converter' f g conv2) = rel_converter A (\<lambda>x y. B x (f y)) (\<lambda>x y. C x (g y)) R conv1 conv2
[PROOF STEP]
using rel_converter_map_converter'1[of "conversep A" "conversep B" "conversep C" "conversep R" f g conv2 conv1]
[PROOF STATE]
proof (prove)
using this:
rel_converter A\<inverse>\<inverse> B\<inverse>\<inverse> C\<inverse>\<inverse> R\<inverse>\<inverse> (map_converter' f g conv2) conv1 = rel_converter A\<inverse>\<inverse> (\<lambda>x. B\<inverse>\<inverse> (f x)) (\<lambda>x. C\<inverse>\<inverse> (g x)) R\<inverse>\<inverse> conv2 conv1

goal (1 subgoal):
 1. rel_converter A B C R conv1 (map_converter' f g conv2) = rel_converter A (\<lambda>x y. B x (f y)) (\<lambda>x y. C x (g y)) R conv1 conv2
[PROOF STEP]
apply(rewrite in "\<hole> = _" conversep_iff[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_converter A\<inverse>\<inverse> B\<inverse>\<inverse> C\<inverse>\<inverse> R\<inverse>\<inverse> (map_converter' f g conv2) conv1 = rel_converter A\<inverse>\<inverse> (\<lambda>x. B\<inverse>\<inverse> (f x)) (\<lambda>x. C\<inverse>\<inverse> (g x)) R\<inverse>\<inverse> conv2 conv1 \<Longrightarrow> (rel_converter A B C R)\<inverse>\<inverse> (map_converter' f g conv2) conv1 = rel_converter A (\<lambda>x y. B x (f y)) (\<lambda>x y. C x (g y)) R conv1 conv2
[PROOF STEP]
apply(rewrite in "_ = \<hole>" conversep_iff[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_converter A\<inverse>\<inverse> B\<inverse>\<inverse> C\<inverse>\<inverse> R\<inverse>\<inverse> (map_converter' f g conv2) conv1 = rel_converter A\<inverse>\<inverse> (\<lambda>x. B\<inverse>\<inverse> (f x)) (\<lambda>x. C\<inverse>\<inverse> (g x)) R\<inverse>\<inverse> conv2 conv1 \<Longrightarrow> (rel_converter A B C R)\<inverse>\<inverse> (map_converter' f g conv2) conv1 = (rel_converter A (\<lambda>x y. B x (f y)) (\<lambda>x y. C x (g y)) R)\<inverse>\<inverse> conv2 conv1
[PROOF STEP]
apply(simp only: rel_converter_conversep[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_converter A\<inverse>\<inverse> B\<inverse>\<inverse> C\<inverse>\<inverse> R\<inverse>\<inverse> (map_converter' f g conv2) conv1 = rel_converter A\<inverse>\<inverse> (\<lambda>x. B\<inverse>\<inverse> (f x)) (\<lambda>x. C\<inverse>\<inverse> (g x)) R\<inverse>\<inverse> conv2 conv1 \<Longrightarrow> rel_converter A\<inverse>\<inverse> (\<lambda>x. B\<inverse>\<inverse> (f x)) (\<lambda>x. C\<inverse>\<inverse> (g x)) R\<inverse>\<inverse> conv2 conv1 = rel_converter A\<inverse>\<inverse> (\<lambda>x y. B x (f y))\<inverse>\<inverse> (\<lambda>x y. C x (g y))\<inverse>\<inverse> R\<inverse>\<inverse> conv2 conv1
[PROOF STEP]
apply(simp only: conversep_iff[abs_def])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma yun_wrel_gcd: assumes "yun_wrel F c' f" "yun_wrel G c g" and c: "c' \<noteq> 0" "c \<noteq> 0"
  and d: "d = rat_of_int (lead_coeff (gcd F G))" "d \<noteq> 0"
  shows "yun_wrel (gcd F G) d (gcd f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
let ?r = "rat_of_int"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
let ?rp = "map_poly ?r"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
have "smult d (gcd f g) = smult d (gcd (smult c' f) (smult c g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult d (gcd f g) = Polynomial.smult d (gcd (Polynomial.smult c' f) (Polynomial.smult c g))
[PROOF STEP]
by (simp add: c gcd_smult_left gcd_smult_right)
[PROOF STATE]
proof (state)
this:
Polynomial.smult d (gcd f g) = Polynomial.smult d (gcd (Polynomial.smult c' f) (Polynomial.smult c g))

goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polynomial.smult d (gcd f g) = Polynomial.smult d (gcd (Polynomial.smult c' f) (Polynomial.smult c g))

goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
have "\<dots> = smult d (gcd (?rp F) (?rp G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult d (gcd (Polynomial.smult c' f) (Polynomial.smult c g)) = Polynomial.smult d (gcd (of_int_poly F) (of_int_poly G))
[PROOF STEP]
using assms(1-2)[unfolded yun_wrel_def]
[PROOF STATE]
proof (prove)
using this:
of_int_poly F = Polynomial.smult c' f
of_int_poly G = Polynomial.smult c g

goal (1 subgoal):
 1. Polynomial.smult d (gcd (Polynomial.smult c' f) (Polynomial.smult c g)) = Polynomial.smult d (gcd (of_int_poly F) (of_int_poly G))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Polynomial.smult d (gcd (Polynomial.smult c' f) (Polynomial.smult c g)) = Polynomial.smult d (gcd (of_int_poly F) (of_int_poly G))

goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polynomial.smult d (gcd (Polynomial.smult c' f) (Polynomial.smult c g)) = Polynomial.smult d (gcd (of_int_poly F) (of_int_poly G))

goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
have "\<dots> = smult (d * inverse d) (?rp (gcd F G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult d (gcd (of_int_poly F) (of_int_poly G)) = Polynomial.smult (d * inverse d) (of_int_poly (gcd F G))
[PROOF STEP]
unfolding gcd_rat_to_gcd_int d
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (rat_of_int (lead_coeff (gcd F G))) (Polynomial.smult (inverse (rat_of_int (lead_coeff (gcd F G)))) (of_int_poly (gcd F G))) = Polynomial.smult (rat_of_int (lead_coeff (gcd F G)) * inverse (rat_of_int (lead_coeff (gcd F G)))) (of_int_poly (gcd F G))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Polynomial.smult d (gcd (of_int_poly F) (of_int_poly G)) = Polynomial.smult (d * inverse d) (of_int_poly (gcd F G))

goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polynomial.smult d (gcd (of_int_poly F) (of_int_poly G)) = Polynomial.smult (d * inverse d) (of_int_poly (gcd F G))

goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
have "d * inverse d = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d * inverse d = 1
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
d = rat_of_int (lead_coeff (gcd F G))
d \<noteq> 0

goal (1 subgoal):
 1. d * inverse d = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d * inverse d = 1

goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Polynomial.smult d (gcd f g) = Polynomial.smult 1 (of_int_poly (gcd F G))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult d (gcd f g) = Polynomial.smult 1 (of_int_poly (gcd F G))

goal (1 subgoal):
 1. yun_wrel (gcd F G) d (gcd f g)
[PROOF STEP]
unfolding yun_wrel_def
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult d (gcd f g) = Polynomial.smult 1 (of_int_poly (gcd F G))

goal (1 subgoal):
 1. of_int_poly (gcd F G) = Polynomial.smult d (gcd f g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
yun_wrel (gcd F G) d (gcd f g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_to_list_first:
  assumes "card S > 0"
  shows "Min S = set_to_list S ! 0 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min S = sorted_list_of_set S ! 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Min S = sorted_list_of_set S ! 0
[PROOF STEP]
have 0: "set (set_to_list S) = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (sorted_list_of_set S) = S
[PROOF STEP]
using assms card_ge_0_finite set_sorted_list_of_set
[PROOF STATE]
proof (prove)
using this:
0 < card S
0 < card ?A \<Longrightarrow> finite ?A
finite ?A \<Longrightarrow> set (sorted_list_of_set ?A) = ?A

goal (1 subgoal):
 1. set (sorted_list_of_set S) = S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set (sorted_list_of_set S) = S

goal (1 subgoal):
 1. Min S = sorted_list_of_set S ! 0
[PROOF STEP]
have 1: "sorted (set_to_list S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (sorted_list_of_set S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (sorted_list_of_set S)

goal (1 subgoal):
 1. Min S = sorted_list_of_set S ! 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min S = sorted_list_of_set S ! 0
[PROOF STEP]
apply(rule Min_eqI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite S
 2. \<And>y. y \<in> S \<Longrightarrow> sorted_list_of_set S ! 0 \<le> y
 3. sorted_list_of_set S ! 0 \<in> S
[PROOF STEP]
using assms card_ge_0_finite
[PROOF STATE]
proof (prove)
using this:
0 < card S
0 < card ?A \<Longrightarrow> finite ?A

goal (3 subgoals):
 1. finite S
 2. \<And>y. y \<in> S \<Longrightarrow> sorted_list_of_set S ! 0 \<le> y
 3. sorted_list_of_set S ! 0 \<in> S
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. y \<in> S \<Longrightarrow> sorted_list_of_set S ! 0 \<le> y
 2. sorted_list_of_set S ! 0 \<in> S
[PROOF STEP]
apply (metis "0" "1" in_set_conv_nth less_Suc0 less_or_eq_imp_le not_less_eq sorted_iff_nth_mono_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set S ! 0 \<in> S
[PROOF STEP]
by (metis "0" Max_in assms card_0_eq card_ge_0_finite gr_zeroI in_set_conv_nth not_less0)
[PROOF STATE]
proof (state)
this:
Min S = sorted_list_of_set S ! 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_proj_leq:
  assumes "finite PROB"
  shows "card (prob_proj PROB vs) \<le> card PROB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (prob_proj PROB vs) \<le> card PROB
[PROOF STEP]
unfolding prob_proj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>a. action_proj a vs) ` PROB) \<le> card PROB
[PROOF STEP]
using assms card_image_le
[PROOF STATE]
proof (prove)
using this:
finite PROB
finite ?A \<Longrightarrow> card (?f ` ?A) \<le> card ?A

goal (1 subgoal):
 1. card ((\<lambda>a. action_proj a vs) ` PROB) \<le> card PROB
[PROOF STEP]
by blast


[STATEMENT]
lemma degree_power_le: "degree (p ^ n) \<le> degree p * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p ^ n) \<le> degree p * n
[PROOF STEP]
by (induct n) (auto intro: order_trans degree_mult_le)


[STATEMENT]
lemma sorted_msort_bu: "sorted (msort_bu xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (msort_bu xs)
[PROOF STEP]
by(simp add: msort_bu_def sorted_merge_all)


[STATEMENT]
lemma isometry_cblinfun_compose[simp]:
  assumes "isometry A" and "isometry B"
  shows "isometry (A o\<^sub>C\<^sub>L B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry (A o\<^sub>C\<^sub>L B)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isometry (A o\<^sub>C\<^sub>L B)
[PROOF STEP]
have "B* o\<^sub>C\<^sub>L A* o\<^sub>C\<^sub>L (A o\<^sub>C\<^sub>L B) = id_cblinfun" if "A* o\<^sub>C\<^sub>L A = id_cblinfun" and "B* o\<^sub>C\<^sub>L B = id_cblinfun"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B* o\<^sub>C\<^sub>L A* o\<^sub>C\<^sub>L (A o\<^sub>C\<^sub>L B) = id_cblinfun
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
A* o\<^sub>C\<^sub>L A = id_cblinfun
B* o\<^sub>C\<^sub>L B = id_cblinfun

goal (1 subgoal):
 1. B* o\<^sub>C\<^sub>L A* o\<^sub>C\<^sub>L (A o\<^sub>C\<^sub>L B) = id_cblinfun
[PROOF STEP]
by (smt (verit, del_insts) adjoint_eqI cblinfun_apply_cblinfun_compose cblinfun_id_cblinfun_apply)
[PROOF STATE]
proof (state)
this:
\<lbrakk>A* o\<^sub>C\<^sub>L A = id_cblinfun; B* o\<^sub>C\<^sub>L B = id_cblinfun\<rbrakk> \<Longrightarrow> B* o\<^sub>C\<^sub>L A* o\<^sub>C\<^sub>L (A o\<^sub>C\<^sub>L B) = id_cblinfun

goal (1 subgoal):
 1. isometry (A o\<^sub>C\<^sub>L B)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A* o\<^sub>C\<^sub>L A = id_cblinfun; B* o\<^sub>C\<^sub>L B = id_cblinfun\<rbrakk> \<Longrightarrow> B* o\<^sub>C\<^sub>L A* o\<^sub>C\<^sub>L (A o\<^sub>C\<^sub>L B) = id_cblinfun

goal (1 subgoal):
 1. isometry (A o\<^sub>C\<^sub>L B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A* o\<^sub>C\<^sub>L A = id_cblinfun; B* o\<^sub>C\<^sub>L B = id_cblinfun\<rbrakk> \<Longrightarrow> B* o\<^sub>C\<^sub>L A* o\<^sub>C\<^sub>L (A o\<^sub>C\<^sub>L B) = id_cblinfun
isometry A
isometry B

goal (1 subgoal):
 1. isometry (A o\<^sub>C\<^sub>L B)
[PROOF STEP]
unfolding isometry_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A* o\<^sub>C\<^sub>L A = id_cblinfun; B* o\<^sub>C\<^sub>L B = id_cblinfun\<rbrakk> \<Longrightarrow> B* o\<^sub>C\<^sub>L A* o\<^sub>C\<^sub>L (A o\<^sub>C\<^sub>L B) = id_cblinfun
A* o\<^sub>C\<^sub>L A = id_cblinfun
B* o\<^sub>C\<^sub>L B = id_cblinfun

goal (1 subgoal):
 1. (A o\<^sub>C\<^sub>L B)* o\<^sub>C\<^sub>L (A o\<^sub>C\<^sub>L B) = id_cblinfun
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
isometry (A o\<^sub>C\<^sub>L B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma winding_number_as_continuous_log:
  assumes "path p" and \<zeta>: "\<zeta> \<notin> path_image p"
  obtains q where "path q"
                  "pathfinish q - pathstart q = 2 * of_real pi * \<i> * winding_number p \<zeta>"
                  "\<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp(q t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>q. \<lbrakk>path q; pathfinish q - pathstart q = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>; \<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp (q t)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>q. \<lbrakk>path q; pathfinish q - pathstart q = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>; \<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp (q t)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?q = "\<lambda>t. 2 * of_real pi * \<i> * winding_number(subpath 0 t p) \<zeta> + Ln(pathstart p - \<zeta>)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>q. \<lbrakk>path q; pathfinish q - pathstart q = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>; \<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp (q t)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. path ?q
 2. pathfinish ?q - pathstart ?q = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>
 3. \<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp (?q t)
[PROOF STEP]
have *: "continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)"
      if t: "t \<in> {0..1}" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
let ?B = "ball (p t) (norm(p t - \<zeta>))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
have "p t \<noteq> \<zeta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p t \<noteq> \<zeta>
[PROOF STEP]
using path_image_def that \<zeta>
[PROOF STATE]
proof (prove)
using this:
path_image ?g = ?g ` {0..1}
t \<in> {0..1}
\<zeta> \<notin> path_image p

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

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p t \<noteq> \<zeta>
[PROOF STEP]
have "simply_connected ?B"
[PROOF STATE]
proof (prove)
using this:
p t \<noteq> \<zeta>

goal (1 subgoal):
 1. simply_connected (ball (p t) (cmod (p t - \<zeta>)))
[PROOF STEP]
by (simp add: convex_imp_simply_connected)
[PROOF STATE]
proof (state)
this:
simply_connected (ball (p t) (cmod (p t - \<zeta>)))

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
simply_connected (ball (p t) (cmod (p t - \<zeta>)))
[PROOF STEP]
have "\<And>f::complex\<Rightarrow>complex. continuous_on ?B f \<and> (\<forall>\<zeta> \<in> ?B. f \<zeta> \<noteq> 0)
                  \<longrightarrow> (\<exists>g. continuous_on ?B g \<and> (\<forall>\<zeta> \<in> ?B. f \<zeta> = exp (g \<zeta>)))"
[PROOF STATE]
proof (prove)
using this:
simply_connected (ball (p t) (cmod (p t - \<zeta>)))

goal (1 subgoal):
 1. \<And>f. continuous_on (ball (p t) (cmod (p t - \<zeta>))) f \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). f \<zeta> \<noteq> 0) \<longrightarrow> (\<exists>g. continuous_on (ball (p t) (cmod (p t - \<zeta>))) g \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). f \<zeta> = exp (g \<zeta>)))
[PROOF STEP]
by (simp add: simply_connected_eq_continuous_log)
[PROOF STATE]
proof (state)
this:
continuous_on (ball (p t) (cmod (p t - \<zeta>))) ?f \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). ?f \<zeta> \<noteq> 0) \<longrightarrow> (\<exists>g. continuous_on (ball (p t) (cmod (p t - \<zeta>))) g \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). ?f \<zeta> = exp (g \<zeta>)))

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on (ball (p t) (cmod (p t - \<zeta>))) ?f \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). ?f \<zeta> \<noteq> 0) \<longrightarrow> (\<exists>g. continuous_on (ball (p t) (cmod (p t - \<zeta>))) g \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). ?f \<zeta> = exp (g \<zeta>)))

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
have "continuous_on ?B (\<lambda>w. w - \<zeta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (ball (p t) (cmod (p t - \<zeta>))) (\<lambda>w. w - \<zeta>)
[PROOF STEP]
by (intro continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on (ball (p t) (cmod (p t - \<zeta>))) (\<lambda>w. w - \<zeta>)

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on (ball (p t) (cmod (p t - \<zeta>))) (\<lambda>w. w - \<zeta>)

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
have "(\<forall>z \<in> ?B. z - \<zeta> \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>z\<in>ball (p t) (cmod (p t - \<zeta>)). z - \<zeta> \<noteq> 0
[PROOF STEP]
by (auto simp: dist_norm)
[PROOF STATE]
proof (state)
this:
\<forall>z\<in>ball (p t) (cmod (p t - \<zeta>)). z - \<zeta> \<noteq> 0

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
continuous_on (ball (p t) (cmod (p t - \<zeta>))) ?f \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). ?f \<zeta> \<noteq> 0) \<longrightarrow> (\<exists>g. continuous_on (ball (p t) (cmod (p t - \<zeta>))) g \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). ?f \<zeta> = exp (g \<zeta>)))
continuous_on (ball (p t) (cmod (p t - \<zeta>))) (\<lambda>w. w - \<zeta>)
\<forall>z\<in>ball (p t) (cmod (p t - \<zeta>)). z - \<zeta> \<noteq> 0
[PROOF STEP]
obtain g where contg: "continuous_on ?B g"
        and geq: "\<And>z. z \<in> ?B \<Longrightarrow> z - \<zeta> = exp (g z)"
[PROOF STATE]
proof (prove)
using this:
continuous_on (ball (p t) (cmod (p t - \<zeta>))) ?f \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). ?f \<zeta> \<noteq> 0) \<longrightarrow> (\<exists>g. continuous_on (ball (p t) (cmod (p t - \<zeta>))) g \<and> (\<forall>\<zeta>\<in>ball (p t) (cmod (p t - \<zeta>)). ?f \<zeta> = exp (g \<zeta>)))
continuous_on (ball (p t) (cmod (p t - \<zeta>))) (\<lambda>w. w - \<zeta>)
\<forall>z\<in>ball (p t) (cmod (p t - \<zeta>)). z - \<zeta> \<noteq> 0

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_on (ball (p t) (cmod (p t - \<zeta>))) g; \<And>z. z \<in> ball (p t) (cmod (p t - \<zeta>)) \<Longrightarrow> z - \<zeta> = exp (g z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on (ball (p t) (cmod (p t - \<zeta>))) g
?z \<in> ball (p t) (cmod (p t - \<zeta>)) \<Longrightarrow> ?z - \<zeta> = exp (g ?z)

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
obtain d where "0 < d" and d:
        "\<And>x. \<lbrakk>x \<in> {0..1}; dist x t < d\<rbrakk> \<Longrightarrow> dist (p x) (p t) < cmod (p t - \<zeta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>x. \<lbrakk>x \<in> {0..1}; dist x t < d\<rbrakk> \<Longrightarrow> dist (p x) (p t) < cmod (p t - \<zeta>)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>path p\<close> t
[PROOF STATE]
proof (prove)
using this:
path p
t \<in> {0..1}

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>x. \<lbrakk>x \<in> {0..1}; dist x t < d\<rbrakk> \<Longrightarrow> dist (p x) (p t) < cmod (p t - \<zeta>)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding path_def continuous_on_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1}. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>{0..1}. dist x' x < d \<longrightarrow> dist (p x') (p x) < e
t \<in> {0..1}

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>x. \<lbrakk>x \<in> {0..1}; dist x t < d\<rbrakk> \<Longrightarrow> dist (p x) (p t) < cmod (p t - \<zeta>)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis \<open>p t \<noteq> \<zeta>\<close> right_minus_eq zero_less_norm_iff)
[PROOF STATE]
proof (state)
this:
0 < d
\<lbrakk>?x \<in> {0..1}; dist ?x t < d\<rbrakk> \<Longrightarrow> dist (p ?x) (p t) < cmod (p t - \<zeta>)

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
have "((\<lambda>x. winding_number (\<lambda>w. subpath 0 x p w - \<zeta>) 0 -
                  winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0) \<longlongrightarrow> 0)
            (at t within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. winding_number (\<lambda>w. subpath 0 x p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0) \<longlongrightarrow> 0) (at t within {0..1})
[PROOF STEP]
proof (rule Lim_transform_within [OF _ \<open>d > 0\<close>])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (?f \<longlongrightarrow> 0) (at t within {0..1})
 2. \<And>x'. \<lbrakk>x' \<in> {0..1}; 0 < dist x' t; dist x' t < d\<rbrakk> \<Longrightarrow> ?f x' = winding_number (\<lambda>w. subpath 0 x' p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
have "continuous (at t within {0..1}) (g o p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at t within {0..1}) (g \<circ> p)
[PROOF STEP]
proof (rule continuous_within_compose)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. continuous (at t within {0..1}) p
 2. continuous (at (p t) within p ` {0..1}) g
[PROOF STEP]
show "continuous (at t within {0..1}) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at t within {0..1}) p
[PROOF STEP]
using \<open>path p\<close> continuous_on_eq_continuous_within path_def that
[PROOF STATE]
proof (prove)
using this:
path p
continuous_on ?s ?f = (\<forall>x\<in>?s. continuous (at x within ?s) ?f)
path ?g = continuous_on {0..1} ?g
t \<in> {0..1}

goal (1 subgoal):
 1. continuous (at t within {0..1}) p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous (at t within {0..1}) p

goal (1 subgoal):
 1. continuous (at (p t) within p ` {0..1}) g
[PROOF STEP]
show "continuous (at (p t) within p ` {0..1}) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at (p t) within p ` {0..1}) g
[PROOF STEP]
by (metis (no_types, lifting) open_ball UNIV_I \<open>p t \<noteq> \<zeta>\<close> centre_in_ball contg continuous_on_eq_continuous_at continuous_within_topological right_minus_eq zero_less_norm_iff)
[PROOF STATE]
proof (state)
this:
continuous (at (p t) within p ` {0..1}) g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous (at t within {0..1}) (g \<circ> p)

goal (2 subgoals):
 1. (?f \<longlongrightarrow> 0) (at t within {0..1})
 2. \<And>x'. \<lbrakk>x' \<in> {0..1}; 0 < dist x' t; dist x' t < d\<rbrakk> \<Longrightarrow> ?f x' = winding_number (\<lambda>w. subpath 0 x' p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
with LIM_zero
[PROOF STATE]
proof (chain)
picking this:
(?f \<longlongrightarrow> ?l) ?F \<Longrightarrow> ((\<lambda>x. ?f x - ?l) \<longlongrightarrow> (0::?'b)) ?F
continuous (at t within {0..1}) (g \<circ> p)
[PROOF STEP]
have "((\<lambda>u. (g (subpath t u p 1) - g (subpath t u p 0))) \<longlongrightarrow> 0) (at t within {0..1})"
[PROOF STATE]
proof (prove)
using this:
(?f \<longlongrightarrow> ?l) ?F \<Longrightarrow> ((\<lambda>x. ?f x - ?l) \<longlongrightarrow> (0::?'b)) ?F
continuous (at t within {0..1}) (g \<circ> p)

goal (1 subgoal):
 1. ((\<lambda>u. g (subpath t u p 1) - g (subpath t u p 0)) \<longlongrightarrow> 0) (at t within {0..1})
[PROOF STEP]
by (auto simp: subpath_def continuous_within o_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>u. g (subpath t u p 1) - g (subpath t u p 0)) \<longlongrightarrow> 0) (at t within {0..1})

goal (2 subgoals):
 1. (?f \<longlongrightarrow> 0) (at t within {0..1})
 2. \<And>x'. \<lbrakk>x' \<in> {0..1}; 0 < dist x' t; dist x' t < d\<rbrakk> \<Longrightarrow> ?f x' = winding_number (\<lambda>w. subpath 0 x' p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>u. g (subpath t u p 1) - g (subpath t u p 0)) \<longlongrightarrow> 0) (at t within {0..1})
[PROOF STEP]
show "((\<lambda>u.  (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * of_real pi * \<i>)) \<longlongrightarrow> 0)
           (at t within {0..1})"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>u. g (subpath t u p 1) - g (subpath t u p 0)) \<longlongrightarrow> 0) (at t within {0..1})

goal (1 subgoal):
 1. ((\<lambda>u. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>)) \<longlongrightarrow> 0) (at t within {0..1})
[PROOF STEP]
by (simp add: tendsto_divide_zero)
[PROOF STATE]
proof (state)
this:
((\<lambda>u. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>)) \<longlongrightarrow> 0) (at t within {0..1})

goal (1 subgoal):
 1. \<And>x'. \<lbrakk>x' \<in> {0..1}; 0 < dist x' t; dist x' t < d\<rbrakk> \<Longrightarrow> (g (subpath t x' p 1) - g (subpath t x' p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 x' p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
show "(g (subpath t u p 1) - g (subpath t u p 0)) / (2 * of_real pi * \<i>) =
              winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0"
          if "u \<in> {0..1}" "0 < dist u t" "dist u t < d" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
have "closed_segment t u \<subseteq> {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment t u \<subseteq> {0..1}
[PROOF STEP]
using closed_segment_eq_real_ivl t that
[PROOF STATE]
proof (prove)
using this:
closed_segment ?a ?b = (if ?a \<le> ?b then {?a..?b} else {?b..?a})
t \<in> {0..1}
u \<in> {0..1}
0 < dist u t
dist u t < d

goal (1 subgoal):
 1. closed_segment t u \<subseteq> {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed_segment t u \<subseteq> {0..1}

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
closed_segment t u \<subseteq> {0..1}
[PROOF STEP]
have piB: "path_image(subpath t u p) \<subseteq> ?B"
[PROOF STATE]
proof (prove)
using this:
closed_segment t u \<subseteq> {0..1}

goal (1 subgoal):
 1. path_image (subpath t u p) \<subseteq> ball (p t) (cmod (p t - \<zeta>))
[PROOF STEP]
apply (clarsimp simp add: path_image_subpath_gen)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>closed_segment t u \<subseteq> {0..1}; xa \<in> closed_segment t u\<rbrakk> \<Longrightarrow> dist (p t) (p xa) < cmod (p t - \<zeta>)
[PROOF STEP]
by (metis subsetD le_less_trans \<open>dist u t < d\<close> d dist_commute dist_in_closed_segment)
[PROOF STATE]
proof (state)
this:
path_image (subpath t u p) \<subseteq> ball (p t) (cmod (p t - \<zeta>))

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
have *: "path (g \<circ> subpath t u p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path (g \<circ> subpath t u p)
[PROOF STEP]
apply (rule path_continuous_image)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. path (subpath t u p)
 2. continuous_on (path_image (subpath t u p)) g
[PROOF STEP]
using \<open>path p\<close> t that
[PROOF STATE]
proof (prove)
using this:
path p
t \<in> {0..1}
u \<in> {0..1}
0 < dist u t
dist u t < d

goal (2 subgoals):
 1. path (subpath t u p)
 2. continuous_on (path_image (subpath t u p)) g
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (path_image (subpath t u p)) g
[PROOF STEP]
using piB contg continuous_on_subset
[PROOF STATE]
proof (prove)
using this:
path_image (subpath t u p) \<subseteq> ball (p t) (cmod (p t - \<zeta>))
continuous_on (ball (p t) (cmod (p t - \<zeta>))) g
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f

goal (1 subgoal):
 1. continuous_on (path_image (subpath t u p)) g
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
path (g \<circ> subpath t u p)

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
have "(g (subpath t u p 1) - g (subpath t u p 0)) / (2 * of_real pi * \<i>)
              =  winding_number (exp \<circ> g \<circ> subpath t u p) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (exp \<circ> g \<circ> subpath t u p) 0
[PROOF STEP]
using winding_number_compose_exp [OF *]
[PROOF STATE]
proof (prove)
using this:
winding_number (exp \<circ> (g \<circ> subpath t u p)) 0 = (pathfinish (g \<circ> subpath t u p) - pathstart (g \<circ> subpath t u p)) / (2 * complex_of_real pi * \<i>)

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (exp \<circ> g \<circ> subpath t u p) 0
[PROOF STEP]
by (simp add: pathfinish_def pathstart_def o_assoc)
[PROOF STATE]
proof (state)
this:
(g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (exp \<circ> g \<circ> subpath t u p) 0

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (exp \<circ> g \<circ> subpath t u p) 0

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
have "... = winding_number (\<lambda>w. subpath t u p w - \<zeta>) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (exp \<circ> g \<circ> subpath t u p) 0 = winding_number (\<lambda>w. subpath t u p w - \<zeta>) 0
[PROOF STEP]
proof (rule winding_number_cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ta. \<lbrakk>0 \<le> ta; ta \<le> 1\<rbrakk> \<Longrightarrow> (exp \<circ> g \<circ> subpath t u p) ta = subpath t u p ta - \<zeta>
[PROOF STEP]
have "exp(g y) = y - \<zeta>" if "y \<in> (subpath t u p) ` {0..1}" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (g y) = y - \<zeta>
[PROOF STEP]
by (metis that geq path_image_def piB subset_eq)
[PROOF STATE]
proof (state)
this:
?y \<in> subpath t u p ` {0..1} \<Longrightarrow> exp (g ?y) = ?y - \<zeta>

goal (1 subgoal):
 1. \<And>ta. \<lbrakk>0 \<le> ta; ta \<le> 1\<rbrakk> \<Longrightarrow> (exp \<circ> g \<circ> subpath t u p) ta = subpath t u p ta - \<zeta>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y \<in> subpath t u p ` {0..1} \<Longrightarrow> exp (g ?y) = ?y - \<zeta>
[PROOF STEP]
show "\<And>x. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> (exp \<circ> g \<circ> subpath t u p) x = subpath t u p x - \<zeta>"
[PROOF STATE]
proof (prove)
using this:
?y \<in> subpath t u p ` {0..1} \<Longrightarrow> exp (g ?y) = ?y - \<zeta>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> (exp \<circ> g \<circ> subpath t u p) x = subpath t u p x - \<zeta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?x; ?x \<le> 1\<rbrakk> \<Longrightarrow> (exp \<circ> g \<circ> subpath t u p) ?x = subpath t u p ?x - \<zeta>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
winding_number (exp \<circ> g \<circ> subpath t u p) 0 = winding_number (\<lambda>w. subpath t u p w - \<zeta>) 0

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
winding_number (exp \<circ> g \<circ> subpath t u p) 0 = winding_number (\<lambda>w. subpath t u p w - \<zeta>) 0

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
have "... = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 -
                           winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (\<lambda>w. subpath t u p w - \<zeta>) 0 = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
apply (simp add: winding_number_offset [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (subpath t u p) \<zeta> = winding_number (subpath 0 u p) \<zeta> - winding_number (subpath 0 t p) \<zeta>
[PROOF STEP]
using winding_number_subpath_combine [OF \<open>path p\<close> \<zeta>, of 0 t u] \<open>t \<in> {0..1}\<close> \<open>u \<in> {0..1}\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<in> {0..1}; t \<in> {0..1}; u \<in> {0..1}\<rbrakk> \<Longrightarrow> winding_number (subpath 0 t p) \<zeta> + winding_number (subpath t u p) \<zeta> = winding_number (subpath 0 u p) \<zeta>
t \<in> {0..1}
u \<in> {0..1}

goal (1 subgoal):
 1. winding_number (subpath t u p) \<zeta> = winding_number (subpath 0 u p) \<zeta> - winding_number (subpath 0 t p) \<zeta>
[PROOF STEP]
by (simp add: add.commute eq_diff_eq)
[PROOF STATE]
proof (state)
this:
winding_number (\<lambda>w. subpath t u p w - \<zeta>) 0 = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0

goal (1 subgoal):
 1. (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(g (subpath t u p 1) - g (subpath t u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?u \<in> {0..1}; 0 < dist ?u t; dist ?u t < d\<rbrakk> \<Longrightarrow> (g (subpath t ?u p 1) - g (subpath t ?u p 0)) / (2 * complex_of_real pi * \<i>) = winding_number (\<lambda>w. subpath 0 ?u p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. winding_number (\<lambda>w. subpath 0 x p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0) \<longlongrightarrow> 0) (at t within {0..1})

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. winding_number (\<lambda>w. subpath 0 x p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0) \<longlongrightarrow> 0) (at t within {0..1})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. winding_number (\<lambda>w. subpath 0 x p w - \<zeta>) 0 - winding_number (\<lambda>w. subpath 0 t p w - \<zeta>) 0) \<longlongrightarrow> 0) (at t within {0..1})

goal (1 subgoal):
 1. continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)
[PROOF STEP]
by (subst winding_number_offset) (simp add: continuous_within LIM_zero_iff)
[PROOF STATE]
proof (state)
this:
continuous (at t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?t \<in> {0..1} \<Longrightarrow> continuous (at ?t within {0..1}) (\<lambda>x. winding_number (subpath 0 x p) \<zeta>)

goal (3 subgoals):
 1. path ?q
 2. pathfinish ?q - pathstart ?q = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>
 3. \<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp (?q t)
[PROOF STEP]
show "path ?q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
unfolding path_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
by (intro continuous_intros) (simp add: continuous_on_eq_continuous_within *)
[PROOF STATE]
proof (state)
this:
path (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))

goal (2 subgoals):
 1. pathfinish (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>)) - pathstart (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>)) = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>
 2. \<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
have "\<zeta> \<noteq> p 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zeta> \<noteq> p 0
[PROOF STEP]
by (metis \<zeta> pathstart_def pathstart_in_path_image)
[PROOF STATE]
proof (state)
this:
\<zeta> \<noteq> p 0

goal (2 subgoals):
 1. pathfinish (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>)) - pathstart (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>)) = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>
 2. \<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<zeta> \<noteq> p 0
[PROOF STEP]
show "pathfinish ?q - pathstart ?q = 2 * of_real pi * \<i> * winding_number p \<zeta>"
[PROOF STATE]
proof (prove)
using this:
\<zeta> \<noteq> p 0

goal (1 subgoal):
 1. pathfinish (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>)) - pathstart (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>)) = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>
[PROOF STEP]
by (simp add: pathfinish_def pathstart_def)
[PROOF STATE]
proof (state)
this:
pathfinish (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>)) - pathstart (\<lambda>t. 2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>)) = 2 * complex_of_real pi * \<i> * winding_number p \<zeta>

goal (1 subgoal):
 1. \<And>t. t \<in> {0..1} \<Longrightarrow> p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
show "p t = \<zeta> + exp (?q t)" if "t \<in> {0..1}" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
have "path (subpath 0 t p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path (subpath 0 t p)
[PROOF STEP]
using \<open>path p\<close> that
[PROOF STATE]
proof (prove)
using this:
path p
t \<in> {0..1}

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

goal (1 subgoal):
 1. p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
path (subpath 0 t p)

goal (1 subgoal):
 1. p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
have "\<zeta> \<notin> path_image (subpath 0 t p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zeta> \<notin> path_image (subpath 0 t p)
[PROOF STEP]
using \<zeta> [unfolded path_image_def] that
[PROOF STATE]
proof (prove)
using this:
\<zeta> \<notin> p ` {0..1}
t \<in> {0..1}

goal (1 subgoal):
 1. \<zeta> \<notin> path_image (subpath 0 t p)
[PROOF STEP]
by (auto simp: path_image_subpath)
[PROOF STATE]
proof (state)
this:
\<zeta> \<notin> path_image (subpath 0 t p)

goal (1 subgoal):
 1. p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
path (subpath 0 t p)
\<zeta> \<notin> path_image (subpath 0 t p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
path (subpath 0 t p)
\<zeta> \<notin> path_image (subpath 0 t p)

goal (1 subgoal):
 1. p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
using winding_number_exp_2pi [of "subpath 0 t p" \<zeta>] \<open>\<zeta> \<noteq> p 0\<close>
[PROOF STATE]
proof (prove)
using this:
path (subpath 0 t p)
\<zeta> \<notin> path_image (subpath 0 t p)
\<lbrakk>path (subpath 0 t p); \<zeta> \<notin> path_image (subpath 0 t p)\<rbrakk> \<Longrightarrow> pathfinish (subpath 0 t p) - \<zeta> = exp (complex_of_real (2 * pi) * \<i> * winding_number (subpath 0 t p) \<zeta>) * (pathstart (subpath 0 t p) - \<zeta>)
\<zeta> \<noteq> p 0

goal (1 subgoal):
 1. p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))
[PROOF STEP]
by (auto simp: exp_add algebra_simps pathfinish_def pathstart_def subpath_def)
[PROOF STATE]
proof (state)
this:
p t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 t p) \<zeta> + Ln (pathstart p - \<zeta>))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?t \<in> {0..1} \<Longrightarrow> p ?t = \<zeta> + exp (2 * complex_of_real pi * \<i> * winding_number (subpath 0 ?t p) \<zeta> + Ln (pathstart p - \<zeta>))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Bseq_iff2: "Bseq X \<longleftrightarrow> (\<exists>k > 0. \<exists>x. \<forall>n. norm (X n + - x) \<le> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq X = (\<exists>k>0. \<exists>x. \<forall>n. norm (X n + - x) \<le> k)
[PROOF STEP]
by (metis BseqE BseqI' add.commute add_cancel_right_left add_uminus_conv_diff norm_add_leD
            norm_minus_cancel norm_minus_commute)


[STATEMENT]
lemma div_mod_lm: "y < x \<Longrightarrow> ((u + (2::nat) ^ x) div (2::nat)^y) mod 2 = (u div (2::nat)^y) mod 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
assume y_lt_x: "y < x"
[PROOF STATE]
proof (state)
this:
y < x

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
let ?n = "(2::nat)^y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
have n_pos: "0 < ?n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 2 ^ y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < 2 ^ y

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
let ?s = "x-y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
from y_lt_x
[PROOF STATE]
proof (chain)
picking this:
y < x
[PROOF STEP]
have s_pos: "0 < ?s"
[PROOF STATE]
proof (prove)
using this:
y < x

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

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
from y_lt_x
[PROOF STATE]
proof (chain)
picking this:
y < x
[PROOF STEP]
have S3: "x = y + ?s"
[PROOF STATE]
proof (prove)
using this:
y < x

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

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
from S3
[PROOF STATE]
proof (chain)
picking this:
x = y + (x - y)
[PROOF STEP]
have "(2::nat)^x = (2::nat)^(y + ?s)"
[PROOF STATE]
proof (prove)
using this:
x = y + (x - y)

goal (1 subgoal):
 1. 2 ^ x = 2 ^ (y + (x - y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ x = 2 ^ (y + (x - y))

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 ^ x = 2 ^ (y + (x - y))

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
have "(2::nat)^(y +?s) = (2::nat)^y * 2^ ?s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (y + (x - y)) = 2 ^ y * 2 ^ (x - y)
[PROOF STEP]
by (rule power_add)
[PROOF STATE]
proof (state)
this:
2 ^ (y + (x - y)) = 2 ^ y * 2 ^ (x - y)

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
2 ^ x = 2 ^ (y + (x - y))
2 ^ (y + (x - y)) = 2 ^ y * 2 ^ (x - y)
[PROOF STEP]
have "(2::nat)^x = 2^y * 2^?s"
[PROOF STATE]
proof (prove)
using this:
2 ^ x = 2 ^ (y + (x - y))
2 ^ (y + (x - y)) = 2 ^ y * 2 ^ (x - y)

goal (1 subgoal):
 1. 2 ^ x = 2 ^ y * 2 ^ (x - y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ x = 2 ^ y * 2 ^ (x - y)

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ x = 2 ^ y * 2 ^ (x - y)
[PROOF STEP]
have S4: "u + (2::nat)^x = u + (2::nat)^y * 2^?s"
[PROOF STATE]
proof (prove)
using this:
2 ^ x = 2 ^ y * 2 ^ (x - y)

goal (1 subgoal):
 1. u + 2 ^ x = u + 2 ^ y * 2 ^ (x - y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u + 2 ^ x = u + 2 ^ y * 2 ^ (x - y)

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
from n_pos
[PROOF STATE]
proof (chain)
picking this:
0 < 2 ^ y
[PROOF STEP]
have S5: "(u + (2::nat)^y * 2^?s) div 2^y = 2^?s + (u div 2^y)"
[PROOF STATE]
proof (prove)
using this:
0 < 2 ^ y

goal (1 subgoal):
 1. (u + 2 ^ y * 2 ^ (x - y)) div 2 ^ y = 2 ^ (x - y) + u div 2 ^ y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u + 2 ^ y * 2 ^ (x - y)) div 2 ^ y = 2 ^ (x - y) + u div 2 ^ y

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
from S4 S5
[PROOF STATE]
proof (chain)
picking this:
u + 2 ^ x = u + 2 ^ y * 2 ^ (x - y)
(u + 2 ^ y * 2 ^ (x - y)) div 2 ^ y = 2 ^ (x - y) + u div 2 ^ y
[PROOF STEP]
have S6: "(u + (2::nat)^x) div 2^y = 2^?s + (u div 2^y)"
[PROOF STATE]
proof (prove)
using this:
u + 2 ^ x = u + 2 ^ y * 2 ^ (x - y)
(u + 2 ^ y * 2 ^ (x - y)) div 2 ^ y = 2 ^ (x - y) + u div 2 ^ y

goal (1 subgoal):
 1. (u + 2 ^ x) div 2 ^ y = 2 ^ (x - y) + u div 2 ^ y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(u + 2 ^ x) div 2 ^ y = 2 ^ (x - y) + u div 2 ^ y

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
from s_pos
[PROOF STATE]
proof (chain)
picking this:
0 < x - y
[PROOF STEP]
have S8: "?s = (?s - 1) + 1"
[PROOF STATE]
proof (prove)
using this:
0 < x - y

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

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
have "(2::nat) ^ ((?s - (1::nat)) + (1::nat)) = (2::nat) ^ (?s - (1::nat)) * 2^1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (x - y - 1 + 1) = 2 ^ (x - y - 1) * 2 ^ 1
[PROOF STEP]
by (rule power_add)
[PROOF STATE]
proof (state)
this:
2 ^ (x - y - 1 + 1) = 2 ^ (x - y - 1) * 2 ^ 1

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
with S8
[PROOF STATE]
proof (chain)
picking this:
x - y = x - y - 1 + 1
2 ^ (x - y - 1 + 1) = 2 ^ (x - y - 1) * 2 ^ 1
[PROOF STEP]
have S9: "(2::nat) ^ ?s = (2::nat) ^ (?s - (1::nat)) * 2"
[PROOF STATE]
proof (prove)
using this:
x - y = x - y - 1 + 1
2 ^ (x - y - 1 + 1) = 2 ^ (x - y - 1) * 2 ^ 1

goal (1 subgoal):
 1. 2 ^ (x - y) = 2 ^ (x - y - 1) * 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ (x - y) = 2 ^ (x - y - 1) * 2

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ (x - y) = 2 ^ (x - y - 1) * 2
[PROOF STEP]
have S10: "2^?s + (u div 2^y) = (u div 2^y) + (2::nat) ^ (?s - (1::nat)) * 2"
[PROOF STATE]
proof (prove)
using this:
2 ^ (x - y) = 2 ^ (x - y - 1) * 2

goal (1 subgoal):
 1. 2 ^ (x - y) + u div 2 ^ y = u div 2 ^ y + 2 ^ (x - y - 1) * 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ (x - y) + u div 2 ^ y = u div 2 ^ y + 2 ^ (x - y - 1) * 2

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
have S11: "((u div 2^y) + (2::nat) ^ (?s - (1::nat)) * 2) mod 2 = (u div 2^y) mod 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u div 2 ^ y + 2 ^ (x - y - 1) * 2) mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
by (rule mod_mult_self1)
[PROOF STATE]
proof (state)
this:
(u div 2 ^ y + 2 ^ (x - y - 1) * 2) mod 2 = u div 2 ^ y mod 2

goal (1 subgoal):
 1. y < x \<Longrightarrow> (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
from S6 S10 S11
[PROOF STATE]
proof (chain)
picking this:
(u + 2 ^ x) div 2 ^ y = 2 ^ (x - y) + u div 2 ^ y
2 ^ (x - y) + u div 2 ^ y = u div 2 ^ y + 2 ^ (x - y - 1) * 2
(u div 2 ^ y + 2 ^ (x - y - 1) * 2) mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(u + 2 ^ x) div 2 ^ y = 2 ^ (x - y) + u div 2 ^ y
2 ^ (x - y) + u div 2 ^ y = u div 2 ^ y + 2 ^ (x - y - 1) * 2
(u div 2 ^ y + 2 ^ (x - y - 1) * 2) mod 2 = u div 2 ^ y mod 2

goal (1 subgoal):
 1. (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_list_of_dlist_Abs_dlist:
  "set (list_of_dlist (Abs_dlist xs)) = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (list_of_dlist (Abs_dlist xs)) = set xs
[PROOF STEP]
by(clarsimp simp add: Abs_dlist_def Abs_dlist'_inverse)(subst Abs_dlist'_inverse, auto dest: equal.equal_eq[OF ID_ceq])


[STATEMENT]
lemma rank_1_proj_density:
  assumes "\<parallel>v\<parallel> = 1"
  shows "density_operator (rank_1_proj v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. density_operator (rank_1_proj v)
[PROOF STEP]
unfolding density_operator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.positive (rank_1_proj v) \<and> Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<parallel>v\<parallel> = 1

goal (1 subgoal):
 1. Complex_Matrix.positive (rank_1_proj v) \<and> Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
by (simp add: rank_1_proj_positive rank_1_proj_trace)


[STATEMENT]
lemma column_Gram_Schmidt_upt_k_preserves:
  fixes A::"'a::{real_inner}^'cols::{mod_type}^'rows"
  assumes i_less_suc: "to_nat i<(Suc k)"
  and suc_less_card: "Suc k < CARD ('cols)"
  shows "column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)
[PROOF STEP]
have "column i (Gram_Schmidt_upt_k A (Suc k))
    = column i (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column i (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)
[PROOF STEP]
have "... = column i (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column i (Gram_Schmidt_upt_k A k)
[PROOF STEP]
unfolding Gram_Schmidt_column_k_def
    column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>ia. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - proj_onto (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) {\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i |i. i < b} else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ ia $ i) = (\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i)
[PROOF STEP]
using i_less_suc
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat i < Suc k

goal (1 subgoal):
 1. (\<chi>ia. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - proj_onto (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) {\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i |i. i < b} else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ ia $ i) = (\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i)
[PROOF STEP]
by (auto simp add: to_nat_from_nat_id[OF suc_less_card])
[PROOF STATE]
proof (state)
this:
column i (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column i (Gram_Schmidt_upt_k A k)

goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)

goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
column i (Gram_Schmidt_upt_k A (Suc k)) = column i (Gram_Schmidt_upt_k A k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_indicator_eq_restriction:
  fixes f::"'a::euclidean_space \<Rightarrow> 'b::banach"
  assumes f: "f integrable_on R"
    and "R \<subseteq> S"
  shows "integral S (\<lambda>x. indicator R x *\<^sub>R f x) = integral R f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
let ?f = "\<lambda>x. indicator R x *\<^sub>R f x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
have "?f integrable_on R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. indicat_real R x *\<^sub>R f x) integrable_on R
[PROOF STEP]
using f negligible_empty
[PROOF STATE]
proof (prove)
using this:
f integrable_on R
negligible {}

goal (1 subgoal):
 1. (\<lambda>x. indicat_real R x *\<^sub>R f x) integrable_on R
[PROOF STEP]
by (rule integrable_spike) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. indicat_real R x *\<^sub>R f x) integrable_on R

goal (1 subgoal):
 1. integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
from integrable_integral[OF this]
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. indicat_real R x *\<^sub>R f x) has_integral integral R (\<lambda>x. indicat_real R x *\<^sub>R f x)) R
[PROOF STEP]
have "(?f has_integral integral R ?f) S"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. indicat_real R x *\<^sub>R f x) has_integral integral R (\<lambda>x. indicat_real R x *\<^sub>R f x)) R

goal (1 subgoal):
 1. ((\<lambda>x. indicat_real R x *\<^sub>R f x) has_integral integral R (\<lambda>x. indicat_real R x *\<^sub>R f x)) S
[PROOF STEP]
by (rule has_integral_on_superset) (use \<open>R \<subseteq> S\<close> in \<open>auto simp: indicator_def\<close>)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. indicat_real R x *\<^sub>R f x) has_integral integral R (\<lambda>x. indicat_real R x *\<^sub>R f x)) S

goal (1 subgoal):
 1. integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. indicat_real R x *\<^sub>R f x) has_integral integral R (\<lambda>x. indicat_real R x *\<^sub>R f x)) S

goal (1 subgoal):
 1. integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
have "integral R ?f = integral R f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral R (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
using negligible_empty
[PROOF STATE]
proof (prove)
using this:
negligible {}

goal (1 subgoal):
 1. integral R (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
by (rule integral_spike) auto
[PROOF STATE]
proof (state)
this:
integral R (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f

goal (1 subgoal):
 1. integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. indicat_real R x *\<^sub>R f x) has_integral integral R f) S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. indicat_real R x *\<^sub>R f x) has_integral integral R f) S

goal (1 subgoal):
 1. integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integral S (\<lambda>x. indicat_real R x *\<^sub>R f x) = integral R f

goal:
No subgoals!
[PROOF STEP]
qed