[STATEMENT]
lemma totient_gcd_lcm: "totient (gcd a b) * totient (lcm a b) = totient a * totient b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
proof (cases "a = 0 \<or> b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (a = 0 \<or> b = 0)

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
let ?P = "prime_factors :: nat \<Rightarrow> nat set" and ?f = "\<lambda>p::nat. 1 - 1 / real p"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
have "real (totient (gcd a b) * totient (lcm a b)) = real (gcd a b * lcm a b) *
          (prod ?f (?P a \<inter> ?P b) * prod ?f (?P a \<union> ?P b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient (gcd a b) * totient (lcm a b)) = real (gcd a b * lcm a b) * ((\<Prod>p\<in>prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors a \<union> prime_factors b. 1 - 1 / real p))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> (a = 0 \<or> b = 0)

goal (1 subgoal):
 1. real (totient (gcd a b) * totient (lcm a b)) = real (gcd a b * lcm a b) * ((\<Prod>p\<in>prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors a \<union> prime_factors b. 1 - 1 / real p))
[PROOF STEP]
unfolding of_nat_mult
[PROOF STATE]
proof (prove)
using this:
\<not> (a = 0 \<or> b = 0)

goal (1 subgoal):
 1. real (totient (gcd a b)) * real (totient (lcm a b)) = real (gcd a b) * real (lcm a b) * ((\<Prod>p\<in>prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors a \<union> prime_factors b. 1 - 1 / real p))
[PROOF STEP]
by (simp add: totient_formula2 prime_factorization_gcd prime_factorization_lcm)
[PROOF STATE]
proof (state)
this:
real (totient (gcd a b) * totient (lcm a b)) = real (gcd a b * lcm a b) * ((\<Prod>p\<in>prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors a \<union> prime_factors b. 1 - 1 / real p))

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (totient (gcd a b) * totient (lcm a b)) = real (gcd a b * lcm a b) * ((\<Prod>p\<in>prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors a \<union> prime_factors b. 1 - 1 / real p))

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
have "gcd a b * lcm a b = a * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a b * lcm a b = a * b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd a b * lcm a b = a * b

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd a b * lcm a b = a * b

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
have "?P a \<union> ?P b = (?P a - ?P a \<inter> ?P b) \<union> ?P b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors a \<union> prime_factors b = prime_factors a - prime_factors a \<inter> prime_factors b \<union> prime_factors b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prime_factors a \<union> prime_factors b = prime_factors a - prime_factors a \<inter> prime_factors b \<union> prime_factors b

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factors a \<union> prime_factors b = prime_factors a - prime_factors a \<inter> prime_factors b \<union> prime_factors b

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
have "prod ?f \<dots> = prod ?f (?P a - ?P a \<inter> ?P b) * prod ?f (?P b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b \<union> prime_factors b. 1 - 1 / real p) = (\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)
[PROOF STEP]
by (rule prod.union_disjoint) blast+
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b \<union> prime_factors b. 1 - 1 / real p) = (\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b \<union> prime_factors b. 1 - 1 / real p) = (\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
have "prod ?f (?P a \<inter> ?P b) * \<dots> =
               prod ?f (?P a \<inter> ?P b \<union> (?P a - ?P a \<inter> ?P b)) * prod ?f (?P b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * ((\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)) = (\<Prod>p\<in>prime_factors a \<inter> prime_factors b \<union> (prime_factors a - prime_factors a \<inter> prime_factors b). 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)
[PROOF STEP]
by (subst prod.union_disjoint) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * ((\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)) = (\<Prod>p\<in>prime_factors a \<inter> prime_factors b \<union> (prime_factors a - prime_factors a \<inter> prime_factors b). 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * ((\<Prod>p\<in>prime_factors a - prime_factors a \<inter> prime_factors b. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)) = (\<Prod>p\<in>prime_factors a \<inter> prime_factors b \<union> (prime_factors a - prime_factors a \<inter> prime_factors b). 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
have "?P a \<inter> ?P b \<union> (?P a - ?P a \<inter> ?P b) = ?P a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors a \<inter> prime_factors b \<union> (prime_factors a - prime_factors a \<inter> prime_factors b) = prime_factors a
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prime_factors a \<inter> prime_factors b \<union> (prime_factors a - prime_factors a \<inter> prime_factors b) = prime_factors a

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factors a \<inter> prime_factors b \<union> (prime_factors a - prime_factors a \<inter> prime_factors b) = prime_factors a

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
have "real (a * b) * (prod ?f (?P a) * prod ?f (?P b)) = real (totient a * totient b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (a * b) * ((\<Prod>p\<in>prime_factors a. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)) = real (totient a * totient b)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> (a = 0 \<or> b = 0)

goal (1 subgoal):
 1. real (a * b) * ((\<Prod>p\<in>prime_factors a. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)) = real (totient a * totient b)
[PROOF STEP]
by (simp add: totient_formula2)
[PROOF STATE]
proof (state)
this:
real (a * b) * ((\<Prod>p\<in>prime_factors a. 1 - 1 / real p) * (\<Prod>p\<in>prime_factors b. 1 - 1 / real p)) = real (totient a * totient b)

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (totient (gcd a b) * totient (lcm a b)) = real (totient a * totient b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (totient (gcd a b) * totient (lcm a b)) = real (totient a * totient b)

goal (1 subgoal):
 1. totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
by (simp only: of_nat_eq_iff)
[PROOF STATE]
proof (state)
this:
totient (gcd a b) * totient (lcm a b) = totient a * totient b

goal (1 subgoal):
 1. a = 0 \<or> b = 0 \<Longrightarrow> totient (gcd a b) * totient (lcm a b) = totient a * totient b
[PROOF STEP]
qed auto


[STATEMENT]
lemma "\<forall>x::'a::linordered_field. \<exists>y::'a::linordered_field. 4 * x + 3 * y \<le> 0 \<and> 4 * x + 3 * y \<ge> -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<exists>y. (4::'a) * x + (3::'a) * y \<le> (0::'a) \<and> - (1::'a) \<le> (4::'a) * x + (3::'a) * y
[PROOF STEP]
by ferrack


[STATEMENT]
lemma setsum_cut_off_le:
  fixes f::"nat \<Rightarrow> nat"
  assumes h1: "m \<le> n"
    and     h2: "\<forall>i \<in> {m..n}. f i = 0"
  shows "(\<Sum>i \<le> n. f i) = (\<Sum>i < m. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..n} = sum f {..<m}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f {..n} = sum f {..<m}
[PROOF STEP]
have eq_zero: "(\<Sum>i \<in> {m..n}. f i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {m..n} = 0
[PROOF STEP]
using h2
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{m..n}. f i = 0

goal (1 subgoal):
 1. sum f {m..n} = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum f {m..n} = 0

goal (1 subgoal):
 1. sum f {..n} = sum f {..<m}
[PROOF STEP]
have "(\<Sum>i \<le> n. f i) = (\<Sum>i \<in> {..<m}. f i) + (\<Sum>i \<in> {m..n}. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..n} = sum f {..<m} + sum f {m..n}
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. sum f {..n} = sum f {..<m} + sum f {m..n}
[PROOF STEP]
by (simp add: setsum_add_nat_ivl2)
[PROOF STATE]
proof (state)
this:
sum f {..n} = sum f {..<m} + sum f {m..n}

goal (1 subgoal):
 1. sum f {..n} = sum f {..<m}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {..n} = sum f {..<m} + sum f {m..n}

goal (1 subgoal):
 1. sum f {..n} = sum f {..<m}
[PROOF STEP]
have "... = (\<Sum>i \<in> {..<m}. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<m} + sum f {m..n} = sum f {..<m}
[PROOF STEP]
using eq_zero
[PROOF STATE]
proof (prove)
using this:
sum f {m..n} = 0

goal (1 subgoal):
 1. sum f {..<m} + sum f {m..n} = sum f {..<m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {..<m} + sum f {m..n} = sum f {..<m}

goal (1 subgoal):
 1. sum f {..n} = sum f {..<m}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f {..n} = sum f {..<m}
[PROOF STEP]
show "(\<Sum>i \<le> n. f i) = (\<Sum>i < m. f i)"
[PROOF STATE]
proof (prove)
using this:
sum f {..n} = sum f {..<m}

goal (1 subgoal):
 1. sum f {..n} = sum f {..<m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {..n} = sum f {..<m}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_div_less:
  assumes p: "(p::'a::field poly) \<noteq> 0" and dvd: "r dvd p" and deg: "degree r \<noteq> 0"
  shows "degree (p div r) < degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p div r) < degree p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (p div r) < degree p
[PROOF STEP]
from dvd
[PROOF STATE]
proof (chain)
picking this:
r dvd p
[PROOF STEP]
obtain q where prq: "p = r * q"
[PROOF STATE]
proof (prove)
using this:
r dvd p

goal (1 subgoal):
 1. (\<And>q. p = r * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. p = r * k

goal (1 subgoal):
 1. (\<And>q. p = r * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = r * q

goal (1 subgoal):
 1. degree (p div r) < degree p
[PROOF STEP]
have "degree p = degree r + degree q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p = degree r + degree q
[PROOF STEP]
unfolding prq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (r * q) = degree r + degree q
[PROOF STEP]
by (rule degree_mult_eq, insert p prq, auto)
[PROOF STATE]
proof (state)
this:
degree p = degree r + degree q

goal (1 subgoal):
 1. degree (p div r) < degree p
[PROOF STEP]
with deg
[PROOF STATE]
proof (chain)
picking this:
degree r \<noteq> 0
degree p = degree r + degree q
[PROOF STEP]
have deg: "degree q < degree p"
[PROOF STATE]
proof (prove)
using this:
degree r \<noteq> 0
degree p = degree r + degree q

goal (1 subgoal):
 1. degree q < degree p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree q < degree p

goal (1 subgoal):
 1. degree (p div r) < degree p
[PROOF STEP]
from prq
[PROOF STATE]
proof (chain)
picking this:
p = r * q
[PROOF STEP]
have "q = p div r"
[PROOF STATE]
proof (prove)
using this:
p = r * q

goal (1 subgoal):
 1. q = p div r
[PROOF STEP]
using deg p
[PROOF STATE]
proof (prove)
using this:
p = r * q
degree q < degree p
p \<noteq> 0

goal (1 subgoal):
 1. q = p div r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q = p div r

goal (1 subgoal):
 1. degree (p div r) < degree p
[PROOF STEP]
with deg
[PROOF STATE]
proof (chain)
picking this:
degree q < degree p
q = p div r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree q < degree p
q = p div r

goal (1 subgoal):
 1. degree (p div r) < degree p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (p div r) < degree p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma col_multrow:  "k \<noteq> i \<Longrightarrow> i < n \<Longrightarrow> col (multrow_mat n k a) i = unit_vec n i"
  "k < n \<Longrightarrow> col (multrow_mat n k a) k = a \<cdot>\<^sub>v unit_vec n k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>k \<noteq> i; i < n\<rbrakk> \<Longrightarrow> col (multrow_mat n k a) i = unit_vec n i) &&& (k < n \<Longrightarrow> col (multrow_mat n k a) k = a \<cdot>\<^sub>v unit_vec n k)
[PROOF STEP]
by (rule eq_vecI, auto)


[STATEMENT]
lemma real_sum:
  "real_of (sum (\<lambda>i. f i) A) = sum (\<lambda>i. real_of (f i)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
[PROOF STEP]
proof (cases "finite A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite A \<Longrightarrow> real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
 2. infinite A \<Longrightarrow> real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite A

goal (2 subgoals):
 1. finite A \<Longrightarrow> real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
 2. infinite A \<Longrightarrow> real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))

goal (1 subgoal):
 1. finite A \<Longrightarrow> real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite A \<Longrightarrow> real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite A

goal (1 subgoal):
 1. finite A \<Longrightarrow> real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))
[PROOF STEP]
by (induct, auto simp add: real_add)
[PROOF STATE]
proof (state)
this:
real_of (sum f A) = (\<Sum>i\<in>A. real_of (f i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sp_append:
  "\<lbrakk> awalk a p b; awalk b q c \<rbrakk> \<Longrightarrow> \<mu> w a c = \<mu> w a b + \<mu> w b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>awalk a p b; awalk b q c\<rbrakk> \<Longrightarrow> \<mu> w a c = \<mu> w a b + \<mu> w b c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>awalk a p b; awalk b q c\<rbrakk> \<Longrightarrow> \<mu> w a c = \<mu> w a b + \<mu> w b c
[PROOF STEP]
assume p: "awalk a p b" and q: "awalk b q c"
[PROOF STATE]
proof (state)
this:
awalk a p b
awalk b q c

goal (1 subgoal):
 1. \<lbrakk>awalk a p b; awalk b q c\<rbrakk> \<Longrightarrow> \<mu> w a c = \<mu> w a b + \<mu> w b c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
awalk a p b
awalk b q c
[PROOF STEP]
have p_q: "awalk a (p@q) c"
[PROOF STATE]
proof (prove)
using this:
awalk a p b
awalk b q c

goal (1 subgoal):
 1. awalk a (p @ q) c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
awalk a (p @ q) c

goal (1 subgoal):
 1. \<lbrakk>awalk a p b; awalk b q c\<rbrakk> \<Longrightarrow> \<mu> w a c = \<mu> w a b + \<mu> w b c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
awalk a (p @ q) c
[PROOF STEP]
have "awalk_cost w (p@q) = awalk_cost w p + awalk_cost w q"
[PROOF STATE]
proof (prove)
using this:
awalk a (p @ q) c

goal (1 subgoal):
 1. awalk_cost w (p @ q) = awalk_cost w p + awalk_cost w q
[PROOF STEP]
using awalk_cost_append
[PROOF STATE]
proof (prove)
using this:
awalk a (p @ q) c
awalk_cost ?f (?xs @ ?ys) = awalk_cost ?f ?xs + awalk_cost ?f ?ys

goal (1 subgoal):
 1. awalk_cost w (p @ q) = awalk_cost w p + awalk_cost w q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
awalk_cost w (p @ q) = awalk_cost w p + awalk_cost w q

goal (1 subgoal):
 1. \<lbrakk>awalk a p b; awalk b q c\<rbrakk> \<Longrightarrow> \<mu> w a c = \<mu> w a b + \<mu> w b c
[PROOF STEP]
with p q p_q
[PROOF STATE]
proof (chain)
picking this:
awalk a p b
awalk b q c
awalk a (p @ q) c
awalk_cost w (p @ q) = awalk_cost w p + awalk_cost w q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
awalk a p b
awalk b q c
awalk a (p @ q) c
awalk_cost w (p @ q) = awalk_cost w p + awalk_cost w q

goal (1 subgoal):
 1. \<mu> w a c = \<mu> w a b + \<mu> w b c
[PROOF STEP]
using sp_eq_awalk_cost
[PROOF STATE]
proof (prove)
using this:
awalk a p b
awalk b q c
awalk a (p @ q) c
awalk_cost w (p @ q) = awalk_cost w p + awalk_cost w q
awalk ?a ?p ?b \<Longrightarrow> ereal (awalk_cost ?w ?p) = \<mu> ?w ?a ?b

goal (1 subgoal):
 1. \<mu> w a c = \<mu> w a b + \<mu> w b c
[PROOF STEP]
by (metis plus_ereal.simps(1))
[PROOF STATE]
proof (state)
this:
\<mu> w a c = \<mu> w a b + \<mu> w b c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_add_ldistrib: "(c::'a::semiring) *s (x + y) = c *s x + c *s y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c *s (x + y) = c *s x + c *s y
[PROOF STEP]
by (vector field_simps)


[STATEMENT]
lemma  density_collapse_carrier:
  assumes "0 < dim_row R"
  and "P \<in> carrier_mat n n"
  and "R \<in> carrier_mat n n"
shows "(density_collapse R P) \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
proof (cases "(Complex_Matrix.trace (R * P)) = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Complex_Matrix.trace (R * P) = 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
 2. Complex_Matrix.trace (R * P) \<noteq> 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (R * P) = 0

goal (2 subgoals):
 1. Complex_Matrix.trace (R * P) = 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
 2. Complex_Matrix.trace (R * P) \<noteq> 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
hence "density_collapse R P = max_mix_density (dim_row R)"
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (R * P) = 0

goal (1 subgoal):
 1. density_collapse R P = max_mix_density (dim_row R)
[PROOF STEP]
unfolding density_collapse_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (R * P) = 0

goal (1 subgoal):
 1. (if Complex_Matrix.trace (R * P) = 0 then max_mix_density (dim_row R) else complex_of_real 1 / Complex_Matrix.trace (R * P) \<cdot>\<^sub>m (P * R * P)) = max_mix_density (dim_row R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
density_collapse R P = max_mix_density (dim_row R)

goal (2 subgoals):
 1. Complex_Matrix.trace (R * P) = 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
 2. Complex_Matrix.trace (R * P) \<noteq> 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
density_collapse R P = max_mix_density (dim_row R)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
density_collapse R P = max_mix_density (dim_row R)

goal (1 subgoal):
 1. density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
using max_mix_is_density assms max_mix_density_carrier
[PROOF STATE]
proof (prove)
using this:
density_collapse R P = max_mix_density (dim_row R)
0 < ?n \<Longrightarrow> density_operator (max_mix_density ?n)
0 < dim_row R
P \<in> carrier_mat n n
R \<in> carrier_mat n n
max_mix_density ?n \<in> carrier_mat ?n ?n

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

goal (1 subgoal):
 1. Complex_Matrix.trace (R * P) \<noteq> 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.trace (R * P) \<noteq> 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (R * P) \<noteq> 0

goal (1 subgoal):
 1. Complex_Matrix.trace (R * P) \<noteq> 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
hence "density_collapse R P = complex_of_real 1 / Complex_Matrix.trace (R * P) \<cdot>\<^sub>m (P * R * P)"
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (R * P) \<noteq> 0

goal (1 subgoal):
 1. density_collapse R P = complex_of_real 1 / Complex_Matrix.trace (R * P) \<cdot>\<^sub>m (P * R * P)
[PROOF STEP]
unfolding density_collapse_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (R * P) \<noteq> 0

goal (1 subgoal):
 1. (if Complex_Matrix.trace (R * P) = 0 then max_mix_density (dim_row R) else complex_of_real 1 / Complex_Matrix.trace (R * P) \<cdot>\<^sub>m (P * R * P)) = complex_of_real 1 / Complex_Matrix.trace (R * P) \<cdot>\<^sub>m (P * R * P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
density_collapse R P = complex_of_real 1 / Complex_Matrix.trace (R * P) \<cdot>\<^sub>m (P * R * P)

goal (1 subgoal):
 1. Complex_Matrix.trace (R * P) \<noteq> 0 \<Longrightarrow> density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
density_collapse R P = complex_of_real 1 / Complex_Matrix.trace (R * P) \<cdot>\<^sub>m (P * R * P)

goal (1 subgoal):
 1. density_collapse R P \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
density_collapse R P = complex_of_real 1 / Complex_Matrix.trace (R * P) \<cdot>\<^sub>m (P * R * P)
0 < dim_row R
P \<in> carrier_mat n n
R \<in> carrier_mat n n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_group_mul_alt:
    "(\<lambda>(x,y). x \<otimes> y) \<in> iso (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
     \<longleftrightarrow> A \<inter> B = {\<one>} \<and> A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>(x, y). x \<otimes> y) \<in> Group.iso (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (A \<inter> B = {\<one>} \<and> A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x))
[PROOF STEP]
by (auto simp: iso_iff_mon_epi mon_group_mul_eq epi_group_mul_eq)


[STATEMENT]
lemma mset_merge [simp]:
  "\<lbrakk> distinct (xs @ ys) \<rbrakk> \<Longrightarrow> mset (merge xs ys) = mset xs + mset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (xs @ ys) \<Longrightarrow> mset (merge xs ys) = mset xs + mset ys
[PROOF STEP]
by (induct xs ys rule: merge.induct) (simp_all add: ac_simps)


[STATEMENT]
lemma gcd_of_int_poly: "gcd (of_int_poly f) (of_int_poly g :: 'a :: {field_char_0,field_gcd} poly) =
  smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (of_int_poly f) (of_int_poly g) = smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd (of_int_poly f) (of_int_poly g) = smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))
[PROOF STEP]
let ?ia = "of_int_poly :: _ \<Rightarrow> 'a poly"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd (of_int_poly f) (of_int_poly g) = smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))
[PROOF STEP]
let ?ir = "of_int_poly :: _ \<Rightarrow> rat poly"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd (of_int_poly f) (of_int_poly g) = smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))
[PROOF STEP]
let ?ra = "map_poly of_rat :: _ \<Rightarrow> 'a poly"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd (of_int_poly f) (of_int_poly g) = smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))
[PROOF STEP]
have id: "?ia x = ?ra (?ir x)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly x = map_poly of_rat (of_int_poly x)
[PROOF STEP]
by (subst map_poly_map_poly, auto)
[PROOF STATE]
proof (state)
this:
of_int_poly ?x = map_poly of_rat (of_int_poly ?x)

goal (1 subgoal):
 1. gcd (of_int_poly f) (of_int_poly g) = smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (of_int_poly f) (of_int_poly g) = smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (map_poly of_rat (of_int_poly f)) (map_poly of_rat (of_int_poly g)) = smult (inverse (of_int (lead_coeff (gcd f g)))) (map_poly of_rat (of_int_poly (gcd f g)))
[PROOF STEP]
unfolding of_rat_hom.map_poly_gcd[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly of_rat (gcd (of_int_poly f) (of_int_poly g)) = smult (inverse (of_int (lead_coeff (gcd f g)))) (map_poly of_rat (of_int_poly (gcd f g)))
[PROOF STEP]
unfolding gcd_rat_to_gcd_int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly of_rat (smult (inverse (rat_of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))) = smult (inverse (of_int (lead_coeff (gcd f g)))) (map_poly of_rat (of_int_poly (gcd f g)))
[PROOF STEP]
by (auto simp: hom_distribs)
[PROOF STATE]
proof (state)
this:
gcd (of_int_poly f) (of_int_poly g) = smult (inverse (of_int (lead_coeff (gcd f g)))) (of_int_poly (gcd f g))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "((x::nat) div y) div z = (x div (y*z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x div y div z = x div (y * z)
[PROOF STEP]
using div_mult2_eq
[PROOF STATE]
proof (prove)
using this:
?m div (?n * ?q) = ?m div ?n div ?q

goal (1 subgoal):
 1. x div y div z = x div (y * z)
[PROOF STEP]
by auto


[STATEMENT]
lemma proper_map_inclusion:
   "s \<subseteq> topspace X
        \<Longrightarrow> proper_map (subtopology X s) X id \<longleftrightarrow> closedin X s \<and> (\<forall>k. compactin X k \<longrightarrow> compactin X (s \<inter> k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<subseteq> topspace X \<Longrightarrow> proper_map (subtopology X s) X id = (closedin X s \<and> (\<forall>k. compactin X k \<longrightarrow> compactin X (s \<inter> k)))
[PROOF STEP]
by (auto simp: proper_map_alt closed_map_inclusion_eq inf.absorb_iff2 Collect_conj_eq compactin_subtopology intro: closed_Int_compactin)


[STATEMENT]
lemma integer_of_nat_1: "integer_of_nat 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integer_of_nat 1 = 1
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma distinct_seteq_set_Cons_in_set':
  "\<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk>
    \<Longrightarrow> \<exists>y ys. x = y#ys \<and> y \<in> xs \<and> ys\<in>{ys. set ys = (xs - {y}) \<and> distinct ys}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys. x = y # ys \<and> y \<in> xs \<and> ys \<in> {ys. set ys = xs - {y} \<and> distinct ys}
[PROOF STEP]
using distinct_seteq_set_Cons''
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Finite_Set.card ?xs = Suc ?n; ?x \<in> {ys. set ys = ?xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys zs. y # ys = ?x \<and> y \<in> ?xs \<and> set ys = zs \<and> Finite_Set.card zs = ?n \<and> distinct ys \<and> finite zs

goal (1 subgoal):
 1. \<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys. x = y # ys \<and> y \<in> xs \<and> ys \<in> {ys. set ys = xs - {y} \<and> distinct ys}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma second_addend: "
  e\<^sub>2 = Double (Add (Var ''x'') (Var ''y'')) \<Longrightarrow>
  eval (\<E>\<^sub>x\<^sub>y x y) e\<^sub>2 = Some (2 * x + 2 * y) \<and>
  wfe \<Gamma>\<^sub>x\<^sub>y e\<^sub>2 \<and>
  coste e\<^sub>2 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e\<^sub>2 = Double (Add (Var ''x'') (Var ''y'')) \<Longrightarrow> eval (\<E>\<^sub>x\<^sub>y x y) e\<^sub>2 = Some (2 * x + 2 * y) \<and> wfe \<Gamma>\<^sub>x\<^sub>y e\<^sub>2 \<and> coste e\<^sub>2 = 2
[PROOF STEP]
by (auto simp: add_opt_def mul_opt_def)
\<comment> \<open>No need to use @{text factorization} explicitly,\<close>
\<comment> \<open>as the default rules that @{text auto} uses to prove it apply here too.\<close>


[STATEMENT]
lemma iT_Plus_inext_nth: "I \<noteq> {} \<Longrightarrow> (I \<oplus> k) \<rightarrow> n = (I \<rightarrow> n) + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> (I \<oplus> k) \<rightarrow> n = (I \<rightarrow> n) + k
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. I \<noteq> {} \<Longrightarrow> (I \<oplus> k) \<rightarrow> 0 = (I \<rightarrow> 0) + k
 2. \<And>n. \<lbrakk>I \<noteq> {} \<Longrightarrow> (I \<oplus> k) \<rightarrow> n = (I \<rightarrow> n) + k; I \<noteq> {}\<rbrakk> \<Longrightarrow> (I \<oplus> k) \<rightarrow> Suc n = (I \<rightarrow> Suc n) + k
[PROOF STEP]
apply (simp add: iT_Plus_Min)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>I \<noteq> {} \<Longrightarrow> (I \<oplus> k) \<rightarrow> n = (I \<rightarrow> n) + k; I \<noteq> {}\<rbrakk> \<Longrightarrow> (I \<oplus> k) \<rightarrow> Suc n = (I \<rightarrow> Suc n) + k
[PROOF STEP]
apply (simp add: iT_Plus_inext)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem fact_asymp_equiv:
  "fact \<sim>[at_top] (\<lambda>n. sqrt (2*pi*n) * (n / exp 1) ^ n :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)
[PROOF STEP]
note fact_asymp_equiv_aux
[PROOF STATE]
proof (state)
this:
fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)
[PROOF STEP]
have "eventually (\<lambda>n. exp c * sqrt (real n) = sqrt (2 * pi * real n)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. exp c * sqrt (real n) = sqrt (2 * pi * real n)
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. exp c * sqrt (real n) = sqrt (2 * pi * real n)
[PROOF STEP]
by eventually_elim (simp add: exp_c real_sqrt_mult)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. exp c * sqrt (real n) = sqrt (2 * pi * real n)

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. exp c * sqrt (real n) = sqrt (2 * pi * real n)

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)
[PROOF STEP]
have "eventually (\<lambda>n. (n / exp 1) powr n = (n / exp 1) ^ n) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (real n / exp 1) powr real n = (real n / exp 1) ^ n
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (real n / exp 1) powr real n = (real n / exp 1) ^ n
[PROOF STEP]
by eventually_elim (simp add: powr_realpow)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. (real n / exp 1) powr real n = (real n / exp 1) ^ n

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fact \<sim>[sequentially] (\<lambda>x. sqrt (2 * pi * real x) * (real x / exp 1) ^ x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fact \<sim>[sequentially] (\<lambda>x. sqrt (2 * pi * real x) * (real x / exp 1) ^ x)

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fact \<sim>[sequentially] (\<lambda>n. sqrt (2 * pi * real n) * (real n / exp 1) ^ n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_mat_plus: assumes wf1: "mat nr nc m1"
  and wf2: "mat nr nc m2"
  and i: "i < nr"
  shows "row (mat_plusI pl m1 m2) i = vec_plusI pl (row m1 i) (row m2 i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (mat_plusI pl m1 m2) i = vec_plusI pl (row m1 i) (row m2 i)
[PROOF STEP]
by (
    simp only: col_transpose_is_row[OF mat_plus[OF wf1 wf2] i, symmetric],
    simp only: transpose_mat_plus[OF wf1 wf2],
    simp only: col_mat_plus[OF transpose[OF wf1] transpose[OF wf2] i],
    simp only: col_transpose_is_row[OF wf1 i],
    simp only: col_transpose_is_row[OF wf2 i])


[STATEMENT]
lemma integral_const_closed_segment:
  fixes a b::real
  shows "integral (closed_segment a b) (\<lambda>x. c) = abs (b - a) *\<^sub>R c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a--b} (\<lambda>x. c) = \<bar>b - a\<bar> *\<^sub>R c
[PROOF STEP]
by (auto simp: closed_segment_eq_real_ivl content_closed_segment_real)


[STATEMENT]
lemma IVT:
  fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology"
  shows "f a \<le> y \<Longrightarrow> y \<le> f b \<Longrightarrow> a \<le> b \<Longrightarrow> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x) \<Longrightarrow>
    \<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f a \<le> y; y \<le> f b; a \<le> b; \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> \<exists>x\<ge>a. x \<le> b \<and> f x = y
[PROOF STEP]
by (rule IVT') (auto intro: continuous_at_imp_continuous_on)


[STATEMENT]
lemma sorted_list_of_set_filter:
  assumes "finite A"
  shows "sorted_list_of_set ({x\<in>A. P x}) = filter P (sorted_list_of_set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
proof (induction "sorted_list_of_set A" arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>xs = sorted_list_of_set ?A; finite ?A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> ?A. P x} = filter P (sorted_list_of_set ?A)
x # xs = sorted_list_of_set A
finite A

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have x: "x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> A
[PROOF STEP]
using Cons sorted_list_of_set list.set_intros(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>xs = sorted_list_of_set ?A; finite ?A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> ?A. P x} = filter P (sorted_list_of_set ?A)
x # xs = sorted_list_of_set A
finite A
finite ?A \<Longrightarrow> set (sorted_list_of_set ?A) = ?A
sorted (sorted_list_of_set ?A)
distinct (sorted_list_of_set ?A)
?x21.0 \<in> set (?x21.0 # ?x22.0)

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

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have "sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>xs = sorted_list_of_set ?A; finite ?A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> ?A. P x} = filter P (sorted_list_of_set ?A)
x # xs = sorted_list_of_set A
finite A

goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
by (intro sorted_list_of_set_Min_Cons) auto
[PROOF STATE]
proof (state)
this:
sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
have 1: "x = Min A" "xs = sorted_list_of_set (A - {x})"
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})

goal (1 subgoal):
 1. x = Min A &&& xs = sorted_list_of_set (A - {x})
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
\<lbrakk>xs = sorted_list_of_set ?A; finite ?A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> ?A. P x} = filter P (sorted_list_of_set ?A)
x # xs = sorted_list_of_set A
finite A

goal (1 subgoal):
 1. x = Min A &&& xs = sorted_list_of_set (A - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = Min A
xs = sorted_list_of_set (A - {x})

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x = Min A
xs = sorted_list_of_set (A - {x})

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
assume Px: "P x"
[PROOF STATE]
proof (state)
this:
P x

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have 2: "sorted_list_of_set {x \<in> A. P x} = Min {x \<in> A. P x} # sorted_list_of_set ({x \<in> A. P x} - {Min {x \<in> A. P x}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set {x \<in> A. P x} = Min {x \<in> A. P x} # sorted_list_of_set ({x \<in> A. P x} - {Min {x \<in> A. P x}})
[PROOF STEP]
using Px Cons 1 sorted_list_of_set_eq_Nil_iff
[PROOF STATE]
proof (prove)
using this:
P x
\<lbrakk>xs = sorted_list_of_set ?A; finite ?A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> ?A. P x} = filter P (sorted_list_of_set ?A)
x # xs = sorted_list_of_set A
finite A
x = Min A
xs = sorted_list_of_set (A - {x})
finite ?A \<Longrightarrow> (sorted_list_of_set ?A = []) = (?A = {})

goal (1 subgoal):
 1. sorted_list_of_set {x \<in> A. P x} = Min {x \<in> A. P x} # sorted_list_of_set ({x \<in> A. P x} - {Min {x \<in> A. P x}})
[PROOF STEP]
by (intro sorted_list_of_set_Min_Cons) fastforce+
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {x \<in> A. P x} = Min {x \<in> A. P x} # sorted_list_of_set ({x \<in> A. P x} - {Min {x \<in> A. P x}})

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {x \<in> A. P x} = Min {x \<in> A. P x} # sorted_list_of_set ({x \<in> A. P x} - {Min {x \<in> A. P x}})

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have 3: "Min {x \<in> A. P x} = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min {x \<in> A. P x} = x
[PROOF STEP]
using Cons 1 Px x
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>xs = sorted_list_of_set ?A; finite ?A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> ?A. P x} = filter P (sorted_list_of_set ?A)
x # xs = sorted_list_of_set A
finite A
x = Min A
xs = sorted_list_of_set (A - {x})
P x
x \<in> A

goal (1 subgoal):
 1. Min {x \<in> A. P x} = x
[PROOF STEP]
by (auto intro!: Min_eqI)
[PROOF STATE]
proof (state)
this:
Min {x \<in> A. P x} = x

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Min {x \<in> A. P x} = x

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have 4: "{x \<in> A. P x} - {x} = {y \<in> A - {x}. P y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> A. P x} - {x} = {y \<in> A - {x}. P y}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{x \<in> A. P x} - {x} = {y \<in> A - {x}. P y}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x \<in> A. P x} - {x} = {y \<in> A - {x}. P y}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have 5: "sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))
[PROOF STEP]
using 1 Cons
[PROOF STATE]
proof (prove)
using this:
x = Min A
xs = sorted_list_of_set (A - {x})
\<lbrakk>xs = sorted_list_of_set ?A; finite ?A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> ?A. P x} = filter P (sorted_list_of_set ?A)
x # xs = sorted_list_of_set A
finite A

goal (1 subgoal):
 1. sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))
