[STATEMENT]
lemma zor_poly_zero_eq:
  assumes "f holomorphic_on s" "open s" "connected s" "z \<in> s" "\<exists>w\<in>s. f w \<noteq> 0"
  shows "eventually (\<lambda>w. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)) (at z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F w in at z. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F w in at z. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)
[PROOF STEP]
obtain r where r:"r>0"
       "(\<forall>w\<in>cball z r - {z}. f w = zor_poly f z w * (w - z) ^ nat (zorder f z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; \<forall>w\<in>cball z r - {z}. f w = zor_poly f z w * (w - z) ^ nat (zorder f z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using zorder_exist_zero[OF assms]
[PROOF STATE]
proof (prove)
using this:
(if f z = 0 then 0 < zorder f z else zorder f z = 0) \<and> (\<exists>r>0. cball z r \<subseteq> s \<and> zor_poly f z holomorphic_on cball z r \<and> (\<forall>w\<in>cball z r. f w = zor_poly f z w * (w - z) ^ nat (zorder f z) \<and> zor_poly f z w \<noteq> 0))

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; \<forall>w\<in>cball z r - {z}. f w = zor_poly f z w * (w - z) ^ nat (zorder f z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < r
\<forall>w\<in>cball z r - {z}. f w = zor_poly f z w * (w - z) ^ nat (zorder f z)

goal (1 subgoal):
 1. \<forall>\<^sub>F w in at z. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < r
\<forall>w\<in>cball z r - {z}. f w = zor_poly f z w * (w - z) ^ nat (zorder f z)
[PROOF STEP]
have *: "\<forall>w\<in>ball z r - {z}. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)"
[PROOF STATE]
proof (prove)
using this:
0 < r
\<forall>w\<in>cball z r - {z}. f w = zor_poly f z w * (w - z) ^ nat (zorder f z)

goal (1 subgoal):
 1. \<forall>w\<in>ball z r - {z}. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)
[PROOF STEP]
by (auto simp: field_simps powr_minus)
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>ball z r - {z}. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)

goal (1 subgoal):
 1. \<forall>\<^sub>F w in at z. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)
[PROOF STEP]
have "eventually (\<lambda>w. w \<in> ball z r - {z}) (at z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F w in at z. w \<in> ball z r - {z}
[PROOF STEP]
using r eventually_at_ball'[of r z UNIV]
[PROOF STATE]
proof (prove)
using this:
0 < r
\<forall>w\<in>cball z r - {z}. f w = zor_poly f z w * (w - z) ^ nat (zorder f z)
0 < r \<Longrightarrow> \<forall>\<^sub>F t in at z. t \<in> ball z r \<and> t \<noteq> z \<and> t \<in> UNIV

goal (1 subgoal):
 1. \<forall>\<^sub>F w in at z. w \<in> ball z r - {z}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F w in at z. w \<in> ball z r - {z}

goal (1 subgoal):
 1. \<forall>\<^sub>F w in at z. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F w in at z. w \<in> ball z r - {z}

goal (1 subgoal):
 1. \<forall>\<^sub>F w in at z. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)
