[STATEMENT]
lemma cfs_X_plus:
  assumes "a \<in> carrier R"
  shows "X_plus a n = (if n = 0 then a else (if n = 1 then \<one> else \<zero>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X_poly_plus R a n = (if n = 0 then a else if n = 1 then \<one> else \<zero>)
[PROOF STEP]
using assms cfs_add monom_closed UP_ring_axioms cfs_monom
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
\<lbrakk>?p \<in> carrier P; ?q \<in> carrier P\<rbrakk> \<Longrightarrow> (?p \<oplus>\<^bsub>P\<^esub> ?q) ?n = ?p ?n \<oplus> ?q ?n
?a \<in> carrier R \<Longrightarrow> monom P ?a ?n \<in> carrier P
UP_ring R
?a \<in> carrier R \<Longrightarrow> monom P ?a ?m ?n = (if ?m = ?n then ?a else \<zero>)

goal (1 subgoal):
 1. X_poly_plus R a n = (if n = 0 then a else if n = 1 then \<one> else \<zero>)
[PROOF STEP]
unfolding X_poly_plus_def to_polynomial_def X_poly_def P_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
\<lbrakk>?p \<in> carrier (UP R); ?q \<in> carrier (UP R)\<rbrakk> \<Longrightarrow> (?p \<oplus>\<^bsub>UP R\<^esub> ?q) ?n = ?p ?n \<oplus> ?q ?n
?a \<in> carrier R \<Longrightarrow> monom (UP R) ?a ?n \<in> carrier (UP R)
UP_ring R
?a \<in> carrier R \<Longrightarrow> monom (UP R) ?a ?m ?n = (if ?m = ?n then ?a else \<zero>)

goal (1 subgoal):
 1. (monom (UP R) \<one> 1 \<oplus>\<^bsub>UP R\<^esub> monom (UP R) a 0) n = (if n = 0 then a else if n = 1 then \<one> else \<zero>)
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_orbit [simp]:
  "finite (orbit f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (orbit f a)
