[STATEMENT]
lemma continuous_at_open:
  "continuous (at x) f \<longleftrightarrow> (\<forall>t. open t \<and> f x \<in> t --> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x' \<in> s. (f x') \<in> t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f x = (\<forall>t. open t \<and> f x \<in> t \<longrightarrow> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x'\<in>s. f x' \<in> t)))
[PROOF STEP]
unfolding continuous_within_topological [of x UNIV f]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>UNIV. y \<in> A \<longrightarrow> f y \<in> B))) = (\<forall>t. open t \<and> f x \<in> t \<longrightarrow> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x'\<in>s. f x' \<in> t)))
[PROOF STEP]
unfolding imp_conjL
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>UNIV. y \<in> A \<longrightarrow> f y \<in> B))) = (\<forall>t. open t \<longrightarrow> f x \<in> t \<longrightarrow> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x'\<in>s. f x' \<in> t)))
[PROOF STEP]
by (intro all_cong imp_cong ex_cong conj_cong refl) auto


[STATEMENT]
lemma foldr_mult_foldl:
  fixes v :: "'a::comm_ring_1"
  shows "foldr (\<lambda>x r. r * f x) as v = foldl (\<lambda>r x. r * f x) v as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>x r. r * f x) as v = foldl (\<lambda>r x. r * f x) v as
[PROOF STEP]
by (induct as arbitrary: v) (simp_all add: foldl_mult_start)


[STATEMENT]
lemma prime_2[intro]: "Prime (Suc (Suc 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Prime (Suc (Suc 0))
[PROOF STEP]
apply(auto simp: Prime.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v. \<lbrakk>u < Suc (Suc 0); v < Suc (Suc 0); u * v = Suc (Suc 0)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using less_2_cases
[PROOF STATE]
proof (prove)
using this:
?n < 2 \<Longrightarrow> ?n = 0 \<or> ?n = Suc 0

goal (1 subgoal):
 1. \<And>u v. \<lbrakk>u < Suc (Suc 0); v < Suc (Suc 0); u * v = Suc (Suc 0)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by fastforce


[STATEMENT]
lemma all_less_two: "(\<forall> i < Suc (Suc 0). P i) = (P 0 \<and> P (Suc 0))" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<Suc (Suc 0). P i) = (P 0 \<and> P (Suc 0))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i<Suc (Suc 0). P i \<Longrightarrow> P 0 \<and> P (Suc 0)
 2. P 0 \<and> P (Suc 0) \<Longrightarrow> \<forall>i<Suc (Suc 0). P i
[PROOF STEP]
assume ?r
[PROOF STATE]
proof (state)
this:
P 0 \<and> P (Suc 0)