[PROOF STEP]
by (intro Cons) (auto)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have "\<dots> = filter P xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P (sorted_list_of_set (A - {x})) = filter P xs
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
x = Min A
xs = sorted_list_of_set (A - {x})

goal (1 subgoal):
 1. filter P (sorted_list_of_set (A - {x})) = filter P xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
filter P (sorted_list_of_set (A - {x})) = filter P xs

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
filter P (sorted_list_of_set (A - {x})) = filter P xs

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have "filter P (sorted_list_of_set A) = x # filter P xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P (sorted_list_of_set A) = x # filter P xs
[PROOF STEP]
using Px
[PROOF STATE]
proof (prove)
using this:
P x

goal (1 subgoal):
 1. filter P (sorted_list_of_set A) = x # filter P xs
[PROOF STEP]
by (simp flip: \<open>x # xs = sorted_list_of_set A\<close>)
[PROOF STATE]
proof (state)
this:
filter P (sorted_list_of_set A) = x # filter P xs

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
filter P (sorted_list_of_set A) = sorted_list_of_set {x \<in> A. P x}
[PROOF STEP]
have ?case
[PROOF STATE]
proof (prove)
using this:
filter P (sorted_list_of_set A) = sorted_list_of_set {x \<in> A. P x}

goal (1 subgoal):
 1. sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
P x \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P x \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
P x \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
assume Px: "\<not> P x"
[PROOF STATE]
proof (state)
this:
\<not> P x

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> P x
[PROOF STEP]
have "{x \<in> A. P x} = {y \<in> A - {x}. P y}"
[PROOF STATE]
proof (prove)
using this:
\<not> P x

goal (1 subgoal):
 1. {x \<in> A. P x} = {y \<in> A - {x}. P y}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{x \<in> A. P x} = {y \<in> A - {x}. P y}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x \<in> A. P x} = {y \<in> A - {x}. P y}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have "sorted_list_of_set \<dots> = filter P (sorted_list_of_set (A - {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))
