[STATEMENT]
theorem Arzela_Ascoli:
  fixes \<F> :: "[nat,'a::euclidean_space] \<Rightarrow> 'b::{real_normed_vector,heine_borel}"
  assumes "compact S"
      and M: "\<And>n x. x \<in> S \<Longrightarrow> norm(\<F> n x) \<le> M"
      and equicont:
          "\<And>x e. \<lbrakk>x \<in> S; 0 < e\<rbrakk>
                 \<Longrightarrow> \<exists>d. 0 < d \<and> (\<forall>n y. y \<in> S \<and> norm(x - y) < d \<longrightarrow> norm(\<F> n x - \<F> n y) < e)"
  obtains g k where "continuous_on S g" "strict_mono (k :: nat \<Rightarrow> nat)"
                    "\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. n \<ge> N \<and> x \<in> S \<longrightarrow> norm(\<F>(k n) x - g x) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have UEQ: "\<And>e. 0 < e \<Longrightarrow> \<exists>d. 0 < d \<and> (\<forall>n. \<forall>x \<in> S. \<forall>x' \<in> S. dist x' x < d \<longrightarrow> dist (\<F> n x') (\<F> n x) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d>0. \<forall>n. \<forall>x\<in>S. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (\<F> n x') (\<F> n x) < e
[PROOF STEP]
apply (rule compact_uniformly_equicontinuous [OF \<open>compact S\<close>, of "range \<F>"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>e x ea. \<lbrakk>0 < e; x \<in> S; 0 < ea\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>f\<in>range \<F>. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (f x') (f x) < ea
 2. \<And>e. 0 < e \<Longrightarrow> 0 < ?e e
 3. \<And>e d. \<lbrakk>0 < e; 0 < d; \<And>f x x'. \<lbrakk>f \<in> range \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < ?e e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>n. \<forall>x\<in>S. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (\<F> n x') (\<F> n x) < e
[PROOF STEP]
using equicont
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; 0 < ?e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>n y. y \<in> S \<and> norm (?x - y) < d \<longrightarrow> norm (\<F> n ?x - \<F> n y) < ?e

goal (3 subgoals):
 1. \<And>e x ea. \<lbrakk>0 < e; x \<in> S; 0 < ea\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>f\<in>range \<F>. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (f x') (f x) < ea
 2. \<And>e. 0 < e \<Longrightarrow> 0 < ?e e
 3. \<And>e d. \<lbrakk>0 < e; 0 < d; \<And>f x x'. \<lbrakk>f \<in> range \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < ?e e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>n. \<forall>x\<in>S. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (\<F> n x') (\<F> n x) < e
[PROOF STEP]
by (force simp: dist_commute dist_norm)+
[PROOF STATE]
proof (state)
this:
0 < ?e \<Longrightarrow> \<exists>d>0. \<forall>n. \<forall>x\<in>S. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (\<F> n x') (\<F> n x) < ?e

goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "continuous_on S g"
       if "\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. n \<ge> N \<and> x \<in> S \<longrightarrow> norm(\<F>(r n) x - g x) < e"
       for g:: "'a \<Rightarrow> 'b" and r :: "nat \<Rightarrow> nat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S g
[PROOF STEP]
proof (rule uniform_limit_theorem [of _ "\<F> \<circ> r"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>\<^sub>F n in ?F. continuous_on S ((\<F> \<circ> r) n)
 2. uniform_limit S (\<F> \<circ> r) g ?F
 3. ?F \<noteq> bot
[PROOF STEP]
have "continuous_on S (\<F> (r n))" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S (\<F> (r n))
[PROOF STEP]
using UEQ
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>d>0. \<forall>n. \<forall>x\<in>S. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (\<F> n x') (\<F> n x) < ?e

goal (1 subgoal):
 1. continuous_on S (\<F> (r n))
[PROOF STEP]
by (force simp: continuous_on_iff)
[PROOF STATE]
proof (state)
this:
continuous_on S (\<F> (r ?n))

goal (3 subgoals):
 1. \<forall>\<^sub>F n in ?F. continuous_on S ((\<F> \<circ> r) n)
 2. uniform_limit S (\<F> \<circ> r) g ?F
 3. ?F \<noteq> bot
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on S (\<F> (r ?n))
[PROOF STEP]
show "\<forall>\<^sub>F n in sequentially. continuous_on S ((\<F> \<circ> r) n)"
[PROOF STATE]
proof (prove)
using this:
continuous_on S (\<F> (r ?n))

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. continuous_on S ((\<F> \<circ> r) n)
[PROOF STEP]
by (simp add: eventually_sequentially)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. continuous_on S ((\<F> \<circ> r) n)

goal (2 subgoals):
 1. uniform_limit S (\<F> \<circ> r) g sequentially
 2. sequentially \<noteq> bot
[PROOF STEP]
show "uniform_limit S (\<F> \<circ> r) g sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit S (\<F> \<circ> r) g sequentially
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (r n) x - g x) < ?e

goal (1 subgoal):
 1. uniform_limit S (\<F> \<circ> r) g sequentially
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) comp_apply dist_norm uniform_limit_sequentially_iff)
[PROOF STATE]
proof (state)
this:
uniform_limit S (\<F> \<circ> r) g sequentially

goal (1 subgoal):
 1. sequentially \<noteq> bot
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (?r n) x - ?g x) < e) \<Longrightarrow> continuous_on S ?g

goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (?r n) x - ?g x) < e) \<Longrightarrow> continuous_on S ?g

goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain R where "countable R" "R \<subseteq> S" and SR: "S \<subseteq> closure R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>R. \<lbrakk>countable R; R \<subseteq> S; S \<subseteq> closure R\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis separable that)
[PROOF STATE]
proof (state)
this:
countable R
R \<subseteq> S
S \<subseteq> closure R

goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain k where "strict_mono k" and k: "\<And>x. x \<in> R \<Longrightarrow> \<exists>l. (\<lambda>n. \<F> (k n) x) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>strict_mono k; \<And>x. x \<in> R \<Longrightarrow> \<exists>l. (\<lambda>n. \<F> (k n) x) \<longlonglongrightarrow> l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>R \<subseteq> S\<close>
[PROOF STATE]
proof (prove)
using this:
R \<subseteq> S

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>strict_mono k; \<And>x. x \<in> R \<Longrightarrow> \<exists>l. (\<lambda>n. \<F> (k n) x) \<longlonglongrightarrow> l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force intro: function_convergent_subsequence [OF \<open>countable R\<close> M])
[PROOF STATE]
proof (state)
this:
strict_mono k
?x \<in> R \<Longrightarrow> \<exists>l. (\<lambda>n. \<F> (k n) ?x) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
strict_mono k
?x \<in> R \<Longrightarrow> \<exists>l. (\<lambda>n. \<F> (k n) ?x) \<longlonglongrightarrow> l
[PROOF STEP]
have Cauchy: "Cauchy ((\<lambda>n. \<F> (k n) x))" if "x \<in> R" for x
[PROOF STATE]
proof (prove)
using this:
strict_mono k
?x \<in> R \<Longrightarrow> \<exists>l. (\<lambda>n. \<F> (k n) ?x) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. Cauchy (\<lambda>n. \<F> (k n) x)
[PROOF STEP]
using convergent_eq_Cauchy that
[PROOF STATE]
proof (prove)
using this:
strict_mono k
?x \<in> R \<Longrightarrow> \<exists>l. (\<lambda>n. \<F> (k n) ?x) \<longlonglongrightarrow> l
(\<exists>l. ?S \<longlonglongrightarrow> l) = Cauchy ?S
x \<in> R

