[STATEMENT]
lemma natUnion_eq[case_names Subset Superset]:
  "(\<And> n. \<exists> m. f n \<subseteq> g m) \<Longrightarrow> (\<And> n. \<exists> m. g n \<subseteq> f m) \<Longrightarrow> natUnion f = natUnion g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>n. \<exists>m. f n \<subseteq> g m; \<And>n. \<exists>m. g n \<subseteq> f m\<rbrakk> \<Longrightarrow> natUnion f = natUnion g
[PROOF STEP]
by (simp add: natUnion_subset subset_antisym)


[STATEMENT]
lemma subquantale_Fix:
  fixes X :: "'a::quantale set"
  assumes "Sup_closed_set X"
  and "comp_closed_set X"
  shows "X = Fix (\<lambda>x. \<Squnion>{y \<in> X. y \<le> x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X = Fix (\<lambda>x. \<Squnion> {y \<in> X. y \<le> x})
[PROOF STEP]
unfolding Fix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X = {x. \<Squnion> {y \<in> X. y \<le> x} = x}
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> X \<Longrightarrow> \<Squnion> {y \<in> X. y \<le> x} = x
 2. \<And>x. \<Squnion> {y \<in> X. y \<le> x} = x \<Longrightarrow> x \<in> X
[PROOF STEP]
apply (metis (mono_tags, lifting) Sup_least Sup_upper antisym mem_Collect_eq order_refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<Squnion> {y \<in> X. y \<le> x} = x \<Longrightarrow> x \<in> X
[PROOF STEP]
by (metis (no_types, lifting) Sup_closed_set_def assms(1) mem_Collect_eq subsetI)


[STATEMENT]
lemma lcm_div_le:
  fixes a :: nat
  shows "lcm a b div b \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm a b div b \<le> a
[PROOF STEP]
by (metis div_by_0 div_le_dividend div_le_mono div_mult_self_is_m lcm_nat_def neq0_conv)


[STATEMENT]
lemma minus_of_real_eq_of_real_iff [simp]: "-of_real x = of_real y \<longleftrightarrow> -x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- of_real x = of_real y) = (- x = y)
[PROOF STEP]
using of_real_eq_iff[of "-x" y]
[PROOF STATE]
proof (prove)
using this:
(of_real (- x) = of_real y) = (- x = y)

goal (1 subgoal):
 1. (- of_real x = of_real y) = (- x = y)
[PROOF STEP]
by (simp only: of_real_minus)


[STATEMENT]
lemma floor_log_divide_eq:
  assumes "i > 0" "j > 0" "p > 1"
  shows "\<lfloor>log p (i / j)\<rfloor> = floor (log p i) - floor (log p j) -
    (if i \<ge> j * p powr (floor (log p i) - floor (log p j)) then 0 else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
let ?l = "log p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
let ?fl = "\<lambda>x. floor (?l x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
have "\<lfloor>?l (i / j)\<rfloor> = \<lfloor>?l i - ?l j\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i - log p j\<rfloor>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < i
0 < j
1 < p

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i - log p j\<rfloor>
[PROOF STEP]
by (auto simp: log_divide)
[PROOF STATE]
proof (state)
this:
\<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i - log p j\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i - log p j\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
have "\<dots> = floor (real_of_int (?fl i - ?fl j) + (?l i - ?fl i - (?l j - ?fl j)))"
    (is "_ = floor (_ + ?r)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log p i - log p j\<rfloor> = \<lfloor>real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) + (log p i - real_of_int \<lfloor>log p i\<rfloor> - (log p j - real_of_int \<lfloor>log p j\<rfloor>))\<rfloor>
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<lfloor>log p i - log p j\<rfloor> = \<lfloor>real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) + (log p i - real_of_int \<lfloor>log p i\<rfloor> - (log p j - real_of_int \<lfloor>log p j\<rfloor>))\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>log p i - log p j\<rfloor> = \<lfloor>real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) + (log p i - real_of_int \<lfloor>log p i\<rfloor> - (log p j - real_of_int \<lfloor>log p j\<rfloor>))\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
note floor_add2
[PROOF STATE]
proof (state)
this:
?x \<in> \<int> \<or> ?y \<in> \<int> \<Longrightarrow> \<lfloor>?x + ?y\<rfloor> = \<lfloor>?x\<rfloor> + \<lfloor>?y\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
?x \<in> \<int> \<or> ?y \<in> \<int> \<Longrightarrow> \<lfloor>?x + ?y\<rfloor> = \<lfloor>?x\<rfloor> + \<lfloor>?y\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
note \<open>p > 1\<close>
[PROOF STATE]
proof (state)
this:
1 < p

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
note powr = powr_le_cancel_iff[symmetric, OF \<open>1 < p\<close>, THEN iffD2]
[PROOF STATE]
proof (state)
this:
p powr ?a1 \<le> p powr ?b1 \<Longrightarrow> ?a1 \<le> ?b1

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
note powr_strict = powr_less_cancel_iff[symmetric, OF \<open>1 < p\<close>, THEN iffD2]
[PROOF STATE]
proof (state)
this:
p powr ?a1 < p powr ?b1 \<Longrightarrow> ?a1 < ?b1

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
have "floor ?r = (if i \<ge> j * p powr (?fl i - ?fl j) then 0 else -1)" (is "_ = ?if")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log p i - real_of_int \<lfloor>log p i\<rfloor> - (log p j - real_of_int \<lfloor>log p j\<rfloor>)\<rfloor> = (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else - 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < i
0 < j
1 < p

goal (1 subgoal):
 1. \<lfloor>log p i - real_of_int \<lfloor>log p i\<rfloor> - (log p j - real_of_int \<lfloor>log p j\<rfloor>)\<rfloor> = (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else - 1)
[PROOF STEP]
by (linarith |
      auto
        intro!: floor_eq2
        intro: powr_strict powr
        simp: powr_diff powr_add field_split_simps algebra_simps)+
[PROOF STATE]
proof (state)
this:
\<lfloor>log p i - real_of_int \<lfloor>log p i\<rfloor> - (log p j - real_of_int \<lfloor>log p j\<rfloor>)\<rfloor> = (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else - 1)

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<in> \<int> \<or> log p i - real_of_int \<lfloor>log p i\<rfloor> - (log p j - real_of_int \<lfloor>log p j\<rfloor>) \<in> \<int> \<Longrightarrow> \<lfloor>log p (i / j)\<rfloor> = \<lfloor>real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>)\<rfloor> + (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<in> \<int> \<or> log p i - real_of_int \<lfloor>log p i\<rfloor> - (log p j - real_of_int \<lfloor>log p j\<rfloor>) \<in> \<int> \<Longrightarrow> \<lfloor>log p (i / j)\<rfloor> = \<lfloor>real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>)\<rfloor> + (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else - 1)

goal (1 subgoal):
 1. \<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lfloor>log p (i / j)\<rfloor> = \<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor> - (if j * p powr real_of_int (\<lfloor>log p i\<rfloor> - \<lfloor>log p j\<rfloor>) \<le> i then 0 else 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma variance_expectation:
  fixes X :: "'a \<Rightarrow> real"
  assumes "integrable M (\<lambda>x. (X x)^2)" and "X \<in> borel_measurable M"
  shows
    "integrable M (\<lambda>x. (X x - expectation X)^2)" (is ?integrable)
    "variance X = expectation (\<lambda>x. (X x)^2) - (expectation X)^2" (is ?variance)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. (X x - expectation X)\<^sup>2) &&& expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)
 2. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2
[PROOF STEP]
have int: "integrable M X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M X
[PROOF STEP]
using integrable_squareD[OF assms]
[PROOF STATE]
proof (prove)
using this:
integrable M X

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

goal (2 subgoals):
 1. integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)
 2. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2
[PROOF STEP]
have "(\<lambda>x. (X x - expectation X)^2) = (\<lambda>x. (X x)^2 + (expectation X)^2 - (2 * X x * expectation X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (X x - expectation X)\<^sup>2) = (\<lambda>x. (X x)\<^sup>2 + (expectation X)\<^sup>2 - 2 * X x * expectation X)
[PROOF STEP]
by (simp only: power2_diff)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (X x - expectation X)\<^sup>2) = (\<lambda>x. (X x)\<^sup>2 + (expectation X)\<^sup>2 - 2 * X x * expectation X)

goal (2 subgoals):
 1. integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)
 2. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2
[PROOF STEP]
hence
    "variance X = expectation (\<lambda>x. (X x)^2) + (expectation X)^2 + expectation (\<lambda>x. - (2 * X x * expectation X))"
    ?integrable
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (X x - expectation X)\<^sup>2) = (\<lambda>x. (X x)\<^sup>2 + (expectation X)\<^sup>2 - 2 * X x * expectation X)

goal (1 subgoal):
 1. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) + (expectation X)\<^sup>2 + expectation (\<lambda>x. - (2 * X x * expectation X)) &&& integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)
