[STATEMENT]
lemma chord_property:
  fixes S C :: "'a :: euclidean_space"
  assumes "dist C S = dist C T"
  assumes "between (S, T) X"
  shows "dist S X * dist X T = (dist C S) ^ 2 - (dist C X) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
define M where "M = midpoint S T"
[PROOF STATE]
proof (state)
this:
M = midpoint S T

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "between (S, T) M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. between (S, T) M
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. between (S, T) (midpoint S T)
[PROOF STEP]
by (simp add: between_midpoint(1))
[PROOF STATE]
proof (state)
this:
between (S, T) M

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "dist T M = dist S M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist T M = dist S M
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist T (midpoint S T) = dist S (midpoint S T)
[PROOF STEP]
by (simp add: dist_midpoint)
[PROOF STATE]
proof (state)
this:
dist T M = dist S M

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have distances: "max (dist S X) (dist X T) = (dist S M) + (dist X M) \<and>
    min (dist S X) (dist X T) = (dist S M) - (dist X M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
 2. \<not> ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
assume "dist S X \<le> dist X T"
[PROOF STATE]
proof (state)
this:
dist S X \<le> dist X T

goal (2 subgoals):
 1. ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
 2. \<not> ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist S X \<le> dist X T
[PROOF STEP]
have "between (X, T) M"
[PROOF STATE]
proof (prove)
using this:
dist S X \<le> dist X T

goal (1 subgoal):
 1. between (X, T) M
[PROOF STEP]
using \<open>between (S, T) X\<close> M_def
[PROOF STATE]
proof (prove)
using this:
dist S X \<le> dist X T
between (S, T) X
M = midpoint S T

goal (1 subgoal):
 1. between (X, T) M
[PROOF STEP]
by (simp add: dist_geq_iff_midpoint_in_between dist_commute)
[PROOF STATE]
proof (state)
this:
between (X, T) M

goal (2 subgoals):
 1. ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
 2. \<not> ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
between (X, T) M
[PROOF STEP]
have "between (S, M) X"
[PROOF STATE]
proof (prove)
using this:
between (X, T) M

goal (1 subgoal):
 1. between (S, M) X
[PROOF STEP]
using \<open>between (S, T) X\<close> \<open>between (S, T) M\<close> between_swap
[PROOF STATE]
proof (prove)
using this:
between (X, T) M
between (S, T) X
between (S, T) M
\<lbrakk>between (?A, ?B) ?X; between (?A, ?B) ?Y\<rbrakk> \<Longrightarrow> between (?X, ?B) ?Y = between (?A, ?Y) ?X

goal (1 subgoal):
 1. between (S, M) X
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
between (S, M) X

goal (2 subgoals):
 1. ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
 2. \<not> ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
from \<open>between (X, T) M\<close>
[PROOF STATE]
proof (chain)
picking this:
between (X, T) M
[PROOF STEP]
have "dist X T = dist X M + dist M T"
[PROOF STATE]
proof (prove)
using this:
between (X, T) M

goal (1 subgoal):
 1. dist X T = dist X M + dist M T
[PROOF STEP]
using between
[PROOF STATE]
proof (prove)
using this:
between (X, T) M
between (?a, ?b) ?x = (dist ?a ?b = dist ?a ?x + dist ?x ?b)

goal (1 subgoal):
 1. dist X T = dist X M + dist M T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist X T = dist X M + dist M T

goal (2 subgoals):
 1. ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
 2. \<not> ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dist X T = dist X M + dist M T

goal (2 subgoals):
 1. ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
 2. \<not> ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
from \<open>between (S, M) X\<close>
[PROOF STATE]
proof (chain)
picking this:
between (S, M) X
[PROOF STEP]
have "dist S X = dist S M - dist M X"
[PROOF STATE]
proof (prove)
using this:
between (S, M) X

goal (1 subgoal):
 1. dist S X = dist S M - dist M X
[PROOF STEP]
using between dist_commute
[PROOF STATE]
proof (prove)
using this:
between (S, M) X
between (?a, ?b) ?x = (dist ?a ?b = dist ?a ?x + dist ?x ?b)
dist ?x ?y = dist ?y ?x

goal (1 subgoal):
 1. dist S X = dist S M - dist M X
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
dist S X = dist S M - dist M X

goal (2 subgoals):
 1. ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
 2. \<not> ?P \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dist X T = dist X M + dist M T
dist S X = dist S M - dist M X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist X T = dist X M + dist M T
dist S X = dist S M - dist M X

goal (1 subgoal):
 1. max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
using \<open>dist S X \<le> dist X T\<close> \<open>dist T M = dist S M\<close>
[PROOF STATE]
proof (prove)
using this:
dist X T = dist X M + dist M T
dist S X = dist S M - dist M X
dist S X \<le> dist X T
dist T M = dist S M

goal (1 subgoal):
 1. max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
by (simp add: add.commute dist_commute max_def min_def)
[PROOF STATE]
proof (state)
this:
max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M

goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
assume "\<not> (dist S X \<le> dist X T)"
[PROOF STATE]
proof (state)
this:
\<not> dist S X \<le> dist X T

goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> dist S X \<le> dist X T
[PROOF STEP]
have "dist T X \<le> dist S X"
[PROOF STATE]
proof (prove)
using this:
\<not> dist S X \<le> dist X T

goal (1 subgoal):
 1. dist T X \<le> dist S X
[PROOF STEP]
by (simp add: dist_commute)
[PROOF STATE]
proof (state)
this:
dist T X \<le> dist S X

goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist T X \<le> dist S X
[PROOF STEP]
have "between (S, X) M"
[PROOF STATE]
proof (prove)
using this:
dist T X \<le> dist S X

goal (1 subgoal):
 1. between (S, X) M
[PROOF STEP]
using \<open>between (S, T) X\<close> M_def
[PROOF STATE]
proof (prove)
using this:
dist T X \<le> dist S X
between (S, T) X
M = midpoint S T

goal (1 subgoal):
 1. between (S, X) M
[PROOF STEP]
by (simp add: dist_geq_iff_midpoint_in_between midpoint_sym between_commute)
[PROOF STATE]
proof (state)
this:
between (S, X) M

goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
between (S, X) M
[PROOF STEP]
have "between (T, M) X"
[PROOF STATE]
proof (prove)
using this:
between (S, X) M

goal (1 subgoal):
 1. between (T, M) X
[PROOF STEP]
using \<open>between (S, T) X\<close> \<open>between (S, T) M\<close> between_swap between_commute
[PROOF STATE]
proof (prove)
using this:
between (S, X) M
between (S, T) X
between (S, T) M
\<lbrakk>between (?A, ?B) ?X; between (?A, ?B) ?Y\<rbrakk> \<Longrightarrow> between (?X, ?B) ?Y = between (?A, ?Y) ?X
between (?a, ?b) = between (?b, ?a)

goal (1 subgoal):
 1. between (T, M) X
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
between (T, M) X

goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
from \<open>between (S, X) M\<close>
[PROOF STATE]
proof (chain)
picking this:
between (S, X) M
[PROOF STEP]
have "dist S X = dist S M + dist M X"
[PROOF STATE]
proof (prove)
using this:
between (S, X) M

goal (1 subgoal):
 1. dist S X = dist S M + dist M X
[PROOF STEP]
using between
[PROOF STATE]
proof (prove)
using this:
between (S, X) M
between (?a, ?b) ?x = (dist ?a ?b = dist ?a ?x + dist ?x ?b)

goal (1 subgoal):
 1. dist S X = dist S M + dist M X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist S X = dist S M + dist M X

goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dist S X = dist S M + dist M X

goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
from \<open>between (T, M) X\<close>
[PROOF STATE]
proof (chain)
picking this:
between (T, M) X
[PROOF STEP]
have "dist T X = dist T M - dist M X"
[PROOF STATE]
proof (prove)
using this:
between (T, M) X

goal (1 subgoal):
 1. dist T X = dist T M - dist M X
[PROOF STEP]
using between dist_commute
[PROOF STATE]
proof (prove)
using this:
between (T, M) X
between (?a, ?b) ?x = (dist ?a ?b = dist ?a ?x + dist ?x ?b)
dist ?x ?y = dist ?y ?x

goal (1 subgoal):
 1. dist T X = dist T M - dist M X
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
dist T X = dist T M - dist M X

goal (1 subgoal):
 1. \<not> dist S X \<le> dist X T \<Longrightarrow> max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dist S X = dist S M + dist M X
dist T X = dist T M - dist M X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist S X = dist S M + dist M X
dist T X = dist T M - dist M X

goal (1 subgoal):
 1. max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
using \<open>\<not> dist S X \<le> dist X T\<close> \<open>dist T M = dist S M\<close>
[PROOF STATE]
proof (prove)
using this:
dist S X = dist S M + dist M X
dist T X = dist T M - dist M X
\<not> dist S X \<le> dist X T
dist T M = dist S M

goal (1 subgoal):
 1. max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M
[PROOF STEP]
by (metis dist_commute max_def min_def)
[PROOF STATE]
proof (state)
this:
max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "orthogonal (C - M) (S - M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal (C - M) (S - M)
[PROOF STEP]
using \<open>dist C S = dist C T\<close> M_def
[PROOF STATE]
proof (prove)
using this:
dist C S = dist C T
M = midpoint S T

goal (1 subgoal):
 1. orthogonal (C - M) (S - M)
[PROOF STEP]
by (auto simp add: isosceles_triangle_orthogonal_on_midpoint)
[PROOF STATE]
proof (state)
this:
orthogonal (C - M) (S - M)

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "orthogonal (C - M) (X - M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal (C - M) (X - M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal (C - M) (X - M)
[PROOF STEP]
have "between (S, T) M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. between (S, T) M
[PROOF STEP]
using M_def between_midpoint(1)
[PROOF STATE]
proof (prove)
using this:
M = midpoint S T
between (?a, ?b) (midpoint ?a ?b)

goal (1 subgoal):
 1. between (S, T) M
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
between (S, T) M

goal (1 subgoal):
 1. orthogonal (C - M) (X - M)
[PROOF STEP]
obtain c where "(X - M) = c *\<^sub>R (S - M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (cases "S = M")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S = M\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S \<noteq> M\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "S \<noteq> M"
[PROOF STATE]
proof (state)
this:
S \<noteq> M

goal (2 subgoals):
 1. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S = M\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S \<noteq> M\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> M
[PROOF STEP]
obtain c where "(X - M) = c *\<^sub>R (S - M)"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> M

goal (1 subgoal):
 1. (\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using between_implies_scaled_diff [OF \<open>between (S, T) X\<close> \<open>between (S, T) M\<close>]
[PROOF STATE]
proof (prove)
using this:
S \<noteq> M
\<lbrakk>S \<noteq> M; \<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
X - M = c *\<^sub>R (S - M)

goal (2 subgoals):
 1. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S = M\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S \<noteq> M\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
from this that
[PROOF STATE]
proof (chain)
picking this:
X - M = c *\<^sub>R (S - M)
X - M = ?c *\<^sub>R (S - M) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
X - M = c *\<^sub>R (S - M)
X - M = ?c *\<^sub>R (S - M) \<Longrightarrow> thesis

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

goal (1 subgoal):
 1. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S = M\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S = M\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "S = M"
[PROOF STATE]
proof (state)
this:
S = M

goal (1 subgoal):
 1. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S = M\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
from this \<open>between (S, T) X\<close>
[PROOF STATE]
proof (chain)
picking this:
S = M
between (S, T) X
[PROOF STEP]
have "X = M"
[PROOF STATE]
proof (prove)
using this:
S = M
between (S, T) X

goal (1 subgoal):
 1. X = M
[PROOF STEP]
by (simp add: midpoint_between M_def)
[PROOF STATE]
proof (state)
this:
X = M

goal (1 subgoal):
 1. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S = M\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
from \<open>X = M\<close> \<open>S = M\<close>
[PROOF STATE]
proof (chain)
picking this:
X = M
S = M
[PROOF STEP]
have "(X - M) = 0 *\<^sub>R (S - M)"
[PROOF STATE]
proof (prove)
using this:
X = M
S = M

goal (1 subgoal):
 1. X - M = 0 *\<^sub>R (S - M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X - M = 0 *\<^sub>R (S - M)

goal (1 subgoal):
 1. \<lbrakk>\<And>c. X - M = c *\<^sub>R (S - M) \<Longrightarrow> thesis; S = M\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
from this that
[PROOF STATE]
proof (chain)
picking this:
X - M = 0 *\<^sub>R (S - M)
X - M = ?c *\<^sub>R (S - M) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
X - M = 0 *\<^sub>R (S - M)
X - M = ?c *\<^sub>R (S - M) \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
X - M = c *\<^sub>R (S - M)

goal (1 subgoal):
 1. orthogonal (C - M) (X - M)
[PROOF STEP]
from this \<open>orthogonal (C - M) (S - M)\<close>
[PROOF STATE]
proof (chain)
picking this:
X - M = c *\<^sub>R (S - M)
orthogonal (C - M) (S - M)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
X - M = c *\<^sub>R (S - M)
orthogonal (C - M) (S - M)

goal (1 subgoal):
 1. orthogonal (C - M) (X - M)
[PROOF STEP]
by (auto intro: orthogonal_clauses(2))
[PROOF STATE]
proof (state)
this:
orthogonal (C - M) (X - M)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
orthogonal (C - M) (X - M)

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
from \<open>orthogonal (C - M) (S - M)\<close> \<open>orthogonal (C - M) (X - M)\<close>
[PROOF STATE]
proof (chain)
picking this:
orthogonal (C - M) (S - M)
orthogonal (C - M) (X - M)
[PROOF STEP]
have
    "(dist S M) ^ 2 + (dist M C) ^ 2 = (dist C S) ^ 2"
    "(dist X M) ^ 2 + (dist M C) ^ 2 = (dist C X) ^ 2"
[PROOF STATE]
proof (prove)
using this:
orthogonal (C - M) (S - M)
orthogonal (C - M) (X - M)

goal (1 subgoal):
 1. (dist S M)\<^sup>2 + (dist M C)\<^sup>2 = (dist C S)\<^sup>2 &&& (dist X M)\<^sup>2 + (dist M C)\<^sup>2 = (dist C X)\<^sup>2
[PROOF STEP]
by (auto simp only: Pythagoras)
[PROOF STATE]
proof (state)
this:
(dist S M)\<^sup>2 + (dist M C)\<^sup>2 = (dist C S)\<^sup>2
(dist X M)\<^sup>2 + (dist M C)\<^sup>2 = (dist C X)\<^sup>2

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(dist S M)\<^sup>2 + (dist M C)\<^sup>2 = (dist C S)\<^sup>2
(dist X M)\<^sup>2 + (dist M C)\<^sup>2 = (dist C X)\<^sup>2
[PROOF STEP]
have geometric_observation:
    "(dist S M) ^ 2 = (dist C S) ^ 2 - (dist M C) ^ 2"
    "(dist X M) ^ 2 = (dist C X) ^ 2 - (dist M C) ^ 2"
[PROOF STATE]
proof (prove)
using this:
(dist S M)\<^sup>2 + (dist M C)\<^sup>2 = (dist C S)\<^sup>2
(dist X M)\<^sup>2 + (dist M C)\<^sup>2 = (dist C X)\<^sup>2

goal (1 subgoal):
 1. (dist S M)\<^sup>2 = (dist C S)\<^sup>2 - (dist M C)\<^sup>2 &&& (dist X M)\<^sup>2 = (dist C X)\<^sup>2 - (dist M C)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(dist S M)\<^sup>2 = (dist C S)\<^sup>2 - (dist M C)\<^sup>2
(dist X M)\<^sup>2 = (dist C X)\<^sup>2 - (dist M C)\<^sup>2

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "dist S X * dist X T = max (dist S X) (dist X T) * min (dist S X) (dist X T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist S X * dist X T = max (dist S X) (dist X T) * min (dist S X) (dist X T)
[PROOF STEP]
by (auto split: split_max)
[PROOF STATE]
proof (state)
this:
dist S X * dist X T = max (dist S X) (dist X T) * min (dist S X) (dist X T)

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist S X * dist X T = max (dist S X) (dist X T) * min (dist S X) (dist X T)

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "\<dots> = ((dist S M) + (dist X M)) * ((dist S M) - (dist X M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (dist S X) (dist X T) * min (dist S X) (dist X T) = (dist S M + dist X M) * (dist S M - dist X M)
[PROOF STEP]
using distances
[PROOF STATE]
proof (prove)
using this:
max (dist S X) (dist X T) = dist S M + dist X M \<and> min (dist S X) (dist X T) = dist S M - dist X M

goal (1 subgoal):
 1. max (dist S X) (dist X T) * min (dist S X) (dist X T) = (dist S M + dist X M) * (dist S M - dist X M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
max (dist S X) (dist X T) * min (dist S X) (dist X T) = (dist S M + dist X M) * (dist S M - dist X M)

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
max (dist S X) (dist X T) * min (dist S X) (dist X T) = (dist S M + dist X M) * (dist S M - dist X M)

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "\<dots> = (dist S M) ^ 2 - (dist X M) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist S M + dist X M) * (dist S M - dist X M) = (dist S M)\<^sup>2 - (dist X M)\<^sup>2
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(dist S M + dist X M) * (dist S M - dist X M) = (dist S M)\<^sup>2 - (dist X M)\<^sup>2

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(dist S M + dist X M) * (dist S M - dist X M) = (dist S M)\<^sup>2 - (dist X M)\<^sup>2

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "\<dots> = ((dist C S) ^ 2 - (dist M C) ^ 2) - ((dist C X) ^ 2 - (dist M C) ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist S M)\<^sup>2 - (dist X M)\<^sup>2 = (dist C S)\<^sup>2 - (dist M C)\<^sup>2 - ((dist C X)\<^sup>2 - (dist M C)\<^sup>2)
[PROOF STEP]
using geometric_observation
[PROOF STATE]
proof (prove)
using this:
(dist S M)\<^sup>2 = (dist C S)\<^sup>2 - (dist M C)\<^sup>2
(dist X M)\<^sup>2 = (dist C X)\<^sup>2 - (dist M C)\<^sup>2

goal (1 subgoal):
 1. (dist S M)\<^sup>2 - (dist X M)\<^sup>2 = (dist C S)\<^sup>2 - (dist M C)\<^sup>2 - ((dist C X)\<^sup>2 - (dist M C)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(dist S M)\<^sup>2 - (dist X M)\<^sup>2 = (dist C S)\<^sup>2 - (dist M C)\<^sup>2 - ((dist C X)\<^sup>2 - (dist M C)\<^sup>2)

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(dist S M)\<^sup>2 - (dist X M)\<^sup>2 = (dist C S)\<^sup>2 - (dist M C)\<^sup>2 - ((dist C X)\<^sup>2 - (dist M C)\<^sup>2)

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
have "\<dots> = (dist C S) ^ 2 - (dist C X) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist C S)\<^sup>2 - (dist M C)\<^sup>2 - ((dist C X)\<^sup>2 - (dist M C)\<^sup>2) = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(dist C S)\<^sup>2 - (dist M C)\<^sup>2 - ((dist C X)\<^sup>2 - (dist M C)\<^sup>2) = (dist C S)\<^sup>2 - (dist C X)\<^sup>2

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2

goal (1 subgoal):
 1. dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist S X * dist X T = (dist C S)\<^sup>2 - (dist C X)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proper_map_polyfun_univ:
    fixes c :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,heine_borel}"
  assumes "compact K" "c i \<noteq> 0" "1 \<le> i" "i \<le> n"
    shows "compact ({z. (\<Sum>i\<le>n. c i * z^i) \<in> K})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact {z. (\<Sum>i\<le>n. c i * z ^ i) \<in> K}
[PROOF STEP]
using proper_map_polyfun [of UNIV K c i n] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>closed UNIV; compact K; c i \<noteq> (0::'a); 1 \<le> i; i \<le> n\<rbrakk> \<Longrightarrow> compact (UNIV \<inter> {z. (\<Sum>i\<le>n. c i * z ^ i) \<in> K})
compact K
c i \<noteq> (0::'a)
1 \<le> i
i \<le> n

goal (1 subgoal):
 1. compact {z. (\<Sum>i\<le>n. c i * z ^ i) \<in> K}
[PROOF STEP]
by simp


[STATEMENT]
lemma Im_Ln_eq:
  assumes "z\<noteq>0"
  shows "Im (Ln z) = (if Re z\<noteq>0 then
                        if Re z>0 then
                          arctan (Im z/Re z)
                        else if Im z\<ge>0 then
                           arctan (Im z/Re z) + pi
                        else
                           arctan (Im z/Re z) - pi
                      else
                        if Im z>0 then pi/2 else -pi/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have eq_arctan_pos:"Im (Ln z) = arctan (Im z/Re z)" when "Re z>0" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
define wR where "wR=Re (Ln z)"
[PROOF STATE]
proof (state)
this:
wR = Re (Ln z)

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
define \<theta> where "\<theta> = arctan (Im z/Re z)"
[PROOF STATE]
proof (state)
this:
\<theta> = arctan (Im z / Re z)

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
have "z\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<noteq> 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < Re z

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

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
have "exp (Complex wR \<theta>) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (Complex wR \<theta>) = z
[PROOF STEP]
proof (rule complex_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Re (exp (Complex wR \<theta>)) = Re z
 2. Im (exp (Complex wR \<theta>)) = Im z
[PROOF STEP]
have "Im (exp (Complex wR \<theta>)) =exp wR * sin \<theta> "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (exp (Complex wR \<theta>)) = exp wR * sin \<theta>
[PROOF STEP]
unfolding Im_exp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (Re (Complex wR \<theta>)) * sin (Im (Complex wR \<theta>)) = exp wR * sin \<theta>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Im (exp (Complex wR \<theta>)) = exp wR * sin \<theta>

goal (2 subgoals):
 1. Re (exp (Complex wR \<theta>)) = Re z
 2. Im (exp (Complex wR \<theta>)) = Im z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Im (exp (Complex wR \<theta>)) = exp wR * sin \<theta>

goal (2 subgoals):
 1. Re (exp (Complex wR \<theta>)) = Re z
 2. Im (exp (Complex wR \<theta>)) = Im z
[PROOF STEP]
have "... = Im z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp wR * sin \<theta> = Im z
[PROOF STEP]
unfolding wR_def Re_Ln[OF \<open>z\<noteq>0\<close>] \<theta>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (ln (cmod z)) * sin (arctan (Im z / Re z)) = Im z
[PROOF STEP]
using \<open>z\<noteq>0\<close> \<open>Re z>0\<close>
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
0 < Re z

goal (1 subgoal):
 1. exp (ln (cmod z)) * sin (arctan (Im z / Re z)) = Im z
[PROOF STEP]
by (auto simp add:sin_arctan divide_simps complex_neq_0 cmod_def real_sqrt_divide)
[PROOF STATE]
proof (state)
this:
exp wR * sin \<theta> = Im z

goal (2 subgoals):
 1. Re (exp (Complex wR \<theta>)) = Re z
 2. Im (exp (Complex wR \<theta>)) = Im z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Im (exp (Complex wR \<theta>)) = Im z
[PROOF STEP]
show "Im (exp (Complex wR \<theta>)) = Im z"
[PROOF STATE]
proof (prove)
using this:
Im (exp (Complex wR \<theta>)) = Im z

goal (1 subgoal):
 1. Im (exp (Complex wR \<theta>)) = Im z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Im (exp (Complex wR \<theta>)) = Im z

goal (1 subgoal):
 1. Re (exp (Complex wR \<theta>)) = Re z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re (exp (Complex wR \<theta>)) = Re z
[PROOF STEP]
have "Re (exp (Complex wR \<theta>)) = exp wR * cos \<theta> "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (exp (Complex wR \<theta>)) = exp wR * cos \<theta>
[PROOF STEP]
unfolding Re_exp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (Re (Complex wR \<theta>)) * cos (Im (Complex wR \<theta>)) = exp wR * cos \<theta>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Re (exp (Complex wR \<theta>)) = exp wR * cos \<theta>

goal (1 subgoal):
 1. Re (exp (Complex wR \<theta>)) = Re z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re (exp (Complex wR \<theta>)) = exp wR * cos \<theta>

goal (1 subgoal):
 1. Re (exp (Complex wR \<theta>)) = Re z
[PROOF STEP]
have "... = Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp wR * cos \<theta> = Re z
[PROOF STEP]
unfolding wR_def Re_Ln[OF \<open>z\<noteq>0\<close>] \<theta>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (ln (cmod z)) * cos (arctan (Im z / Re z)) = Re z
[PROOF STEP]
using \<open>z\<noteq>0\<close> \<open>Re z>0\<close>
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
0 < Re z

goal (1 subgoal):
 1. exp (ln (cmod z)) * cos (arctan (Im z / Re z)) = Re z
[PROOF STEP]
by (auto simp add:cos_arctan divide_simps complex_neq_0 cmod_def real_sqrt_divide)
[PROOF STATE]
proof (state)
this:
exp wR * cos \<theta> = Re z

goal (1 subgoal):
 1. Re (exp (Complex wR \<theta>)) = Re z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Re (exp (Complex wR \<theta>)) = Re z
[PROOF STEP]
show "Re (exp (Complex wR \<theta>)) = Re z"
[PROOF STATE]
proof (prove)
using this:
Re (exp (Complex wR \<theta>)) = Re z

goal (1 subgoal):
 1. Re (exp (Complex wR \<theta>)) = Re z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Re (exp (Complex wR \<theta>)) = Re z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
exp (Complex wR \<theta>) = z

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
exp (Complex wR \<theta>) = z

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
have "-pi<\<theta>" "\<theta>\<le>pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi < \<theta> &&& \<theta> \<le> pi
[PROOF STEP]
using arctan_lbound [of \<open>Im z / Re z\<close>] arctan_ubound [of \<open>Im z / Re z\<close>]
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < arctan (Im z / Re z)
arctan (Im z / Re z) < pi / 2

goal (1 subgoal):
 1. - pi < \<theta> &&& \<theta> \<le> pi
[PROOF STEP]
by (simp_all add: \<theta>_def)
[PROOF STATE]
proof (state)
this:
- pi < \<theta>
\<theta> \<le> pi

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
exp (Complex wR \<theta>) = z
- pi < \<theta>
\<theta> \<le> pi
[PROOF STEP]
have "Ln z = Complex wR \<theta>"
[PROOF STATE]
proof (prove)
using this:
exp (Complex wR \<theta>) = z
- pi < \<theta>
\<theta> \<le> pi

goal (1 subgoal):
 1. Ln z = Complex wR \<theta>
[PROOF STEP]
using Ln_unique
[PROOF STATE]
proof (prove)
using this:
exp (Complex wR \<theta>) = z
- pi < \<theta>
\<theta> \<le> pi
\<lbrakk>exp ?z = ?w; - pi < Im ?z; Im ?z \<le> pi\<rbrakk> \<Longrightarrow> Ln ?w = ?z

goal (1 subgoal):
 1. Ln z = Complex wR \<theta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ln z = Complex wR \<theta>

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Ln z = Complex wR \<theta>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ln z = Complex wR \<theta>

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Ln z = Complex wR \<theta>
0 < Re z

goal (1 subgoal):
 1. Im (Ln z) = arctan (Im z / Re z)
[PROOF STEP]
unfolding \<theta>_def
[PROOF STATE]
proof (prove)
using this:
Ln z = Complex wR (arctan (Im z / Re z))
0 < Re z

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < Re ?z \<Longrightarrow> Im (Ln ?z) = arctan (Im ?z / Re ?z)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have ?thesis when "Re z=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
using Im_Ln_eq_pi_half[OF \<open>z\<noteq>0\<close>] that
[PROOF STATE]
proof (prove)
using this:
(Im (Ln z) = pi / 2) = (0 < Im z \<and> Re z = 0)
(Im (Ln z) = - pi / 2) = (Im z < 0 \<and> Re z = 0)
Re z = 0

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Re z = 0; Im (Ln z) * 2 \<noteq> pi; Im z = 0; Im (Ln z) \<noteq> - (pi / 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using assms complex.expand
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
Re ?complex = Re ?complex' \<and> Im ?complex = Im ?complex' \<Longrightarrow> ?complex = ?complex'

goal (1 subgoal):
 1. \<lbrakk>Re z = 0; Im (Ln z) * 2 \<noteq> pi; Im z = 0; Im (Ln z) \<noteq> - (pi / 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re z = 0 \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Re z = 0 \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have ?thesis when "Re z>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
using eq_arctan_pos[OF that] that
[PROOF STATE]
proof (prove)
using this:
Im (Ln z) = arctan (Im z / Re z)
0 < Re z

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < Re z \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < Re z \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have ?thesis when "Re z<0" "Im z\<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have "Im (Ln (- z)) = arctan (Im (- z) / Re (- z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln (- z)) = arctan (Im (- z) / Re (- z))
[PROOF STEP]
apply (rule eq_arctan_pos)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re (- z)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re z < 0
0 \<le> Im z

goal (1 subgoal):
 1. 0 < Re (- z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have "Ln (- z) = Ln z - \<i> * complex_of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (- z) = Ln z - \<i> * complex_of_real pi
[PROOF STEP]
apply (subst Ln_minus[OF \<open>z\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if Im z \<le> 0 \<and> \<not> (Re z < 0 \<and> Im z = 0) then Ln z + \<i> * complex_of_real pi else Ln z - \<i> * complex_of_real pi) = Ln z - \<i> * complex_of_real pi
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re z < 0
0 \<le> Im z

goal (1 subgoal):
 1. (if Im z \<le> 0 \<and> \<not> (Re z < 0 \<and> Im z = 0) then Ln z + \<i> * complex_of_real pi else Ln z - \<i> * complex_of_real pi) = Ln z - \<i> * complex_of_real pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ln (- z) = Ln z - \<i> * complex_of_real pi

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))
Ln (- z) = Ln z - \<i> * complex_of_real pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))
Ln (- z) = Ln z - \<i> * complex_of_real pi

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))
Ln (- z) = Ln z - \<i> * complex_of_real pi
Re z < 0
0 \<le> Im z

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re z < 0; 0 \<le> Im z\<rbrakk> \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re z < 0; 0 \<le> Im z\<rbrakk> \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have ?thesis when "Re z<0" "Im z<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have "Im (Ln (- z)) = arctan (Im (- z) / Re (- z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln (- z)) = arctan (Im (- z) / Re (- z))
[PROOF STEP]
apply (rule eq_arctan_pos)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re (- z)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re z < 0
Im z < 0

goal (1 subgoal):
 1. 0 < Re (- z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
have "Ln (- z) = Ln z + \<i> * complex_of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (- z) = Ln z + \<i> * complex_of_real pi
[PROOF STEP]
apply (subst Ln_minus[OF \<open>z\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if Im z \<le> 0 \<and> \<not> (Re z < 0 \<and> Im z = 0) then Ln z + \<i> * complex_of_real pi else Ln z - \<i> * complex_of_real pi) = Ln z + \<i> * complex_of_real pi
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re z < 0
Im z < 0

goal (1 subgoal):
 1. (if Im z \<le> 0 \<and> \<not> (Re z < 0 \<and> Im z = 0) then Ln z + \<i> * complex_of_real pi else Ln z - \<i> * complex_of_real pi) = Ln z + \<i> * complex_of_real pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ln (- z) = Ln z + \<i> * complex_of_real pi

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))
Ln (- z) = Ln z + \<i> * complex_of_real pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))
Ln (- z) = Ln z + \<i> * complex_of_real pi

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Im (Ln (- z)) = arctan (Im (- z) / Re (- z))
Ln (- z) = Ln z + \<i> * complex_of_real pi
Re z < 0
Im z < 0

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re z < 0; Im z < 0\<rbrakk> \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Re z = 0 \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
0 < Re z \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
\<lbrakk>Re z < 0; 0 \<le> Im z\<rbrakk> \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
\<lbrakk>Re z < 0; Im z < 0\<rbrakk> \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re z = 0 \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
0 < Re z \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
\<lbrakk>Re z < 0; 0 \<le> Im z\<rbrakk> \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
\<lbrakk>Re z < 0; Im z < 0\<rbrakk> \<Longrightarrow> Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal (1 subgoal):
 1. Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
Im (Ln z) = (if Re z \<noteq> 0 then if 0 < Re z then arctan (Im z / Re z) else if 0 \<le> Im z then arctan (Im z / Re z) + pi else arctan (Im z / Re z) - pi else if 0 < Im z then pi / 2 else - pi / 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma high_inv: assumes "x< 2^n " shows "high (y*2^n + x) n = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. high (y * 2 ^ n + x) n = y
[PROOF STEP]
unfolding high_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y * 2 ^ n + x) div 2 ^ n = y
[PROOF STEP]
by (simp add: assms)


[STATEMENT]
lemma cos_zero_iff_int2:
  fixes x::real
  shows "cos x = 0 \<longleftrightarrow> (\<exists>n::int. x = n * pi +  pi/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos x = 0) = (\<exists>xa. x = real_of_int xa * pi + pi / 2)
[PROOF STEP]
using sin_zero_iff_int2[of "x-pi/2"]
[PROOF STATE]
proof (prove)
using this:
(sin (x - pi / 2) = 0) = (\<exists>i. x - pi / 2 = real_of_int i * pi)

goal (1 subgoal):
 1. (cos x = 0) = (\<exists>xa. x = real_of_int xa * pi + pi / 2)
[PROOF STEP]
unfolding sin_cos_eq
[PROOF STATE]
proof (prove)
using this:
(cos (of_real pi / 2 - (x - pi / 2)) = 0) = (\<exists>i. x - pi / 2 = real_of_int i * pi)

goal (1 subgoal):
 1. (cos x = 0) = (\<exists>xa. x = real_of_int xa * pi + pi / 2)
[PROOF STEP]
by (auto simp add:algebra_simps)


[STATEMENT]
lemma f_aggregate_snoc: "
  \<lbrakk> 0 < k; length ys = k; length xs mod k = 0 \<rbrakk> \<Longrightarrow>
  f_aggregate (xs @ ys) k ag = f_aggregate xs k ag @ [ag ys]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; length ys = k; length xs mod k = 0\<rbrakk> \<Longrightarrow> f_aggregate (xs @ ys) k ag = f_aggregate xs k ag @ [ag ys]
[PROOF STEP]
by (simp add: f_aggregate_append_mod f_aggregate_one)


[STATEMENT]
lemma rtrancl_mono_proof[mono]:
   "(\<And>a b. x a b \<longrightarrow> y a b) \<Longrightarrow> rtranclp x a b \<longrightarrow> rtranclp y a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. x a b \<longrightarrow> y a b) \<Longrightarrow> x\<^sup>*\<^sup>* a b \<longrightarrow> y\<^sup>*\<^sup>* a b
[PROOF STEP]
apply (rule impI, rotate_tac, induct rule: rtranclp.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. (\<And>a b. x a b \<longrightarrow> y a b) \<Longrightarrow> y\<^sup>*\<^sup>* a a
 2. \<And>a b c. \<lbrakk>x\<^sup>*\<^sup>* a b; (\<And>a b. x a b \<longrightarrow> y a b) \<Longrightarrow> y\<^sup>*\<^sup>* a b; x b c; \<And>a b. x a b \<longrightarrow> y a b\<rbrakk> \<Longrightarrow> y\<^sup>*\<^sup>* a c
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>x\<^sup>*\<^sup>* a b; y\<^sup>*\<^sup>* a b; x b c; \<And>a b. x a b \<longrightarrow> y a b\<rbrakk> \<Longrightarrow> y\<^sup>*\<^sup>* a c
[PROOF STEP]
apply (metis rtranclp.intros)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem swap_sym: "(X #[x \<and> y]_zs) = (X #[y \<and> x]_zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X #[x \<and> y]_zs = X #[y \<and> x]_zs
[PROOF STEP]
unfolding swap_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. asTerm (pick X #[[x \<and> y]]_zs) = asTerm (pick X #[[y \<and> x]]_zs)
[PROOF STEP]
by(auto simp add: qSwap_sym)


[STATEMENT]
theorem gen_sqrt_lower:  "0 \<le> x \<Longrightarrow> sqrtl x n \<le> sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> sqrtl x n \<le> sqrt x
[PROOF STEP]
using real_sqrt_le_mono [OF sqrtl_lower [of x n]]
[PROOF STATE]
proof (prove)
using this:
0 \<le> x \<Longrightarrow> sqrt ((sqrtl x n)\<^sup>2) \<le> sqrt x

goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> sqrtl x n \<le> sqrt x
[PROOF STEP]
by auto


[STATEMENT]
lemma bernoulli_fps_altdef: "bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n :: 'a)"
  and bernoulli_fps_aux:    "bernoulli_fps * (fps_exp 1 - 1 :: 'a :: real_normed_field fps) = fps_X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) &&& bernoulli_fps * (fps_exp (1::'a) - 1) = fps_X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n)
 2. bernoulli_fps * (fps_exp (1::'a) - 1) = fps_X
[PROOF STEP]
have *: "Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n :: 'a) * (fps_exp 1 - 1) = fps_X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1) = fps_X
[PROOF STEP]
proof (rule fps_ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
have "(Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n :: 'a) * (fps_exp 1 - 1)) $ n =
            (\<Sum>i = 0..n. of_real (bernoulli i) * (1 / fact (n - i) - (if n = i then 1 else 0)) / fact i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = (\<Sum>i = 0..n. of_real (bernoulli i) * ((1::'a) / fact (n - i) - (if n = i then 1::'a else (0::'a))) / fact i)
[PROOF STEP]
by (auto simp: fps_mult_nth divide_simps split: if_splits intro!: sum.cong)
[PROOF STATE]
proof (state)
this:
(Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = (\<Sum>i = 0..n. of_real (bernoulli i) * ((1::'a) / fact (n - i) - (if n = i then 1::'a else (0::'a))) / fact i)

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = (\<Sum>i = 0..n. of_real (bernoulli i) * ((1::'a) / fact (n - i) - (if n = i then 1::'a else (0::'a))) / fact i)

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
have "\<dots> = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i)) -
                                    (if n = i then of_real (bernoulli i) / fact i else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. of_real (bernoulli i) * ((1::'a) / fact (n - i) - (if n = i then 1::'a else (0::'a))) / fact i) = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i)) - (if n = i then of_real (bernoulli i) / fact i else (0::'a)))
[PROOF STEP]
by (intro sum.cong) (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. of_real (bernoulli i) * ((1::'a) / fact (n - i) - (if n = i then 1::'a else (0::'a))) / fact i) = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i)) - (if n = i then of_real (bernoulli i) / fact i else (0::'a)))

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. of_real (bernoulli i) * ((1::'a) / fact (n - i) - (if n = i then 1::'a else (0::'a))) / fact i) = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i)) - (if n = i then of_real (bernoulli i) / fact i else (0::'a)))

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
have "\<dots> = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) -
                      of_real (bernoulli n) / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i)) - (if n = i then of_real (bernoulli i) / fact i else (0::'a))) = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) - of_real (bernoulli n) / fact n
[PROOF STEP]
unfolding sum_subtractf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) - (\<Sum>i = 0..n. if n = i then of_real (bernoulli i) / fact i else (0::'a)) = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) - of_real (bernoulli n) / fact n
[PROOF STEP]
by (subst sum.delta') simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i)) - (if n = i then of_real (bernoulli i) / fact i else (0::'a))) = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) - of_real (bernoulli n) / fact n

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i)) - (if n = i then of_real (bernoulli i) / fact i else (0::'a))) = (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) - of_real (bernoulli n) / fact n

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
have "\<dots> = (\<Sum>i<n. of_real (bernoulli i) / (fact i * fact (n - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) - of_real (bernoulli n) / fact n = (\<Sum>i<n. of_real (bernoulli i) / (fact i * fact (n - i)))
[PROOF STEP]
by (cases n) (simp_all add: atLeast0AtMost lessThan_Suc_atMost [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) - of_real (bernoulli n) / fact n = (\<Sum>i<n. of_real (bernoulli i) / (fact i * fact (n - i)))

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. of_real (bernoulli i) / (fact i * fact (n - i))) - of_real (bernoulli n) / fact n = (\<Sum>i<n. of_real (bernoulli i) / (fact i * fact (n - i)))

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
have "\<dots> = (\<Sum>i<n. fact n * (of_real (bernoulli i) / (fact i * fact (n - i)))) / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. of_real (bernoulli i) / (fact i * fact (n - i))) = (\<Sum>i<n. fact n * (of_real (bernoulli i) / (fact i * fact (n - i)))) / fact n
[PROOF STEP]
by (subst sum_distrib_left [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. of_real (bernoulli i) / (fact i * fact (n - i))) = (\<Sum>i<n. fact n * (of_real (bernoulli i) / (fact i * fact (n - i)))) / fact n

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. of_real (bernoulli i) / (fact i * fact (n - i))) = (\<Sum>i<n. fact n * (of_real (bernoulli i) / (fact i * fact (n - i)))) / fact n

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
have "(\<Sum>i<n. fact n * (of_real (bernoulli i) / (fact i * fact (n - i)))) =
                 (\<Sum>i<n. of_nat (n choose i) * of_real (bernoulli i) :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. fact n * (of_real (bernoulli i) / (fact i * fact (n - i)))) = (\<Sum>i<n. of_nat (n choose i) * of_real (bernoulli i))
[PROOF STEP]
by (intro sum.cong) (simp_all add: binomial_fact)
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. fact n * (of_real (bernoulli i) / (fact i * fact (n - i)))) = (\<Sum>i<n. of_nat (n choose i) * of_real (bernoulli i))

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. fact n * (of_real (bernoulli i) / (fact i * fact (n - i)))) = (\<Sum>i<n. of_nat (n choose i) * of_real (bernoulli i))

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
have "\<dots> = of_real (\<Sum>i<n. (n choose i) * bernoulli i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. of_nat (n choose i) * of_real (bernoulli i)) = of_real (\<Sum>i<n. real (n choose i) * bernoulli i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. of_nat (n choose i) * of_real (bernoulli i)) = of_real (\<Sum>i<n. real (n choose i) * bernoulli i)

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. of_nat (n choose i) * of_real (bernoulli i)) = of_real (\<Sum>i<n. real (n choose i) * bernoulli i)

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
have "\<dots> / fact n = fps_X $ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_real (\<Sum>i<n. real (n choose i) * bernoulli i) / fact n = fps_X $ n
[PROOF STEP]
by (subst sum_binomial_times_bernoulli') simp_all
[PROOF STATE]
proof (state)
this:
of_real (\<Sum>i<n. real (n choose i) * bernoulli i) / fact n = fps_X $ n

goal (1 subgoal):
 1. \<And>n. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
show "(Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n :: 'a) * (fps_exp 1 - 1)) $ n =
                     fps_X $ n"
[PROOF STATE]
proof (prove)
using this:
(Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n

goal (1 subgoal):
 1. (Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1)) $ n = fps_X $ n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1) = fps_X

goal (2 subgoals):
 1. bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n)
 2. bernoulli_fps * (fps_exp (1::'a) - 1) = fps_X
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1) = fps_X

goal (2 subgoals):
 1. bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n)
 2. bernoulli_fps * (fps_exp (1::'a) - 1) = fps_X
[PROOF STEP]
show "bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n)
[PROOF STEP]
unfolding bernoulli_fps_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_X / (fps_exp (1::'a) - 1) = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n)
[PROOF STEP]
by (subst * [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n)

goal (1 subgoal):
 1. bernoulli_fps * (fps_exp (1::'a) - 1) = fps_X
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1) = fps_X
bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n)
[PROOF STEP]
show "bernoulli_fps * (fps_exp 1 - 1 :: 'a fps) = fps_X"
[PROOF STATE]
proof (prove)
using this:
Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n) * (fps_exp (1::'a) - 1) = fps_X
bernoulli_fps = Abs_fps (\<lambda>n. of_real (bernoulli n) / fact n)

goal (1 subgoal):
 1. bernoulli_fps * (fps_exp (1::'a) - 1) = fps_X
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bernoulli_fps * (fps_exp (1::'a) - 1) = fps_X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma loxodromic_isometry_inv:
  assumes "loxodromic_isometry f"
  shows "loxodromic_isometry (inv f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. loxodromic_isometry (inv f)
[PROOF STEP]
unfolding loxodromic_isometry_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry (inv f) \<and> \<not> elliptic_isometry (inv f) \<and> stable_translation_length (inv f) \<noteq> 0
[PROOF STEP]
using isometry_inverse[of f] elliptic_isometry_inv_iff[of f]
loxodromic_isometryD[OF assms] stable_translation_length_inv[of f]
[PROOF STATE]
proof (prove)
using this:
isometry f \<Longrightarrow> isometry (inv f)
isometry f \<Longrightarrow> bij f
bij f \<Longrightarrow> elliptic_isometry (inv f) = elliptic_isometry f
isometry f
\<not> bounded {(f ^^ n) ?x |n. True}
0 < stable_translation_length f
\<not> elliptic_isometry f
isometry f \<Longrightarrow> stable_translation_length (inv f) = stable_translation_length f

goal (1 subgoal):
 1. isometry (inv f) \<and> \<not> elliptic_isometry (inv f) \<and> stable_translation_length (inv f) \<noteq> 0
[PROOF STEP]
by auto


[STATEMENT]
lemma setprod_lessThan_Suc[simp]:
  "(\<Prod>i < Suc n. f i) = (\<Prod>i < n. f i) * f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<Suc n} = prod f {..<n} * f n
[PROOF STEP]
by (simp add:lessThan_Suc mult_ac)


[STATEMENT]
lemma of_nat_le_zhmset_of_enat_iff: "of_nat m \<le> zhmset_of_enat n \<longleftrightarrow> enat m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat m \<le> zhmset_of_enat n) = (enat m \<le> n)
[PROOF STEP]
by (metis zhmset_of_enat.simps(1) zhmset_of_enat_le_iff_le)


[STATEMENT]
lemma sums_cot_pfd_real:
  fixes x :: real
  shows "(\<lambda>n. 2 * x / (x ^ 2 - of_nat (Suc n) ^ 2)) sums cot_pfd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2)) sums cot_pfd x
[PROOF STEP]
using summable_cot_pfd_real[of x]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2))

goal (1 subgoal):
 1. (\<lambda>n. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2)) sums cot_pfd x
[PROOF STEP]
by (simp add: cot_pfd_def sums_iff)


[STATEMENT]
lemma nonzero_nat_pow_ord:
  assumes "a \<in> nonzero Q\<^sub>p"
  shows "ord (a [^] (n::nat)) = n * ord a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord (a [^] n) = int n * ord a
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ord (a [^] 0) = int 0 * ord a
 2. \<And>n. ord (a [^] n) = int n * ord a \<Longrightarrow> ord (a [^] Suc n) = int (Suc n) * ord a
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. ord (a [^] n) = int n * ord a \<Longrightarrow> ord (a [^] Suc n) = int (Suc n) * ord a
[PROOF STEP]
using Qp_nat_pow_nonzero assms semiring_normalization_rules(2)
[PROOF STATE]
proof (prove)
using this:
?x \<in> nonzero Q\<^sub>p \<Longrightarrow> ?x [^] ?n \<in> nonzero Q\<^sub>p
a \<in> nonzero Q\<^sub>p
?a * ?m + ?m = (?a + (1::?'a)) * ?m

goal (1 subgoal):
 1. \<And>n. ord (a [^] n) = int n * ord a \<Longrightarrow> ord (a [^] Suc n) = int (Suc n) * ord a
[PROOF STEP]
by (simp add: semiring_normalization_rules(2) ord_mult)


[STATEMENT]
lemma index_minus_vec[simp]:
  "i < dim_vec v\<^sub>2 \<Longrightarrow> (v\<^sub>1 - v\<^sub>2) $ i = v\<^sub>1 $ i - v\<^sub>2 $ i" "dim_vec (v\<^sub>1 - v\<^sub>2) = dim_vec v\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < dim_vec v\<^sub>2 \<Longrightarrow> (v\<^sub>1 - v\<^sub>2) $ i = v\<^sub>1 $ i - v\<^sub>2 $ i) &&& dim_vec (v\<^sub>1 - v\<^sub>2) = dim_vec v\<^sub>2
[PROOF STEP]
unfolding minus_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < dim_vec v\<^sub>2 \<Longrightarrow> vec (dim_vec v\<^sub>2) (\<lambda>i. v\<^sub>1 $ i - v\<^sub>2 $ i) $ i = v\<^sub>1 $ i - v\<^sub>2 $ i) &&& dim_vec (vec (dim_vec v\<^sub>2) (\<lambda>i. v\<^sub>1 $ i - v\<^sub>2 $ i)) = dim_vec v\<^sub>2
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_strict_mono':
  assumes "a < b" and "c < d" and "0 \<le> a" and "0 \<le> c"
  shows "a * c < b * d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * c < b * d
[PROOF STEP]
by (rule mult_strict_mono) (insert assms, auto)


[STATEMENT]
lemma measurable_pair_measureI:
  assumes 1: "f \<in> space M \<rightarrow> space M1 \<times> space M2"
  assumes 2: "\<And>A B. A \<in> sets M1 \<Longrightarrow> B \<in> sets M2 \<Longrightarrow> f -` (A \<times> B) \<inter> space M \<in> sets M"
  shows "f \<in> measurable M (M1 \<Otimes>\<^sub>M M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M M1 \<Otimes>\<^sub>M M2
[PROOF STEP]
unfolding pair_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M measure_of (space M1 \<times> space M2) {a \<times> b |a b. a \<in> sets M1 \<and> b \<in> sets M2} (\<lambda>X. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M2 \<partial>M1)
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
f \<in> space M \<rightarrow> space M1 \<times> space M2
\<lbrakk>?A \<in> sets M1; ?B \<in> sets M2\<rbrakk> \<Longrightarrow> f -` (?A \<times> ?B) \<inter> space M \<in> sets M

goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M measure_of (space M1 \<times> space M2) {a \<times> b |a b. a \<in> sets M1 \<and> b \<in> sets M2} (\<lambda>X. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M2 \<partial>M1)
[PROOF STEP]
by (intro measurable_measure_of) (auto dest: sets.sets_into_space)


[STATEMENT]
lemma Dirichlet_L_conv_hurwitz_zeta_nonprincipal:
  assumes "s \<noteq> 1"
  shows   "Dirichlet_L n \<chi> s =
             of_nat n powr -s * (\<Sum>k = 1..n. \<chi> k * hurwitz_zeta (real k / real n) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dirichlet_L n \<chi> s = of_nat n powr - s * (\<Sum>k = 1..n. \<chi> k * hurwitz_zeta (real k / real n) s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s \<noteq> 1

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s = of_nat n powr - s * (\<Sum>k = 1..n. \<chi> k * hurwitz_zeta (real k / real n) s)
[PROOF STEP]
by (simp add: Dirichlet_L_def)


[STATEMENT]
lemma vintersection_def: "A \<inter>\<^sub>\<circ> B = set {x. x \<in>\<^sub>\<circ> A \<and> x \<in>\<^sub>\<circ> B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter>\<^sub>\<circ> B = set {x. x \<in>\<^sub>\<circ> A \<and> x \<in>\<^sub>\<circ> B}
[PROOF STEP]
by (metis Int_def inf_V_def)


[STATEMENT]
lemma twopow_dvd_totient:
  fixes n :: nat
  assumes "n > 0"
  defines "k \<equiv> card {p\<in>prime_factors n. odd p}"
  shows   "2 ^ k dvd totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
define P where "P = {p\<in>prime_factors n. odd p}"
[PROOF STATE]
proof (state)
this:
P = {p. p \<in># prime_factorization n \<and> odd p}

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
define P' where "P' = {p\<in>prime_factors n. even p}"
[PROOF STATE]
proof (state)
this:
P' = {p. p \<in># prime_factorization n \<and> even p}

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
define r where "r = (\<lambda>p. multiplicity p n)"
[PROOF STATE]
proof (state)
this:
r = (\<lambda>p. multiplicity p n)

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
from \<open>n > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "totient n = (\<Prod>p\<in>prime_factors n. totient (p ^ r p))"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. totient (p ^ r p))
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>prime_factors n. totient (p ^ multiplicity p n))
[PROOF STEP]
by (rule totient.prod_prime_factors)
[PROOF STATE]
proof (state)
this:
totient n = (\<Prod>p\<in>prime_factors n. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
totient n = (\<Prod>p\<in>prime_factors n. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
have "prime_factors n = P \<union> P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors n = P \<union> P'
[PROOF STEP]
by (auto simp: P_def P'_def)
[PROOF STATE]
proof (state)
this:
prime_factors n = P \<union> P'

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factors n = P \<union> P'

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
have "(\<Prod>p\<in>\<dots>. totient (p ^ r p)) =
               (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>P \<union> P'. totient (p ^ r p)) = (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))
[PROOF STEP]
by (subst prod.union_disjoint) (auto simp: P_def P'_def)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>P \<union> P'. totient (p ^ r p)) = (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
totient n = (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))
[PROOF STEP]
have eq: "totient n = \<dots>"
[PROOF STATE]
proof (prove)
using this:
totient n = (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))

goal (1 subgoal):
 1. totient n = (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
totient n = (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
have "p ^ r p > 2" if "p \<in> P" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
have "p \<noteq> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 2
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
p \<in> P

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

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p \<noteq> 2

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
have "p > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < p
[PROOF STEP]
using prime_gt_1_nat[of p] that
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 1 < p
p \<in> P

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

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 2
1 < p
[PROOF STEP]
have "2 < p"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 2
1 < p

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

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 < p

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
have "p = p ^ 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = p ^ 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p = p ^ 1

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p = p ^ 1

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
have "p ^ 1 \<le> p ^ r p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ 1 \<le> p ^ r p
[PROOF STEP]
using that prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
p \<in> P
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. p ^ 1 \<le> p ^ r p
[PROOF STEP]
by (intro power_increasing) (auto simp: P_def prime_factors_multiplicity r_def)
[PROOF STATE]
proof (state)
this:
p ^ 1 \<le> p ^ r p

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 < p ^ r p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 < p ^ r p

goal (1 subgoal):
 1. 2 < p ^ r p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 < p ^ r p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?p \<in> P \<Longrightarrow> 2 < ?p ^ r ?p

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
hence "(\<Prod>p\<in>P. 2) dvd (\<Prod>p\<in>P. totient (p ^ r p))"
[PROOF STATE]
proof (prove)
using this:
?p \<in> P \<Longrightarrow> 2 < ?p ^ r ?p

goal (1 subgoal):
 1. (\<Prod>p\<in>P. 2) dvd (\<Prod>p\<in>P. totient (p ^ r p))
[PROOF STEP]
by (intro prod_dvd_prod totient_even)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>P. 2) dvd (\<Prod>p\<in>P. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
hence "2 ^ card P dvd (\<Prod>p\<in>P. totient (p ^ r p))"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>p\<in>P. 2) dvd (\<Prod>p\<in>P. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ card P dvd (\<Prod>p\<in>P. totient (p ^ r p))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ card P dvd (\<Prod>p\<in>P. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ card P dvd (\<Prod>p\<in>P. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
have "\<dots> dvd (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>P. totient (p ^ r p)) dvd (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>P. totient (p ^ r p)) dvd (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>P. totient (p ^ r p)) dvd (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p))

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
have "\<dots> = totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p)) = totient n
[PROOF STEP]
by (rule eq [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>P. totient (p ^ r p)) * (\<Prod>p\<in>P'. totient (p ^ r p)) = totient n

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 ^ card P dvd totient n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 ^ card P dvd totient n

goal (1 subgoal):
 1. 2 ^ k dvd totient n
[PROOF STEP]
unfolding k_def P_def
[PROOF STATE]
proof (prove)
using this:
2 ^ card {p. p \<in># prime_factorization n \<and> odd p} dvd totient n

goal (1 subgoal):
 1. 2 ^ card {p. p \<in># prime_factorization n \<and> odd p} dvd totient n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 ^ k dvd totient n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma double_eq_zero_iff:
  \<open>2 * a = 0 \<longleftrightarrow> a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0)\<close>
  for a :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
define n where \<open>n = LENGTH('a) - Suc 0\<close>
[PROOF STATE]
proof (state)
this:
n = LENGTH('a) - Suc 0

goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = LENGTH('a) - Suc 0
[PROOF STEP]
have *: \<open>LENGTH('a) = Suc n\<close>
[PROOF STATE]
proof (prove)
using this:
n = LENGTH('a) - Suc 0

goal (1 subgoal):
 1. LENGTH('a) = Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LENGTH('a) = Suc n

goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
have \<open>a = 0\<close> if \<open>2 * a = 0\<close> and \<open>a \<noteq> 2 ^ (LENGTH('a) - Suc 0)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
2 * a = 0
a \<noteq> 2 ^ (LENGTH('a) - Suc 0)

goal (1 subgoal):
 1. a = 0
[PROOF STEP]
by transfer
      (auto simp add: take_bit_eq_0_iff take_bit_eq_mod *)
[PROOF STATE]
proof (state)
this:
\<lbrakk>2 * a = 0; a \<noteq> 2 ^ (LENGTH('a) - Suc 0)\<rbrakk> \<Longrightarrow> a = 0

goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>2 * a = 0; a \<noteq> 2 ^ (LENGTH('a) - Suc 0)\<rbrakk> \<Longrightarrow> a = 0

goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
have \<open>2 ^ LENGTH('a) = (0 :: 'a word)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ LENGTH('a) = 0
[PROOF STEP]
by transfer simp
[PROOF STATE]
proof (state)
this:
2 ^ LENGTH('a) = 0

goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ LENGTH('a) = 0
[PROOF STEP]
have \<open>2 * 2 ^ (LENGTH('a) - Suc 0) = (0 :: 'a word)\<close>
[PROOF STATE]
proof (prove)
using this:
2 ^ LENGTH('a) = 0

goal (1 subgoal):
 1. 2 * 2 ^ (LENGTH('a) - Suc 0) = 0
[PROOF STEP]
by (simp add: *)
[PROOF STATE]
proof (state)
this:
2 * 2 ^ (LENGTH('a) - Suc 0) = 0

goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>2 * a = 0; a \<noteq> 2 ^ (LENGTH('a) - Suc 0)\<rbrakk> \<Longrightarrow> a = 0
2 * 2 ^ (LENGTH('a) - Suc 0) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>2 * a = 0; a \<noteq> 2 ^ (LENGTH('a) - Suc 0)\<rbrakk> \<Longrightarrow> a = 0
2 * 2 ^ (LENGTH('a) - Suc 0) = 0

goal (1 subgoal):
 1. (2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(2 * a = 0) = (a = 0 \<or> a = 2 ^ (LENGTH('a) - Suc 0))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma connected_nest_gen:
  fixes S :: "'a::linorder \<Rightarrow> 'b::euclidean_space set"
  assumes S: "\<And>n. closed(S n)" "\<And>n. connected(S n)" "compact(S k)"
    and nest: "\<And>m n. m \<le> n \<Longrightarrow> S n \<subseteq> S m"
  shows "connected(\<Inter> (range S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected (\<Inter> (range S))
[PROOF STEP]
proof (rule connected_chain_gen [of "S k"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. S k \<in> range S
 2. compact (S k)
 3. \<And>T. T \<in> range S \<Longrightarrow> closed T \<and> connected T
 4. \<And>Sa T. Sa \<in> range S \<and> T \<in> range S \<Longrightarrow> Sa \<subseteq> T \<or> T \<subseteq> Sa
[PROOF STEP]
show "\<And>A T. A \<in> range S \<and> T \<in> range S \<Longrightarrow> A \<subseteq> T \<or> T \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A T. A \<in> range S \<and> T \<in> range S \<Longrightarrow> A \<subseteq> T \<or> T \<subseteq> A
[PROOF STEP]
by (metis imageE le_cases nest)
[PROOF STATE]
proof (state)
this:
?A \<in> range S \<and> ?T \<in> range S \<Longrightarrow> ?A \<subseteq> ?T \<or> ?T \<subseteq> ?A

goal (3 subgoals):
 1. S k \<in> range S
 2. compact (S k)
 3. \<And>T. T \<in> range S \<Longrightarrow> closed T \<and> connected T
[PROOF STEP]
qed (use S in auto)


[STATEMENT]
lemma E_sup_add_left:
  assumes [measurable]: "f \<in> borel_measurable St"
  shows "E_sup s (\<lambda>x. f x + c) = E_sup s f + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E_sup s (\<lambda>x. f x + c) = E_sup s f + c
[PROOF STEP]
by (simp add: nn_integral_add E_sup_def T.emeasure_space_1[simplified] ennreal_SUP_add_left)


[STATEMENT]
theorem sup_state_rev_fst:
  "(G \<turnstile> (rev a, x) <=s (rev b, y)) = (G \<turnstile> (a, x) <=s (b, y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<turnstile> (rev a, x) <=s (rev b, y) = G \<turnstile> (a, x) <=s (b, y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. G \<turnstile> (rev a, x) <=s (rev b, y) = G \<turnstile> (a, x) <=s (b, y)
[PROOF STEP]
have m: "\<And>f x. map f (rev x) = rev (map f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x. map f (rev x) = rev (map f x)
[PROOF STEP]
by (simp add: rev_map)
[PROOF STATE]
proof (state)
this:
map ?f (rev ?x) = rev (map ?f ?x)

goal (1 subgoal):
 1. G \<turnstile> (rev a, x) <=s (rev b, y) = G \<turnstile> (a, x) <=s (b, y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<turnstile> (rev a, x) <=s (rev b, y) = G \<turnstile> (a, x) <=s (b, y)
[PROOF STEP]
by (simp add: m sup_state_def stk_convert lesub_def Product.le_def)
[PROOF STATE]
proof (state)
this:
G \<turnstile> (rev a, x) <=s (rev b, y) = G \<turnstile> (a, x) <=s (b, y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_linear_power: "degree ([:a, 1:] ^ n) = n"
  for a :: "'a::comm_semiring_1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:a, 1::'a:] ^ n) = n
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree ([:a, 1::'a:] ^ n) \<le> n
 2. n \<le> degree ([:a, 1::'a:] ^ n)
[PROOF STEP]
show "degree ([:a, 1:] ^ n) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:a, 1::'a:] ^ n) \<le> n
[PROOF STEP]
by (metis One_nat_def degree_pCons_eq_if degree_power_le mult.left_neutral one_neq_zero one_pCons)
[PROOF STATE]
proof (state)
this:
degree ([:a, 1::'a:] ^ n) \<le> n

goal (1 subgoal):
 1. n \<le> degree ([:a, 1::'a:] ^ n)
[PROOF STEP]
qed (simp add: coeff_linear_power le_degree)


[STATEMENT]
lemma ceiling_le_one [simp]: "\<lceil>x\<rceil> \<le> 1 \<longleftrightarrow> x \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lceil>x\<rceil> \<le> 1) = (x \<le> (1::'a))
[PROOF STEP]
by (simp add: ceiling_le_iff)


[STATEMENT]
lemma ACC_cf_union: "ACC_cf (X \<union> Y) = ACC_cf X \<union> ACC_cf Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ACC_cf (X \<union> Y) = ACC_cf X \<union> ACC_cf Y
[PROOF STEP]
unfolding ACC_cf_def accepts_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {F \<in> \<F>. \<exists>D\<in>X \<union> Y. D \<subseteq> C F} = {F \<in> \<F>. \<exists>D\<in>X. D \<subseteq> C F} \<union> {F \<in> \<F>. \<exists>D\<in>Y. D \<subseteq> C F}
[PROOF STEP]
by blast


[STATEMENT]
lemma Or_propos:
  "propos (Or xs) = \<Union>{propos x| x. x \<in> set xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
proof (cases xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
 2. \<And>a list. xs = a # list \<Longrightarrow> propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
xs = []

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
 2. \<And>a list. xs = a # list \<Longrightarrow> propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
xs = []

goal (1 subgoal):
 1. propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
xs = x # xs

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
xs = x # xs

goal (1 subgoal):
 1. propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
using propos_foldl[of LTLOr x]
[PROOF STATE]
proof (prove)
using this:
xs = x # xs
(\<And>x y. propos (x or y) = propos x \<union> propos y) \<Longrightarrow> \<Union> {propos y |y. y = x \<or> y \<in> set ?xs} = propos (foldl LTLOr x ?xs)

goal (1 subgoal):
 1. propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
propos (Or xs) = \<Union> {propos x |x. x \<in> set xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bouncing_ball_dyn: "g < 0 \<Longrightarrow> h \<ge> 0 \<Longrightarrow>
  {s. s$1 = h \<and> s$2 = 0} \<le> fb\<^sub>\<F>
  (LOOP (
    (EVOL (\<phi> g) (\<lambda> s. s$1 \<ge> 0) T) ;
    (IF (\<lambda> s. s$1 = 0) THEN (2 ::= (\<lambda>s. - s$2)) ELSE skip))
  INV (\<lambda>s. 0 \<le> s$1 \<and> 2 * g * s$1 = 2 * g * h + s$2 * s$2))
  {s. 0 \<le> s$1 \<and> s$1 \<le> h}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> {s. s $ 1 = h \<and> s $ 2 = 0} \<subseteq> fb\<^sub>\<F> (LOOP EVOL (\<lambda>t s. \<chi>i. if i = 1 then g \<cdot> t\<^sup>2 / 2 + s $ 2 \<cdot> t + s $ 1 else g \<cdot> t + s $ 2) (\<lambda>s. 0 \<le> s $ 1) T ; (IF (\<lambda>s. s $ 1 = 0) THEN (2 ::= (\<lambda>s. - s $ 2)) ELSE skip) INV (\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2) ) {s. 0 \<le> s $ 1 \<and> s $ 1 \<le> h}
[PROOF STEP]
by (rule ffb_loopI) (auto simp: bb_real_arith)

\<comment> \<open>Verified with the flow. \<close>


[STATEMENT]
lemma compact_space_proper_map_preimage:
  assumes f: "proper_map X Y f" and fim: "f ` (topspace X) = topspace Y" and "compact_space Y"
  shows "compact_space X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact_space X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compact_space X
[PROOF STEP]
have eq: "topspace X = {x \<in> topspace X. f x \<in> topspace Y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace X = {x \<in> topspace X. f x \<in> topspace Y}
[PROOF STEP]
using fim
[PROOF STATE]
proof (prove)
using this:
f ` topspace X = topspace Y

goal (1 subgoal):
 1. topspace X = {x \<in> topspace X. f x \<in> topspace Y}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
topspace X = {x \<in> topspace X. f x \<in> topspace Y}

goal (1 subgoal):
 1. compact_space X
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
topspace X = {x \<in> topspace X. f x \<in> topspace Y}

goal (1 subgoal):
 1. compact_space X
[PROOF STEP]
have "compactin Y (topspace Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compactin Y (topspace Y)
[PROOF STEP]
using \<open>compact_space Y\<close> compact_space_def
[PROOF STATE]
proof (prove)
using this:
compact_space Y
compact_space ?X \<equiv> compactin ?X (topspace ?X)

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

goal (1 subgoal):
 1. compact_space X
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
topspace X = {x \<in> topspace X. f x \<in> topspace Y}
compactin Y (topspace Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace X = {x \<in> topspace X. f x \<in> topspace Y}
compactin Y (topspace Y)

goal (1 subgoal):
 1. compact_space X
[PROOF STEP]
unfolding compact_space_def
[PROOF STATE]
proof (prove)
using this:
topspace X = {x \<in> topspace X. f x \<in> topspace Y}
compactin Y (topspace Y)

goal (1 subgoal):
 1. compactin X (topspace X)
[PROOF STEP]
using eq f compactin_proper_map_preimage
[PROOF STATE]
proof (prove)
using this:
topspace X = {x \<in> topspace X. f x \<in> topspace Y}
compactin Y (topspace Y)
topspace X = {x \<in> topspace X. f x \<in> topspace Y}
proper_map X Y f
\<lbrakk>proper_map ?X ?Y ?f; compactin ?Y ?K\<rbrakk> \<Longrightarrow> compactin ?X {x \<in> topspace ?X. ?f x \<in> ?K}

goal (1 subgoal):
 1. compactin X (topspace X)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
compact_space X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lenlex_nsets_2_eq: "nsets A 2 = {{x,y} | x y. x \<in> A \<and> y \<in> A \<and> (x,y) \<in> lenlex less_than}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [A]\<^bsup>2\<^esup> = {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> lenlex less_than}
[PROOF STEP]
using total_order_nsets_2_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>total_on ?A ?r; irrefl ?r\<rbrakk> \<Longrightarrow> [?A]\<^bsup>2\<^esup> = {{x, y} |x y. x \<in> ?A \<and> y \<in> ?A \<and> (x, y) \<in> ?r}

goal (1 subgoal):
 1. [A]\<^bsup>2\<^esup> = {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> lenlex less_than}
[PROOF STEP]
by (simp add: total_order_nsets_2_eq irrefl_def)


[STATEMENT]
lemma finite_inf_linorder_ne_ex:
  fixes f :: "_ \<Rightarrow> _::{complete_lattice,linorder}"
  assumes "finite S"
  assumes "S\<noteq>{}"
  shows "\<exists>x\<in>S. (INF x \<in> S. f x) = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>S. Inf (f ` S) = f x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
S \<noteq> {}

goal (1 subgoal):
 1. \<exists>x\<in>S. Inf (f ` S) = f x
[PROOF STEP]
by (meson Inf_in finite_imageI imageE image_is_empty)


[STATEMENT]
lemma foldr_scene_union_eq_scene_space:
  "\<lbrakk> set xs \<subseteq> scene_space; set xs = set ys \<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs = \<Squnion>\<^sub>S ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set xs \<subseteq> scene_space; set xs = set ys\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs = \<Squnion>\<^sub>S ys
[PROOF STEP]
by (metis foldr_scene_union_eq_sets pairwise_def pairwise_subset scene_space_compat)


[STATEMENT]
lemma tau_star_tau [simp]: "\<tau> ((\<tau> x)\<^sup>\<star>) = \<tau> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau> (\<tau> x\<^sup>\<star>) = \<tau> x
[PROOF STEP]
using local.s_prod_distr tau_star
[PROOF STATE]
proof (prove)
using this:
(?x + ?y) \<cdot> ?z = ?x \<cdot> ?z + ?y \<cdot> ?z
\<tau> ?x\<^sup>\<star> = 1\<^sub>\<sigma> + \<tau> ?x

goal (1 subgoal):
 1. \<tau> (\<tau> x\<^sup>\<star>) = \<tau> x
[PROOF STEP]
by auto


[STATEMENT]
lemma  vec_hom_set_distinct_iff:
  fixes xs :: "'a vec list"
  shows "distinct xs \<longleftrightarrow> distinct (map (map_vec hom) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs = distinct (map (map_vec hom) xs)
[PROOF STEP]
using vec_hom_inj
[PROOF STATE]
proof (prove)
using this:
map_vec hom ?v = map_vec hom ?w \<Longrightarrow> ?v = ?w

goal (1 subgoal):
 1. distinct xs = distinct (map (map_vec hom) xs)
[PROOF STEP]
by (induct xs) (auto)


[STATEMENT]
lemma has_sum_Re:
  assumes "has_sum f M a"
  shows "has_sum (\<lambda>x. Re (f x)) M (Re a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum (\<lambda>x. Re (f x)) M (Re a)
[PROOF STEP]
apply (rule has_sum_comm_additive[where f=Re, unfolded o_def])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. additive Re
 2. Re \<midarrow>a\<rightarrow> Re a
 3. has_sum f M a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
has_sum f M a

goal (3 subgoals):
 1. additive Re
 2. Re \<midarrow>a\<rightarrow> Re a
 3. has_sum f M a
[PROOF STEP]
by (auto intro!: additive.intro tendsto_Re)


[STATEMENT]
lemma map_iterator_linord_foldli_conv :
    "map_iterator_linord iti m \<longleftrightarrow>
     (\<exists>l0. distinct (map fst l0) \<and> m = map_of l0 \<and> sorted (map fst l0) \<and> iti = foldli l0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_iterator_linord iti m = (\<exists>l0. distinct (map fst l0) \<and> m = map_of l0 \<and> sorted (map fst l0) \<and> iti = foldli l0)
[PROOF STEP]
unfolding set_iterator_map_linord_def map_iterator_genord_foldli_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>l0. distinct (map fst l0) \<and> m = map_of l0 \<and> sorted_wrt (\<lambda>(k, uu_) (k', uu_). k \<le> k') l0 \<and> iti = foldli l0) = (\<exists>l0. distinct (map fst l0) \<and> m = map_of l0 \<and> sorted (map fst l0) \<and> iti = foldli l0)
[PROOF STEP]
by (simp add: sorted_wrt_keys_map_fst)