goal (1 subgoal):
 1. Cauchy (\<lambda>n. \<F> (k n) x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> R \<Longrightarrow> Cauchy (\<lambda>n. \<F> (k n) ?x)

goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e"
    if "0 < e" for e
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
obtain d where "0 < d"
      and d: "\<And>n. \<forall>x \<in> S. \<forall>x' \<in> S. dist x' x < d \<longrightarrow> dist (\<F> n x') (\<F> n x) < e/3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>n. \<forall>x\<in>S. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (\<F> n x') (\<F> n x) < e / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis UEQ \<open>0 < e\<close> divide_pos_pos zero_less_numeral)
[PROOF STATE]
proof (state)
this:
0 < d
\<forall>x\<in>S. \<forall>x'\<in>S. dist x' x < d \<longrightarrow> dist (\<F> ?n x') (\<F> ?n x) < e / 3

goal (1 subgoal):
 1. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
obtain T where "T \<subseteq> R" and "finite T" and T: "S \<subseteq> (\<Union>c\<in>T. ball c d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (rule compactE_image [OF  \<open>compact S\<close>, of R "(\<lambda>x. ball x d)"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>T. \<lbrakk>\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis; T \<in> R\<rbrakk> \<Longrightarrow> open (ball T d)
 2. (\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> S \<subseteq> (\<Union>c\<in>R. ball c d)
 3. \<And>C'. \<lbrakk>\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis; C' \<subseteq> R; finite C'; S \<subseteq> (\<Union>c\<in>C'. ball c d)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "closure R \<subseteq> (\<Union>c\<in>R. ball c d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure R \<subseteq> (\<Union>c\<in>R. ball c d)
[PROOF STEP]
using \<open>0 < d\<close>
[PROOF STATE]
proof (prove)
using this:
0 < d

goal (1 subgoal):
 1. closure R \<subseteq> (\<Union>c\<in>R. ball c d)
[PROOF STEP]
by (auto simp: closure_approachable)
[PROOF STATE]
proof (state)
this:
closure R \<subseteq> (\<Union>c\<in>R. ball c d)

goal (3 subgoals):
 1. \<And>T. \<lbrakk>\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis; T \<in> R\<rbrakk> \<Longrightarrow> open (ball T d)
 2. (\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> S \<subseteq> (\<Union>c\<in>R. ball c d)
 3. \<And>C'. \<lbrakk>\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis; C' \<subseteq> R; finite C'; S \<subseteq> (\<Union>c\<in>C'. ball c d)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
with SR
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> closure R
closure R \<subseteq> (\<Union>c\<in>R. ball c d)
[PROOF STEP]
show "S \<subseteq> (\<Union>c\<in>R. ball c d)"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> closure R
closure R \<subseteq> (\<Union>c\<in>R. ball c d)

goal (1 subgoal):
 1. S \<subseteq> (\<Union>c\<in>R. ball c d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subseteq> (\<Union>c\<in>R. ball c d)

goal (2 subgoals):
 1. \<And>T. \<lbrakk>\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis; T \<in> R\<rbrakk> \<Longrightarrow> open (ball T d)
 2. \<And>C'. \<lbrakk>\<And>T. \<lbrakk>T \<subseteq> R; finite T; S \<subseteq> (\<Union>c\<in>T. ball c d)\<rbrakk> \<Longrightarrow> thesis; C' \<subseteq> R; finite C'; S \<subseteq> (\<Union>c\<in>C'. ball c d)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
T \<subseteq> R
finite T
S \<subseteq> (\<Union>c\<in>T. ball c d)

goal (1 subgoal):
 1. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
have "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) x) (\<F> (k n) x) < e/3" if "x \<in> R" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) x) (\<F> (k n) x) < e / 3
[PROOF STEP]
using Cauchy \<open>0 < e\<close> that
[PROOF STATE]
proof (prove)
using this:
?x \<in> R \<Longrightarrow> Cauchy (\<lambda>n. \<F> (k n) ?x)
0 < e
x \<in> R

goal (1 subgoal):
 1. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) x) (\<F> (k n) x) < e / 3
[PROOF STEP]
unfolding Cauchy_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> R \<Longrightarrow> \<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) ?x) (\<F> (k n) ?x) < e
0 < e
x \<in> R

goal (1 subgoal):
 1. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) x) (\<F> (k n) x) < e / 3
[PROOF STEP]
by (metis less_divide_eq_numeral1(1) mult_zero_left)
[PROOF STATE]
proof (state)
this:
?x \<in> R \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) ?x) (\<F> (k n) ?x) < e / 3

goal (1 subgoal):
 1. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> R \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) ?x) (\<F> (k n) ?x) < e / 3
[PROOF STEP]
obtain MF where MF: "\<And>x m n. \<lbrakk>x \<in> R; m \<ge> MF x; n \<ge> MF x\<rbrakk> \<Longrightarrow> norm (\<F> (k m) x - \<F> (k n) x) < e/3"
[PROOF STATE]
proof (prove)
using this:
?x \<in> R \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) ?x) (\<F> (k n) ?x) < e / 3

goal (1 subgoal):
 1. (\<And>MF. (\<And>x m n. \<lbrakk>x \<in> R; MF x \<le> m; MF x \<le> n\<rbrakk> \<Longrightarrow> norm (\<F> (k m) x - \<F> (k n) x) < e / 3) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using dist_norm
[PROOF STATE]
proof (prove)
using this:
?x \<in> R \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<F> (k m) ?x) (\<F> (k n) ?x) < e / 3
dist ?x ?y = norm (?x - ?y)

goal (1 subgoal):
 1. (\<And>MF. (\<And>x m n. \<lbrakk>x \<in> R; MF x \<le> m; MF x \<le> n\<rbrakk> \<Longrightarrow> norm (\<F> (k m) x - \<F> (k n) x) < e / 3) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> R; MF ?x \<le> ?m; MF ?x \<le> ?n\<rbrakk> \<Longrightarrow> norm (\<F> (k ?m) ?x - \<F> (k ?n) ?x) < e / 3

goal (1 subgoal):
 1. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
have "dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e"
         if m: "Max (MF ` T) \<le> m" and n: "Max (MF ` T) \<le> n" "x \<in> S" for m n x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
obtain t where "t \<in> T" and t: "x \<in> ball t d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. \<lbrakk>t \<in> T; x \<in> ball t d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>x \<in> S\<close> T
[PROOF STATE]
proof (prove)
using this:
x \<in> S
S \<subseteq> (\<Union>c\<in>T. ball c d)

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>t \<in> T; x \<in> ball t d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<in> T
x \<in> ball t d

goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
have "norm(\<F> (k m) t - \<F> (k m) x) < e / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<F> (k m) t - \<F> (k m) x) < e / 3
[PROOF STEP]
by (metis \<open>R \<subseteq> S\<close> \<open>T \<subseteq> R\<close> \<open>t \<in> T\<close> d dist_norm mem_ball subset_iff t \<open>x \<in> S\<close>)
[PROOF STATE]
proof (state)
this:
norm (\<F> (k m) t - \<F> (k m) x) < e / 3

goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
norm (\<F> (k m) t - \<F> (k m) x) < e / 3

goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
have "norm(\<F> (k n) t - \<F> (k n) x) < e / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<F> (k n) t - \<F> (k n) x) < e / 3
[PROOF STEP]
by (metis \<open>R \<subseteq> S\<close> \<open>T \<subseteq> R\<close> \<open>t \<in> T\<close> subsetD d dist_norm mem_ball t \<open>x \<in> S\<close>)
[PROOF STATE]
proof (state)
this:
norm (\<F> (k n) t - \<F> (k n) x) < e / 3

goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
norm (\<F> (k n) t - \<F> (k n) x) < e / 3

goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
have "norm(\<F> (k m) t - \<F> (k n) t) < e / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<F> (k m) t - \<F> (k n) t) < e / 3
[PROOF STEP]
proof (rule MF)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. t \<in> R
 2. MF t \<le> m
 3. MF t \<le> n
[PROOF STEP]
show "t \<in> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> R
[PROOF STEP]
using \<open>T \<subseteq> R\<close> \<open>t \<in> T\<close>
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> R
t \<in> T

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

goal (2 subgoals):
 1. MF t \<le> m
 2. MF t \<le> n
[PROOF STEP]
show "MF t \<le> m" "MF t \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MF t \<le> m &&& MF t \<le> n
[PROOF STEP]
by (meson Max_ge \<open>finite T\<close> \<open>t \<in> T\<close> finite_imageI imageI le_trans m n)+
[PROOF STATE]
proof (state)
this:
MF t \<le> m
MF t \<le> n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm (\<F> (k m) t - \<F> (k n) t) < e / 3

goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
norm (\<F> (k m) t - \<F> (k m) x) < e / 3
norm (\<F> (k n) t - \<F> (k n) x) < e / 3
norm (\<F> (k m) t - \<F> (k n) t) < e / 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (\<F> (k m) t - \<F> (k m) x) < e / 3
norm (\<F> (k n) t - \<F> (k n) x) < e / 3
norm (\<F> (k m) t - \<F> (k n) t) < e / 3

goal (1 subgoal):
 1. dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
unfolding dist_norm [symmetric] o_def
[PROOF STATE]
proof (prove)
using this:
dist (\<F> (k m) t) (\<F> (k m) x) < e / 3
dist (\<F> (k n) t) (\<F> (k n) x) < e / 3
dist (\<F> (k m) t) (\<F> (k n) t) < e / 3

goal (1 subgoal):
 1. dist (\<F> (k m) x) (\<F> (k n) x) < e
[PROOF STEP]
by (metis dist_triangle_third dist_commute)
[PROOF STATE]
proof (state)
this:
dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Max (MF ` T) \<le> ?m; Max (MF ` T) \<le> ?n; ?x \<in> S\<rbrakk> \<Longrightarrow> dist ((\<F> \<circ> k) ?m ?x) ((\<F> \<circ> k) ?n ?x) < e

goal (1 subgoal):
 1. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>Max (MF ` T) \<le> ?m; Max (MF ` T) \<le> ?n; ?x \<in> S\<rbrakk> \<Longrightarrow> dist ((\<F> \<circ> k) ?m ?x) ((\<F> \<circ> k) ?n ?x) < e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Max (MF ` T) \<le> ?m; Max (MF ` T) \<le> ?n; ?x \<in> S\<rbrakk> \<Longrightarrow> dist ((\<F> \<circ> k) ?m ?x) ((\<F> \<circ> k) ?n ?x) < e

goal (1 subgoal):
 1. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < ?e \<Longrightarrow> \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < ?e

goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < ?e \<Longrightarrow> \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < ?e
[PROOF STEP]
obtain g where "\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm ((\<F> \<circ> k) n x - g x) < e"
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < ?e

goal (1 subgoal):
 1. (\<And>g. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm ((\<F> \<circ> k) n x - g x) < e \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using uniformly_convergent_eq_cauchy [of "\<lambda>x. x \<in> S" "\<F> \<circ> k"]
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < ?e
(\<exists>l. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) n x) (l x) < e) = (\<forall>e>0. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> x \<in> S \<longrightarrow> dist ((\<F> \<circ> k) m x) ((\<F> \<circ> k) n x) < e)