[PROOF STEP]
proof (cases "a \<in> affected f")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<in> affected f \<Longrightarrow> finite (orbit f a)
 2. a \<notin> affected f \<Longrightarrow> finite (orbit f a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<notin> affected f

goal (2 subgoals):
 1. a \<in> affected f \<Longrightarrow> finite (orbit f a)
 2. a \<notin> affected f \<Longrightarrow> finite (orbit f a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<notin> affected f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<notin> affected f

goal (1 subgoal):
 1. finite (orbit f a)
[PROOF STEP]
by (simp add: not_in_affected_iff_orbit_eq_singleton)
[PROOF STATE]
proof (state)
this:
finite (orbit f a)

goal (1 subgoal):
 1. a \<in> affected f \<Longrightarrow> finite (orbit f a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<in> affected f \<Longrightarrow> finite (orbit f a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a \<in> affected f

goal (1 subgoal):
 1. a \<in> affected f \<Longrightarrow> finite (orbit f a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> affected f
[PROOF STEP]
have "orbit f a \<subseteq> affected f"
[PROOF STATE]
proof (prove)
using this:
a \<in> affected f

goal (1 subgoal):
 1. orbit f a \<subseteq> affected f
[PROOF STEP]
by (rule orbit_subset_eq_affected)
[PROOF STATE]
proof (state)
this:
orbit f a \<subseteq> affected f

goal (1 subgoal):
 1. a \<in> affected f \<Longrightarrow> finite (orbit f a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
orbit f a \<subseteq> affected f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
orbit f a \<subseteq> affected f

goal (1 subgoal):
 1. finite (orbit f a)
[PROOF STEP]
using finite_affected
[PROOF STATE]
proof (prove)
using this:
orbit f a \<subseteq> affected f
finite (affected ?f)

goal (1 subgoal):
 1. finite (orbit f a)
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite (orbit f a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zmset_subseteq_add_iff1:
  \<open>j \<le> i \<Longrightarrow> (repeat_zmset i u + m \<subseteq>#\<^sub>z repeat_zmset j u + n) = (repeat_zmset (i - j) u + m \<subseteq>#\<^sub>z n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_zmset i u + m \<subseteq>#\<^sub>z repeat_zmset j u + n) = (repeat_zmset (i - j) u + m \<subseteq>#\<^sub>z n)
[PROOF STEP]
by (simp add: add.commute add_diff_eq left_diff_repeat_zmset_distrib' subset_eq_diff_conv_zmset)


[STATEMENT]
lemma powrat_mult_pos:
  assumes "0 < x" and "0 < r" and "0 < s"
  shows "x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
proof (cases r)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
case (Fract a b)
[PROOF STATE]
proof (state)
this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
assume b0: "b > 0" and rf: "r = Fract a b" and coab: "coprime a b"
[PROOF STATE]
proof (state)
this:
0 < b
r = Fract a b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
have a0: "a > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a
[PROOF STEP]
using assms(2) b0 rf zero_less_Fract_iff
[PROOF STATE]
proof (prove)
using this:
0 < r
0 < b
r = Fract a b
0 < ?b \<Longrightarrow> (0 < Fract ?a ?b) = (0 < ?a)

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

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
proof (cases s)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>0 < a; s = Fract aa b; 0 < b; coprime aa b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
case (Fract c d)
[PROOF STATE]
proof (state)
this:
s = Fract c d
0 < d
coprime c d

goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>0 < a; s = Fract aa b; 0 < b; coprime aa b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
assume d0: "d > 0" and sf: "s = Fract c d" and coad: "coprime c d"
[PROOF STATE]
proof (state)
this:
0 < d
s = Fract c d
coprime c d

goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>0 < a; s = Fract aa b; 0 < b; coprime aa b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < d
s = Fract c d
coprime c d
[PROOF STEP]
have c0: "c > 0"
[PROOF STATE]
proof (prove)
using this:
0 < d
s = Fract c d
coprime c d

goal (1 subgoal):
 1. 0 < c
[PROOF STEP]
using assms(3) zero_less_Fract_iff
[PROOF STATE]
proof (prove)
using this:
0 < d
s = Fract c d
coprime c d
0 < s
0 < ?b \<Longrightarrow> (0 < Fract ?a ?b) = (0 < ?a)

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

goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>0 < a; s = Fract aa b; 0 < b; coprime aa b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have  "b * d > 0"
[PROOF STATE]
proof (prove)
using this:
0 < c

goal (1 subgoal):
 1. 0 < b * d
[PROOF STEP]
using b0 d0
[PROOF STATE]
proof (prove)
using this:
0 < c
0 < b
0 < d

goal (1 subgoal):
 1. 0 < b * d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < b * d

goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>0 < a; s = Fract aa b; 0 < b; coprime aa b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < b * d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < b * d

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
using a0 c0 b0 d0 rf sf coab coad assms
[PROOF STATE]
proof (prove)
using this:
0 < b * d
0 < a
0 < c
0 < b
0 < d
r = Fract a b
s = Fract c d
coprime a b
coprime c d
0 < x
0 < r
0 < s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
by (auto intro: mult_pos_pos simp add: powrat_def quotient_of_Fract
            zero_less_Fract_iff real_root_normalize_cancel real_root_power
            real_root_mult_exp [symmetric] nat_mult_distrib power_mult
            mult.commute)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in shortest_path_pos_cost) tail_value_check:
  fixes u :: 'a
  assumes "s \<in> verts G"
  shows "\<mu> c s s = ereal 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> c s s = ereal 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<mu> c s s = ereal 0
[PROOF STEP]
have *: "awalk s [] s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. awalk s [] s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s \<in> verts G

goal (1 subgoal):
 1. awalk s [] s
[PROOF STEP]
unfolding awalk_def
[PROOF STATE]
proof (prove)
using this:
s \<in> verts G

goal (1 subgoal):
 1. s \<in> verts G \<and> set [] \<subseteq> arcs G \<and> cas s [] s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
awalk s [] s

goal (1 subgoal):
 1. \<mu> c s s = ereal 0
[PROOF STEP]
hence "\<mu> c s s \<le> ereal 0"
[PROOF STATE]
proof (prove)
using this:
awalk s [] s

goal (1 subgoal):
 1. \<mu> c s s \<le> ereal 0
[PROOF STEP]
using min_cost_le_walk_cost[OF *]
[PROOF STATE]
proof (prove)
using this:
awalk s [] s
\<mu> ?c s s \<le> ereal (awalk_cost ?c [])

goal (1 subgoal):
 1. \<mu> c s s \<le> ereal 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<mu> c s s \<le> ereal 0

goal (1 subgoal):
 1. \<mu> c s s = ereal 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<mu> c s s \<le> ereal 0

goal (1 subgoal):
 1. \<mu> c s s = ereal 0
[PROOF STEP]
have "(\<And>p. awalk s p s \<Longrightarrow> ereal(awalk_cost c p) \<ge> ereal 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. awalk s p s \<Longrightarrow> ereal 0 \<le> ereal (awalk_cost c p)
[PROOF STEP]
using pos_cost pos_cost_pos_awalk_cost
[PROOF STATE]
proof (prove)
using this:
?e \<in> arcs G \<Longrightarrow> 0 \<le> c ?e
\<lbrakk>awalk ?u ?p ?v; \<And>e. e \<in> arcs G \<Longrightarrow> 0 \<le> ?c e\<rbrakk> \<Longrightarrow> 0 \<le> awalk_cost ?c ?p

goal (1 subgoal):
 1. \<And>p. awalk s p s \<Longrightarrow> ereal 0 \<le> ereal (awalk_cost c p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
awalk s ?p2 s \<Longrightarrow> ereal 0 \<le> ereal (awalk_cost c ?p2)

goal (1 subgoal):
 1. \<mu> c s s = ereal 0
[PROOF STEP]
hence "\<mu> c s s \<ge> ereal 0"
[PROOF STATE]
proof (prove)
using this:
awalk s ?p2 s \<Longrightarrow> ereal 0 \<le> ereal (awalk_cost c ?p2)

goal (1 subgoal):
 1. ereal 0 \<le> \<mu> c s s
[PROOF STEP]
unfolding \<mu>_def
[PROOF STATE]
proof (prove)
using this:
awalk s ?p2 s \<Longrightarrow> ereal 0 \<le> ereal (awalk_cost c ?p2)

goal (1 subgoal):
 1. ereal 0 \<le> (INF p\<in>{p. awalk s p s}. ereal (awalk_cost c p))
[PROOF STEP]
by (blast intro: INF_greatest)
[PROOF STATE]
proof (state)
this:
ereal 0 \<le> \<mu> c s s

goal (1 subgoal):
 1. \<mu> c s s = ereal 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<mu> c s s \<le> ereal 0
ereal 0 \<le> \<mu> c s s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<mu> c s s \<le> ereal 0
ereal 0 \<le> \<mu> c s s

goal (1 subgoal):
 1. \<mu> c s s = ereal 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<mu> c s s = ereal 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compact_uniformly_equicontinuous:
  assumes "compact S"
      and cont: "\<And>x e. \<lbrakk>x \<in> S; 0 < e\<rbrakk>
                        \<Longrightarrow> \<exists>d. 0 < d \<and>
                                (\<forall>f \<in> \<F>. \<forall>x' \<in> S. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"
      and "0 < e"
  obtains d where "0 < d"
                  "\<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain d where d_pos: "\<And>x e. \<lbrakk>x \<in> S; 0 < e\<rbrakk> \<Longrightarrow> 0 < d x e"
     and d_dist : "\<And>x x' e f. \<lbrakk>dist x' x < d x e; x \<in> S; x' \<in> S; 0 < e; f \<in> \<F>\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>\<And>x e. \<lbrakk>x \<in> S; 0 < e\<rbrakk> \<Longrightarrow> 0 < d x e; \<And>x x' e f. \<lbrakk>dist x' x < d x e; x \<in> S; x' \<in> S; 0 < e; f \<in> \<F>\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cont
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; 0 < ?e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>f\<in>\<F>. \<forall>x'\<in>S. dist x' ?x < d \<longrightarrow> dist (f x') (f ?x) < ?e

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>\<And>x e. \<lbrakk>x \<in> S; 0 < e\<rbrakk> \<Longrightarrow> 0 < d x e; \<And>x x' e f. \<lbrakk>dist x' x < d x e; x \<in> S; x' \<in> S; 0 < e; f \<in> \<F>\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> S; 0 < ?e\<rbrakk> \<Longrightarrow> 0 < d ?x ?e
\<lbrakk>dist ?x' ?x < d ?x ?e; ?x \<in> S; ?x' \<in> S; 0 < ?e; ?f \<in> \<F>\<rbrakk> \<Longrightarrow> dist (?f ?x') (?f ?x) < ?e

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?\<G> = "((\<lambda>x. ball x (d x (e/2))) ` S)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have Ssub: "S \<subseteq> \<Union> ?\<G>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> (\<Union>x\<in>S. ball x (d x (e / 2)))
[PROOF STEP]
by clarsimp (metis d_pos \<open>0 < e\<close> dist_self half_gt_zero_iff)
[PROOF STATE]
proof (state)
this:
S \<subseteq> (\<Union>x\<in>S. ball x (d x (e / 2)))

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> (\<Union>x\<in>S. ball x (d x (e / 2)))
[PROOF STEP]
obtain k where "0 < k" and k: "\<And>x. x \<in> S \<Longrightarrow> \<exists>G \<in> ?\<G>. ball x k \<subseteq> G"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> (\<Union>x\<in>S. ball x (d x (e / 2)))

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>0 < k; \<And>x. x \<in> S \<Longrightarrow> \<exists>G\<in>(\<lambda>x. ball x (d x (e / 2))) ` S. ball x k \<subseteq> G\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule Heine_Borel_lemma [OF \<open>compact S\<close>]) auto
[PROOF STATE]
proof (state)
this:
0 < k
?x \<in> S \<Longrightarrow> \<exists>G\<in>(\<lambda>x. ball x (d x (e / 2))) ` S. ball ?x k \<subseteq> G

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < k
?x \<in> S \<Longrightarrow> \<exists>G\<in>(\<lambda>x. ball x (d x (e / 2))) ` S. ball ?x k \<subseteq> G

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "dist (f v) (f u) < e" if "f \<in> \<F>" "u \<in> S" "v \<in> S" "dist v u < k" for f u v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
obtain G where "G \<in> ?\<G>" "u \<in> G" "v \<in> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>G. \<lbrakk>G \<in> (\<lambda>x. ball x (d x (e / 2))) ` S; u \<in> G; v \<in> G\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using k that
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>G\<in>(\<lambda>x. ball x (d x (e / 2))) ` S. ball ?x k \<subseteq> G
\<lbrakk>?G \<in> (\<lambda>x. ball x (d x (e / 2))) ` S; u \<in> ?G; v \<in> ?G\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>G. \<lbrakk>G \<in> (\<lambda>x. ball x (d x (e / 2))) ` S; u \<in> G; v \<in> G\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis \<open>dist v u < k\<close> \<open>u \<in> S\<close> \<open>0 < k\<close> centre_in_ball subsetD dist_commute mem_ball)
[PROOF STATE]
proof (state)
this:
G \<in> (\<lambda>x. ball x (d x (e / 2))) ` S
u \<in> G
v \<in> G

goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
G \<in> (\<lambda>x. ball x (d x (e / 2))) ` S
u \<in> G
v \<in> G
[PROOF STEP]
obtain w where w: "dist w u < d w (e/2)" "dist w v < d w (e/2)" "w \<in> S"
[PROOF STATE]
proof (prove)
using this:
G \<in> (\<lambda>x. ball x (d x (e / 2))) ` S
u \<in> G
v \<in> G

goal (1 subgoal):
 1. (\<And>w. \<lbrakk>dist w u < d w (e / 2); dist w v < d w (e / 2); w \<in> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist w u < d w (e / 2)
dist w v < d w (e / 2)
w \<in> S

goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
with that d_dist
[PROOF STATE]
proof (chain)
picking this:
f \<in> \<F>
u \<in> S
v \<in> S
dist v u < k
\<lbrakk>dist ?x' ?x < d ?x ?e; ?x \<in> S; ?x' \<in> S; 0 < ?e; ?f \<in> \<F>\<rbrakk> \<Longrightarrow> dist (?f ?x') (?f ?x) < ?e
dist w u < d w (e / 2)
dist w v < d w (e / 2)
w \<in> S
[PROOF STEP]
have "dist (f w) (f v) < e/2"
[PROOF STATE]
proof (prove)
using this:
f \<in> \<F>
u \<in> S
v \<in> S
dist v u < k
\<lbrakk>dist ?x' ?x < d ?x ?e; ?x \<in> S; ?x' \<in> S; 0 < ?e; ?f \<in> \<F>\<rbrakk> \<Longrightarrow> dist (?f ?x') (?f ?x) < ?e
dist w u < d w (e / 2)
dist w v < d w (e / 2)
w \<in> S

goal (1 subgoal):
 1. dist (f w) (f v) < e / 2
[PROOF STEP]
by (metis \<open>0 < e\<close> dist_commute half_gt_zero)
[PROOF STATE]
proof (state)
this:
dist (f w) (f v) < e / 2

goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dist (f w) (f v) < e / 2

goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
have "dist (f w) (f u) < e/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f w) (f u) < e / 2
[PROOF STEP]
using that d_dist w
[PROOF STATE]
proof (prove)
using this:
f \<in> \<F>
u \<in> S
v \<in> S
dist v u < k
\<lbrakk>dist ?x' ?x < d ?x ?e; ?x \<in> S; ?x' \<in> S; 0 < ?e; ?f \<in> \<F>\<rbrakk> \<Longrightarrow> dist (?f ?x') (?f ?x) < ?e
dist w u < d w (e / 2)
dist w v < d w (e / 2)
w \<in> S

goal (1 subgoal):
 1. dist (f w) (f u) < e / 2
[PROOF STEP]
by (metis \<open>0 < e\<close> dist_commute divide_pos_pos zero_less_numeral)
[PROOF STATE]
proof (state)
this:
dist (f w) (f u) < e / 2

goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dist (f w) (f v) < e / 2
dist (f w) (f u) < e / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist (f w) (f v) < e / 2
dist (f w) (f u) < e / 2

goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
using dist_triangle_half_r
[PROOF STATE]
proof (prove)
using this:
dist (f w) (f v) < e / 2
dist (f w) (f u) < e / 2
\<lbrakk>dist ?y ?x1.0 < ?e / 2; dist ?y ?x2.0 < ?e / 2\<rbrakk> \<Longrightarrow> dist ?x1.0 ?x2.0 < ?e

goal (1 subgoal):
 1. dist (f v) (f u) < e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
dist (f v) (f u) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?f \<in> \<F>; ?u \<in> S; ?v \<in> S; dist ?v ?u < k\<rbrakk> \<Longrightarrow> dist (?f ?v) (?f ?u) < e

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < k
?x \<in> S \<Longrightarrow> \<exists>G\<in>(\<lambda>x. ball x (d x (e / 2))) ` S. ball ?x k \<subseteq> G
\<lbrakk>?f \<in> \<F>; ?u \<in> S; ?v \<in> S; dist ?v ?u < k\<rbrakk> \<Longrightarrow> dist (?f ?v) (?f ?u) < e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < k
?x \<in> S \<Longrightarrow> \<exists>G\<in>(\<lambda>x. ball x (d x (e / 2))) ` S. ball ?x k \<subseteq> G
\<lbrakk>?f \<in> \<F>; ?u \<in> S; ?v \<in> S; dist ?v ?u < k\<rbrakk> \<Longrightarrow> dist (?f ?v) (?f ?u) < e

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < k
?x \<in> S \<Longrightarrow> \<exists>G\<in>(\<lambda>x. ball x (d x (e / 2))) ` S. ball ?x k \<subseteq> G
\<lbrakk>?f \<in> \<F>; ?u \<in> S; ?v \<in> S; dist ?v ?u < k\<rbrakk> \<Longrightarrow> dist (?f ?v) (?f ?u) < e
\<lbrakk>0 < ?d; \<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < ?d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Zero_not_eq_One [simp]:
    shows "Zero \<noteq> One"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Zero \<noteq> One
[PROOF STEP]
by (simp add: One_def Zero_def)


[STATEMENT]
lemma INF_approx_ennreal:
  fixes x::ennreal and e::real
  assumes "e > 0"
  assumes INF: "x = (INF i \<in> A. f i)"
  assumes "x \<noteq> \<infinity>"
  shows "\<exists>i \<in> A. f i < x + e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i\<in>A. f i < x + ennreal e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i\<in>A. f i < x + ennreal e
[PROOF STEP]
have "(INF i \<in> A. f i) < x + e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (f ` A) < x + ennreal e
[PROOF STEP]
unfolding INF[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < x + ennreal e
[PROOF STEP]
using \<open>0<e\<close> \<open>x \<noteq> \<infinity>\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e
x \<noteq> \<infinity>

goal (1 subgoal):
 1. x < x + ennreal e
[PROOF STEP]
by (cases x) auto
[PROOF STATE]
proof (state)
this:
Inf (f ` A) < x + ennreal e

goal (1 subgoal):
 1. \<exists>i\<in>A. f i < x + ennreal e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Inf (f ` A) < x + ennreal e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Inf (f ` A) < x + ennreal e

goal (1 subgoal):
 1. \<exists>i\<in>A. f i < x + ennreal e
[PROOF STEP]
unfolding INF_less_iff
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<in>A. f xa < x + ennreal e

goal (1 subgoal):
 1. \<exists>i\<in>A. f i < x + ennreal e
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<exists>i\<in>A. f i < x + ennreal e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma axis_index_axis [simp]:
  fixes UU :: "real^'n"
  shows "(axis_index (axis u 1 :: real^'n)) = (u::'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. axis_index (axis u 1) = u
[PROOF STEP]
by (simp add: axis_eq_axis axis_index_def)


[STATEMENT]
lemma coprod_qbs_closed2: "qbs_closed2 (SIGMA i:I. qbs_space (X i)) (coprod_qbs_Mx I X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_closed2 (SIGMA i:I. qbs_space (X i)) (coprod_qbs_Mx I X)
[PROOF STEP]
proof(rule qbs_closed2I,auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> I; b \<in> qbs_space (X a)\<rbrakk> \<Longrightarrow> (\<lambda>r. (a, b)) \<in> coprod_qbs_Mx I X
[PROOF STEP]
fix i x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> I; b \<in> qbs_space (X a)\<rbrakk> \<Longrightarrow> (\<lambda>r. (a, b)) \<in> coprod_qbs_Mx I X
[PROOF STEP]
assume "i \<in> I" "x \<in> qbs_space (X i)"
[PROOF STATE]
proof (state)
this:
i \<in> I
x \<in> qbs_space (X i)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> I; b \<in> qbs_space (X a)\<rbrakk> \<Longrightarrow> (\<lambda>r. (a, b)) \<in> coprod_qbs_Mx I X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> I
x \<in> qbs_space (X i)
[PROOF STEP]
show "(\<lambda>r. (i,x)) \<in> coprod_qbs_Mx I X"
[PROOF STATE]
proof (prove)
using this:
i \<in> I
x \<in> qbs_space (X i)

goal (1 subgoal):
 1. (\<lambda>r. (i, x)) \<in> coprod_qbs_Mx I X
[PROOF STEP]
by(auto simp: coprod_qbs_Mx_def intro!: exI[where x="\<lambda>r. i"])
[PROOF STATE]
proof (state)
this:
(\<lambda>r. (i, x)) \<in> coprod_qbs_Mx I X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma OrdP_IN_SUCC_lemma: "{OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (rule OrdP_linear [of _ "SUCC x" "SUCC y"])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. {OrdP x, y IN x} \<turnstile> OrdP (SUCC x)
 2. {OrdP x, y IN x} \<turnstile> OrdP (SUCC y)
 3. {SUCC x IN SUCC y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 4. {SUCC x EQ SUCC y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 5. {SUCC y IN SUCC x, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (auto intro!: Mem_SUCC_EH  intro: OrdP_SUCC_I Ord_IN_Ord0)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. {SUCC x IN y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 2. {SUCC x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 3. {x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (metis Hyp Mem_SUCC_I1 Mem_not_sym cut_same insertCI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {SUCC x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 2. {x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (metis Assume EQ_imp_SUBS Mem_SUCC_I1 Mem_non_refl Subset_D thin1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (blast intro: cut_same [OF Mem_cong [THEN Iff_MP2_same]])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma finite_fv[simp]: "finite (fv (e::'a::fs) :: ('b::at_base) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (fv e)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (fv e)
[PROOF STEP]
have "finite (supp e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (supp e)
[PROOF STEP]
by (metis finite_supp)
[PROOF STATE]
proof (state)
this:
finite (supp e)

goal (1 subgoal):
 1. finite (fv e)
[PROOF STEP]
hence "finite (atom -` supp e :: 'b set)"
[PROOF STATE]
proof (prove)
using this:
finite (supp e)

goal (1 subgoal):
 1. finite (atom -` supp e)
[PROOF STEP]
apply (rule finite_vimageI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj atom
[PROOF STEP]
apply (rule inj_onI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; atom x = atom y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
finite (atom -` supp e)

goal (1 subgoal):
 1. finite (fv e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (atom -` supp e)

goal (1 subgoal):
 1. finite (fv e)
[PROOF STEP]
have "(atom -` supp e  :: 'b set) = fv e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atom -` supp e = fv e
[PROOF STEP]
unfolding fv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atom -` supp e = {v. atom v \<in> supp e}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
atom -` supp e = fv e

goal (1 subgoal):
 1. finite (fv e)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (atom -` supp e)
atom -` supp e = fv e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (atom -` supp e)
atom -` supp e = fv e

goal (1 subgoal):
 1. finite (fv e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (fv e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_iff_length_cond:
  assumes "length p1 = length p2"
  shows "p1 = p2 \<longleftrightarrow> coeff p1 = coeff p2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p1 = p2) = (local.coeff p1 = local.coeff p2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p1 = p2 \<Longrightarrow> local.coeff p1 = local.coeff p2
 2. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
show "p1 = p2 \<Longrightarrow> coeff p1 = coeff p2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p1 = p2 \<Longrightarrow> local.coeff p1 = local.coeff p2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p1 = p2 \<Longrightarrow> local.coeff p1 = local.coeff p2

goal (1 subgoal):
 1. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
assume A: "coeff p1 = coeff p2"
[PROOF STATE]
proof (state)
this:
local.coeff p1 = local.coeff p2

goal (1 subgoal):
 1. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
have "p1 = map (coeff p1) (rev [0..< length p1])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p1 = map (local.coeff p1) (rev [0..<length p1])
[PROOF STEP]
using coeff_list[of p1]
[PROOF STATE]
proof (prove)
using this:
map (local.coeff p1) (rev [0..<length p1]) = p1

goal (1 subgoal):
 1. p1 = map (local.coeff p1) (rev [0..<length p1])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p1 = map (local.coeff p1) (rev [0..<length p1])

goal (1 subgoal):
 1. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p1 = map (local.coeff p1) (rev [0..<length p1])

goal (1 subgoal):
 1. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
have " ... = map (coeff p2) (rev [0..< length p2])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (local.coeff p1) (rev [0..<length p1]) = map (local.coeff p2) (rev [0..<length p2])
[PROOF STEP]
using A assms
[PROOF STATE]
proof (prove)
using this:
local.coeff p1 = local.coeff p2
length p1 = length p2

goal (1 subgoal):
 1. map (local.coeff p1) (rev [0..<length p1]) = map (local.coeff p2) (rev [0..<length p2])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map (local.coeff p1) (rev [0..<length p1]) = map (local.coeff p2) (rev [0..<length p2])

goal (1 subgoal):
 1. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map (local.coeff p1) (rev [0..<length p1]) = map (local.coeff p2) (rev [0..<length p2])

goal (1 subgoal):
 1. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
have " ... = p2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (local.coeff p2) (rev [0..<length p2]) = p2
[PROOF STEP]
using coeff_list[of p2]
[PROOF STATE]
proof (prove)
using this:
map (local.coeff p2) (rev [0..<length p2]) = p2

goal (1 subgoal):
 1. map (local.coeff p2) (rev [0..<length p2]) = p2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map (local.coeff p2) (rev [0..<length p2]) = p2

goal (1 subgoal):
 1. local.coeff p1 = local.coeff p2 \<Longrightarrow> p1 = p2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p1 = p2
[PROOF STEP]
show "p1 = p2"
[PROOF STATE]
proof (prove)
using this:
p1 = p2

goal (1 subgoal):
 1. p1 = p2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
p1 = p2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vcard_mono:
  assumes "A \<subseteq>\<^sub>\<circ> B"
  shows "vcard A \<le> vcard B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard A \<subseteq>\<^sub>\<circ> vcard B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq>\<^sub>\<circ> B

goal (1 subgoal):
 1. vcard A \<subseteq>\<^sub>\<circ> vcard B
[PROOF STEP]
by (simp add: lepoll_imp_Card_le vlepoll_vsubset)


[STATEMENT]
lemma XXX :
"isPrime_core n \<equiv>
     if\<^sub>C (\<lambda>\<sigma>. n < 2) then (return\<^bsub>result_value_update\<^esub> (\<lambda>\<sigma>. False))
                     else skip\<^sub>S\<^sub>E fi;-
     i_update :==\<^sub>L (\<lambda>\<sigma>. 2) ;-
     while\<^sub>C (\<lambda>\<sigma>. (hd\<circ>i)\<sigma> < SQRT_UINT_MAX \<and> (hd\<circ>i)\<sigma> * (hd\<circ>i)\<sigma> \<le> n)
     do
        (if\<^sub>C (\<lambda>\<sigma>. n mod (hd \<circ> i) \<sigma> = 0)
         then (return\<^bsub>result_value_update\<^esub> (\<lambda>\<sigma>. False))
         else skip\<^sub>S\<^sub>E fi ;-
        i_update :==\<^sub>L (\<lambda>\<sigma>. (hd \<circ> i) \<sigma> + 1))
     od ;-
     return\<^bsub>result_value_update\<^esub> (\<lambda>\<sigma>. True)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isPrime_core n \<equiv> _if_SECLEAN (\<lambda>\<sigma>. n < 2) (return\<^bsub>result_value_update\<^esub> (\<lambda>\<sigma>. False)) skip\<^sub>S\<^sub>E ;- i_update :==\<^sub>L (\<lambda>\<sigma>. 2) ;- _while_C (\<lambda>\<sigma>. (hd \<circ> i) \<sigma> < SQRT_UINT_MAX \<and> (hd \<circ> i) \<sigma> * (hd \<circ> i) \<sigma> \<le> n) (_if_SECLEAN (\<lambda>\<sigma>. n mod (hd \<circ> i) \<sigma> = 0) (return\<^bsub>result_value_update\<^esub> (\<lambda>\<sigma>. False)) skip\<^sub>S\<^sub>E ;- i_update :==\<^sub>L (\<lambda>\<sigma>. (hd \<circ> i) \<sigma> + 1)) ;- return\<^bsub>result_value_update\<^esub> (\<lambda>\<sigma>. True)
[PROOF STEP]
by(simp add: isPrime_core_def)


[STATEMENT]
lemma condition_1_part_1:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  assumes zero_column_k: "\<forall>m\<ge>from_nat 0. A $ m $ from_nat k = 0"
  and all_zero: "\<forall>m. is_zero_row_upt_k m k A"
  shows "is_zero_row_upt_k j (Suc k) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k j (Suc k) A
[PROOF STEP]
unfolding is_zero_row_upt_k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ja. mod_type_class.to_nat ja < Suc k \<longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ja. mod_type_class.to_nat ja < Suc k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ja. mod_type_class.to_nat ja < Suc k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
fix ja::'columns
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ja. mod_type_class.to_nat ja < Suc k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
assume ja_less_suc_k: "to_nat ja < Suc k"
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat ja < Suc k

goal (1 subgoal):
 1. \<And>ja. mod_type_class.to_nat ja < Suc k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
show "A $ j $ ja = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ j $ ja = (0::'a)
[PROOF STEP]
proof (cases "to_nat ja < k")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mod_type_class.to_nat ja < k \<Longrightarrow> A $ j $ ja = (0::'a)
 2. \<not> mod_type_class.to_nat ja < k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat ja < k

goal (2 subgoals):
 1. mod_type_class.to_nat ja < k \<Longrightarrow> A $ j $ ja = (0::'a)
 2. \<not> mod_type_class.to_nat ja < k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat ja < k

goal (1 subgoal):
 1. A $ j $ ja = (0::'a)
[PROOF STEP]
using all_zero
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat ja < k
\<forall>m. is_zero_row_upt_k m k A

goal (1 subgoal):
 1. A $ j $ ja = (0::'a)
[PROOF STEP]
unfolding is_zero_row_upt_k_def
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat ja < k
\<forall>m j. mod_type_class.to_nat j < k \<longrightarrow> A $ m $ j = (0::'a)

goal (1 subgoal):
 1. A $ j $ ja = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A $ j $ ja = (0::'a)

goal (1 subgoal):
 1. \<not> mod_type_class.to_nat ja < k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> mod_type_class.to_nat ja < k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> mod_type_class.to_nat ja < k

goal (1 subgoal):
 1. \<not> mod_type_class.to_nat ja < k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
hence ja_eq_k: "k = to_nat ja "
[PROOF STATE]
proof (prove)
using this:
\<not> mod_type_class.to_nat ja < k

goal (1 subgoal):
 1. k = mod_type_class.to_nat ja
[PROOF STEP]
using ja_less_suc_k
[PROOF STATE]
proof (prove)
using this:
\<not> mod_type_class.to_nat ja < k
mod_type_class.to_nat ja < Suc k

goal (1 subgoal):
 1. k = mod_type_class.to_nat ja
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k = mod_type_class.to_nat ja

goal (1 subgoal):
 1. \<not> mod_type_class.to_nat ja < k \<Longrightarrow> A $ j $ ja = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ j $ ja = (0::'a)
[PROOF STEP]
using zero_column_k
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)

goal (1 subgoal):
 1. A $ j $ ja = (0::'a)
[PROOF STEP]
unfolding ja_eq_k from_nat_to_nat_id from_nat_0
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<ge>0::'rows. A $ m $ ja = (0::'a)

goal (1 subgoal):
 1. A $ j $ ja = (0::'a)
[PROOF STEP]
using least_mod_type
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<ge>0::'rows. A $ m $ ja = (0::'a)
(0::?'a) \<le> ?n

goal (1 subgoal):
 1. A $ j $ ja = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A $ j $ ja = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A $ j $ ja = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded S = (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)
[PROOF STEP]
unfolding bounded_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e) = (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)
[PROOF STEP]
by auto (metis add.commute add_le_cancel_right dist_commute dist_triangle_le)


[STATEMENT]
lemma to_Gromov_completion_inj:
  "inj to_Gromov_completion"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj to_Gromov_completion
[PROOF STEP]
proof (rule injI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. to_Gromov_completion x = to_Gromov_completion y \<Longrightarrow> x = y
[PROOF STEP]
fix x y::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. to_Gromov_completion x = to_Gromov_completion y \<Longrightarrow> x = y
[PROOF STEP]
assume H: "to_Gromov_completion x = to_Gromov_completion y"
[PROOF STATE]
proof (state)
this:
to_Gromov_completion x = to_Gromov_completion y

goal (1 subgoal):
 1. \<And>x y. to_Gromov_completion x = to_Gromov_completion y \<Longrightarrow> x = y
[PROOF STEP]
have "Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. y)
[PROOF STEP]
apply (subst Quotient3_rel[OF Quotient3_Gromov_completion, symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. x) \<and> Gromov_completion_rel (\<lambda>n. y) (\<lambda>n. y) \<and> abs_Gromov_completion (\<lambda>n. x) = abs_Gromov_completion (\<lambda>n. y)
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
to_Gromov_completion x = to_Gromov_completion y

goal (1 subgoal):
 1. Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. x) \<and> Gromov_completion_rel (\<lambda>n. y) (\<lambda>n. y) \<and> abs_Gromov_completion (\<lambda>n. x) = abs_Gromov_completion (\<lambda>n. y)
[PROOF STEP]
unfolding to_Gromov_completion_def
[PROOF STATE]
proof (prove)
using this:
abs_Gromov_completion (\<lambda>n. x) = abs_Gromov_completion (\<lambda>n. y)

goal (1 subgoal):
 1. Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. x) \<and> Gromov_completion_rel (\<lambda>n. y) (\<lambda>n. y) \<and> abs_Gromov_completion (\<lambda>n. x) = abs_Gromov_completion (\<lambda>n. y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. y)

goal (1 subgoal):
 1. \<And>x y. to_Gromov_completion x = to_Gromov_completion y \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. y)
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. y)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using Gromov_completion_rel_to_const
[PROOF STATE]
proof (prove)
using this:
Gromov_completion_rel (\<lambda>n. x) (\<lambda>n. y)
Gromov_completion_rel ?u (\<lambda>n. ?x) \<Longrightarrow> ?u ?n = ?x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma steps_empty_preserves_le: assumes "step S cs = cs"
shows "cs' \<le> cs \<Longrightarrow> (step {} ^^ n) cs' \<le> cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cs' \<le> cs \<Longrightarrow> (step {} ^^ n) cs' \<le> cs
[PROOF STEP]
proof(induction n arbitrary: cs')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>cs'. cs' \<le> cs \<Longrightarrow> (step {} ^^ 0) cs' \<le> cs
 2. \<And>n cs'. \<lbrakk>\<And>cs'. cs' \<le> cs \<Longrightarrow> (step {} ^^ n) cs' \<le> cs; cs' \<le> cs\<rbrakk> \<Longrightarrow> (step {} ^^ Suc n) cs' \<le> cs
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
cs' \<le> cs

goal (2 subgoals):
 1. \<And>cs'. cs' \<le> cs \<Longrightarrow> (step {} ^^ 0) cs' \<le> cs
 2. \<And>n cs'. \<lbrakk>\<And>cs'. cs' \<le> cs \<Longrightarrow> (step {} ^^ n) cs' \<le> cs; cs' \<le> cs\<rbrakk> \<Longrightarrow> (step {} ^^ Suc n) cs' \<le> cs
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
cs' \<le> cs

goal (1 subgoal):
 1. (step {} ^^ 0) cs' \<le> cs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(step {} ^^ 0) cs' \<le> cs

goal (1 subgoal):
 1. \<And>n cs'. \<lbrakk>\<And>cs'. cs' \<le> cs \<Longrightarrow> (step {} ^^ n) cs' \<le> cs; cs' \<le> cs\<rbrakk> \<Longrightarrow> (step {} ^^ Suc n) cs' \<le> cs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n cs'. \<lbrakk>\<And>cs'. cs' \<le> cs \<Longrightarrow> (step {} ^^ n) cs' \<le> cs; cs' \<le> cs\<rbrakk> \<Longrightarrow> (step {} ^^ Suc n) cs' \<le> cs
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
?cs' \<le> cs \<Longrightarrow> (step {} ^^ n) ?cs' \<le> cs
cs' \<le> cs

goal (1 subgoal):
 1. \<And>n cs'. \<lbrakk>\<And>cs'. cs' \<le> cs \<Longrightarrow> (step {} ^^ n) cs' \<le> cs; cs' \<le> cs\<rbrakk> \<Longrightarrow> (step {} ^^ Suc n) cs' \<le> cs
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
?cs' \<le> cs \<Longrightarrow> (step {} ^^ n) ?cs' \<le> cs
cs' \<le> cs

goal (1 subgoal):
 1. (step {} ^^ Suc n) cs' \<le> cs
[PROOF STEP]
using Suc.IH[OF step_preserves_le[OF assms empty_subsetI Suc.prems]]
[PROOF STATE]
proof (prove)
using this:
?cs' \<le> cs \<Longrightarrow> (step {} ^^ n) ?cs' \<le> cs
cs' \<le> cs
(step {} ^^ n) (step {} cs') \<le> cs

goal (1 subgoal):
 1. (step {} ^^ Suc n) cs' \<le> cs
[PROOF STEP]
by(simp add:funpow_swap1)
[PROOF STATE]
proof (state)
this:
(step {} ^^ Suc n) cs' \<le> cs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma the_inverseD:
  assumes   "g\<in>G"
  shows     "\<ii> g \<in> G" "binop g (\<ii> g) = e" "binop (\<ii> g) g = e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<ii> g \<in> G &&& binop g (\<ii> g) = e &&& binop (\<ii> g) g = e
[PROOF STEP]
using     assms theI'[OF unique_inverse]
[PROOF STATE]
proof (prove)
using this:
g \<in> G
?g1 \<in> G \<Longrightarrow> (THE x. x \<in> G \<and> binop ?g1 x = e \<and> binop x ?g1 = e) \<in> G \<and> binop ?g1 (THE x. x \<in> G \<and> binop ?g1 x = e \<and> binop x ?g1 = e) = e \<and> binop (THE x. x \<in> G \<and> binop ?g1 x = e \<and> binop x ?g1 = e) ?g1 = e

goal (1 subgoal):
 1. \<ii> g \<in> G &&& binop g (\<ii> g) = e &&& binop (\<ii> g) g = e
[PROOF STEP]
unfolding the_inverse_def
[PROOF STATE]
proof (prove)
using this:
g \<in> G
?g1 \<in> G \<Longrightarrow> (THE x. x \<in> G \<and> binop ?g1 x = e \<and> binop x ?g1 = e) \<in> G \<and> binop ?g1 (THE x. x \<in> G \<and> binop ?g1 x = e \<and> binop x ?g1 = e) = e \<and> binop (THE x. x \<in> G \<and> binop ?g1 x = e \<and> binop x ?g1 = e) ?g1 = e

goal (1 subgoal):
 1. (THE h. h \<in> G \<and> binop g h = e \<and> binop h g = e) \<in> G &&& binop g (THE h. h \<in> G \<and> binop g h = e \<and> binop h g = e) = e &&& binop (THE h. h \<in> G \<and> binop g h = e \<and> binop h g = e) g = e
[PROOF STEP]
by        auto


[STATEMENT]
lemma prime_factorization_Gcd_factorial:
  assumes "\<not>A \<subseteq> {0}"
  shows   "prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<not> A \<subseteq> {0::'a}
[PROOF STEP]
obtain x where x: "x \<in> A - {0}"
[PROOF STATE]
proof (prove)
using this:
\<not> A \<subseteq> {0::'a}

goal (1 subgoal):
 1. (\<And>x. x \<in> A - {0::'a} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> A - {0::'a}

goal (1 subgoal):
 1. prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
hence "Inf (prime_factorization ` (A - {0})) \<subseteq># prime_factorization x"
[PROOF STATE]
proof (prove)
using this:
x \<in> A - {0::'a}

goal (1 subgoal):
 1. Inf (prime_factorization ` (A - {0::'a})) \<subseteq># prime_factorization x
[PROOF STEP]
by (intro subset_mset.cInf_lower) simp_all
[PROOF STATE]
proof (state)
this:
Inf (prime_factorization ` (A - {0::'a})) \<subseteq># prime_factorization x

goal (1 subgoal):
 1. prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
hence "\<forall>y. y \<in># Inf (prime_factorization ` (A - {0})) \<longrightarrow> y \<in> prime_factors x"
[PROOF STATE]
proof (prove)
using this:
Inf (prime_factorization ` (A - {0::'a})) \<subseteq># prime_factorization x

goal (1 subgoal):
 1. \<forall>y. y \<in># Inf (prime_factorization ` (A - {0::'a})) \<longrightarrow> y \<in> prime_factors x
[PROOF STEP]
by (auto dest: mset_subset_eqD)
[PROOF STATE]
proof (state)
this:
\<forall>y. y \<in># Inf (prime_factorization ` (A - {0::'a})) \<longrightarrow> y \<in> prime_factors x

goal (1 subgoal):
 1. prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
with in_prime_factors_imp_prime[of _ x]
[PROOF STATE]
proof (chain)
picking this:
?p \<in> prime_factors x \<Longrightarrow> prime ?p
\<forall>y. y \<in># Inf (prime_factorization ` (A - {0::'a})) \<longrightarrow> y \<in> prime_factors x
[PROOF STEP]
have "\<forall>p. p \<in># Inf (prime_factorization ` (A - {0})) \<longrightarrow> prime p"
[PROOF STATE]
proof (prove)
using this:
?p \<in> prime_factors x \<Longrightarrow> prime ?p
\<forall>y. y \<in># Inf (prime_factorization ` (A - {0::'a})) \<longrightarrow> y \<in> prime_factors x

goal (1 subgoal):
 1. \<forall>p. p \<in># Inf (prime_factorization ` (A - {0::'a})) \<longrightarrow> prime p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>p. p \<in># Inf (prime_factorization ` (A - {0::'a})) \<longrightarrow> prime p

goal (1 subgoal):
 1. prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
\<not> A \<subseteq> {0::'a}
\<forall>p. p \<in># Inf (prime_factorization ` (A - {0::'a})) \<longrightarrow> prime p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> A \<subseteq> {0::'a}
\<forall>p. p \<in># Inf (prime_factorization ` (A - {0::'a})) \<longrightarrow> prime p

goal (1 subgoal):
 1. prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
by (simp add: Gcd_factorial_def prime_factorization_prod_mset_primes)
[PROOF STATE]
proof (state)
this:
prime_factorization (Gcd_factorial A) = Inf (prime_factorization ` (A - {0::'a}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_fun_id [simp]: "poly_fun (\<lambda>x. x)" "poly_fun id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_fun (\<lambda>x. x) &&& poly_fun id
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly_fun (\<lambda>x. x)
 2. poly_fun id
[PROOF STEP]
show "poly_fun (\<lambda>x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_fun (\<lambda>x. x)
[PROOF STEP]
by (rule poly_funI[where p="[:0, 1:]"]) simp
[PROOF STATE]
proof (state)
this:
poly_fun (\<lambda>x. x)

goal (1 subgoal):
 1. poly_fun id
[PROOF STEP]
thus "poly_fun id"
[PROOF STATE]
proof (prove)
using this:
poly_fun (\<lambda>x. x)

goal (1 subgoal):
 1. poly_fun id
[PROOF STEP]
by (simp only: id_def)
[PROOF STATE]
proof (state)
this:
poly_fun id

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fresh2_list[code]:
  "fresh2 (set xs) x y =
     (if x \<notin> set xs then x else
      if y \<notin> set xs then y else
      fresh2 (set xs) (x-1) (y+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fresh2 (set xs) x y = (if x \<notin> set xs then x else if y \<notin> set xs then y else fresh2 (set xs) (x - 1) (y + 1))
[PROOF STEP]
by (auto simp: fresh2.simps)


[STATEMENT]
lemma poly_add_append_zero:
  assumes "set p \<subseteq> carrier R" "set q \<subseteq> carrier R"
  shows "poly_add (p @ [ \<zero> ]) (q @ [ \<zero> ]) = normalize ((poly_add p q) @ [ \<zero> ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
have in_carrier: "set (p @ [ \<zero> ]) \<subseteq> carrier R" "set (q @ [ \<zero> ]) \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (p @ [\<zero>]) \<subseteq> carrier R &&& set (q @ [\<zero>]) \<subseteq> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set p \<subseteq> carrier R
set q \<subseteq> carrier R

goal (1 subgoal):
 1. set (p @ [\<zero>]) \<subseteq> carrier R &&& set (q @ [\<zero>]) \<subseteq> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (p @ [\<zero>]) \<subseteq> carrier R
set (q @ [\<zero>]) \<subseteq> carrier R

goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
have "coeff (poly_add (p @ [ \<zero> ]) (q @ [ \<zero> ])) = coeff ((poly_add p q) @ [ \<zero> ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (poly_add p q @ [\<zero>])
[PROOF STEP]
using append_coeff[of p "[ \<zero> ]"] poly_add_coeff[OF in_carrier]
          append_coeff[of q "[ \<zero> ]"] append_coeff[of "poly_add p q" "[ \<zero> ]"]
          poly_add_coeff[OF assms] assms[THEN coeff_in_carrier]
[PROOF STATE]
proof (prove)
using this:
local.coeff (p @ [\<zero>]) = (\<lambda>i. if i < length [\<zero>] then local.coeff [\<zero>] i else local.coeff p (i - length [\<zero>]))
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = (\<lambda>i. local.coeff (p @ [\<zero>]) i \<oplus> local.coeff (q @ [\<zero>]) i)
local.coeff (q @ [\<zero>]) = (\<lambda>i. if i < length [\<zero>] then local.coeff [\<zero>] i else local.coeff q (i - length [\<zero>]))
local.coeff (poly_add p q @ [\<zero>]) = (\<lambda>i. if i < length [\<zero>] then local.coeff [\<zero>] i else local.coeff (poly_add p q) (i - length [\<zero>]))
local.coeff (poly_add p q) = (\<lambda>i. local.coeff p i \<oplus> local.coeff q i)
local.coeff p ?i \<in> carrier R
local.coeff q ?i \<in> carrier R

goal (1 subgoal):
 1. local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (poly_add p q @ [\<zero>])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (poly_add p q @ [\<zero>])

goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
hence "coeff (poly_add (p @ [ \<zero> ]) (q @ [ \<zero> ])) = coeff (normalize ((poly_add p q) @ [ \<zero> ]))"
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (poly_add p q @ [\<zero>])

goal (1 subgoal):
 1. local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (local.normalize (poly_add p q @ [\<zero>]))
[PROOF STEP]
using normalize_coeff
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (poly_add p q @ [\<zero>])
local.coeff ?p = local.coeff (local.normalize ?p)

goal (1 subgoal):
 1. local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (local.normalize (poly_add p q @ [\<zero>]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (local.normalize (poly_add p q @ [\<zero>]))

goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (local.normalize (poly_add p q @ [\<zero>]))

goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
have "set ((poly_add p q) @ [ \<zero> ]) \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (poly_add p q @ [\<zero>]) \<subseteq> carrier R
[PROOF STEP]
using poly_add_in_carrier[OF assms]
[PROOF STATE]
proof (prove)
using this:
set (poly_add p q) \<subseteq> carrier R

goal (1 subgoal):
 1. set (poly_add p q @ [\<zero>]) \<subseteq> carrier R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (poly_add p q @ [\<zero>]) \<subseteq> carrier R

goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (local.normalize (poly_add p q @ [\<zero>]))
set (poly_add p q @ [\<zero>]) \<subseteq> carrier R
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (local.normalize (poly_add p q @ [\<zero>]))
set (poly_add p q @ [\<zero>]) \<subseteq> carrier R

goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
using coeff_iff_polynomial_cond[OF poly_add_is_polynomial[OF carrier_is_subring in_carrier]
          normalize_gives_polynomial]
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (local.normalize (poly_add p q @ [\<zero>]))
set (poly_add p q @ [\<zero>]) \<subseteq> carrier R
set ?p1 \<subseteq> carrier R \<Longrightarrow> (poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize ?p1) = (local.coeff (poly_add (p @ [\<zero>]) (q @ [\<zero>])) = local.coeff (local.normalize ?p1))

goal (1 subgoal):
 1. poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_add (p @ [\<zero>]) (q @ [\<zero>]) = local.normalize (poly_add p q @ [\<zero>])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma symm_closure_of_symm_rel:
  fixes Rel :: "('a \<times> 'a) set"
  assumes "sym Rel"
  shows "symcl Rel = Rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symcl Rel = Rel
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sym Rel

goal (1 subgoal):
 1. symcl Rel = Rel
[PROOF STEP]
unfolding symcl_def sym_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. (x, y) \<in> Rel \<longrightarrow> (y, x) \<in> Rel

goal (1 subgoal):
 1. Rel \<union> Rel\<inverse> = Rel
[PROOF STEP]
by auto


[STATEMENT]
lemma if_then_None_else_Some_eq[simp]:
  "(if a then None else Some b) = Some c \<longleftrightarrow> \<not> a \<and> b = c"
  "(if a then None else Some b) = None \<longleftrightarrow> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if a then None else Some b) = Some c) = (\<not> a \<and> b = c) &&& ((if a then None else Some b) = None) = a
[PROOF STEP]
by (cases a) simp_all


[STATEMENT]
lemma diag_mat_zero[simp]: "diag_mat (0\<^sub>m n n) = replicate n 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_mat (0\<^sub>m n n) = replicate n (0::'a)
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. 0\<^sub>m n n $$ (i, i)) [0..<dim_row (0\<^sub>m n n)] = replicate n (0::'a)
[PROOF STEP]
by (rule nth_equalityI, auto)


[STATEMENT]
lemma restrict_linorder: "\<lbrakk>linorder_on D cmp ; D'\<subseteq>D\<rbrakk> \<Longrightarrow> linorder_on D' cmp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>linorder_on D cmp; D' \<subseteq> D\<rbrakk> \<Longrightarrow> linorder_on D' cmp
[PROOF STEP]
apply (rule linorder_on.intro)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>x y. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'\<rbrakk> \<Longrightarrow> (cmp x y = LESS) = (cmp y x = GREATER)
 2. \<And>x. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'\<rbrakk> \<Longrightarrow> cmp x x = EQUAL
 3. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 4. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = LESS
 5. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 6. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (drule (1) rev_subsetD)+
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>x y. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D; y \<in> D\<rbrakk> \<Longrightarrow> (cmp x y = LESS) = (cmp y x = GREATER)
 2. \<And>x. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'\<rbrakk> \<Longrightarrow> cmp x x = EQUAL
 3. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 4. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = LESS
 5. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 6. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (erule (2) linorder_on.lt_eq)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>x. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'\<rbrakk> \<Longrightarrow> cmp x x = EQUAL
 2. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 3. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = LESS
 4. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 5. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (drule (1) rev_subsetD)+
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>x. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D\<rbrakk> \<Longrightarrow> cmp x x = EQUAL
 2. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 3. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = LESS
 4. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 5. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (erule (1) linorder_on.refl)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 2. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = LESS
 3. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 4. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (drule (1) rev_subsetD)+
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; cmp x y = LESS; cmp y z = LESS; x \<in> D; y \<in> D; z \<in> D\<rbrakk> \<Longrightarrow> cmp x z = LESS
 2. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = LESS
 3. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 4. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (erule (5) linorder_on.trans)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = LESS; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = LESS
 2. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 3. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (drule (1) rev_subsetD)+
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; cmp x y = LESS; cmp y z = EQUAL; x \<in> D; y \<in> D; z \<in> D\<rbrakk> \<Longrightarrow> cmp x z = LESS
 2. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 3. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (erule (5) linorder_on.trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = LESS\<rbrakk> \<Longrightarrow> cmp x z = LESS
 2. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (drule (1) rev_subsetD)+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; cmp x y = EQUAL; cmp y z = LESS; x \<in> D; y \<in> D; z \<in> D\<rbrakk> \<Longrightarrow> cmp x z = LESS
 2. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (erule (5) linorder_on.trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; x \<in> D'; y \<in> D'; z \<in> D'; cmp x y = EQUAL; cmp y z = EQUAL\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (drule (1) rev_subsetD)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>linorder_on D cmp; D' \<subseteq> D; cmp x y = EQUAL; cmp y z = EQUAL; x \<in> D; y \<in> D; z \<in> D\<rbrakk> \<Longrightarrow> cmp x z = EQUAL
[PROOF STEP]
apply (erule (5) linorder_on.trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ltakeWhile_eq_LNil_iff: "ltakeWhile P xs = LNil \<longleftrightarrow> (xs \<noteq> LNil \<longrightarrow> \<not> P (lhd xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ltakeWhile P xs = LNil) = (xs \<noteq> LNil \<longrightarrow> \<not> P (lhd xs))
[PROOF STEP]
using lnull_ltakeWhile
[PROOF STATE]
proof (prove)
using this:
lnull (ltakeWhile ?P ?xs) = (\<not> lnull ?xs \<longrightarrow> \<not> ?P (lhd ?xs))

goal (1 subgoal):
 1. (ltakeWhile P xs = LNil) = (xs \<noteq> LNil \<longrightarrow> \<not> P (lhd xs))
[PROOF STEP]
unfolding lnull_def
[PROOF STATE]
proof (prove)
using this:
(ltakeWhile ?P ?xs = LNil) = (?xs \<noteq> LNil \<longrightarrow> \<not> ?P (lhd ?xs))

goal (1 subgoal):
 1. (ltakeWhile P xs = LNil) = (xs \<noteq> LNil \<longrightarrow> \<not> P (lhd xs))
[PROOF STEP]
.


[STATEMENT]
lemma finite_triangle_set:
  assumes fin: "finite (uverts G)" and wf: "uwellformed G"
  shows "finite (triangle_set G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (triangle_set G)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (triangle_set G)
[PROOF STEP]
have "triangle_set G \<subseteq> Pow (uverts G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. triangle_set G \<subseteq> Pow (uverts G)
[PROOF STEP]
using PowI local.wf triangle_in_graph_def triangle_set_def uwellformed_def
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> ?B \<Longrightarrow> ?A \<in> Pow ?B
uwellformed G
triangle_in_graph ?x ?y ?z ?G \<equiv> {?x, ?y} \<in> uedges ?G \<and> {?y, ?z} \<in> uedges ?G \<and> {?x, ?z} \<in> uedges ?G
triangle_set ?G \<equiv> {{x, y, z} |x y z. triangle_in_graph x y z ?G}
uwellformed ?G \<equiv> \<forall>e\<in>uedges ?G. card e = 2 \<and> (\<forall>u\<in>e. u \<in> uverts ?G)

goal (1 subgoal):
 1. triangle_set G \<subseteq> Pow (uverts G)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
triangle_set G \<subseteq> Pow (uverts G)

goal (1 subgoal):
 1. finite (triangle_set G)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
triangle_set G \<subseteq> Pow (uverts G)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
triangle_set G \<subseteq> Pow (uverts G)

goal (1 subgoal):
 1. finite (triangle_set G)
[PROOF STEP]
by (meson fin finite_Pow_iff infinite_super)
[PROOF STATE]
proof (state)
this:
finite (triangle_set G)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subst_simp_pair:
  shows "(Pair A B)[x ::= M] = Pair (A[x ::= M]) (B[x ::= M])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SimplyTyped.Pair A B[x ::= M] = SimplyTyped.Pair A[x ::= M] B[x ::= M]
[PROOF STEP]
unfolding subst_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE X. substitutes (SimplyTyped.Pair A B) x M X) = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))
 2. \<And>X. substitutes (SimplyTyped.Pair A B) x M X \<Longrightarrow> X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
obtain A' B' where A': "A' = (A[x ::= M])" and B': "B' = (B[x ::= M])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A' B'. \<lbrakk>A' = A[x ::= M]; B' = B[x ::= M]\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' = A[x ::= M]
B' = B[x ::= M]

goal (2 subgoals):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))
 2. \<And>X. substitutes (SimplyTyped.Pair A B) x M X \<Longrightarrow> X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
hence "substitutes A x M A'" "substitutes B x M B'"
[PROOF STATE]
proof (prove)
using this:
A' = A[x ::= M]
B' = B[x ::= M]

goal (1 subgoal):
 1. substitutes A x M A' &&& substitutes B x M B'
[PROOF STEP]
unfolding subst_def
[PROOF STATE]
proof (prove)
using this:
A' = (THE X. substitutes A x M X)
B' = (THE X. substitutes B x M X)

goal (1 subgoal):
 1. substitutes A x M A' &&& substitutes B x M B'
[PROOF STEP]
using substitutes_function theI
[PROOF STATE]
proof (prove)
using this:
A' = (THE X. substitutes A x M X)
B' = (THE X. substitutes B x M X)
\<exists>!X. substitutes ?A ?x ?M X
\<lbrakk>?P ?a; \<And>x. ?P x \<Longrightarrow> x = ?a\<rbrakk> \<Longrightarrow> ?P (THE x. ?P x)

goal (1 subgoal):
 1. substitutes A x M A' &&& substitutes B x M B'
[PROOF STEP]
by metis+
[PROOF STATE]
proof (state)
this:
substitutes A x M A'
substitutes B x M B'

goal (2 subgoals):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))
 2. \<And>X. substitutes (SimplyTyped.Pair A B) x M X \<Longrightarrow> X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
hence "substitutes (Pair A B) x M (Pair A' B')"
[PROOF STATE]
proof (prove)
using this:
substitutes A x M A'
substitutes B x M B'

goal (1 subgoal):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair A' B')
[PROOF STEP]
using substitutes.pair
[PROOF STATE]
proof (prove)
using this:
substitutes A x M A'
substitutes B x M B'
\<lbrakk>substitutes ?A ?x ?M ?A'; substitutes ?B ?x ?M ?B'\<rbrakk> \<Longrightarrow> substitutes (SimplyTyped.Pair ?A ?B) ?x ?M (SimplyTyped.Pair ?A' ?B')

goal (1 subgoal):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair A' B')
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair A' B')

goal (2 subgoals):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))
 2. \<And>X. substitutes (SimplyTyped.Pair A B) x M X \<Longrightarrow> X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
thus *: "substitutes (Pair A B) x M (Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))"
[PROOF STATE]
proof (prove)
using this:
substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair A' B')

goal (1 subgoal):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))
[PROOF STEP]
using A' B'
[PROOF STATE]
proof (prove)
using this:
substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair A' B')
A' = A[x ::= M]
B' = B[x ::= M]

goal (1 subgoal):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))
[PROOF STEP]
unfolding subst_def
[PROOF STATE]
proof (prove)
using this:
substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair A' B')
A' = (THE X. substitutes A x M X)
B' = (THE X. substitutes B x M X)

goal (1 subgoal):
 1. substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))

goal (1 subgoal):
 1. \<And>X. substitutes (SimplyTyped.Pair A B) x M X \<Longrightarrow> X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
fix X
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X. substitutes (SimplyTyped.Pair A B) x M X \<Longrightarrow> X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
assume "substitutes (Pair A B) x M X"
[PROOF STATE]
proof (state)
this:
substitutes (SimplyTyped.Pair A B) x M X

goal (1 subgoal):
 1. \<And>X. substitutes (SimplyTyped.Pair A B) x M X \<Longrightarrow> X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
thus "X = Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)"
[PROOF STATE]
proof (prove)
using this:
substitutes (SimplyTyped.Pair A B) x M X

goal (1 subgoal):
 1. X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
using substitutes_function *
[PROOF STATE]
proof (prove)
using this:
substitutes (SimplyTyped.Pair A B) x M X
\<exists>!X. substitutes ?A ?x ?M X
substitutes (SimplyTyped.Pair A B) x M (SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X))

goal (1 subgoal):
 1. X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
X = SimplyTyped.Pair (THE X. substitutes A x M X) (THE X. substitutes B x M X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma realrelI [intro?]: "cauchy X \<Longrightarrow> cauchy Y \<Longrightarrow> vanishes (\<lambda>n. X n - Y n) \<Longrightarrow> realrel X Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cauchy X; cauchy Y; vanishes (\<lambda>n. X n - Y n)\<rbrakk> \<Longrightarrow> realrel X Y
[PROOF STEP]
by (simp add: realrel_def)


[STATEMENT]
lemma \<delta>_prodI: "\<lbrakk>
    length qs1 = length qs2;
    (q1 \<rightarrow> l qs1)\<in>\<delta>1;
    (q2 \<rightarrow> l qs2)\<in>\<delta>2 \<rbrakk> \<Longrightarrow> ((q1,q2) \<rightarrow> l (zip qs1 qs2)) \<in> \<delta>_prod \<delta>1 \<delta>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length qs1 = length qs2; q1 \<rightarrow> l qs1 \<in> \<delta>1; q2 \<rightarrow> l qs2 \<in> \<delta>2\<rbrakk> \<Longrightarrow> (q1, q2) \<rightarrow> l zip qs1 qs2 \<in> \<delta>_prod \<delta>1 \<delta>2
[PROOF STEP]
by (auto simp add: \<delta>_prod_def)


[STATEMENT]
lemma basis_det_nonzero:
  assumes db:"basis (set G)" and len:"length G = n"
  shows "det (mat_of_rows n G) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
have M_car1:"mat_of_rows n G \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows n G \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
basis (set G)
length G = n

goal (1 subgoal):
 1. mat_of_rows n G \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_of_rows n G \<in> carrier_mat n n

goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
hence M_car:"(mat_of_rows n G)\<^sup>T \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
mat_of_rows n G \<in> carrier_mat n n

goal (1 subgoal):
 1. (mat_of_rows n G)\<^sup>T \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_of_rows n G)\<^sup>T \<in> carrier_mat n n

goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
have li:"lin_indpt (set G)"
   and inc_2:"set G \<subseteq> carrier_vec n"
   and issp:"carrier_vec n = span (set G)"
   and RG_in_carr:"\<And>i. i < length G \<Longrightarrow> G ! i \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lin_indpt (set G) &&& set G \<subseteq> carrier_vec n) &&& carrier_vec n = local.span (set G) &&& (\<And>i. i < length G \<Longrightarrow> G ! i \<in> carrier_vec n)
[PROOF STEP]
using assms[unfolded basis_def]
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set G) \<and> local.span (set G) = carrier_vec n \<and> set G \<subseteq> carrier_vec n
length G = n

goal (1 subgoal):
 1. (lin_indpt (set G) &&& set G \<subseteq> carrier_vec n) &&& carrier_vec n = local.span (set G) &&& (\<And>i. i < length G \<Longrightarrow> G ! i \<in> carrier_vec n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lin_indpt (set G)
set G \<subseteq> carrier_vec n
carrier_vec n = local.span (set G)
?i1 < length G \<Longrightarrow> G ! ?i1 \<in> carrier_vec n

goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
hence "basis_list G"
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set G)
set G \<subseteq> carrier_vec n
carrier_vec n = local.span (set G)
?i1 < length G \<Longrightarrow> G ! ?i1 \<in> carrier_vec n

goal (1 subgoal):
 1. basis_list G
[PROOF STEP]
unfolding basis_list_def
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set G)
set G \<subseteq> carrier_vec n
carrier_vec n = local.span (set G)
?i1 < length G \<Longrightarrow> G ! ?i1 \<in> carrier_vec n

goal (1 subgoal):
 1. set G \<subseteq> carrier_vec n \<and> length G = n \<and> carrier_vec n \<subseteq> local.span (set G)
[PROOF STEP]
using len
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set G)
set G \<subseteq> carrier_vec n
carrier_vec n = local.span (set G)
?i1 < length G \<Longrightarrow> G ! ?i1 \<in> carrier_vec n
length G = n

goal (1 subgoal):
 1. set G \<subseteq> carrier_vec n \<and> length G = n \<and> carrier_vec n \<subseteq> local.span (set G)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
basis_list G

goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
from basis_list_basis[OF this]
[PROOF STATE]
proof (chain)
picking this:
distinct G
lin_indpt (set G)
basis (set G)
[PROOF STEP]
have di:"distinct G"
[PROOF STATE]
proof (prove)
using this:
distinct G
lin_indpt (set G)
basis (set G)

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

goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
have "det ((mat_of_rows n G)\<^sup>T) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat_of_rows n G)\<^sup>T \<noteq> (0::'a)
[PROOF STEP]
unfolding det_0_iff_vec_prod_zero[OF M_car]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
assume "\<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n"
[PROOF STATE]
proof (state)
this:
\<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n
[PROOF STEP]
obtain v where v:"v \<in> span (set G)"
                          "v \<noteq> 0\<^sub>v n" "(mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
using this:
\<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> local.span (set G); v \<noteq> 0\<^sub>v n; (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding issp
[PROOF STATE]
proof (prove)
using this:
\<exists>v. v \<in> local.span (set G) \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> local.span (set G); v \<noteq> 0\<^sub>v n; (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v \<in> local.span (set G)
v \<noteq> 0\<^sub>v n
(mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
from finite_in_span[OF finite_set inc_2 v(1)]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a. True \<and> lincomb a (set G) = v
[PROOF STEP]
obtain a
      where aA: "v = lincomb a (set G)"
[PROOF STATE]
proof (prove)
using this:
\<exists>a. True \<and> lincomb a (set G) = v

goal (1 subgoal):
 1. (\<And>a. v = lincomb a (set G) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v = lincomb a (set G)

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
from v(1,2)[folded issp]
[PROOF STATE]
proof (chain)
picking this:
v \<in> carrier_vec n
v \<noteq> 0\<^sub>v n
[PROOF STEP]
obtain i where i:"v $ i \<noteq> 0" "i < n"
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
v \<noteq> 0\<^sub>v n

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>v $ i \<noteq> (0::'a); i < n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
v $ i \<noteq> (0::'a)
i < n

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
hence inG:"G ! i \<in> set G"
[PROOF STATE]
proof (prove)
using this:
v $ i \<noteq> (0::'a)
i < n

goal (1 subgoal):
 1. G ! i \<in> set G
[PROOF STEP]
using len
[PROOF STATE]
proof (prove)
using this:
v $ i \<noteq> (0::'a)
i < n
length G = n

goal (1 subgoal):
 1. G ! i \<in> set G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
G ! i \<in> set G

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
have di2: "distinct [0..<length G]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct [0..<length G]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct [0..<length G]

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
define f where "f = (\<lambda>l. \<Sum>i \<in> set [0..<length G]. if l = G ! i then v $ i else 0)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>l. \<Sum>i\<in>set [0..<length G]. if l = G ! i then v $ i else (0::'a))

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
hence f':"f (G ! i) = (\<Sum>ia\<leftarrow>[0..<n]. if G ! ia = G ! i then v $ ia else 0)"
[PROOF STATE]
proof (prove)
using this:
f = (\<lambda>l. \<Sum>i\<in>set [0..<length G]. if l = G ! i then v $ i else (0::'a))

goal (1 subgoal):
 1. f (G ! i) = (\<Sum>ia\<leftarrow>[0..<n]. if G ! ia = G ! i then v $ ia else (0::'a))
[PROOF STEP]
unfolding f_def sum.distinct_set_conv_list[OF di2]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>l. \<Sum>i\<leftarrow>[0..<length G]. if l = G ! i then v $ i else (0::'a)) = (\<lambda>l. \<Sum>i\<leftarrow>[0..<length G]. if l = G ! i then v $ i else (0::'a))

goal (1 subgoal):
 1. (\<Sum>ia\<leftarrow>[0..<length G]. if G ! i = G ! ia then v $ ia else (0::'a)) = (\<Sum>ia\<leftarrow>[0..<n]. if G ! ia = G ! i then v $ ia else (0::'a))
[PROOF STEP]
unfolding len
[PROOF STATE]
proof (prove)
using this:
(\<lambda>l. \<Sum>i\<leftarrow>[0..<n]. if l = G ! i then v $ i else (0::'a)) = (\<lambda>l. \<Sum>i\<leftarrow>[0..<n]. if l = G ! i then v $ i else (0::'a))

goal (1 subgoal):
 1. (\<Sum>ia\<leftarrow>[0..<n]. if G ! i = G ! ia then v $ ia else (0::'a)) = (\<Sum>ia\<leftarrow>[0..<n]. if G ! ia = G ! i then v $ ia else (0::'a))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
f (G ! i) = (\<Sum>ia\<leftarrow>[0..<n]. if G ! ia = G ! i then v $ ia else (0::'a))

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
v \<in> local.span (set G)
v \<noteq> 0\<^sub>v n
(mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n
[PROOF STEP]
have "mat_of_cols n G *\<^sub>v v = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
using this:
v \<in> local.span (set G)
v \<noteq> 0\<^sub>v n
(mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. mat_of_cols n G *\<^sub>v v = 0\<^sub>v n
[PROOF STEP]
unfolding transpose_mat_of_rows
[PROOF STATE]
proof (prove)
using this:
v \<in> local.span (set G)
v \<noteq> 0\<^sub>v n
mat_of_cols n G *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. mat_of_cols n G *\<^sub>v v = 0\<^sub>v n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_of_cols n G *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
with mat_of_cols_mult_as_finsum[OF v(1)[folded issp len] RG_in_carr]
[PROOF STATE]
proof (chain)
picking this:
(\<And>i. i < length G \<Longrightarrow> i < length G) \<Longrightarrow> mat_of_cols n G *\<^sub>v v = lincomb (\<lambda>l. \<Sum>i = 0..<length G. if l = G ! i then v $ i else (0::'a)) (set G)
mat_of_cols n G *\<^sub>v v = 0\<^sub>v n
[PROOF STEP]
have f:"lincomb f (set G) = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i < length G \<Longrightarrow> i < length G) \<Longrightarrow> mat_of_cols n G *\<^sub>v v = lincomb (\<lambda>l. \<Sum>i = 0..<length G. if l = G ! i then v $ i else (0::'a)) (set G)
mat_of_cols n G *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. lincomb f (set G) = 0\<^sub>v n
[PROOF STEP]
unfolding len f_def
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i < n \<Longrightarrow> i < n) \<Longrightarrow> mat_of_cols n G *\<^sub>v v = lincomb (\<lambda>l. \<Sum>i = 0..<n. if l = G ! i then v $ i else (0::'a)) (set G)
mat_of_cols n G *\<^sub>v v = 0\<^sub>v n

goal (1 subgoal):
 1. lincomb (\<lambda>l. \<Sum>i\<in>set [0..<n]. if l = G ! i then v $ i else (0::'a)) (set G) = 0\<^sub>v n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb f (set G) = 0\<^sub>v n

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
note [simp] = list_trisect[OF i(2)[folded len],unfolded len]
[PROOF STATE]
proof (state)
this:
[0..<n] = [0..<i] @ i # [Suc i..<n]

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
note x = i(2)[folded len]
[PROOF STATE]
proof (state)
this:
i < length G

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
have [simp]:"(\<Sum>x\<leftarrow>[0..<i]. if G ! x = G ! i then v $ x else 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[0..<i]. if G ! x = G ! i then v $ x else (0::'a)) = (0::'a)
[PROOF STEP]
by (rule sum_list_0,auto simp: nth_eq_iff_index_eq[OF di less_trans[OF _ x] x])
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>[0..<i]. if G ! x = G ! i then v $ x else (0::'a)) = (0::'a)

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
have [simp]:"(\<Sum>x\<leftarrow>[Suc i..<n]. if G ! x = G ! i then v $ x else 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[Suc i..<n]. if G ! x = G ! i then v $ x else (0::'a)) = (0::'a)
[PROOF STEP]
apply (rule sum_list_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set (map (\<lambda>x. if G ! x = G ! i then v $ x else (0::'a)) [Suc i..<n]) \<Longrightarrow> x = (0::'a)
[PROOF STEP]
using nth_eq_iff_index_eq[OF di _ x] len
[PROOF STATE]
proof (prove)
using this:
?i < length G \<Longrightarrow> (G ! ?i = G ! i) = (?i = i)
length G = n

goal (1 subgoal):
 1. \<And>x. x \<in> set (map (\<lambda>x. if G ! x = G ! i then v $ x else (0::'a)) [Suc i..<n]) \<Longrightarrow> x = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>[Suc i..<n]. if G ! x = G ! i then v $ x else (0::'a)) = (0::'a)

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
from i(1)
[PROOF STATE]
proof (chain)
picking this:
v $ i \<noteq> (0::'a)
[PROOF STEP]
have "f (G ! i) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
v $ i \<noteq> (0::'a)

goal (1 subgoal):
 1. f (G ! i) \<noteq> (0::'a)
[PROOF STEP]
unfolding f'
[PROOF STATE]
proof (prove)
using this:
v $ i \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<Sum>ia\<leftarrow>[0..<n]. if G ! ia = G ! i then v $ ia else (0::'a)) \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (G ! i) \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
from lin_dep_crit[OF finite_set subset_refl TrueI inG this f]
[PROOF STATE]
proof (chain)
picking this:
lin_dep (set G)
[PROOF STEP]
have "lin_dep (set G)"
[PROOF STATE]
proof (prove)
using this:
lin_dep (set G)

goal (1 subgoal):
 1. lin_dep (set G)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lin_dep (set G)

goal (1 subgoal):
 1. \<exists>v. v \<in> carrier_vec n \<and> v \<noteq> 0\<^sub>v n \<and> (mat_of_rows n G)\<^sup>T *\<^sub>v v = 0\<^sub>v n \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
lin_dep (set G)

goal (1 subgoal):
 1. False
[PROOF STEP]
using li
[PROOF STATE]
proof (prove)
using this:
lin_dep (set G)
lin_indpt (set G)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (mat_of_rows n G)\<^sup>T \<noteq> (0::'a)

goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
thus det0:"det (mat_of_rows n G) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
det (mat_of_rows n G)\<^sup>T \<noteq> (0::'a)

goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
by (unfold det_transpose[OF M_car1])
[PROOF STATE]
proof (state)
this:
det (mat_of_rows n G) \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_ctxt_closedD: "all_ctxt_closed F r \<Longrightarrow> (f,length ss) \<in> F \<Longrightarrow> length ts = length ss
  \<Longrightarrow> \<lbrakk>\<And> i. i < length ts \<Longrightarrow> (ts ! i, ss ! i) \<in> r \<rbrakk>
  \<Longrightarrow> \<lbrakk>\<And> i. i < length ts \<Longrightarrow> funas_term (ts ! i) \<subseteq> F \<rbrakk>
  \<Longrightarrow> \<lbrakk>\<And> i. i < length ts \<Longrightarrow> funas_term (ss ! i) \<subseteq> F \<rbrakk>
  \<Longrightarrow> (Fun f ts, Fun f ss) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>all_ctxt_closed F r; (f, length ss) \<in> F; length ts = length ss; \<And>i. i < length ts \<Longrightarrow> (ts ! i, ss ! i) \<in> r; \<And>i. i < length ts \<Longrightarrow> funas_term (ts ! i) \<subseteq> F; \<And>i. i < length ts \<Longrightarrow> funas_term (ss ! i) \<subseteq> F\<rbrakk> \<Longrightarrow> (Fun f ts, Fun f ss) \<in> r
[PROOF STEP]
unfolding all_ctxt_closed_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<forall>f ts ss. (f, length ss) \<in> F \<longrightarrow> length ts = length ss \<longrightarrow> (\<forall>i<length ts. (ts ! i, ss ! i) \<in> r) \<longrightarrow> (\<forall>i<length ts. funas_term (ts ! i) \<union> funas_term (ss ! i) \<subseteq> F) \<longrightarrow> (Fun f ts, Fun f ss) \<in> r) \<and> (\<forall>x. (Var x, Var x) \<in> r); (f, length ss) \<in> F; length ts = length ss; \<And>i. i < length ts \<Longrightarrow> (ts ! i, ss ! i) \<in> r; \<And>i. i < length ts \<Longrightarrow> funas_term (ts ! i) \<subseteq> F; \<And>i. i < length ts \<Longrightarrow> funas_term (ss ! i) \<subseteq> F\<rbrakk> \<Longrightarrow> (Fun f ts, Fun f ss) \<in> r
[PROOF STEP]
by auto


[STATEMENT]
lemma var_rename_fv_disjoint:
  "fv s \<inter> fv (t \<cdot> var_rename (max_var s)) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv s \<inter> fv (t \<cdot> var_rename (max_var_set (fv s))) = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fv s \<inter> fv (t \<cdot> var_rename (max_var_set (fv s))) = {}
[PROOF STEP]
have 1: "\<forall>v \<in> fv s. snd v \<le> max_var s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>fv s. snd v \<le> max_var_set (fv s)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fv s. snd v \<le> max_var_set (fv s)

goal (1 subgoal):
 1. fv s \<inter> fv (t \<cdot> var_rename (max_var_set (fv s))) = {}
[PROOF STEP]
have 2: "\<forall>v \<in> fv (t \<cdot> var_rename n). snd v > n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>fv (t \<cdot> var_rename n). n < snd v
[PROOF STEP]
unfolding var_rename_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>fv (t \<cdot> (\<lambda>v. Var (fst v, snd v + Suc n))). n < snd v
[PROOF STEP]
by (induct t) auto
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fv (t \<cdot> var_rename ?n2). ?n2 < snd v

goal (1 subgoal):
 1. fv s \<inter> fv (t \<cdot> var_rename (max_var_set (fv s))) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv s \<inter> fv (t \<cdot> var_rename (max_var_set (fv s))) = {}
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fv s. snd v \<le> max_var_set (fv s)
\<forall>v\<in>fv (t \<cdot> var_rename ?n2). ?n2 < snd v

goal (1 subgoal):
 1. fv s \<inter> fv (t \<cdot> var_rename (max_var_set (fv s))) = {}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
fv s \<inter> fv (t \<cdot> var_rename (max_var_set (fv s))) = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subsequence_nth[simp]: "k < j - i \<Longrightarrow> (w [i \<rightarrow> j]) ! k = w (i + k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < j - i \<Longrightarrow> w [i \<rightarrow> j] ! k = w (i + k)
[PROOF STEP]
unfolding subsequence_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < j - i \<Longrightarrow> map w [i..<j] ! k = w (i + k)
[PROOF STEP]
by auto


[STATEMENT]
lemma qPsubstInp_preserves_qGoodInp:
assumes "qGoodInp qinp" and "qGoodEnv qrho"
shows "qGoodInp (qinp %[[qrho]])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qGoodInp (qinp %[[qrho]])
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
qGoodInp qinp
qGoodEnv qrho

goal (1 subgoal):
 1. qGoodInp (qinp %[[qrho]])
[PROOF STEP]
unfolding qGoodInp_def qPsubstInp_def liftAll_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>i v. qinp i = Some v \<longrightarrow> qGood v) \<and> |{i. qinp i \<noteq> None}| <o |UNIV|
qGoodEnv qrho

goal (1 subgoal):
 1. (\<forall>i v. lift (qPsubst qrho) qinp i = Some v \<longrightarrow> qGood v) \<and> |{i. lift (qPsubst qrho) qinp i \<noteq> None}| <o |UNIV|
[PROOF STEP]
by simp (smt Collect_cong lift_def option.case_eq_if
   option.exhaust_sel option.sel qPsubst_preserves_qGood)