[PROOF STEP]
using 1 Cons
[PROOF STATE]
proof (prove)
using this:
x = Min A
xs = sorted_list_of_set (A - {x})
\<lbrakk>xs = sorted_list_of_set ?A; finite ?A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> ?A. P x} = filter P (sorted_list_of_set ?A)
x # xs = sorted_list_of_set A
finite A

goal (1 subgoal):
 1. sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))
[PROOF STEP]
by (intro Cons) auto
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {y \<in> A - {x}. P y} = filter P (sorted_list_of_set (A - {x}))

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have  "filter P (sorted_list_of_set (A - {x})) = filter P (sorted_list_of_set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P (sorted_list_of_set (A - {x})) = filter P (sorted_list_of_set A)
[PROOF STEP]
using 1 Px
[PROOF STATE]
proof (prove)
using this:
x = Min A
xs = sorted_list_of_set (A - {x})
\<not> P x

goal (1 subgoal):
 1. filter P (sorted_list_of_set (A - {x})) = filter P (sorted_list_of_set A)
[PROOF STEP]
by (simp flip: \<open>x # xs = sorted_list_of_set A\<close>)
[PROOF STATE]
proof (state)
this:
filter P (sorted_list_of_set (A - {x})) = filter P (sorted_list_of_set A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
have ?case
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (1 subgoal):
 1. sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> P x \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
 2. \<And>a x A. \<lbrakk>\<And>A. \<lbrakk>x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A); a # x = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P x \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
\<not> P x \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
P x \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
\<not> P x \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (1 subgoal):
 1. sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>[] = sorted_list_of_set A; finite A\<rbrakk> \<Longrightarrow> sorted_list_of_set {x \<in> A. P x} = filter P (sorted_list_of_set A)
[PROOF STEP]
qed (use sorted_list_of_set_eq_Nil_iff in fastforce)


[STATEMENT]
lemma subset_Euclidean_space [simp]:
   "topspace(Euclidean_space m) \<subseteq> topspace(Euclidean_space n) \<longleftrightarrow> m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (topspace (Euclidean_space m) \<subseteq> topspace (Euclidean_space n)) = (m \<le> n)
[PROOF STEP]
apply (simp add: topspace_Euclidean_space subset_iff, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>t. (\<forall>i\<ge>m. t i = 0) \<longrightarrow> (\<forall>i\<ge>n. t i = 0) \<Longrightarrow> m \<le> n
 2. \<And>t i. \<lbrakk>m \<le> n; \<forall>i\<ge>m. t i = 0; n \<le> i\<rbrakk> \<Longrightarrow> t i = 0
[PROOF STEP]
apply (drule_tac x="(\<lambda>i. if i < m then 1 else 0)" in spec)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>i\<ge>m. (if i < m then 1 else 0) = 0) \<longrightarrow> (\<forall>i\<ge>n. (if i < m then 1 else 0) = 0) \<Longrightarrow> m \<le> n
 2. \<And>t i. \<lbrakk>m \<le> n; \<forall>i\<ge>m. t i = 0; n \<le> i\<rbrakk> \<Longrightarrow> t i = 0
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<ge>n. (if i < m then 1 else 0) = 0 \<Longrightarrow> m \<le> n
[PROOF STEP]
using not_less
[PROOF STATE]
proof (prove)
using this:
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. \<forall>i\<ge>n. (if i < m then 1 else 0) = 0 \<Longrightarrow> m \<le> n
[PROOF STEP]
by fastforce


[STATEMENT]
lemma Cons_sorted_less_nth:  "\<forall>x<length xs. xs ! x < p \<Longrightarrow> sorted (rev xs) \<Longrightarrow> sorted (rev (p # xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x<length xs. xs ! x < p; Sorted_Less.sorted (rev xs)\<rbrakk> \<Longrightarrow> Sorted_Less.sorted (rev (p # xs))
[PROOF STEP]
apply(subgoal_tac "\<forall>x\<in>set xs. x < p")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>x<length xs. xs ! x < p; Sorted_Less.sorted (rev xs); \<forall>x\<in>set xs. x < p\<rbrakk> \<Longrightarrow> Sorted_Less.sorted (rev (p # xs))
 2. \<lbrakk>\<forall>x<length xs. xs ! x < p; Sorted_Less.sorted (rev xs)\<rbrakk> \<Longrightarrow> \<forall>x\<in>set xs. x < p
[PROOF STEP]
apply(fastforce dest:Cons_sorted_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x<length xs. xs ! x < p; Sorted_Less.sorted (rev xs)\<rbrakk> \<Longrightarrow> \<forall>x\<in>set xs. x < p
[PROOF STEP]
apply(auto simp add: set_conv_nth)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sets_in_Pi_aux:
  "finite I \<Longrightarrow> (\<And>j. j \<in> I \<Longrightarrow> {x\<in>space (M j). x \<in> F j} \<in> sets (M j)) \<Longrightarrow>
  {x\<in>space (PiM I M). x \<in> Pi I F} \<in> sets (PiM I M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>j. j \<in> I \<Longrightarrow> {x \<in> space (M j). x \<in> F j} \<in> sets (M j)\<rbrakk> \<Longrightarrow> {x \<in> space (Pi\<^sub>M I M). x \<in> Pi I F} \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
by (simp add: subset_eq Pi_iff)


[STATEMENT]
lemma convex_rel_interior_inter:
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
  shows "rel_interior (\<Inter>I) \<subseteq> \<Inter>{rel_interior S |S. S \<in> I}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
have "convex (\<Inter>I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (\<Inter> I)
[PROOF STEP]
using assms convex_Inter
[PROOF STATE]
proof (prove)
using this:
\<forall>S\<in>I. convex S
\<Inter> {rel_interior S |S. S \<in> I} \<noteq> {}
(\<And>s. s \<in> ?f \<Longrightarrow> convex s) \<Longrightarrow> convex (\<Inter> ?f)

goal (1 subgoal):
 1. convex (\<Inter> I)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex (\<Inter> I)

goal (1 subgoal):
 1. rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
convex (\<Inter> I)

goal (1 subgoal):
 1. rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
have "convex (\<Inter>{rel_interior S |S. S \<in> I})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
using assms convex_rel_interior
[PROOF STATE]
proof (prove)
using this:
\<forall>S\<in>I. convex S
\<Inter> {rel_interior S |S. S \<in> I} \<noteq> {}
convex ?S \<Longrightarrow> convex (rel_interior ?S)

goal (1 subgoal):
 1. convex (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
by (force intro: convex_Inter)
[PROOF STATE]
proof (state)
this:
convex (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
convex (\<Inter> I)
convex (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
have "rel_interior (\<Inter>{rel_interior S |S. S \<in> I}) = rel_interior (\<Inter>I)"
[PROOF STATE]
proof (prove)
using this:
convex (\<Inter> I)
convex (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. rel_interior (\<Inter> {rel_interior S |S. S \<in> I}) = rel_interior (\<Inter> I)
[PROOF STEP]
using convex_inter_rel_interior_same_closure assms
      closure_eq_rel_interior_eq[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"]
[PROOF STATE]
proof (prove)
using this:
convex (\<Inter> I)
convex (\<Inter> {rel_interior S |S. S \<in> I})
\<lbrakk>\<forall>S\<in>?I. convex S; \<Inter> {rel_interior S |S. S \<in> ?I} \<noteq> {}\<rbrakk> \<Longrightarrow> closure (\<Inter> {rel_interior S |S. S \<in> ?I}) = closure (\<Inter> ?I)
\<forall>S\<in>I. convex S
\<Inter> {rel_interior S |S. S \<in> I} \<noteq> {}
\<lbrakk>convex (\<Inter> {rel_interior S |S. S \<in> I}); convex (\<Inter> I)\<rbrakk> \<Longrightarrow> (closure (\<Inter> {rel_interior S |S. S \<in> I}) = closure (\<Inter> I)) = (rel_interior (\<Inter> {rel_interior S |S. S \<in> I}) = rel_interior (\<Inter> I))

goal (1 subgoal):
 1. rel_interior (\<Inter> {rel_interior S |S. S \<in> I}) = rel_interior (\<Inter> I)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
rel_interior (\<Inter> {rel_interior S |S. S \<in> I}) = rel_interior (\<Inter> I)

goal (1 subgoal):
 1. rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_interior (\<Inter> {rel_interior S |S. S \<in> I}) = rel_interior (\<Inter> I)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rel_interior (\<Inter> {rel_interior S |S. S \<in> I}) = rel_interior (\<Inter> I)

goal (1 subgoal):
 1. rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
using rel_interior_subset[of "\<Inter>{rel_interior S |S. S \<in> I}"]
[PROOF STATE]
proof (prove)
using this:
rel_interior (\<Inter> {rel_interior S |S. S \<in> I}) = rel_interior (\<Inter> I)
rel_interior (\<Inter> {rel_interior S |S. S \<in> I}) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}

goal (1 subgoal):
 1. rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (\<Inter> I) \<subseteq> \<Inter> {rel_interior S |S. S \<in> I}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "A \<and> B \<longrightarrow> B \<and> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<and> B \<longrightarrow> B \<and> A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<and> B \<Longrightarrow> B \<and> A
[PROOF STEP]
assume "A \<and> B"
[PROOF STATE]
proof (state)
this:
A \<and> B

goal (1 subgoal):
 1. A \<and> B \<Longrightarrow> B \<and> A
[PROOF STEP]
show "B \<and> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<and> A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B
 2. A
[PROOF STEP]
show B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B
[PROOF STEP]
by (rule conjunct2) fact
[PROOF STATE]
proof (state)
this:
B

goal (1 subgoal):
 1. A
[PROOF STEP]
show A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A
[PROOF STEP]
by (rule conjunct1) fact
[PROOF STATE]
proof (state)
this:
A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
B \<and> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_affine_sets_eq:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "affine S" "affine T"
  shows "S homeomorphic T \<longleftrightarrow> aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
proof (cases "S = {} \<or> T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<or> T = {} \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
 2. \<not> (S = {} \<or> T = {}) \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {} \<or> T = {}

goal (2 subgoals):
 1. S = {} \<or> T = {} \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
 2. \<not> (S = {} \<or> T = {}) \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {} \<or> T = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {} \<or> T = {}

goal (1 subgoal):
 1. S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
using assms homeomorphic_affine_sets
[PROOF STATE]
proof (prove)
using this:
S = {} \<or> T = {}
affine S
affine T
\<lbrakk>affine ?S; affine ?T; aff_dim ?S = aff_dim ?T\<rbrakk> \<Longrightarrow> ?S homeomorphic ?T

goal (1 subgoal):
 1. S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
S homeomorphic T = (aff_dim S = aff_dim T)

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (S = {} \<or> T = {})

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (S = {} \<or> T = {})
[PROOF STEP]
obtain a b where "a \<in> S" "b \<in> T"
[PROOF STATE]
proof (prove)
using this:
\<not> (S = {} \<or> T = {})

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

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> S
b \<in> T
[PROOF STEP]
have "subspace ((+) (- a) ` S)" "subspace ((+) (- b) ` T)"
[PROOF STATE]
proof (prove)
using this:
a \<in> S
b \<in> T

goal (1 subgoal):
 1. subspace ((+) (- a) ` S) &&& subspace ((+) (- b) ` T)
[PROOF STEP]
using affine_diffs_subspace assms
[PROOF STATE]
proof (prove)
using this:
a \<in> S
b \<in> T
\<lbrakk>affine ?S; ?a \<in> ?S\<rbrakk> \<Longrightarrow> subspace ((+) (- ?a) ` ?S)
affine S
affine T

goal (1 subgoal):
 1. subspace ((+) (- a) ` S) &&& subspace ((+) (- b) ` T)
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
subspace ((+) (- a) ` S)
subspace ((+) (- b) ` T)

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subspace ((+) (- a) ` S)
subspace ((+) (- b) ` T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subspace ((+) (- a) ` S)
subspace ((+) (- b) ` T)

goal (1 subgoal):
 1. S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
by (metis affine_imp_convex assms homeomorphic_affine_sets homeomorphic_convex_sets)
[PROOF STATE]
proof (state)
this:
S homeomorphic T = (aff_dim S = aff_dim T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_mult_distrib: "k * gcd a b = gcd (k * a) (k * b) * unit_factor k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * gcd a b = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k * gcd a b = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
have "normalize k * gcd a b = gcd (k * a) (k * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize k * gcd a b = gcd (k * a) (k * b)
[PROOF STEP]
by (simp add: gcd_mult_distrib')
[PROOF STATE]
proof (state)
this:
normalize k * gcd a b = gcd (k * a) (k * b)

goal (1 subgoal):
 1. k * gcd a b = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
normalize k * gcd a b = gcd (k * a) (k * b)
[PROOF STEP]
have "normalize k * gcd a b * unit_factor k = gcd (k * a) (k * b) * unit_factor k"
[PROOF STATE]
proof (prove)
using this:
normalize k * gcd a b = gcd (k * a) (k * b)

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

goal (1 subgoal):
 1. k * gcd a b = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
normalize k * gcd a b * unit_factor k = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
have "normalize k * unit_factor k * gcd a b  = gcd (k * a) (k * b) * unit_factor k"
[PROOF STATE]
proof (prove)
using this:
normalize k * gcd a b * unit_factor k = gcd (k * a) (k * b) * unit_factor k

goal (1 subgoal):
 1. normalize k * unit_factor k * gcd a b = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
by (simp only: ac_simps)
[PROOF STATE]
proof (state)
this:
normalize k * unit_factor k * gcd a b = gcd (k * a) (k * b) * unit_factor k

goal (1 subgoal):
 1. k * gcd a b = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
normalize k * unit_factor k * gcd a b = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
normalize k * unit_factor k * gcd a b = gcd (k * a) (k * b) * unit_factor k

goal (1 subgoal):
 1. k * gcd a b = gcd (k * a) (k * b) * unit_factor k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k * gcd a b = gcd (k * a) (k * b) * unit_factor k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lim_component_le_cart:
  fixes f :: "'a \<Rightarrow> real^'n"
  assumes "(f \<longlongrightarrow> l) net" "\<not> (trivial_limit net)"  "eventually (\<lambda>x. f x $i \<le> b) net"
  shows "l$i \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l $ i \<le> b
[PROOF STEP]
by (rule tendsto_le[OF assms(2) tendsto_const tendsto_vec_nth, OF assms(1, 3)])


[STATEMENT]
lemma from_nat_mono:
  assumes i_le_j: "i<j" and j: "j<CARD('a)"
  shows "(from_nat i::'a) < from_nat j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat j
[PROOF STEP]
have i: "i<CARD('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < CARD('a)
[PROOF STEP]
using i_le_j j
[PROOF STATE]
proof (prove)
using this:
i < j
j < CARD('a)

goal (1 subgoal):
 1. i < CARD('a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < CARD('a)

goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat j
[PROOF STEP]
obtain a where a: "i=to_nat a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. i = mod_type_class.to_nat a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bij_to_nat
[PROOF STATE]
proof (prove)
using this:
bij_betw mod_type_class.to_nat UNIV {0..<CARD('a)}

goal (1 subgoal):
 1. (\<And>a. i = mod_type_class.to_nat a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('a)}

goal (1 subgoal):
 1. (\<And>a. i = mod_type_class.to_nat a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using i to_nat_from_nat_id
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('a)}
i < CARD('a)
?x < CARD('a) \<Longrightarrow> mod_type_class.to_nat (mod_type_class.from_nat ?x) = ?x

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

goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat j
[PROOF STEP]
obtain b where b: "j=to_nat b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. j = mod_type_class.to_nat b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bij_to_nat
[PROOF STATE]
proof (prove)
using this:
bij_betw mod_type_class.to_nat UNIV {0..<CARD('a)}

goal (1 subgoal):
 1. (\<And>b. j = mod_type_class.to_nat b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('a)}

goal (1 subgoal):
 1. (\<And>b. j = mod_type_class.to_nat b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using j to_nat_from_nat_id
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('a)}
j < CARD('a)
?x < CARD('a) \<Longrightarrow> mod_type_class.to_nat (mod_type_class.from_nat ?x) = ?x

goal (1 subgoal):
 1. (\<And>b. j = mod_type_class.to_nat b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
j = mod_type_class.to_nat b

goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat j
[PROOF STEP]
by (metis a b from_nat_to_nat_id i_le_j strict_mono_less strict_mono_to_nat)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i < mod_type_class.from_nat j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_subst':
  "eventually (\<lambda>x. f x = g x) F \<Longrightarrow> eventually (\<lambda>x. P x (f x)) F = eventually (\<lambda>x. P x (g x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x = g x \<Longrightarrow> (\<forall>\<^sub>F x in F. P x (f x)) = (\<forall>\<^sub>F x in F. P x (g x))
[PROOF STEP]
by (rule eventually_subst, erule eventually_rev_mp) simp


[STATEMENT]
lemma card_UNION_nonneg:
  assumes "finite A"
    and "\<forall>k \<in> A. finite k"
  shows "(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter>I))) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
using int_card_UNION [OF assms]
[PROOF STATE]
proof (prove)
using this:
int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))

goal (1 subgoal):
 1. 0 \<le> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
by presburger


[STATEMENT]
lemma card_of_Sigma_ordLeq_Cinfinite:
  "\<lbrakk>Cinfinite r; |I| \<le>o r; \<forall>i \<in> I. |A i| \<le>o r\<rbrakk> \<Longrightarrow> |SIGMA i : I. A i| \<le>o r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Cinfinite r; |I| \<le>o r; \<forall>i\<in>I. |A i| \<le>o r\<rbrakk> \<Longrightarrow> |Sigma I A| \<le>o r
[PROOF STEP]
unfolding cinfinite_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>infinite (Field r) \<and> Card_order r; |I| \<le>o r; \<forall>i\<in>I. |A i| \<le>o r\<rbrakk> \<Longrightarrow> |Sigma I A| \<le>o r
[PROOF STEP]
by (blast intro: card_of_Sigma_ordLeq_infinite_Field)