goal (1 subgoal):
 1. (\<And>g. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm ((\<F> \<circ> k) n x - g x) < e \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: dist_norm)
[PROOF STATE]
proof (state)
this:
\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm ((\<F> \<circ> k) n x - g x) < e

goal (1 subgoal):
 1. (\<And>g k. \<lbrakk>continuous_on S g; strict_mono k; \<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (k n) x - g x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (?r n) x - ?g x) < e) \<Longrightarrow> continuous_on S ?g
\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm ((\<F> \<circ> k) n x - g x) < e
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm (\<F> (?r n) x - ?g x) < e) \<Longrightarrow> continuous_on S ?g
\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> x \<in> S \<longrightarrow> norm ((\<F> \<circ> k) n x - g x) < e

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (metis \<open>strict_mono k\<close> comp_apply that)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


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

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


[STATEMENT]
lemma sameDom_and_liftAll2_iff:
"(sameDom inp inp' \<and> liftAll2 phi inp inp') =
 (\<forall> i. (inp i = None \<and> inp' i = None) \<or>
         (\<exists> v v'. inp i = Some v \<and> inp' i = Some v' \<and> phi v v'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sameDom inp inp' \<and> liftAll2 phi inp inp') = (\<forall>i. inp i = None \<and> inp' i = None \<or> (\<exists>v v'. inp i = Some v \<and> inp' i = Some v' \<and> phi v v'))
[PROOF STEP]
unfolding sameDom_def liftAll2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i. (inp i = None) = (inp' i = None)) \<and> (\<forall>i v1 v2. inp i = Some v1 \<and> inp' i = Some v2 \<longrightarrow> phi v1 v2)) = (\<forall>i. inp i = None \<and> inp' i = None \<or> (\<exists>v v'. inp i = Some v \<and> inp' i = Some v' \<and> phi v v'))
[PROOF STEP]
apply (auto simp add: fun_eq_iff option.case_eq_if)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i v1 v2. \<lbrakk>\<forall>i. inp i = None \<and> inp' i = None \<or> (\<exists>v. inp i = Some v \<and> (\<exists>v'. inp' i = Some v' \<and> phi v v')); inp i = Some v1; inp' i = Some v2\<rbrakk> \<Longrightarrow> phi v1 v2
[PROOF STEP]
using option.sel
[PROOF STATE]
proof (prove)
using this:
the (Some ?x2.0) = ?x2.0

goal (1 subgoal):
 1. \<And>i v1 v2. \<lbrakk>\<forall>i. inp i = None \<and> inp' i = None \<or> (\<exists>v. inp i = Some v \<and> (\<exists>v'. inp' i = Some v' \<and> phi v v')); inp i = Some v1; inp' i = Some v2\<rbrakk> \<Longrightarrow> phi v1 v2
[PROOF STEP]
by fastforce


[STATEMENT]
lemma AbstTermP_subst [simp]:
      "(AbstTermP v i t u)(j::=w) = AbstTermP (subst j w v) (subst j w i) (subst j w t) (subst j w u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (AbstTermP v i t u)(j::=w) = AbstTermP (subst j w v) (subst j w i) (subst j w t) (subst j w u)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (AbstTermP v i t u)(j::=w) = AbstTermP (subst j w v) (subst j w i) (subst j w t) (subst j w u)
[PROOF STEP]
obtain s::name and k::name  where "atom s \<sharp> (v,i,t,u,w,j,k)"  "atom k \<sharp> (v,i,t,u,w,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s k. \<lbrakk>atom s \<sharp> (v, i, t, u, w, j, k); atom k \<sharp> (v, i, t, u, w, j)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis obtain_fresh)
[PROOF STATE]
proof (state)
this:
atom s \<sharp> (v, i, t, u, w, j, k)
atom k \<sharp> (v, i, t, u, w, j)

goal (1 subgoal):
 1. (AbstTermP v i t u)(j::=w) = AbstTermP (subst j w v) (subst j w i) (subst j w t) (subst j w u)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
atom s \<sharp> (v, i, t, u, w, j, k)
atom k \<sharp> (v, i, t, u, w, j)

goal (1 subgoal):
 1. (AbstTermP v i t u)(j::=w) = AbstTermP (subst j w v) (subst j w i) (subst j w t) (subst j w u)
[PROOF STEP]
by (simp add: AbstTermP.simps [of s _ _ _ _ k])
[PROOF STATE]
proof (state)
this:
(AbstTermP v i t u)(j::=w) = AbstTermP (subst j w v) (subst j w i) (subst j w t) (subst j w u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_diag_smult: "mat_diag n (\<lambda> x. (k::'a::comm_ring_1)) = (k \<cdot>\<^sub>m 1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
have "mat_diag n (\<lambda> x. k) = mat_diag n (\<lambda> x. k * 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = mat_diag n (\<lambda>x. k * (1::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k) = mat_diag n (\<lambda>x. k * (1::'a))

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k) = mat_diag n (\<lambda>x. k * (1::'a))

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
have "... = mat_diag n (\<lambda> x. k) * mat_diag n (\<lambda> x. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k * (1::'a)) = mat_diag n (\<lambda>x. k) * mat_diag n (\<lambda>x. 1::'a)
[PROOF STEP]
using mat_diag_diag
[PROOF STATE]
proof (prove)
using this:
mat_diag ?n ?f * mat_diag ?n ?g = mat_diag ?n (\<lambda>i. ?f i * ?g i)

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k * (1::'a)) = mat_diag n (\<lambda>x. k) * mat_diag n (\<lambda>x. 1::'a)
[PROOF STEP]
by (simp add: mat_diag_def)
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k * (1::'a)) = mat_diag n (\<lambda>x. k) * mat_diag n (\<lambda>x. 1::'a)

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k * (1::'a)) = mat_diag n (\<lambda>x. k) * mat_diag n (\<lambda>x. 1::'a)

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
have "... = mat_diag n (\<lambda> x. k) * (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) * mat_diag n (\<lambda>x. 1::'a) = mat_diag n (\<lambda>x. k) * 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k) * mat_diag n (\<lambda>x. 1::'a) = mat_diag n (\<lambda>x. k) * 1\<^sub>m n

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
thm mat_diag_mult_left
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k) * mat_diag n (\<lambda>x. 1::'a) = mat_diag n (\<lambda>x. k) * 1\<^sub>m n

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k) * mat_diag n (\<lambda>x. 1::'a) = mat_diag n (\<lambda>x. k) * 1\<^sub>m n

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
have "... = Matrix.mat n n (\<lambda>(i, j). k * (1\<^sub>m n) $$ (i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) * 1\<^sub>m n = Matrix.mat n n (\<lambda>(i, j). k * 1\<^sub>m n $$ (i, j))
[PROOF STEP]
by (rule mat_diag_mult_left, auto)
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k) * 1\<^sub>m n = Matrix.mat n n (\<lambda>(i, j). k * 1\<^sub>m n $$ (i, j))

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k) * 1\<^sub>m n = Matrix.mat n n (\<lambda>(i, j). k * 1\<^sub>m n $$ (i, j))

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
have "... = (k \<cdot>\<^sub>m 1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat n n (\<lambda>(i, j). k * 1\<^sub>m n $$ (i, j)) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
unfolding smult_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat n n (\<lambda>(i, j). k * 1\<^sub>m n $$ (i, j)) = map_mat ((*) k) (1\<^sub>m n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Matrix.mat n n (\<lambda>(i, j). k * 1\<^sub>m n $$ (i, j)) = k \<cdot>\<^sub>m 1\<^sub>m n

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n

goal (1 subgoal):
 1. mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mat_diag n (\<lambda>x. k) = k \<cdot>\<^sub>m 1\<^sub>m n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hermitean_congruence:
  assumes "hermitean H"
  shows "hermitean (congruence M H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitean (congruence M H)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitean H

goal (1 subgoal):
 1. hermitean (congruence M H)
[PROOF STEP]
unfolding hermitean_def
[PROOF STATE]
proof (prove)
using this:
mat_adj H = H

goal (1 subgoal):
 1. mat_adj (congruence M H) = congruence M H
[PROOF STEP]
by (auto simp add: mult_mm_assoc)


[STATEMENT]
lemma unstream_filter_trans [stream_fusion]: "unstream (filter_trans P g) s = filter P (unstream g s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unstream (filter_trans P g) s = filter P (unstream g s)
[PROOF STEP]
proof (induction s taking: g rule: unstream.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator g s = Skip x2 \<Longrightarrow> unstream (filter_trans P g) x2 = filter P (unstream g x2); \<And>x31 x32. generator g s = Yield x31 x32 \<Longrightarrow> unstream (filter_trans P g) x32 = filter P (unstream g x32)\<rbrakk> \<Longrightarrow> unstream (filter_trans P g) s = filter P (unstream g s)
[PROOF STEP]
case (1 s)
[PROOF STATE]
proof (state)
this:
generator g s = Skip ?x2.0 \<Longrightarrow> unstream (filter_trans P g) ?x2.0 = filter P (unstream g ?x2.0)
generator g s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (filter_trans P g) ?x32.0 = filter P (unstream g ?x32.0)

goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator g s = Skip x2 \<Longrightarrow> unstream (filter_trans P g) x2 = filter P (unstream g x2); \<And>x31 x32. generator g s = Yield x31 x32 \<Longrightarrow> unstream (filter_trans P g) x32 = filter P (unstream g x32)\<rbrakk> \<Longrightarrow> unstream (filter_trans P g) s = filter P (unstream g s)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
generator g s = Skip ?x2.0 \<Longrightarrow> unstream (filter_trans P g) ?x2.0 = filter P (unstream g ?x2.0)
generator g s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (filter_trans P g) ?x32.0 = filter P (unstream g ?x32.0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
generator g s = Skip ?x2.0 \<Longrightarrow> unstream (filter_trans P g) ?x2.0 = filter P (unstream g ?x2.0)
generator g s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (filter_trans P g) ?x32.0 = filter P (unstream g ?x32.0)

goal (1 subgoal):
 1. unstream (filter_trans P g) s = filter P (unstream g s)
[PROOF STEP]
by(cases "generator g s")(simp_all add: filter_trans.rep_eq filter_raw_def)
[PROOF STATE]
proof (state)
this:
unstream (filter_trans P g) s = filter P (unstream g s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<pi>_le_self':
  includes prime_counting_notation
  assumes "x \<ge> 1"
  shows   "\<pi> x \<le> x - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> x \<le> x - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<pi> x \<le> x - 1
[PROOF STEP]
have "\<pi> x \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> x \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)
[PROOF STEP]
unfolding \<pi>_def prime_sum_upto_altdef2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. 1) \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)
[PROOF STEP]
by (intro sum_mono2) (auto dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
\<pi> x \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)

goal (1 subgoal):
 1. \<pi> x \<le> x - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<pi> x \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)

goal (1 subgoal):
 1. \<pi> x \<le> x - 1
[PROOF STEP]
have "\<dots> = real (nat \<lfloor>x\<rfloor> - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)

goal (1 subgoal):
 1. \<pi> x \<le> x - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)

goal (1 subgoal):
 1. \<pi> x \<le> x - 1
[PROOF STEP]
have "\<dots> \<le> x - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (nat \<lfloor>x\<rfloor> - 1) \<le> x - 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. real (nat \<lfloor>x\<rfloor> - 1) \<le> x - 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real (nat \<lfloor>x\<rfloor> - 1) \<le> x - 1

goal (1 subgoal):
 1. \<pi> x \<le> x - 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<pi> x \<le> x - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<pi> x \<le> x - 1

goal (1 subgoal):
 1. \<pi> x \<le> x - 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<pi> x \<le> x - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_space_mult:
  assumes "A \<in> carrier_mat nr nc" and "B \<in> carrier_mat nr nr"
  shows "row_space (B * A) \<subseteq> row_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_space (B * A) \<subseteq> row_space A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> row_space (B * A) \<Longrightarrow> x \<in> row_space A
[PROOF STEP]
from assms(2) assms(1)
[PROOF STATE]
proof (chain)
picking this:
B \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
[PROOF STEP]
have "B * A \<in> carrier_mat nr nc"
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. B * A \<in> carrier_mat nr nc
[PROOF STEP]
by (rule mult_carrier_mat)
[PROOF STATE]
proof (state)
this:
B * A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. \<And>x. x \<in> row_space (B * A) \<Longrightarrow> x \<in> row_space A
[PROOF STEP]
hence "nr = dim_row (B * A)"
[PROOF STATE]
proof (prove)
using this:
B * A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. nr = dim_row (B * A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
nr = dim_row (B * A)

goal (1 subgoal):
 1. \<And>x. x \<in> row_space (B * A) \<Longrightarrow> x \<in> row_space A
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> row_space (B * A) \<Longrightarrow> x \<in> row_space A
[PROOF STEP]
assume "x \<in> row_space (B * A)"
[PROOF STATE]
proof (state)
this:
x \<in> row_space (B * A)

goal (1 subgoal):
 1. \<And>x. x \<in> row_space (B * A) \<Longrightarrow> x \<in> row_space A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> row_space (B * A)
[PROOF STEP]
obtain v where "v \<in> carrier_vec nr" and x: "x = v \<^sub>v* (B * A)"
[PROOF STATE]
proof (prove)
using this:
x \<in> row_space (B * A)

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> carrier_vec nr; x = v \<^sub>v* (B * A)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>nr = dim_row (B * A)\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> row_space (B * A)

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> carrier_vec (dim_row (B * A)); x = v \<^sub>v* (B * A)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule row_spaceE)
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec nr
x = v \<^sub>v* (B * A)

goal (1 subgoal):
 1. \<And>x. x \<in> row_space (B * A) \<Longrightarrow> x \<in> row_space A
[PROOF STEP]
from this(1) assms(2) assms(1)
[PROOF STATE]
proof (chain)
picking this:
v \<in> carrier_vec nr
B \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
[PROOF STEP]
have "x = (v \<^sub>v* B) \<^sub>v* A"
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec nr
B \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. x = v \<^sub>v* B \<^sub>v* A
[PROOF STEP]
unfolding x
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec nr
B \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. v \<^sub>v* (B * A) = v \<^sub>v* B \<^sub>v* A
[PROOF STEP]
by (rule assoc_mult_vec_mat)
[PROOF STATE]
proof (state)
this:
x = v \<^sub>v* B \<^sub>v* A

goal (1 subgoal):
 1. \<And>x. x \<in> row_space (B * A) \<Longrightarrow> x \<in> row_space A
[PROOF STEP]
thus "x \<in> row_space A"
[PROOF STATE]
proof (prove)
using this:
x = v \<^sub>v* B \<^sub>v* A

goal (1 subgoal):
 1. x \<in> row_space A
[PROOF STEP]
by (rule row_spaceI)
[PROOF STATE]
proof (state)
this:
x \<in> row_space A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Pi'_mono: "(\<And>x. x \<in> A \<Longrightarrow> B x \<subseteq> C x) \<Longrightarrow> Pi' A B \<subseteq> Pi' A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> B x \<subseteq> C x) \<Longrightarrow> Pi' A B \<subseteq> Pi' A C
[PROOF STEP]
by (auto simp: Pi'_def)


[STATEMENT]
lemma pderiv_add:
  assumes "p \<in> carrier P"
  assumes "q \<in> carrier P"
  shows "pderiv (p \<oplus>\<^bsub>P\<^esub> q) = pderiv p \<oplus>\<^bsub>P\<^esub> pderiv q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv (p \<oplus>\<^bsub>P\<^esub> q) = pderiv p \<oplus>\<^bsub>P\<^esub> pderiv q
[PROOF STEP]
unfolding pderiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_shift (n_mult (p \<oplus>\<^bsub>P\<^esub> q)) = poly_shift (n_mult p) \<oplus>\<^bsub>P\<^esub> poly_shift (n_mult q)
[PROOF STEP]
using assms poly_shift_add n_mult_add
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P
q \<in> carrier P
\<lbrakk>?f \<in> carrier P; ?g \<in> carrier P\<rbrakk> \<Longrightarrow> poly_shift (?f \<oplus>\<^bsub>P\<^esub> ?g) = poly_shift ?f \<oplus>\<^bsub>P\<^esub> poly_shift ?g
\<lbrakk>?p \<in> carrier P; ?q \<in> carrier P\<rbrakk> \<Longrightarrow> n_mult (?p \<oplus>\<^bsub>P\<^esub> ?q) = n_mult ?p \<oplus>\<^bsub>P\<^esub> n_mult ?q

goal (1 subgoal):
 1. poly_shift (n_mult (p \<oplus>\<^bsub>P\<^esub> q)) = poly_shift (n_mult p) \<oplus>\<^bsub>P\<^esub> poly_shift (n_mult q)
[PROOF STEP]
by (simp add: n_mult_closed)