[STATEMENT]
lemma pos_convex_function:
  fixes f :: "real \<Rightarrow> real"
  assumes "convex C"
    and leq: "\<And>x y. x \<in> C \<Longrightarrow> y \<in> C \<Longrightarrow> f' x * (y - x) \<le> f y - f x"
  shows "convex_on C f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on C f
[PROOF STEP]
unfolding convex_on_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>C. \<forall>y\<in>C. \<forall>\<mu>. 0 \<le> \<mu> \<and> \<mu> \<le> 1 \<longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convex C
\<lbrakk>?x \<in> C; ?y \<in> C\<rbrakk> \<Longrightarrow> f' ?x * (?y - ?x) \<le> f ?y - f ?x

goal (1 subgoal):
 1. \<forall>x\<in>C. \<forall>y\<in>C. \<forall>\<mu>. 0 \<le> \<mu> \<and> \<mu> \<le> 1 \<longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y \<mu>. \<lbrakk>convex C; \<And>x y. \<lbrakk>x \<in> C; y \<in> C\<rbrakk> \<Longrightarrow> f' x * (y - x) \<le> f y - f x; x \<in> C; y \<in> C; 0 \<le> \<mu>; \<mu> \<le> 1\<rbrakk> \<Longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
fix x y \<mu> :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y \<mu>. \<lbrakk>convex C; \<And>x y. \<lbrakk>x \<in> C; y \<in> C\<rbrakk> \<Longrightarrow> f' x * (y - x) \<le> f y - f x; x \<in> C; y \<in> C; 0 \<le> \<mu>; \<mu> \<le> 1\<rbrakk> \<Longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
let ?x = "\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y \<mu>. \<lbrakk>convex C; \<And>x y. \<lbrakk>x \<in> C; y \<in> C\<rbrakk> \<Longrightarrow> f' x * (y - x) \<le> f y - f x; x \<in> C; y \<in> C; 0 \<le> \<mu>; \<mu> \<le> 1\<rbrakk> \<Longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
assume *: "convex C" "x \<in> C" "y \<in> C" "\<mu> \<ge> 0" "\<mu> \<le> 1"
[PROOF STATE]
proof (state)
this:
convex C
x \<in> C
y \<in> C
0 \<le> \<mu>
\<mu> \<le> 1

goal (1 subgoal):
 1. \<And>x y \<mu>. \<lbrakk>convex C; \<And>x y. \<lbrakk>x \<in> C; y \<in> C\<rbrakk> \<Longrightarrow> f' x * (y - x) \<le> f y - f x; x \<in> C; y \<in> C; 0 \<le> \<mu>; \<mu> \<le> 1\<rbrakk> \<Longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
convex C
x \<in> C
y \<in> C
0 \<le> \<mu>
\<mu> \<le> 1
[PROOF STEP]
have "1 - \<mu> \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
convex C
x \<in> C
y \<in> C
0 \<le> \<mu>
\<mu> \<le> 1

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

goal (1 subgoal):
 1. \<And>x y \<mu>. \<lbrakk>convex C; \<And>x y. \<lbrakk>x \<in> C; y \<in> C\<rbrakk> \<Longrightarrow> f' x * (y - x) \<le> f y - f x; x \<in> C; y \<in> C; 0 \<le> \<mu>; \<mu> \<le> 1\<rbrakk> \<Longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> 1 - \<mu>
[PROOF STEP]
have xpos: "?x \<in> C"
[PROOF STATE]
proof (prove)
using this:
0 \<le> 1 - \<mu>

goal (1 subgoal):
 1. \<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y \<in> C
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
0 \<le> 1 - \<mu>
convex C
x \<in> C
y \<in> C
0 \<le> \<mu>
\<mu> \<le> 1

goal (1 subgoal):
 1. \<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y \<in> C