[PROOF STEP]
using integral_add
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (X x - expectation X)\<^sup>2) = (\<lambda>x. (X x)\<^sup>2 + (expectation X)\<^sup>2 - 2 * X x * expectation X)
\<lbrakk>?f integrable_on ?S; ?g integrable_on ?S\<rbrakk> \<Longrightarrow> integral ?S (\<lambda>x. ?f x + ?g x) = integral ?S ?f + integral ?S ?g

goal (1 subgoal):
 1. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) + (expectation X)\<^sup>2 + expectation (\<lambda>x. - (2 * X x * expectation X)) &&& integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)
[PROOF STEP]
by (simp add: int assms prob_space)+
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) + (expectation X)\<^sup>2 + expectation (\<lambda>x. - (2 * X x * expectation X))
integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)

goal (2 subgoals):
 1. integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)
 2. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2
[PROOF STEP]
thus ?variance ?integrable
[PROOF STATE]
proof (prove)
using this:
expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) + (expectation X)\<^sup>2 + expectation (\<lambda>x. - (2 * X x * expectation X))
integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)

goal (1 subgoal):
 1. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 &&& integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)
[PROOF STEP]
by (simp add: int power2_eq_square)+
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2
integrable M (\<lambda>x. (X x - expectation X)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqrt_Sup_power2_eq_Sup_abs:
  "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A}) = Sup {\<bar>f i\<bar> |i. i \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A}) = Sup {\<bar>f i\<bar> |i. i \<in> A}
[PROOF STEP]
proof(rule sym)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
assume assms: "finite A" "A \<noteq> {}"
[PROOF STATE]
proof (state)
this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
[PROOF STEP]
obtain i where i_def: "i \<in> A \<and> Sup {(f i)\<^sup>2|i. i \<in> A} = (f i)^2"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. (\<And>i. i \<in> A \<and> Sup {(f i)\<^sup>2 |i. i \<in> A} = (f i)\<^sup>2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cSup_finite_ex[of "{(f i)\<^sup>2|i. i \<in> A}"]
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
\<lbrakk>finite {(f i)\<^sup>2 |i. i \<in> A}; {(f i)\<^sup>2 |i. i \<in> A} \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>x\<in>{(f i)\<^sup>2 |i. i \<in> A}. Sup {(f i)\<^sup>2 |i. i \<in> A} = x

goal (1 subgoal):
 1. (\<And>i. i \<in> A \<and> Sup {(f i)\<^sup>2 |i. i \<in> A} = (f i)\<^sup>2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<in> A \<and> Sup {(f i)\<^sup>2 |i. i \<in> A} = (f i)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
hence lhs: "sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A}) = \<bar>f i\<bar>"
[PROOF STATE]
proof (prove)
using this:
i \<in> A \<and> Sup {(f i)\<^sup>2 |i. i \<in> A} = (f i)\<^sup>2

goal (1 subgoal):
 1. sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A}) = \<bar>f i\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A}) = \<bar>f i\<bar>

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
have "finite {(f i)\<^sup>2|i. i \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(f i)\<^sup>2 |i. i \<in> A}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. finite {(f i)\<^sup>2 |i. i \<in> A}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {(f i)\<^sup>2 |i. i \<in> A}

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
hence "\<forall>j\<in>A. (f j)\<^sup>2 \<le> (f i)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
finite {(f i)\<^sup>2 |i. i \<in> A}

goal (1 subgoal):
 1. \<forall>j\<in>A. (f j)\<^sup>2 \<le> (f i)\<^sup>2
[PROOF STEP]
using i_def cSup_upper[of _ "{(f i)\<^sup>2 |i. i \<in> A}"]
[PROOF STATE]
proof (prove)
using this:
finite {(f i)\<^sup>2 |i. i \<in> A}
i \<in> A \<and> Sup {(f i)\<^sup>2 |i. i \<in> A} = (f i)\<^sup>2
\<lbrakk>?x \<in> {(f i)\<^sup>2 |i. i \<in> A}; bdd_above {(f i)\<^sup>2 |i. i \<in> A}\<rbrakk> \<Longrightarrow> ?x \<le> Sup {(f i)\<^sup>2 |i. i \<in> A}

goal (1 subgoal):
 1. \<forall>j\<in>A. (f j)\<^sup>2 \<le> (f i)\<^sup>2
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<forall>j\<in>A. (f j)\<^sup>2 \<le> (f i)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
hence "\<forall>j\<in>A. \<bar>f j\<bar> \<le> \<bar>f i\<bar>"
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<in>A. (f j)\<^sup>2 \<le> (f i)\<^sup>2

goal (1 subgoal):
 1. \<forall>j\<in>A. \<bar>f j\<bar> \<le> \<bar>f i\<bar>
[PROOF STEP]
using abs_le_square_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<in>A. (f j)\<^sup>2 \<le> (f i)\<^sup>2
(\<bar>?x\<bar> \<le> \<bar>?y\<bar>) = (?x\<^sup>2 \<le> ?y\<^sup>2)

goal (1 subgoal):
 1. \<forall>j\<in>A. \<bar>f j\<bar> \<le> \<bar>f i\<bar>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>j\<in>A. \<bar>f j\<bar> \<le> \<bar>f i\<bar>

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<forall>j\<in>A. \<bar>f j\<bar> \<le> \<bar>f i\<bar>

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
have "\<bar>f i\<bar> \<in> {\<bar>f i\<bar> |i. i \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f i\<bar> \<in> {\<bar>f i\<bar> |i. i \<in> A}
[PROOF STEP]
using i_def
[PROOF STATE]
proof (prove)
using this:
i \<in> A \<and> Sup {(f i)\<^sup>2 |i. i \<in> A} = (f i)\<^sup>2

goal (1 subgoal):
 1. \<bar>f i\<bar> \<in> {\<bar>f i\<bar> |i. i \<in> A}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>f i\<bar> \<in> {\<bar>f i\<bar> |i. i \<in> A}

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>j\<in>A. \<bar>f j\<bar> \<le> \<bar>f i\<bar>
\<bar>f i\<bar> \<in> {\<bar>f i\<bar> |i. i \<in> A}
[PROOF STEP]
show "Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})"
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<in>A. \<bar>f j\<bar> \<le> \<bar>f i\<bar>
\<bar>f i\<bar> \<in> {\<bar>f i\<bar> |i. i \<in> A}

goal (1 subgoal):
 1. Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
using cSup_mem_eq[of "\<bar>f i\<bar>" "{\<bar>f i\<bar> |i. i \<in> A}"] lhs
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<in>A. \<bar>f j\<bar> \<le> \<bar>f i\<bar>
\<bar>f i\<bar> \<in> {\<bar>f i\<bar> |i. i \<in> A}
\<lbrakk>\<bar>f i\<bar> \<in> {\<bar>f i\<bar> |i. i \<in> A}; \<forall>x\<in>{\<bar>f i\<bar> |i. i \<in> A}. x \<le> \<bar>f i\<bar>\<rbrakk> \<Longrightarrow> Sup {\<bar>f i\<bar> |i. i \<in> A} = \<bar>f i\<bar>
sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A}) = \<bar>f i\<bar>

goal (1 subgoal):
 1. Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sup {\<bar>f i\<bar> |i. i \<in> A} = sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_less_set_eq:
  assumes "sorted xs "
    shows "xs = sorted_list_of_set (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = sorted_list_of_set (set xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted xs

goal (1 subgoal):
 1. xs = sorted_list_of_set (set xs)
[PROOF STEP]
apply(subgoal_tac "sorted (sorted_list_of_set (set xs))")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Sorted_Less.sorted xs; Sorted_Less.sorted (sorted_list_of_set (set xs))\<rbrakk> \<Longrightarrow> xs = sorted_list_of_set (set xs)
 2. Sorted_Less.sorted xs \<Longrightarrow> Sorted_Less.sorted (sorted_list_of_set (set xs))
[PROOF STEP]
apply(auto intro: sorted_less_set_unique sorted_le2lt)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma poly_newton_poly: "poly (newton_poly n) y = sum_list (map (\<lambda> i. c i * poly (N i) y) [0 ..< Suc n])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (local.newton_poly n) y = (\<Sum>i\<leftarrow>[0..<Suc n]. c i * poly (N i) y)
[PROOF STEP]
unfolding newton_poly_sum poly_sum_list map_map o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[0..<Suc n]. poly (smult (c x) (N x)) y) = (\<Sum>i\<leftarrow>[0..<Suc n]. c i * poly (N i) y)
[PROOF STEP]
by simp


[STATEMENT]
lemma sorted_mono_map:
  assumes "sorted xs"
  assumes "mono f"
  shows "sorted (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map f xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sorted xs
mono f

goal (1 subgoal):
 1. sorted (map f xs)