[PROOF STEP]
by eventually_elim (insert *, auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F w in at z. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma balanced_Node_if_wbal2:
  assumes "balanced l" "balanced r" "abs(int(size_kdt l) - int(size_kdt r)) \<le> 1"
  shows "balanced (Node k v l r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. balanced (Node k v l r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. balanced (Node k v l r)
[PROOF STEP]
have "size_kdt l = size_kdt r \<or> (size_kdt l = size_kdt r + 1 \<or> size_kdt r = size_kdt l + 1)" (is "?A \<or> ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.size_kdt l = KD_Tree.size_kdt r \<or> KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
\<bar>int (KD_Tree.size_kdt l) - int (KD_Tree.size_kdt r)\<bar> \<le> 1

goal (1 subgoal):
 1. KD_Tree.size_kdt l = KD_Tree.size_kdt r \<or> KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt l = KD_Tree.size_kdt r \<or> KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1

goal (1 subgoal):
 1. balanced (Node k v l r)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt l = KD_Tree.size_kdt r \<or> KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1

goal (1 subgoal):
 1. balanced (Node k v l r)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. KD_Tree.size_kdt l = KD_Tree.size_kdt r \<Longrightarrow> balanced (Node k v l r)
 2. KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1 \<Longrightarrow> balanced (Node k v l r)
[PROOF STEP]
assume "?A"
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt l = KD_Tree.size_kdt r

goal (2 subgoals):
 1. KD_Tree.size_kdt l = KD_Tree.size_kdt r \<Longrightarrow> balanced (Node k v l r)
 2. KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1 \<Longrightarrow> balanced (Node k v l r)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt l = KD_Tree.size_kdt r

goal (1 subgoal):
 1. balanced (Node k v l r)
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt l = KD_Tree.size_kdt r
balanced l
balanced r

goal (1 subgoal):
 1. balanced (Node k v l r)
[PROOF STEP]
apply(simp add: balanced_def min_def max_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>KD_Tree.size_kdt l = KD_Tree.size_kdt r; height l - min_height l \<le> Suc 0; height r - min_height r \<le> Suc 0\<rbrakk> \<Longrightarrow> (height l \<le> height r \<longrightarrow> min_height l \<le> min_height r \<longrightarrow> height r - min_height l \<le> Suc 0) \<and> (\<not> height l \<le> height r \<longrightarrow> \<not> min_height l \<le> min_height r \<longrightarrow> height l - min_height r \<le> Suc 0)
[PROOF STEP]
by (metis assms(1,2) balanced_optimal le_antisym le_less)
[PROOF STATE]
proof (state)
this:
balanced (Node k v l r)

goal (1 subgoal):
 1. KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1 \<Longrightarrow> balanced (Node k v l r)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1 \<Longrightarrow> balanced (Node k v l r)
[PROOF STEP]
assume "?B"
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1

goal (1 subgoal):
 1. KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1 \<Longrightarrow> balanced (Node k v l r)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt l = KD_Tree.size_kdt r + 1 \<or> KD_Tree.size_kdt r = KD_Tree.size_kdt l + 1

goal (1 subgoal):
 1. balanced (Node k v l r)
[PROOF STEP]
by (meson assms(1,2) balanced_sym balanced_Node_if_wbal1)
[PROOF STATE]
proof (state)
this:
balanced (Node k v l r)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
balanced (Node k v l r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in fin_digraph) closed_euler2:
  assumes "euler_trail u p u"
  shows "connected G"
    and "\<And>u. u \<in> verts G \<Longrightarrow> in_degree G u = out_degree G u" (is "\<And>u. _ \<Longrightarrow> ?eq_deg u")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Digraph_Component.connected G &&& (\<And>u. u \<in> verts G \<Longrightarrow> in_degree G u = out_degree G u)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Digraph_Component.connected G
 2. \<And>u. u \<in> verts G \<Longrightarrow> in_degree G u = out_degree G u
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
euler_trail u p u
[PROOF STEP]
show "connected G"
[PROOF STATE]
proof (prove)
using this:
euler_trail u p u

goal (1 subgoal):
 1. Digraph_Component.connected G
[PROOF STEP]
by (rule euler_imp_connected)
[PROOF STATE]
proof (state)
this:
Digraph_Component.connected G

goal (1 subgoal):
 1. \<And>u. u \<in> verts G \<Longrightarrow> in_degree G u = out_degree G u
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. u \<in> verts G \<Longrightarrow> in_degree G u = out_degree G u
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. u \<in> verts G \<Longrightarrow> in_degree G u = out_degree G u
[PROOF STEP]
assume A: "v \<in> verts G"
[PROOF STATE]
proof (state)
this:
v \<in> verts G

goal (1 subgoal):
 1. \<And>u. u \<in> verts G \<Longrightarrow> in_degree G u = out_degree G u
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
euler_trail u p u
v \<in> verts G
[PROOF STEP]
show "?eq_deg v"
[PROOF STATE]
proof (prove)
using this:
euler_trail u p u
v \<in> verts G

goal (1 subgoal):
 1. in_degree G v = out_degree G v
[PROOF STEP]
by (rule closed_euler_imp_eq_degree)
[PROOF STATE]
proof (state)
this:
in_degree G v = out_degree G v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_size_1[simp]:
  "size_kdt kdt = 1 \<longleftrightarrow> (\<exists>p. kdt = Leaf p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (KD_Tree.size_kdt kdt = 1) = (\<exists>p. kdt = Leaf p)
[PROOF STEP]
apply (induction kdt)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. (KD_Tree.size_kdt (Leaf x) = 1) = (\<exists>p. Leaf x = Leaf p)
 2. \<And>x1a x2 kdt1 kdt2. \<lbrakk>(KD_Tree.size_kdt kdt1 = 1) = (\<exists>p. kdt1 = Leaf p); (KD_Tree.size_kdt kdt2 = 1) = (\<exists>p. kdt2 = Leaf p)\<rbrakk> \<Longrightarrow> (KD_Tree.size_kdt (Node x1a x2 kdt1 kdt2) = 1) = (\<exists>p. Node x1a x2 kdt1 kdt2 = Leaf p)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>kdt2. \<lbrakk>KD_Tree.size_kdt kdt2 = 0; \<forall>p. kdt2 \<noteq> Leaf p\<rbrakk> \<Longrightarrow> False
 2. \<And>kdt1. \<lbrakk>KD_Tree.size_kdt kdt1 = 0; \<forall>p. kdt1 \<noteq> Leaf p\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using size_ge0 nat_less_le
[PROOF STATE]
proof (prove)
using this:
0 < KD_Tree.size_kdt ?kdt
(?m < ?n) = (?m \<le> ?n \<and> ?m \<noteq> ?n)

goal (2 subgoals):
 1. \<And>kdt2. \<lbrakk>KD_Tree.size_kdt kdt2 = 0; \<forall>p. kdt2 \<noteq> Leaf p\<rbrakk> \<Longrightarrow> False
 2. \<And>kdt1. \<lbrakk>KD_Tree.size_kdt kdt1 = 0; \<forall>p. kdt1 \<noteq> Leaf p\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply blast+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma b_least2_aux1: "b_least2 f x y = y \<or> (b_least2 f x y < y \<and> (f x (b_least2 f x y)) \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b_least2 f x y = y \<or> b_least2 f x y < y \<and> f x (b_least2 f x y) \<noteq> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b_least2 f x y = y \<or> b_least2 f x y < y \<and> f x (b_least2 f x y) \<noteq> 0
[PROOF STEP]
let ?P = "%z. z = y \<or> (z < y \<and> (f x z) \<noteq> 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b_least2 f x y = y \<or> b_least2 f x y < y \<and> f x (b_least2 f x y) \<noteq> 0
[PROOF STEP]
have "?P y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = y \<or> y < y \<and> f x y \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y = y \<or> y < y \<and> f x y \<noteq> 0

goal (1 subgoal):
 1. b_least2 f x y = y \<or> b_least2 f x y < y \<and> f x (b_least2 f x y) \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = y \<or> y < y \<and> f x y \<noteq> 0
[PROOF STEP]
have "?P (Least ?P)"
[PROOF STATE]
proof (prove)
using this:
y = y \<or> y < y \<and> f x y \<noteq> 0

goal (1 subgoal):
 1. (LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) = y \<or> (LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) < y \<and> f x (LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) \<noteq> 0
[PROOF STEP]
by (rule LeastI)
[PROOF STATE]
proof (state)
this:
(LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) = y \<or> (LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) < y \<and> f x (LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) \<noteq> 0

goal (1 subgoal):
 1. b_least2 f x y = y \<or> b_least2 f x y < y \<and> f x (b_least2 f x y) \<noteq> 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) = y \<or> (LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) < y \<and> f x (LEAST z. z = y \<or> z < y \<and> f x z \<noteq> 0) \<noteq> 0

goal (1 subgoal):
 1. b_least2 f x y = y \<or> b_least2 f x y < y \<and> f x (b_least2 f x y) \<noteq> 0
[PROOF STEP]
by (simp add: b_least2_def)
[PROOF STATE]
proof (state)
this:
b_least2 f x y = y \<or> b_least2 f x y < y \<and> f x (b_least2 f x y) \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma st_proj2_continuous:
  "continuous_on (UNIV - {bot_sphere}) st_proj2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (UNIV - {bot_sphere}) st_proj2
[PROOF STEP]
apply (transfer; auto intro!: continuous_intros simp: add_nonneg_eq_0_iff split_beta' norm_prod_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(norm a)\<^sup>2 + b\<^sup>2 = 1; 1 + b = 0\<rbrakk> \<Longrightarrow> a = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(norm a)\<^sup>2 + b\<^sup>2 = 1; 1 + b = 0\<rbrakk> \<Longrightarrow> a = (0::'a)
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(norm a)\<^sup>2 + b\<^sup>2 = 1; 1 + b = 0\<rbrakk> \<Longrightarrow> a = (0::'a)
[PROOF STEP]
assume 1: "(norm a)^2 + b^2 = 1" and 2: "1 + b = 0"
[PROOF STATE]
proof (state)
this:
(norm a)\<^sup>2 + b\<^sup>2 = 1
1 + b = 0

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(norm a)\<^sup>2 + b\<^sup>2 = 1; 1 + b = 0\<rbrakk> \<Longrightarrow> a = (0::'a)
[PROOF STEP]
have "b = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = - 1
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
1 + b = 0

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

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(norm a)\<^sup>2 + b\<^sup>2 = 1; 1 + b = 0\<rbrakk> \<Longrightarrow> a = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = - 1
[PROOF STEP]
show "a = 0"
[PROOF STATE]
proof (prove)
using this:
b = - 1

goal (1 subgoal):
 1. a = (0::'b)
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
b = - 1
(norm a)\<^sup>2 + b\<^sup>2 = 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sumset_eq_Union_left:
  assumes "A \<subseteq> G"
  shows "sumset A B = (\<Union> a \<in> A. sumset {a} B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset A B = (\<Union>a\<in>A. sumset {a} B)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sumset A B \<subseteq> (\<Union>a\<in>A. sumset {a} B)
 2. (\<Union>a\<in>A. sumset {a} B) \<subseteq> sumset A B
[PROOF STEP]
show "sumset A B \<subseteq> (\<Union> a \<in> A. sumset {a} B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset A B \<subseteq> (\<Union>a\<in>A. sumset {a} B)
[PROOF STEP]
using assms sumset.cases Int_absorb2 Int_iff UN_iff singletonI sumset.sumsetI
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> G
\<lbrakk>?a \<in> sumset ?A ?B; \<And>a b. \<lbrakk>?a = a \<oplus> b; a \<in> ?A; a \<in> G; b \<in> ?B; b \<in> G\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
?A \<subseteq> ?B \<Longrightarrow> ?A \<inter> ?B = ?A
(?c \<in> ?A \<inter> ?B) = (?c \<in> ?A \<and> ?c \<in> ?B)
(?b \<in> \<Union> (?B ` ?A)) = (\<exists>x\<in>?A. ?b \<in> ?B x)
?a \<in> {?a}
\<lbrakk>?a \<in> ?A; ?a \<in> G; ?b \<in> ?B; ?b \<in> G\<rbrakk> \<Longrightarrow> ?a \<oplus> ?b \<in> sumset ?A ?B

goal (1 subgoal):
 1. sumset A B \<subseteq> (\<Union>a\<in>A. sumset {a} B)
[PROOF STEP]
by (smt (verit, del_insts) subsetI)
[PROOF STATE]
proof (state)
this:
sumset A B \<subseteq> (\<Union>a\<in>A. sumset {a} B)

goal (1 subgoal):
 1. (\<Union>a\<in>A. sumset {a} B) \<subseteq> sumset A B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Union>a\<in>A. sumset {a} B) \<subseteq> sumset A B
[PROOF STEP]
show "(\<Union> a \<in> A. sumset {a} B) \<subseteq> sumset A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>a\<in>A. sumset {a} B) \<subseteq> sumset A B
[PROOF STEP]
using sumset
[PROOF STATE]
proof (prove)
using this:
sumset ?A ?B = (\<Union>a\<in>?A \<inter> G. \<Union>b\<in>?B \<inter> G. {a \<oplus> b})

goal (1 subgoal):
 1. (\<Union>a\<in>A. sumset {a} B) \<subseteq> sumset A B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>a\<in>A. sumset {a} B) \<subseteq> sumset A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma epigraph_lsc_hull:
  fixes f :: "'a::metric_space \<Rightarrow> ereal"
  shows "Epigraph UNIV (lsc_hull f) = closure(Epigraph UNIV f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Epigraph UNIV (lsc_hull f) = closure (Epigraph UNIV f)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Epigraph UNIV (lsc_hull f) = closure (Epigraph UNIV f)
[PROOF STEP]
have "\<exists>g. Epigraph UNIV g = closure (Epigraph UNIV f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. Epigraph UNIV g = closure (Epigraph UNIV f)
[PROOF STEP]
using lsc_hull_exists
[PROOF STATE]
proof (prove)
using this:
\<exists>g. Epigraph UNIV g = closure (Epigraph UNIV ?f)

goal (1 subgoal):
 1. \<exists>g. Epigraph UNIV g = closure (Epigraph UNIV f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>g. Epigraph UNIV g = closure (Epigraph UNIV f)

goal (1 subgoal):
 1. Epigraph UNIV (lsc_hull f) = closure (Epigraph UNIV f)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>g. Epigraph UNIV g = closure (Epigraph UNIV f)

goal (1 subgoal):
 1. Epigraph UNIV (lsc_hull f) = closure (Epigraph UNIV f)
[PROOF STEP]
unfolding lsc_hull_def
[PROOF STATE]
proof (prove)
using this:
\<exists>g. Epigraph UNIV g = closure (Epigraph UNIV f)

goal (1 subgoal):
 1. Epigraph UNIV (SOME g. Epigraph UNIV g = closure (Epigraph UNIV f)) = closure (Epigraph UNIV f)
[PROOF STEP]
using some_eq_ex[of "(\<lambda>g. Epigraph UNIV g = closure(Epigraph UNIV f))"]
[PROOF STATE]
proof (prove)
using this:
\<exists>g. Epigraph UNIV g = closure (Epigraph UNIV f)
(Epigraph UNIV (SOME x. Epigraph UNIV x = closure (Epigraph UNIV f)) = closure (Epigraph UNIV f)) = (\<exists>x. Epigraph UNIV x = closure (Epigraph UNIV f))

goal (1 subgoal):
 1. Epigraph UNIV (SOME g. Epigraph UNIV g = closure (Epigraph UNIV f)) = closure (Epigraph UNIV f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Epigraph UNIV (lsc_hull f) = closure (Epigraph UNIV f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_replicate_mapr: "length xs = n \<Longrightarrow> zip xs (replicate n x) = map (\<lambda>y. (y, x)) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = n \<Longrightarrow> zip xs (replicate n x) = map (\<lambda>y. (y, x)) xs
[PROOF STEP]
apply (induct n arbitrary: xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs. length xs = 0 \<Longrightarrow> zip xs (replicate 0 x) = map (\<lambda>y. (y, x)) xs
 2. \<And>n xs. \<lbrakk>\<And>xs. length xs = n \<Longrightarrow> zip xs (replicate n x) = map (\<lambda>y. (y, x)) xs; length xs = Suc n\<rbrakk> \<Longrightarrow> zip xs (replicate (Suc n) x) = map (\<lambda>y. (y, x)) xs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. length xs = n \<Longrightarrow> zip xs (replicate n x) = map (\<lambda>y. (y, x)) xs; length xs = Suc n\<rbrakk> \<Longrightarrow> zip xs (replicate (Suc n) x) = map (\<lambda>y. (y, x)) xs
[PROOF STEP]
apply (case_tac xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n xs. \<lbrakk>\<And>xs. length xs = n \<Longrightarrow> zip xs (replicate n x) = map (\<lambda>y. (y, x)) xs; length xs = Suc n; xs = []\<rbrakk> \<Longrightarrow> zip xs (replicate (Suc n) x) = map (\<lambda>y. (y, x)) xs
 2. \<And>n xs a list. \<lbrakk>\<And>xs. length xs = n \<Longrightarrow> zip xs (replicate n x) = map (\<lambda>y. (y, x)) xs; length xs = Suc n; xs = a # list\<rbrakk> \<Longrightarrow> zip xs (replicate (Suc n) x) = map (\<lambda>y. (y, x)) xs
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma poly_power_n_odd:
  fixes x a:: real
  assumes "odd n"
  shows "poly ([:-a,1:]^n) x>0 \<longleftrightarrow> (x>a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
odd n

goal (1 subgoal):
 1. (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. odd n \<Longrightarrow> (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
have "poly ([:-a,1:]^n) x\<ge>0 = (poly [:- a, 1:] x \<ge>0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> poly ([:- a, 1:] ^ n) x) = (0 \<le> poly [:- a, 1:] x)
[PROOF STEP]
unfolding poly_power
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> poly [:- a, 1:] x ^ n) = (0 \<le> poly [:- a, 1:] x)
[PROOF STEP]
using zero_le_odd_power[OF \<open>odd n\<close>]
[PROOF STATE]
proof (prove)
using this:
((0::?'a) \<le> ?a ^ n) = ((0::?'a) \<le> ?a)

goal (1 subgoal):
 1. (0 \<le> poly [:- a, 1:] x ^ n) = (0 \<le> poly [:- a, 1:] x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(0 \<le> poly ([:- a, 1:] ^ n) x) = (0 \<le> poly [:- a, 1:] x)

goal (1 subgoal):
 1. odd n \<Longrightarrow> (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0 \<le> poly ([:- a, 1:] ^ n) x) = (0 \<le> poly [:- a, 1:] x)

goal (1 subgoal):
 1. odd n \<Longrightarrow> (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
have "(poly [:- a, 1:] x \<ge>0) = (x\<ge>a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> poly [:- a, 1:] x) = (a \<le> x)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(0 \<le> poly [:- a, 1:] x) = (a \<le> x)

goal (1 subgoal):
 1. odd n \<Longrightarrow> (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0 \<le> poly ([:- a, 1:] ^ n) x) = (a \<le> x)
[PROOF STEP]
have "poly ([:-a,1:]^n) x\<ge>0 = (x\<ge>a)"
[PROOF STATE]
proof (prove)
using this:
(0 \<le> poly ([:- a, 1:] ^ n) x) = (a \<le> x)

goal (1 subgoal):
 1. (0 \<le> poly ([:- a, 1:] ^ n) x) = (a \<le> x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(0 \<le> poly ([:- a, 1:] ^ n) x) = (a \<le> x)

goal (1 subgoal):
 1. odd n \<Longrightarrow> (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(0 \<le> poly ([:- a, 1:] ^ n) x) = (a \<le> x)

goal (1 subgoal):
 1. odd n \<Longrightarrow> (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
have "poly ([:-a,1:]^n) x=0 = (x=a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly ([:- a, 1:] ^ n) x = 0) = (x = a)
[PROOF STEP]
by(rule poly_power_n_eq, metis assms even_zero)
[PROOF STATE]
proof (state)
this:
(poly ([:- a, 1:] ^ n) x = 0) = (x = a)

goal (1 subgoal):
 1. odd n \<Longrightarrow> (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(0 \<le> poly ([:- a, 1:] ^ n) x) = (a \<le> x)
(poly ([:- a, 1:] ^ n) x = 0) = (x = a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0 \<le> poly ([:- a, 1:] ^ n) x) = (a \<le> x)
(poly ([:- a, 1:] ^ n) x = 0) = (x = a)

goal (1 subgoal):
 1. (0 < poly ([:- a, 1:] ^ n) x) = (a < x)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(0 < poly ([:- a, 1:] ^ n) x) = (a < x)

goal:
No subgoals!
[PROOF STEP]
qed


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

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

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

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

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

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma onorm_le_matrix_component_sum:
  fixes A :: "real^'n^'m"
  shows "onorm((*v) A) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm ((*v) A) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>)
[PROOF STEP]
proof (rule onorm_le)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x
[PROOF STEP]
have "norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<bar>(A *v x) $ i\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<bar>(A *v x) $ i\<bar>)
[PROOF STEP]
by (rule norm_le_l1_cart)
[PROOF STATE]
proof (state)
this:
norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<bar>(A *v x) $ i\<bar>)

goal (1 subgoal):
 1. \<And>x. norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<bar>(A *v x) $ i\<bar>)

goal (1 subgoal):
 1. \<And>x. norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x
[PROOF STEP]
have "\<dots> \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<bar>(A *v x) $ i\<bar>) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
proof (rule sum_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
have "\<bar>(A *v x) $ i\<bar> \<le> \<bar>\<Sum>j\<in>UNIV. A $ i $ j * x $ j\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>(A *v x) $ i\<bar> \<le> \<bar>\<Sum>j\<in>UNIV. A $ i $ j * x $ j\<bar>
[PROOF STEP]
by (simp add: matrix_vector_mult_def)
[PROOF STATE]
proof (state)
this:
\<bar>(A *v x) $ i\<bar> \<le> \<bar>\<Sum>j\<in>UNIV. A $ i $ j * x $ j\<bar>

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>(A *v x) $ i\<bar> \<le> \<bar>\<Sum>j\<in>UNIV. A $ i $ j * x $ j\<bar>

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
have "\<dots> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j * x $ j\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>j\<in>UNIV. A $ i $ j * x $ j\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j * x $ j\<bar>)
[PROOF STEP]
by (rule sum_abs)
[PROOF STATE]
proof (state)
this:
\<bar>\<Sum>j\<in>UNIV. A $ i $ j * x $ j\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j * x $ j\<bar>)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>\<Sum>j\<in>UNIV. A $ i $ j * x $ j\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j * x $ j\<bar>)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
have "\<dots> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>UNIV. \<bar>A $ i $ j * x $ j\<bar>) \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
by (rule sum_mono) (simp add: abs_mult component_le_norm_cart mult_left_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>UNIV. \<bar>A $ i $ j * x $ j\<bar>) \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
show "\<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)"
[PROOF STATE]
proof (prove)
using this:
\<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)

goal (1 subgoal):
 1. \<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<bar>(A *v x) $ i\<bar>) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)

goal (1 subgoal):
 1. \<And>x. norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)
[PROOF STEP]
show "norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x"
[PROOF STATE]
proof (prove)
using this:
norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)

goal (1 subgoal):
 1. norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x
[PROOF STEP]
by (simp add: sum_distrib_right)
[PROOF STATE]
proof (state)
this:
norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ex_first_occurrence [rule_format]:
  "P (n::nat) \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i. i<m \<longrightarrow> \<not> P i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P n \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i<m. \<not> P i))
[PROOF STEP]
apply(rule nat_less_induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>m<n. P m \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i<m. \<not> P i)) \<Longrightarrow> P n \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i<m. \<not> P i))
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>m<n. P m \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i<m. \<not> P i)); P n\<rbrakk> \<Longrightarrow> \<exists>m. P m \<and> (\<forall>i<m. \<not> P i)
[PROOF STEP]
apply(case_tac "\<forall>m. m<n \<longrightarrow> \<not> P m")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<forall>m<n. P m \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i<m. \<not> P i)); P n; \<forall>m<n. \<not> P m\<rbrakk> \<Longrightarrow> \<exists>m. P m \<and> (\<forall>i<m. \<not> P i)
 2. \<And>n. \<lbrakk>\<forall>m<n. P m \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i<m. \<not> P i)); P n; \<not> (\<forall>m<n. \<not> P m)\<rbrakk> \<Longrightarrow> \<exists>m. P m \<and> (\<forall>i<m. \<not> P i)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma quasi_isometry_between_change_params:
  assumes "lambda C-quasi_isometry_between X Y f" "mu \<ge> lambda" "D \<ge> C"
  shows "mu D-quasi_isometry_between X Y f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mu D -quasi_isometry_between X Y f
[PROOF STEP]
proof (rule quasi_isometry_betweenI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. mu D -quasi_isometry_on X f
 2. f ` X \<subseteq> Y
 3. \<And>y. y \<in> Y \<Longrightarrow> \<exists>x\<in>X. dist (f x) y \<le> D
[PROOF STEP]
show "mu D-quasi_isometry_on X f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mu D -quasi_isometry_on X f
[PROOF STEP]
by (rule quasi_isometry_on_change_params[OF quasi_isometry_betweenD(1)[OF assms(1)] assms(2) assms(3)])
[PROOF STATE]
proof (state)
this:
mu D -quasi_isometry_on X f

goal (2 subgoals):
 1. f ` X \<subseteq> Y
 2. \<And>y. y \<in> Y \<Longrightarrow> \<exists>x\<in>X. dist (f x) y \<le> D
[PROOF STEP]
show "f`X \<subseteq> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` X \<subseteq> Y
[PROOF STEP]
using quasi_isometry_betweenD[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
lambda C -quasi_isometry_on X f
f ` X \<subseteq> Y
?y \<in> Y \<Longrightarrow> \<exists>x\<in>X. dist (f x) ?y \<le> C
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> dist (f ?x) (f ?y) \<le> lambda * dist ?x ?y + C
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> 1 / lambda * dist ?x ?y - C \<le> dist (f ?x) (f ?y)
1 \<le> lambda
0 \<le> C

goal (1 subgoal):
 1. f ` X \<subseteq> Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` X \<subseteq> Y

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> \<exists>x\<in>X. dist (f x) y \<le> D
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> \<exists>x\<in>X. dist (f x) y \<le> D
[PROOF STEP]
assume "y \<in> Y"
[PROOF STATE]
proof (state)
this:
y \<in> Y

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> \<exists>x\<in>X. dist (f x) y \<le> D
[PROOF STEP]
show "\<exists>x\<in>X. dist (f x) y \<le> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>X. dist (f x) y \<le> D
[PROOF STEP]
using quasi_isometry_betweenD(3)[OF assms(1) \<open>y \<in> Y\<close>] \<open>D \<ge> C\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>X. dist (f x) y \<le> C
C \<le> D

goal (1 subgoal):
 1. \<exists>x\<in>X. dist (f x) y \<le> D
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>X. dist (f x) y \<le> D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma snd_set_zip:
  "length xs = length ys \<Longrightarrow> snd ` (set (zip xs ys)) = set ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys \<Longrightarrow> snd ` set (zip xs ys) = set ys
[PROOF STEP]
by (induct xs ys rule: list_induct2) auto


[STATEMENT]
lemma inversions_between_code:
  "inversions_between xs ys =
     Set.filter (\<lambda>(i,j). less (ys ! j) (xs ! i)) ({..<length xs}\<times>{..<length ys})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversions_between xs ys = Set.filter (\<lambda>(i, j). ys ! j < xs ! i) ({..<length xs} \<times> {..<length ys})
[PROOF STEP]
by (auto simp: inversions_between_def)


[STATEMENT]
lemma simply_connected_imp_connected:
  fixes S :: "_::real_normed_vector set"
  shows "simply_connected S \<Longrightarrow> connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simply_connected S \<Longrightarrow> connected S
[PROOF STEP]
by (simp add: path_connected_imp_connected simply_connected_imp_path_connected)


[STATEMENT]
lemma path_connected_Ioc[simp]: "path_connected {a<..b}" for a b :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected {a<..b}
[PROOF STEP]
by (simp add: convex_imp_path_connected)


[STATEMENT]
lemma up_filter_antitone:
  "x \<le> y \<longleftrightarrow> up_filter y \<le> up_filter x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y) = (up_filter y \<le> up_filter x)
[PROOF STEP]
by (metis eq_onp_same_args less_eq_filter.abs_eq up_antitone up_filter)


[STATEMENT]
lemma lcm_proj2_iff_int [simp]: "lcm m n = \<bar>n\<bar> \<longleftrightarrow> m dvd n"
  for m n :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lcm m n = \<bar>n\<bar>) = (m dvd n)
[PROOF STEP]
by (metis dvd_abs_iff lcm_proj2_if_dvd_int lcm_unique_int)


[STATEMENT]
lemma id_slg_rel_alt_a: "\<langle>Id\<rangle>slg_rel
    = { (s,E). \<forall>u. distinct (s u) \<and> set (s u) = E``{u} }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>Id\<rangle>slg_rel = {(s, E). \<forall>u. distinct (s u) \<and> set (s u) = E `` {u}}
[PROOF STEP]
by (auto simp add: slg_rel_def br_def list_set_rel_def dest: fun_relD)


[STATEMENT]
lemma compl_le_compl_iff [simp]: "- x \<le> - y \<longleftrightarrow> y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- x \<le> - y) = (y \<le> x)
[PROOF STEP]
by (auto dest: compl_mono)


[STATEMENT]
lemma integration_by_parts_interior_strong:
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
  assumes bilinear: "bounded_bilinear (prod)"
  assumes s: "finite s" and le: "a \<le> b"
  assumes cont [continuous_intros]: "continuous_on {a..b} f" "continuous_on {a..b} g"
  assumes deriv: "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
                 "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (g has_vector_derivative g' x) (at x)"
  assumes int: "((\<lambda>x. prod (f x) (g' x)) has_integral
                  (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}"
  shows   "((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}
[PROOF STEP]
interpret bounded_bilinear prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_bilinear prod
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}
[PROOF STEP]
have "((\<lambda>x. prod (f x) (g' x) + prod (f' x) (g x)) has_integral
          (prod (f b) (g b) - prod (f a) (g a))) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. prod (f x) (g' x) + prod (f' x) (g x)) has_integral prod (f b) (g b) - prod (f a) (g a)) {a..b}
[PROOF STEP]
using deriv
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a<..<b} - s \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
?x \<in> {a<..<b} - s \<Longrightarrow> (g has_vector_derivative g' ?x) (at ?x)

goal (1 subgoal):
 1. ((\<lambda>x. prod (f x) (g' x) + prod (f' x) (g x)) has_integral prod (f b) (g b) - prod (f a) (g a)) {a..b}
[PROOF STEP]
by (intro fundamental_theorem_of_calculus_interior_strong[OF s le])
                   (auto intro!: continuous_intros continuous_on has_vector_derivative)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. prod (f x) (g' x) + prod (f' x) (g x)) has_integral prod (f b) (g b) - prod (f a) (g a)) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}