goal (2 subgoals):
 1. \<forall>i<Suc (Suc 0). P i \<Longrightarrow> P 0 \<and> P (Suc 0)
 2. P 0 \<and> P (Suc 0) \<Longrightarrow> \<forall>i<Suc (Suc 0). P i
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<Suc (Suc 0). P i
[PROOF STEP]
proof(intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < Suc (Suc 0) \<Longrightarrow> P i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < Suc (Suc 0) \<Longrightarrow> P i
[PROOF STEP]
assume "i < Suc (Suc 0)"
[PROOF STATE]
proof (state)
this:
i < Suc (Suc 0)

goal (1 subgoal):
 1. \<And>i. i < Suc (Suc 0) \<Longrightarrow> P i
[PROOF STEP]
hence "i = 0 \<or> i = Suc 0"
[PROOF STATE]
proof (prove)
using this:
i < Suc (Suc 0)

goal (1 subgoal):
 1. i = 0 \<or> i = Suc 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i = 0 \<or> i = Suc 0

goal (1 subgoal):
 1. \<And>i. i < Suc (Suc 0) \<Longrightarrow> P i
[PROOF STEP]
with \<open>?r\<close>
[PROOF STATE]
proof (chain)
picking this:
P 0 \<and> P (Suc 0)
i = 0 \<or> i = Suc 0
[PROOF STEP]
show "P i"
[PROOF STATE]
proof (prove)
using this:
P 0 \<and> P (Suc 0)
i = 0 \<or> i = Suc 0

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<Suc (Suc 0). P i

goal (1 subgoal):
 1. \<forall>i<Suc (Suc 0). P i \<Longrightarrow> P 0 \<and> P (Suc 0)
[PROOF STEP]
qed auto


[STATEMENT]
lemma lex_two_SN_order_pair:
  assumes o1: "SN_order_pair s1 ns1" and o2: "SN_order_pair s2 ns2"
  shows "SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
interpret o1: SN_order_pair s1 ns1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SN_order_pair s1 ns1
[PROOF STEP]
using o1
[PROOF STATE]
proof (prove)
using this:
SN_order_pair s1 ns1

goal (1 subgoal):
 1. SN_order_pair s1 ns1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
interpret o2: SN_order_pair s2 ns2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SN_order_pair s2 ns2
[PROOF STEP]
using o2
[PROOF STATE]
proof (prove)
using this:
SN_order_pair s2 ns2

goal (1 subgoal):
 1. SN_order_pair s2 ns2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
note o1.trans_S o1.trans_NS o2.trans_S o2.trans_NS o1.SN o2.SN
    o1.compat_NS_S o2.compat_NS_S o1.compat_S_NS o2.compat_S_NS
[PROOF STATE]
proof (state)
this:
trans s1
trans ns1
trans s2
trans ns2
SN s1
SN s2
ns1 O s1 \<subseteq> s1
ns2 O s2 \<subseteq> s2
s1 O ns1 \<subseteq> s1
s2 O ns2 \<subseteq> s2

goal (1 subgoal):
 1. SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
note this [unfolded trans_O_iff]
[PROOF STATE]
proof (state)
this:
s1 O s1 \<subseteq> s1
ns1 O ns1 \<subseteq> ns1
s2 O s2 \<subseteq> s2
ns2 O ns2 \<subseteq> ns2
SN s1
SN s2
ns1 O s1 \<subseteq> s1
ns2 O s2 \<subseteq> s2
s1 O ns1 \<subseteq> s1
s2 O ns2 \<subseteq> s2

goal (1 subgoal):
 1. SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
interpret order_pair "(lex_two s1 ns1 s2)" "(lex_two s1 ns1 ns2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
by(rule lex_two_order_pair, standard)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)
[PROOF STEP]
by(standard, rule lex_two; fact)
[PROOF STATE]
proof (state)
this:
SN_order_pair (lex_two s1 ns1 s2) (lex_two s1 ns1 ns2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coprime_crossproduct:
  fixes a b c d :: 'a
  assumes "coprime a d" and "coprime b c"
  shows "normalize a * normalize c = normalize b * normalize d \<longleftrightarrow>
    normalize a = normalize b \<and> normalize c = normalize d"
    (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (normalize a * normalize c = normalize b * normalize d) = (normalize a = normalize b \<and> normalize c = normalize d)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
 2. normalize a = normalize b \<and> normalize c = normalize d \<Longrightarrow> normalize a * normalize c = normalize b * normalize d
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
normalize a = normalize b \<and> normalize c = normalize d

goal (2 subgoals):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
 2. normalize a = normalize b \<and> normalize c = normalize d \<Longrightarrow> normalize a * normalize c = normalize b * normalize d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
normalize a = normalize b \<and> normalize c = normalize d

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normalize a * normalize c = normalize b * normalize d

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
normalize a * normalize c = normalize b * normalize d

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
from \<open>?lhs\<close>
[PROOF STATE]
proof (chain)
picking this:
normalize a * normalize c = normalize b * normalize d
[PROOF STEP]
have "normalize a dvd normalize b * normalize d"
[PROOF STATE]
proof (prove)
using this:
normalize a * normalize c = normalize b * normalize d

goal (1 subgoal):
 1. normalize a dvd normalize b * normalize d
[PROOF STEP]
by (auto intro: dvdI dest: sym)
[PROOF STATE]
proof (state)
this:
normalize a dvd normalize b * normalize d

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
with \<open>coprime a d\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime a d
normalize a dvd normalize b * normalize d
[PROOF STEP]
have "a dvd b"
[PROOF STATE]
proof (prove)
using this:
coprime a d
normalize a dvd normalize b * normalize d

goal (1 subgoal):
 1. a dvd b
[PROOF STEP]
by (simp add: coprime_dvd_mult_left_iff normalize_mult [symmetric])
[PROOF STATE]
proof (state)
this:
a dvd b

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
from \<open>?lhs\<close>
[PROOF STATE]
proof (chain)
picking this:
normalize a * normalize c = normalize b * normalize d
[PROOF STEP]
have "normalize b dvd normalize a * normalize c"
[PROOF STATE]
proof (prove)
using this:
normalize a * normalize c = normalize b * normalize d

goal (1 subgoal):
 1. normalize b dvd normalize a * normalize c
[PROOF STEP]
by (auto intro: dvdI dest: sym)
[PROOF STATE]
proof (state)
this:
normalize b dvd normalize a * normalize c

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
with \<open>coprime b c\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime b c
normalize b dvd normalize a * normalize c
[PROOF STEP]
have "b dvd a"
[PROOF STATE]
proof (prove)
using this:
coprime b c
normalize b dvd normalize a * normalize c

goal (1 subgoal):
 1. b dvd a
[PROOF STEP]
by (simp add: coprime_dvd_mult_left_iff normalize_mult [symmetric])
[PROOF STATE]
proof (state)
this:
b dvd a

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
from \<open>?lhs\<close>
[PROOF STATE]
proof (chain)
picking this:
normalize a * normalize c = normalize b * normalize d
[PROOF STEP]
have "normalize c dvd normalize d * normalize b"
[PROOF STATE]
proof (prove)
using this:
normalize a * normalize c = normalize b * normalize d

goal (1 subgoal):
 1. normalize c dvd normalize d * normalize b
[PROOF STEP]
by (auto intro: dvdI dest: sym simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
normalize c dvd normalize d * normalize b

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
with \<open>coprime b c\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime b c
normalize c dvd normalize d * normalize b
[PROOF STEP]
have "c dvd d"
[PROOF STATE]
proof (prove)
using this:
coprime b c
normalize c dvd normalize d * normalize b

goal (1 subgoal):
 1. c dvd d
[PROOF STEP]
by (simp add: coprime_dvd_mult_left_iff coprime_commute normalize_mult [symmetric])
[PROOF STATE]
proof (state)
this:
c dvd d

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
from \<open>?lhs\<close>
[PROOF STATE]
proof (chain)
picking this:
normalize a * normalize c = normalize b * normalize d
[PROOF STEP]
have "normalize d dvd normalize c * normalize a"
[PROOF STATE]
proof (prove)
using this:
normalize a * normalize c = normalize b * normalize d

goal (1 subgoal):
 1. normalize d dvd normalize c * normalize a
[PROOF STEP]
by (auto intro: dvdI dest: sym simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
normalize d dvd normalize c * normalize a

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
with \<open>coprime a d\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime a d
normalize d dvd normalize c * normalize a
[PROOF STEP]
have "d dvd c"
[PROOF STATE]
proof (prove)
using this:
coprime a d
normalize d dvd normalize c * normalize a

goal (1 subgoal):
 1. d dvd c
[PROOF STEP]
by (simp add: coprime_dvd_mult_left_iff coprime_commute normalize_mult [symmetric])
[PROOF STATE]
proof (state)
this:
d dvd c

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
from \<open>a dvd b\<close> \<open>b dvd a\<close>
[PROOF STATE]
proof (chain)
picking this:
a dvd b
b dvd a
[PROOF STEP]
have "normalize a = normalize b"
[PROOF STATE]
proof (prove)
using this:
a dvd b
b dvd a

goal (1 subgoal):
 1. normalize a = normalize b
[PROOF STEP]
by (rule associatedI)
[PROOF STATE]
proof (state)
this:
normalize a = normalize b

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
normalize a = normalize b

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
from \<open>c dvd d\<close> \<open>d dvd c\<close>
[PROOF STATE]
proof (chain)
picking this:
c dvd d
d dvd c
[PROOF STEP]
have "normalize c = normalize d"
[PROOF STATE]
proof (prove)
using this:
c dvd d
d dvd c

goal (1 subgoal):
 1. normalize c = normalize d
[PROOF STEP]
by (rule associatedI)
[PROOF STATE]
proof (state)
this:
normalize c = normalize d

goal (1 subgoal):
 1. normalize a * normalize c = normalize b * normalize d \<Longrightarrow> normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
normalize a = normalize b
normalize c = normalize d
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
normalize a = normalize b
normalize c = normalize d

goal (1 subgoal):
 1. normalize a = normalize b \<and> normalize c = normalize d
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
normalize a = normalize b \<and> normalize c = normalize d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mask_conversed_shift:
  fixes a b k :: nat
  assumes asm: "a \<preceq> b"
  shows "a * 2^k \<preceq> b * 2^k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * 2 ^ k \<preceq> b * 2 ^ k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a * 2 ^ k \<preceq> b * 2 ^ k
[PROOF STEP]
have shift: "x \<preceq> y \<Longrightarrow> 2*x \<preceq> 2*y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<preceq> y \<Longrightarrow> 2 * x \<preceq> 2 * y
[PROOF STEP]
by (induction x; auto)
[PROOF STATE]
proof (state)
this:
?x \<preceq> ?y \<Longrightarrow> 2 * ?x \<preceq> 2 * ?y

goal (1 subgoal):
 1. a * 2 ^ k \<preceq> b * 2 ^ k
[PROOF STEP]
have "a * 2 ^ k \<preceq> b * 2 ^ k \<Longrightarrow> 2 * (a * 2 ^ k) \<preceq> 2 * (b * 2 ^ k)" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * 2 ^ k \<preceq> b * 2 ^ k \<Longrightarrow> 2 * (a * 2 ^ k) \<preceq> 2 * (b * 2 ^ k)
[PROOF STEP]
using shift[of "a*2^k" "b*2^k"]
[PROOF STATE]
proof (prove)
using this:
a * 2 ^ k \<preceq> b * 2 ^ k \<Longrightarrow> 2 * (a * 2 ^ k) \<preceq> 2 * (b * 2 ^ k)

goal (1 subgoal):
 1. a * 2 ^ k \<preceq> b * 2 ^ k \<Longrightarrow> 2 * (a * 2 ^ k) \<preceq> 2 * (b * 2 ^ k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * 2 ^ ?k \<preceq> b * 2 ^ ?k \<Longrightarrow> 2 * (a * 2 ^ ?k) \<preceq> 2 * (b * 2 ^ ?k)

goal (1 subgoal):
 1. a * 2 ^ k \<preceq> b * 2 ^ k
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a * 2 ^ ?k \<preceq> b * 2 ^ ?k \<Longrightarrow> 2 * (a * 2 ^ ?k) \<preceq> 2 * (b * 2 ^ ?k)

goal (1 subgoal):
 1. a * 2 ^ k \<preceq> b * 2 ^ k
[PROOF STEP]
by (induction k; auto simp: asm shift algebra_simps)
[PROOF STATE]
proof (state)
this:
a * 2 ^ k \<preceq> b * 2 ^ k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma restrict_rtrancl: "(restrict r S)\<^sup>* \<subseteq> r\<^sup>*" (is "?r\<^sup>* \<subseteq> r\<^sup>*")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (restrict r S)\<^sup>* \<subseteq> r\<^sup>*
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (restrict r S)\<^sup>* \<subseteq> r\<^sup>*
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (restrict r S)\<^sup>* \<subseteq> r\<^sup>*
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (restrict r S)\<^sup>* \<subseteq> r\<^sup>*
[PROOF STEP]
assume "(x, y) \<in> ?r\<^sup>*"
[PROOF STATE]
proof (state)
this:
(x, y) \<in> (restrict r S)\<^sup>*

goal (1 subgoal):
 1. (restrict r S)\<^sup>* \<subseteq> r\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<in> (restrict r S)\<^sup>*
[PROOF STEP]
have "(x, y) \<in> r\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> (restrict r S)\<^sup>*

goal (1 subgoal):
 1. (x, y) \<in> r\<^sup>*
[PROOF STEP]
unfolding restrict_def
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> {(x, y). x \<in> S \<and> y \<in> S \<and> (x, y) \<in> r}\<^sup>*

goal (1 subgoal):
 1. (x, y) \<in> r\<^sup>*
[PROOF STEP]
by induct auto
[PROOF STATE]
proof (state)
this:
(x, y) \<in> r\<^sup>*

goal (1 subgoal):
 1. (restrict r S)\<^sup>* \<subseteq> r\<^sup>*
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(?x2, ?y2) \<in> (restrict r S)\<^sup>* \<Longrightarrow> (?x2, ?y2) \<in> r\<^sup>*

goal (1 subgoal):
 1. (restrict r S)\<^sup>* \<subseteq> r\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?x2, ?y2) \<in> (restrict r S)\<^sup>* \<Longrightarrow> (?x2, ?y2) \<in> r\<^sup>*
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(?x2, ?y2) \<in> (restrict r S)\<^sup>* \<Longrightarrow> (?x2, ?y2) \<in> r\<^sup>*

goal (1 subgoal):
 1. (restrict r S)\<^sup>* \<subseteq> r\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(restrict r S)\<^sup>* \<subseteq> r\<^sup>*

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dom_rbt_lookup_Branch:
  "rbt_sorted (Branch c t1 k v t2) \<Longrightarrow>
    dom (rbt_lookup (Branch c t1 k v t2))
    = Set.insert k (dom (rbt_lookup t1) \<union> dom (rbt_lookup t2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rbt_sorted (Branch c t1 k v t2) \<Longrightarrow> dom (rbt_lookup (Branch c t1 k v t2)) = insert k (dom (rbt_lookup t1) \<union> dom (rbt_lookup t2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rbt_sorted (Branch c t1 k v t2) \<Longrightarrow> dom (rbt_lookup (Branch c t1 k v t2)) = insert k (dom (rbt_lookup t1) \<union> dom (rbt_lookup t2))
[PROOF STEP]
assume "rbt_sorted (Branch c t1 k v t2)"
[PROOF STATE]
proof (state)
this:
rbt_sorted (Branch c t1 k v t2)

goal (1 subgoal):
 1. rbt_sorted (Branch c t1 k v t2) \<Longrightarrow> dom (rbt_lookup (Branch c t1 k v t2)) = insert k (dom (rbt_lookup t1) \<union> dom (rbt_lookup t2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rbt_sorted (Branch c t1 k v t2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rbt_sorted (Branch c t1 k v t2)

goal (1 subgoal):
 1. dom (rbt_lookup (Branch c t1 k v t2)) = insert k (dom (rbt_lookup t1) \<union> dom (rbt_lookup t2))
[PROOF STEP]
by (simp add: rbt_lookup_keys)
[PROOF STATE]
proof (state)
this:
dom (rbt_lookup (Branch c t1 k v t2)) = insert k (dom (rbt_lookup t1) \<union> dom (rbt_lookup t2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dvd_div_eq_2:
  fixes a b c :: nat
  assumes "c>0" "a dvd c" "b dvd c" "c div a = c div b"
  shows "a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = b
[PROOF STEP]
have "a > 0" "a \<le> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a &&& a \<le> c
[PROOF STEP]
using dvd_nat_bounds[OF assms(1-2)]
[PROOF STATE]
proof (prove)
using this:
0 < a \<and> a \<le> c

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

goal (1 subgoal):
 1. a = b
[PROOF STEP]
have "a*(c div a) = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (c div a) = c
[PROOF STEP]
using assms dvd_mult_div_cancel
[PROOF STATE]
proof (prove)
using this:
0 < c
a dvd c
b dvd c
c div a = c div b
?a dvd ?b \<Longrightarrow> ?a * (?b div ?a) = ?b

goal (1 subgoal):
 1. a * (c div a) = c
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
a * (c div a) = c

goal (1 subgoal):
 1. a = b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a * (c div a) = c

goal (1 subgoal):
 1. a = b
[PROOF STEP]
have "\<dots> = b*(c div a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c = b * (c div a)
[PROOF STEP]
using assms dvd_mult_div_cancel
[PROOF STATE]
proof (prove)
using this:
0 < c
a dvd c
b dvd c
c div a = c div b
?a dvd ?b \<Longrightarrow> ?a * (?b div ?a) = ?b

goal (1 subgoal):
 1. c = b * (c div a)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
c = b * (c div a)

goal (1 subgoal):
 1. a = b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a * (c div a) = b * (c div a)
[PROOF STEP]
show "a = b"
[PROOF STATE]
proof (prove)
using this:
a * (c div a) = b * (c div a)

goal (1 subgoal):
 1. a = b
[PROOF STEP]
using \<open>c>0\<close> dvd_div_ge_1[OF _ \<open>a dvd c\<close>]
[PROOF STATE]
proof (prove)
using this:
a * (c div a) = b * (c div a)
0 < c
1 \<le> c \<Longrightarrow> 1 \<le> c div a

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_fixp:
  assumes "finite(UNIV :: 'a set)"
      and "mono (\<tau> :: ('a set \<Rightarrow> 'a set))"
    shows "\<exists> i. (\<tau> ^^ i) ({}) = (\<tau> ^^(i + 1))({})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
text \<open>Proof idea:
with @{text predtrans_empty} we know

@{term "\<forall> i. (\<tau> ^^ i){} \<subseteq> (\<tau> ^^(i + 1))({})"} (1).

If we can additionally show

@{term "\<exists> i.  (\<tau> ^^ i)({}) \<supseteq> (\<tau> ^^(i + 1))({})"} (2),

we can get the goal together with equalityI
@{text "\<subseteq> + \<supseteq> \<longrightarrow> ="}.
To prove (1) we observe that
@{term "(\<tau> ^^ i)({}) \<supseteq> (\<tau> ^^(i + 1))({})"}
can be inferred from
@{term "\<not>((\<tau> ^^ i)({}) \<subseteq> (\<tau> ^^(i + 1))({}))"}
and (1).
Finally, the latter is solved directly by @{text \<open>no_infinite_subset_chain\<close>}.\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
have a: "\<forall>i. (\<tau> ^^ i) ({}:: 'a set) \<subseteq> (\<tau> ^^ (i + (1))) {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. (\<tau> ^^ i) {} \<subseteq> (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
by(rule predtrans_empty, rule assms(2))
[PROOF STATE]
proof (state)
this:
\<forall>i. (\<tau> ^^ i) {} \<subseteq> (\<tau> ^^ (i + 1)) {}

goal (1 subgoal):
 1. \<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
have a3: "\<not> (\<forall> i :: nat. (\<tau> ^^ i) {} \<subset> (\<tau> ^^(i + 1)) {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>i. (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {})
[PROOF STEP]
by (rule notI, rule no_infinite_subset_chain, (rule assms)+)
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>i. (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {})

goal (1 subgoal):
 1. \<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
hence b: "(\<exists> i :: nat. \<not>((\<tau> ^^ i) {} \<subset> (\<tau> ^^(i + 1)) {}))"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>i. (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {})

goal (1 subgoal):
 1. \<exists>i. \<not> (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
using assms a3
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>i. (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {})
finite UNIV
mono \<tau>
\<not> (\<forall>i. (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {})

goal (1 subgoal):
 1. \<exists>i. \<not> (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i. \<not> (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {}

goal (1 subgoal):
 1. \<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
thus "\<exists> i. (\<tau> ^^ i) ({}) = (\<tau> ^^(i + 1))({})"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. \<not> (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {}

goal (1 subgoal):
 1. \<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
\<exists>i. \<not> (\<tau> ^^ i) {} \<subset> (\<tau> ^^ (i + 1)) {}
\<forall>i. (\<tau> ^^ i) {} \<subseteq> (\<tau> ^^ (i + 1)) {}

goal (1 subgoal):
 1. \<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i. (\<tau> ^^ i) {} = (\<tau> ^^ (i + 1)) {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_Un':
  assumes "A \<in> sets M" "B \<in> sets M" "A \<inter> B \<in> null_sets M"
  shows   "emeasure M (A \<union> B) = emeasure M A + emeasure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
have "A \<union> B = A \<union> (B - A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union> B = A \<union> (B - A \<inter> B)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<union> B = A \<union> (B - A \<inter> B)

goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A \<union> B = A \<union> (B - A \<inter> B)

goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
have "emeasure M \<dots> = emeasure M A + emeasure M (B - A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (A \<union> (B - A \<inter> B)) = emeasure M A + emeasure M (B - A \<inter> B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
B \<in> sets M
A \<inter> B \<in> null_sets M

goal (1 subgoal):
 1. emeasure M (A \<union> (B - A \<inter> B)) = emeasure M A + emeasure M (B - A \<inter> B)
[PROOF STEP]
by (subst plus_emeasure) auto
[PROOF STATE]
proof (state)
this:
emeasure M (A \<union> (B - A \<inter> B)) = emeasure M A + emeasure M (B - A \<inter> B)

goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (A \<union> (B - A \<inter> B)) = emeasure M A + emeasure M (B - A \<inter> B)

goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
have "emeasure M (B - A \<inter> B) = emeasure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (B - A \<inter> B) = emeasure M B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
B \<in> sets M
A \<inter> B \<in> null_sets M

goal (1 subgoal):
 1. emeasure M (B - A \<inter> B) = emeasure M B
[PROOF STEP]
by (intro emeasure_Diff_null_set) auto
[PROOF STATE]
proof (state)
this:
emeasure M (B - A \<inter> B) = emeasure M B

goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M (A \<union> B) = emeasure M A + emeasure M B

goal (1 subgoal):
 1. emeasure M (A \<union> B) = emeasure M A + emeasure M B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure M (A \<union> B) = emeasure M A + emeasure M B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vars_Prod_any: "vars (Prod_any h) \<subseteq> (\<Union>i. vars (h i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (Prod_any h) \<subseteq> (\<Union>i. vars (h i))
[PROOF STEP]
unfolding Prod_any.expand_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (prod h {a. h a \<noteq> 1}) \<subseteq> (\<Union>i. vars (h i))
[PROOF STEP]
by (intro order.trans[OF vars_prod]) auto


[STATEMENT]
lemma dim_row_conjugate[simp]: "dim_row (conjugate m) = dim_row m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (conjugate m) = dim_row m
[PROOF STEP]
unfolding conjugate_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat (dim_row m) (dim_col m) (\<lambda>(i, j). conjugate (m $$ (i, j)))) = dim_row m
[PROOF STEP]
by auto


[STATEMENT]
lemma Sum4:
  "(\<Sum>i=0..<4::nat. x i) = x 0 + x 1 + x 2 + x 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum x {0..<4} = x 0 + x 1 + x 2 + x 3
[PROOF STEP]
by (simp add: Ivl4 eval_nat_numeral)


[STATEMENT]
lemma binomial_symmetric_plus: "(n + k) choose n = (n + k) choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n + k choose n = n + k choose k
[PROOF STEP]
by (metis add_diff_cancel_left' binomial_symmetric le_add1)


[STATEMENT]
theorem theorem3:
  shows "(\<forall>A::'a mat. admits_triangular_reduction A)
  = (\<forall>a b::'a. \<exists> a1 b1 d. a = a1*d \<and> b = b1*d \<and> ideal_generated {a1,b1} = ideal_generated {1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A. admits_triangular_reduction A) = (\<forall>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a})
[PROOF STEP]
using theorem3_part1 theorem3_part2
[PROOF STATE]
proof (prove)
using this:
\<forall>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a} \<Longrightarrow> \<forall>A. admits_triangular_reduction A
\<forall>A. admits_triangular_reduction A \<Longrightarrow> \<forall>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}

goal (1 subgoal):
 1. (\<forall>A. admits_triangular_reduction A) = (\<forall>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a})
[PROOF STEP]
by auto


[STATEMENT]
lemma "wordinterval_to_set (l2wi_intersect (map ipt_iprange_to_interval ips)) =
            (\<Inter> ip \<in> set ips. ipt_iprange_to_set ip)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi_intersect (map ipt_iprange_to_interval ips)) = \<Inter> (ipt_iprange_to_set ` set ips)
[PROOF STEP]
apply(simp add: l2wi_intersect)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>a\<in>set ips. case ipt_iprange_to_interval a of (x, xa) \<Rightarrow> {x..xa}) = \<Inter> (ipt_iprange_to_set ` set ips)
[PROOF STEP]
using ipt_iprange_to_interval
[PROOF STATE]
proof (prove)
using this:
ipt_iprange_to_interval ?ip = (?s, ?e) \<Longrightarrow> {?s..?e} = ipt_iprange_to_set ?ip

goal (1 subgoal):
 1. (\<Inter>a\<in>set ips. case ipt_iprange_to_interval a of (x, xa) \<Rightarrow> {x..xa}) = \<Inter> (ipt_iprange_to_set ` set ips)
[PROOF STEP]
by blast


[STATEMENT]
lemma [code equation]:
  "(x :: real) / (y :: real) = x * inverse y"
  "(x :: real) - (y :: real) = x + (- y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x / y = x * inverse y &&& x - y = x + - y
[PROOF STEP]
by (simp_all add: divide_inverse)


[STATEMENT]
lemma cos_int_2pin [simp]: "cos ((2 * pi) * of_int n) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (2 * pi * real_of_int n) = 1
[PROOF STEP]
by (simp add: cos_one_2pi_int)


[STATEMENT]
lemma primitive_root_unity_simple_computation:
  "primitive_root_unity k x  = (if k = 0 then False else
     x ^ k = 1 \<and> (\<forall> i \<in> {1 ..< k}. x ^ i \<noteq> 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_root_unity k x = (if k = 0 then False else x ^ k = (1::'a) \<and> (\<forall>i\<in>{1..<k}. x ^ i \<noteq> (1::'a)))
[PROOF STEP]
unfolding primitive_root_unity_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k \<noteq> 0 \<and> x ^ k = (1::'a) \<and> (\<forall>k'<k. k' \<noteq> 0 \<longrightarrow> x ^ k' \<noteq> (1::'a))) = (if k = 0 then False else x ^ k = (1::'a) \<and> (\<forall>i\<in>{1..<k}. x ^ i \<noteq> (1::'a)))
[PROOF STEP]
by auto


[STATEMENT]
lemma continuous_attains_inf:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
  shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f \<Longrightarrow> (\<exists>x\<in>s. \<forall>y\<in>s. f x \<le> f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>compact s; s \<noteq> {}; continuous_on s f\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. \<forall>y\<in>s. f x \<le> f y
[PROOF STEP]
using compact_attains_inf[of "f ` s"] compact_continuous_image[of s f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>compact (f ` s); f ` s \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>sa\<in>f ` s. \<forall>t\<in>f ` s. sa \<le> t
\<lbrakk>continuous_on s f; compact s\<rbrakk> \<Longrightarrow> compact (f ` s)

goal (1 subgoal):
 1. \<lbrakk>compact s; s \<noteq> {}; continuous_on s f\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. \<forall>y\<in>s. f x \<le> f y
[PROOF STEP]
by auto


[STATEMENT]
lemma rank_take_cols_geq:
  assumes R:"R \<in> carrier_mat n nc"
  assumes t:"take_cols R ls \<in> carrier_mat n r"
  assumes B:"B \<in> carrier_mat r nc"
  assumes "R = (take_cols R ls) * B"
  shows "rank (take_cols R ls) \<ge> rank R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank R \<le> rank (take_cols R ls)
[PROOF STEP]
by (metis B assms(4) t vec_space.rank_mat_mul_right)


[STATEMENT]
lemma cos0_sin1:
  assumes "sin \<phi> = 1"
  shows "\<exists> k::int. \<phi> = pi/2 + 2*k*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. \<phi> = pi / 2 + 2 * real_of_int x * pi
[PROOF STEP]
by (smt (verit, ccfv_threshold) assms cos_diff cos_one_2pi_int cos_pi_half mult_cancel_right1 sin_pi_half sin_plus_pi)


[STATEMENT]
lemma sat_EXISTS: "distinct xs \<Longrightarrow> sat (EXISTS xs Q) I \<sigma> = (\<exists>ds. length ds = length xs \<and> sat Q I (\<sigma>[xs :=\<^sup>* ds]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> sat (EXISTS xs Q) I \<sigma> = (\<exists>ds. length ds = length xs \<and> sat Q I (\<sigma>[xs :=\<^sup>* ds]))
[PROOF STEP]
proof (induct xs arbitrary: Q \<sigma>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Q \<sigma>. distinct [] \<Longrightarrow> sat (EXISTS [] Q) I \<sigma> = (\<exists>ds. length ds = length [] \<and> sat Q I (\<sigma>[[] :=\<^sup>* ds]))
 2. \<And>a xs Q \<sigma>. \<lbrakk>\<And>Q \<sigma>. distinct xs \<Longrightarrow> sat (EXISTS xs Q) I \<sigma> = (\<exists>ds. length ds = length xs \<and> sat Q I (\<sigma>[xs :=\<^sup>* ds])); distinct (a # xs)\<rbrakk> \<Longrightarrow> sat (EXISTS (a # xs) Q) I \<sigma> = (\<exists>ds. length ds = length (a # xs) \<and> sat Q I (\<sigma>[a # xs :=\<^sup>* ds]))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
distinct xs \<Longrightarrow> sat (EXISTS xs ?Q) I ?\<sigma> = (\<exists>ds. length ds = length xs \<and> sat ?Q I (?\<sigma>[xs :=\<^sup>* ds]))
distinct (x # xs)

goal (2 subgoals):
 1. \<And>Q \<sigma>. distinct [] \<Longrightarrow> sat (EXISTS [] Q) I \<sigma> = (\<exists>ds. length ds = length [] \<and> sat Q I (\<sigma>[[] :=\<^sup>* ds]))
 2. \<And>a xs Q \<sigma>. \<lbrakk>\<And>Q \<sigma>. distinct xs \<Longrightarrow> sat (EXISTS xs Q) I \<sigma> = (\<exists>ds. length ds = length xs \<and> sat Q I (\<sigma>[xs :=\<^sup>* ds])); distinct (a # xs)\<rbrakk> \<Longrightarrow> sat (EXISTS (a # xs) Q) I \<sigma> = (\<exists>ds. length ds = length (a # xs) \<and> sat Q I (\<sigma>[a # xs :=\<^sup>* ds]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct xs \<Longrightarrow> sat (EXISTS xs ?Q) I ?\<sigma> = (\<exists>ds. length ds = length xs \<and> sat ?Q I (?\<sigma>[xs :=\<^sup>* ds]))
distinct (x # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
distinct xs \<Longrightarrow> sat (EXISTS xs ?Q) I ?\<sigma> = (\<exists>ds. length ds = length xs \<and> sat ?Q I (?\<sigma>[xs :=\<^sup>* ds]))
distinct (x # xs)

goal (1 subgoal):
 1. sat (EXISTS (x # xs) Q) I \<sigma> = (\<exists>ds. length ds = length (x # xs) \<and> sat Q I (\<sigma>[x # xs :=\<^sup>* ds]))
[PROOF STEP]
by (auto 0 3 simp: EXISTS_def length_Suc_conv fun_upds_twist fun_upd_def[symmetric])
[PROOF STATE]
proof (state)
this:
sat (EXISTS (x # xs) Q) I \<sigma> = (\<exists>ds. length ds = length (x # xs) \<and> sat Q I (\<sigma>[x # xs :=\<^sup>* ds]))

goal (1 subgoal):
 1. \<And>Q \<sigma>. distinct [] \<Longrightarrow> sat (EXISTS [] Q) I \<sigma> = (\<exists>ds. length ds = length [] \<and> sat Q I (\<sigma>[[] :=\<^sup>* ds]))
[PROOF STEP]
qed (simp add: EXISTS_def)


[STATEMENT]
lemma configuration_step_eq_unified:
  shows "configuration q (Suc n) = \<Union>{configuration q' n | q'. q = \<delta> q' (w n)} \<union> (if q = q\<^sub>0 then {Suc n} else {}) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. configuration q (Suc n) = \<Union> {configuration q' n |q'. q = \<delta> q' (w n)} \<union> (if q = q\<^sub>0 then {Suc n} else {})
[PROOF STEP]
using configuration_step_eq configuration_step_eq_q\<^sub>0
[PROOF STATE]
proof (prove)
using this:
?q \<noteq> q\<^sub>0 \<Longrightarrow> configuration ?q (Suc ?n) = \<Union> {configuration q' ?n |q'. ?q = \<delta> q' (w ?n)}
configuration q\<^sub>0 (Suc ?n) = {Suc ?n} \<union> \<Union> {configuration q' ?n |q'. q\<^sub>0 = \<delta> q' (w ?n)}

goal (1 subgoal):
 1. configuration q (Suc n) = \<Union> {configuration q' n |q'. q = \<delta> q' (w n)} \<union> (if q = q\<^sub>0 then {Suc n} else {})
[PROOF STEP]
by force


[STATEMENT]
lemma le_comp_right: "x \<le> y \<Longrightarrow> x * z \<le> y * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x * z \<le> y * z
[PROOF STEP]
apply (cut_tac x = x and y = y and z = z in inf_comp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; x \<sqinter> y * z = x * z \<sqinter> (y * z)\<rbrakk> \<Longrightarrow> x * z \<le> y * z
[PROOF STEP]
apply (simp add: inf_absorb1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; x * z = x * z \<sqinter> (y * z)\<rbrakk> \<Longrightarrow> x * z \<le> y * z
[PROOF STEP]
apply (subgoal_tac "x * z \<sqinter> (y * z) \<le> y * z")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<le> y; x * z = x * z \<sqinter> (y * z); x * z \<sqinter> (y * z) \<le> y * z\<rbrakk> \<Longrightarrow> x * z \<le> y * z
 2. \<lbrakk>x \<le> y; x * z = x * z \<sqinter> (y * z)\<rbrakk> \<Longrightarrow> x * z \<sqinter> (y * z) \<le> y * z
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; x * z = x * z \<sqinter> (y * z)\<rbrakk> \<Longrightarrow> x * z \<sqinter> (y * z) \<le> y * z
[PROOF STEP]
by (rule inf_le2)


[STATEMENT]
lemma set_maps: "set (List.maps f a) = (\<Union>a\<in>set a. set (f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (List.maps f a) = (\<Union>a\<in>set a. set (f a))
[PROOF STEP]
unfolding List.maps_def set_concat set_map UN_simps(10)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>a\<in>set a. set (f a)) = (\<Union>a\<in>set a. set (f a))
[PROOF STEP]
..


[STATEMENT]
lemma bigtheta_mult_eq_set_mult:
  shows "\<Theta>[F](\<lambda>x. f x * g x) = set_mult (\<Theta>[F](f)) (\<Theta>[F](g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Theta>[F](\<lambda>x. f x * g x) = set_mult \<Theta>[F](f) \<Theta>[F](g)
[PROOF STEP]
unfolding bigtheta_mult_eq set_mult_def set_times_def func_times
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {c. \<exists>a\<in>\<Theta>[F](f). \<exists>b\<in>\<Theta>[F](g). c = (\<lambda>x. a x * b x)} = {\<lambda>x. fa x * ga x |fa ga. fa \<in> \<Theta>[F](f) \<and> ga \<in> \<Theta>[F](g)}
[PROOF STEP]
by blast


[STATEMENT]
lemma neighborhood_incident: "u \<in> neighborhood v \<longleftrightarrow> {u, v} \<in> incident_edges v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> neighborhood v) = ({u, v} \<in> incident_edges v)
[PROOF STEP]
unfolding neighborhood_def incident_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> {va \<in> V. vert_adj v va}) = ({u, v} \<in> {e \<in> E. incident v e})
[PROOF STEP]
by (smt (verit) incident_def insert_commute insert_subset mem_Collect_eq subset_insertI vert_adj_def wellformed)


[STATEMENT]
lemma content_eq_0: "content (box a b) = 0 \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i \<le> a\<bullet>i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (content (box a b) = 0) = (\<exists>i\<in>Basis. b \<bullet> i \<le> a \<bullet> i)
[PROOF STEP]
by (auto simp: content_box_cases not_le intro: less_imp_le antisym eq_refl)


[STATEMENT]
lemma isCont_powr[continuous_intros, simp]:
  fixes f g :: "_ \<Rightarrow> real"
  assumes "isCont f a" "isCont g a" "f a \<noteq> 0"
  shows "isCont (\<lambda>x. (f x) powr g x) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>x. f x powr g x) a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isCont f a
isCont g a
f a \<noteq> 0

goal (1 subgoal):
 1. isCont (\<lambda>x. f x powr g x) a
[PROOF STEP]
unfolding continuous_at
[PROOF STATE]
proof (prove)
using this:
f \<midarrow>a\<rightarrow> f a
g \<midarrow>a\<rightarrow> g a
f a \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>x. f x powr g x) \<midarrow>a\<rightarrow> f a powr g a
[PROOF STEP]
by (rule tendsto_powr)


[STATEMENT]
lemma separatedin_open_sets:
     "\<lbrakk>openin X S; openin X T\<rbrakk> \<Longrightarrow> separatedin X S T \<longleftrightarrow> disjnt S T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>openin X S; openin X T\<rbrakk> \<Longrightarrow> separatedin X S T = disjnt S T
[PROOF STEP]
unfolding disjnt_def separatedin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>openin X S; openin X T\<rbrakk> \<Longrightarrow> (S \<subseteq> topspace X \<and> T \<subseteq> topspace X \<and> S \<inter> X closure_of T = {} \<and> T \<inter> X closure_of S = {}) = (S \<inter> T = {})
[PROOF STEP]
by (auto simp: openin_Int_closure_of_eq_empty openin_subset)


[STATEMENT]
lemma inverse_negative_iff_negative [simp]:
  "(inverse a < 0) = (a < 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inverse a < (0::'a)) = (a < (0::'a))
[PROOF STEP]
using local.negative_imp_inverse_negative
[PROOF STATE]
proof (prove)
using this:
?a < (0::'a) \<Longrightarrow> inverse ?a < (0::'a)

goal (1 subgoal):
 1. (inverse a < (0::'a)) = (a < (0::'a))
[PROOF STEP]
by fastforce


[STATEMENT]
lemma rel_interior_rel_open:
  fixes S :: "'n::euclidean_space set"
  assumes "convex S"
  shows "rel_open (rel_interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_open (rel_interior S)
[PROOF STEP]
unfolding rel_open_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior (rel_interior S) = rel_interior S
[PROOF STEP]
using rel_interior_rel_interior assms
[PROOF STATE]
proof (prove)
using this:
convex ?S \<Longrightarrow> rel_interior (rel_interior ?S) = rel_interior ?S
convex S

goal (1 subgoal):
 1. rel_interior (rel_interior S) = rel_interior S
[PROOF STEP]
by auto


[STATEMENT]
lemma card_product_dependent:
  assumes "finite S" "\<forall>x \<in> S. finite (T x)"
  shows "card {(x, y). x \<in> S \<and> y \<in> T x} = (\<Sum>x \<in> S. card (T x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(x, y). x \<in> S \<and> y \<in> T x} = (\<Sum>x\<in>S. card (T x))
[PROOF STEP]
using card_SigmaI[OF assms, symmetric]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a\<in>S. card (T a)) = card (Sigma S T)

goal (1 subgoal):
 1. card {(x, y). x \<in> S \<and> y \<in> T x} = (\<Sum>x\<in>S. card (T x))
[PROOF STEP]
by (auto intro!: arg_cong[where f=card] simp add: Sigma_def)


[STATEMENT]
lemma swap_ell2_tensor[simp]: \<open>swap_ell2 *\<^sub>V tensor_ell2 a b = tensor_ell2 b a\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swap_ell2 *\<^sub>V a \<otimes>\<^sub>s b = b \<otimes>\<^sub>s a
[PROOF STEP]
apply (rule clinear_equal_ket[THEN fun_cong, where x=a])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. clinear (\<lambda>a. swap_ell2 *\<^sub>V a \<otimes>\<^sub>s b)
 2. clinear ((\<otimes>\<^sub>s) b)
 3. \<And>i. swap_ell2 *\<^sub>V ket i \<otimes>\<^sub>s b = b \<otimes>\<^sub>s ket i
[PROOF STEP]
apply (simp add: cblinfun.add_right clinearI tensor_ell2_add1 tensor_ell2_scaleC1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. clinear ((\<otimes>\<^sub>s) b)
 2. \<And>i. swap_ell2 *\<^sub>V ket i \<otimes>\<^sub>s b = b \<otimes>\<^sub>s ket i
[PROOF STEP]
apply (simp add: clinear_tensor_ell21)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. swap_ell2 *\<^sub>V ket i \<otimes>\<^sub>s b = b \<otimes>\<^sub>s ket i
[PROOF STEP]
apply (rule clinear_equal_ket[THEN fun_cong, where x=b])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i. clinear (\<lambda>a. swap_ell2 *\<^sub>V ket i \<otimes>\<^sub>s a)
 2. \<And>i. clinear (\<lambda>a. a \<otimes>\<^sub>s ket i)
 3. \<And>i ia. swap_ell2 *\<^sub>V ket i \<otimes>\<^sub>s ket ia = ket ia \<otimes>\<^sub>s ket i
[PROOF STEP]
apply (simp add: cblinfun.add_right clinearI tensor_ell2_add1 tensor_ell2_add2 tensor_ell2_scaleC1 tensor_ell2_scaleC2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. clinear (\<lambda>a. a \<otimes>\<^sub>s ket i)
 2. \<And>i ia. swap_ell2 *\<^sub>V ket i \<otimes>\<^sub>s ket ia = ket ia \<otimes>\<^sub>s ket i
[PROOF STEP]
apply (simp add: clinearI tensor_ell2_add1 tensor_ell2_add2 tensor_ell2_scaleC1 tensor_ell2_scaleC2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia. swap_ell2 *\<^sub>V ket i \<otimes>\<^sub>s ket ia = ket ia \<otimes>\<^sub>s ket i
[PROOF STEP]
unfolding swap_ell2.rep_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia. swap_ell20 (ket i \<otimes>\<^sub>s ket ia) = ket ia \<otimes>\<^sub>s ket i
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia. (\<lambda>(a, b). case (b, a) of (ib, j) \<Rightarrow> (if i = ib then 1 else 0) * (if ia = j then 1 else 0)) = (\<lambda>(ib, j). (if ia = ib then 1 else 0) * (if i = j then 1 else 0))
[PROOF STEP]
by auto


[STATEMENT]
lemma Ex_last_occurrence:
  "\<lbrakk>P (n::nat); n\<le>l\<rbrakk> \<Longrightarrow> (\<exists>m. P (l - m) \<and> (\<forall>i. i<m \<longrightarrow> \<not>P (l - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P n; n \<le> l\<rbrakk> \<Longrightarrow> \<exists>m. P (l - m) \<and> (\<forall>i<m. \<not> P (l - i))
[PROOF STEP]
apply(drule Compl_lemma)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P n; \<exists>m\<le>l. n = l - m\<rbrakk> \<Longrightarrow> \<exists>m. P (l - m) \<and> (\<forall>i<m. \<not> P (l - i))
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>P (l - m); m \<le> l; n = l - m\<rbrakk> \<Longrightarrow> \<exists>m. P (l - m) \<and> (\<forall>i<m. \<not> P (l - i))
[PROOF STEP]
apply(erule Ex_first_occurrence)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_mult' [continuous_intros]:
  fixes f g :: "_ \<Rightarrow> 'b::topological_semigroup_mult"
  shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. f x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. f x * g x)
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F; (g \<longlongrightarrow> g (Lim F (\<lambda>x. x))) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> f (Lim F (\<lambda>x. x)) * g (Lim F (\<lambda>x. x))) F
[PROOF STEP]
by (rule tendsto_mult)


[STATEMENT]
lemma less_power_nat_iff_bitlen:
  "x < 2 ^ w \<longleftrightarrow> bitlen (int x) \<le> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x < 2 ^ w) = (bitlen (int x) \<le> int w)
[PROOF STEP]
using bitlen_le_iff_power[of x w]
[PROOF STATE]
proof (prove)
using this:
(bitlen (int x) \<le> int w) = (0 \<le> int w \<and> int x < 2 ^ nat (int w))

goal (1 subgoal):
 1. (x < 2 ^ w) = (bitlen (int x) \<le> int w)
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_add_distrib_mat[algebra_simps]: assumes m: "A \<in> carrier_mat nr n"
  "B \<in> carrier_mat n nc" "C \<in> carrier_mat n nc"
  shows "A * (B + C) = A * B + A * C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * (B + C) = A * B + A * C
[PROOF STEP]
using m
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr n
B \<in> carrier_mat n nc
C \<in> carrier_mat n nc

goal (1 subgoal):
 1. A * (B + C) = A * B + A * C
[PROOF STEP]
by (intro eq_matI, auto simp: scalar_prod_add_distrib[of _ n])


[STATEMENT]
lemma (in Group) cmp_rfn3:"\<lbrakk>0 < r; 0 < s; compseries G r f; compseries G s g\<rbrakk>
 \<Longrightarrow> cmp_rfn G r f s g 0 = carrier G \<and> cmp_rfn G r f s g (s * r) = {\<one>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; compseries G r f; compseries G s g\<rbrakk> \<Longrightarrow> cmp_rfn G r f s g 0 = carrier G \<and> cmp_rfn G r f s g (s * r) = {\<one>}
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < r; 0 < s; compseries G r f; compseries G s g\<rbrakk> \<Longrightarrow> cmp_rfn G r f s g 0 = carrier G
 2. \<lbrakk>0 < r; 0 < s; compseries G r f; compseries G s g\<rbrakk> \<Longrightarrow> cmp_rfn G r f s g (s * r) = {\<one>}
[PROOF STEP]
apply (simp add:cmp_rfn_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < r; 0 < s; compseries G r f; compseries G s g\<rbrakk> \<Longrightarrow> f (Suc 0) \<diamondop> f 0 \<inter> g 0 = carrier G
 2. \<lbrakk>0 < r; 0 < s; compseries G r f; compseries G s g\<rbrakk> \<Longrightarrow> cmp_rfn G r f s g (s * r) = {\<one>}
[PROOF STEP]
apply (rule cmp_rfn1 [of "r" "s" "f" "g"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; compseries G r f; compseries G s g\<rbrakk> \<Longrightarrow> cmp_rfn G r f s g (s * r) = {\<one>}
[PROOF STEP]
apply (simp add:cmp_rfn_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma group_type_contained_count: "(g, a) \<in> group_type \<Longrightarrow> card {G \<in> \<G> . card G = g} = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g, a) \<in> group_type \<Longrightarrow> card {G \<in> \<G>. card G = g} = a
[PROOF STEP]
unfolding group_type_def groups_of_size_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g, a) \<in> {(g, card {G \<in> \<G>. card G = g}) |g. g \<in> group_sizes} \<Longrightarrow> card {G \<in> \<G>. card G = g} = a
[PROOF STEP]
by simp


[STATEMENT]
lemma indexed_const_mult:
  assumes "a \<in> carrier R"
  assumes "b \<in> carrier R"
  shows "indexed_const a \<otimes>\<^bsub> Pring R I\<^esub> indexed_const b  = indexed_const (a \<otimes>  b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indexed_const a \<otimes>\<^bsub>Pring R I\<^esub> indexed_const b = indexed_const (a \<otimes> b)
[PROOF STEP]
by (metis Pring_mult assms(1) assms(2) indexed_const_P_mult_eq)


[STATEMENT]
lemma Left_Coset_eq_sumset_stabilizer:
  assumes "x \<in> G"
  shows "sumset {x} (stabilizer B) = x \<cdot>| (stabilizer B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset {x} (stabilizer B) = x \<cdot>| stabilizer B
[PROOF STEP]
by (simp add: Left_Coset_eq_sumset assms)


[STATEMENT]
lemma bezout_matrix_JNF_mult_eq2:
  assumes A: "A \<in> carrier_mat m n" and a: "a<m"  and b: "b<m" and ab: "a \<noteq> b"
  assumes pquvd: "(p,q,u,v,d) = euclid_ext2 (A$$(a,j)) (A$$(b,j))"
  shows "Matrix.mat (dim_row A) (dim_col A)
          (\<lambda>(i,k). if i = a then (p*A$$(a,k) + q*A$$(b,k))
                   else if i = b then u * A$$(a,k) + v * A$$(b,k)
                   else A$$(i,k)
            ) = (bezout_matrix_JNF A a b j euclid_ext2) * A" (is "?A = ?BM * A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = bezout_matrix_JNF A a b j euclid_ext2 * A
[PROOF STEP]
proof (rule bezout_matrix_JNF_mult_eq'[OF A a b ab _ _ pquvd])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = A @\<^sub>r ?B
 2. ?B \<in> carrier_mat ?t n
[PROOF STEP]
show "A = A @\<^sub>r (0\<^sub>m 0 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = A @\<^sub>r 0\<^sub>m 0 n
[PROOF STEP]
by (rule eq_matI, unfold append_rows_def, auto)
[PROOF STATE]
proof (state)
this:
A = A @\<^sub>r 0\<^sub>m 0 n

goal (1 subgoal):
 1. 0\<^sub>m 0 n \<in> carrier_mat ?t n
[PROOF STEP]
show "(0\<^sub>m 0 n) \<in> carrier_mat 0 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>m 0 n \<in> carrier_mat 0 n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0\<^sub>m 0 n \<in> carrier_mat 0 n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_discrete_range_constant:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_algebra_1"
  assumes S: "connected S"
      and "continuous_on S f"
      and "\<And>x. x \<in> S \<Longrightarrow> \<exists>e>0. \<forall>y. y \<in> S \<and> f y \<noteq> f x \<longrightarrow> e \<le> norm (f y - f x)"
    shows "f constant_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f constant_on S
[PROOF STEP]
using continuous_discrete_range_constant_eq [THEN iffD1, OF S] assms
[PROOF STATE]
proof (prove)
using this:
\<forall>f. continuous_on S f \<and> (\<forall>x\<in>S. \<exists>e>0. \<forall>y. y \<in> S \<and> f y \<noteq> f x \<longrightarrow> e \<le> norm (f y - f x)) \<longrightarrow> f constant_on S
connected S
continuous_on S f
?x \<in> S \<Longrightarrow> \<exists>e>0. \<forall>y. y \<in> S \<and> f y \<noteq> f ?x \<longrightarrow> e \<le> norm (f y - f ?x)

goal (1 subgoal):
 1. f constant_on S
[PROOF STEP]
by blast


[STATEMENT]
theorem hyp2_axiom8: "\<exists> a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b
[PROOF STEP]
let ?ca = "0 :: real^2"
    and ?cb = "vector [1/2,0] :: real^2"
    and ?cc = "vector [0,1/2] :: real^2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b
[PROOF STEP]
let ?a = "hyp2_abs ?ca"
    and ?b = "hyp2_abs ?cb"
    and ?c = "hyp2_abs ?cc"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b
[PROOF STEP]
from hyp2_rep_abs_examples and non_Col_example
[PROOF STATE]
proof (chain)
picking this:
hyp2_rep (hyp2_abs 0) = 0
hyp2_rep (hyp2_abs (vector [1 / 2, 0])) = vector [1 / 2, 0]
hyp2_rep (hyp2_abs (vector [0, 1 / 2])) = vector [0, 1 / 2]
hyp2_rep (hyp2_abs (vector [1 / 4, 1 / 4])) = vector [1 / 4, 1 / 4]
hyp2_rep (hyp2_abs (vector [1 / 2, 1 / 2])) = vector [1 / 2, 1 / 2]
\<not> real_euclid.Col 0 (vector [1 / 2, 0]) (vector [0, 1 / 2])
[PROOF STEP]
have "\<not> (hyp2.Col ?a ?b ?c)"
[PROOF STATE]
proof (prove)
using this:
hyp2_rep (hyp2_abs 0) = 0
hyp2_rep (hyp2_abs (vector [1 / 2, 0])) = vector [1 / 2, 0]
hyp2_rep (hyp2_abs (vector [0, 1 / 2])) = vector [0, 1 / 2]
hyp2_rep (hyp2_abs (vector [1 / 4, 1 / 4])) = vector [1 / 4, 1 / 4]
hyp2_rep (hyp2_abs (vector [1 / 2, 1 / 2])) = vector [1 / 2, 1 / 2]
\<not> real_euclid.Col 0 (vector [1 / 2, 0]) (vector [0, 1 / 2])

goal (1 subgoal):
 1. \<not> hyp2.Col (hyp2_abs 0) (hyp2_abs (vector [1 / 2, 0])) (hyp2_abs (vector [0, 1 / 2]))
[PROOF STEP]
by (unfold hyp2.Col_def real_euclid.Col_def real_hyp2_B_def) simp
[PROOF STATE]
proof (state)
this:
\<not> hyp2.Col (hyp2_abs 0) (hyp2_abs (vector [1 / 2, 0])) (hyp2_abs (vector [0, 1 / 2]))

goal (1 subgoal):
 1. \<exists>a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b
[PROOF STEP]
thus "\<exists> a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b"
[PROOF STATE]
proof (prove)
using this:
\<not> hyp2.Col (hyp2_abs 0) (hyp2_abs (vector [1 / 2, 0])) (hyp2_abs (vector [0, 1 / 2]))

goal (1 subgoal):
 1. \<exists>a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b
[PROOF STEP]
unfolding hyp2.Col_def
[PROOF STATE]
proof (prove)
using this:
\<not> (B\<^sub>K hyp2_abs 0 hyp2_abs (vector [1 / 2, 0]) hyp2_abs (vector [0, 1 / 2]) \<or> B\<^sub>K hyp2_abs (vector [1 / 2, 0]) hyp2_abs (vector [0, 1 / 2]) hyp2_abs 0 \<or> B\<^sub>K hyp2_abs (vector [0, 1 / 2]) hyp2_abs 0 hyp2_abs (vector [1 / 2, 0]))

goal (1 subgoal):
 1. \<exists>a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b
[PROOF STEP]
by simp (rule exI)+
[PROOF STATE]
proof (state)
this:
\<exists>a b c. \<not> B\<^sub>K a b c \<and> \<not> B\<^sub>K b c a \<and> \<not> B\<^sub>K c a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_nhds_metric_le: "F \<le> nhds a \<longleftrightarrow> (\<forall>e>0. eventually (\<lambda>x. dist x a \<le> e) F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<le> nhds a) = (\<forall>e>0. \<forall>\<^sub>F x in F. dist x a \<le> e)
[PROOF STEP]
unfolding le_filter_def eventually_nhds_metric_le
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>P. (\<exists>d>0. \<forall>x. dist x a \<le> d \<longrightarrow> P x) \<longrightarrow> eventually P F) = (\<forall>e>0. \<forall>\<^sub>F x in F. dist x a \<le> e)
[PROOF STEP]
by (fast elim: eventually_mono)


[STATEMENT]
lemma map_SSup_func2:
  fixes F :: "'c::complete_lattice downset \<Rightarrow> 'b::complete_lattice downset"
  and G :: "'a::complete_lattice downset \<Rightarrow> 'c downset"
  shows "map_SSup (F \<circ> G) = map_SSup F \<circ> map_SSup G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_SSup (F \<circ> G) = map_SSup F \<circ> map_SSup G
[PROOF STEP]
unfolding map_SSup_def fun_eq_iff comp_def id_def ds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. SSup (F (G (Abs_downset (\<down> x)))) = SSup (F (Abs_downset (\<down> (SSup (G (Abs_downset (\<down> x)))))))
[PROOF STEP]
by (metis comp_apply ds_SSup_inv ds_def id_apply)


[STATEMENT]
lemma i_cut_Un_disj: "
  \<lbrakk> cut_op = (\<down><) \<or> cut_op = (\<down>\<le>) \<or>
    cut_op = (\<down>>) \<or> cut_op = (\<down>\<ge>) \<rbrakk>
  \<Longrightarrow> cut_op (A \<union> B) t = cut_op A t \<union> cut_op B t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cut_op = (\<down><) \<or> cut_op = (\<down>\<le>) \<or> cut_op = (\<down>>) \<or> cut_op = (\<down>\<ge>) \<Longrightarrow> cut_op (A \<union> B) t = cut_op A t \<union> cut_op B t
[PROOF STEP]
apply (drule i_cut_set_restriction_disj[where f="\<lambda>I. cut_op I t"], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_restriction (\<lambda>I. cut_op I t) \<Longrightarrow> cut_op (A \<union> B) t = cut_op A t \<union> cut_op B t
[PROOF STEP]
by (rule set_restriction_Un)


[STATEMENT]
lemma has_prod_If_finite_set:
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
  shows "finite A \<Longrightarrow> (\<lambda>r. if r \<in> A then f r else 1) has_prod (\<Prod>r\<in>A. f r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> (\<lambda>r. if r \<in> A then f r else (1::'a)) has_prod prod f A
[PROOF STEP]
using has_prod_finite[of A "(\<lambda>r. if r \<in> A then f r else 1)"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite A; \<And>n. n \<notin> A \<Longrightarrow> (if n \<in> A then f n else (1::'a)) = (1::'a)\<rbrakk> \<Longrightarrow> (\<lambda>r. if r \<in> A then f r else (1::'a)) has_prod (\<Prod>n\<in>A. if n \<in> A then f n else (1::'a))

goal (1 subgoal):
 1. finite A \<Longrightarrow> (\<lambda>r. if r \<in> A then f r else (1::'a)) has_prod prod f A
[PROOF STEP]
by simp


[STATEMENT]
lemma nl42: assumes "(l'::real) \<ge> 1" "r' \<ge> 1" "ll \<ge> 1" "r \<ge> 1"
shows "4 * (l' + r') * (l' + ll) * (r' + r) \<le> (l' + ll + r' + r)^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * (l' + r') * (l' + ll) * (r' + r) \<le> (l' + ll + r' + r) ^ 3
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 4 * (l' + r') * (l' + ll) * (r' + r) \<le> (l' + ll + r' + r) ^ 3
[PROOF STEP]
have 1: "l' + r' \<le> l' + ll + r' + r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l' + r' \<le> l' + ll + r' + r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> l'
1 \<le> r'
1 \<le> ll
1 \<le> r

goal (1 subgoal):
 1. l' + r' \<le> l' + ll + r' + r
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
l' + r' \<le> l' + ll + r' + r

goal (1 subgoal):
 1. 4 * (l' + r') * (l' + ll) * (r' + r) \<le> (l' + ll + r' + r) ^ 3
[PROOF STEP]
have 2: "0 \<le> (l' + ll + r' + r)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (l' + ll + r' + r)\<^sup>2
[PROOF STEP]
by (rule zero_le_power2)
[PROOF STATE]
proof (state)
this:
0 \<le> (l' + ll + r' + r)\<^sup>2

goal (1 subgoal):
 1. 4 * (l' + r') * (l' + ll) * (r' + r) \<le> (l' + ll + r' + r) ^ 3
[PROOF STEP]
have 3: "0 \<le> l' + r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> l' + r'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> l'
1 \<le> r'
1 \<le> ll
1 \<le> r

goal (1 subgoal):
 1. 0 \<le> l' + r'
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
0 \<le> l' + r'

goal (1 subgoal):
 1. 4 * (l' + r') * (l' + ll) * (r' + r) \<le> (l' + ll + r' + r) ^ 3
[PROOF STEP]
from mult_mono[OF nl41[OF assms] 1 2 3]
[PROOF STATE]
proof (chain)
picking this:
4 * (l' + ll) * (r' + r) * (l' + r') \<le> (l' + ll + r' + r)\<^sup>2 * (l' + ll + r' + r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
4 * (l' + ll) * (r' + r) * (l' + r') \<le> (l' + ll + r' + r)\<^sup>2 * (l' + ll + r' + r)

goal (1 subgoal):
 1. 4 * (l' + r') * (l' + ll) * (r' + r) \<le> (l' + ll + r' + r) ^ 3
[PROOF STEP]
by(simp add: ac_simps numeral_eq_Suc del: distrib_right_numeral)
[PROOF STATE]
proof (state)
this:
4 * (l' + r') * (l' + ll) * (r' + r) \<le> (l' + ll + r' + r) ^ 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_gbinomial: "of_nat (n choose k) = (of_nat n gchoose k :: 'a::field_char_0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (n choose k) = of_nat n gchoose k
[PROOF STEP]
by (simp add: gbinomial_binomial [symmetric] of_nat_gbinomial)


[STATEMENT]
lemma disjointE:
  assumes "disjoint Ss"
  assumes "A \<in> Ss"
  assumes "B \<in> Ss"
  assumes "A \<noteq>B"
  shows "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
by (meson assms(1) assms(2) assms(3) assms(4) disjoint_def)


[STATEMENT]
lemma wqo_wf_and_no_antichain_conv:
  assumes "qo_on P A"
  shows "wqo_on P A \<longleftrightarrow> wfp_on (strict P) A \<and> \<not> (\<exists>f. antichain_on P f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wqo_on P A = (wfp_on (strict P) A \<and> (\<nexists>f. antichain_on P f A))
[PROOF STEP]
unfolding wqo_af_conv [OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_full_on P A = (wfp_on (strict P) A \<and> (\<nexists>f. antichain_on P f A))
[PROOF STEP]
using af_trans_imp_wf [OF _ assms [THEN qo_on_imp_transp_on]]
    and almost_full_on_imp_no_antichain_on [of P A]
    and wf_and_no_antichain_imp_qo_extension_wf [of P A]
    and every_qo_extension_wf_imp_af [OF _ assms]
[PROOF STATE]
proof (prove)
using this:
almost_full_on P A \<Longrightarrow> wfp_on (strict P) A
almost_full_on P A \<Longrightarrow> \<not> antichain_on P ?f A
\<lbrakk>wfp_on (strict P) A; \<nexists>f. antichain_on P f A; \<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> ?Q x y; qo_on ?Q A\<rbrakk> \<Longrightarrow> wfp_on (strict ?Q) A
\<forall>Q. (\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q x y) \<and> qo_on Q A \<longrightarrow> wfp_on (strict Q) A \<Longrightarrow> almost_full_on P A

goal (1 subgoal):
 1. almost_full_on P A = (wfp_on (strict P) A \<and> (\<nexists>f. antichain_on P f A))
[PROOF STEP]
by blast


[STATEMENT]
lemma measure_lub_spmf:
  assumes Y: "Y \<noteq> {}"
  shows "measure (measure_spmf lub_spmf) A = (SUP y\<in>Y. measure (measure_spmf y) A)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf local.lub_spmf) A = (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf local.lub_spmf) A = (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
have "ennreal ?lhs = ennreal ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure (measure_spmf local.lub_spmf) A) = ennreal (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
using emeasure_lub_spmf[OF assms] SUP_emeasure_spmf_neq_top[of A Y] Y
[PROOF STATE]
proof (prove)
using this:
emeasure (measure_spmf local.lub_spmf) ?A = (\<Squnion>y\<in>Y. emeasure (measure_spmf y) ?A)
(\<Squnion>p\<in>Y. emeasure (measure_spmf p) A) \<noteq> \<top>
Y \<noteq> {}

goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure (measure_spmf local.lub_spmf) A) = ennreal (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
unfolding measure_spmf.emeasure_eq_measure
[PROOF STATE]
proof (prove)
using this:
ennreal (Sigma_Algebra.measure (measure_spmf local.lub_spmf) ?A) = (\<Squnion>y\<in>Y. ennreal (Sigma_Algebra.measure (measure_spmf y) ?A))
(\<Squnion>p\<in>Y. ennreal (Sigma_Algebra.measure (measure_spmf p) A)) \<noteq> \<top>
Y \<noteq> {}

goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure (measure_spmf local.lub_spmf) A) = ennreal (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
by(subst ennreal_SUP)
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure (measure_spmf local.lub_spmf) A) = ennreal (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf local.lub_spmf) A = (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure (measure_spmf local.lub_spmf) A) = ennreal (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf local.lub_spmf) A = (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
have "0 \<le> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
using Y
[PROOF STATE]
proof (prove)
using this:
Y \<noteq> {}

goal (1 subgoal):
 1. 0 \<le> (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
by(auto intro!: cSUP_upper2 bdd_aboveI[where M=1] measure_spmf.subprob_measure_le_1)
[PROOF STATE]
proof (state)
this:
0 \<le> (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf local.lub_spmf) A = (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ennreal (Sigma_Algebra.measure (measure_spmf local.lub_spmf) A) = ennreal (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
0 \<le> (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (Sigma_Algebra.measure (measure_spmf local.lub_spmf) A) = ennreal (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
0 \<le> (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf local.lub_spmf) A = (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure (measure_spmf local.lub_spmf) A = (\<Squnion>y\<in>Y. Sigma_Algebra.measure (measure_spmf y) A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Weierstrass_l2_trig_polynomial:
  assumes f: "f square_integrable {-pi..pi}" and "0 < e"
  obtains n a b where
   "l2norm {-pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin(real k * x) + b k * cos(real k * x))) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b n. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a b n. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?\<phi> = "\<lambda>n a b x. \<Sum>k\<le>n. a k * sin(real k * x) + b k * cos(real k * x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a b n. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain g where contg: "continuous_on {-pi..pi} g" and geq: "g(-pi) = g pi"
           and g: "g square_integrable {-pi..pi}" and norm_fg: "l2norm {-pi..pi} (\<lambda>x. f x - g x) < e/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_on {- pi..pi} g; g (- pi) = g pi; g square_integrable {- pi..pi}; l2norm {- pi..pi} (\<lambda>x. f x - g x) < e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>e > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_on {- pi..pi} g; g (- pi) = g pi; g square_integrable {- pi..pi}; l2norm {- pi..pi} (\<lambda>x. f x - g x) < e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto intro: square_integrable_approximate_continuous_ends [OF f, of "e/2"])
[PROOF STATE]
proof (state)
this:
continuous_on {- pi..pi} g
g (- pi) = g pi
g square_integrable {- pi..pi}
l2norm {- pi..pi} (\<lambda>x. f x - g x) < e / 2

goal (1 subgoal):
 1. (\<And>a b n. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on {- pi..pi} g
g (- pi) = g pi
g square_integrable {- pi..pi}
l2norm {- pi..pi} (\<lambda>x. f x - g x) < e / 2
[PROOF STEP]
obtain n a b where g_phi_less: "\<And>x. x \<in> {-pi..pi} \<Longrightarrow> \<bar>g x - (?\<phi> n a b x)\<bar> < e/6"
[PROOF STATE]
proof (prove)
using this:
continuous_on {- pi..pi} g
g (- pi) = g pi
g square_integrable {- pi..pi}
l2norm {- pi..pi} (\<lambda>x. f x - g x) < e / 2

goal (1 subgoal):
 1. (\<And>a b n. (\<And>x. x \<in> {- pi..pi} \<Longrightarrow> \<bar>g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))\<bar> < e / 6) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>e > 0\<close> Weierstrass_trig_polynomial [OF contg geq, of "e/6"]
[PROOF STATE]
proof (prove)
using this:
continuous_on {- pi..pi} g
g (- pi) = g pi
g square_integrable {- pi..pi}
l2norm {- pi..pi} (\<lambda>x. f x - g x) < e / 2
0 < e
\<lbrakk>0 < e / 6; \<And>n a b. (\<And>x. x \<in> {- pi..pi} \<Longrightarrow> \<bar>g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))\<bar> < e / 6) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>a b n. (\<And>x. x \<in> {- pi..pi} \<Longrightarrow> \<bar>g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))\<bar> < e / 6) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson zero_less_divide_iff zero_less_numeral)
[PROOF STATE]
proof (state)
this:
?x \<in> {- pi..pi} \<Longrightarrow> \<bar>g ?x - (\<Sum>k\<le>n. a k * sin (real k * ?x) + b k * cos (real k * ?x))\<bar> < e / 6

goal (1 subgoal):
 1. (\<And>a b n. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>?n. ?a k * sin (real k * x) + ?b k * cos (real k * x))) < e
[PROOF STEP]
have si: "(?\<phi> n u v) square_integrable {-pi..pi}" for n::nat and u v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<Sum>k\<le>n. u k * sin (real k * x) + v k * cos (real k * x)) square_integrable {- pi..pi}
[PROOF STEP]
proof (intro square_integrable_sum continuous_imp_square_integrable)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite {..n}
 2. \<And>k. k \<in> {..n} \<Longrightarrow> continuous_on {- pi..pi} (\<lambda>x. u k * sin (real k * x) + v k * cos (real k * x))
 3. {- pi..pi} \<in> sets lebesgue
[PROOF STEP]
show "continuous_on {-pi..pi} (\<lambda>x. u k * sin (real k * x) + v k * cos (real k * x))"
        if "k \<in> {..n}" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {- pi..pi} (\<lambda>x. u k * sin (real k * x) + v k * cos (real k * x))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
k \<in> {..n}

goal (1 subgoal):
 1. continuous_on {- pi..pi} (\<lambda>x. u k * sin (real k * x) + v k * cos (real k * x))
[PROOF STEP]
by (intro continuous_intros)
[PROOF STATE]
proof (state)
this:
?k \<in> {..n} \<Longrightarrow> continuous_on {- pi..pi} (\<lambda>x. u ?k * sin (real ?k * x) + v ?k * cos (real ?k * x))

goal (2 subgoals):
 1. finite {..n}
 2. {- pi..pi} \<in> sets lebesgue
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<Sum>k\<le>?n. ?u k * sin (real k * x) + ?v k * cos (real k * x)) square_integrable {- pi..pi}

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>?n. ?a k * sin (real k * x) + ?b k * cos (real k * x))) < e
[PROOF STEP]
have "l2norm {-pi..pi} (\<lambda>x. f x - (?\<phi> n a b x)) =  l2norm {-pi..pi} (\<lambda>x. (f x - g x) + (g x - (?\<phi> n a b x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) = l2norm {- pi..pi} (\<lambda>x. f x - g x + (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) = l2norm {- pi..pi} (\<lambda>x. f x - g x + (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))))

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>?n. ?a k * sin (real k * x) + ?b k * cos (real k * x))) < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) = l2norm {- pi..pi} (\<lambda>x. f x - g x + (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))))

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>?n. ?a k * sin (real k * x) + ?b k * cos (real k * x))) < e
[PROOF STEP]
have "\<dots> \<le> l2norm {-pi..pi} (\<lambda>x. f x - g x) + l2norm {-pi..pi} (\<lambda>x. g x - (?\<phi> n a b x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - g x + (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))) \<le> l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))
[PROOF STEP]
proof (rule l2norm_triangle)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. f x - g x) square_integrable {- pi..pi}
 2. (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}
[PROOF STEP]
show "(\<lambda>x. f x - g x) square_integrable {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x - g x) square_integrable {- pi..pi}
[PROOF STEP]
using f g square_integrable_diff
[PROOF STATE]
proof (prove)
using this:
f square_integrable {- pi..pi}
g square_integrable {- pi..pi}
\<lbrakk>?f square_integrable ?S; ?g square_integrable ?S\<rbrakk> \<Longrightarrow> (\<lambda>x. ?f x - ?g x) square_integrable ?S

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

goal (1 subgoal):
 1. (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}
[PROOF STEP]
show "(\<lambda>x. g x - (?\<phi> n a b x)) square_integrable {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}
[PROOF STEP]
using g si square_integrable_diff
[PROOF STATE]
proof (prove)
using this:
g square_integrable {- pi..pi}
(\<lambda>x. \<Sum>k\<le>?n. ?u k * sin (real k * x) + ?v k * cos (real k * x)) square_integrable {- pi..pi}
\<lbrakk>?f square_integrable ?S; ?g square_integrable ?S\<rbrakk> \<Longrightarrow> (\<lambda>x. ?f x - ?g x) square_integrable ?S

goal (1 subgoal):
 1. (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l2norm {- pi..pi} (\<lambda>x. f x - g x + (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))) \<le> l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>?n. ?a k * sin (real k * x) + ?b k * cos (real k * x))) < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
l2norm {- pi..pi} (\<lambda>x. f x - g x + (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))) \<le> l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>?n. ?a k * sin (real k * x) + ?b k * cos (real k * x))) < e
[PROOF STEP]
have "\<dots> < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e
[PROOF STEP]
have g_phi: "(\<lambda>x. g x - (?\<phi> n a b x)) square_integrable {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}
[PROOF STEP]
using g si square_integrable_diff
[PROOF STATE]
proof (prove)
using this:
g square_integrable {- pi..pi}
(\<lambda>x. \<Sum>k\<le>?n. ?u k * sin (real k * x) + ?v k * cos (real k * x)) square_integrable {- pi..pi}
\<lbrakk>?f square_integrable ?S; ?g square_integrable ?S\<rbrakk> \<Longrightarrow> (\<lambda>x. ?f x - ?g x) square_integrable ?S

goal (1 subgoal):
 1. (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e
[PROOF STEP]
have "l2norm {-pi..pi} (\<lambda>x. g x - (?\<phi> n a b x)) \<le> e/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) \<le> e / 2
[PROOF STEP]
unfolding l2norm_def l2product_def power2_eq_square [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2) \<le> e / 2
[PROOF STEP]
proof (rule real_le_lsqrt)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 \<le> LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2
 2. 0 \<le> e / 2
 3. LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
show "0 \<le> LINT x|lebesgue_on {-pi..pi}. (g x - (?\<phi> n a b x))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2
[PROOF STEP]
by (rule integral_nonneg_AE) auto
[PROOF STATE]
proof (state)
this:
0 \<le> LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2

goal (2 subgoals):
 1. 0 \<le> e / 2
 2. LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
have "LINT x|lebesgue_on {-pi..pi}. (g x - (?\<phi> n a b x))\<^sup>2
            \<le> LINT x|lebesgue_on {-pi..pi}. (e / 6) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> LINT x|lebesgue_on {- pi..pi}. (e / 6)\<^sup>2
[PROOF STEP]
proof (rule integral_mono)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2)
 2. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. (e / 6)\<^sup>2)
 3. \<And>x. x \<in> space (lebesgue_on {- pi..pi}) \<Longrightarrow> (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 6)\<^sup>2
[PROOF STEP]
show "integrable (lebesgue_on {-pi..pi}) (\<lambda>x. (g x - (?\<phi> n a b x))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2)
[PROOF STEP]
using g_phi square_integrable_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) square_integrable {- pi..pi}
?f square_integrable ?S \<equiv> ?S \<in> sets lebesgue \<and> ?f \<in> borel_measurable (lebesgue_on ?S) \<and> integrable (lebesgue_on ?S) (\<lambda>x. (?f x)\<^sup>2)

goal (1 subgoal):
 1. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {- pi..pi}) (\<lambda>x. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2)

goal (2 subgoals):
 1. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. (e / 6)\<^sup>2)
 2. \<And>x. x \<in> space (lebesgue_on {- pi..pi}) \<Longrightarrow> (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 6)\<^sup>2
[PROOF STEP]
show "integrable (lebesgue_on {-pi..pi}) (\<lambda>x. (e / 6)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. (e / 6)\<^sup>2)
[PROOF STEP]
by (intro continuous_intros continuous_imp_integrable_real)
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {- pi..pi}) (\<lambda>x. (e / 6)\<^sup>2)

goal (1 subgoal):
 1. \<And>x. x \<in> space (lebesgue_on {- pi..pi}) \<Longrightarrow> (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 6)\<^sup>2
[PROOF STEP]
show "(g x - (?\<phi> n a b x))\<^sup>2 \<le> (e / 6)\<^sup>2" if "x \<in> space (lebesgue_on {-pi..pi})" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 6)\<^sup>2
[PROOF STEP]
using \<open>e > 0\<close> g_phi_less that
[PROOF STATE]
proof (prove)
using this:
0 < e
?x \<in> {- pi..pi} \<Longrightarrow> \<bar>g ?x - (\<Sum>k\<le>n. a k * sin (real k * ?x) + b k * cos (real k * ?x))\<bar> < e / 6
x \<in> space (lebesgue_on {- pi..pi})

goal (1 subgoal):
 1. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 6)\<^sup>2
[PROOF STEP]
apply (simp add: abs_le_square_iff [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < e; \<And>x. - pi \<le> x \<and> x \<le> pi \<Longrightarrow> \<bar>g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))\<bar> * 6 < e; - pi \<le> x \<and> x \<le> pi\<rbrakk> \<Longrightarrow> \<bar>g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))\<bar> * 6 \<le> e
[PROOF STEP]
using less_eq_real_def
[PROOF STATE]
proof (prove)
using this:
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

goal (1 subgoal):
 1. \<lbrakk>0 < e; \<And>x. - pi \<le> x \<and> x \<le> pi \<Longrightarrow> \<bar>g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))\<bar> * 6 < e; - pi \<le> x \<and> x \<le> pi\<rbrakk> \<Longrightarrow> \<bar>g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))\<bar> * 6 \<le> e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> space (lebesgue_on {- pi..pi}) \<Longrightarrow> (g ?x - (\<Sum>k\<le>n. a k * sin (real k * ?x) + b k * cos (real k * ?x)))\<^sup>2 \<le> (e / 6)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> LINT x|lebesgue_on {- pi..pi}. (e / 6)\<^sup>2

goal (2 subgoals):
 1. 0 \<le> e / 2
 2. LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> LINT x|lebesgue_on {- pi..pi}. (e / 6)\<^sup>2

goal (2 subgoals):
 1. 0 \<le> e / 2
 2. LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
have "\<dots> \<le> (e / 2)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|lebesgue_on {- pi..pi}. (e / 6)\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
using \<open>e > 0\<close> pi_less_4
[PROOF STATE]
proof (prove)
using this:
0 < e
pi < 4

goal (1 subgoal):
 1. LINT x|lebesgue_on {- pi..pi}. (e / 6)\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
by (auto simp: power2_eq_square measure_restrict_space)
[PROOF STATE]
proof (state)
this:
LINT x|lebesgue_on {- pi..pi}. (e / 6)\<^sup>2 \<le> (e / 2)\<^sup>2

goal (2 subgoals):
 1. 0 \<le> e / 2
 2. LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
show "LINT x|lebesgue_on {-pi..pi}. (g x - (?\<phi> n a b x))\<^sup>2 \<le> (e / 2)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2

goal (1 subgoal):
 1. LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
LINT x|lebesgue_on {- pi..pi}. (g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x)))\<^sup>2 \<le> (e / 2)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> e / 2
[PROOF STEP]
qed (use \<open>e > 0\<close> in auto)
[PROOF STATE]
proof (state)
this:
l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) \<le> e / 2

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e
[PROOF STEP]
with norm_fg
[PROOF STATE]
proof (chain)
picking this:
l2norm {- pi..pi} (\<lambda>x. f x - g x) < e / 2
l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) \<le> e / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
l2norm {- pi..pi} (\<lambda>x. f x - g x) < e / 2
l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) \<le> e / 2

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l2norm {- pi..pi} (\<lambda>x. f x - g x) + l2norm {- pi..pi} (\<lambda>x. g x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>?n. ?a k * sin (real k * x) + ?b k * cos (real k * x))) < e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e
[PROOF STEP]
show "l2norm {-pi..pi} (\<lambda>x. f x - (?\<phi> n a b x)) < e"
[PROOF STATE]
proof (prove)
using this:
l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e

goal (1 subgoal):
 1. l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
l2norm {- pi..pi} (\<lambda>x. f x - (\<Sum>k\<le>n. a k * sin (real k * x) + b k * cos (real k * x))) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed