[STATEMENT]
lemma poly_at_top_or_bot_at_bot:
  fixes p :: "real poly"
  assumes "degree p \<ge> 1" "coeff p (degree p) > 0"
  shows "LIM x at_bot. poly p x :> (if even (degree p) then at_top else at_bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
let ?n = "degree p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
define f g where "f x = poly p x / x ^ ?n" and "g x = x ^ ?n" for x :: real
[PROOF STATE]
proof (state)
this:
f ?x = poly p ?x / ?x ^ degree p
g ?x = ?x ^ degree p

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
from poly_limit_aux
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. poly ?p x / x ^ degree ?p) \<longlongrightarrow> lead_coeff ?p) at_infinity
[PROOF STEP]
have "(f \<longlongrightarrow> coeff p (degree p)) at_bot"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. poly ?p x / x ^ degree ?p) \<longlongrightarrow> lead_coeff ?p) at_infinity

goal (1 subgoal):
 1. (f \<longlongrightarrow> lead_coeff p) at_bot
[PROOF STEP]
using tendsto_mono at_bot_le_at_infinity
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. poly ?p x / x ^ degree ?p) \<longlongrightarrow> lead_coeff ?p) at_infinity
\<lbrakk>?F \<le> ?F'; (?f \<longlongrightarrow> ?l) ?F'\<rbrakk> \<Longrightarrow> (?f \<longlongrightarrow> ?l) ?F
at_bot \<le> at_infinity

goal (1 subgoal):
 1. (f \<longlongrightarrow> lead_coeff p) at_bot
[PROOF STEP]
by (force simp: f_def [abs_def])
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> lead_coeff p) at_bot

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> lead_coeff p) at_bot

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 \<le> degree p
0 < lead_coeff p
[PROOF STEP]
have "LIM x at_bot. g x :> (if even (degree p) then at_top else at_bot)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> degree p
0 < lead_coeff p