[PROOF STEP]
from has_integral_diff[OF this int]
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. prod (f x) (g' x) + prod (f' x) (g x) - prod (f x) (g' x)) has_integral prod (f b) (g b) - prod (f a) (g a) - (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. prod (f x) (g' x) + prod (f' x) (g x) - prod (f x) (g' x)) has_integral prod (f b) (g b) - prod (f a) (g a) - (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma round_mono: "x \<le> y \<Longrightarrow> round x \<le> round y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> round x \<le> round y
[PROOF STEP]
unfolding round_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> \<lfloor>x + (1::'a) / (2::'a)\<rfloor> \<le> \<lfloor>y + (1::'a) / (2::'a)\<rfloor>
[PROOF STEP]
by (intro floor_mono) simp


[STATEMENT]
lemma map_zip_is_bisum:
  "bisum f l1 = (\<Sum>(x,y)\<leftarrow>zip (0 # l1) (l1 @ [0]). f x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bisum f l1 = sum_list (map2 f ((0::'b) # l1) (l1 @ [0::'b]))
[PROOF STEP]
using bisum_is_map_zip[of "\<lambda>(x,y). f x y"]
[PROOF STATE]
proof (prove)
using this:
sum_list (map2 f ((0::'b) # ?l1.0) (?l1.0 @ [0::'b])) = bisum (\<lambda>x y. case (x, y) of (x, y) \<Rightarrow> f x y) ?l1.0

goal (1 subgoal):
 1. bisum f l1 = sum_list (map2 f ((0::'b) # l1) (l1 @ [0::'b]))
[PROOF STEP]
by auto


[STATEMENT]
lemma ideal_generated_repeated: "ideal_generated {a,a} = ideal_generated {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal_generated {a, a} = ideal_generated {a}
[PROOF STEP]
unfolding ideal_generated_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> {I. ideal I \<and> {a, a} \<subseteq> I} = \<Inter> {I. ideal I \<and> {a} \<subseteq> I}
[PROOF STEP]
by auto


[STATEMENT]
lemma fst_pairs_VLambda: "fst ` pairs (VLambda A f) = elts A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ` pairs (VLambda A f) = elts A
[PROOF STEP]
by (force simp: VLambda_def pairs_def)


[STATEMENT]
lemma map_of_zip_is_Some:
  assumes "length xs = length ys"
  shows "x \<in> set xs \<longleftrightarrow> (\<exists>y. map_of (zip xs ys) x = Some y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set xs) = (\<exists>y. map_of (zip xs ys) x = Some y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. (x \<in> set xs) = (\<exists>y. map_of (zip xs ys) x = Some y)
[PROOF STEP]
by (induct rule: list_induct2) simp_all


[STATEMENT]
lemma smult_pCons [simp]: "smult a (pCons b p) = pCons (a * b) (smult a p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a (pCons b p) = pCons (a * b) (smult a p)
[PROOF STEP]
by (rule poly_eqI) (simp add: coeff_pCons split: nat.split)


[STATEMENT]
lemma (in sigma_finite_measure) RN_deriv_finite:
  assumes N: "sigma_finite_measure N" and ac: "absolutely_continuous M N" "sets N = sets M"
  shows "AE x in M. RN_deriv M N x \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. RN_deriv M N x \<noteq> \<infinity>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. RN_deriv M N x \<noteq> \<infinity>
[PROOF STEP]
interpret N: sigma_finite_measure N
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure N
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. RN_deriv M N x \<noteq> \<infinity>
[PROOF STEP]
from N
[PROOF STATE]
proof (chain)
picking this:
sigma_finite_measure N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sigma_finite_measure N

goal (1 subgoal):
 1. AE x in M. RN_deriv M N x \<noteq> \<infinity>
[PROOF STEP]
using sigma_finite_iff_density_finite[OF borel_measurable_RN_deriv, of N] density_RN_deriv[OF ac]
[PROOF STATE]
proof (prove)
using this:
sigma_finite_measure N
sigma_finite_measure (density M (RN_deriv M N)) = (AE x in M. RN_deriv M N x \<noteq> \<infinity>)
density M (RN_deriv M N) = N

goal (1 subgoal):
 1. AE x in M. RN_deriv M N x \<noteq> \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AE x in M. RN_deriv M N x \<noteq> \<infinity>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem SubstFormP_Disj:
  "{SubstFormP v i x x', SubstFormP v i y y'} \<turnstile> SubstFormP v i (Q_Disj x y) (Q_Disj x' y')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {SubstFormP v i x x', SubstFormP v i y y'} \<turnstile> SubstFormP v i (Q_Disj x y) (Q_Disj x' y')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {SubstFormP v i x x', SubstFormP v i y y'} \<turnstile> SubstFormP v i (Q_Disj x y) (Q_Disj x' y')
[PROOF STEP]
obtain k1::name and s1::name and k2::name and s2::name and k::name and s::name
    where "atom s1 \<sharp> (v,i,x,y,x',y')"        "atom k1 \<sharp> (v,i,x,y,x',y',s1)"
          "atom s2 \<sharp> (v,i,x,y,x',y',k1,s1)"  "atom k2 \<sharp> (v,i,x,y,x',y',s2,k1,s1)"
          "atom s  \<sharp> (v,i,x,y,x',y',k2,s2,k1,s1)" "atom k  \<sharp> (v,i,x,y,x',y',s,k2,s2,k1,s1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s1 k1 s2 k2 s k. \<lbrakk>atom s1 \<sharp> (v, i, x, y, x', y'); atom k1 \<sharp> (v, i, x, y, x', y', s1); atom s2 \<sharp> (v, i, x, y, x', y', k1, s1); atom k2 \<sharp> (v, i, x, y, x', y', s2, k1, s1); atom s \<sharp> (v, i, x, y, x', y', k2, s2, k1, s1); atom k \<sharp> (v, i, x, y, x', y', s, k2, s2, k1, s1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis obtain_fresh)
[PROOF STATE]
proof (state)
this:
atom s1 \<sharp> (v, i, x, y, x', y')
atom k1 \<sharp> (v, i, x, y, x', y', s1)
atom s2 \<sharp> (v, i, x, y, x', y', k1, s1)
atom k2 \<sharp> (v, i, x, y, x', y', s2, k1, s1)
atom s \<sharp> (v, i, x, y, x', y', k2, s2, k1, s1)
atom k \<sharp> (v, i, x, y, x', y', s, k2, s2, k1, s1)

goal (1 subgoal):
 1. {SubstFormP v i x x', SubstFormP v i y y'} \<turnstile> SubstFormP v i (Q_Disj x y) (Q_Disj x' y')
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
atom s1 \<sharp> (v, i, x, y, x', y')
atom k1 \<sharp> (v, i, x, y, x', y', s1)
atom s2 \<sharp> (v, i, x, y, x', y', k1, s1)
atom k2 \<sharp> (v, i, x, y, x', y', s2, k1, s1)
atom s \<sharp> (v, i, x, y, x', y', k2, s2, k1, s1)
atom k \<sharp> (v, i, x, y, x', y', s, k2, s2, k1, s1)

goal (1 subgoal):
 1. {SubstFormP v i x x', SubstFormP v i y y'} \<turnstile> SubstFormP v i (Q_Disj x y) (Q_Disj x' y')
[PROOF STEP]
by (force simp: SubstFormP.simps [of s v i "Q_Disj x y" _ k]
                     SubstFormP.simps [of s1 v i x x' k1]
                     SubstFormP.simps [of s2 v i y y' k2]
               intro: SeqSubstFormP_Disj [THEN cut4])
[PROOF STATE]
proof (state)
this:
{SubstFormP v i x x', SubstFormP v i y y'} \<turnstile> SubstFormP v i (Q_Disj x y) (Q_Disj x' y')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma UN_space_closed: "\<Union>(sets ` S) \<subseteq> Pow (\<Union>(space ` S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (sets ` S) \<subseteq> Pow (\<Union> (space ` S))
[PROOF STEP]
using sets.space_closed
[PROOF STATE]
proof (prove)
using this:
sets ?M \<subseteq> Pow (space ?M)

goal (1 subgoal):
 1. \<Union> (sets ` S) \<subseteq> Pow (\<Union> (space ` S))
[PROOF STEP]
by auto


[STATEMENT]
lemma scaler_column_fst_QR_decomposition:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes i: "i>j"
  and r: "rank A = ncols A"
  shows "column i (fst (QR_decomposition A)) \<bullet> column j A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
have "column i (fst(QR_decomposition A)) \<bullet> column j A
    = column i (fst (QR_decomposition A)) \<bullet> (\<Sum>x\<in>{column i (fst (QR_decomposition A))|i. i \<le> j}. (x \<bullet> (column j A)) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = column i (fst (QR_decomposition A)) \<bullet> (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. (x \<bullet> column j A) *\<^sub>R x)
[PROOF STEP]
using column_QR_decomposition2[OF r]
[PROOF STATE]
proof (prove)
using this:
column ?k A = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> ?k}. (x \<bullet> column ?k A) *\<^sub>R x)

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = column i (fst (QR_decomposition A)) \<bullet> (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. (x \<bullet> column j A) *\<^sub>R x)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<bullet> column j A = column i (fst (QR_decomposition A)) \<bullet> (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. (x \<bullet> column j A) *\<^sub>R x)

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<bullet> column j A = column i (fst (QR_decomposition A)) \<bullet> (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. (x \<bullet> column j A) *\<^sub>R x)

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
have "... = (\<Sum>x\<in>{column i (fst (QR_decomposition A))|i. i \<le> j}.
    column i (fst (QR_decomposition A)) \<bullet> (x \<bullet> (column j A)) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. (x \<bullet> column j A) *\<^sub>R x) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. column i (fst (QR_decomposition A)) \<bullet> (x \<bullet> column j A) *\<^sub>R x)