[PROOF STEP]
apply (simp add:sorted_wrt_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted xs; mono f\<rbrakk> \<Longrightarrow> sorted_wrt (\<lambda>x y. f x \<le> f y) xs
[PROOF STEP]
apply (rule sorted_wrt_mono_rel[where P="(\<le>)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>sorted xs; mono f; x \<in> set xs; y \<in> set xs; x \<le> y\<rbrakk> \<Longrightarrow> f x \<le> f y
 2. \<lbrakk>sorted xs; mono f\<rbrakk> \<Longrightarrow> sorted xs
[PROOF STEP]
by (simp add:mono_def, simp)


[STATEMENT]
lemma mset_size2elem: "\<lbrakk>size P \<le> 2; {#q#}+{#q'#} \<subseteq># P\<rbrakk> \<Longrightarrow> P={#q#}+{#q'#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>size P \<le> 2; {#q#} + {#q'#} \<subseteq># P\<rbrakk> \<Longrightarrow> P = {#q#} + {#q'#}
[PROOF STEP]
by (auto elim: mset_le_addE)


[STATEMENT]
lemma poly_degree_conv_Max:
  assumes "p \<noteq> 0"
  shows   "Polynomial.degree p = Max {n. poly.coeff p n \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.degree p = Max {n. poly.coeff p n \<noteq> (0::'a)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. Polynomial.degree p = Max {n. poly.coeff p n \<noteq> (0::'a)}
[PROOF STEP]
proof (intro antisym degree_le Max.boundedI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> \<forall>i>Max {n. poly.coeff p n \<noteq> (0::'a)}. poly.coeff p i = (0::'a)
 2. p \<noteq> 0 \<Longrightarrow> finite {n. poly.coeff p n \<noteq> (0::'a)}
 3. p \<noteq> 0 \<Longrightarrow> {n. poly.coeff p n \<noteq> (0::'a)} \<noteq> {}
 4. \<And>a. \<lbrakk>p \<noteq> 0; a \<in> {n. poly.coeff p n \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> a \<le> Polynomial.degree p
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> \<forall>i>Max {n. poly.coeff p n \<noteq> (0::'a)}. poly.coeff p i = (0::'a)
 2. p \<noteq> 0 \<Longrightarrow> finite {n. poly.coeff p n \<noteq> (0::'a)}
 3. p \<noteq> 0 \<Longrightarrow> {n. poly.coeff p n \<noteq> (0::'a)} \<noteq> {}
 4. \<And>a. \<lbrakk>p \<noteq> 0; a \<in> {n. poly.coeff p n \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> a \<le> Polynomial.degree p
[PROOF STEP]
assume "n \<in> {n. poly.coeff p n \<noteq> 0}"
[PROOF STATE]
proof (state)
this:
n \<in> {n. poly.coeff p n \<noteq> (0::'a)}

goal (4 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> \<forall>i>Max {n. poly.coeff p n \<noteq> (0::'a)}. poly.coeff p i = (0::'a)
 2. p \<noteq> 0 \<Longrightarrow> finite {n. poly.coeff p n \<noteq> (0::'a)}
 3. p \<noteq> 0 \<Longrightarrow> {n. poly.coeff p n \<noteq> (0::'a)} \<noteq> {}
 4. \<And>a. \<lbrakk>p \<noteq> 0; a \<in> {n. poly.coeff p n \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> a \<le> Polynomial.degree p
[PROOF STEP]
thus "n \<le> Polynomial.degree p"
[PROOF STATE]
proof (prove)
using this:
n \<in> {n. poly.coeff p n \<noteq> (0::'a)}

goal (1 subgoal):
 1. n \<le> Polynomial.degree p
[PROOF STEP]
by (simp add: le_degree)
[PROOF STATE]
proof (state)
this:
n \<le> Polynomial.degree p

goal (3 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> \<forall>i>Max {n. poly.coeff p n \<noteq> (0::'a)}. poly.coeff p i = (0::'a)
 2. p \<noteq> 0 \<Longrightarrow> finite {n. poly.coeff p n \<noteq> (0::'a)}
 3. p \<noteq> 0 \<Longrightarrow> {n. poly.coeff p n \<noteq> (0::'a)} \<noteq> {}
[PROOF STEP]
qed (auto simp: poly_eq_iff finite_poly_coeff_nonzero)


[STATEMENT]
lemma matrix_compose:
  assumes "linear (f::real^'n \<Rightarrow> real^'m)" "linear (g::real^'m \<Rightarrow> real^_)"
  shows "matrix (g o f) = matrix g ** matrix f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix (g \<circ> f) = matrix g ** matrix f
[PROOF STEP]
using matrix_compose_gen[of f g] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Vector_Spaces.linear (*s) (*s) f; Vector_Spaces.linear (*s) (*s) g\<rbrakk> \<Longrightarrow> matrix (g \<circ> f) = matrix g ** matrix f
linear f
linear g

goal (1 subgoal):
 1. matrix (g \<circ> f) = matrix g ** matrix f
[PROOF STEP]
by (simp add: linear_def scalar_mult_eq_scaleR)


[STATEMENT]
lemma lcm_left_idem: "lcm a (lcm a b) = lcm a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm a (lcm a b) = lcm a b
[PROOF STEP]
by (fact lcm.left_idem)


[STATEMENT]
theorem wf_dtree_iff_wf_list:
  "wf_list_arcs xs \<and> r \<notin> fst ` set xs \<and> wf_list_verts xs \<longleftrightarrow> wf_dtree (dtree_from_list r xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (wf_list_arcs xs \<and> r \<notin> fst ` set xs \<and> wf_list_verts xs) = wf_dtree (dtree_from_list r xs)
[PROOF STEP]
using wf_darcs_iff_wf_list_arcs wf_dverts_iff_wf_list_verts
[PROOF STATE]
proof (prove)
using this:
wf_list_arcs ?xs = wf_darcs (dtree_from_list ?r ?xs)
(?r \<notin> fst ` set ?xs \<and> wf_list_verts ?xs) = wf_dverts (dtree_from_list ?r ?xs)

goal (1 subgoal):
 1. (wf_list_arcs xs \<and> r \<notin> fst ` set xs \<and> wf_list_verts xs) = wf_dtree (dtree_from_list r xs)
[PROOF STEP]
unfolding wf_dtree_def
[PROOF STATE]
proof (prove)
using this:
wf_list_arcs ?xs = wf_darcs (dtree_from_list ?r ?xs)
(?r \<notin> fst ` set ?xs \<and> wf_list_verts ?xs) = wf_dverts (dtree_from_list ?r ?xs)

goal (1 subgoal):
 1. (wf_list_arcs xs \<and> r \<notin> fst ` set xs \<and> wf_list_verts xs) = (wf_darcs (dtree_from_list r xs) \<and> wf_dverts (dtree_from_list r xs))
[PROOF STEP]
by fast


[STATEMENT]
lemma matrix_vector_all_zero_from_index:
  fixes A::"'a::{zero}^'columns::{mod_type}^'rows::{mod_type}"
  shows "(\<forall>m\<ge>i. A $ m $ k = 0) = (vector_all_zero_from_index (to_nat i, vec_to_iarray (column k A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>m\<ge>i. A $ m $ k = (0::'a)) = vector_all_zero_from_index (mod_type_class.to_nat i, vec_to_iarray (column k A))
[PROOF STEP]
unfolding vector_all_zero_from_index_eq[symmetric] column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>m\<ge>i. A $ m $ k = (0::'a)) = (\<forall>m\<ge>i. (\<chi>i. A $ i $ k) $ m = (0::'a))
[PROOF STEP]
by simp


[STATEMENT]
lemma matrix_vector_right_distrib_diff: "(M :: 'a :: ring_1 ^ 'nr ^ 'nc) *v (v - w) = M *v v - M *v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M *v (v - w) = M *v v - M *v w
[PROOF STEP]
by (transfer_hma rule: mult_minus_distrib_mat_vec)


[STATEMENT]
lemma gOr_commute: "gval (gOr a b) s = gval (gOr b a) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gval (gOr a b) s = gval (gOr b a) s
[PROOF STEP]
by (simp add: plus_trilean_commutative gOr_def)


[STATEMENT]
lemma mult_mm_cancel_r:
  assumes "mat_det M \<noteq> 0"  "A *\<^sub>m\<^sub>m M = B *\<^sub>m\<^sub>m M"
  shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mat_det M \<noteq> 0
A *\<^sub>m\<^sub>m M = B *\<^sub>m\<^sub>m M

goal (1 subgoal):
 1. A = B
[PROOF STEP]
by (metis mult_mm_inv_r)


[STATEMENT]
lemma norm_add_less: "norm x < r \<Longrightarrow> norm y < s \<Longrightarrow> norm (x + y) < r + s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>norm x < r; norm y < s\<rbrakk> \<Longrightarrow> norm (x + y) < r + s
[PROOF STEP]
by (rule order_le_less_trans [OF norm_triangle_ineq add_strict_mono])


[STATEMENT]
theorem "\<not> (\<forall>(i::int). 4 \<le> i \<longrightarrow> (\<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>i\<ge>4. \<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i)
[PROOF STEP]
by cooper


[STATEMENT]
theorem comm:  "x \<cdot> y = y \<cdot> x  \<longleftrightarrow>  (\<exists> t k m. x = t\<^sup>@k \<and> y = t\<^sup>@m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot> y = y \<cdot> x) = (\<exists>t k m. x = t \<^sup>@ k \<and> y = t \<^sup>@ m)
[PROOF STEP]
using  comm_append_are_replicate[of x y, folded pow_is_concat_replicate] pows_comm
[PROOF STATE]
proof (prove)
using this:
x \<cdot> y = y \<cdot> x \<Longrightarrow> \<exists>m n zs. zs \<^sup>@ m = x \<and> zs \<^sup>@ n = y
?t \<^sup>@ ?k \<cdot> ?t \<^sup>@ ?m = ?t \<^sup>@ ?m \<cdot> ?t \<^sup>@ ?k

goal (1 subgoal):
 1. (x \<cdot> y = y \<cdot> x) = (\<exists>t k m. x = t \<^sup>@ k \<and> y = t \<^sup>@ m)
[PROOF STEP]
by auto


[STATEMENT]
lemma nextl_Reverse_nfa:
    "nfa.nextl (Reverse_nfa M) Q u = {q' \<in> dfa.states M. dfa.nextl M q' (rev u) \<in> Q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfa.nextl (Reverse_nfa M) Q u = {q' \<in> dfa.states M. nextl q' (rev u) \<in> Q}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nfa.nextl (Reverse_nfa M) Q u = {q' \<in> dfa.states M. nextl q' (rev u) \<in> Q}
[PROOF STEP]
interpret NR: nfa "Reverse_nfa M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfa (Reverse_nfa M)
[PROOF STEP]
by (rule nfa_Reverse_nfa)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. NR.nextl Q u = {q' \<in> dfa.states M. nextl q' (rev u) \<in> Q}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR.nextl Q u = {q' \<in> dfa.states M. nextl q' (rev u) \<in> Q}
[PROOF STEP]
by (induct u rule: rev_induct) (auto simp: nxt)
[PROOF STATE]
proof (state)
this:
NR.nextl Q u = {q' \<in> dfa.states M. nextl q' (rev u) \<in> Q}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eucl_of_list_nth:
  assumes "length xs = DIM('a)"
  shows "eucl_of_list xs = (\<Sum>i<DIM('a::executable_euclidean_space). (xs ! i) *\<^sub>R ((Basis_list::'a list) ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list xs = (\<Sum>i<DIM('a). xs ! i *\<^sub>R Basis_list ! i)
[PROOF STEP]
by (auto simp: eucl_of_list_def sum_list_sum_nth length_Basis_list assms atLeast0LessThan)


[STATEMENT]
theorem Kneser_strict:  fixes A and B assumes "A \<subseteq> G" and "B\<subseteq> G" and "finite A" and "finite B"
  and "stabilizer (sumset A B) = H" and "A \<noteq> {}" and "B \<noteq> {}" and " card (sumset A B) < card A + card B"
  shows "card (sumset A B) = card (sumset A (stabilizer (sumset A B))) +
    card (sumset B (stabilizer (sumset A B))) - card (stabilizer (sumset A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset A B) = card (sumset A (stabilizer (sumset A B))) + card (sumset B (stabilizer (sumset A B))) - card (stabilizer (sumset A B))
[PROOF STEP]
using Kneser Kneser_strict_aux assms le_antisym nat_less_le
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> G; ?B \<subseteq> G; finite ?A; finite ?B; ?A \<noteq> {}; ?B \<noteq> {}\<rbrakk> \<Longrightarrow> card (sumset ?A (stabilizer (sumset ?A ?B))) + card (sumset ?B (stabilizer (sumset ?A ?B))) - card (stabilizer (sumset ?A ?B)) \<le> card (sumset ?A ?B)
\<lbrakk>?A \<subseteq> G; ?B \<subseteq> G; finite ?A; finite ?B; ?A \<noteq> {}; ?B \<noteq> {}; card (sumset ?A (stabilizer (sumset ?A ?B))) + card (sumset ?B (stabilizer (sumset ?A ?B))) - card (stabilizer (sumset ?A ?B)) < card (sumset ?A ?B)\<rbrakk> \<Longrightarrow> card ?A + card ?B \<le> card (sumset ?A ?B)
A \<subseteq> G
B \<subseteq> G
finite A
finite B
stabilizer (sumset A B) = H
A \<noteq> {}
B \<noteq> {}
card (sumset A B) < card A + card B
\<lbrakk>?m \<le> ?n; ?n \<le> ?m\<rbrakk> \<Longrightarrow> ?m = ?n
(?m < ?n) = (?m \<le> ?n \<and> ?m \<noteq> ?n)

goal (1 subgoal):
 1. card (sumset A B) = card (sumset A (stabilizer (sumset A B))) + card (sumset B (stabilizer (sumset A B))) - card (stabilizer (sumset A B))
[PROOF STEP]
by metis


[STATEMENT]
lemma measure_negligible_finite_Union:
  assumes "finite \<F>"
    and meas: "\<And>S. S \<in> \<F> \<Longrightarrow> S \<in> lmeasurable"
    and djointish: "pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>"
  shows "measure lebesgue (\<Union>\<F>) = (\<Sum>S\<in>\<F>. measure lebesgue S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> \<F>) = sum (Sigma_Algebra.measure lebesgue) \<F>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite \<F>
?S \<in> \<F> \<Longrightarrow> ?S \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> \<F>) = sum (Sigma_Algebra.measure lebesgue) \<F>
[PROOF STEP]
proof (induction)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>S. S \<in> {} \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) {}\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> {}) = sum (Sigma_Algebra.measure lebesgue) {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<And>S. S \<in> F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> F) = sum (Sigma_Algebra.measure lebesgue) F; \<And>S. S \<in> insert x F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert x F)\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> (insert x F)) = sum (Sigma_Algebra.measure lebesgue) (insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
?S \<in> {} \<Longrightarrow> ?S \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) {}

goal (2 subgoals):
 1. \<lbrakk>\<And>S. S \<in> {} \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) {}\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> {}) = sum (Sigma_Algebra.measure lebesgue) {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<And>S. S \<in> F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> F) = sum (Sigma_Algebra.measure lebesgue) F; \<And>S. S \<in> insert x F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert x F)\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> (insert x F)) = sum (Sigma_Algebra.measure lebesgue) (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?S \<in> {} \<Longrightarrow> ?S \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?S \<in> {} \<Longrightarrow> ?S \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) {}

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> {}) = sum (Sigma_Algebra.measure lebesgue) {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (\<Union> {}) = sum (Sigma_Algebra.measure lebesgue) {}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<And>S. S \<in> F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> F) = sum (Sigma_Algebra.measure lebesgue) F; \<And>S. S \<in> insert x F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert x F)\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> (insert x F)) = sum (Sigma_Algebra.measure lebesgue) (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<And>S. S \<in> F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> F) = sum (Sigma_Algebra.measure lebesgue) F; \<And>S. S \<in> insert x F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert x F)\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> (insert x F)) = sum (Sigma_Algebra.measure lebesgue) (insert x F)
[PROOF STEP]
case (insert S \<F>)
[PROOF STATE]
proof (state)
this:
finite \<F>
S \<notin> \<F>
\<lbrakk>\<And>S. S \<in> \<F> \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> \<F>) = sum (Sigma_Algebra.measure lebesgue) \<F>
?S \<in> insert S \<F> \<Longrightarrow> ?S \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert S \<F>)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<And>S. S \<in> F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> F) = sum (Sigma_Algebra.measure lebesgue) F; \<And>S. S \<in> insert x F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert x F)\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> (insert x F)) = sum (Sigma_Algebra.measure lebesgue) (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite \<F>
S \<notin> \<F>
\<lbrakk>\<And>S. S \<in> \<F> \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> \<F>) = sum (Sigma_Algebra.measure lebesgue) \<F>
?S \<in> insert S \<F> \<Longrightarrow> ?S \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert S \<F>)
[PROOF STEP]
have "S \<in> lmeasurable" "\<Union>\<F> \<in> lmeasurable" "pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>"
[PROOF STATE]
proof (prove)
using this:
finite \<F>
S \<notin> \<F>
\<lbrakk>\<And>S. S \<in> \<F> \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> \<F>) = sum (Sigma_Algebra.measure lebesgue) \<F>
?S \<in> insert S \<F> \<Longrightarrow> ?S \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert S \<F>)

goal (1 subgoal):
 1. S \<in> lmeasurable &&& \<Union> \<F> \<in> lmeasurable &&& pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>
[PROOF STEP]
by (simp_all add: fmeasurable.finite_Union insert.hyps(1) insert.prems(1) pairwise_insert subsetI)
[PROOF STATE]
proof (state)
this:
S \<in> lmeasurable
\<Union> \<F> \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>\<And>S. S \<in> F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) F\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> F) = sum (Sigma_Algebra.measure lebesgue) F; \<And>S. S \<in> insert x F \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert x F)\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> (insert x F)) = sum (Sigma_Algebra.measure lebesgue) (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<in> lmeasurable
\<Union> \<F> \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
S \<in> lmeasurable
\<Union> \<F> \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (insert S \<F>)) = sum (Sigma_Algebra.measure lebesgue) (insert S \<F>)
[PROOF STEP]
proof (simp add: measure_Un3 insert)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<Union> \<F> \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (S \<inter> \<Union> \<F>) = 0
[PROOF STEP]
have *: "\<And>T. T \<in> (\<inter>) S ` \<F> \<Longrightarrow> negligible T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>T. T \<in> (\<inter>) S ` \<F> \<Longrightarrow> negligible T
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite \<F>
S \<notin> \<F>
\<lbrakk>\<And>S. S \<in> \<F> \<Longrightarrow> S \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (\<Union> \<F>) = sum (Sigma_Algebra.measure lebesgue) \<F>
?S \<in> insert S \<F> \<Longrightarrow> ?S \<in> lmeasurable
pairwise (\<lambda>S T. negligible (S \<inter> T)) (insert S \<F>)

goal (1 subgoal):
 1. \<And>T. T \<in> (\<inter>) S ` \<F> \<Longrightarrow> negligible T
[PROOF STEP]
by (force simp: pairwise_def)
[PROOF STATE]
proof (state)
this:
?T \<in> (\<inter>) S ` \<F> \<Longrightarrow> negligible ?T

goal (1 subgoal):
 1. \<lbrakk>\<Union> \<F> \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (S \<inter> \<Union> \<F>) = 0
[PROOF STEP]
have "negligible(S \<inter> \<Union>\<F>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (S \<inter> \<Union> \<F>)
[PROOF STEP]
unfolding Int_Union
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (\<Union> ((\<inter>) S ` \<F>))
[PROOF STEP]
by (rule negligible_Union) (simp_all add: * insert.hyps(1))
[PROOF STATE]
proof (state)
this:
negligible (S \<inter> \<Union> \<F>)

goal (1 subgoal):
 1. \<lbrakk>\<Union> \<F> \<in> lmeasurable; pairwise (\<lambda>S T. negligible (S \<inter> T)) \<F>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure lebesgue (S \<inter> \<Union> \<F>) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
negligible (S \<inter> \<Union> \<F>)
[PROOF STEP]
show "measure lebesgue (S \<inter> \<Union>\<F>) = 0"
[PROOF STATE]
proof (prove)
using this:
negligible (S \<inter> \<Union> \<F>)

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (S \<inter> \<Union> \<F>) = 0
[PROOF STEP]
using negligible_imp_measure0
[PROOF STATE]
proof (prove)
using this:
negligible (S \<inter> \<Union> \<F>)
negligible ?S \<Longrightarrow> Sigma_Algebra.measure lebesgue ?S = 0

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (S \<inter> \<Union> \<F>) = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (S \<inter> \<Union> \<F>) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (\<Union> (insert S \<F>)) = sum (Sigma_Algebra.measure lebesgue) (insert S \<F>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennreal_SUP_add:
  fixes f g :: "nat \<Rightarrow> ennreal"
  shows "incseq f \<Longrightarrow> incseq g \<Longrightarrow> (SUP i. f i + g i) = Sup (f ` UNIV) + Sup (g ` UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>incseq f; incseq g\<rbrakk> \<Longrightarrow> (SUP i. f i + g i) = Sup (range f) + Sup (range g)
[PROOF STEP]
unfolding incseq_def le_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>m n. m \<le> n \<longrightarrow> f m \<le> f n; \<forall>m n. m \<le> n \<longrightarrow> g m \<le> g n\<rbrakk> \<Longrightarrow> (SUP i. f i + g i) = Sup (range f) + Sup (range g)
[PROOF STEP]
by transfer
     (simp add: SUP_ereal_add incseq_def le_fun_def max_absorb2 SUP_upper2)


[STATEMENT]
lemma tan_altdef: "tan x = inverse (cot x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan x = inverse (cot x)
[PROOF STEP]
by (simp add: cot_def tan_def)


[STATEMENT]
lemma set_plus_closed : "A \<subseteq> G \<Longrightarrow> B \<subseteq> G \<Longrightarrow> A + B \<subseteq> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> G; B \<subseteq> G\<rbrakk> \<Longrightarrow> A + B \<subseteq> G
[PROOF STEP]
using set_plus_def[of A B] add_closed
[PROOF STATE]
proof (prove)
using this:
A + B = {c. \<exists>a\<in>A. \<exists>b\<in>B. c = a + b}
\<lbrakk>?g \<in> G; ?h \<in> G\<rbrakk> \<Longrightarrow> ?g + ?h \<in> G

goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> G; B \<subseteq> G\<rbrakk> \<Longrightarrow> A + B \<subseteq> G
[PROOF STEP]
by force


[STATEMENT]
lemma cot_zero [simp]: "cot 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot (0::'a) = (0::'a)
[PROOF STEP]
by (simp add: cot_def)


[STATEMENT]
lemma preserve_mat_inter_num:
  assumes "inj_on_01_hom f"
  assumes "j1 < dim_col M" "j2 < dim_col M"
  shows "mat_inter_num M j1 j2 = mat_inter_num (map_mat f M) j1 j2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_inter_num M j1 j2 = mat_inter_num (map_mat f M) j1 j2
[PROOF STEP]
unfolding mat_inter_num_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i < dim_row M \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} = card {i. i < dim_row (map_mat f M) \<and> map_mat f M $$ (i, j1) = (1::'a) \<and> map_mat f M $$ (i, j2) = (1::'a)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj_on_01_hom f
j1 < dim_col M
j2 < dim_col M

goal (1 subgoal):
 1. card {i. i < dim_row M \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} = card {i. i < dim_row (map_mat f M) \<and> map_mat f M $$ (i, j1) = (1::'a) \<and> map_mat f M $$ (i, j2) = (1::'a)}
[PROOF STEP]
by (metis (no_types, opaque_lifting) index_map_mat(2) inj_on_01_hom_index(1))


[STATEMENT]
lemma space_lborel_f: "space (lborel_f n) = Pi\<^sub>E {..<n} (\<lambda>_. UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (lborel_f n) = {..<n} \<rightarrow>\<^sub>E UNIV
[PROOF STEP]
unfolding lborel_f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (Pi\<^sub>M {..<n} (\<lambda>b. lborel)) = {..<n} \<rightarrow>\<^sub>E UNIV
[PROOF STEP]
unfolding space_PiM space_lborel space_borel
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<n} \<rightarrow>\<^sub>E UNIV = {..<n} \<rightarrow>\<^sub>E UNIV
[PROOF STEP]
by metis


[STATEMENT]
lemma ereal_INF_cmult: "0 < c \<Longrightarrow> (INF i\<in>I. c * f i) = ereal c * (INF i\<in>I. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < c \<Longrightarrow> (\<Sqinter>i\<in>I. ereal c * f i) = ereal c * \<Sqinter> (f ` I)
[PROOF STEP]
using ereal_Inf_cmult[where P="\<lambda>x. \<exists>i\<in>I. x = f i", of c]
[PROOF STATE]
proof (prove)
using this:
0 < c \<Longrightarrow> \<Sqinter> {ereal c * x |x. \<exists>i\<in>I. x = f i} = ereal c * \<Sqinter> {x. \<exists>i\<in>I. x = f i}

goal (1 subgoal):
 1. 0 < c \<Longrightarrow> (\<Sqinter>i\<in>I. ereal c * f i) = ereal c * \<Sqinter> (f ` I)
[PROOF STEP]
by(rule box_equals)(auto intro!: arg_cong[where f="Inf"] arg_cong2[where f="(*)"])


[STATEMENT]
lemma has_derivative_inverse[simp, derivative_intros]:
  fixes f :: "_ \<Rightarrow> 'a::real_normed_div_algebra"
  assumes x:  "f x \<noteq> 0"
    and f: "(f has_derivative f') (at x within S)"
  shows "((\<lambda>x. inverse (f x)) has_derivative (\<lambda>h. - (inverse (f x) * f' h * inverse (f x))))
    (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) has_derivative (\<lambda>h. - (inverse (f x) * f' h * inverse (f x)))) (at x within S)
[PROOF STEP]
using has_derivative_compose[OF f has_derivative_inverse', OF x]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (f x)) has_derivative (\<lambda>xa. - (inverse (f x) * f' xa * inverse (f x)))) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) has_derivative (\<lambda>h. - (inverse (f x) * f' h * inverse (f x)))) (at x within S)
[PROOF STEP]
.


[STATEMENT]
lemma upset_anti_iff: "(\<up>y \<subseteq> \<up>x) = (x \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<up> y \<subseteq> \<up> x) = (x \<le> y)
[PROOF STEP]
by (simp add: dual_preorder.downset_iso_iff dual_upset)


[STATEMENT]
lemma has_integral_component_lbound:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "(f has_integral i) (cbox a b)"
    and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k"
    and "k \<in> Basis"
  shows "B * content (cbox a b) \<le> i\<bullet>k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * content (cbox a b) \<le> i \<bullet> k
[PROOF STEP]
using has_integral_component_le[OF assms(3) has_integral_const assms(1),of "(\<Sum>i\<in>Basis. B *\<^sub>R i)::'b"] assms(2-)
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> cbox a b \<Longrightarrow> sum ((*\<^sub>R) B) Basis \<bullet> k \<le> f x \<bullet> k) \<Longrightarrow> content (cbox a b) *\<^sub>R sum ((*\<^sub>R) B) Basis \<bullet> k \<le> i \<bullet> k
\<forall>x\<in>cbox a b. B \<le> f x \<bullet> k
k \<in> Basis

goal (1 subgoal):
 1. B * content (cbox a b) \<le> i \<bullet> k
[PROOF STEP]
by (auto simp add: field_simps)


[STATEMENT]
lemma rel_language_alt:
  "rel_language R L K = rel_fun (list_all2 R) (=) (in_language L) (in_language K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_language R L K = rel_fun (list_all2 R) (=) (in_language L) (in_language K)
[PROOF STEP]
unfolding rel_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_language R L K = (\<forall>x y. list_all2 R x y \<longrightarrow> in_language L x = in_language K y)
[PROOF STEP]
proof (rule iffI, safe del: iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>rel_language R L K; list_all2 R x y\<rbrakk> \<Longrightarrow> in_language L x = in_language K y
 2. \<forall>x y. list_all2 R x y \<longrightarrow> in_language L x = in_language K y \<Longrightarrow> rel_language R L K
[PROOF STEP]
fix xs ys
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>rel_language R L K; list_all2 R x y\<rbrakk> \<Longrightarrow> in_language L x = in_language K y
 2. \<forall>x y. list_all2 R x y \<longrightarrow> in_language L x = in_language K y \<Longrightarrow> rel_language R L K
[PROOF STEP]
assume "list_all2 R xs ys" "rel_language R L K"
[PROOF STATE]
proof (state)
this:
list_all2 R xs ys
rel_language R L K

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>rel_language R L K; list_all2 R x y\<rbrakk> \<Longrightarrow> in_language L x = in_language K y
 2. \<forall>x y. list_all2 R x y \<longrightarrow> in_language L x = in_language K y \<Longrightarrow> rel_language R L K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_all2 R xs ys
rel_language R L K
[PROOF STEP]
show "in_language L xs = in_language K ys"
[PROOF STATE]
proof (prove)
using this:
list_all2 R xs ys
rel_language R L K

goal (1 subgoal):
 1. in_language L xs = in_language K ys
[PROOF STEP]
by (induct xs ys arbitrary: L K) (auto del: iffI elim: rel_language.cases)
[PROOF STATE]
proof (state)
this:
in_language L xs = in_language K ys

goal (1 subgoal):
 1. \<forall>x y. list_all2 R x y \<longrightarrow> in_language L x = in_language K y \<Longrightarrow> rel_language R L K
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x y. list_all2 R x y \<longrightarrow> in_language L x = in_language K y \<Longrightarrow> rel_language R L K
[PROOF STEP]
assume "\<forall>xs ys. list_all2 R xs ys \<longrightarrow> in_language L xs = in_language K ys"
[PROOF STATE]
proof (state)
this:
\<forall>xs ys. list_all2 R xs ys \<longrightarrow> in_language L xs = in_language K ys

goal (1 subgoal):
 1. \<forall>x y. list_all2 R x y \<longrightarrow> in_language L x = in_language K y \<Longrightarrow> rel_language R L K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>xs ys. list_all2 R xs ys \<longrightarrow> in_language L xs = in_language K ys
[PROOF STEP]
show "rel_language R L K"
[PROOF STATE]
proof (prove)
using this:
\<forall>xs ys. list_all2 R xs ys \<longrightarrow> in_language L xs = in_language K ys

goal (1 subgoal):
 1. rel_language R L K
[PROOF STEP]
by (coinduction arbitrary: L K) (auto dest: spec2)
[PROOF STATE]
proof (state)
this:
rel_language R L K

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma countable_Un_iff[simp]: "countable (A \<union> B) \<longleftrightarrow> countable A \<and> countable B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (A \<union> B) = (countable A \<and> countable B)
[PROOF STEP]
by (metis countable_Un countable_subset inf_sup_ord(3,4))


[STATEMENT]
lemma I_XpZ_spectrum:
  shows "{Re x |x. x \<in> spectrum I_XpZ} \<subseteq> {- 1, 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Re x |x. x \<in> spectrum I_XpZ} \<subseteq> {- 1, 1}
[PROOF STEP]
using unitary_hermitian_Re_spectrum
    I_XpZ_hermitian I_XpZ_unitary I_XpZ_carrier
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Complex_Matrix.unitary ?U; hermitian ?U; ?U \<in> carrier_mat ?n ?n; 0 < ?n\<rbrakk> \<Longrightarrow> {Re x |x. x \<in> spectrum ?U} \<subseteq> {- 1, 1}
hermitian I_XpZ
Complex_Matrix.unitary I_XpZ
I_XpZ \<in> carrier_mat 4 4

goal (1 subgoal):
 1. {Re x |x. x \<in> spectrum I_XpZ} \<subseteq> {- 1, 1}
[PROOF STEP]
by simp


[STATEMENT]
lemma take_rows_and_take_cols:  "(take_rows_from_matrix M r) = (take_cols_from_matrix M\<^sup>T r)\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_rows_from_matrix M r = (take_cols_from_matrix M\<^sup>T r)\<^sup>T
[PROOF STEP]
unfolding take_rows_from_matrix_def take_cols_from_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows (dim_col M) (take_indices (rows M) r) = (mat_of_cols (dim_row M\<^sup>T) (take_indices (cols M\<^sup>T) r))\<^sup>T
[PROOF STEP]
using transpose_carrier_mat rows_and_cols_transpose
[PROOF STATE]
proof (prove)
using this:
(?A\<^sup>T \<in> carrier_mat ?nc ?nr) = (?A \<in> carrier_mat ?nr ?nc)
rows ?M = cols ?M\<^sup>T

goal (1 subgoal):
 1. mat_of_rows (dim_col M) (take_indices (rows M) r) = (mat_of_cols (dim_row M\<^sup>T) (take_indices (cols M\<^sup>T) r))\<^sup>T
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows (dim_col M) (take_indices (rows M) r) = (mat_of_cols (dim_col M) (take_indices (rows M) r))\<^sup>T
[PROOF STEP]
by (simp add: transpose_mat_of_cols)


[STATEMENT]
theorem FP_preserves_set_closure_property:
  assumes "monotonic f"
      and "\<And>\<Delta>. set_closure_property S \<Delta> \<Longrightarrow> set_closure_property S (f \<Delta>)"
    shows "set_closure_property S (GFP f)"
      and "set_closure_property S (LFP f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_closure_property S (GFP f) &&& set_closure_property S (LFP f)
[PROOF STEP]
apply (metis GFP_preserves_set_closure_property_aux assms(1) assms(2) mono_same same_GFP set_closure_prop_empty_all(2))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_closure_property S (LFP f)
[PROOF STEP]
by (metis LFP_preserves_set_closure_property_aux LFP_same assms(1) assms(2) set_closure_prop_empty_all(1))


[STATEMENT]
lemma vector_derivative_mult_at [simp]:
  fixes f g :: "real \<Rightarrow> 'a :: real_normed_algebra"
  shows  "\<lbrakk>f differentiable at a; g differentiable at a\<rbrakk>
   \<Longrightarrow> vector_derivative (\<lambda>x. f x * g x) (at a) = f a * vector_derivative g (at a) + vector_derivative f (at a) * g a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at a; g differentiable at a\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. f x * g x) (at a) = f a * vector_derivative g (at a) + vector_derivative f (at a) * g a
[PROOF STEP]
by (simp add: vector_derivative_at has_vector_derivative_mult vector_derivative_works [symmetric])


[STATEMENT]
lemma rcis_mult: "rcis r1 a * rcis r2 b = rcis (r1 * r2) (a + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rcis r1 a * rcis r2 b = rcis (r1 * r2) (a + b)
[PROOF STEP]
by (simp add: rcis_def cis_mult)


[STATEMENT]
lemma homology_exactness_reduced_1:
  assumes "topspace X \<inter> S \<noteq> {}"
  shows  "exact_seq([reduced_homology_group(p - 1) (subtopology X S),
                     relative_homology_group p X S,
                     reduced_homology_group p X],
                    [hom_boundary p X S, hom_induced p X {} X S id])"
    (is "exact_seq ([?G1,?G2,?G3], [?h1,?h2])")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exact_seq ([reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S, reduced_homology_group p X], [hom_boundary p X S, hom_induced p X {} X S id])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. exact_seq ([reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S, reduced_homology_group p X], [hom_boundary p X S, hom_induced p X {} X S id])
[PROOF STEP]
have *: "?h2 ` carrier (homology_group p X)
         = kernel ?G2 (homology_group (p - 1) (subtopology X S)) ?h1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_induced p X {} X S id ` carrier (homology_group p X) = kernel (relative_homology_group p X S) (homology_group (p - 1) (subtopology X S)) (hom_boundary p X S)
[PROOF STEP]
using homology_exactness_axiom_1 [of p X S]
[PROOF STATE]
proof (prove)
using this:
exact_seq ([homology_group (p - 1) (subtopology X S), relative_homology_group p X S, homology_group p X], [hom_boundary p X S, hom_induced p X {} X S id])

goal (1 subgoal):
 1. hom_induced p X {} X S id ` carrier (homology_group p X) = kernel (relative_homology_group p X S) (homology_group (p - 1) (subtopology X S)) (hom_boundary p X S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
hom_induced p X {} X S id ` carrier (homology_group p X) = kernel (relative_homology_group p X S) (homology_group (p - 1) (subtopology X S)) (hom_boundary p X S)

goal (1 subgoal):
 1. exact_seq ([reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S, reduced_homology_group p X], [hom_boundary p X S, hom_induced p X {} X S id])
[PROOF STEP]
have gh: "group_hom ?G3 ?G2 ?h2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. group_hom (reduced_homology_group p X) (relative_homology_group p X S) (hom_induced p X {} X S id)
[PROOF STEP]
by (simp add: reduced_homology_group_def group_hom_def group_hom_axioms_def
      group.group_subgroup_generated group.hom_from_subgroup_generated hom_induced_hom)
[PROOF STATE]
proof (state)
this:
group_hom (reduced_homology_group p X) (relative_homology_group p X S) (hom_induced p X {} X S id)

goal (1 subgoal):
 1. exact_seq ([reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S, reduced_homology_group p X], [hom_boundary p X S, hom_induced p X {} X S id])
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exact_seq ([reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S, reduced_homology_group p X], [hom_boundary p X S, hom_induced p X {} X S id])
[PROOF STEP]
apply (simp add: hom_boundary_reduced_hom gh * image_reduced_homology_group [OF assms])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel (relative_homology_group p X S) (reduced_homology_group (p - 1) (subtopology X S)) (hom_boundary p X S) = kernel (relative_homology_group p X S) (homology_group (p - 1) (subtopology X S)) (hom_boundary p X S)
[PROOF STEP]
apply (simp add: kernel_def one_reduced_homology_group)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
exact_seq ([reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S, reduced_homology_group p X], [hom_boundary p X S, hom_induced p X {} X S id])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma factor_sum_cubes: "(x::int)^3 + y^3 = (x+y)*(x^2 - x*y + y^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 3 + y ^ 3 = (x + y) * (x\<^sup>2 - x * y + y\<^sup>2)
[PROOF STEP]
by (simp add: eval_nat_numeral field_simps)


[STATEMENT]
lemma norm_le_l1_cart: "norm x \<le> sum(\<lambda>i. \<bar>x$i\<bar>) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x \<le> (\<Sum>i\<in>UNIV. \<bar>x $ i\<bar>)
[PROOF STEP]
by (simp add: norm_vec_def L2_set_le_sum)


[STATEMENT]
lemma less_imp_inverse_less:
  assumes less: "a < b" and apos:  "0 < a"
  shows "inverse b < inverse a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse b < inverse a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b
(0::'a) < a

goal (1 subgoal):
 1. inverse b < inverse a
[PROOF STEP]
by (metis local.dual_order.strict_iff_order
      local.inverse_inverse_eq local.inverse_le_imp_le local.positive_imp_inverse_positive)


[STATEMENT]
lemma nth_prime_partition:
  assumes "x \<ge> 2"
  shows   "\<exists>k. x \<in> {nth_prime k..<nth_prime (Suc k)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. x \<in> {nth_prime k..<nth_prime (Suc k)}
[PROOF STEP]
using strict_mono_sequence_partition[OF strict_mono_nth_prime, of x] assms nth_prime_at_top
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>nth_prime 0 \<le> x; filterlim nth_prime sequentially sequentially\<rbrakk> \<Longrightarrow> \<exists>k. x \<in> {nth_prime k..<nth_prime (Suc k)}
2 \<le> x
filterlim nth_prime sequentially sequentially

goal (1 subgoal):
 1. \<exists>k. x \<in> {nth_prime k..<nth_prime (Suc k)}
[PROOF STEP]
by simp


[STATEMENT]
lemma interval_empty_iff: "{y. x < y \<and> y < z} = {} \<longleftrightarrow> \<not> x < z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({y. x < y \<and> y < z} = {}) = (\<not> x < z)
[PROOF STEP]
by (auto dest: dense)


[STATEMENT]
lemma smult_indexed_Ints_vec: "x \<in> \<int> \<Longrightarrow> v \<in> indexed_Ints_vec I \<Longrightarrow> x \<cdot>\<^sub>v v \<in> indexed_Ints_vec I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> \<int>; v \<in> indexed_Ints_vec I\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>v v \<in> indexed_Ints_vec I
[PROOF STEP]
unfolding indexed_Ints_vec_def smult_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> \<int>; v \<in> {x. \<forall>i<dim_vec x. i \<in> I \<longrightarrow> x $ i \<in> \<int>}\<rbrakk> \<Longrightarrow> vec (dim_vec v) (\<lambda>i. x * v $ i) \<in> {x. \<forall>i<dim_vec x. i \<in> I \<longrightarrow> x $ i \<in> \<int>}
[PROOF STEP]
by simp


[STATEMENT]
lemma idiv_self: "\<lbrakk> 0 < (n::enat); n \<noteq> \<infinity> \<rbrakk> \<Longrightarrow> n div n = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; n \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> n div n = 1
[PROOF STEP]
by (case_tac n, simp_all add: one_enat_def)


[STATEMENT]
lemma rangeSetOfPairs:
  "Range {(fst pair, Y)| Y pair. Y \<in> finestpart (snd pair) & pair \<in> X} =
   {Y. \<exists>x. ((Y \<in> finestpart x) \<and> (x \<in> Range X))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Range {(fst pair, Y) |Y pair. Y \<in> finestpart (snd pair) \<and> pair \<in> X} = {Y. \<exists>x. Y \<in> finestpart x \<and> x \<in> Range X}
[PROOF STEP]
by auto


[STATEMENT]
lemma suminf_minus_initial_segment: "summable f \<Longrightarrow> (\<Sum>n. f (n + k)) = (\<Sum>n. f n) - (\<Sum>i<k. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<Sum>n. f (n + k)) = (\<Sum>n. f n) - sum f {..<k}
[PROOF STEP]
by (rule sums_unique[symmetric]) (auto simp: sums_iff_shift)


[STATEMENT]
lemma convex_hull_3_alt:
  "convex hull {a,b,c} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) | u v.  0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull {a, b, c} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) |u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex hull {a, b, c} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) |u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}
[PROOF STEP]
have *: "\<And>x y z ::real. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. (x + y + z = 1) = (x = 1 - y - z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(?x + ?y + ?z = 1) = (?x = 1 - ?y - ?z)

goal (1 subgoal):
 1. convex hull {a, b, c} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) |u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull {a, b, c} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) |u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}
[PROOF STEP]
unfolding convex_hull_3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c |u v w. 0 \<le> u \<and> 0 \<le> v \<and> 0 \<le> w \<and> u + v + w = 1} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) |u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}
[PROOF STEP]
apply (auto simp: *)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>v w. \<lbrakk>w \<le> 1 - v; 0 \<le> v; 0 \<le> w\<rbrakk> \<Longrightarrow> \<exists>u va. (1 - v - w) *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c = a + u *\<^sub>R (b - a) + va *\<^sub>R (c - a) \<and> 0 \<le> u \<and> 0 \<le> va \<and> u + va \<le> 1
 2. \<And>u v. \<lbrakk>0 \<le> u; 0 \<le> v; u + v \<le> 1\<rbrakk> \<Longrightarrow> \<exists>va w. a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) = (1 - va - w) *\<^sub>R a + va *\<^sub>R b + w *\<^sub>R c \<and> w \<le> 1 - va \<and> 0 \<le> va \<and> 0 \<le> w
[PROOF STEP]
apply (rule_tac x=v in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>v w. \<lbrakk>w \<le> 1 - v; 0 \<le> v; 0 \<le> w\<rbrakk> \<Longrightarrow> \<exists>va. (1 - v - w) *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c = a + v *\<^sub>R (b - a) + va *\<^sub>R (c - a) \<and> 0 \<le> v \<and> 0 \<le> va \<and> v + va \<le> 1
 2. \<And>u v. \<lbrakk>0 \<le> u; 0 \<le> v; u + v \<le> 1\<rbrakk> \<Longrightarrow> \<exists>va w. a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) = (1 - va - w) *\<^sub>R a + va *\<^sub>R b + w *\<^sub>R c \<and> w \<le> 1 - va \<and> 0 \<le> va \<and> 0 \<le> w
[PROOF STEP]
apply (rule_tac x=w in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>v w. \<lbrakk>w \<le> 1 - v; 0 \<le> v; 0 \<le> w\<rbrakk> \<Longrightarrow> (1 - v - w) *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c = a + v *\<^sub>R (b - a) + w *\<^sub>R (c - a) \<and> 0 \<le> v \<and> 0 \<le> w \<and> v + w \<le> 1
 2. \<And>u v. \<lbrakk>0 \<le> u; 0 \<le> v; u + v \<le> 1\<rbrakk> \<Longrightarrow> \<exists>va w. a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) = (1 - va - w) *\<^sub>R a + va *\<^sub>R b + w *\<^sub>R c \<and> w \<le> 1 - va \<and> 0 \<le> va \<and> 0 \<le> w
[PROOF STEP]
apply (simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v. \<lbrakk>0 \<le> u; 0 \<le> v; u + v \<le> 1\<rbrakk> \<Longrightarrow> \<exists>va w. a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) = (1 - va - w) *\<^sub>R a + va *\<^sub>R b + w *\<^sub>R c \<and> w \<le> 1 - va \<and> 0 \<le> va \<and> 0 \<le> w
[PROOF STEP]
apply (rule_tac x=u in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v. \<lbrakk>0 \<le> u; 0 \<le> v; u + v \<le> 1\<rbrakk> \<Longrightarrow> \<exists>w. a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) = (1 - u - w) *\<^sub>R a + u *\<^sub>R b + w *\<^sub>R c \<and> w \<le> 1 - u \<and> 0 \<le> u \<and> 0 \<le> w
[PROOF STEP]
apply (rule_tac x=v in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v. \<lbrakk>0 \<le> u; 0 \<le> v; u + v \<le> 1\<rbrakk> \<Longrightarrow> a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) = (1 - u - v) *\<^sub>R a + u *\<^sub>R b + v *\<^sub>R c \<and> v \<le> 1 - u \<and> 0 \<le> u \<and> 0 \<le> v
[PROOF STEP]
apply (simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
convex hull {a, b, c} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) |u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_split_nat_ivl:
  "a \<le> Suc j \<Longrightarrow> j \<le> b \<Longrightarrow> sum f {a..j} + sum f {Suc j..b} = sum f {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> Suc j; j \<le> b\<rbrakk> \<Longrightarrow> sum f {a..j} + sum f {Suc j..b} = sum f {a..b}
[PROOF STEP]
by (metis Suc_eq_plus1 le_Suc_ex sum.ub_add_nat)


[STATEMENT]
lemma
  inorder_isempty: "invar t \<Longrightarrow> is_empty t \<longleftrightarrow> inorder t = []"
  and inorder_getmin: "\<lbrakk>invar t; inorder t \<noteq> []; getmin t = (a,b)\<rbrakk>
        \<Longrightarrow> is_min2 (a,b) (set (inorder t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (invar t \<Longrightarrow> is_empty t = (inorder t = [])) &&& (\<lbrakk>invar t; inorder t \<noteq> []; getmin t = (a, b)\<rbrakk> \<Longrightarrow> is_min2 (a, b) (set (inorder t)))
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inv t \<and> sorted1 (inorder t) \<Longrightarrow> is_empty t = (inorder t = [])) &&& (\<lbrakk>inv t \<and> sorted1 (inorder t); inorder t \<noteq> []; getmin t = (a, b)\<rbrakk> \<Longrightarrow> is_min2 (a, b) (set (inorder t)))
[PROOF STEP]
by (auto simp: inorder_isempty' inorder_getmin')


[STATEMENT]
lemma sym_div_code[code]:
  "sym_div x y = (let yy = integer_of_int y in
     (case divmod_integer (integer_of_int x) yy
     of (d, m) \<Rightarrow> if m + m \<le> yy then int_of_integer d else (int_of_integer (d + 1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x symdiv y = (let yy = integer_of_int y in case divmod_integer (integer_of_int x) yy of (d, m) \<Rightarrow> if m + m \<le> yy then int_of_integer d else int_of_integer (d + 1))
[PROOF STEP]
unfolding sym_div_def Let_def divmod_integer_def split
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x mod y + x mod y \<le> y then x div y else x div y + 1) = (if integer_of_int x mod integer_of_int y + integer_of_int x mod integer_of_int y \<le> integer_of_int y then int_of_integer (integer_of_int x div integer_of_int y) else int_of_integer (integer_of_int x div integer_of_int y + 1))
[PROOF STEP]
apply (rule if_cong, subst of_int_le_iff[symmetric], unfold of_int_add)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (of_int (x mod y) + of_int (x mod y) \<le> of_int y) = (integer_of_int x mod integer_of_int y + integer_of_int x mod integer_of_int y \<le> integer_of_int y)
 2. integer_of_int x mod integer_of_int y + integer_of_int x mod integer_of_int y \<le> integer_of_int y \<Longrightarrow> x div y = int_of_integer (integer_of_int x div integer_of_int y)
 3. \<not> integer_of_int x mod integer_of_int y + integer_of_int x mod integer_of_int y \<le> integer_of_int y \<Longrightarrow> x div y + 1 = int_of_integer (integer_of_int x div integer_of_int y + 1)
[PROOF STEP]
by (subst (1 2) of_int_mod_integer, auto)


[STATEMENT]
lemma has_integral_nonpos:
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
  assumes "(f has_integral i) s"
    and "\<forall>x\<in>s. f x \<le> 0"
  shows "i \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> 0
[PROOF STEP]
by (rule has_integral_nonneg[of "-f" "-i" s, simplified])
    (auto intro!: has_integral_neg simp: fun_Compl_def assms)


[STATEMENT]
lemma circline_set_y_axis:
  shows "circline_set y_axis = of_complex ` {x. is_imag x} \<union> {\<infinity>\<^sub>h}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circline_set y_axis = of_complex ` {x. is_imag x} \<union> {\<infinity>\<^sub>h}
[PROOF STEP]
using on_circline_y_axis
[PROOF STATE]
proof (prove)
using this:
on_circline y_axis ?z = ((\<exists>c. is_imag c \<and> ?z = of_complex c) \<or> ?z = \<infinity>\<^sub>h)

goal (1 subgoal):
 1. circline_set y_axis = of_complex ` {x. is_imag x} \<union> {\<infinity>\<^sub>h}
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
using this:
on_circline y_axis ?z = ((\<exists>c. is_imag c \<and> ?z = of_complex c) \<or> ?z = \<infinity>\<^sub>h)

goal (1 subgoal):
 1. Collect (on_circline y_axis) = of_complex ` {x. is_imag x} \<union> {\<infinity>\<^sub>h}
[PROOF STEP]
by auto


[STATEMENT]
lemma gbinomial_rec: "((a + 1) gchoose (Suc k)) = (a gchoose k) * ((a + 1) / of_nat (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = (a gchoose k) * ((a + (1::'a)) / of_nat (Suc k))
[PROOF STEP]
using gbinomial_mult_1[of a k]
[PROOF STATE]
proof (prove)
using this:
a * (a gchoose k) = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k)

goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = (a gchoose k) * ((a + (1::'a)) / of_nat (Suc k))
[PROOF STEP]
by (subst gbinomial_Suc_Suc) (simp add: field_simps del: of_nat_Suc, simp add: algebra_simps)


[STATEMENT]
lemma inj_on_one_iff':
   "\<lbrakk>h \<in> hom G H; group G; group H\<rbrakk> \<Longrightarrow> inj_on h (carrier G) \<longleftrightarrow> (\<forall>x. x \<in> carrier G \<longrightarrow> h x = one H \<longrightarrow> x = one G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>h \<in> hom G H; Group.group G; Group.group H\<rbrakk> \<Longrightarrow> inj_on h (carrier G) = (\<forall>x. x \<in> carrier G \<longrightarrow> h x = \<one>\<^bsub>H\<^esub> \<longrightarrow> x = \<one>\<^bsub>G\<^esub>)
[PROOF STEP]
using group_hom.inj_on_one_iff group_hom.intro group_hom_axioms.intro
[PROOF STATE]
proof (prove)
using this:
group_hom ?G ?H ?h \<Longrightarrow> inj_on ?h (carrier ?G) = (\<forall>x. x \<in> carrier ?G \<longrightarrow> ?h x = \<one>\<^bsub>?H\<^esub> \<longrightarrow> x = \<one>\<^bsub>?G\<^esub>)
\<lbrakk>Group.group ?G; Group.group ?H; group_hom_axioms ?G ?H ?h\<rbrakk> \<Longrightarrow> group_hom ?G ?H ?h
?h \<in> hom ?G ?H \<Longrightarrow> group_hom_axioms ?G ?H ?h

goal (1 subgoal):
 1. \<lbrakk>h \<in> hom G H; Group.group G; Group.group H\<rbrakk> \<Longrightarrow> inj_on h (carrier G) = (\<forall>x. x \<in> carrier G \<longrightarrow> h x = \<one>\<^bsub>H\<^esub> \<longrightarrow> x = \<one>\<^bsub>G\<^esub>)
[PROOF STEP]
by blast


[STATEMENT]
lemma Basis_le_norm: "b \<in> Basis \<Longrightarrow> \<bar>inner x b\<bar> \<le> norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> Basis \<Longrightarrow> \<bar>inner x b\<bar> \<le> norm x
[PROOF STEP]
by (rule order_trans [OF Cauchy_Schwarz_ineq2]) simp