goal (1 subgoal):
 1. filterlim g (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
by (auto simp add: g_def split: if_split_asm intro: filterlim_pow_at_bot_even filterlim_pow_at_bot_odd filterlim_ident)
[PROOF STATE]
proof (state)
this:
filterlim g (if even (degree p) then at_top else at_bot) at_bot

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> lead_coeff p) at_bot
filterlim g (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
have "LIM x at_bot. f x * g x :>
                      (if even ?n then at_top else at_bot)"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> lead_coeff p) at_bot
filterlim g (if even (degree p) then at_top else at_bot) at_bot

goal (1 subgoal):
 1. LIM x at_bot. f x * g x :> if even (degree p) then at_top else at_bot
[PROOF STEP]
by (auto simp: assms intro: filterlim_tendsto_pos_mult_at_top
                                  filterlim_tendsto_pos_mult_at_bot)
[PROOF STATE]
proof (state)
this:
LIM x at_bot. f x * g x :> if even (degree p) then at_top else at_bot

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LIM x at_bot. f x * g x :> if even (degree p) then at_top else at_bot

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
have "eventually (\<lambda>x. f x * g x = poly p x) at_bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_bot. f x * g x = poly p x
[PROOF STEP]
unfolding f_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_bot. poly p x / x ^ degree p * x ^ degree p = poly p x
[PROOF STEP]
by (subst eventually_at_bot_linorder, rule exI[of _ "-1"],
          simp add: poly_altdef field_simps sum_distrib_left power_diff)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_bot. f x * g x = poly p x

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
note filterlim_cong[OF refl refl this]
[PROOF STATE]
proof (state)
this:
(LIM x at_bot. f x * g x :> ?F1.0) = filterlim (poly p) ?F1.0 at_bot

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot

goal (1 subgoal):
 1. filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
filterlim (poly p) (if even (degree p) then at_top else at_bot) at_bot

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtrancl_len_E [elim]:
  assumes "(x, y) \<in> r\<^sup>*" obtains n where "(x, y) \<in> r^^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. (x, y) \<in> r ^^ n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using rtrancl_imp_UN_relpow [OF assms]
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> \<Union> (range ((^^) r))

goal (1 subgoal):
 1. (\<And>n. (x, y) \<in> r ^^ n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by best


[STATEMENT]
lemma eventually_deriv_add:
  assumes "f twice_field_differentiable_at x"
      and "g twice_field_differentiable_at x"
    shows "\<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
obtain S where Df_on_S: "f field_differentiable_on S" and x_int_S: "x \<in> interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S. \<lbrakk>f field_differentiable_on S; x \<in> interior S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms twice_field_differentiable_at_def
[PROOF STATE]
proof (prove)
using this:
f twice_field_differentiable_at x
g twice_field_differentiable_at x
?f twice_field_differentiable_at ?x \<equiv> \<exists>S. ?f field_differentiable_on S \<and> ?x \<in> interior S \<and> deriv ?f field_differentiable at ?x

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>f field_differentiable_on S; x \<in> interior S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f field_differentiable_on S
x \<in> interior S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
obtain S' where Dg_on_S: "g field_differentiable_on S'" and x_int_S': "x \<in> interior S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S'. \<lbrakk>g field_differentiable_on S'; x \<in> interior S'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms twice_field_differentiable_at_def
[PROOF STATE]
proof (prove)
using this:
f twice_field_differentiable_at x
g twice_field_differentiable_at x
?f twice_field_differentiable_at ?x \<equiv> \<exists>S. ?f field_differentiable_on S \<and> ?x \<in> interior S \<and> deriv ?f field_differentiable at ?x

goal (1 subgoal):
 1. (\<And>S'. \<lbrakk>g field_differentiable_on S'; x \<in> interior S'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g field_differentiable_on S'
x \<in> interior S'

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
have "x \<in> interior (S \<inter> S')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> interior (S \<inter> S')
[PROOF STEP]
by (simp add: x_int_S x_int_S')
[PROOF STATE]
proof (state)
this:
x \<in> interior (S \<inter> S')

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> interior (S \<inter> S')

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
have Df_on_SS': "f field_differentiable_on (S \<inter> S')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f field_differentiable_on S \<inter> S'
[PROOF STEP]
by (meson Df_on_S IntD1 field_differentiable_on_def field_differentiable_within_subset inf_sup_ord(1))
[PROOF STATE]
proof (state)
this:
f field_differentiable_on S \<inter> S'

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f field_differentiable_on S \<inter> S'

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
have Dg_on_SS': "g field_differentiable_on (S \<inter> S')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g field_differentiable_on S \<inter> S'
[PROOF STEP]
by (meson Dg_on_S IntD2 field_differentiable_on_def field_differentiable_within_subset inf_le2)
[PROOF STATE]
proof (state)
this:
g field_differentiable_on S \<inter> S'

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g field_differentiable_on S \<inter> S'

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
have "open (interior (S \<inter> S'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (interior (S \<inter> S'))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
open (interior (S \<inter> S'))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open (interior (S \<inter> S'))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
have "\<forall>x\<in> interior (S \<inter> S'). deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>interior (S \<inter> S'). deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
by (metis (full_types) Df_on_SS' Dg_on_SS' at_within_interior deriv_add field_differentiable_on_def in_mono interior_subset)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>interior (S \<inter> S'). deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> interior (S \<inter> S')
f field_differentiable_on S \<inter> S'
g field_differentiable_on S \<inter> S'
open (interior (S \<inter> S'))
\<forall>x\<in>interior (S \<inter> S'). deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> interior (S \<inter> S')
f field_differentiable_on S \<inter> S'
g field_differentiable_on S \<inter> S'
open (interior (S \<inter> S'))
\<forall>x\<in>interior (S \<inter> S'). deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
using eventually_nhds
[PROOF STATE]
proof (prove)
using this:
x \<in> interior (S \<inter> S')
f field_differentiable_on S \<inter> S'
g field_differentiable_on S \<inter> S'
open (interior (S \<inter> S'))
\<forall>x\<in>interior (S \<inter> S'). deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
eventually ?P (nhds ?a) = (\<exists>S. open S \<and> ?a \<in> S \<and> (\<forall>x\<in>S. ?P x))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enum_0_eq_Inf:
  fixes N :: "nat set"
  assumes "infinite N"
  shows "enum N 0 = Inf N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enum N 0 = \<Sqinter> N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. enum N 0 = \<Sqinter> N
[PROOF STEP]
have "enum N 0 \<in> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enum N 0 \<in> N
[PROOF STEP]
using assms range_enum
[PROOF STATE]
proof (prove)
using this:
infinite N
infinite ?N \<Longrightarrow> range (enum ?N) = ?N

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

goal (1 subgoal):
 1. enum N 0 = \<Sqinter> N
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
enum N 0 \<in> N

goal (1 subgoal):
 1. enum N 0 = \<Sqinter> N
[PROOF STEP]
have "\<And>x. x \<in> N \<Longrightarrow> enum N 0 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> N \<Longrightarrow> enum N 0 \<le> x
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) assms imageE le0 less_mono_imp_le_mono range_enum strict_monoD strict_mono_enum)
[PROOF STATE]
proof (state)
this:
?x \<in> N \<Longrightarrow> enum N 0 \<le> ?x

goal (1 subgoal):
 1. enum N 0 = \<Sqinter> N
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
enum N 0 \<in> N
?x \<in> N \<Longrightarrow> enum N 0 \<le> ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
enum N 0 \<in> N
?x \<in> N \<Longrightarrow> enum N 0 \<le> ?x

goal (1 subgoal):
 1. enum N 0 = \<Sqinter> N
[PROOF STEP]
by (metis cInf_eq_minimum)
[PROOF STATE]
proof (state)
this:
enum N 0 = \<Sqinter> N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scene_override_union: "X ##\<^sub>S Y \<Longrightarrow> S\<^sub>1 \<oplus>\<^sub>S S\<^sub>2 on (X \<squnion>\<^sub>S Y) = (S\<^sub>1 \<oplus>\<^sub>S S\<^sub>2 on X) \<oplus>\<^sub>S S\<^sub>2 on Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X ##\<^sub>S Y \<Longrightarrow> S\<^sub>1 \<oplus>\<^sub>S S\<^sub>2 on (X \<squnion>\<^sub>S Y) = S\<^sub>1 \<oplus>\<^sub>S S\<^sub>2 on X \<oplus>\<^sub>S S\<^sub>2 on Y
[PROOF STEP]
by (transfer, auto)


[STATEMENT]
lemma (in Ring) bilinear_r_lin1:"\<lbrakk>R module M1; R module M2; R module N;
      m1 \<in> carrier M1; m2 \<in> carrier M2; r \<in> carrier R;
      bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow>
      f (m1, r \<cdot>\<^sub>s\<^bsub>M2\<^esub> m2)  \<plusminus>\<^bsub>N\<^esub> -\<^sub>a\<^bsub>N\<^esub> (r \<cdot>\<^sub>s\<^bsub>N\<^esub> (f (m1, m2))) = \<zero>\<^bsub>N\<^esub> "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M1; R module M2; R module N; m1 \<in> carrier M1; m2 \<in> carrier M2; r \<in> carrier R; bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow> f (m1, r \<cdot>\<^sub>s\<^bsub>M2\<^esub> m2) \<plusminus>\<^bsub>N\<^esub> -\<^sub>a\<^bsub>N\<^esub> r \<cdot>\<^sub>s\<^bsub>N\<^esub> f (m1, m2) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (frule Module.module_is_ag[of N],
       subst aGroup.ag_eq_diffzero[of N, THEN sym], assumption+,
       frule_tac a = r and m = m2 in Module.sc_mem[of M2 R], assumption+,
       simp add:bilinear_mem)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module M1; R module M2; R module N; m1 \<in> carrier M1; m2 \<in> carrier M2; r \<in> carrier R; bilinear_map f R M1 M2 N; aGroup N\<rbrakk> \<Longrightarrow> r \<cdot>\<^sub>s\<^bsub>N\<^esub> f (m1, m2) \<in> carrier N
 2. \<lbrakk>R module M1; R module M2; R module N; m1 \<in> carrier M1; m2 \<in> carrier M2; r \<in> carrier R; bilinear_map f R M1 M2 N; aGroup N\<rbrakk> \<Longrightarrow> f (m1, r \<cdot>\<^sub>s\<^bsub>M2\<^esub> m2) = r \<cdot>\<^sub>s\<^bsub>N\<^esub> f (m1, m2)
[PROOF STEP]
apply (rule Module.sc_mem, assumption+, simp add:bilinear_mem,
        simp add:bilinear_r_lin)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prod_dhs_ga[autoref_ga_rules]:
  "\<lbrakk> GEN_ALGO_tag (is_valid_def_hm_size TYPE('a) n1);
     GEN_ALGO_tag (is_valid_def_hm_size TYPE('b) n2) \<rbrakk>
   \<Longrightarrow> is_valid_def_hm_size TYPE('a*'b) (n1+n2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>GEN_ALGO_tag (is_valid_def_hm_size TYPE('a) n1); GEN_ALGO_tag (is_valid_def_hm_size TYPE('b) n2)\<rbrakk> \<Longrightarrow> is_valid_def_hm_size TYPE('a \<times> 'b) (n1 + n2)
[PROOF STEP]
unfolding is_valid_def_hm_size_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>GEN_ALGO_tag (1 < n1); GEN_ALGO_tag (1 < n2)\<rbrakk> \<Longrightarrow> 1 < n1 + n2
[PROOF STEP]
by auto


[STATEMENT]
lemma (in auto_ll_on_open) f_tendsto[tendsto_intros]:
  assumes g1: "(g1 \<longlongrightarrow> b1) (at s within S)" and "b1 \<in> X"
  shows "((\<lambda>x. f (g1 x)) \<longlongrightarrow> f b1) (at s within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (g1 x)) \<longlongrightarrow> f b1) (at s within S)
[PROOF STEP]
apply (rule continuous_on_tendsto_compose[OF continuous tendsto_Pair[OF tendsto_const],
      unfolded split_beta fst_conv snd_conv, OF g1])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (?a1, b1) \<in> UNIV \<times> X
 2. \<forall>\<^sub>F x in at s within S. (?a1, g1 x) \<in> UNIV \<times> X
[PROOF STEP]
by (auto simp: \<open>b1 \<in> X\<close> intro!: topological_tendstoD[OF g1])


[STATEMENT]
theorem constr_fp_uniq:
  assumes "constr F E" "mono F" "\<Sqinter> (range E) = C"
  shows "(C \<and> \<mu> F) = (C \<and> \<nu> F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (C \<and> \<mu> F) = (C \<and> \<nu> F)
[PROOF STEP]
using assms(1) assms(2) assms(3) chain_pred_terminates
[PROOF STATE]
proof (prove)
using this:
constr F E
Monotonic F
\<Or>range E = C
\<lbrakk>constr ?F ?E; Monotonic ?F\<rbrakk> \<Longrightarrow> (\<Or>range ?E \<and> \<mu> ?F) = (\<Or>range ?E \<and> \<nu> ?F)

goal (1 subgoal):
 1. (C \<and> \<mu> F) = (C \<and> \<nu> F)
[PROOF STEP]
by blast


[STATEMENT]
lemma (in Ring) nsMulDistrL:"\<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk>
        \<Longrightarrow> x \<cdot>\<^sub>r (nscal R y n) = nscal R (x \<cdot>\<^sub>r y) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r  0 \<times>\<^bsub>R\<^esub> y =  0 \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)
 2. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r  Suc n \<times>\<^bsub>R\<^esub> y =  Suc n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<zero> = \<zero>
 2. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r  Suc n \<times>\<^bsub>R\<^esub> y =  Suc n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)
[PROOF STEP]
apply (simp add:ring_times_x_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r  Suc n \<times>\<^bsub>R\<^esub> y =  Suc n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r ( n \<times>\<^bsub>R\<^esub> y \<plusminus> y) =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y) \<plusminus> x \<cdot>\<^sub>r y
[PROOF STEP]
apply (subst ring_distrib1, assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)\<rbrakk> \<Longrightarrow>  n \<times>\<^bsub>R\<^esub> y \<in> carrier R
 2. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)\<rbrakk> \<Longrightarrow> y \<in> carrier R
 3. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y \<plusminus> x \<cdot>\<^sub>r y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y) \<plusminus> x \<cdot>\<^sub>r y
[PROOF STEP]
apply (rule nsClose, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y)\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r  n \<times>\<^bsub>R\<^esub> y \<plusminus> x \<cdot>\<^sub>r y =  n \<times>\<^bsub>R\<^esub> (x \<cdot>\<^sub>r y) \<plusminus> x \<cdot>\<^sub>r y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma corthogonal_inv:
  assumes orth: "corthogonal (vs ::'a::conjugatable_field vec list)"
      and V: "set vs \<subseteq> carrier_vec n"
  shows "inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)"
    (is "inverts_mat ?W ?V")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)
[PROOF STEP]
define l where "l = length vs"
[PROOF STATE]
proof (state)
this:
l = length vs

goal (1 subgoal):
 1. inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)
[PROOF STEP]
have rW[simp]: "dim_row ?W = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_of_rows n (map vec_inv vs)) = l
[PROOF STEP]
using l_def
[PROOF STATE]
proof (prove)
using this:
l = length vs

goal (1 subgoal):
 1. dim_row (mat_of_rows n (map vec_inv vs)) = l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (mat_of_rows n (map vec_inv vs)) = l

goal (1 subgoal):
 1. inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)
[PROOF STEP]
have cV[simp]:"dim_col ?V = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (mat_of_cols n vs) = l
[PROOF STEP]
using l_def
[PROOF STATE]
proof (prove)
using this:
l = length vs

goal (1 subgoal):
 1. dim_col (mat_of_cols n vs) = l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_col (mat_of_cols n vs) = l

goal (1 subgoal):
 1. inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)
[PROOF STEP]
have dim: "\<And>i. i < length vs \<Longrightarrow> vs!i \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length vs \<Longrightarrow> vs ! i \<in> carrier_vec n
[PROOF STEP]
using V
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<And>i. i < length vs \<Longrightarrow> vs ! i \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i < length vs \<Longrightarrow> vs ! ?i \<in> carrier_vec n

goal (1 subgoal):
 1. inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)
[PROOF STEP]
unfolding inverts_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows n (map vec_inv vs) * mat_of_cols n vs = 1\<^sub>m (dim_row (mat_of_rows n (map vec_inv vs)))
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m (dim_row (mat_of_rows n (map vec_inv vs)))); j < dim_col (1\<^sub>m (dim_row (mat_of_rows n (map vec_inv vs))))\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = 1\<^sub>m (dim_row (mat_of_rows n (map vec_inv vs))) $$ (i, j)
 2. dim_row (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = dim_row (1\<^sub>m (dim_row (mat_of_rows n (map vec_inv vs))))
 3. dim_col (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = dim_col (1\<^sub>m (dim_row (mat_of_rows n (map vec_inv vs))))
[PROOF STEP]
unfolding mat_of_rows_carrier length_map l_def[symmetric]
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m l); j < dim_col (1\<^sub>m l)\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = 1\<^sub>m l $$ (i, j)
 2. dim_row (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = dim_row (1\<^sub>m l)
 3. dim_col (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = dim_col (1\<^sub>m l)
[PROOF STEP]
unfolding index_one_mat
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < l; j < l\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))
 2. dim_row (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = l
 3. dim_col (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < l; j < l\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))
 2. dim_row (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = l
 3. dim_col (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = l
[PROOF STEP]
show "dim_row (?W * ?V) = l" "dim_col (?W * ?V) = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = l &&& dim_col (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = l
[PROOF STEP]
unfolding times_mat_def rW cV
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat l l (\<lambda>(i, j). row (mat_of_rows n (map vec_inv vs)) i \<bullet> col (mat_of_cols n vs) j)) = l &&& dim_col (mat l l (\<lambda>(i, j). row (mat_of_rows n (map vec_inv vs)) i \<bullet> col (mat_of_cols n vs) j)) = l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = l
dim_col (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) = l

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < l; j < l\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < l; j < l\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
assume i:"i<l" and j: "j<l"
[PROOF STATE]
proof (state)
this:
i < l
j < l

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < l; j < l\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
hence i2: "i<length vs"
      and i3: "i<length (map vec_inv vs)"
      and j2: "j<length vs"
[PROOF STATE]
proof (prove)
using this:
i < l
j < l

goal (1 subgoal):
 1. i < length vs &&& i < length (map vec_inv vs) &&& j < length vs
[PROOF STEP]
using l_def
[PROOF STATE]
proof (prove)
using this:
i < l
j < l
l = length vs

goal (1 subgoal):
 1. i < length vs &&& i < length (map vec_inv vs) &&& j < length vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length vs
i < length (map vec_inv vs)
j < length vs

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < l; j < l\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
hence id2: "vs ! i \<in> carrier_vec n"
      and id3: "map vec_inv vs ! i \<in> carrier_vec n"
      and id4: "conjugate (vs ! i) \<in> carrier_vec n"
      and jd2: "vs ! j \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
i < length vs
i < length (map vec_inv vs)
j < length vs

goal (1 subgoal):
 1. (vs ! i \<in> carrier_vec n &&& map vec_inv vs ! i \<in> carrier_vec n) &&& conjugate (vs ! i) \<in> carrier_vec n &&& vs ! j \<in> carrier_vec n
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
i < length vs
i < length (map vec_inv vs)
j < length vs
?i < length vs \<Longrightarrow> vs ! ?i \<in> carrier_vec n

goal (1 subgoal):
 1. (vs ! i \<in> carrier_vec n &&& map vec_inv vs ! i \<in> carrier_vec n) &&& conjugate (vs ! i) \<in> carrier_vec n &&& vs ! j \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vs ! i \<in> carrier_vec n
map vec_inv vs ! i \<in> carrier_vec n
conjugate (vs ! i) \<in> carrier_vec n
vs ! j \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < l; j < l\<rbrakk> \<Longrightarrow> (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
show "(?W * ?V) $$ (i,j) = (if i = j then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding times_mat_def rW cV
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat l l (\<lambda>(i, j). row (mat_of_rows n (map vec_inv vs)) i \<bullet> col (mat_of_cols n vs) j) $$ (i, j) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding index_mat[OF i j] split
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (mat_of_rows n (map vec_inv vs)) i \<bullet> col (mat_of_cols n vs) j = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding mat_of_rows_row[OF i3 id3]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map vec_inv vs ! i \<bullet> col (mat_of_cols n vs) j = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding col_mat_of_cols[OF j2 jd2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map vec_inv vs ! i \<bullet> vs ! j = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding nth_map[OF i2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_inv (vs ! i) \<bullet> vs ! j = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding vec_inv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1::'a) / (vs ! i \<bullet>c vs ! i) \<cdot>\<^sub>v conjugate (vs ! i)) \<bullet> vs ! j = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding smult_scalar_prod_distrib[OF id4 jd2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) / (vs ! i \<bullet>c vs ! i) * (conjugate (vs ! i) \<bullet> vs ! j) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding comm_scalar_prod[OF id4 jd2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) / (vs ! i \<bullet>c vs ! i) * (vs ! j \<bullet>c vs ! i) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
using corthogonalD[OF orth j2 i2]
[PROOF STATE]
proof (prove)
using this:
(vs ! j \<bullet>c vs ! i = (0::'a)) = (j \<noteq> i)

goal (1 subgoal):
 1. (1::'a) / (vs ! i \<bullet>c vs ! i) * (vs ! j \<bullet>c vs ! i) = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_of_rows n (map vec_inv vs) * mat_of_cols n vs) $$ (i, j) = (if i = j then 1::'a else (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inverts_mat (mat_of_rows n (map vec_inv vs)) (mat_of_cols n vs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_implode_append:
 \<open>nat_implode (a@[b]) = (1*b + foldr (+) (map (\<lambda>(p, y). 10 ^ p * y) (enumerate (Suc 0) (rev a))) 0 )\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_implode (a @ [b]) = (1::'a) * b + foldr (+) (map (\<lambda>(p, y). (10::'a) ^ p * y) (enumerate (Suc 0) (rev a))) (0::'a)
[PROOF STEP]
by(simp add:nat_implode_def)


[STATEMENT]
lemma farkas_minkowsky_weyl_theorem:
  "(\<exists> X. X \<subseteq> carrier_vec n \<and> finite X \<and> P = cone X)
  \<longleftrightarrow> (\<exists> A nr. A \<in> carrier_mat nr n \<and> P = polyhedral_cone A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>X\<subseteq>carrier_vec n. finite X \<and> P = cone X) = (\<exists>A nr. A \<in> carrier_mat nr n \<and> P = polyhedral_cone A)
[PROOF STEP]
using farkas_minkowsky_weyl_theorem_1 farkas_minkowsky_weyl_theorem_2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?X \<subseteq> carrier_vec n; finite ?X\<rbrakk> \<Longrightarrow> \<exists>nr A. A \<in> carrier_mat nr n \<and> cone ?X = polyhedral_cone A \<and> (is_det_bound ?db \<longrightarrow> ?X \<subseteq> \<int>\<^sub>v \<inter> Bounded_vec (of_int ?Bnd) \<longrightarrow> A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int (?db (n - 1) (max 1 ?Bnd))))
?A \<in> carrier_mat ?nr n \<Longrightarrow> \<exists>X\<subseteq>carrier_vec n. finite X \<and> polyhedral_cone ?A = cone X \<and> (is_det_bound ?db \<longrightarrow> ?A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int ?Bnd) \<longrightarrow> X \<subseteq> \<int>\<^sub>v \<inter> Bounded_vec (of_int (?db (n - 1) (max 1 ?Bnd))))

goal (1 subgoal):
 1. (\<exists>X\<subseteq>carrier_vec n. finite X \<and> P = cone X) = (\<exists>A nr. A \<in> carrier_mat nr n \<and> P = polyhedral_cone A)
[PROOF STEP]
by metis


[STATEMENT]
lemma Digamma_approx:
  assumes x: "(x :: real) > 0"
  shows   "Digamma x = ln x - 1 / (2 * x) - P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
have "eventually (\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1/(2*x) - p n x =
          ln (real n) - S' n x - 1/(2*x)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
using eventually_gt_at_top[of "1::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 1) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 1 < n \<Longrightarrow> ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 1 < n \<Longrightarrow> ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
assume n: "n > 1"
[PROOF STATE]
proof (state)
this:
1 < n

goal (1 subgoal):
 1. \<And>n. 1 < n \<Longrightarrow> ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
have "ln (real n) - S' n x = ln ((real n) / (real n + x)) + ln x - p n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real n) - S' n x = ln (real n / (real n + x)) + ln x - p n x
[PROOF STEP]
using assms n
[PROOF STATE]
proof (prove)
using this:
0 < x
1 < n

goal (1 subgoal):
 1. ln (real n) - S' n x = ln (real n / (real n + x)) + ln x - p n x
[PROOF STEP]
unfolding S'_approx
[PROOF STATE]
proof (prove)
using this:
0 < x
1 < n

goal (1 subgoal):
 1. ln (real n) - (ln (real n + x) - ln x + p n x) = ln (real n / (real n + x)) + ln x - p n x
[PROOF STEP]
by (subst ln_div) (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
ln (real n) - S' n x = ln (real n / (real n + x)) + ln x - p n x

goal (1 subgoal):
 1. \<And>n. 1 < n \<Longrightarrow> ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real n) - S' n x = ln (real n / (real n + x)) + ln x - p n x

goal (1 subgoal):
 1. \<And>n. 1 < n \<Longrightarrow> ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
1 < n
[PROOF STEP]
have "real n / (real n + x) = inverse (1 + x / real n)"
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. real n / (real n + x) = inverse (1 + x / real n)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
real n / (real n + x) = inverse (1 + x / real n)

goal (1 subgoal):
 1. \<And>n. 1 < n \<Longrightarrow> ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (real n) - S' n x = ln (inverse (1 + x / real n)) + ln x - p n x
[PROOF STEP]
show "ln (inverse (1 + x / real n)) + ln x - 1/(2*x) - p n x =
                    ln (real n) - S' n x - 1/(2*x)"
[PROOF STATE]
proof (prove)
using this:
ln (real n) - S' n x = ln (inverse (1 + x / real n)) + ln x - p n x

goal (1 subgoal):
 1. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)

goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)

goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
have "(\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1/(2*x) - p n x)
                   \<longlonglongrightarrow> ln (inverse (1 + 0)) + ln x - 1/(2*x) - P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x) \<longlonglongrightarrow> ln (inverse (1 + 0)) + ln x - 1 / (2 * x) - P x
[PROOF STEP]
by (rule tendsto_intros p_LIMSEQ x real_tendsto_divide_at_top
          filterlim_real_sequentially | simp)+
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x) \<longlonglongrightarrow> ln (inverse (1 + 0)) + ln x - 1 / (2 * x) - P x

goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
hence "(\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1/(2*x) - p n x)
             \<longlonglongrightarrow> ln x - 1/(2*x) - P x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x) \<longlonglongrightarrow> ln (inverse (1 + 0)) + ln x - 1 / (2 * x) - P x

goal (1 subgoal):
 1. (\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x

goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
(\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x
[PROOF STEP]
have "(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> ln x - 1/(2*x) - P x"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x = ln (real n) - S' n x - 1 / (2 * x)
(\<lambda>n. ln (inverse (1 + x / real n)) + ln x - 1 / (2 * x) - p n x) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x
[PROOF STEP]
by (blast intro: Lim_transform_eventually)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x

goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x

goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have "(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x"
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
by (intro S'_LIMSEQ_Digamma) simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x

goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
show "Digamma x = ln x - 1 / (2 * x) - P x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> ln x - 1 / (2 * x) - P x
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x

goal (1 subgoal):
 1. Digamma x = ln x - 1 / (2 * x) - P x
[PROOF STEP]
by (rule LIMSEQ_unique [rotated])
[PROOF STATE]
proof (state)
this:
Digamma x = ln x - 1 / (2 * x) - P x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma graph_max_final_ex:
 "\<exists>f\<in>set (finals (graph n)). |vertices f| = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f\<in>set (finals (graph n)). |vertices f| = n
[PROOF STEP]
proof (induct "n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>f\<in>set (finals (graph 0)). |vertices f| = 0
 2. \<And>n. \<exists>f\<in>set (finals (graph n)). |vertices f| = n \<Longrightarrow> \<exists>f\<in>set (finals (graph (Suc n))). |vertices f| = Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<exists>f\<in>set (finals (graph 0)). |vertices f| = 0
 2. \<And>n. \<exists>f\<in>set (finals (graph n)). |vertices f| = n \<Longrightarrow> \<exists>f\<in>set (finals (graph (Suc n))). |vertices f| = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f\<in>set (finals (graph 0)). |vertices f| = 0
[PROOF STEP]
by (simp add: graph_def finals_def)
[PROOF STATE]
proof (state)
this:
\<exists>f\<in>set (finals (graph 0)). |vertices f| = 0

goal (1 subgoal):
 1. \<And>n. \<exists>f\<in>set (finals (graph n)). |vertices f| = n \<Longrightarrow> \<exists>f\<in>set (finals (graph (Suc n))). |vertices f| = Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<exists>f\<in>set (finals (graph n)). |vertices f| = n \<Longrightarrow> \<exists>f\<in>set (finals (graph (Suc n))). |vertices f| = Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<exists>f\<in>set (finals (graph n)). |vertices f| = n

goal (1 subgoal):
 1. \<And>n. \<exists>f\<in>set (finals (graph n)). |vertices f| = n \<Longrightarrow> \<exists>f\<in>set (finals (graph (Suc n))). |vertices f| = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>f\<in>set (finals (graph n)). |vertices f| = n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<exists>f\<in>set (finals (graph n)). |vertices f| = n

goal (1 subgoal):
 1. \<exists>f\<in>set (finals (graph (Suc n))). |vertices f| = Suc n
[PROOF STEP]
by (simp add: graph_def finals_def)
[PROOF STATE]
proof (state)
this:
\<exists>f\<in>set (finals (graph (Suc n))). |vertices f| = Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma winding_number_unique:
  assumes \<gamma>: "path \<gamma>" "z \<notin> path_image \<gamma>"
      and pi: "\<And>e. e>0 \<Longrightarrow> \<exists>p. winding_number_prop \<gamma> z e p n"
   shows "winding_number \<gamma> z = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
have "path_image \<gamma> \<subseteq> UNIV - {z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image \<gamma> \<subseteq> UNIV - {z}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path \<gamma>
z \<notin> path_image \<gamma>
0 < ?e \<Longrightarrow> \<exists>p. winding_number_prop \<gamma> z ?e p n

goal (1 subgoal):
 1. path_image \<gamma> \<subseteq> UNIV - {z}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
path_image \<gamma> \<subseteq> UNIV - {z}

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path_image \<gamma> \<subseteq> UNIV - {z}
[PROOF STEP]
obtain e
    where e: "e>0"
      and pi_eq: "\<And>h1 h2 f. \<lbrakk>valid_path h1; valid_path h2;
                    (\<forall>t\<in>{0..1}. cmod (h1 t - \<gamma> t) < e \<and> cmod (h2 t - \<gamma> t) < e);
                    pathstart h2 = pathstart h1; pathfinish h2 = pathfinish h1; f holomorphic_on UNIV - {z}\<rbrakk> \<Longrightarrow>
                    contour_integral h2 f = contour_integral h1 f"
[PROOF STATE]
proof (prove)
using this:
path_image \<gamma> \<subseteq> UNIV - {z}

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; \<And>h1 h2 f. \<lbrakk>valid_path h1; valid_path h2; \<forall>t\<in>{0..1}. cmod (h1 t - \<gamma> t) < e \<and> cmod (h2 t - \<gamma> t) < e; pathstart h2 = pathstart h1; pathfinish h2 = pathfinish h1; f holomorphic_on UNIV - {z}\<rbrakk> \<Longrightarrow> contour_integral h2 f = contour_integral h1 f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using contour_integral_nearby_ends [of "UNIV - {z}" \<gamma>] assms
[PROOF STATE]
proof (prove)
using this:
path_image \<gamma> \<subseteq> UNIV - {z}
\<lbrakk>open (UNIV - {z}); path \<gamma>; path_image \<gamma> \<subseteq> UNIV - {z}\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - \<gamma> t) < d \<and> cmod (h t - \<gamma> t) < d) \<and> pathstart h = pathstart g \<and> pathfinish h = pathfinish g \<longrightarrow> path_image g \<subseteq> UNIV - {z} \<and> path_image h \<subseteq> UNIV - {z} \<and> (\<forall>f. f holomorphic_on UNIV - {z} \<longrightarrow> contour_integral h f = contour_integral g f)
path \<gamma>
z \<notin> path_image \<gamma>
0 < ?e \<Longrightarrow> \<exists>p. winding_number_prop \<gamma> z ?e p n

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; \<And>h1 h2 f. \<lbrakk>valid_path h1; valid_path h2; \<forall>t\<in>{0..1}. cmod (h1 t - \<gamma> t) < e \<and> cmod (h2 t - \<gamma> t) < e; pathstart h2 = pathstart h1; pathfinish h2 = pathfinish h1; f holomorphic_on UNIV - {z}\<rbrakk> \<Longrightarrow> contour_integral h2 f = contour_integral h1 f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: open_delete)
[PROOF STATE]
proof (state)
this:
0 < e
\<lbrakk>valid_path ?h1.0; valid_path ?h2.0; \<forall>t\<in>{0..1}. cmod (?h1.0 t - \<gamma> t) < e \<and> cmod (?h2.0 t - \<gamma> t) < e; pathstart ?h2.0 = pathstart ?h1.0; pathfinish ?h2.0 = pathfinish ?h1.0; ?f holomorphic_on UNIV - {z}\<rbrakk> \<Longrightarrow> contour_integral ?h2.0 ?f = contour_integral ?h1.0 ?f

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
obtain p where p: "winding_number_prop \<gamma> z e p n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. winding_number_prop \<gamma> z e p n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using pi [OF e]
[PROOF STATE]
proof (prove)
using this:
\<exists>p. winding_number_prop \<gamma> z e p n

goal (1 subgoal):
 1. (\<And>p. winding_number_prop \<gamma> z e p n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
winding_number_prop \<gamma> z e p n

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
obtain q where q: "winding_number_prop \<gamma> z e q (winding_number \<gamma> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>q. winding_number_prop \<gamma> z e q (winding_number \<gamma> z) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using winding_number [OF \<gamma> e]
[PROOF STATE]
proof (prove)
using this:
\<exists>p. winding_number_prop \<gamma> z e p (winding_number \<gamma> z)

goal (1 subgoal):
 1. (\<And>q. winding_number_prop \<gamma> z e q (winding_number \<gamma> z) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
winding_number_prop \<gamma> z e q (winding_number \<gamma> z)

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
have "2 * complex_of_real pi * \<i> * n = contour_integral p (\<lambda>w. 1 / (w - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * complex_of_real pi * \<i> * n = contour_integral p (\<lambda>w. 1 / (w - z))
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
winding_number_prop \<gamma> z e p n

goal (1 subgoal):
 1. 2 * complex_of_real pi * \<i> * n = contour_integral p (\<lambda>w. 1 / (w - z))
[PROOF STEP]
by (auto simp: winding_number_prop_def)
[PROOF STATE]
proof (state)
this:
2 * complex_of_real pi * \<i> * n = contour_integral p (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * complex_of_real pi * \<i> * n = contour_integral p (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
have "\<dots> = contour_integral q (\<lambda>w. 1 / (w - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral p (\<lambda>w. 1 / (w - z)) = contour_integral q (\<lambda>w. 1 / (w - z))
[PROOF STEP]
proof (rule pi_eq)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. valid_path q
 2. valid_path p
 3. \<forall>t\<in>{0..1}. cmod (q t - \<gamma> t) < e \<and> cmod (p t - \<gamma> t) < e
 4. pathstart p = pathstart q
 5. pathfinish p = pathfinish q
 6. (\<lambda>w. 1 / (w - z)) holomorphic_on UNIV - {z}
[PROOF STEP]
show "(\<lambda>w. 1 / (w - z)) holomorphic_on UNIV - {z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. 1 / (w - z)) holomorphic_on UNIV - {z}
[PROOF STEP]
by (auto intro!: holomorphic_intros)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. 1 / (w - z)) holomorphic_on UNIV - {z}

goal (5 subgoals):
 1. valid_path q
 2. valid_path p
 3. \<forall>t\<in>{0..1}. cmod (q t - \<gamma> t) < e \<and> cmod (p t - \<gamma> t) < e
 4. pathstart p = pathstart q
 5. pathfinish p = pathfinish q
[PROOF STEP]
qed (use p q in \<open>auto simp: winding_number_prop_def norm_minus_commute\<close>)
[PROOF STATE]
proof (state)
this:
contour_integral p (\<lambda>w. 1 / (w - z)) = contour_integral q (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
contour_integral p (\<lambda>w. 1 / (w - z)) = contour_integral q (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
have "\<dots> = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral q (\<lambda>w. 1 / (w - z)) = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z
[PROOF STEP]
using q
[PROOF STATE]
proof (prove)
using this:
winding_number_prop \<gamma> z e q (winding_number \<gamma> z)

goal (1 subgoal):
 1. contour_integral q (\<lambda>w. 1 / (w - z)) = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z
[PROOF STEP]
by (auto simp: winding_number_prop_def)
[PROOF STATE]
proof (state)
this:
contour_integral q (\<lambda>w. 1 / (w - z)) = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * complex_of_real pi * \<i> * n = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z
[PROOF STEP]
have "2 * complex_of_real pi * \<i> * n = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
using this:
2 * complex_of_real pi * \<i> * n = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. 2 * complex_of_real pi * \<i> * n = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 * complex_of_real pi * \<i> * n = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * complex_of_real pi * \<i> * n = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * complex_of_real pi * \<i> * n = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. winding_number \<gamma> z = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
winding_number \<gamma> z = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Diff1_foldSetD:
  "\<lbrakk>(A - {x}, y) \<in> foldSetD D f e; x \<in> A; f x y \<in> D\<rbrakk> \<Longrightarrow>
   (A, f x y) \<in> foldSetD D f e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(A - {x}, y) \<in> foldSetD D f e; x \<in> A; f x y \<in> D\<rbrakk> \<Longrightarrow> (A, f x y) \<in> foldSetD D f e
[PROOF STEP]
by (metis Diff_insert_absorb foldSetD.insertI mk_disjoint_insert)


[STATEMENT]
lemma DERIV_neg_imp_decreasing_open:
  fixes a b :: real
    and f :: "real \<Rightarrow> real"
  assumes "a < b"
    and "\<And>x. a < x \<Longrightarrow> x < b \<Longrightarrow> \<exists>y. DERIV f x :> y \<and> y < 0"
    and con: "continuous_on {a..b} f"
  shows "f a > f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
have "(\<lambda>x. -f x) a < (\<lambda>x. -f x) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - f a < - f b
[PROOF STEP]
proof (rule DERIV_pos_imp_increasing_open [of a b])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. a < b
 2. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>a. - f a) has_real_derivative y) (at x) \<and> 0 < y
 3. continuous_on {a..b} (\<lambda>a. - f a)
[PROOF STEP]
show "\<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. - f x) has_real_derivative y) (at x) \<and> 0 < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. - f x) has_real_derivative y) (at x) \<and> 0 < y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b
\<lbrakk>a < ?x; ?x < b\<rbrakk> \<Longrightarrow> \<exists>y. (f has_real_derivative y) (at ?x) \<and> y < 0
continuous_on {a..b} f

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. - f x) has_real_derivative y) (at x) \<and> 0 < y
[PROOF STEP]
by simp (metis field_differentiable_minus neg_0_less_iff_less)
[PROOF STATE]
proof (state)
this:
\<lbrakk>a < ?x; ?x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. - f x) has_real_derivative y) (at ?x) \<and> 0 < y

goal (2 subgoals):
 1. a < b
 2. continuous_on {a..b} (\<lambda>a. - f a)
[PROOF STEP]
show "continuous_on {a..b} (\<lambda>x. - f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. - f x)
[PROOF STEP]
using con continuous_on_minus
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} f
continuous_on ?s ?f \<Longrightarrow> continuous_on ?s (\<lambda>x. - ?f x)

goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. - f x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. - f x)

goal (1 subgoal):
 1. a < b
[PROOF STEP]
qed (use assms in auto)
[PROOF STATE]
proof (state)
this:
- f a < - f b

goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- f a < - f b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
- f a < - f b

goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f b < f a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma star_mon [intro]: "x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
assume "x \<le> y"
[PROOF STATE]
proof (state)
this:
x \<le> y

goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
hence "x \<le> y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
x \<le> y

goal (1 subgoal):
 1. x \<le> y\<^sup>\<star>
[PROOF STEP]
by (meson local.dual_order.trans local.join.le_supE local.star_rtc1)
[PROOF STATE]
proof (state)
this:
x \<le> y\<^sup>\<star>

goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
hence "1 + x + y\<^sup>\<star> \<cdot> y\<^sup>\<star> \<le> y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
x \<le> y\<^sup>\<star>

goal (1 subgoal):
 1. (1::'a) + x + y\<^sup>\<star> \<cdot> y\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
using local.star_rtc1
[PROOF STATE]
proof (prove)
using this:
x \<le> y\<^sup>\<star>
(1::'a) + ?x\<^sup>\<star> \<cdot> ?x\<^sup>\<star> + ?x \<le> ?x\<^sup>\<star>

goal (1 subgoal):
 1. (1::'a) + x + y\<^sup>\<star> \<cdot> y\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1::'a) + x + y\<^sup>\<star> \<cdot> y\<^sup>\<star> \<le> y\<^sup>\<star>

goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
thus "x\<^sup>\<star> \<le> y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
(1::'a) + x + y\<^sup>\<star> \<cdot> y\<^sup>\<star> \<le> y\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
by (simp add: local.star_rtc2)
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> \<le> y\<^sup>\<star>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma psi_odd_mono: "m \<le> n \<Longrightarrow> psi_odd m \<le> psi_odd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> psi_odd m \<le> psi_odd n
[PROOF STEP]
using mangoldt_odd_pos sum_mono2[of "{1..n}" "{1..m}" "mangoldt_odd"]
[PROOF STATE]
proof (prove)
using this:
0 \<le> mangoldt_odd ?d
\<lbrakk>finite {1..n}; {1..m} \<subseteq> {1..n}; \<And>b. b \<in> {1..n} - {1..m} \<Longrightarrow> 0 \<le> mangoldt_odd b\<rbrakk> \<Longrightarrow> sum mangoldt_odd {1..m} \<le> sum mangoldt_odd {1..n}

goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> psi_odd m \<le> psi_odd n
[PROOF STEP]
by (simp add: psi_odd_def)


[STATEMENT]
lemma incratseq_0_less [simp]: "of_rat(incratseq x 0) < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (incratseq x 0) < x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_rat (incratseq x 0) < x
[PROOF STEP]
have "x - 1 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - 1 < x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x - 1 < x

goal (1 subgoal):
 1. real_of_rat (incratseq x 0) < x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - 1 < x
[PROOF STEP]
have "\<exists>q. x - 1 < real_of_rat q \<and> real_of_rat q < x"
[PROOF STATE]
proof (prove)
using this:
x - 1 < x

goal (1 subgoal):
 1. \<exists>q. x - 1 < real_of_rat q \<and> real_of_rat q < x
[PROOF STEP]
using of_rat_dense
[PROOF STATE]
proof (prove)
using this:
x - 1 < x
?x < ?y \<Longrightarrow> \<exists>q. ?x < real_of_rat q \<and> real_of_rat q < ?y

goal (1 subgoal):
 1. \<exists>q. x - 1 < real_of_rat q \<and> real_of_rat q < x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>q. x - 1 < real_of_rat q \<and> real_of_rat q < x

goal (1 subgoal):
 1. real_of_rat (incratseq x 0) < x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>q. x - 1 < real_of_rat q \<and> real_of_rat q < x
[PROOF STEP]
obtain q where " x - 1 < real_of_rat q \<and> real_of_rat q < x"
[PROOF STATE]
proof (prove)
using this:
\<exists>q. x - 1 < real_of_rat q \<and> real_of_rat q < x

goal (1 subgoal):
 1. (\<And>q. x - 1 < real_of_rat q \<and> real_of_rat q < x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x - 1 < real_of_rat q \<and> real_of_rat q < x

goal (1 subgoal):
 1. real_of_rat (incratseq x 0) < x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - 1 < real_of_rat q \<and> real_of_rat q < x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x - 1 < real_of_rat q \<and> real_of_rat q < x

goal (1 subgoal):
 1. real_of_rat (incratseq x 0) < x
[PROOF STEP]
by (auto intro: someI2)
[PROOF STATE]
proof (state)
this:
real_of_rat (incratseq x 0) < x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tau_om_nu:
assumes  "\<And>x y z. x \<cdot> (d y \<cdot> z) = (x \<cdot> d y ) \<cdot> z"
shows "\<tau> ((\<nu> x)\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>
[PROOF STEP]
have "\<tau> ((\<nu> x)\<^sup>\<omega>) = \<tau> (\<nabla> (\<nu> x) \<cdot> U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau> (\<nu> x\<^sup>\<omega>) = \<tau> (\<nabla> (\<nu> x) \<cdot> U)
[PROOF STEP]
by (metis assms nabla_omega_U)
[PROOF STATE]
proof (state)
this:
\<tau> (\<nu> x\<^sup>\<omega>) = \<tau> (\<nabla> (\<nu> x) \<cdot> U)

goal (1 subgoal):
 1. \<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<tau> (\<nu> x\<^sup>\<omega>) = \<tau> (\<nabla> (\<nu> x) \<cdot> U)

goal (1 subgoal):
 1. \<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>
[PROOF STEP]
have "... = \<nabla> (\<nu> x) \<cdot> \<tau> U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau> (\<nabla> (\<nu> x) \<cdot> U) = \<nabla> (\<nu> x) \<cdot> \<tau> U
[PROOF STEP]
using local.tau_s_prod
[PROOF STATE]
proof (prove)
using this:
\<tau> (?x \<cdot> ?y) = ?x \<cdot> \<tau> ?y

goal (1 subgoal):
 1. \<tau> (\<nabla> (\<nu> x) \<cdot> U) = \<nabla> (\<nu> x) \<cdot> \<tau> U
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<tau> (\<nabla> (\<nu> x) \<cdot> U) = \<nabla> (\<nu> x) \<cdot> \<tau> U

goal (1 subgoal):
 1. \<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> \<tau> U
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> \<tau> U

goal (1 subgoal):
 1. \<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>
[PROOF STEP]
using local.tau_U
[PROOF STATE]
proof (prove)
using this:
\<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> \<tau> U
\<tau> U = 1\<^sub>\<pi>

goal (1 subgoal):
 1. \<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<tau> (\<nu> x\<^sup>\<omega>) = \<nabla> (\<nu> x) \<cdot> 1\<^sub>\<pi>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subspace_sum: "subspace A \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> f x \<in> A) \<Longrightarrow> sum f B \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subspace A; \<And>x. x \<in> B \<Longrightarrow> f x \<in> A\<rbrakk> \<Longrightarrow> sum f B \<in> A
[PROOF STEP]
by (induct B rule: infinite_finite_induct) (auto simp add: subspace_add subspace_0)


[STATEMENT]
lemma suminf_ereal:
  assumes "\<And>i. 0 \<le> f i"
    and "(\<Sum>i. ereal (f i)) \<noteq> \<infinity>"
  shows "(\<Sum>i. ereal (f i)) = ereal (suminf f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. ereal (f i)) = ereal (suminf f)
[PROOF STEP]
proof (rule sums_unique[symmetric])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>i. ereal (f i)) sums ereal (suminf f)
[PROOF STEP]
from summable_ereal[OF assms]
[PROOF STATE]
proof (chain)
picking this:
summable f
[PROOF STEP]
show "(\<lambda>x. ereal (f x)) sums (ereal (suminf f))"
[PROOF STATE]
proof (prove)
using this:
summable f

goal (1 subgoal):
 1. (\<lambda>x. ereal (f x)) sums ereal (suminf f)
[PROOF STEP]
unfolding sums_ereal
[PROOF STATE]
proof (prove)
using this:
summable f

goal (1 subgoal):
 1. f sums suminf f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
summable f
0 \<le> f ?i
(\<Sum>i. ereal (f i)) \<noteq> \<infinity>

goal (1 subgoal):
 1. f sums suminf f
[PROOF STEP]
by (intro summable_sums summable_ereal)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ereal (f x)) sums ereal (suminf f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma limited_family_union: "finite B \<Longrightarrow> \<forall>P\<in>B. card P \<le> k \<Longrightarrow> card (\<Union>B) \<le> card B * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite B; \<forall>P\<in>B. card P \<le> k\<rbrakk> \<Longrightarrow> card (\<Union> B) \<le> card B * k
[PROOF STEP]
proof (induction B rule:finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>P\<in>{}. card P \<le> k \<Longrightarrow> card (\<Union> {}) \<le> card {} * k
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>P\<in>F. card P \<le> k \<Longrightarrow> card (\<Union> F) \<le> card F * k; \<forall>P\<in>insert x F. card P \<le> k\<rbrakk> \<Longrightarrow> card (\<Union> (insert x F)) \<le> card (insert x F) * k
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
\<forall>P\<in>{}. card P \<le> k

goal (2 subgoals):
 1. \<forall>P\<in>{}. card P \<le> k \<Longrightarrow> card (\<Union> {}) \<le> card {} * k
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>P\<in>F. card P \<le> k \<Longrightarrow> card (\<Union> F) \<le> card F * k; \<forall>P\<in>insert x F. card P \<le> k\<rbrakk> \<Longrightarrow> card (\<Union> (insert x F)) \<le> card (insert x F) * k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>P\<in>{}. card P \<le> k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>P\<in>{}. card P \<le> k

goal (1 subgoal):
 1. card (\<Union> {}) \<le> card {} * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (\<Union> {}) \<le> card {} * k

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>P\<in>F. card P \<le> k \<Longrightarrow> card (\<Union> F) \<le> card F * k; \<forall>P\<in>insert x F. card P \<le> k\<rbrakk> \<Longrightarrow> card (\<Union> (insert x F)) \<le> card (insert x F) * k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>P\<in>F. card P \<le> k \<Longrightarrow> card (\<Union> F) \<le> card F * k; \<forall>P\<in>insert x F. card P \<le> k\<rbrakk> \<Longrightarrow> card (\<Union> (insert x F)) \<le> card (insert x F) * k
[PROOF STEP]
case (insert P B)
[PROOF STATE]
proof (state)
this:
finite B
P \<notin> B
\<forall>P\<in>B. card P \<le> k \<Longrightarrow> card (\<Union> B) \<le> card B * k
\<forall>P\<in>insert P B. card P \<le> k

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>P\<in>F. card P \<le> k \<Longrightarrow> card (\<Union> F) \<le> card F * k; \<forall>P\<in>insert x F. card P \<le> k\<rbrakk> \<Longrightarrow> card (\<Union> (insert x F)) \<le> card (insert x F) * k
[PROOF STEP]
have "card (\<Union>(insert P B)) \<le> card P + card (\<Union>B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union> (insert P B)) \<le> card P + card (\<Union> B)
[PROOF STEP]
by (simp add: card_Un_le)
[PROOF STATE]
proof (state)
this:
card (\<Union> (insert P B)) \<le> card P + card (\<Union> B)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>P\<in>F. card P \<le> k \<Longrightarrow> card (\<Union> F) \<le> card F * k; \<forall>P\<in>insert x F. card P \<le> k\<rbrakk> \<Longrightarrow> card (\<Union> (insert x F)) \<le> card (insert x F) * k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (\<Union> (insert P B)) \<le> card P + card (\<Union> B)
[PROOF STEP]
have "card (\<Union>(insert P B)) \<le> card P + card B * k"
[PROOF STATE]
proof (prove)
using this:
card (\<Union> (insert P B)) \<le> card P + card (\<Union> B)

goal (1 subgoal):
 1. card (\<Union> (insert P B)) \<le> card P + card B * k
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
card (\<Union> (insert P B)) \<le> card P + card (\<Union> B)
finite B
P \<notin> B
\<forall>P\<in>B. card P \<le> k \<Longrightarrow> card (\<Union> B) \<le> card B * k
\<forall>P\<in>insert P B. card P \<le> k

goal (1 subgoal):
 1. card (\<Union> (insert P B)) \<le> card P + card B * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (\<Union> (insert P B)) \<le> card P + card B * k

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>P\<in>F. card P \<le> k \<Longrightarrow> card (\<Union> F) \<le> card F * k; \<forall>P\<in>insert x F. card P \<le> k\<rbrakk> \<Longrightarrow> card (\<Union> (insert x F)) \<le> card (insert x F) * k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (\<Union> (insert P B)) \<le> card P + card B * k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (\<Union> (insert P B)) \<le> card P + card B * k

goal (1 subgoal):
 1. card (\<Union> (insert P B)) \<le> card (insert P B) * k
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
card (\<Union> (insert P B)) \<le> card P + card B * k
finite B
P \<notin> B
\<forall>P\<in>B. card P \<le> k \<Longrightarrow> card (\<Union> B) \<le> card B * k
\<forall>P\<in>insert P B. card P \<le> k

goal (1 subgoal):
 1. card (\<Union> (insert P B)) \<le> card (insert P B) * k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (\<Union> (insert P B)) \<le> card (insert P B) * k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_mult_eq_left_unit:
  fixes p q :: "'a :: comm_semiring_1 poly"
  assumes unit: "lead_coeff p dvd 1" and q0: "q \<noteq> 0"
  shows "degree (p * q) = degree p + degree q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p * q) = degree p + degree q
[PROOF STEP]
proof(intro degree_mult_eq2 notI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lead_coeff p * lead_coeff q = (0::'a) \<Longrightarrow> False
[PROOF STEP]
from unit
[PROOF STATE]
proof (chain)
picking this:
lead_coeff p dvd (1::'a)
[PROOF STEP]
obtain c where "lead_coeff p * c = 1"
[PROOF STATE]
proof (prove)
using this:
lead_coeff p dvd (1::'a)

goal (1 subgoal):
 1. (\<And>c. lead_coeff p * c = (1::'a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim dvdE,auto)
[PROOF STATE]
proof (state)
this:
lead_coeff p * c = (1::'a)

goal (1 subgoal):
 1. lead_coeff p * lead_coeff q = (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
lead_coeff p * c = (1::'a)
[PROOF STEP]
have "c * lead_coeff p = 1"
[PROOF STATE]
proof (prove)
using this:
lead_coeff p * c = (1::'a)

goal (1 subgoal):
 1. c * lead_coeff p = (1::'a)
[PROOF STEP]
by (auto simp: ac_simps)
[PROOF STATE]
proof (state)
this:
c * lead_coeff p = (1::'a)

goal (1 subgoal):
 1. lead_coeff p * lead_coeff q = (0::'a) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c * lead_coeff p = (1::'a)

goal (1 subgoal):
 1. lead_coeff p * lead_coeff q = (0::'a) \<Longrightarrow> False
[PROOF STEP]
assume "lead_coeff p * lead_coeff q = 0"
[PROOF STATE]
proof (state)
this:
lead_coeff p * lead_coeff q = (0::'a)

goal (1 subgoal):
 1. lead_coeff p * lead_coeff q = (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
lead_coeff p * lead_coeff q = (0::'a)
[PROOF STEP]
have "c * lead_coeff p * lead_coeff q = 0"
[PROOF STATE]
proof (prove)
using this:
lead_coeff p * lead_coeff q = (0::'a)

goal (1 subgoal):
 1. c * lead_coeff p * lead_coeff q = (0::'a)
[PROOF STEP]
by (auto simp: ac_simps)
[PROOF STATE]
proof (state)
this:
c * lead_coeff p * lead_coeff q = (0::'a)

goal (1 subgoal):
 1. lead_coeff p * lead_coeff q = (0::'a) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
c * lead_coeff p = (1::'a)
c * lead_coeff p * lead_coeff q = (0::'a)
[PROOF STEP]
have "lead_coeff q = 0"
[PROOF STATE]
proof (prove)
using this:
c * lead_coeff p = (1::'a)
c * lead_coeff p * lead_coeff q = (0::'a)

goal (1 subgoal):
 1. lead_coeff q = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lead_coeff q = (0::'a)

goal (1 subgoal):
 1. lead_coeff p * lead_coeff q = (0::'a) \<Longrightarrow> False
[PROOF STEP]
with q0
[PROOF STATE]
proof (chain)
picking this:
q \<noteq> 0
lead_coeff q = (0::'a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0
lead_coeff q = (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mangoldt_sum:
  assumes "n \<noteq> 0"
  shows   "(\<Sum>d | d dvd n. mangoldt d :: 'a :: real_algebra_1) = of_real (ln (real n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "(\<Sum>d | d dvd n. mangoldt d :: 'a) = of_real (\<Sum>d | d dvd n. mangoldt d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (\<Sum>d | d dvd n. mangoldt d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. mangoldt d) = of_real (\<Sum>d | d dvd n. mangoldt d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. mangoldt d) = of_real (\<Sum>d | d dvd n. mangoldt d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "(\<Sum>d | d dvd n. mangoldt d) = (\<Sum>d \<in> primepow_factors n. ln (real (aprimedivisor d)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = (\<Sum>d\<in>primepow_factors n. ln (real (aprimedivisor d)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = (\<Sum>d\<in>primepow_factors n. ln (real (aprimedivisor d)))
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) (auto simp: primepow_factors_def mangoldt_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. mangoldt d) = (\<Sum>d\<in>primepow_factors n. ln (real (aprimedivisor d)))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. mangoldt d) = (\<Sum>d\<in>primepow_factors n. ln (real (aprimedivisor d)))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "\<dots> = ln (real (\<Prod>d \<in> primepow_factors n. aprimedivisor d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>primepow_factors n. ln (real (aprimedivisor d))) = ln (real (prod aprimedivisor (primepow_factors n)))
[PROOF STEP]
using assms finite_primepow_factors[of n]
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
n \<noteq> 0 \<Longrightarrow> finite (primepow_factors n)

goal (1 subgoal):
 1. (\<Sum>d\<in>primepow_factors n. ln (real (aprimedivisor d))) = ln (real (prod aprimedivisor (primepow_factors n)))
[PROOF STEP]
by (subst ln_prod [symmetric])
       (auto simp: primepow_factors_def intro!: aprimedivisor_pos_nat
             intro: Nat.gr0I primepow_gt_Suc_0)
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>primepow_factors n. ln (real (aprimedivisor d))) = ln (real (prod aprimedivisor (primepow_factors n)))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>primepow_factors n. ln (real (aprimedivisor d))) = ln (real (prod aprimedivisor (primepow_factors n)))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "primepow_factors n =
               (\<lambda>(p,k). p ^ k) ` (SIGMA p:prime_factors n. {0<..multiplicity p n})"
    (is "_ = _ ` ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primepow_factors n = (\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors n. {0<..multiplicity p n})
[PROOF STEP]
by (subst primepow_factors_altdef[OF assms]) fast+
[PROOF STATE]
proof (state)
this:
primepow_factors n = (\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors n. {0<..multiplicity p n})

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
primepow_factors n = (\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors n. {0<..multiplicity p n})

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "prod aprimedivisor \<dots> = (\<Prod>(p,k)\<in>?A. aprimedivisor (p ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod aprimedivisor ((\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors n. {0<..multiplicity p n})) = (\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). aprimedivisor (p ^ k))
[PROOF STEP]
by (subst prod.reindex)
       (auto simp: inj_on_def prime_power_inj'' prime_factors_multiplicity
                   prod.Sigma [symmetric] case_prod_unfold)
[PROOF STATE]
proof (state)
this:
prod aprimedivisor ((\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors n. {0<..multiplicity p n})) = (\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). aprimedivisor (p ^ k))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod aprimedivisor ((\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors n. {0<..multiplicity p n})) = (\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). aprimedivisor (p ^ k))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "\<dots> = (\<Prod>(p,k)\<in>?A. p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). aprimedivisor (p ^ k)) = (\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). p)
[PROOF STEP]
by (intro prod.cong refl) (auto simp: aprimedivisor_prime_power prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
(\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). aprimedivisor (p ^ k)) = (\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). p)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). aprimedivisor (p ^ k)) = (\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). p)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "\<dots> = (\<Prod>x\<in>prime_factors n. \<Prod>k\<in>{0<..multiplicity x n}. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). p) = (\<Prod>x\<in>prime_factors n. \<Prod>k\<in>{0<..multiplicity x n}. x)
[PROOF STEP]
by (rule prod.Sigma [symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). p) = (\<Prod>x\<in>prime_factors n. \<Prod>k\<in>{0<..multiplicity x n}. x)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>(p, k)\<in>(SIGMA p:prime_factors n. {0<..multiplicity p n}). p) = (\<Prod>x\<in>prime_factors n. \<Prod>k\<in>{0<..multiplicity x n}. x)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "\<dots> = (\<Prod>x\<in>prime_factors n. x ^ multiplicity x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>prime_factors n. \<Prod>k\<in>{0<..multiplicity x n}. x) = (\<Prod>x\<in>prime_factors n. x ^ multiplicity x n)
[PROOF STEP]
by (intro prod.cong refl) (simp add: prod_constant)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>prime_factors n. \<Prod>k\<in>{0<..multiplicity x n}. x) = (\<Prod>x\<in>prime_factors n. x ^ multiplicity x n)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>prime_factors n. \<Prod>k\<in>{0<..multiplicity x n}. x) = (\<Prod>x\<in>prime_factors n. x ^ multiplicity x n)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
have "\<dots> = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>prime_factors n. x ^ multiplicity x n) = n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (\<Prod>x\<in>prime_factors n. x ^ multiplicity x n) = n
[PROOF STEP]
by (intro prime_factorization_nat [symmetric]) simp
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>prime_factors n. x ^ multiplicity x n) = n

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. mangoldt d) = of_real (ln (real n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma identities: "k = root 4 m" "l = root 8 m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real k = root 4 (real m) &&& real l = root 8 (real m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. real k = root 4 (real m)
 2. real l = root 8 (real m)
[PROOF STEP]
let ?r = real
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. real k = root 4 (real m)
 2. real l = root 8 (real m)
[PROOF STEP]
have "?r k ^ 4 = ?r m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real k ^ 4 = real m
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real k ^ 4 = real (k ^ 4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real k ^ 4 = real m

goal (2 subgoals):
 1. real k = root 4 (real m)
 2. real l = root 8 (real m)
[PROOF STEP]
from arg_cong[OF this, of "root 4"]
[PROOF STATE]
proof (chain)
picking this:
root 4 (real k ^ 4) = root 4 (real m)
[PROOF STEP]
show km_id: "k = root 4 m"
[PROOF STATE]
proof (prove)
using this:
root 4 (real k ^ 4) = root 4 (real m)

goal (1 subgoal):
 1. real k = root 4 (real m)
[PROOF STEP]
by (simp add: real_root_pos2)
[PROOF STATE]
proof (state)
this:
real k = root 4 (real m)

goal (1 subgoal):
 1. real l = root 8 (real m)
[PROOF STEP]
have "?r l ^ 8 = ?r m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real l ^ 8 = real m
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real l ^ 8 = real (k ^ 4)
[PROOF STEP]
using kl2
[PROOF STATE]
proof (prove)
using this:
k = l\<^sup>2

goal (1 subgoal):
 1. real l ^ 8 = real (k ^ 4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real l ^ 8 = real m

goal (1 subgoal):
 1. real l = root 8 (real m)
[PROOF STEP]
from arg_cong[OF this, of "root 8"]
[PROOF STATE]
proof (chain)
picking this:
root 8 (real l ^ 8) = root 8 (real m)
[PROOF STEP]
show lm_id: "l = root 8 m"
[PROOF STATE]
proof (prove)
using this:
root 8 (real l ^ 8) = root 8 (real m)

goal (1 subgoal):
 1. real l = root 8 (real m)
[PROOF STEP]
by (simp add: real_root_pos2)
[PROOF STATE]
proof (state)
this:
real l = root 8 (real m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma elts_vcard_VSigma_eqpoll: "elts (vcard (vtimes i j)) \<approx> elts i \<times> elts j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (vcard (vtimes i j)) \<approx> elts i \<times> elts j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. elts (vcard (vtimes i j)) \<approx> elts i \<times> elts j
[PROOF STEP]
have "elts (vtimes i j) \<approx> elts i \<times> elts j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (vtimes i j) \<approx> elts i \<times> elts j
[PROOF STEP]
by (simp add: elts_VSigma)
[PROOF STATE]
proof (state)
this:
elts (vtimes i j) \<approx> elts i \<times> elts j

goal (1 subgoal):
 1. elts (vcard (vtimes i j)) \<approx> elts i \<times> elts j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
elts (vtimes i j) \<approx> elts i \<times> elts j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
elts (vtimes i j) \<approx> elts i \<times> elts j

goal (1 subgoal):
 1. elts (vcard (vtimes i j)) \<approx> elts i \<times> elts j
[PROOF STEP]
using cardinal_eqpoll eqpoll_trans
[PROOF STATE]
proof (prove)
using this:
elts (vtimes i j) \<approx> elts i \<times> elts j
elts (vcard ?a) \<approx> elts ?a
\<lbrakk>?A \<approx> ?B; ?B \<approx> ?C\<rbrakk> \<Longrightarrow> ?A \<approx> ?C

goal (1 subgoal):
 1. elts (vcard (vtimes i j)) \<approx> elts i \<times> elts j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
elts (vcard (vtimes i j)) \<approx> elts i \<times> elts j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma upto_split1:
  "\<lbrakk> i \<le> j;  j \<le> k \<rbrakk> \<Longrightarrow> [i..k] = [i..j-1] @ [j..k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> j; j \<le> k\<rbrakk> \<Longrightarrow> [i..k] = [i..j - 1] @ [j..k]
[PROOF STEP]
proof (induction j rule: int_ge_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<le> k \<Longrightarrow> [i..k] = [i..i - 1] @ [i..k]
 2. \<And>ia. \<lbrakk>i \<le> ia; ia \<le> k \<Longrightarrow> [i..k] = [i..ia - 1] @ [ia..k]; ia + 1 \<le> k\<rbrakk> \<Longrightarrow> [i..k] = [i..ia + 1 - 1] @ [ia + 1..k]
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:
i \<le> k

goal (2 subgoals):
 1. i \<le> k \<Longrightarrow> [i..k] = [i..i - 1] @ [i..k]
 2. \<And>ia. \<lbrakk>i \<le> ia; ia \<le> k \<Longrightarrow> [i..k] = [i..ia - 1] @ [ia..k]; ia + 1 \<le> k\<rbrakk> \<Longrightarrow> [i..k] = [i..ia + 1 - 1] @ [ia + 1..k]
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
i \<le> k

goal (1 subgoal):
 1. [i..k] = [i..i - 1] @ [i..k]
[PROOF STEP]
by (simp add: upto_rec1)
[PROOF STATE]
proof (state)
this:
[i..k] = [i..i - 1] @ [i..k]

goal (1 subgoal):
 1. \<And>ia. \<lbrakk>i \<le> ia; ia \<le> k \<Longrightarrow> [i..k] = [i..ia - 1] @ [ia..k]; ia + 1 \<le> k\<rbrakk> \<Longrightarrow> [i..k] = [i..ia + 1 - 1] @ [ia + 1..k]
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. \<lbrakk>i \<le> ia; ia \<le> k \<Longrightarrow> [i..k] = [i..ia - 1] @ [ia..k]; ia + 1 \<le> k\<rbrakk> \<Longrightarrow> [i..k] = [i..ia + 1 - 1] @ [ia + 1..k]
[PROOF STEP]
case step
[PROOF STATE]
proof (state)
this:
i \<le> i_
i_ \<le> k \<Longrightarrow> [i..k] = [i..i_ - 1] @ [i_..k]
i_ + 1 \<le> k

goal (1 subgoal):
 1. \<And>ia. \<lbrakk>i \<le> ia; ia \<le> k \<Longrightarrow> [i..k] = [i..ia - 1] @ [ia..k]; ia + 1 \<le> k\<rbrakk> \<Longrightarrow> [i..k] = [i..ia + 1 - 1] @ [ia + 1..k]
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
i \<le> i_
i_ \<le> k \<Longrightarrow> [i..k] = [i..i_ - 1] @ [i_..k]
i_ + 1 \<le> k

goal (1 subgoal):
 1. [i..k] = [i..i_ + 1 - 1] @ [i_ + 1..k]
[PROOF STEP]
using upto_rec1 upto_rec2
[PROOF STATE]
proof (prove)
using this:
i \<le> i_
i_ \<le> k \<Longrightarrow> [i..k] = [i..i_ - 1] @ [i_..k]
i_ + 1 \<le> k
?i \<le> ?j \<Longrightarrow> [?i..?j] = ?i # [?i + 1..?j]
?i \<le> ?j \<Longrightarrow> [?i..?j] = [?i..?j - 1] @ [?j]

goal (1 subgoal):
 1. [i..k] = [i..i_ + 1 - 1] @ [i_ + 1..k]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[i..k] = [i..i_ + 1 - 1] @ [i_ + 1..k]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma word_add_less_mono1:
  fixes i :: "'a :: len word"
  assumes ij: "i < j"
  and    ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)"
  shows  "i + k < j + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + k < j + k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i + k < j + k
[PROOF STEP]
from ij ujk
[PROOF STATE]
proof (chain)
picking this:
i < j
unat j + unat k < 2 ^ LENGTH('a)
[PROOF STEP]
have jk: "unat i + unat k < 2 ^ len_of TYPE ('a)"
[PROOF STATE]
proof (prove)
using this:
i < j
unat j + unat k < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. unat i + unat k < 2 ^ LENGTH('a)
[PROOF STEP]
by (auto elim: order_le_less_subst2 simp: word_less_nat_alt elim: add_less_mono1)
[PROOF STATE]
proof (state)
this:
unat i + unat k < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. i + k < j + k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
unat i + unat k < 2 ^ LENGTH('a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
unat i + unat k < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. i + k < j + k
[PROOF STEP]
using ujk ij
[PROOF STATE]
proof (prove)
using this:
unat i + unat k < 2 ^ LENGTH('a)
unat j + unat k < 2 ^ LENGTH('a)
i < j

goal (1 subgoal):
 1. i + k < j + k
[PROOF STEP]
by (auto simp: word_less_nat_alt iffD1 [OF unat_add_lem])
[PROOF STATE]
proof (state)
this:
i + k < j + k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_dim_of_vec_of_list [simp]:
  assumes "length l = n"
  shows "dim_vec (vec_of_list l) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec_of_list l) = n
[PROOF STEP]
using assms vec_of_list_def
[PROOF STATE]
proof (prove)
using this:
length l = n
vec_of_list \<equiv> map_fun id Abs_vec (\<lambda>v. (length v, mk_vec (length v) ((!) v)))

goal (1 subgoal):
 1. dim_vec (vec_of_list l) = n
[PROOF STEP]
by simp


[STATEMENT]
lemma cos_periodic_int[simp]:
  fixes i :: int
  shows "cos (x + i * (2 * pi)) = cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
proof (cases "0 \<le> i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
 2. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 \<le> i

goal (2 subgoals):
 1. 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
 2. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
hence i_nat: "real_of_int i = nat i"
[PROOF STATE]
proof (prove)
using this:
0 \<le> i

goal (1 subgoal):
 1. real_of_int i = real (nat i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_int i = real (nat i)

goal (2 subgoals):
 1. 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
 2. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
unfolding i_nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + real (nat i) * (2 * pi)) = cos x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (x + real_of_int i * (2 * pi)) = cos x

goal (1 subgoal):
 1. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> i

goal (1 subgoal):
 1. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
hence i_nat: "i = - real (nat (-i))"
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> i

goal (1 subgoal):
 1. real_of_int i = - real (nat (- i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_int i = - real (nat (- i))

goal (1 subgoal):
 1. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
have "cos x = cos (x + i * (2 * pi) - i * (2 * pi))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = cos (x + real_of_int i * (2 * pi) - real_of_int i * (2 * pi))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos x = cos (x + real_of_int i * (2 * pi) - real_of_int i * (2 * pi))

goal (1 subgoal):
 1. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos x = cos (x + real_of_int i * (2 * pi) - real_of_int i * (2 * pi))

goal (1 subgoal):
 1. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
have "\<dots> = cos (x + i * (2 * pi))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + real_of_int i * (2 * pi) - real_of_int i * (2 * pi)) = cos (x + real_of_int i * (2 * pi))
[PROOF STEP]
unfolding i_nat mult_minus_left diff_minus_eq_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + - (real (nat (- i)) * (2 * pi)) + real (nat (- i)) * (2 * pi)) = cos (x + - (real (nat (- i)) * (2 * pi)))
[PROOF STEP]
by (rule cos_periodic_nat)
[PROOF STATE]
proof (state)
this:
cos (x + real_of_int i * (2 * pi) - real_of_int i * (2 * pi)) = cos (x + real_of_int i * (2 * pi))

goal (1 subgoal):
 1. \<not> 0 \<le> i \<Longrightarrow> cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cos x = cos (x + real_of_int i * (2 * pi))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos x = cos (x + real_of_int i * (2 * pi))

goal (1 subgoal):
 1. cos (x + real_of_int i * (2 * pi)) = cos x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (x + real_of_int i * (2 * pi)) = cos x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_cycle_alt: "is_cycle xs \<longleftrightarrow> is_walk xs \<and> distinct (tl xs) \<and> walk_length xs \<ge> 1 \<and> hd xs = last xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_cycle xs = (is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs)
[PROOF STEP]
proof (intro iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_cycle xs \<Longrightarrow> is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs
 2. is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs \<Longrightarrow> is_cycle xs
[PROOF STEP]
show "is_cycle xs \<Longrightarrow> is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_cycle xs \<Longrightarrow> is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs
[PROOF STEP]
using is_cycle_alt_gen_path is_cycle_def is_gen_path_def
[PROOF STATE]
proof (prove)
using this:
is_cycle ?xs = (is_gen_path ?xs \<and> 1 \<le> walk_length ?xs \<and> hd ?xs = last ?xs)
is_cycle ?xs \<equiv> is_closed_walk ?xs \<and> 1 \<le> walk_length ?xs \<and> distinct (tl ?xs)
is_gen_path ?p \<equiv> is_walk ?p \<and> (distinct (tl ?p) \<and> hd ?p = last ?p \<or> distinct ?p)

goal (1 subgoal):
 1. is_cycle xs \<Longrightarrow> is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_cycle xs \<Longrightarrow> is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs

goal (1 subgoal):
 1. is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs \<Longrightarrow> is_cycle xs
[PROOF STEP]
show "is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs \<Longrightarrow> is_cycle xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs \<Longrightarrow> is_cycle xs
[PROOF STEP]
by (simp add: is_cycle_alt_gen_path is_gen_path_def)
[PROOF STATE]
proof (state)
this:
is_walk xs \<and> distinct (tl xs) \<and> 1 \<le> walk_length xs \<and> hd xs = last xs \<Longrightarrow> is_cycle xs

goal:
No subgoals!
[PROOF STEP]
qed