[PROOF STEP]
unfolding real_inner_class.inner_sum_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>y\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. column i (fst (QR_decomposition A)) \<bullet> (y \<bullet> column j A) *\<^sub>R y) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. column i (fst (QR_decomposition A)) \<bullet> (x \<bullet> column j A) *\<^sub>R x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<bullet> (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. (x \<bullet> column j A) *\<^sub>R x) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. column i (fst (QR_decomposition A)) \<bullet> (x \<bullet> column j A) *\<^sub>R x)

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<bullet> (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. (x \<bullet> column j A) *\<^sub>R x) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. column i (fst (QR_decomposition A)) \<bullet> (x \<bullet> column j A) *\<^sub>R x)

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
have "... = (\<Sum>x\<in>{column i (fst (QR_decomposition A))|i. i \<le> j}.
    (x \<bullet> (column j A)) *(column i (fst (QR_decomposition A)) \<bullet> x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. column i (fst (QR_decomposition A)) \<bullet> (x \<bullet> column j A) *\<^sub>R x) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. x \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> x))
[PROOF STEP]
unfolding real_inner_class.inner_scaleR_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. x \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> x)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. x \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> x))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. column i (fst (QR_decomposition A)) \<bullet> (x \<bullet> column j A) *\<^sub>R x) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. x \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> x))

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. column i (fst (QR_decomposition A)) \<bullet> (x \<bullet> column j A) *\<^sub>R x) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. x \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> x))

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. x \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> x)) = 0
[PROOF STEP]
proof (rule sum.neutral, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x ia. ia \<le> j \<Longrightarrow> column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0
[PROOF STEP]
fix ia
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x ia. ia \<le> j \<Longrightarrow> column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0
[PROOF STEP]
assume ia: "ia \<le> j"
[PROOF STATE]
proof (state)
this:
ia \<le> j

goal (1 subgoal):
 1. \<And>x ia. ia \<le> j \<Longrightarrow> column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0
[PROOF STEP]
have i_not_ia: "i \<noteq> ia"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<noteq> ia
[PROOF STEP]
using i ia
[PROOF STATE]
proof (prove)
using this:
j < i
ia \<le> j

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

goal (1 subgoal):
 1. \<And>x ia. ia \<le> j \<Longrightarrow> column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0
[PROOF STEP]
hence "(column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)))"
[PROOF STATE]
proof (prove)
using this:
i \<noteq> ia

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))
[PROOF STEP]
by (metis column_eq_fst_QR_decomposition r)
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))