[PROOF STEP]
unfolding convex_alt
[PROOF STATE]
proof (prove)
using this:
0 \<le> 1 - \<mu>
\<forall>x\<in>C. \<forall>y\<in>C. \<forall>u. 0 \<le> u \<and> u \<le> 1 \<longrightarrow> (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> C
x \<in> C
y \<in> C
0 \<le> \<mu>
\<mu> \<le> 1

goal (1 subgoal):
 1. \<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y \<in> C
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y \<in> C

goal (1 subgoal):
 1. \<And>x y \<mu>. \<lbrakk>convex C; \<And>x y. \<lbrakk>x \<in> C; y \<in> C\<rbrakk> \<Longrightarrow> f' x * (y - x) \<le> f y - f x; x \<in> C; y \<in> C; 0 \<le> \<mu>; \<mu> \<le> 1\<rbrakk> \<Longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
have geq: "\<mu> * (f x - f ?x) + (1 - \<mu>) * (f y - f ?x) \<ge>
      \<mu> * f' ?x * (x - ?x) + (1 - \<mu>) * f' ?x * (y - ?x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (x - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (y - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) \<le> \<mu> * (f x - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * (f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y))
[PROOF STEP]
using add_mono [OF mult_left_mono [OF leq [OF xpos *(2)] \<open>\<mu> \<ge> 0\<close>]
        mult_left_mono [OF leq [OF xpos *(3)] \<open>1 - \<mu> \<ge> 0\<close>]]
[PROOF STATE]
proof (prove)
using this:
\<mu> * (f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (x - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y))) + (1 - \<mu>) * (f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (y - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y))) \<le> \<mu> * (f x - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * (f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y))

goal (1 subgoal):
 1. \<mu> * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (x - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (y - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) \<le> \<mu> * (f x - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * (f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<mu> * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (x - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (y - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) \<le> \<mu> * (f x - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * (f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y))

goal (1 subgoal):
 1. \<And>x y \<mu>. \<lbrakk>convex C; \<And>x y. \<lbrakk>x \<in> C; y \<in> C\<rbrakk> \<Longrightarrow> f' x * (y - x) \<le> f y - f x; x \<in> C; y \<in> C; 0 \<le> \<mu>; \<mu> \<le> 1\<rbrakk> \<Longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<mu> * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (x - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (y - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) \<le> \<mu> * (f x - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * (f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y))
[PROOF STEP]
have "\<mu> * f x + (1 - \<mu>) * f y - f ?x \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
\<mu> * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (x - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * f' (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) * (y - (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) \<le> \<mu> * (f x - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)) + (1 - \<mu>) * (f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y))

goal (1 subgoal):
 1. 0 \<le> \<mu> * f x + (1 - \<mu>) * f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> \<mu> * f x + (1 - \<mu>) * f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)

goal (1 subgoal):
 1. \<And>x y \<mu>. \<lbrakk>convex C; \<And>x y. \<lbrakk>x \<in> C; y \<in> C\<rbrakk> \<Longrightarrow> f' x * (y - x) \<le> f y - f x; x \<in> C; y \<in> C; 0 \<le> \<mu>; \<mu> \<le> 1\<rbrakk> \<Longrightarrow> f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> \<mu> * f x + (1 - \<mu>) * f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)
[PROOF STEP]
show "f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y"
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<mu> * f x + (1 - \<mu>) * f y - f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y)

goal (1 subgoal):
 1. f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (\<mu> *\<^sub>R x + (1 - \<mu>) *\<^sub>R y) \<le> \<mu> * f x + (1 - \<mu>) * f y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wf_rels[simp]:
  assumes "wf {(l,l'). (pointsTo :: 'link \<Rightarrow> ('sequent, 'rule, 'link)ctree) l' = Link l}"
    (is "wf ?w")
  shows "wf (rels pointsTo)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (rels pointsTo)
[PROOF STEP]
using wf_map_prod_image
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf ?r; inj ?f\<rbrakk> \<Longrightarrow> wf (map_prod ?f ?f ` ?r)

goal (1 subgoal):
 1. wf (rels pointsTo)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>r f. \<lbrakk>wf r; inj f\<rbrakk> \<Longrightarrow> wf (map_prod f f ` r)) \<Longrightarrow> wf (rels pointsTo)
[PROOF STEP]
define r1 :: "(('link \<Rightarrow> ('sequent, 'rule, 'link) ctree) \<times> ('sequent, 'rule, 'link) ctree) rel" where
    "r1 = {((pointsTo,pointsTo l'), (pointsTo, Link l'::('sequent, 'rule, 'link) ctree)) | l'.
                 (\<forall>l''. pointsTo l' \<noteq> Link l'')}"
[PROOF STATE]
proof (state)
this:
r1 = {((pointsTo, pointsTo l'), pointsTo, Link l') |l'. \<forall>l''. pointsTo l' \<noteq> Link l''}

goal (1 subgoal):
 1. (\<And>r f. \<lbrakk>wf r; inj f\<rbrakk> \<Longrightarrow> wf (map_prod f f ` r)) \<Longrightarrow> wf (rels pointsTo)
[PROOF STEP]
define r2 :: "(('link \<Rightarrow> ('sequent, 'rule, 'link) ctree) \<times> ('sequent, 'rule, 'link) ctree) rel" where
    "r2 = image (map_prod (map_prod id Link) (map_prod id Link)) (inv_image ?w snd)"
[PROOF STATE]
proof (state)
this:
r2 = map_prod (map_prod id Link) (map_prod id Link) ` inv_image {(l, l'). pointsTo l' = Link l} snd

goal (1 subgoal):
 1. (\<And>r f. \<lbrakk>wf r; inj f\<rbrakk> \<Longrightarrow> wf (map_prod f f ` r)) \<Longrightarrow> wf (rels pointsTo)
[PROOF STEP]
have 0: "rels pointsTo \<subseteq> r1 \<union> r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rels pointsTo \<subseteq> r1 \<union> r2
[PROOF STEP]
unfolding rels_def r1_def r2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {((pointsTo, pointsTo l'), pointsTo, Link l') |l'. True} \<subseteq> {((pointsTo, pointsTo l'), pointsTo, Link l') |l'. \<forall>l''. pointsTo l' \<noteq> Link l''} \<union> map_prod (map_prod id Link) (map_prod id Link) ` inv_image {(l, l'). pointsTo l' = Link l} snd
[PROOF STEP]
unfolding inv_image_def image_Collect
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {((pointsTo, pointsTo l'), pointsTo, Link l') |l'. True} \<subseteq> {((pointsTo, pointsTo l'), pointsTo, Link l') |l'. \<forall>l''. pointsTo l' \<noteq> Link l''} \<union> {map_prod (map_prod id Link) (map_prod id Link) x |x. case x of (x, y) \<Rightarrow> (snd x, snd y) \<in> {(l, l'). pointsTo l' = Link l}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rels pointsTo \<subseteq> r1 \<union> r2

goal (1 subgoal):
 1. (\<And>r f. \<lbrakk>wf r; inj f\<rbrakk> \<Longrightarrow> wf (map_prod f f ` r)) \<Longrightarrow> wf (rels pointsTo)
[PROOF STEP]
let ?m = "measure (\<lambda>(tOfL,t). case t of Link l' => Suc 0 | _ => 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>r f. \<lbrakk>wf r; inj f\<rbrakk> \<Longrightarrow> wf (map_prod f f ` r)) \<Longrightarrow> wf (rels pointsTo)
[PROOF STEP]
have 1: "wf r1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf r1
[PROOF STEP]
unfolding r1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {((pointsTo, pointsTo l'), pointsTo, Link l') |l'. \<forall>l''. pointsTo l' \<noteq> Link l''}
[PROOF STEP]
by (rule wf_subset[of ?m]) (auto split: ctree.splits)
[PROOF STATE]
proof (state)
this:
wf r1

goal (1 subgoal):
 1. (\<And>r f. \<lbrakk>wf r; inj f\<rbrakk> \<Longrightarrow> wf (map_prod f f ` r)) \<Longrightarrow> wf (rels pointsTo)
[PROOF STEP]
have 2: "wf r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf r2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf {(l, l'). pointsTo l' = Link l}

goal (1 subgoal):
 1. wf r2
[PROOF STEP]
unfolding r2_def
[PROOF STATE]
proof (prove)
using this:
wf {(l, l'). pointsTo l' = Link l}

goal (1 subgoal):
 1. wf (map_prod (map_prod id Link) (map_prod id Link) ` inv_image {(l, l'). pointsTo l' = Link l} snd)
[PROOF STEP]
by (intro wf_map_prod_image wf_inv_image) (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
wf r2

goal (1 subgoal):
 1. (\<And>r f. \<lbrakk>wf r; inj f\<rbrakk> \<Longrightarrow> wf (map_prod f f ` r)) \<Longrightarrow> wf (rels pointsTo)
[PROOF STEP]
have 3: "Domain r1 \<inter> Range r2 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Domain r1 \<inter> Range r2 = {}
[PROOF STEP]
unfolding r1_def r2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Domain {((pointsTo, pointsTo l'), pointsTo, Link l') |l'. \<forall>l''. pointsTo l' \<noteq> Link l''} \<inter> Range (map_prod (map_prod id Link) (map_prod id Link) ` inv_image {(l, l'). pointsTo l' = Link l} snd) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Domain r1 \<inter> Range r2 = {}

goal (1 subgoal):
 1. (\<And>r f. \<lbrakk>wf r; inj f\<rbrakk> \<Longrightarrow> wf (map_prod f f ` r)) \<Longrightarrow> wf (rels pointsTo)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (rels pointsTo)
[PROOF STEP]
using 1 2 3
[PROOF STATE]
proof (prove)
using this:
wf r1
wf r2
Domain r1 \<inter> Range r2 = {}

goal (1 subgoal):
 1. wf (rels pointsTo)
[PROOF STEP]
by (intro wf_subset[OF _ 0] wf_Un) auto
[PROOF STATE]
proof (state)
this:
wf (rels pointsTo)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reflect_poly_dvd: "(f :: 'a :: idom poly) dvd g \<Longrightarrow> reflect_poly f dvd reflect_poly g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f dvd g \<Longrightarrow> reflect_poly f dvd reflect_poly g
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. g = f * k \<Longrightarrow> \<exists>k. reflect_poly g = reflect_poly f * k
[PROOF STEP]
by (auto simp: reflect_poly_mult)


[STATEMENT]
lemma id_preserve [quot_preserve]:
  assumes "Quotient3 R Abs Rep"
  shows "(Rep ---> Abs) id = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Rep ---> Abs) id = id
[PROOF STEP]
using Quotient3_abs_rep [OF assms]
[PROOF STATE]
proof (prove)
using this:
Abs (Rep ?a) = ?a

goal (1 subgoal):
 1. (Rep ---> Abs) id = id
[PROOF STEP]
by (simp add: fun_eq_iff)


[STATEMENT]
lemma countable_infinite:
assumes A: "countable A" and B: "infinite B"
shows "|A| \<le>o |B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| \<le>o |B|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |A| \<le>o |B|
[PROOF STEP]
have "|A| \<le>o natLeq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| \<le>o natLeq
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
countable A

goal (1 subgoal):
 1. |A| \<le>o natLeq
[PROOF STEP]
unfolding countable_card_le_natLeq
[PROOF STATE]
proof (prove)
using this:
|A| \<le>o natLeq

goal (1 subgoal):
 1. |A| \<le>o natLeq
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
|A| \<le>o natLeq

goal (1 subgoal):
 1. |A| \<le>o |B|
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
|A| \<le>o natLeq

goal (1 subgoal):
 1. |A| \<le>o |B|
[PROOF STEP]
have "natLeq \<le>o |B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. natLeq \<le>o |B|
[PROOF STEP]
by (metis B infinite_iff_natLeq_ordLeq)
[PROOF STATE]
proof (state)
this:
natLeq \<le>o |B|

goal (1 subgoal):
 1. |A| \<le>o |B|
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
|A| \<le>o |B|
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
|A| \<le>o |B|

goal (1 subgoal):
 1. |A| \<le>o |B|
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
|A| \<le>o |B|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_segment_same_Re:
  assumes "Re a = Re b"
  shows   "closed_segment a b = {z. Re z = Re a \<and> Im z \<in> closed_segment (Im a) (Im b)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment a b = {z. Re z = Re a \<and> Im z \<in> closed_segment (Im a) (Im b)}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x = Re a
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x \<in> closed_segment (Im a) (Im b)
 3. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x = Re a
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x \<in> closed_segment (Im a) (Im b)
 3. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
assume "z \<in> closed_segment a b"
[PROOF STATE]
proof (state)
this:
z \<in> closed_segment a b

goal (3 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x = Re a
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x \<in> closed_segment (Im a) (Im b)
 3. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> closed_segment a b
[PROOF STEP]
obtain u where u: "u \<in> {0..1}" "z = a + of_real u * (b - a)"
[PROOF STATE]
proof (prove)
using this:
z \<in> closed_segment a b

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> {0..1}; z = a + complex_of_real u * (b - a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: closed_segment_def scaleR_conv_of_real algebra_simps)
[PROOF STATE]
proof (state)
this:
u \<in> {0..1}
z = a + complex_of_real u * (b - a)

goal (3 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x = Re a
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x \<in> closed_segment (Im a) (Im b)
 3. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Re a = Re b
[PROOF STEP]
show "Re z = Re a"
[PROOF STATE]
proof (prove)
using this:
Re a = Re b

goal (1 subgoal):
 1. Re z = Re a
[PROOF STEP]
by (auto simp: u)
[PROOF STATE]
proof (state)
this:
Re z = Re a

goal (2 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x \<in> closed_segment (Im a) (Im b)
 2. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
from u(1)
[PROOF STATE]
proof (chain)
picking this:
u \<in> {0..1}
[PROOF STEP]
show "Im z \<in> closed_segment (Im a) (Im b)"
[PROOF STATE]
proof (prove)
using this:
u \<in> {0..1}

goal (1 subgoal):
 1. Im z \<in> closed_segment (Im a) (Im b)
[PROOF STEP]
by (force simp: u closed_segment_def algebra_simps)
[PROOF STATE]
proof (state)
this:
Im z \<in> closed_segment (Im a) (Im b)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
assume [simp]: "Re z = Re a" and "Im z \<in> closed_segment (Im a) (Im b)"
[PROOF STATE]
proof (state)
this:
Re z = Re a
Im z \<in> closed_segment (Im a) (Im b)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Re z = Re a
Im z \<in> closed_segment (Im a) (Im b)
[PROOF STEP]
obtain u where u: "u \<in> {0..1}" "Im z = Im a + of_real u * (Im b - Im a)"
[PROOF STATE]
proof (prove)
using this:
Re z = Re a
Im z \<in> closed_segment (Im a) (Im b)

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> {0..1}; Im z = Im a + of_real u * (Im b - Im a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: closed_segment_def scaleR_conv_of_real algebra_simps)
[PROOF STATE]
proof (state)
this:
u \<in> {0..1}
Im z = Im a + of_real u * (Im b - Im a)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>Re x = Re a; Im x \<in> closed_segment (Im a) (Im b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
from u(1)
[PROOF STATE]
proof (chain)
picking this:
u \<in> {0..1}
[PROOF STEP]
show "z \<in> closed_segment a b"
[PROOF STATE]
proof (prove)
using this:
u \<in> {0..1}

goal (1 subgoal):
 1. z \<in> closed_segment a b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> {0..1}
Re a = Re b

goal (1 subgoal):
 1. z \<in> closed_segment a b
[PROOF STEP]
by (force simp: u closed_segment_def algebra_simps scaleR_conv_of_real complex_eq_iff)
[PROOF STATE]
proof (state)
this:
z \<in> closed_segment a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in cpx_sq_mat) sum_mat_hermitian:
  assumes "finite I"
and "\<forall>i\<in> I. hermitian (A i)"
and "\<forall>i\<in> I. A i\<in> fc_mats"
shows "hermitian (sum_mat A I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian (local.sum_mat A I)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hermitian (local.sum_mat A I)
[PROOF STEP]
have "Complex_Matrix.adjoint (sum_mat A I) = sum_mat (\<lambda>i. Complex_Matrix.adjoint (A i)) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint (local.sum_mat A I) = local.sum_mat (\<lambda>i. Complex_Matrix.adjoint (A i)) I
[PROOF STEP]
using assms sum_mat_adjoint[of I]
[PROOF STATE]
proof (prove)
using this:
finite I
\<forall>i\<in>I. hermitian (A i)
\<forall>i\<in>I. A i \<in> fc_mats
\<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> ?A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (local.sum_mat ?A I) = local.sum_mat (\<lambda>i. Complex_Matrix.adjoint (?A i)) I

goal (1 subgoal):
 1. Complex_Matrix.adjoint (local.sum_mat A I) = local.sum_mat (\<lambda>i. Complex_Matrix.adjoint (A i)) I
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (local.sum_mat A I) = local.sum_mat (\<lambda>i. Complex_Matrix.adjoint (A i)) I

goal (1 subgoal):
 1. hermitian (local.sum_mat A I)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (local.sum_mat A I) = local.sum_mat (\<lambda>i. Complex_Matrix.adjoint (A i)) I

goal (1 subgoal):
 1. hermitian (local.sum_mat A I)
[PROOF STEP]
have "... = sum_mat A I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. Complex_Matrix.adjoint (A i)) I = local.sum_mat A I
[PROOF STEP]
proof (rule sum_mat_cong, (auto simp add: assms))
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) = A i
 2. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) \<in> fc_mats
[PROOF STEP]
show "\<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) = A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) = A i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
\<forall>i\<in>I. hermitian (A i)
\<forall>i\<in>I. A i \<in> fc_mats

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) = A i
[PROOF STEP]
unfolding hermitian_def
[PROOF STATE]
proof (prove)
using this:
finite I
\<forall>i\<in>I. Complex_Matrix.adjoint (A i) = A i
\<forall>i\<in>I. A i \<in> fc_mats

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) = A i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i2 \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A ?i2) = A ?i2

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) \<in> fc_mats
[PROOF STEP]
show "\<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) \<in> fc_mats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) \<in> fc_mats
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
finite I
\<forall>i\<in>I. hermitian (A i)
\<forall>i\<in>I. A i \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A i) \<in> fc_mats
[PROOF STEP]
by (simp add: adjoint_dim)
[PROOF STATE]
proof (state)
this:
?i2 \<in> I \<Longrightarrow> Complex_Matrix.adjoint (A ?i2) \<in> fc_mats

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. Complex_Matrix.adjoint (A i)) I = local.sum_mat A I

goal (1 subgoal):
 1. hermitian (local.sum_mat A I)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.adjoint (local.sum_mat A I) = local.sum_mat A I
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint (local.sum_mat A I) = local.sum_mat A I

goal (1 subgoal):
 1. hermitian (local.sum_mat A I)
[PROOF STEP]
unfolding hermitian_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint (local.sum_mat A I) = local.sum_mat A I

goal (1 subgoal):
 1. Complex_Matrix.adjoint (local.sum_mat A I) = local.sum_mat A I
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
hermitian (local.sum_mat A I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma edges_graph: "\<lbrakk>finite V; finite E\<rbrakk> \<Longrightarrow> edges (graph V E) = (E\<union>E\<inverse>)-Id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite V; finite E\<rbrakk> \<Longrightarrow> edges (graph V E) = E \<union> E\<inverse> - Id
[PROOF STEP]
unfolding edges_def nodes_def graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite V; finite E\<rbrakk> \<Longrightarrow> edges_internal (graph_internal V E) = E \<union> E\<inverse> - Id
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma transp_on_map':
  assumes "transp_on Q B"
    and "g ` A \<subseteq> B"
    and "h ` A \<subseteq> B"
    and "\<And>x. x \<in> A \<Longrightarrow> Q\<^sup>=\<^sup>= (h x) (g x)"
  shows "transp_on (\<lambda>x y. Q (g x) (h y)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transp_on (\<lambda>x y. Q (g x) (h y)) A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
transp_on Q B
g ` A \<subseteq> B
h ` A \<subseteq> B
?x \<in> A \<Longrightarrow> Q\<^sup>=\<^sup>= (h ?x) (g ?x)

goal (1 subgoal):
 1. transp_on (\<lambda>x y. Q (g x) (h y)) A
[PROOF STEP]
unfolding transp_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>B. \<forall>y\<in>B. \<forall>z\<in>B. Q x y \<and> Q y z \<longrightarrow> Q x z
g ` A \<subseteq> B
h ` A \<subseteq> B
?x \<in> A \<Longrightarrow> Q\<^sup>=\<^sup>= (h ?x) (g ?x)

goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>A. \<forall>z\<in>A. Q (g x) (h y) \<and> Q (g y) (h z) \<longrightarrow> Q (g x) (h z)
[PROOF STEP]
by auto (metis imageI subsetD)


[STATEMENT]
lemma reachable_rtranclI:
  "u \<rightarrow>\<^sup>*\<^bsub>G \<^esub> v \<Longrightarrow> (u, v) \<in> (arcs_ends G)\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<rightarrow>\<^sup>*\<^bsub>G\<^esub> v \<Longrightarrow> (u, v) \<in> (arcs_ends G)\<^sup>*
[PROOF STEP]
unfolding reachable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u, v) \<in> rtrancl_on (verts G) (arcs_ends G) \<Longrightarrow> (u, v) \<in> (arcs_ends G)\<^sup>*
[PROOF STEP]
by (rule rtrancl_on_rtranclI)


[STATEMENT]
lemma irreducible\<^sub>d_smult_int:
  fixes c :: int assumes c: "c \<noteq> 0"
  shows "irreducible\<^sub>d (smult c p) = irreducible\<^sub>d p" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible\<^sub>d (smult c p) = irreducible\<^sub>d p
[PROOF STEP]
using irreducible\<^sub>d_primitive_part[of "smult c p", unfolded primitive_part_smult] c
[PROOF STATE]
proof (prove)
using this:
irreducible\<^sub>d (smult (unit_factor c) (primitive_part p)) = irreducible\<^sub>d (smult c p)
c \<noteq> 0

goal (1 subgoal):
 1. irreducible\<^sub>d (smult c p) = irreducible\<^sub>d p
[PROOF STEP]
apply (cases "c < 0", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>irreducible\<^sub>d (- primitive_part p) = irreducible\<^sub>d (smult c p); c < 0\<rbrakk> \<Longrightarrow> irreducible\<^sub>d (smult c p) = irreducible\<^sub>d p
 2. \<lbrakk>irreducible\<^sub>d (smult (unit_factor c) (primitive_part p)) = irreducible\<^sub>d (smult c p); c \<noteq> 0; \<not> c < 0\<rbrakk> \<Longrightarrow> irreducible\<^sub>d (smult c p) = irreducible\<^sub>d p
[PROOF STEP]
apply (metis add.inverse_inverse add.inverse_neutral c irreducible\<^sub>d_smultI normalize_non_0_smult smult_1_left smult_minus_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>irreducible\<^sub>d (smult (unit_factor c) (primitive_part p)) = irreducible\<^sub>d (smult c p); c \<noteq> 0; \<not> c < 0\<rbrakk> \<Longrightarrow> irreducible\<^sub>d (smult c p) = irreducible\<^sub>d p
[PROOF STEP]
apply (simp add: irreducible\<^sub>d_primitive_part)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Lambert_W'_neg_ln_over_self:
  assumes "x \<ge> exp 1"
  shows   "Lambert_W' (-ln x / x) = -ln x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W' (- ln x / x) = - ln x
[PROOF STEP]
proof (rule Lambert_W'_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - ln x \<le> - 1
 2. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
have "0 < (exp 1 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < exp 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < exp 1

goal (2 subgoals):
 1. - ln x \<le> - 1
 2. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 < exp 1

goal (2 subgoals):
 1. - ln x \<le> - 1
 2. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
have "\<dots> \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp 1 \<le> x
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
exp 1 \<le> x

goal (2 subgoals):
 1. - ln x \<le> - 1
 2. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have "x > 0"
[PROOF STATE]
proof (prove)
using this:
0 < x

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

goal (2 subgoals):
 1. - ln x \<le> - 1
 2. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
from assms \<open>x > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
exp 1 \<le> x
0 < x
[PROOF STEP]
have "ln x \<ge> ln (exp 1)"
[PROOF STATE]
proof (prove)
using this:
exp 1 \<le> x
0 < x

goal (1 subgoal):
 1. ln (exp 1) \<le> ln x
[PROOF STEP]
by (subst ln_le_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln (exp 1) \<le> ln x

goal (2 subgoals):
 1. - ln x \<le> - 1
 2. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
thus "-ln x \<le> -1"
[PROOF STATE]
proof (prove)
using this:
ln (exp 1) \<le> ln x

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

goal (1 subgoal):
 1. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
show "-ln x * exp (-ln x) = -ln x / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
using \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. - ln x * exp (- ln x) = - ln x / x
[PROOF STEP]
by (simp add: field_simps exp_minus)
[PROOF STATE]
proof (state)
this:
- ln x * exp (- ln x) = - ln x / x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ortho_basis_exists:
  fixes S :: \<open>'a::chilbert_space set\<close>
  assumes \<open>is_ortho_set S\<close>
  shows \<open>\<exists>B. B \<supseteq> S \<and> is_ortho_set B \<and> closure (cspan B) = UNIV\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
define on where \<open>on B \<longleftrightarrow> B \<supseteq> S \<and> is_ortho_set B\<close> for B :: \<open>'a set\<close>
[PROOF STATE]
proof (state)
this:
on ?B = (S \<subseteq> ?B \<and> is_ortho_set ?B)

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
have \<open>\<exists>B\<in>Collect on. \<forall>B'\<in>Collect on. B \<subseteq> B' \<longrightarrow> B' = B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B\<in>Collect on. \<forall>B'\<in>Collect on. B \<subseteq> B' \<longrightarrow> B' = B
[PROOF STEP]
proof (rule subset_Zorn_nonempty; simp)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>x. on x
 2. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
show \<open>\<exists>S. on S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S. on S
[PROOF STEP]
apply (rule exI[of _ S])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. on S
[PROOF STEP]
using assms on_def
[PROOF STATE]
proof (prove)
using this:
is_ortho_set S
on ?B = (S \<subseteq> ?B \<and> is_ortho_set ?B)

goal (1 subgoal):
 1. on S
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>S. on S

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
fix C :: \<open>'a set set\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
assume \<open>C \<noteq> {}\<close>
[PROOF STATE]
proof (state)
this:
C \<noteq> {}

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
assume \<open>subset.chain (Collect on) C\<close>
[PROOF STATE]
proof (state)
this:
subset.chain (Collect on) C

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subset.chain (Collect on) C
[PROOF STEP]
have C_on: \<open>B \<in> C \<Longrightarrow> on B\<close> and C_order: \<open>B \<in> C \<Longrightarrow> B' \<in> C \<Longrightarrow> B \<subseteq> B' \<or> B' \<subseteq> B\<close> for B B'
[PROOF STATE]
proof (prove)
using this:
subset.chain (Collect on) C

goal (1 subgoal):
 1. (B \<in> C \<Longrightarrow> on B) &&& (\<lbrakk>B \<in> C; B' \<in> C\<rbrakk> \<Longrightarrow> B \<subseteq> B' \<or> B' \<subseteq> B)
[PROOF STEP]
by (auto simp: subset.chain_def)
[PROOF STATE]
proof (state)
this:
?B \<in> C \<Longrightarrow> on ?B
\<lbrakk>?B \<in> C; ?B' \<in> C\<rbrakk> \<Longrightarrow> ?B \<subseteq> ?B' \<or> ?B' \<subseteq> ?B

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
have \<open>is_orthogonal x y\<close> if \<open>x\<in>\<Union>C\<close> \<open>y\<in>\<Union>C\<close> \<open>x \<noteq> y\<close> for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_orthogonal x y
[PROOF STEP]
by (smt (verit) UnionE C_order C_on on_def is_ortho_set_def subsetD that(1) that(2) that(3))
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> \<Union> C; ?y \<in> \<Union> C; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> \<Union> C; ?y \<in> \<Union> C; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
have \<open>0 \<notin> \<Union> C\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<notin> \<Union> C
[PROOF STEP]
by (meson UnionE C_on is_ortho_set_def on_def)
[PROOF STATE]
proof (state)
this:
(0::'a) \<notin> \<Union> C

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(0::'a) \<notin> \<Union> C

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
have \<open>\<Union>C \<supseteq> S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> \<Union> C
[PROOF STEP]
using C_on \<open>C \<noteq> {}\<close> on_def
[PROOF STATE]
proof (prove)
using this:
?B \<in> C \<Longrightarrow> on ?B
C \<noteq> {}
on ?B = (S \<subseteq> ?B \<and> is_ortho_set ?B)

goal (1 subgoal):
 1. S \<subseteq> \<Union> C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S \<subseteq> \<Union> C

goal (1 subgoal):
 1. \<And>\<C>. \<lbrakk>\<C> \<noteq> {}; subset.chain (Collect on) \<C>\<rbrakk> \<Longrightarrow> on (\<Union> \<C>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> \<Union> C; ?y \<in> \<Union> C; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y
(0::'a) \<notin> \<Union> C
S \<subseteq> \<Union> C
[PROOF STEP]
show \<open>on (\<Union> C)\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> \<Union> C; ?y \<in> \<Union> C; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y
(0::'a) \<notin> \<Union> C
S \<subseteq> \<Union> C

goal (1 subgoal):
 1. on (\<Union> C)
[PROOF STEP]
unfolding on_def is_ortho_set_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> \<Union> C; ?y \<in> \<Union> C; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y
(0::'a) \<notin> \<Union> C
S \<subseteq> \<Union> C

goal (1 subgoal):
 1. S \<subseteq> \<Union> C \<and> (\<forall>x\<in>\<Union> C. \<forall>y\<in>\<Union> C. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> \<Union> C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
on (\<Union> C)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>B\<in>Collect on. \<forall>B'\<in>Collect on. B \<subseteq> B' \<longrightarrow> B' = B

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>B\<in>Collect on. \<forall>B'\<in>Collect on. B \<subseteq> B' \<longrightarrow> B' = B
[PROOF STEP]
obtain B where \<open>on B\<close> and B_max: \<open>B' \<supseteq> B \<Longrightarrow> on B' \<Longrightarrow> B=B'\<close> for B'
[PROOF STATE]
proof (prove)
using this:
\<exists>B\<in>Collect on. \<forall>B'\<in>Collect on. B \<subseteq> B' \<longrightarrow> B' = B

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>on B; \<And>B'. \<lbrakk>B \<subseteq> B'; on B'\<rbrakk> \<Longrightarrow> B = B'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
on B
\<lbrakk>B \<subseteq> ?B'; on ?B'\<rbrakk> \<Longrightarrow> B = ?B'

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
have \<open>\<psi> = 0\<close> if \<psi>ortho: \<open>\<forall>b\<in>B. is_orthogonal \<psi> b\<close> for \<psi> :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> = (0::'a)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
assume \<open>\<psi> \<noteq> 0\<close>
[PROOF STATE]
proof (state)
this:
\<psi> \<noteq> (0::'a)

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
define \<phi> B' where \<open>\<phi> = \<psi> /\<^sub>R norm \<psi>\<close> and \<open>B' = B \<union> {\<phi>}\<close>
[PROOF STATE]
proof (state)
this:
\<phi> = \<psi> /\<^sub>R norm \<psi>
B' = B \<union> {\<phi>}

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
have [simp]: \<open>norm \<phi> = 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm \<phi> = 1
[PROOF STEP]
using \<open>\<psi> \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
\<psi> \<noteq> (0::'a)

goal (1 subgoal):
 1. norm \<phi> = 1
[PROOF STEP]
by (auto simp: \<phi>_def)
[PROOF STATE]
proof (state)
this:
norm \<phi> = 1

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
have \<phi>ortho: \<open>is_orthogonal \<phi> b\<close> if \<open>b \<in> B\<close> for b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_orthogonal \<phi> b
[PROOF STEP]
using \<psi>ortho that \<phi>_def
[PROOF STATE]
proof (prove)
using this:
\<forall>b\<in>B. is_orthogonal \<psi> b
b \<in> B
\<phi> = \<psi> /\<^sub>R norm \<psi>

goal (1 subgoal):
 1. is_orthogonal \<phi> b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?b \<in> B \<Longrightarrow> is_orthogonal \<phi> ?b

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
have orthoB': \<open>is_orthogonal x y\<close> if \<open>x\<in>B'\<close> \<open>y\<in>B'\<close> \<open>x \<noteq> y\<close> for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_orthogonal x y
[PROOF STEP]
using that \<open>on B\<close> \<phi>ortho \<phi>ortho[THEN is_orthogonal_sym[THEN iffD1]]
[PROOF STATE]
proof (prove)
using this:
x \<in> B'
y \<in> B'
x \<noteq> y
on B
?b \<in> B \<Longrightarrow> is_orthogonal \<phi> ?b
?\<phi>1 \<in> B \<Longrightarrow> is_orthogonal ?\<phi>1 \<phi>

goal (1 subgoal):
 1. is_orthogonal x y
[PROOF STEP]
by (auto simp: B'_def on_def is_ortho_set_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> B'; ?y \<in> B'; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
have B'0: \<open>0 \<notin> B'\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<notin> B'
[PROOF STEP]
using B'_def \<open>norm \<phi> = 1\<close> \<open>on B\<close> is_ortho_set_def on_def
[PROOF STATE]
proof (prove)
using this:
B' = B \<union> {\<phi>}
norm \<phi> = 1
on B
is_ortho_set ?S = ((\<forall>x\<in>?S. \<forall>y\<in>?S. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::?'a) \<notin> ?S)
on ?B = (S \<subseteq> ?B \<and> is_ortho_set ?B)

goal (1 subgoal):
 1. (0::'a) \<notin> B'
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(0::'a) \<notin> B'

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
have \<open>S \<subseteq> B'\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> B'
[PROOF STEP]
using B'_def \<open>on B\<close> on_def
[PROOF STATE]
proof (prove)
using this:
B' = B \<union> {\<phi>}
on B
on ?B = (S \<subseteq> ?B \<and> is_ortho_set ?B)

goal (1 subgoal):
 1. S \<subseteq> B'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subseteq> B'

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
from orthoB' B'0 \<open>S \<subseteq> B'\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> B'; ?y \<in> B'; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y
(0::'a) \<notin> B'
S \<subseteq> B'
[PROOF STEP]
have \<open>on B'\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> B'; ?y \<in> B'; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y
(0::'a) \<notin> B'
S \<subseteq> B'

goal (1 subgoal):
 1. on B'
[PROOF STEP]
by (simp add: on_def is_ortho_set_def)
[PROOF STATE]
proof (state)
this:
on B'

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
with B_max
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>B \<subseteq> ?B'; on ?B'\<rbrakk> \<Longrightarrow> B = ?B'
on B'
[PROOF STEP]
have \<open>B = B'\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>B \<subseteq> ?B'; on ?B'\<rbrakk> \<Longrightarrow> B = ?B'
on B'

goal (1 subgoal):
 1. B = B'
[PROOF STEP]
by (metis B'_def Un_upper1)
[PROOF STATE]
proof (state)
this:
B = B'

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B = B'
[PROOF STEP]
have \<open>\<phi> \<in> B\<close>
[PROOF STATE]
proof (prove)
using this:
B = B'

goal (1 subgoal):
 1. \<phi> \<in> B
[PROOF STEP]
using B'_def
[PROOF STATE]
proof (prove)
using this:
B = B'
B' = B \<union> {\<phi>}

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

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<phi> \<in> B
[PROOF STEP]
have \<open>is_orthogonal \<phi> \<phi>\<close>
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> B

goal (1 subgoal):
 1. is_orthogonal \<phi> \<phi>
[PROOF STEP]
using \<phi>ortho
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> B
?b \<in> B \<Longrightarrow> is_orthogonal \<phi> ?b

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

goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_orthogonal \<phi> \<phi>
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
is_orthogonal \<phi> \<phi>

goal (1 subgoal):
 1. False
[PROOF STEP]
using B'0 \<open>B = B'\<close> \<open>\<phi> \<in> B\<close>
[PROOF STATE]
proof (prove)
using this:
is_orthogonal \<phi> \<phi>
(0::'a) \<notin> B'
B = B'
\<phi> \<in> B

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>B. is_orthogonal ?\<psi> b \<Longrightarrow> ?\<psi> = (0::'a)

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>b\<in>B. is_orthogonal ?\<psi> b \<Longrightarrow> ?\<psi> = (0::'a)
[PROOF STEP]
have \<open>orthogonal_complement B = {0}\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>b\<in>B. is_orthogonal ?\<psi> b \<Longrightarrow> ?\<psi> = (0::'a)

goal (1 subgoal):
 1. orthogonal_complement B = {0::'a}
[PROOF STEP]
by (auto simp: orthogonal_complement_def)
[PROOF STATE]
proof (state)
this:
orthogonal_complement B = {0::'a}

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
orthogonal_complement B = {0::'a}
[PROOF STEP]
have \<open>UNIV = orthogonal_complement (orthogonal_complement B)\<close>
[PROOF STATE]
proof (prove)
using this:
orthogonal_complement B = {0::'a}

goal (1 subgoal):
 1. UNIV = orthogonal_complement (orthogonal_complement B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
UNIV = orthogonal_complement (orthogonal_complement B)

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
UNIV = orthogonal_complement (orthogonal_complement B)

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
have \<open>\<dots> = orthogonal_complement (orthogonal_complement (closure (cspan B)))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement B) = orthogonal_complement (orthogonal_complement (closure (cspan B)))
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) \<open>orthogonal_complement B = {0}\<close> cinner_zero_left complex_vector.span_superset empty_iff insert_iff orthogonal_complementI orthogonal_complement_antimono orthogonal_complement_of_closure subsetI subset_antisym)
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement B) = orthogonal_complement (orthogonal_complement (closure (cspan B)))

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement B) = orthogonal_complement (orthogonal_complement (closure (cspan B)))

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
have \<open>\<dots> = closure (cspan B)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement (closure (cspan B))) = closure (cspan B)
[PROOF STEP]
apply (rule double_orthogonal_complement_id)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace (closure (cspan B))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement (closure (cspan B))) = closure (cspan B)

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
UNIV = closure (cspan B)
[PROOF STEP]
have \<open>closure (cspan B) = UNIV\<close>
[PROOF STATE]
proof (prove)
using this:
UNIV = closure (cspan B)

goal (1 subgoal):
 1. closure (cspan B) = UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closure (cspan B) = UNIV

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
with \<open>on B\<close>
[PROOF STATE]
proof (chain)
picking this:
on B
closure (cspan B) = UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
on B
closure (cspan B) = UNIV

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV
[PROOF STEP]
by (auto simp: on_def)
[PROOF STATE]
proof (state)
this:
\<exists>B. S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_power [continuous_intros]:
  fixes f :: "_ \<Rightarrow> 'b::{power,real_normed_algebra}"
  shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. (f x)^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. f x ^ n)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s) \<Longrightarrow> \<forall>x\<in>s. ((\<lambda>x. f x ^ n) \<longlongrightarrow> f x ^ n) (at x within s)
[PROOF STEP]
by (auto intro: tendsto_power)


[STATEMENT]
lemma eexp_strict_mono:
  "strict_mono eexp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono eexp
[PROOF STEP]
unfolding eexp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono (\<lambda>x. enn2ereal (ennexp x))
[PROOF STEP]
using ennexp_strict_mono
[PROOF STATE]
proof (prove)
using this:
strict_mono ennexp

goal (1 subgoal):
 1. strict_mono (\<lambda>x. enn2ereal (ennexp x))
[PROOF STEP]
unfolding strict_mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x < y \<longrightarrow> ennexp x < ennexp y

goal (1 subgoal):
 1. \<forall>x y. x < y \<longrightarrow> enn2ereal (ennexp x) < enn2ereal (ennexp y)
[PROOF STEP]
by (auto intro: mono_intros)


[STATEMENT]
lemma convex_connected:
  fixes S :: "'a::real_normed_vector set"
  assumes "convex S"
  shows "connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected S
[PROOF STEP]
proof (rule connectedI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix A B
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "open A" "open B" "A \<inter> B \<inter> S = {}" "S \<subseteq> A \<union> B"
[PROOF STATE]
proof (state)
this:
open A
open B
A \<inter> B \<inter> S = {}
S \<subseteq> A \<union> B

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open A
open B
A \<inter> B \<inter> S = {}
S \<subseteq> A \<union> B

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "A \<inter> S \<noteq> {}" "B \<inter> S \<noteq> {}"
[PROOF STATE]
proof (state)
this:
A \<inter> S \<noteq> {}
B \<inter> S \<noteq> {}

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<inter> S \<noteq> {}
B \<inter> S \<noteq> {}
[PROOF STEP]
obtain a b where a: "a \<in> A" "a \<in> S" and b: "b \<in> B" "b \<in> S"
[PROOF STATE]
proof (prove)
using this:
A \<inter> S \<noteq> {}
B \<inter> S \<noteq> {}

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> A; a \<in> S; b \<in> B; b \<in> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> A
a \<in> S
b \<in> B
b \<in> S

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define f where [abs_def]: "f u = u *\<^sub>R a + (1 - u) *\<^sub>R b" for u
[PROOF STATE]
proof (state)
this:
f \<equiv> \<lambda>u. u *\<^sub>R a + (1 - u) *\<^sub>R b

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<equiv> \<lambda>u. u *\<^sub>R a + (1 - u) *\<^sub>R b
[PROOF STEP]
have "continuous_on {0 .. 1} f"
[PROOF STATE]
proof (prove)
using this:
f \<equiv> \<lambda>u. u *\<^sub>R a + (1 - u) *\<^sub>R b

goal (1 subgoal):
 1. continuous_on {0..1} f
[PROOF STEP]
by (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} f

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} f
[PROOF STEP]
have "connected (f ` {0 .. 1})"
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} f

goal (1 subgoal):
 1. connected (f ` {0..1})
[PROOF STEP]
by (auto intro!: connected_continuous_image)
[PROOF STATE]
proof (state)
this:
connected (f ` {0..1})

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
note connectedD[OF this, of A B]
[PROOF STATE]
proof (state)
this:
\<lbrakk>open A; open B; A \<inter> B \<inter> f ` {0..1} = {}; f ` {0..1} \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> A \<inter> f ` {0..1} = {} \<or> B \<inter> f ` {0..1} = {}

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>open A; open B; A \<inter> B \<inter> f ` {0..1} = {}; f ` {0..1} \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> A \<inter> f ` {0..1} = {} \<or> B \<inter> f ` {0..1} = {}

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "a \<in> A \<inter> f ` {0 .. 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> A \<inter> f ` {0..1}
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
a \<in> A
a \<in> S

goal (1 subgoal):
 1. a \<in> A \<inter> f ` {0..1}
[PROOF STEP]
by (auto intro!: image_eqI[of _ _ 1] simp: f_def)
[PROOF STATE]
proof (state)
this:
a \<in> A \<inter> f ` {0..1}

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<in> A \<inter> f ` {0..1}

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "b \<in> B \<inter> f ` {0 .. 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> B \<inter> f ` {0..1}
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
b \<in> B
b \<in> S

goal (1 subgoal):
 1. b \<in> B \<inter> f ` {0..1}
[PROOF STEP]
by (auto intro!: image_eqI[of _ _ 0] simp: f_def)
[PROOF STATE]
proof (state)
this:
b \<in> B \<inter> f ` {0..1}

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<in> B \<inter> f ` {0..1}

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "f ` {0 .. 1} \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {0..1} \<subseteq> S
[PROOF STEP]
using \<open>convex S\<close> a b
[PROOF STATE]
proof (prove)
using this:
convex S
a \<in> A
a \<in> S
b \<in> B
b \<in> S

goal (1 subgoal):
 1. f ` {0..1} \<subseteq> S
[PROOF STEP]
unfolding convex_def f_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<forall>y\<in>S. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
a \<in> A
a \<in> S
b \<in> B
b \<in> S

goal (1 subgoal):
 1. (\<lambda>u. u *\<^sub>R a + (1 - u) *\<^sub>R b) ` {0..1} \<subseteq> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` {0..1} \<subseteq> S

goal (1 subgoal):
 1. \<And>A B. \<lbrakk>open A; open B; A \<inter> S \<noteq> {}; B \<inter> S \<noteq> {}; A \<inter> B \<inter> S = {}; S \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
open A
open B
A \<inter> B \<inter> S = {}
S \<subseteq> A \<union> B
\<lbrakk>open A; open B; A \<inter> B \<inter> f ` {0..1} = {}; f ` {0..1} \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> A \<inter> f ` {0..1} = {} \<or> B \<inter> f ` {0..1} = {}
a \<in> A \<inter> f ` {0..1}
b \<in> B \<inter> f ` {0..1}
f ` {0..1} \<subseteq> S
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
open A
open B
A \<inter> B \<inter> S = {}
S \<subseteq> A \<union> B
\<lbrakk>open A; open B; A \<inter> B \<inter> f ` {0..1} = {}; f ` {0..1} \<subseteq> A \<union> B\<rbrakk> \<Longrightarrow> A \<inter> f ` {0..1} = {} \<or> B \<inter> f ` {0..1} = {}
a \<in> A \<inter> f ` {0..1}
b \<in> B \<inter> f ` {0..1}
f ` {0..1} \<subseteq> S

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma independent_not_zero_rows_rref:
  fixes A::"'a::{field}^'m::{mod_type}^'n::{finite,one,plus,ord}"
  assumes rref_A: "reduced_row_echelon_form A"
  shows "vec.independent {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
define R where "R = {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (state)
this:
R = {row i A |i. row i A \<noteq> 0}

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
assume dep: "vec.dependent R"
[PROOF STATE]
proof (state)
this:
vec.dependent R

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
vec.dependent R
[PROOF STEP]
obtain a where a_in_R: "a\<in>R" and a_in_span: "a \<in> vec.span (R - {a})"
[PROOF STATE]
proof (prove)
using this:
vec.dependent R

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> R; a \<in> vec.span (R - {a})\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding vec.dependent_def
[PROOF STATE]
proof (prove)
using this:
\<exists>a\<in>R. a \<in> vec.span (R - {a})

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> R; a \<in> vec.span (R - {a})\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
a \<in> R
a \<in> vec.span (R - {a})

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
from a_in_R
[PROOF STATE]
proof (chain)
picking this:
a \<in> R
[PROOF STEP]
obtain i where a_eq_row_i_A: "a=row i A"
[PROOF STATE]
proof (prove)
using this:
a \<in> R

goal (1 subgoal):
 1. (\<And>i. a = row i A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding R_def
[PROOF STATE]
proof (prove)
using this:
a \<in> {row i A |i. row i A \<noteq> 0}

goal (1 subgoal):
 1. (\<And>i. a = row i A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a = row i A

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
hence a_eq_Ai: "a = A $ i"
[PROOF STATE]
proof (prove)
using this:
a = row i A

goal (1 subgoal):
 1. a = A $ i
[PROOF STEP]
unfolding row_def
[PROOF STATE]
proof (prove)
using this:
a = vec_lambda (($) (A $ i))

goal (1 subgoal):
 1. a = A $ i
[PROOF STEP]
unfolding vec_nth_inverse
[PROOF STATE]
proof (prove)
using this:
a = A $ i

goal (1 subgoal):
 1. a = A $ i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
a = A $ i

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
have row_i_A_not_zero: "\<not> is_zero_row i A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_zero_row i A
[PROOF STEP]
using a_in_R
[PROOF STATE]
proof (prove)
using this:
a \<in> R

goal (1 subgoal):
 1. \<not> is_zero_row i A
[PROOF STEP]
unfolding R_def is_zero_row_def is_zero_row_upt_ncols row_def vec_nth_inverse
[PROOF STATE]
proof (prove)
using this:
a \<in> {A $ i |i. A $ i \<noteq> 0}

goal (1 subgoal):
 1. \<not> (\<forall>j. A $ i $ j = (0::'a))
[PROOF STEP]
unfolding vec_lambda_unique zero_vec_def mem_Collect_eq
[PROOF STATE]
proof (prove)
using this:
\<exists>i. a = A $ i \<and> A $ i \<noteq> (\<chi>i. (0::'a))

goal (1 subgoal):
 1. (\<chi>j. (0::'a)) \<noteq> A $ i
[PROOF STEP]
using a_eq_Ai
[PROOF STATE]
proof (prove)
using this:
\<exists>i. a = A $ i \<and> A $ i \<noteq> (\<chi>i. (0::'a))
a = A $ i

goal (1 subgoal):
 1. (\<chi>j. (0::'a)) \<noteq> A $ i
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<not> is_zero_row i A

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
define least_n where "least_n = (LEAST n. A $ i $ n \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
least_n = (LEAST n. A $ i $ n \<noteq> (0::'a))

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
have span_rw: "vec.span (R - {a}) = range (\<lambda>u. \<Sum>v\<in>R - {a}. u v *s v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.span (R - {a}) = range (\<lambda>u. \<Sum>v\<in>R - {a}. u v *s v)
[PROOF STEP]
proof (rule vec.span_finite)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (R - {a})
[PROOF STEP]
show "finite (R - {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (R - {a})
[PROOF STEP]
using finite_rows[of A]
[PROOF STATE]
proof (prove)
using this:
finite (rows A)

goal (1 subgoal):
 1. finite (R - {a})
[PROOF STEP]
unfolding rows_def R_def
[PROOF STATE]
proof (prove)
using this:
finite {row i A |i. i \<in> UNIV}

goal (1 subgoal):
 1. finite ({row i A |i. row i A \<noteq> 0} - {a})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (R - {a})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vec.span (R - {a}) = range (\<lambda>u. \<Sum>v\<in>R - {a}. u v *s v)

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
vec.span (R - {a}) = range (\<lambda>u. \<Sum>v\<in>R - {a}. u v *s v)
[PROOF STEP]
obtain f where f: "(\<Sum>v\<in>(R - {a}). f v *s v) = a"
[PROOF STATE]
proof (prove)
using this:
vec.span (R - {a}) = range (\<lambda>u. \<Sum>v\<in>R - {a}. u v *s v)

goal (1 subgoal):
 1. (\<And>f. (\<Sum>v\<in>R - {a}. f v *s v) = a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using a_in_span
[PROOF STATE]
proof (prove)
using this:
vec.span (R - {a}) = range (\<lambda>u. \<Sum>v\<in>R - {a}. u v *s v)
a \<in> vec.span (R - {a})

goal (1 subgoal):
 1. (\<And>f. (\<Sum>v\<in>R - {a}. f v *s v) = a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (no_types, lifting) imageE)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>R - {a}. f v *s v) = a

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
have "1 = a $ least_n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) = a $ least_n
[PROOF STEP]
using rref_condition2[OF rref_A] row_i_A_not_zero
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<not> is_zero_row i A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
\<not> is_zero_row i A

goal (1 subgoal):
 1. (1::'a) = a $ least_n
[PROOF STEP]
unfolding least_n_def a_eq_Ai
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<not> is_zero_row i A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
\<not> is_zero_row i A

goal (1 subgoal):
 1. (1::'a) = A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(1::'a) = a $ least_n

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) = a $ least_n

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
have"... = (\<Sum>v\<in>(R - {a}). f v *s v) $ least_n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a $ least_n = (\<Sum>v\<in>R - {a}. f v *s v) $ least_n
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>R - {a}. f v *s v) = a

goal (1 subgoal):
 1. a $ least_n = (\<Sum>v\<in>R - {a}. f v *s v) $ least_n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a $ least_n = (\<Sum>v\<in>R - {a}. f v *s v) $ least_n

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a $ least_n = (\<Sum>v\<in>R - {a}. f v *s v) $ least_n

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
have "... = (\<Sum>v\<in>(R - {a}). (f v *s v) $ least_n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>R - {a}. f v *s v) $ least_n = (\<Sum>v\<in>R - {a}. (f v *s v) $ least_n)
[PROOF STEP]
unfolding sum_component
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>R - {a}. (f x *s x) $ least_n) = (\<Sum>v\<in>R - {a}. (f v *s v) $ least_n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>R - {a}. f v *s v) $ least_n = (\<Sum>v\<in>R - {a}. (f v *s v) $ least_n)

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>R - {a}. f v *s v) $ least_n = (\<Sum>v\<in>R - {a}. (f v *s v) $ least_n)

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
have "... = (\<Sum>v\<in>(R - {a}). (f v) * (v $ least_n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>R - {a}. (f v *s v) $ least_n) = (\<Sum>v\<in>R - {a}. f v * v $ least_n)
[PROOF STEP]
unfolding vector_smult_component
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>R - {a}. f v * v $ least_n) = (\<Sum>v\<in>R - {a}. f v * v $ least_n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>R - {a}. (f v *s v) $ least_n) = (\<Sum>v\<in>R - {a}. f v * v $ least_n)

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>R - {a}. (f v *s v) $ least_n) = (\<Sum>v\<in>R - {a}. f v * v $ least_n)

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
have "... = (\<Sum>v\<in>(R - {a}). 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>R - {a}. f v * v $ least_n) = (\<Sum>v\<in>R - {a}. (0::'a))
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. R - {a} = R - {a}
 2. \<And>x. x \<in> R - {a} \<Longrightarrow> f x * x $ least_n = (0::'a)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. R - {a} = R - {a}
 2. \<And>x. x \<in> R - {a} \<Longrightarrow> f x * x $ least_n = (0::'a)
[PROOF STEP]
assume x: "x \<in> R - {a}"
[PROOF STATE]
proof (state)
this:
x \<in> R - {a}

goal (2 subgoals):
 1. R - {a} = R - {a}
 2. \<And>x. x \<in> R - {a} \<Longrightarrow> f x * x $ least_n = (0::'a)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
x \<in> R - {a}
[PROOF STEP]
obtain j where x_eq_row_j_A: "x=row j A"
[PROOF STATE]
proof (prove)
using this:
x \<in> R - {a}

goal (1 subgoal):
 1. (\<And>j. x = row j A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding R_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {row i A |i. row i A \<noteq> 0} - {a}

goal (1 subgoal):
 1. (\<And>j. x = row j A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = row j A

goal (2 subgoals):
 1. R - {a} = R - {a}
 2. \<And>x. x \<in> R - {a} \<Longrightarrow> f x * x $ least_n = (0::'a)
[PROOF STEP]
hence i_not_j: "i \<noteq> j"
[PROOF STATE]
proof (prove)
using this:
x = row j A

goal (1 subgoal):
 1. i \<noteq> j
[PROOF STEP]
using a_eq_row_i_A x
[PROOF STATE]
proof (prove)
using this:
x = row j A
a = row i A
x \<in> R - {a}

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

goal (2 subgoals):
 1. R - {a} = R - {a}
 2. \<And>x. x \<in> R - {a} \<Longrightarrow> f x * x $ least_n = (0::'a)
[PROOF STEP]
have x_least_is_zero: "x $ least_n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x $ least_n = (0::'a)
[PROOF STEP]
using rref_condition4[OF rref_A] i_not_j row_i_A_not_zero
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<not> is_zero_row i A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a))
i \<noteq> j
\<not> is_zero_row i A

goal (1 subgoal):
 1. x $ least_n = (0::'a)
[PROOF STEP]
unfolding x_eq_row_j_A least_n_def row_def vec_nth_inverse
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<not> is_zero_row i A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a))
i \<noteq> j
\<not> is_zero_row i A

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x $ least_n = (0::'a)

goal (2 subgoals):
 1. R - {a} = R - {a}
 2. \<And>x. x \<in> R - {a} \<Longrightarrow> f x * x $ least_n = (0::'a)
[PROOF STEP]
show "f x * x $ least_n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x * x $ least_n = (0::'a)
[PROOF STEP]
unfolding x_least_is_zero
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x * (0::'a) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f x * x $ least_n = (0::'a)

goal (1 subgoal):
 1. R - {a} = R - {a}
[PROOF STEP]
qed rule
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>R - {a}. f v * v $ least_n) = (\<Sum>v\<in>R - {a}. (0::'a))

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>R - {a}. f v * v $ least_n) = (\<Sum>v\<in>R - {a}. (0::'a))

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>R - {a}. (0::'a)) = (0::'a)
[PROOF STEP]
unfolding sum.neutral_const
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) = (0::'a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>R - {a}. (0::'a)) = (0::'a)

goal (1 subgoal):
 1. vec.dependent {row i A |i. row i A \<noteq> 0} \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1::'a) = (0::'a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(1::'a) = (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "ipv6addr_toString (ipv6preferred_to_int
          (IPv6AddrPreferred 0x2001 0xdb8 0x0 0x0 0x0 0x0 0x0 0x1)) =
              ''2001:db8::1''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv6addr_toString (ipv6preferred_to_int (IPv6AddrPreferred 8193 3512 0 0 0 0 0 1)) = ''2001:db8::1''
[PROOF STEP]
by eval \<comment> \<open>Section 4.1 of RFC5952\<close>


[STATEMENT]
lemma landau_rat_ceil:
  assumes "(\<lambda>_. 1) \<in> O[F'](g)"
  assumes "(\<lambda>x. real_of_rat (f x)) \<in> O[F'](g)"
  shows "(\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)
[PROOF STEP]
have a:"\<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>" for x :: rat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
proof (cases "x \<ge> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
 2. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
 2. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
by  (simp, metis  add.commute  of_int_ceiling_le_add_one of_rat_ceiling)
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> x

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
have "real_of_rat x - 1 \<le> real_of_rat x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat x - 1 \<le> real_of_rat x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_rat x - 1 \<le> real_of_rat x

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_rat x - 1 \<le> real_of_rat x

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
have "... \<le> real_of_int \<lceil>x\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat x \<le> real_of_int \<lceil>x\<rceil>
[PROOF STEP]
by (metis ceiling_correct of_rat_ceiling)
[PROOF STATE]
proof (state)
this:
real_of_rat x \<le> real_of_int \<lceil>x\<rceil>

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_rat x - 1 \<le> real_of_int \<lceil>x\<rceil>
[PROOF STEP]
have " real_of_rat (x)-1 \<le> real_of_int \<lceil>x\<rceil>"
[PROOF STATE]
proof (prove)
using this:
real_of_rat x - 1 \<le> real_of_int \<lceil>x\<rceil>

goal (1 subgoal):
 1. real_of_rat x - 1 \<le> real_of_int \<lceil>x\<rceil>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_rat x - 1 \<le> real_of_int \<lceil>x\<rceil>

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
hence "- real_of_int \<lceil>x\<rceil> \<le> 1 + real_of_rat (- x)"
[PROOF STATE]
proof (prove)
using this:
real_of_rat x - 1 \<le> real_of_int \<lceil>x\<rceil>

goal (1 subgoal):
 1. - real_of_int \<lceil>x\<rceil> \<le> 1 + real_of_rat (- x)
[PROOF STEP]
by (simp add: of_rat_minus)
[PROOF STATE]
proof (state)
this:
- real_of_int \<lceil>x\<rceil> \<le> 1 + real_of_rat (- x)

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- real_of_int \<lceil>x\<rceil> \<le> 1 + real_of_rat (- x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
- real_of_int \<lceil>x\<rceil> \<le> 1 + real_of_rat (- x)

goal (1 subgoal):
 1. \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
- real_of_int \<lceil>x\<rceil> \<le> 1 + real_of_rat (- x)
\<not> 0 \<le> x

goal (1 subgoal):
 1. \<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int \<lceil>x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>x\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int \<lceil>?x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>?x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)
[PROOF STEP]
have "(\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](\<lambda>x. 1 + abs (real_of_rat (f x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](\<lambda>x. 1 + \<bar>real_of_rat (f x)\<bar>)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
\<bar>real_of_int \<lceil>?x\<rceil>\<bar> \<le> 1 + real_of_rat \<bar>?x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](\<lambda>x. 1 + \<bar>real_of_rat (f x)\<bar>)
[PROOF STEP]
by (intro landau_o.big_mono always_eventually allI, simp)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](\<lambda>x. 1 + \<bar>real_of_rat (f x)\<bar>)

goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](\<lambda>x. 1 + \<bar>real_of_rat (f x)\<bar>)

goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)
[PROOF STEP]
have "(\<lambda>x. 1 + abs (real_of_rat (f x))) \<in> O[F'](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. 1 + \<bar>real_of_rat (f x)\<bar>) \<in> O[F'](g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>_. 1) \<in> O[F'](g)
(\<lambda>x. real_of_rat (f x)) \<in> O[F'](g)

goal (1 subgoal):
 1. (\<lambda>x. 1 + \<bar>real_of_rat (f x)\<bar>) \<in> O[F'](g)
[PROOF STEP]
by (intro sum_in_bigo assms(1), subst landau_o.big.abs_in_iff, simp)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. 1 + \<bar>real_of_rat (f x)\<bar>) \<in> O[F'](g)

goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)

goal (1 subgoal):
 1. (\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real_of_int \<lceil>f x\<rceil>) \<in> O[F'](g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma non_distinct_repetition_indices_rev :
  assumes "i < j" and "j < length xs" and "xs ! i = xs ! j"
  shows "\<not> distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> distinct xs
[PROOF STEP]
using assms nth_eq_iff_index_eq
[PROOF STATE]
proof (prove)
using this:
i < j
j < length xs
xs ! i = xs ! j
\<lbrakk>distinct ?xs; ?i < length ?xs; ?j < length ?xs\<rbrakk> \<Longrightarrow> (?xs ! ?i = ?xs ! ?j) = (?i = ?j)

goal (1 subgoal):
 1. \<not> distinct xs
[PROOF STEP]
by fastforce


[STATEMENT]
lemma F_Un_D_card: "card (F \<union> D) = nat ((p - 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (F \<union> D) = nat (int ((p - 1) div 2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (F \<union> D) = nat (int ((p - 1) div 2))
[PROOF STEP]
have "card (F \<union> D) = card E + card D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (F \<union> D) = card E + card D
[PROOF STEP]
by (auto simp add: finite_F finite_D F_D_disj card_Un_disjoint F_card_eq_E)
[PROOF STATE]
proof (state)
this:
card (F \<union> D) = card E + card D

goal (1 subgoal):
 1. card (F \<union> D) = nat (int ((p - 1) div 2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (F \<union> D) = card E + card D
[PROOF STEP]
have "card (F \<union> D) = card C"
[PROOF STATE]
proof (prove)
using this:
card (F \<union> D) = card E + card D

goal (1 subgoal):
 1. card (F \<union> D) = card C
[PROOF STEP]
by (simp add: C_card_eq_D_plus_E)
[PROOF STATE]
proof (state)
this:
card (F \<union> D) = card C

goal (1 subgoal):
 1. card (F \<union> D) = nat (int ((p - 1) div 2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (F \<union> D) = card C
[PROOF STEP]
show "card (F \<union> D) = nat ((p - 1) div 2)"
[PROOF STATE]
proof (prove)
using this:
card (F \<union> D) = card C

goal (1 subgoal):
 1. card (F \<union> D) = nat (int ((p - 1) div 2))
[PROOF STEP]
by (simp add: C_card_eq_B B_card_eq)
[PROOF STATE]
proof (state)
this:
card (F \<union> D) = nat (int ((p - 1) div 2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NSLIM_zero_cancel:
  assumes "(\<lambda>x. f x - l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0"
  shows "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
have "(\<lambda>x. f x - l + l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0 + l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x - l + l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (0::'b) + l
[PROOF STEP]
by (fast intro: assms NSLIM_const NSLIM_add)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x - l + l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (0::'b) + l

goal (1 subgoal):
 1. f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. f x - l + l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (0::'b) + l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f x - l + l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (0::'b) + l

goal (1 subgoal):
 1. f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_dff_mult_right_trans[trans]: "x =dff y * z \<Longrightarrow> z =dff u \<Longrightarrow> x =dff y * u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x =dff y * z; z =dff u\<rbrakk> \<Longrightarrow> x =dff y * u
[PROOF STEP]
using eq_dff_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x =dff ?y; ?y =dff ?z\<rbrakk> \<Longrightarrow> ?x =dff ?z

goal (1 subgoal):
 1. \<lbrakk>x =dff y * z; z =dff u\<rbrakk> \<Longrightarrow> x =dff y * u
[PROOF STEP]
by force


[STATEMENT]
lemma InternalSets_diff: "X \<in> InternalSets \<Longrightarrow> Y \<in> InternalSets \<Longrightarrow> X - Y \<in> InternalSets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<in> InternalSets; Y \<in> InternalSets\<rbrakk> \<Longrightarrow> X - Y \<in> InternalSets
[PROOF STEP]
by (auto simp add: InternalSets_def starset_n_diff [symmetric])


[STATEMENT]
lemma inv_Mp_rev: assumes bnd: "\<And> n. 2 * abs (coeff f n) < m"
  shows "inv_Mp (Mp f) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_Mp (Mp f) = f
[PROOF STEP]
proof (rule poly_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. coeff (inv_Mp (Mp f)) n = coeff f n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. coeff (inv_Mp (Mp f)) n = coeff f n
[PROOF STEP]
define c where "c = coeff f n"
[PROOF STATE]
proof (state)
this:
c = coeff f n

goal (1 subgoal):
 1. \<And>n. coeff (inv_Mp (Mp f)) n = coeff f n
[PROOF STEP]
from bnd[of n, folded c_def]
[PROOF STATE]
proof (chain)
picking this:
2 * \<bar>c\<bar> < m
[PROOF STEP]
have bnd: "2 * abs c < m"
[PROOF STATE]
proof (prove)
using this:
2 * \<bar>c\<bar> < m

goal (1 subgoal):
 1. 2 * \<bar>c\<bar> < m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * \<bar>c\<bar> < m

goal (1 subgoal):
 1. \<And>n. coeff (inv_Mp (Mp f)) n = coeff f n
[PROOF STEP]
show "coeff (inv_Mp (Mp f)) n = coeff f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (inv_Mp (Mp f)) n = coeff f n
[PROOF STEP]
unfolding inv_Mp_coeff Mp_coeff c_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_M (M c) = c
[PROOF STEP]
using inv_M_rev[OF bnd]
[PROOF STATE]
proof (prove)
using this:
inv_M (M c) = c

goal (1 subgoal):
 1. inv_M (M c) = c
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
coeff (inv_Mp (Mp f)) n = coeff f n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fmeasurable_UN:
  assumes "countable I" "\<And>i. i \<in> I \<Longrightarrow> F i \<subseteq> A" "\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets M" "A \<in> fmeasurable M"
  shows "(\<Union>i\<in>I. F i) \<in> fmeasurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (F ` I) \<in> fmeasurable M
[PROOF STEP]
proof (rule fmeasurableI2)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?A \<in> fmeasurable M
 2. \<Union> (F ` I) \<subseteq> ?A
 3. \<Union> (F ` I) \<in> sets M
[PROOF STEP]
show "A \<in> fmeasurable M" "(\<Union>i\<in>I. F i) \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> fmeasurable M &&& \<Union> (F ` I) \<subseteq> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
countable I
?i \<in> I \<Longrightarrow> F ?i \<subseteq> A
?i \<in> I \<Longrightarrow> F ?i \<in> sets M
A \<in> fmeasurable M

goal (1 subgoal):
 1. A \<in> fmeasurable M &&& \<Union> (F ` I) \<subseteq> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> fmeasurable M
\<Union> (F ` I) \<subseteq> A

goal (1 subgoal):
 1. \<Union> (F ` I) \<in> sets M
[PROOF STEP]
show "(\<Union>i\<in>I. F i) \<in> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (F ` I) \<in> sets M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
countable I
?i \<in> I \<Longrightarrow> F ?i \<subseteq> A
?i \<in> I \<Longrightarrow> F ?i \<in> sets M
A \<in> fmeasurable M

goal (1 subgoal):
 1. \<Union> (F ` I) \<in> sets M
[PROOF STEP]
by (intro sets.countable_UN') auto
[PROOF STATE]
proof (state)
this:
\<Union> (F ` I) \<in> sets M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_is_zero: "\<exists>!x::real. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!x. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0
[PROOF STEP]
proof (rule ex_ex1I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>x\<ge>0. x \<le> 2 \<and> cos x = 0
 2. \<And>x y. \<lbrakk>0 \<le> x \<and> x \<le> 2 \<and> cos x = 0; 0 \<le> y \<and> y \<le> 2 \<and> cos y = 0\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
show "\<exists>x::real. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<ge>0. x \<le> 2 \<and> cos x = 0
[PROOF STEP]
by (rule IVT2) simp_all
[PROOF STATE]
proof (state)
this:
\<exists>x\<ge>0. x \<le> 2 \<and> cos x = 0

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 \<le> x \<and> x \<le> 2 \<and> cos x = 0; 0 \<le> y \<and> y \<le> 2 \<and> cos y = 0\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 \<le> x \<and> x \<le> 2 \<and> cos x = 0; 0 \<le> y \<and> y \<le> 2 \<and> cos y = 0\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix a b :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 \<le> x \<and> x \<le> 2 \<and> cos x = 0; 0 \<le> y \<and> y \<le> 2 \<and> cos y = 0\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume ab: "0 \<le> a \<and> a \<le> 2 \<and> cos a = 0" "0 \<le> b \<and> b \<le> 2 \<and> cos b = 0"
[PROOF STATE]
proof (state)
this:
0 \<le> a \<and> a \<le> 2 \<and> cos a = 0
0 \<le> b \<and> b \<le> 2 \<and> cos b = 0

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 \<le> x \<and> x \<le> 2 \<and> cos x = 0; 0 \<le> y \<and> y \<le> 2 \<and> cos y = 0\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have cosd: "\<And>x::real. cos differentiable (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. cos differentiable at x
[PROOF STEP]
unfolding real_differentiable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<exists>D. (cos has_real_derivative D) (at x)
[PROOF STEP]
by (auto intro: DERIV_cos)
[PROOF STATE]
proof (state)
this:
cos differentiable at ?x

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 \<le> x \<and> x \<le> 2 \<and> cos x = 0; 0 \<le> y \<and> y \<le> 2 \<and> cos y = 0\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
show "a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = b
[PROOF STEP]
proof (cases a b rule: linorder_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. a < b \<Longrightarrow> a = b
 2. a = b \<Longrightarrow> a = b
 3. b < a \<Longrightarrow> a = b
[PROOF STEP]
case less
[PROOF STATE]
proof (state)
this:
a < b

goal (3 subgoals):
 1. a < b \<Longrightarrow> a = b
 2. a = b \<Longrightarrow> a = b
 3. b < a \<Longrightarrow> a = b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < b
[PROOF STEP]
obtain z where "a < z" "z < b" "(cos has_real_derivative 0) (at z)"
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>a < z; z < b; (cos has_real_derivative 0) (at z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Rolle
[PROOF STATE]
proof (prove)
using this:
a < b
\<lbrakk>?a < ?b; ?f ?a = ?f ?b; continuous_on {?a..?b} ?f; \<And>x. \<lbrakk>?a < x; x < ?b\<rbrakk> \<Longrightarrow> ?f differentiable at x\<rbrakk> \<Longrightarrow> \<exists>z>?a. z < ?b \<and> (?f has_real_derivative 0) (at z)

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>a < z; z < b; (cos has_real_derivative 0) (at z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis cosd continuous_on_cos_real ab)
[PROOF STATE]
proof (state)
this:
a < z
z < b
(cos has_real_derivative 0) (at z)

goal (3 subgoals):
 1. a < b \<Longrightarrow> a = b
 2. a = b \<Longrightarrow> a = b
 3. b < a \<Longrightarrow> a = b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < z
z < b
(cos has_real_derivative 0) (at z)
[PROOF STEP]
have "sin z = 0"
[PROOF STATE]
proof (prove)
using this:
a < z
z < b
(cos has_real_derivative 0) (at z)

goal (1 subgoal):
 1. sin z = 0
[PROOF STEP]
using DERIV_cos DERIV_unique neg_equal_0_iff_equal
[PROOF STATE]
proof (prove)
using this:
a < z
z < b
(cos has_real_derivative 0) (at z)
(cos has_field_derivative - sin ?x) (at ?x)
\<lbrakk>(?f has_field_derivative ?D) (at ?x); (?f has_field_derivative ?E) (at ?x)\<rbrakk> \<Longrightarrow> ?D = ?E
(- ?a = (0::?'a)) = (?a = (0::?'a))

goal (1 subgoal):
 1. sin z = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sin z = 0

goal (3 subgoals):
 1. a < b \<Longrightarrow> a = b
 2. a = b \<Longrightarrow> a = b
 3. b < a \<Longrightarrow> a = b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sin z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sin z = 0

goal (1 subgoal):
 1. a = b
[PROOF STEP]
by (metis \<open>a < z\<close> \<open>z < b\<close> ab order_less_le_trans less_le sin_gt_zero_02)
[PROOF STATE]
proof (state)
this:
a = b

goal (2 subgoals):
 1. a = b \<Longrightarrow> a = b
 2. b < a \<Longrightarrow> a = b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = b \<Longrightarrow> a = b
 2. b < a \<Longrightarrow> a = b
[PROOF STEP]
case greater
[PROOF STATE]
proof (state)
this:
b < a

goal (2 subgoals):
 1. a = b \<Longrightarrow> a = b
 2. b < a \<Longrightarrow> a = b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b < a
[PROOF STEP]
obtain z where "b < z" "z < a" "(cos has_real_derivative 0) (at z)"
[PROOF STATE]
proof (prove)
using this:
b < a

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>b < z; z < a; (cos has_real_derivative 0) (at z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Rolle
[PROOF STATE]
proof (prove)
using this:
b < a
\<lbrakk>?a < ?b; ?f ?a = ?f ?b; continuous_on {?a..?b} ?f; \<And>x. \<lbrakk>?a < x; x < ?b\<rbrakk> \<Longrightarrow> ?f differentiable at x\<rbrakk> \<Longrightarrow> \<exists>z>?a. z < ?b \<and> (?f has_real_derivative 0) (at z)

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>b < z; z < a; (cos has_real_derivative 0) (at z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis cosd continuous_on_cos_real ab)
[PROOF STATE]
proof (state)
this:
b < z
z < a
(cos has_real_derivative 0) (at z)

goal (2 subgoals):
 1. a = b \<Longrightarrow> a = b
 2. b < a \<Longrightarrow> a = b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b < z
z < a
(cos has_real_derivative 0) (at z)
[PROOF STEP]
have "sin z = 0"
[PROOF STATE]
proof (prove)
using this:
b < z
z < a
(cos has_real_derivative 0) (at z)

goal (1 subgoal):
 1. sin z = 0
[PROOF STEP]
using DERIV_cos DERIV_unique neg_equal_0_iff_equal
[PROOF STATE]
proof (prove)
using this:
b < z
z < a
(cos has_real_derivative 0) (at z)
(cos has_field_derivative - sin ?x) (at ?x)
\<lbrakk>(?f has_field_derivative ?D) (at ?x); (?f has_field_derivative ?E) (at ?x)\<rbrakk> \<Longrightarrow> ?D = ?E
(- ?a = (0::?'a)) = (?a = (0::?'a))

goal (1 subgoal):
 1. sin z = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sin z = 0

goal (2 subgoals):
 1. a = b \<Longrightarrow> a = b
 2. b < a \<Longrightarrow> a = b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sin z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sin z = 0

goal (1 subgoal):
 1. a = b
[PROOF STEP]
by (metis \<open>b < z\<close> \<open>z < a\<close> ab order_less_le_trans less_le sin_gt_zero_02)
[PROOF STATE]
proof (state)
this:
a = b

goal (1 subgoal):
 1. a = b \<Longrightarrow> a = b
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
a = b

goal:
No subgoals!
[PROOF STEP]
qed