goal (1 subgoal):
 1. \<And>x ia. ia \<le> j \<Longrightarrow> column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0
[PROOF STEP]
hence "(column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0"
[PROOF STATE]
proof (prove)
using this:
column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A)) = 0
[PROOF STEP]
by (rule orthogonal_columns_fst_QR_decomposition)
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A)) = 0

goal (1 subgoal):
 1. \<And>x ia. ia \<le> j \<Longrightarrow> column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0
[PROOF STEP]
thus "column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0"
[PROOF STATE]
proof (prove)
using this:
column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A)) = 0

goal (1 subgoal):
 1. column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column ia (fst (QR_decomposition A)) \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> column ia (fst (QR_decomposition A))) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> j}. x \<bullet> column j A * (column i (fst (QR_decomposition A)) \<bullet> x)) = 0

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
column i (fst (QR_decomposition A)) \<bullet> column j A = 0

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<bullet> column j A = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sort_map_perm:
  fixes f :: "nat \<Rightarrow> 'b :: linorder"
  shows "image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
define is_swap where "is_swap = (\<lambda>(ts :: ((nat \<Rightarrow> 'b) \<Rightarrow> nat \<Rightarrow> 'b)). \<exists>i < n. \<exists>j < n. ts = sort_primitive i j)"
[PROOF STATE]
proof (state)
this:
is_swap = (\<lambda>ts. \<exists>i<n. \<exists>j<n. ts = sort_primitive i j)

goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
define t :: "((nat \<Rightarrow> 'b) \<Rightarrow> nat \<Rightarrow> 'b) list"
    where "t = [sort_primitive j i. i <- [0..<n], j <- [0..<i]]"
[PROOF STATE]
proof (state)
this:
t = concat (map (\<lambda>i. map (\<lambda>j. sort_primitive j i) [0..<i]) [0..<n])

goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
have a: "\<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
fix f :: "nat \<Rightarrow> 'b :: linorder"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
assume "is_swap x"
[PROOF STATE]
proof (state)
this:
is_swap x

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_swap x
[PROOF STEP]
obtain i j where x_def: "x = sort_primitive i j" and i_bound: "i < n" and j_bound:"j < n"
[PROOF STATE]
proof (prove)
using this:
is_swap x

goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>x = sort_primitive i j; i < n; j < n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using is_swap_def
[PROOF STATE]
proof (prove)
using this:
is_swap x
is_swap = (\<lambda>ts. \<exists>i<n. \<exists>j<n. ts = sort_primitive i j)

goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>x = sort_primitive i j; i < n; j < n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = sort_primitive i j
i < n
j < n

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
define inv where "inv = mset_set {k. k < n \<and> k \<noteq> i \<and> k \<noteq> j}"
[PROOF STATE]
proof (state)
this:
inv = mset_set {k. k < n \<and> k \<noteq> i \<and> k \<noteq> j}

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
have b:"{0..<n} = {k. k < n \<and> k \<noteq> i \<and> k \<noteq> j} \<union> {i,j}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<n} = {k. k < n \<and> k \<noteq> i \<and> k \<noteq> j} \<union> {i, j}
[PROOF STEP]
apply (rule order_antisym, rule subsetI, simp, blast, rule subsetI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x = i \<or> x = j \<or> x < n \<and> x \<noteq> i \<and> x \<noteq> j \<Longrightarrow> x < n
[PROOF STEP]
using i_bound j_bound
[PROOF STATE]
proof (prove)
using this:
i < n
j < n

goal (1 subgoal):
 1. \<And>x. x = i \<or> x = j \<or> x < n \<and> x \<noteq> i \<and> x \<noteq> j \<Longrightarrow> x < n
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
{0..<n} = {k. k < n \<and> k \<noteq> i \<and> k \<noteq> j} \<union> {i, j}

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
have c:"\<And>k. k \<in># inv \<Longrightarrow> (x f) k = f k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k \<in># inv \<Longrightarrow> x f k = f k
[PROOF STEP]
by (simp add:x_def inv_def)
[PROOF STATE]
proof (state)
this:
?k \<in># inv \<Longrightarrow> x f ?k = f ?k

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
have "image_mset (x f) inv = image_mset f inv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset (x f) inv = image_mset f inv
[PROOF STEP]
apply (rule multiset_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. count (image_mset (x f) inv) xa = count (image_mset f inv) xa
[PROOF STEP]
using c multiset.map_cong0
[PROOF STATE]
proof (prove)
using this:
?k \<in># inv \<Longrightarrow> x f ?k = f ?k
(\<And>z. z \<in># ?x \<Longrightarrow> ?f z = ?g z) \<Longrightarrow> image_mset ?f ?x = image_mset ?g ?x

goal (1 subgoal):
 1. \<And>xa. count (image_mset (x f) inv) xa = count (image_mset f inv) xa
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
image_mset (x f) inv = image_mset f inv

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
image_mset (x f) inv = image_mset f inv

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
have "image_mset (x f) (mset_set {i,j}) = image_mset f (mset_set {i,j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset (x f) (mset_set {i, j}) = image_mset f (mset_set {i, j})
[PROOF STEP]
apply (cases "i = j")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. i = j \<Longrightarrow> image_mset (x f) (mset_set {i, j}) = image_mset f (mset_set {i, j})
 2. i \<noteq> j \<Longrightarrow> image_mset (x f) (mset_set {i, j}) = image_mset f (mset_set {i, j})
[PROOF STEP]
by (simp add:x_def max_def min_def)+
[PROOF STATE]
proof (state)
this:
image_mset (x f) (mset_set {i, j}) = image_mset f (mset_set {i, j})

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
image_mset (x f) (mset_set {i, j}) = image_mset f (mset_set {i, j})

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
have "mset_set {0..<n} = inv + mset_set {i,j}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset_set {0..<n} = inv + mset_set {i, j}
[PROOF STEP]
by (simp only:inv_def b, rule mset_set_Union, simp, simp, simp)
[PROOF STATE]
proof (state)
this:
mset_set {0..<n} = inv + mset_set {i, j}

goal (1 subgoal):
 1. \<And>x f. is_swap x \<Longrightarrow> image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
image_mset (x f) inv = image_mset f inv
image_mset (x f) (mset_set {i, j}) = image_mset f (mset_set {i, j})
mset_set {0..<n} = inv + mset_set {i, j}
[PROOF STEP]
show "image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})"
[PROOF STATE]
proof (prove)
using this:
image_mset (x f) inv = image_mset f inv
image_mset (x f) (mset_set {i, j}) = image_mset f (mset_set {i, j})
mset_set {0..<n} = inv + mset_set {i, j}

goal (1 subgoal):
 1. image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
image_mset (x f) (mset_set {0..<n}) = image_mset f (mset_set {0..<n})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_swap ?x \<Longrightarrow> image_mset (?x ?f) (mset_set {0..<n}) = image_mset ?f (mset_set {0..<n})

goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
have "(\<forall>x \<in> set t. is_swap x) \<Longrightarrow> image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set t. is_swap x \<Longrightarrow> image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
by (induction t arbitrary:f, simp, simp add:a)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set t. is_swap x \<Longrightarrow> image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])

goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set t. is_swap x \<Longrightarrow> image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])

goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
have "\<And>x. x \<in> set t \<Longrightarrow> is_swap x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set t \<Longrightarrow> is_swap x
[PROOF STEP]
apply (simp add:t_def is_swap_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<exists>xa\<in>{0..<n}. x \<in> (\<lambda>x. sort_primitive x xa) ` {0..<xa} \<Longrightarrow> \<exists>i<n. \<exists>j<n. x = sort_primitive i j
[PROOF STEP]
by (meson atLeastLessThan_iff imageE less_imp_le less_le_trans)
[PROOF STATE]
proof (state)
this:
?x \<in> set t \<Longrightarrow> is_swap ?x

goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set t. is_swap x \<Longrightarrow> image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])
?x \<in> set t \<Longrightarrow> is_swap ?x
[PROOF STEP]
have "image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set t. is_swap x \<Longrightarrow> image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])
?x \<in> set t \<Longrightarrow> is_swap ?x

goal (1 subgoal):
 1. image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])

goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
image_mset (fold id t f) (mset [0..<n]) = image_mset f (mset [0..<n])

goal (1 subgoal):
 1. image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])
[PROOF STEP]
by (simp add:t_def)
[PROOF STATE]
proof (state)
this:
image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_of_int_ceiling [simp]: "x \<le> of_int \<lceil>x\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> of_int \<lceil>x\<rceil>
[PROOF STEP]
using ceiling_correct
[PROOF STATE]
proof (prove)
using this:
of_int \<lceil>?x\<rceil> - (1::?'a) < ?x \<and> ?x \<le> of_int \<lceil>?x\<rceil>

goal (1 subgoal):
 1. x \<le> of_int \<lceil>x\<rceil>
[PROOF STEP]
..


[STATEMENT]
lemma iia_f_idem:
  assumes "f_range_on A f"
  assumes "iia_on A f"
  assumes "B \<subseteq> A"
  shows "f (f B) = f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (f B) = f B
[PROOF STEP]
using %invisible assms
[PROOF STATE]
proof (prove)
using this:
f_range_on A f
iia_on A f
B \<subseteq> A

goal (1 subgoal):
 1. f (f B) = f B
[PROOF STEP]
unfolding iia_on_def
[PROOF STATE]
proof (prove)
using this:
f_range_on A f
\<forall>B\<subseteq>A. \<forall>C\<subseteq>B. \<forall>a\<in>C. a \<in> f B \<longrightarrow> a \<in> f C
B \<subseteq> A

goal (1 subgoal):
 1. f (f B) = f B
[PROOF STEP]
by (meson f_range_onD f_range_on_antimono subset_antisym subset_eq)


[STATEMENT]
lemma ZFZero: "Nat2nat Empty = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Nat2nat Empty = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Nat2nat Empty = 0
[PROOF STEP]
have "nat2Nat 0 = Empty"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat2Nat 0 = Empty
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat2Nat 0 = Empty

goal (1 subgoal):
 1. Nat2nat Empty = 0
[PROOF STEP]
hence "Nat2nat Empty = Nat2nat (nat2Nat 0)"
[PROOF STATE]
proof (prove)
using this:
nat2Nat 0 = Empty

goal (1 subgoal):
 1. Nat2nat Empty = Nat2nat (nat2Nat 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Nat2nat Empty = Nat2nat (nat2Nat 0)

goal (1 subgoal):
 1. Nat2nat Empty = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Nat2nat Empty = Nat2nat (nat2Nat 0)

goal (1 subgoal):
 1. Nat2nat Empty = 0
[PROOF STEP]
using Nat2nat_nat2Nat[of "0"]
[PROOF STATE]
proof (prove)
using this:
Nat2nat Empty = Nat2nat (nat2Nat 0)
Nat2nat (nat2Nat 0) = 0

goal (1 subgoal):
 1. Nat2nat Empty = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Nat2nat Empty = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Inf_islimpt: "bdd_below S \<Longrightarrow> Inf S \<notin> S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> Inf S islimpt S" for S::"real set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bdd_below S; Inf S \<notin> S; S \<noteq> {}\<rbrakk> \<Longrightarrow> Inf S islimpt S
[PROOF STEP]
by (auto simp: islimpt_in_closure intro!: closure_contains_Inf)


[STATEMENT]
lemma enn2real_nn_integral_eq_integral:
  assumes eq: "AE x in M. f x = ennreal (g x)" and nn: "AE x in M. 0 \<le> g x"
    and fin: "(\<integral>\<^sup>+x. f x \<partial>M) < top"
    and [measurable]: "g \<in> M \<rightarrow>\<^sub>M borel"
  shows "enn2real (\<integral>\<^sup>+x. f x \<partial>M) = (\<integral>x. g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
have "ennreal (enn2real (\<integral>\<^sup>+x. f x \<partial>M)) = (\<integral>\<^sup>+x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (enn2real (integral\<^sup>N M f)) = integral\<^sup>N M f
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N M f < top

goal (1 subgoal):
 1. ennreal (enn2real (integral\<^sup>N M f)) = integral\<^sup>N M f
[PROOF STEP]
by (intro ennreal_enn2real) auto
[PROOF STATE]
proof (state)
this:
ennreal (enn2real (integral\<^sup>N M f)) = integral\<^sup>N M f

goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (enn2real (integral\<^sup>N M f)) = integral\<^sup>N M f

goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+x. g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N M f = \<integral>\<^sup>+ x. ennreal (g x) \<partial>M
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
AE x in M. f x = ennreal (g x)

goal (1 subgoal):
 1. integral\<^sup>N M f = \<integral>\<^sup>+ x. ennreal (g x) \<partial>M
[PROOF STEP]
by (rule nn_integral_cong_AE)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f = \<integral>\<^sup>+ x. ennreal (g x) \<partial>M

goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f = \<integral>\<^sup>+ x. ennreal (g x) \<partial>M

goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
have "\<dots> = (\<integral>x. g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (g x) \<partial>M = ennreal (integral\<^sup>L M g)
[PROOF STEP]
proof (rule nn_integral_eq_integral)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable M g
 2. AE x in M. 0 \<le> g x
[PROOF STEP]
show "integrable M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M g
[PROOF STEP]
proof (rule integrableI_bounded)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. g \<in> borel_measurable M
 2. \<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M < \<infinity>
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M) = (\<integral>\<^sup>+ x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M = integral\<^sup>N M f
[PROOF STEP]
using eq nn
[PROOF STATE]
proof (prove)
using this:
AE x in M. f x = ennreal (g x)
AE x in M. 0 \<le> g x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M = integral\<^sup>N M f
[PROOF STEP]
by (auto intro!: nn_integral_cong_AE elim!: eventually_elim2)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M = integral\<^sup>N M f

goal (2 subgoals):
 1. g \<in> borel_measurable M
 2. \<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M < \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M = integral\<^sup>N M f

goal (2 subgoals):
 1. g \<in> borel_measurable M
 2. \<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M < \<infinity>
[PROOF STEP]
note fin
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f < top

goal (2 subgoals):
 1. g \<in> borel_measurable M
 2. \<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M < \<infinity>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M < top
[PROOF STEP]
show "(\<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M) < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M < top

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M < \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (g x)) \<partial>M < \<infinity>

goal (1 subgoal):
 1. g \<in> borel_measurable M
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
integrable M g

goal (1 subgoal):
 1. AE x in M. 0 \<le> g x
[PROOF STEP]
qed fact
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (g x) \<partial>M = ennreal (integral\<^sup>L M g)

goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (enn2real (integral\<^sup>N M f)) = ennreal (integral\<^sup>L M g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (enn2real (integral\<^sup>N M f)) = ennreal (integral\<^sup>L M g)

goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
using nn
[PROOF STATE]
proof (prove)
using this:
ennreal (enn2real (integral\<^sup>N M f)) = ennreal (integral\<^sup>L M g)
AE x in M. 0 \<le> g x

goal (1 subgoal):
 1. enn2real (integral\<^sup>N M f) = integral\<^sup>L M g
[PROOF STEP]
by (simp add: integral_nonneg_AE)
[PROOF STATE]
proof (state)
this:
enn2real (integral\<^sup>N M f) = integral\<^sup>L M g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pdevs_val_pdevs_inner[simp]: "pdevs_val e (pdevs_inner p a) = pdevs_val e p \<bullet> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdevs_val e (pdevs_inner p a) = pdevs_val e p \<bullet> a
[PROOF STEP]
by (auto simp add: inner_sum_left pdevs_val_pdevs_domain intro!: sum.mono_neutral_cong_left)


[STATEMENT]
lemma ts_Least_0:
  assumes "ts x"
  shows    "(LEAST i. (x i) \<noteq> [] ) = (0::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST i. x i \<noteq> []) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LEAST i. x i \<noteq> []) = 0
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
ts x
[PROOF STEP]
have sg1:"x 0 \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
ts x

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

goal (1 subgoal):
 1. (LEAST i. x i \<noteq> []) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x 0 \<noteq> []

goal (1 subgoal):
 1. (LEAST i. x i \<noteq> []) = 0
[PROOF STEP]
apply (simp add: Least_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x 0 \<noteq> [] \<Longrightarrow> (THE xa. x xa \<noteq> [] \<and> (\<forall>y. x y \<noteq> [] \<longrightarrow> xa \<le> y)) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(LEAST i. x i \<noteq> []) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integrable_mono_on_nonneg:
  fixes f :: "real \<Rightarrow> real"
  assumes mon: "mono_on {a..b} f" and 0: "\<And>x. 0 \<le> f x"
  shows "integrable (lebesgue_on {a..b}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have "space lborel = space lebesgue" "sets borel \<subseteq> sets lebesgue"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space lborel = space lebesgue &&& sets borel \<subseteq> sets lebesgue
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue
[PROOF STEP]
have fborel: "f \<in> borel_measurable (lebesgue_on {a..b})"
[PROOF STATE]
proof (prove)
using this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
by (metis mon borel_measurable_mono_on_fnc borel_measurable_subalgebra mono_restrict_space
              space_lborel space_restrict_space)
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
obtain g where g: "incseq g" and simple: "\<And>i. simple_function (lebesgue_on {a..b}) (g i)"
                and bdd: " (\<forall>x. bdd_above (range (\<lambda>i. g i x)))" and nonneg: "\<forall>i x. 0 \<le> g i x"
                and fsup: "f = (SUP i. g i)"
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>incseq g; \<And>i. simple_function (lebesgue_on {a..b}) (g i); \<forall>x. bdd_above (range (\<lambda>i. g i x)); \<forall>i x. 0 \<le> g i x; f = Sup (range g)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis borel_measurable_implies_simple_function_sequence_real 0)
[PROOF STATE]
proof (state)
this:
incseq g
simple_function (lebesgue_on {a..b}) (g ?i1)
\<forall>x. bdd_above (range (\<lambda>i. g i x))
\<forall>i x. 0 \<le> g i x
f = Sup (range g)

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have "f ` {a..b} \<subseteq> {f a..f b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {a..b} \<subseteq> {f a..f b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mono_on {a..b} f
0 \<le> f ?x

goal (1 subgoal):
 1. f ` {a..b} \<subseteq> {f a..f b}
[PROOF STEP]
by (auto simp: mono_on_def)
[PROOF STATE]
proof (state)
this:
f ` {a..b} \<subseteq> {f a..f b}

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have g_le_f: "g i x \<le> f x" for i x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g i x \<le> f x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g i x \<le> f x
[PROOF STEP]
have "bdd_above ((\<lambda>h. h x) ` range g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above ((\<lambda>h. h x) ` range g)
[PROOF STEP]
using bdd cSUP_lessD linorder_not_less
[PROOF STATE]
proof (prove)
using this:
\<forall>x. bdd_above (range (\<lambda>i. g i x))
\<lbrakk>bdd_above (?f ` ?A); Sup (?f ` ?A) < ?y; ?i \<in> ?A\<rbrakk> \<Longrightarrow> ?f ?i < ?y
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. bdd_above ((\<lambda>h. h x) ` range g)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
bdd_above ((\<lambda>h. h x) ` range g)

goal (1 subgoal):
 1. g i x \<le> f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bdd_above ((\<lambda>h. h x) ` range g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bdd_above ((\<lambda>h. h x) ` range g)

goal (1 subgoal):
 1. g i x \<le> f x
[PROOF STEP]
by (metis SUP_apply UNIV_I bdd cSUP_upper fsup)
[PROOF STATE]
proof (state)
this:
g i x \<le> f x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
g ?i1 ?x1 \<le> f ?x1

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g ?i1 ?x1 \<le> f ?x1
[PROOF STEP]
have gfb: "g i x \<le> f b" if "x \<in> {a..b}" for i x
[PROOF STATE]
proof (prove)
using this:
g ?i1 ?x1 \<le> f ?x1

goal (1 subgoal):
 1. g i x \<le> f b
[PROOF STEP]
by (smt (verit, best) mon atLeastAtMost_iff mono_on_def that)
[PROOF STATE]
proof (state)
this:
?x1 \<in> {a..b} \<Longrightarrow> g ?i1 ?x1 \<le> f b

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have g_le: "g i x \<le> g j x" if "i\<le>j"  for i j x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g i x \<le> g j x
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
incseq g

goal (1 subgoal):
 1. g i x \<le> g j x
[PROOF STEP]
by (simp add: incseq_def le_funD that)
[PROOF STATE]
proof (state)
this:
?i1 \<le> ?j1 \<Longrightarrow> g ?i1 ?x1 \<le> g ?j1 ?x1

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
show "integrable (lebesgue_on {a..b}) ( f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
proof (rule integrable_dominated_convergence)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
 2. \<And>i. ?s i \<in> borel_measurable (lebesgue_on {a..b})
 3. integrable (lebesgue_on {a..b}) ?w
 4. AE x in lebesgue_on {a..b}. (\<lambda>i. ?s i x) \<longlonglongrightarrow> f x
 5. \<And>i. AE x in lebesgue_on {a..b}. norm (?s i x) \<le> ?w x
[PROOF STEP]
show "f \<in> borel_measurable (lebesgue_on {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
using fborel
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (4 subgoals):
 1. \<And>i. ?s i \<in> borel_measurable (lebesgue_on {a..b})
 2. integrable (lebesgue_on {a..b}) ?w
 3. AE x in lebesgue_on {a..b}. (\<lambda>i. ?s i x) \<longlonglongrightarrow> f x
 4. \<And>i. AE x in lebesgue_on {a..b}. norm (?s i x) \<le> ?w x
[PROOF STEP]
have "\<And>x. (\<lambda>i. g i x) \<longlonglongrightarrow> (SUP h \<in> range g. h  x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<lambda>i. g i x) \<longlonglongrightarrow> (SUP h\<in>range g. h x)
[PROOF STEP]
proof (rule order_tendstoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x a. a < (SUP h\<in>range g. h x) \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. a < g xa x
 2. \<And>x a. (SUP h\<in>range g. h x) < a \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. g xa x < a
[PROOF STEP]
show "\<forall>\<^sub>F i in sequentially. y < g i x"
        if "y < (SUP h\<in>range g. h x)" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. y < g i x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. y < g i x
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
y < (SUP h\<in>range g. h x)
[PROOF STEP]
obtain h where h: "h \<in> range g" "y < h x"
[PROOF STATE]
proof (prove)
using this:
y < (SUP h\<in>range g. h x)

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> range g; y < h x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using g_le_f
[PROOF STATE]
proof (prove)
using this:
y < (SUP h\<in>range g. h x)
g ?i1 ?x1 \<le> f ?x1

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> range g; y < h x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (subst (asm)less_cSUP_iff) fastforce+
[PROOF STATE]
proof (state)
this:
h \<in> range g
y < h x

goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. y < g i x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h \<in> range g
y < h x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
h \<in> range g
y < h x

goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. y < g i x
[PROOF STEP]
by (smt (verit, ccfv_SIG) eventually_sequentially g_le imageE)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F i in sequentially. y < g i x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?y1 < (SUP h\<in>range g. h ?x1) \<Longrightarrow> \<forall>\<^sub>F i in sequentially. ?y1 < g i ?x1

goal (1 subgoal):
 1. \<And>x a. (SUP h\<in>range g. h x) < a \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. g xa x < a
[PROOF STEP]
show "\<forall>\<^sub>F i in sequentially. g i x < y"
        if "(SUP h\<in>range g. h x) < y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. g i x < y
[PROOF STEP]
by (smt (verit, best) that Sup_apply g_le_f always_eventually fsup image_cong)
[PROOF STATE]
proof (state)
this:
(SUP h\<in>range g. h ?x1) < ?y1 \<Longrightarrow> \<forall>\<^sub>F i in sequentially. g i ?x1 < ?y1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>i. g i ?x1) \<longlonglongrightarrow> (SUP h\<in>range g. h ?x1)

goal (4 subgoals):
 1. \<And>i. ?s i \<in> borel_measurable (lebesgue_on {a..b})
 2. integrable (lebesgue_on {a..b}) ?w
 3. AE x in lebesgue_on {a..b}. (\<lambda>i. ?s i x) \<longlonglongrightarrow> f x
 4. \<And>i. AE x in lebesgue_on {a..b}. norm (?s i x) \<le> ?w x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. g i ?x1) \<longlonglongrightarrow> (SUP h\<in>range g. h ?x1)
[PROOF STEP]
show "AE x in lebesgue_on {a..b}. (\<lambda>i. g i x) \<longlonglongrightarrow> f x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. g i ?x1) \<longlonglongrightarrow> (SUP h\<in>range g. h ?x1)

goal (1 subgoal):
 1. AE x in lebesgue_on {a..b}. (\<lambda>i. g i x) \<longlonglongrightarrow> f x
[PROOF STEP]
by (simp add: fsup)
[PROOF STATE]
proof (state)
this:
AE x in lebesgue_on {a..b}. (\<lambda>i. g i x) \<longlonglongrightarrow> f x

goal (3 subgoals):
 1. \<And>i. g i \<in> borel_measurable (lebesgue_on {a..b})
 2. integrable (lebesgue_on {a..b}) ?w
 3. \<And>i. AE x in lebesgue_on {a..b}. norm (g i x) \<le> ?w x
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i. g i \<in> borel_measurable (lebesgue_on {a..b})
 2. integrable (lebesgue_on {a..b}) ?w
 3. \<And>i. AE x in lebesgue_on {a..b}. norm (g i x) \<le> ?w x
[PROOF STEP]
show "g i \<in> borel_measurable (lebesgue_on {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g i \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
using borel_measurable_simple_function simple
[PROOF STATE]
proof (prove)
using this:
simple_function ?M ?f \<Longrightarrow> ?f \<in> borel_measurable ?M
simple_function (lebesgue_on {a..b}) (g ?i1)

goal (1 subgoal):
 1. g i \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g i \<in> borel_measurable (lebesgue_on {a..b})

goal (2 subgoals):
 1. integrable (lebesgue_on {a..b}) ?w
 2. \<And>i. AE x in lebesgue_on {a..b}. norm (g i x) \<le> ?w x
[PROOF STEP]
show "AE x in lebesgue_on {a..b}. norm (g i x) \<le> f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in lebesgue_on {a..b}. norm (g i x) \<le> f b
[PROOF STEP]
by (simp add: gfb nonneg Measure_Space.AE_I' [of "{}"])
[PROOF STATE]
proof (state)
this:
AE x in lebesgue_on {a..b}. norm (g i x) \<le> f b

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) (\<lambda>x. f b)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {a..b}) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lift_set_Un_distrib: "lift_set i (A \<union> B) = lift_set i A \<union> lift_set i B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lift_set i (A \<union> B) = lift_set i A \<union> lift_set i B
[PROOF STEP]
by (simp add: lift_set_def image_Un)


[STATEMENT]
lemma closed_Int_compact [intro]:
  assumes "closed s"
    and "compact t"
  shows "compact (s \<inter> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (s \<inter> t)
[PROOF STEP]
using compact_Int_closed [of t s] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>compact t; closed s\<rbrakk> \<Longrightarrow> compact (t \<inter> s)
closed s
compact t

goal (1 subgoal):
 1. compact (s \<inter> t)
[PROOF STEP]
by (simp add: Int_commute)


[STATEMENT]
lemma map_of_zip_is_Some:
  assumes "length xs = length ys"
  shows "x \<in> set xs \<longleftrightarrow> (\<exists>y. map_of (zip xs ys) x = Some y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set xs) = (\<exists>y. map_of (zip xs ys) x = Some y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. (x \<in> set xs) = (\<exists>y. map_of (zip xs ys) x = Some y)
[PROOF STEP]
by (induct rule: list_induct2) simp_all


[STATEMENT]
lemma join_le_iff[simp]: "x \<squnion> y \<sqsubseteq> z \<longleftrightarrow> x \<sqsubseteq> z \<and> y \<sqsubseteq> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<squnion> y \<sqsubseteq> z) = (x \<sqsubseteq> z \<and> y \<sqsubseteq> z)
[PROOF STEP]
by (metis join_ge1 join_ge2 join_least le_trans)


[STATEMENT]
lemma complex_of_real_of:
  "(complex_of \<circ> real_of) = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of \<circ> real_of = id
[PROOF STEP]
unfolding complex_of_def real_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. complex_of_real (x $\<^sub>e 0) + \<i> * complex_of_real (x $\<^sub>e 1)) \<circ> (\<lambda>x. eucl_of_list [Re x, Im x]) = id
[PROOF STEP]
using complex_eq
[PROOF STATE]
proof (prove)
using this:
?a = complex_of_real (Re ?a) + \<i> * complex_of_real (Im ?a)

goal (1 subgoal):
 1. (\<lambda>x. complex_of_real (x $\<^sub>e 0) + \<i> * complex_of_real (x $\<^sub>e 1)) \<circ> (\<lambda>x. eucl_of_list [Re x, Im x]) = id
[PROOF STEP]
by (auto simp add:vec_simps)


[STATEMENT]
lemma norm_divide_numeral [simp]: "norm (a / numeral w) = norm a / numeral w"
  for a b :: "'a::{real_normed_field,field}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a / numeral w) = norm a / numeral w
[PROOF STEP]
by (simp add: norm_divide)


[STATEMENT]
lemma rbt_comp_delete: "rbt_comp_delete = ord.rbt_delete (lt_of_comp c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.rbt_comp_delete = ord.rbt_delete (lt_of_comp c)
[PROOF STEP]
unfolding rbt_comp_delete_def[abs_def] ord.rbt_delete_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k t. paint color.B (local.rbt_comp_del k t)) = (\<lambda>k t. paint color.B (ord.rbt_del (lt_of_comp c) k t))
[PROOF STEP]
unfolding rbt_comp_del
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k t. paint color.B (ord.rbt_del (lt_of_comp c) k t)) = (\<lambda>k t. paint color.B (ord.rbt_del (lt_of_comp c) k t))
[PROOF STEP]
..


[STATEMENT]
lemma vrange_vintersection_vsubset: "\<R>\<^sub>\<circ> (r \<inter>\<^sub>\<circ> s) \<subseteq>\<^sub>\<circ> \<R>\<^sub>\<circ> r \<inter>\<^sub>\<circ> \<R>\<^sub>\<circ> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (r \<inter>\<^sub>\<circ> s) \<subseteq>\<^sub>\<circ> \<R>\<^sub>\<circ> r \<inter>\<^sub>\<circ> \<R>\<^sub>\<circ> s
[PROOF STEP]
by auto


[STATEMENT]
lemma is_K33_component_size_last:
  assumes "k = ig_verts_cnt G"
  shows "is_K33_component_size_inv G k blue cnt \<longleftrightarrow> card {u \<in> set (ig_verts G). blue u} = cnt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_K33_component_size_inv G k blue cnt = (card {u \<in> set (ig_verts G). blue u} = cnt)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_K33_component_size_inv G k blue cnt = (card {u \<in> set (ig_verts G). blue u} = cnt)
[PROOF STEP]
have *: "{u \<in> set (ig_verts G). blue u} = (\<lambda>n. ig_verts G ! n) ` {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {u \<in> set (ig_verts G). blue u} = (!) (ig_verts G) ` {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}
[PROOF STEP]
by (auto simp: in_set_conv_nth )
[PROOF STATE]
proof (state)
this:
{u \<in> set (ig_verts G). blue u} = (!) (ig_verts G) ` {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}

goal (1 subgoal):
 1. is_K33_component_size_inv G k blue cnt = (card {u \<in> set (ig_verts G). blue u} = cnt)
[PROOF STEP]
have "inj_on (\<lambda>n. ig_verts G ! n) {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((!) (ig_verts G)) {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}
[PROOF STEP]
using distinct_ig_verts
[PROOF STATE]
proof (prove)
using this:
distinct (ig_verts ?G)

goal (1 subgoal):
 1. inj_on ((!) (ig_verts G)) {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}
[PROOF STEP]
by (auto simp: nth_eq_iff_index_eq intro: inj_onI)
[PROOF STATE]
proof (state)
this:
inj_on ((!) (ig_verts G)) {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}

goal (1 subgoal):
 1. is_K33_component_size_inv G k blue cnt = (card {u \<in> set (ig_verts G). blue u} = cnt)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
k = ig_verts_cnt G
inj_on ((!) (ig_verts G)) {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = ig_verts_cnt G
inj_on ((!) (ig_verts G)) {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}

goal (1 subgoal):
 1. is_K33_component_size_inv G k blue cnt = (card {u \<in> set (ig_verts G). blue u} = cnt)
[PROOF STEP]
unfolding * is_K33_component_size_inv_def
[PROOF STATE]
proof (prove)
using this:
k = ig_verts_cnt G
inj_on ((!) (ig_verts G)) {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}

goal (1 subgoal):
 1. (cnt = card {i. i < k \<and> blue (ig_verts G ! i)}) = (card ((!) (ig_verts G) ` {i. i < ig_verts_cnt G \<and> blue (ig_verts G ! i)}) = cnt)
[PROOF STEP]
by (auto intro: card_image)
[PROOF STATE]
proof (state)
this:
is_K33_component_size_inv G k blue cnt = (card {u \<in> set (ig_verts G). blue u} = cnt)

goal:
No subgoals!
[PROOF STEP]
qed