[STATEMENT]
lemma poly_mult_monom_assoc:
  assumes "set p \<subseteq> carrier R" "set q \<subseteq> carrier R" and "a \<in> carrier R"
    shows "poly_mult (poly_mult (monom a n) p) q =
           poly_mult (monom a n) (poly_mult p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly_mult (poly_mult (local.monom a 0) p) q = poly_mult (local.monom a 0) (poly_mult p q)
 2. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. poly_mult (poly_mult (local.monom a 0) p) q = poly_mult (local.monom a 0) (poly_mult p q)
 2. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult (poly_mult (local.monom a 0) p) q = poly_mult (local.monom a 0) (poly_mult p q)
[PROOF STEP]
unfolding monom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult (poly_mult (a # replicate 0 \<zero>) p) q = poly_mult (a # replicate 0 \<zero>) (poly_mult p q)
[PROOF STEP]
using poly_mult_semiassoc[OF assms]
[PROOF STATE]
proof (prove)
using this:
poly_mult (poly_mult [a] p) q = poly_mult [a] (poly_mult p q)

goal (1 subgoal):
 1. poly_mult (poly_mult (a # replicate 0 \<zero>) p) q = poly_mult (a # replicate 0 \<zero>) (poly_mult p q)
[PROOF STEP]
by (auto simp del: poly_mult.simps)
[PROOF STATE]
proof (state)
this:
poly_mult (poly_mult (local.monom a 0) p) q = poly_mult (local.monom a 0) (poly_mult p q)

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q)

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
have "poly_mult (poly_mult (monom a (Suc n)) p) q =
        poly_mult (normalize ((poly_mult (monom a n) p) @ [ \<zero> ])) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.normalize (poly_mult (local.monom a n) p @ [\<zero>])) q
[PROOF STEP]
using poly_mult_append_zero[OF monom_in_carrier[OF assms(3), of n] assms(1)]
[PROOF STATE]
proof (prove)
using this:
poly_mult (local.monom a n @ [\<zero>]) p = local.normalize (poly_mult (local.monom a n) p @ [\<zero>])

goal (1 subgoal):
 1. poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.normalize (poly_mult (local.monom a n) p @ [\<zero>])) q
[PROOF STEP]
unfolding monom_def
[PROOF STATE]
proof (prove)
using this:
poly_mult ((a # replicate n \<zero>) @ [\<zero>]) p = local.normalize (poly_mult (a # replicate n \<zero>) p @ [\<zero>])

goal (1 subgoal):
 1. poly_mult (poly_mult (a # replicate (Suc n) \<zero>) p) q = poly_mult (local.normalize (poly_mult (a # replicate n \<zero>) p @ [\<zero>])) q
[PROOF STEP]
by (auto simp del: poly_mult.simps simp add: replicate_append_same)
[PROOF STATE]
proof (state)
this:
poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.normalize (poly_mult (local.monom a n) p @ [\<zero>])) q

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.normalize (poly_mult (local.monom a n) p @ [\<zero>])) q

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
have " ... = normalize ((poly_mult (poly_mult (monom a n) p) q) @ [ \<zero> ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult (local.normalize (poly_mult (local.monom a n) p @ [\<zero>])) q = local.normalize (poly_mult (poly_mult (local.monom a n) p) q @ [\<zero>])
[PROOF STEP]
using poly_mult_normalize[OF _ assms(2)] poly_mult_append_zero[OF _ assms(2)]
          poly_mult_in_carrier[OF monom_in_carrier[OF assms(3), of n] assms(1)]
[PROOF STATE]
proof (prove)
using this:
set ?p1.0 \<subseteq> carrier R \<Longrightarrow> poly_mult ?p1.0 q = poly_mult (local.normalize ?p1.0) q
set ?p \<subseteq> carrier R \<Longrightarrow> poly_mult (?p @ [\<zero>]) q = local.normalize (poly_mult ?p q @ [\<zero>])
set (poly_mult (local.monom a n) p) \<subseteq> carrier R

goal (1 subgoal):
 1. poly_mult (local.normalize (poly_mult (local.monom a n) p @ [\<zero>])) q = local.normalize (poly_mult (poly_mult (local.monom a n) p) q @ [\<zero>])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mult (local.normalize (poly_mult (local.monom a n) p @ [\<zero>])) q = local.normalize (poly_mult (poly_mult (local.monom a n) p) q @ [\<zero>])

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_mult (local.normalize (poly_mult (local.monom a n) p @ [\<zero>])) q = local.normalize (poly_mult (poly_mult (local.monom a n) p) q @ [\<zero>])

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
have " ... = normalize ((poly_mult (monom a n) (poly_mult p q)) @ [ \<zero> ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.normalize (poly_mult (poly_mult (local.monom a n) p) q @ [\<zero>]) = local.normalize (poly_mult (local.monom a n) (poly_mult p q) @ [\<zero>])
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q)

goal (1 subgoal):
 1. local.normalize (poly_mult (poly_mult (local.monom a n) p) q @ [\<zero>]) = local.normalize (poly_mult (local.monom a n) (poly_mult p q) @ [\<zero>])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.normalize (poly_mult (poly_mult (local.monom a n) p) q @ [\<zero>]) = local.normalize (poly_mult (local.monom a n) (poly_mult p q) @ [\<zero>])

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.normalize (poly_mult (poly_mult (local.monom a n) p) q @ [\<zero>]) = local.normalize (poly_mult (local.monom a n) (poly_mult p q) @ [\<zero>])

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
have " ... = poly_mult (monom a (Suc n)) (poly_mult p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.normalize (poly_mult (local.monom a n) (poly_mult p q) @ [\<zero>]) = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
using poly_mult_append_zero[OF monom_in_carrier[OF assms(3), of n]
                                   poly_mult_in_carrier[OF assms(1-2)]]
[PROOF STATE]
proof (prove)
using this:
poly_mult (local.monom a n @ [\<zero>]) (poly_mult p q) = local.normalize (poly_mult (local.monom a n) (poly_mult p q) @ [\<zero>])

goal (1 subgoal):
 1. local.normalize (poly_mult (local.monom a n) (poly_mult p q) @ [\<zero>]) = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
unfolding monom_def
[PROOF STATE]
proof (prove)
using this:
poly_mult ((a # replicate n \<zero>) @ [\<zero>]) (poly_mult p q) = local.normalize (poly_mult (a # replicate n \<zero>) (poly_mult p q) @ [\<zero>])

goal (1 subgoal):
 1. local.normalize (poly_mult (a # replicate n \<zero>) (poly_mult p q) @ [\<zero>]) = poly_mult (a # replicate (Suc n) \<zero>) (poly_mult p q)
[PROOF STEP]
by (simp add: replicate_append_same)
[PROOF STATE]
proof (state)
this:
local.normalize (poly_mult (local.monom a n) (poly_mult p q) @ [\<zero>]) = poly_mult (local.monom a (Suc n)) (poly_mult p q)

goal (1 subgoal):
 1. \<And>n. poly_mult (poly_mult (local.monom a n) p) q = poly_mult (local.monom a n) (poly_mult p q) \<Longrightarrow> poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)

goal (1 subgoal):
 1. poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly_mult (poly_mult (local.monom a (Suc n)) p) q = poly_mult (local.monom a (Suc n)) (poly_mult p q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PosOrd_Stars_appendE:
  assumes "Stars (vs @ vs1) :\<sqsubset>val Stars (vs @ vs2)"
  shows "Stars vs1 :\<sqsubset>val Stars vs2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stars vs1 :\<sqsubset>val Stars vs2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Stars (vs @ vs1) :\<sqsubset>val Stars (vs @ vs2)

goal (1 subgoal):
 1. Stars vs1 :\<sqsubset>val Stars vs2
[PROOF STEP]
apply(induct vs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Stars ([] @ vs1) :\<sqsubset>val Stars ([] @ vs2) \<Longrightarrow> Stars vs1 :\<sqsubset>val Stars vs2
 2. \<And>a vs. \<lbrakk>Stars (vs @ vs1) :\<sqsubset>val Stars (vs @ vs2) \<Longrightarrow> Stars vs1 :\<sqsubset>val Stars vs2; Stars ((a # vs) @ vs1) :\<sqsubset>val Stars ((a # vs) @ vs2)\<rbrakk> \<Longrightarrow> Stars vs1 :\<sqsubset>val Stars vs2
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a vs. \<lbrakk>Stars (vs @ vs1) :\<sqsubset>val Stars (vs @ vs2) \<Longrightarrow> Stars vs1 :\<sqsubset>val Stars vs2; Stars ((a # vs) @ vs1) :\<sqsubset>val Stars ((a # vs) @ vs2)\<rbrakk> \<Longrightarrow> Stars vs1 :\<sqsubset>val Stars vs2
[PROOF STEP]
apply(simp add: PosOrd_StarsE2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nth_fst[rule_format]: "length l = n + 1 \<longrightarrow> (l @ [x])!0 = l!0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length l = n + 1 \<longrightarrow> (l @ [x]) ! 0 = l ! 0
[PROOF STEP]
by (induct l, simp_all)


[STATEMENT]
lemma pq_coprime_int: "coprime (int p) (int q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (int p) (int q)
[PROOF STEP]
by (simp add: gcd_int_def pq_coprime)


[STATEMENT]
lemma diffs_equiv:
  fixes x :: "'a::{real_normed_vector,ring_1}"
  shows "summable (\<lambda>n. diffs c n * x^n) \<Longrightarrow>
    (\<lambda>n. of_nat n * c n * x^(n - Suc 0)) sums (\<Sum>n. diffs c n * x^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. diffs c n * x ^ n) \<Longrightarrow> (\<lambda>n. of_nat n * c n * x ^ (n - Suc 0)) sums (\<Sum>n. diffs c n * x ^ n)
[PROOF STEP]
unfolding diffs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. of_nat (Suc n) * c (Suc n) * x ^ n) \<Longrightarrow> (\<lambda>n. of_nat n * c n * x ^ (n - Suc 0)) sums (\<Sum>n. of_nat (Suc n) * c (Suc n) * x ^ n)
[PROOF STEP]
by (simp add: summable_sums sums_Suc_imp)


[STATEMENT]
lemma "((\<lambda>x::real. (root 3 x - 1) / \<bar>sqrt x - 1\<bar>) \<longlongrightarrow> -2 / 3) (at_left 1)"
      "((\<lambda>x::real. (root 3 x - 1) / \<bar>sqrt x - 1\<bar>) \<longlongrightarrow> 2 / 3) (at_right 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (root 3 x - 1) / \<bar>sqrt x - 1\<bar>) \<longlongrightarrow> - 2 / 3) (at_left 1) &&& ((\<lambda>x. (root 3 x - 1) / \<bar>sqrt x - 1\<bar>) \<longlongrightarrow> 2 / 3) (at_right 1)
[PROOF STEP]
by real_asymp+


[STATEMENT]
lemma refl_on_tranclI :
  assumes "refl_on A r"
  shows "refl_on A (trancl r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. refl_on A (r\<^sup>+)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r\<^sup>+ \<subseteq> A \<times> A
 2. \<And>x. x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+
[PROOF STEP]
show "r\<^sup>+ \<subseteq> A \<times> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r\<^sup>+ \<subseteq> A \<times> A
[PROOF STEP]
by( rule trancl_subset_Sigma
        , auto simp: assms[THEN refl_onD1] assms[THEN refl_onD2])
[PROOF STATE]
proof (state)
this:
r\<^sup>+ \<subseteq> A \<times> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+
[PROOF STEP]
show "x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+
[PROOF STEP]
using assms[THEN refl_onD]
[PROOF STATE]
proof (prove)
using this:
?a \<in> A \<Longrightarrow> (?a, ?a) \<in> r

goal (1 subgoal):
 1. x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> A \<Longrightarrow> (?x, ?x) \<in> r\<^sup>+

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in vectorspace) li_le_dim:
  fixes A
  assumes fd: "fin_dim" and c: "A\<subseteq>carrier V" and l: "lin_indpt A"
  shows "finite A" "card A \<le> dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A &&& card A \<le> dim
[PROOF STEP]
proof  -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite A
 2. card A \<le> dim
[PROOF STEP]
from fd c l
[PROOF STATE]
proof (chain)
picking this:
fin_dim
A \<subseteq> carrier V
lin_indpt A
[PROOF STEP]
show fa: "finite A"
[PROOF STATE]
proof (prove)
using this:
fin_dim
A \<subseteq> carrier V
lin_indpt A

goal (1 subgoal):
 1. finite A
[PROOF STEP]
by (intro fin_dim_li_fin, auto)
[PROOF STATE]
proof (state)
this:
finite A

goal (1 subgoal):
 1. card A \<le> dim
[PROOF STEP]
from fd
[PROOF STATE]
proof (chain)
picking this:
fin_dim
[PROOF STEP]
obtain \<beta> where 1: "finite \<beta> \<and> basis \<beta>"
[PROOF STATE]
proof (prove)
using this:
fin_dim

goal (1 subgoal):
 1. (\<And>\<beta>. finite \<beta> \<and> basis \<beta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis finite_basis_exists)
[PROOF STATE]
proof (state)
this:
finite \<beta> \<and> basis \<beta>

goal (1 subgoal):
 1. card A \<le> dim
[PROOF STEP]
from assms fa 1
[PROOF STATE]
proof (chain)
picking this:
fin_dim
A \<subseteq> carrier V
lin_indpt A
finite A
finite \<beta> \<and> basis \<beta>
[PROOF STEP]
have 2: "card A \<le> card \<beta>"
[PROOF STATE]
proof (prove)
using this:
fin_dim
A \<subseteq> carrier V
lin_indpt A
finite A
finite \<beta> \<and> basis \<beta>

goal (1 subgoal):
 1. card A \<le> card \<beta>
[PROOF STEP]
apply (intro li_smaller_than_gen, auto)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>fin_dim; A \<subseteq> carrier V; lin_indpt A; finite A; x \<in> \<beta>; finite \<beta>; basis \<beta>\<rbrakk> \<Longrightarrow> x \<in> carrier V
 2. \<And>x. \<lbrakk>fin_dim; A \<subseteq> carrier V; lin_indpt A; finite A; finite \<beta>; basis \<beta>; x \<in> span \<beta>\<rbrakk> \<Longrightarrow> x \<in> carrier V
 3. \<And>x. \<lbrakk>fin_dim; A \<subseteq> carrier V; lin_indpt A; finite A; finite \<beta>; basis \<beta>; x \<in> carrier V\<rbrakk> \<Longrightarrow> x \<in> span \<beta>
[PROOF STEP]
by (unfold basis_def, auto)
[PROOF STATE]
proof (state)
this:
card A \<le> card \<beta>

goal (1 subgoal):
 1. card A \<le> dim
[PROOF STEP]
from assms 1
[PROOF STATE]
proof (chain)
picking this:
fin_dim
A \<subseteq> carrier V
lin_indpt A
finite \<beta> \<and> basis \<beta>
[PROOF STEP]
have 3: "dim = card \<beta>"
[PROOF STATE]
proof (prove)
using this:
fin_dim
A \<subseteq> carrier V
lin_indpt A
finite \<beta> \<and> basis \<beta>

goal (1 subgoal):
 1. dim = card \<beta>
[PROOF STEP]
by (intro dim_basis, auto)
[PROOF STATE]
proof (state)
this:
dim = card \<beta>

goal (1 subgoal):
 1. card A \<le> dim
[PROOF STEP]
from 2 3
[PROOF STATE]
proof (chain)
picking this:
card A \<le> card \<beta>
dim = card \<beta>
[PROOF STEP]
show "card A \<le> dim"
[PROOF STATE]
proof (prove)
using this:
card A \<le> card \<beta>
dim = card \<beta>

goal (1 subgoal):
 1. card A \<le> dim
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card A \<le> dim

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inc_mat_row_def: "j < length Bs \<Longrightarrow> i < length Vs \<Longrightarrow>
    (row (inc_mat_of Vs Bs) i) $ j = (if (Vs ! i \<in> Bs ! j) then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < length Bs; i < length Vs\<rbrakk> \<Longrightarrow> row (inc_mat_of Vs Bs) i $ j = (if Vs ! i \<in> Bs ! j then 1::'b else (0::'b))
[PROOF STEP]
by (simp add: inc_mat_of_def)


[STATEMENT]
lemma integrable_on_cmult_left:
  assumes "f integrable_on S"
  shows "(\<lambda>x. of_real c * f x) integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. of_real c * f x) integrable_on S
[PROOF STEP]
using integrable_cmul[of f S "of_real c"] assms
[PROOF STATE]
proof (prove)
using this:
f integrable_on S \<Longrightarrow> (\<lambda>x. of_real c *\<^sub>R f x) integrable_on S
f integrable_on S

goal (1 subgoal):
 1. (\<lambda>x. of_real c * f x) integrable_on S
[PROOF STEP]
by (simp add: scaleR_conv_of_real)


[STATEMENT]
lemma div_power_2_float[simp]: "x \<in> float \<Longrightarrow> x / 2^d \<in> float"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> float \<Longrightarrow> x / 2 ^ d \<in> float
[PROOF STEP]
apply (auto simp add: float_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. x = real_of_int m * 2 powr real_of_int e \<Longrightarrow> \<exists>ma ea. real_of_int m * 2 powr real_of_int e / 2 ^ d = real_of_int ma * 2 powr real_of_int ea
[PROOF STEP]
apply hypsubst_thin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. \<exists>ma ea. real_of_int m * 2 powr real_of_int e / 2 ^ d = real_of_int ma * 2 powr real_of_int ea
[PROOF STEP]
apply (rename_tac m e)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. \<exists>ma ea. real_of_int m * 2 powr real_of_int e / 2 ^ d = real_of_int ma * 2 powr real_of_int ea
[PROOF STEP]
apply (rule_tac x="m" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. \<exists>ea. real_of_int m * 2 powr real_of_int e / 2 ^ d = real_of_int m * 2 powr real_of_int ea
[PROOF STEP]
apply (rule_tac x="e - d" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. real_of_int m * 2 powr real_of_int e / 2 ^ d = real_of_int m * 2 powr real_of_int (e - int d)
[PROOF STEP]
apply (simp flip: powr_realpow powr_add add: field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_ereal[simp]: "(\<Sum>x\<in>A. ereal (f x)) = ereal (\<Sum>x\<in>A. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>A. ereal (f x)) = ereal (sum f A)
[PROOF STEP]
proof (cases "finite A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite A \<Longrightarrow> (\<Sum>x\<in>A. ereal (f x)) = ereal (sum f A)
 2. infinite A \<Longrightarrow> (\<Sum>x\<in>A. ereal (f x)) = ereal (sum f A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. finite A \<Longrightarrow> (\<Sum>x\<in>A. ereal (f x)) = ereal (sum f A)
 2. infinite A \<Longrightarrow> (\<Sum>x\<in>A. ereal (f x)) = ereal (sum f A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A

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

goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Sum>x\<in>A. ereal (f x)) = ereal (sum f A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Sum>x\<in>A. ereal (f x)) = ereal (sum f A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite A

goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Sum>x\<in>A. ereal (f x)) = ereal (sum f A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite A

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma truncate_up_eq_zero_iff[simp]: "truncate_up prec x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (truncate_up prec x = 0) = (x = 0)
[PROOF STEP]
by (metis not_less_iff_gr_or_eq truncate_up_less_zero_iff truncate_up_pos truncate_up_zero)


[STATEMENT]
lemma root_cancel1:
  "root (2 * m) ^ (i * (2 * j)) = root m ^ (i * j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)
[PROOF STEP]
have "root (2 * m) ^ (i * (2 * j)) = root (2 * m) ^ (2 * (i * j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root (2 * m) ^ (2 * (i * j))
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root (2 * m) ^ (2 * (i * j))

goal (1 subgoal):
 1. FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root (2 * m) ^ (2 * (i * j))

goal (1 subgoal):
 1. FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)
[PROOF STEP]
have "... = root m ^ (i * j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FFT.root (2 * m) ^ (2 * (i * j)) = FFT.root m ^ (i * j)
[PROOF STEP]
by (simp add: root_cancel)
[PROOF STATE]
proof (state)
this:
FFT.root (2 * m) ^ (2 * (i * j)) = FFT.root m ^ (i * j)

goal (1 subgoal):
 1. FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)

goal (1 subgoal):
 1. FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
FFT.root (2 * m) ^ (i * (2 * j)) = FFT.root m ^ (i * j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_iff:
  "continuous_on s f \<longleftrightarrow>
    (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s f = (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)
[PROOF STEP]
unfolding continuous_on_def Lim_within
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e) = (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)
[PROOF STEP]
by (metis dist_pos_lt dist_self)


[STATEMENT]
lemma norm_matrix_le_mult_op_norm: "\<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>x\<parallel>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
have "\<parallel>A *v x\<parallel> = (\<parallel>A *v sgn x\<parallel>) * (\<parallel>x\<parallel>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> = \<parallel>A *v sgn x\<parallel> * \<parallel>x\<parallel>
[PROOF STEP]
by(simp add: mult_norm_matrix_sgn_eq)
[PROOF STATE]
proof (state)
this:
\<parallel>A *v x\<parallel> = \<parallel>A *v sgn x\<parallel> * \<parallel>x\<parallel>

goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<parallel>A *v x\<parallel> = \<parallel>A *v sgn x\<parallel> * \<parallel>x\<parallel>

goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
have "... \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>x\<parallel>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A *v sgn x\<parallel> * \<parallel>x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
using norm_sgn_le_op_norm[of A]
[PROOF STATE]
proof (prove)
using this:
\<parallel>A *v sgn ?x\<parallel> \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p

goal (1 subgoal):
 1. \<parallel>A *v sgn x\<parallel> * \<parallel>x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
by (simp add: mult_mono')
[PROOF STATE]
proof (state)
this:
\<parallel>A *v sgn x\<parallel> * \<parallel>x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>

goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>

goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<parallel>A *v x\<parallel> \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "rec_BinTree l n (Leaf x) = l x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_BinTree l n (Leaf x) = l x
[PROOF STEP]
nitpick [expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_BinTree l n (Leaf x) = l x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lengthAux:
  fixes xvec :: "name list"
  and   y    :: name
  and   yvec :: "name list"

  assumes "length xvec = length(y#yvec)"

  obtains z zvec where "xvec = z#zvec" and "length zvec = length yvec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z zvec. \<lbrakk>xvec = z # zvec; length zvec = length yvec\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xvec = length (y # yvec)

goal (1 subgoal):
 1. (\<And>z zvec. \<lbrakk>xvec = z # zvec; length zvec = length yvec\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(induct xvec arbitrary: yvec y) auto


[STATEMENT]
lemma Ord_linear: "Ord k \<Longrightarrow> Ord l \<Longrightarrow> k \<in> elts l \<or> k=l \<or> l \<in> elts k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ord k; Ord l\<rbrakk> \<Longrightarrow> k \<in> elts l \<or> k = l \<or> l \<in> elts k
[PROOF STEP]
proof (induct k arbitrary: l rule: Ord_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x l. \<lbrakk>Ord x; \<And>y l. \<lbrakk>y \<in> elts x; Ord l\<rbrakk> \<Longrightarrow> y \<in> elts l \<or> y = l \<or> l \<in> elts y; Ord l\<rbrakk> \<Longrightarrow> x \<in> elts l \<or> x = l \<or> l \<in> elts x
[PROOF STEP]
case (step k)
[PROOF STATE]
proof (state)
this:
Ord k
\<lbrakk>?y \<in> elts k; Ord ?l\<rbrakk> \<Longrightarrow> ?y \<in> elts ?l \<or> ?y = ?l \<or> ?l \<in> elts ?y
Ord l

goal (1 subgoal):
 1. \<And>x l. \<lbrakk>Ord x; \<And>y l. \<lbrakk>y \<in> elts x; Ord l\<rbrakk> \<Longrightarrow> y \<in> elts l \<or> y = l \<or> l \<in> elts y; Ord l\<rbrakk> \<Longrightarrow> x \<in> elts l \<or> x = l \<or> l \<in> elts x
[PROOF STEP]
note step_k = step
[PROOF STATE]
proof (state)
this:
Ord k
\<lbrakk>?y \<in> elts k; Ord ?l\<rbrakk> \<Longrightarrow> ?y \<in> elts ?l \<or> ?y = ?l \<or> ?l \<in> elts ?y
Ord l

goal (1 subgoal):
 1. \<And>x l. \<lbrakk>Ord x; \<And>y l. \<lbrakk>y \<in> elts x; Ord l\<rbrakk> \<Longrightarrow> y \<in> elts l \<or> y = l \<or> l \<in> elts y; Ord l\<rbrakk> \<Longrightarrow> x \<in> elts l \<or> x = l \<or> l \<in> elts x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<in> elts l \<or> k = l \<or> l \<in> elts k
[PROOF STEP]
using \<open>Ord l\<close>
[PROOF STATE]
proof (prove)
using this:
Ord l

goal (1 subgoal):
 1. k \<in> elts l \<or> k = l \<or> l \<in> elts k
[PROOF STEP]
proof (induct l rule: Ord_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Ord x; \<And>y. y \<in> elts x \<Longrightarrow> k \<in> elts y \<or> k = y \<or> y \<in> elts k\<rbrakk> \<Longrightarrow> k \<in> elts x \<or> k = x \<or> x \<in> elts k
[PROOF STEP]
case (step l)
[PROOF STATE]
proof (state)
this:
Ord l
?y \<in> elts l \<Longrightarrow> k \<in> elts ?y \<or> k = ?y \<or> ?y \<in> elts k

goal (1 subgoal):
 1. \<And>x. \<lbrakk>Ord x; \<And>y. y \<in> elts x \<Longrightarrow> k \<in> elts y \<or> k = y \<or> y \<in> elts k\<rbrakk> \<Longrightarrow> k \<in> elts x \<or> k = x \<or> x \<in> elts k
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
Ord l
?y \<in> elts l \<Longrightarrow> k \<in> elts ?y \<or> k = ?y \<or> ?y \<in> elts k

goal (1 subgoal):
 1. k \<in> elts l \<or> k = l \<or> l \<in> elts k
[PROOF STEP]
using step_k
[PROOF STATE]
proof (prove)
using this:
Ord l
?y \<in> elts l \<Longrightarrow> k \<in> elts ?y \<or> k = ?y \<or> ?y \<in> elts k
Ord k
\<lbrakk>?y \<in> elts k; Ord ?l\<rbrakk> \<Longrightarrow> ?y \<in> elts ?l \<or> ?y = ?l \<or> ?l \<in> elts ?y
Ord la__

goal (1 subgoal):
 1. k \<in> elts l \<or> k = l \<or> l \<in> elts k
[PROOF STEP]
by (metis Ord_trans V_equalityI)
[PROOF STATE]
proof (state)
this:
k \<in> elts l \<or> k = l \<or> l \<in> elts k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
k \<in> elts l \<or> k = l \<or> l \<in> elts k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma keys_map_scale: "keys ((k::'b::semiring_no_zero_divisors) \<cdot> t) = (if k = 0 then {} else keys t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (k \<cdot> t) = (if k = (0::'b) then {} else keys t)
[PROOF STEP]
proof (split if_split, intro conjI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = (0::'b) \<Longrightarrow> keys (k \<cdot> t) = {}
 2. k \<noteq> (0::'b) \<Longrightarrow> keys (k \<cdot> t) = keys t
[PROOF STEP]
assume "k = 0"
[PROOF STATE]
proof (state)
this:
k = (0::'b)

goal (2 subgoals):
 1. k = (0::'b) \<Longrightarrow> keys (k \<cdot> t) = {}
 2. k \<noteq> (0::'b) \<Longrightarrow> keys (k \<cdot> t) = keys t
[PROOF STEP]
thus "keys (k \<cdot> t) = {}"
[PROOF STATE]
proof (prove)
using this:
k = (0::'b)

goal (1 subgoal):
 1. keys (k \<cdot> t) = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
keys (k \<cdot> t) = {}

goal (1 subgoal):
 1. k \<noteq> (0::'b) \<Longrightarrow> keys (k \<cdot> t) = keys t
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k \<noteq> (0::'b) \<Longrightarrow> keys (k \<cdot> t) = keys t
[PROOF STEP]
assume "k \<noteq> 0"
[PROOF STATE]
proof (state)
this:
k \<noteq> (0::'b)

goal (1 subgoal):
 1. k \<noteq> (0::'b) \<Longrightarrow> keys (k \<cdot> t) = keys t
[PROOF STEP]
show "keys (k \<cdot> t) = keys t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (k \<cdot> t) = keys t
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. keys (k \<cdot> t) \<subseteq> keys t
 2. keys t \<subseteq> keys (k \<cdot> t)
[PROOF STEP]
show "keys t \<subseteq> keys (k \<cdot> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys t \<subseteq> keys (k \<cdot> t)
[PROOF STEP]
by rule (simp add: \<open>k \<noteq> 0\<close> flip: lookup_not_eq_zero_eq_in_keys)
[PROOF STATE]
proof (state)
this:
keys t \<subseteq> keys (k \<cdot> t)

goal (1 subgoal):
 1. keys (k \<cdot> t) \<subseteq> keys t
[PROOF STEP]
qed (fact keys_map_scale_subset)
[PROOF STATE]
proof (state)
this:
keys (k \<cdot> t) = keys t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_bounds_lemma:
  fixes x :: "'a::real_normed_vector"
  assumes "convex_on (cball x e) f"
    and "\<forall>y \<in> cball x e. f y \<le> b" and y: "y \<in> cball x e"
  shows "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
proof (cases "0 \<le> e")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
 2. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 \<le> e

goal (2 subgoals):
 1. 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
 2. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
define z where "z = 2 *\<^sub>R x - y"
[PROOF STATE]
proof (state)
this:
z = 2 *\<^sub>R x - y

goal (2 subgoals):
 1. 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
 2. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
have *: "x - (2 *\<^sub>R x - y) = y - x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - (2 *\<^sub>R x - y) = y - x
[PROOF STEP]
by (simp add: scaleR_2)
[PROOF STATE]
proof (state)
this:
x - (2 *\<^sub>R x - y) = y - x

goal (2 subgoals):
 1. 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
 2. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
have z: "z \<in> cball x e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> cball x e
[PROOF STEP]
using y
[PROOF STATE]
proof (prove)
using this:
y \<in> cball x e

goal (1 subgoal):
 1. z \<in> cball x e
[PROOF STEP]
unfolding z_def mem_cball dist_norm *
[PROOF STATE]
proof (prove)
using this:
norm (x - y) \<le> e

goal (1 subgoal):
 1. norm (y - x) \<le> e
[PROOF STEP]
by (auto simp: norm_minus_commute)
[PROOF STATE]
proof (state)
this:
z \<in> cball x e

goal (2 subgoals):
 1. 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
 2. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
have "(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x
[PROOF STEP]
unfolding z_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R (2 *\<^sub>R x - y) = x
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x

goal (2 subgoals):
 1. 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
 2. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x
[PROOF STEP]
show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>"
[PROOF STATE]
proof (prove)
using this:
(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x

goal (1 subgoal):
 1. \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
using assms(1)[unfolded convex_on_def,rule_format, OF y z, of "1/2" "1/2"]
[PROOF STATE]
proof (prove)
using this:
(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x
\<lbrakk>0 \<le> 1 / 2; 0 \<le> 1 / 2; 1 / 2 + 1 / 2 = 1\<rbrakk> \<Longrightarrow> f ((1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z) \<le> 1 / 2 * f y + 1 / 2 * f z

goal (1 subgoal):
 1. \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
using assms(2)[rule_format,OF y] assms(2)[rule_format,OF z]
[PROOF STATE]
proof (prove)
using this:
(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x
\<lbrakk>0 \<le> 1 / 2; 0 \<le> 1 / 2; 1 / 2 + 1 / 2 = 1\<rbrakk> \<Longrightarrow> f ((1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z) \<le> 1 / 2 * f y + 1 / 2 * f z
f y \<le> b
f z \<le> b

goal (1 subgoal):
 1. \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
by (auto simp:field_simps)
[PROOF STATE]
proof (state)
this:
\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>

goal (1 subgoal):
 1. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> e

goal (1 subgoal):
 1. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
have "dist x y < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y < 0
[PROOF STEP]
using False y
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> e
y \<in> cball x e

goal (1 subgoal):
 1. dist x y < 0
[PROOF STEP]
unfolding mem_cball not_le
[PROOF STATE]
proof (prove)
using this:
e < 0
dist x y \<le> e

goal (1 subgoal):
 1. dist x y < 0
[PROOF STEP]
by (auto simp del: dist_not_less_zero)
[PROOF STATE]
proof (state)
this:
dist x y < 0

goal (1 subgoal):
 1. \<not> 0 \<le> e \<Longrightarrow> \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist x y < 0
[PROOF STEP]
show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>"
[PROOF STATE]
proof (prove)
using this:
dist x y < 0

goal (1 subgoal):
 1. \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
using zero_le_dist[of x y]
[PROOF STATE]
proof (prove)
using this:
dist x y < 0
0 \<le> dist x y

goal (1 subgoal):
 1. \<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subtopology_subtopology:
   "subtopology (subtopology X S) T = subtopology X (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology (subtopology X S) T = subtopology X (S \<inter> T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtopology (subtopology X S) T = subtopology X (S \<inter> T)
[PROOF STEP]
have eq: "\<And>T'. (\<exists>S'. T' = S' \<inter> T \<and> (\<exists>T. openin X T \<and> S' = T \<inter> S)) = (\<exists>Sa. T' = Sa \<inter> (S \<inter> T) \<and> openin X Sa)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>T'. (\<exists>S'. T' = S' \<inter> T \<and> (\<exists>T. openin X T \<and> S' = T \<inter> S)) = (\<exists>Sa. T' = Sa \<inter> (S \<inter> T) \<and> openin X Sa)
[PROOF STEP]
by (metis inf_assoc)
[PROOF STATE]
proof (state)
this:
(\<exists>S'. ?T' = S' \<inter> T \<and> (\<exists>T. openin X T \<and> S' = T \<inter> S)) = (\<exists>Sa. ?T' = Sa \<inter> (S \<inter> T) \<and> openin X Sa)

goal (1 subgoal):
 1. subtopology (subtopology X S) T = subtopology X (S \<inter> T)
[PROOF STEP]
have "subtopology (subtopology X S) T = topology (\<lambda>Ta. \<exists>Sa. Ta = Sa \<inter> T \<and> openin (subtopology X S) Sa)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology (subtopology X S) T = topology (\<lambda>Ta. \<exists>Sa. Ta = Sa \<inter> T \<and> openin (subtopology X S) Sa)
[PROOF STEP]
by (simp add: subtopology_def)
[PROOF STATE]
proof (state)
this:
subtopology (subtopology X S) T = topology (\<lambda>Ta. \<exists>Sa. Ta = Sa \<inter> T \<and> openin (subtopology X S) Sa)

goal (1 subgoal):
 1. subtopology (subtopology X S) T = subtopology X (S \<inter> T)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
subtopology (subtopology X S) T = topology (\<lambda>Ta. \<exists>Sa. Ta = Sa \<inter> T \<and> openin (subtopology X S) Sa)

goal (1 subgoal):
 1. subtopology (subtopology X S) T = subtopology X (S \<inter> T)
[PROOF STEP]
have "\<dots> = subtopology X (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topology (\<lambda>Ta. \<exists>Sa. Ta = Sa \<inter> T \<and> openin (subtopology X S) Sa) = subtopology X (S \<inter> T)
[PROOF STEP]
by (simp add: openin_subtopology eq) (simp add: subtopology_def)
[PROOF STATE]
proof (state)
this:
topology (\<lambda>Ta. \<exists>Sa. Ta = Sa \<inter> T \<and> openin (subtopology X S) Sa) = subtopology X (S \<inter> T)

goal (1 subgoal):
 1. subtopology (subtopology X S) T = subtopology X (S \<inter> T)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
subtopology (subtopology X S) T = subtopology X (S \<inter> T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subtopology (subtopology X S) T = subtopology X (S \<inter> T)

goal (1 subgoal):
 1. subtopology (subtopology X S) T = subtopology X (S \<inter> T)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
subtopology (subtopology X S) T = subtopology X (S \<inter> T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prefix_concat_minus:
  assumes "prefix xs ys"
  shows "xs @ (ys - xs) = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs @ ys - xs = ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prefix xs ys

goal (1 subgoal):
 1. xs @ ys - xs = ys
[PROOF STEP]
by (metis minus_list_def prefix_drop)


[STATEMENT]
lemma zero_less_arctan_iff [simp]: "0 < arctan x \<longleftrightarrow> 0 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < arctan x) = (0 < x)
[PROOF STEP]
using arctan_less_iff [of 0 x]
[PROOF STATE]
proof (prove)
using this:
(arctan 0 < arctan x) = (0 < x)

goal (1 subgoal):
 1. (0 < arctan x) = (0 < x)
[PROOF STEP]
by simp


[STATEMENT]
lemma threeway_partition_code [code]:
  "threeway_partition x [] = ([], [], [])"
  "threeway_partition x (y # ys) =
     (case threeway_partition x ys of (ls, es, gs) \<Rightarrow>
        if y < x then (y # ls, es, gs) else if x = y then (ls, y # es, gs) else (ls, es, y # gs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. threeway_partition x [] = ([], [], []) &&& threeway_partition x (y # ys) = (case threeway_partition x ys of (ls, es, gs) \<Rightarrow> if y < x then (y # ls, es, gs) else if x = y then (ls, y # es, gs) else (ls, es, y # gs))
[PROOF STEP]
by (auto simp: threeway_partition_def)


[STATEMENT]
lemma fds_nth_truncate: "fds_nth (fds_truncate m f) n = (if n \<le> m then fds_nth f n else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (fds_truncate m f) n = (if n \<le> m then fds_nth f n else (0::'a))
[PROOF STEP]
by (simp add: fds_truncate_def fds_nth_fds')


[STATEMENT]
lemma Un_open_segment:
  fixes a :: "'a::euclidean_space"
  assumes "b \<in> open_segment a c"
  shows "open_segment a b \<union> {b} \<union> open_segment b c = open_segment a c" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a b \<union> {b} \<union> open_segment b c = open_segment a c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. open_segment a b \<union> {b} \<union> open_segment b c = open_segment a c
[PROOF STEP]
have b: "b \<in> closed_segment a c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> closed_segment a c
[PROOF STEP]
by (simp add: assms open_closed_segment)
[PROOF STATE]
proof (state)
this:
b \<in> closed_segment a c

goal (1 subgoal):
 1. open_segment a b \<union> {b} \<union> open_segment b c = open_segment a c
[PROOF STEP]
have *: "?rhs \<subseteq> insert b (open_segment a b \<union> open_segment b c)"
          if "{b,c,a} \<union> open_segment a b \<union> open_segment b c = {c,a} \<union> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a c \<subseteq> insert b (open_segment a b \<union> open_segment b c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. open_segment a c \<subseteq> insert b (open_segment a b \<union> open_segment b c)
[PROOF STEP]
have "insert a (insert c (insert b (open_segment a b \<union> open_segment b c))) = insert a (insert c (?rhs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert a (insert c (insert b (open_segment a b \<union> open_segment b c))) = insert a (insert c (open_segment a c))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
{b, c, a} \<union> open_segment a b \<union> open_segment b c = {c, a} \<union> open_segment a c

goal (1 subgoal):
 1. insert a (insert c (insert b (open_segment a b \<union> open_segment b c))) = insert a (insert c (open_segment a c))
[PROOF STEP]
by (simp add: insert_commute)
[PROOF STATE]
proof (state)
this:
insert a (insert c (insert b (open_segment a b \<union> open_segment b c))) = insert a (insert c (open_segment a c))

goal (1 subgoal):
 1. open_segment a c \<subseteq> insert b (open_segment a b \<union> open_segment b c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
insert a (insert c (insert b (open_segment a b \<union> open_segment b c))) = insert a (insert c (open_segment a c))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
insert a (insert c (insert b (open_segment a b \<union> open_segment b c))) = insert a (insert c (open_segment a c))

goal (1 subgoal):
 1. open_segment a c \<subseteq> insert b (open_segment a b \<union> open_segment b c)
[PROOF STEP]
by (metis (no_types) Diff_cancel Diff_eq_empty_iff Diff_insert2 open_segment_def)
[PROOF STATE]
proof (state)
this:
open_segment a c \<subseteq> insert b (open_segment a b \<union> open_segment b c)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{b, c, a} \<union> open_segment a b \<union> open_segment b c = {c, a} \<union> open_segment a c \<Longrightarrow> open_segment a c \<subseteq> insert b (open_segment a b \<union> open_segment b c)

goal (1 subgoal):
 1. open_segment a b \<union> {b} \<union> open_segment b c = open_segment a c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a b \<union> {b} \<union> open_segment b c = open_segment a c
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. open_segment a b \<union> {b} \<union> open_segment b c \<subseteq> open_segment a c
 2. open_segment a c \<subseteq> open_segment a b \<union> {b} \<union> open_segment b c
[PROOF STEP]
show "?lhs \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a b \<union> {b} \<union> open_segment b c \<subseteq> open_segment a c
[PROOF STEP]
by (simp add: assms b subset_open_segment)
[PROOF STATE]
proof (state)
this:
open_segment a b \<union> {b} \<union> open_segment b c \<subseteq> open_segment a c

goal (1 subgoal):
 1. open_segment a c \<subseteq> open_segment a b \<union> {b} \<union> open_segment b c
[PROOF STEP]
show "?rhs \<subseteq> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a c \<subseteq> open_segment a b \<union> {b} \<union> open_segment b c
[PROOF STEP]
using Un_closed_segment [OF b] *
[PROOF STATE]
proof (prove)
using this:
closed_segment a b \<union> closed_segment b c = closed_segment a c
{b, c, a} \<union> open_segment a b \<union> open_segment b c = {c, a} \<union> open_segment a c \<Longrightarrow> open_segment a c \<subseteq> insert b (open_segment a b \<union> open_segment b c)

goal (1 subgoal):
 1. open_segment a c \<subseteq> open_segment a b \<union> {b} \<union> open_segment b c
[PROOF STEP]
by (simp add: closed_segment_eq_open insert_commute)
[PROOF STATE]
proof (state)
this:
open_segment a c \<subseteq> open_segment a b \<union> {b} \<union> open_segment b c

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
open_segment a b \<union> {b} \<union> open_segment b c = open_segment a c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_mult_not_eq_zero_prodI:
  fixes f g :: "'a \<Rightarrow> 'b::semiring_0"
  assumes "finite {a. f a \<noteq> 0}" (is "finite ?F")
  assumes "finite {b. g b \<noteq> 0}" (is "finite ?G")
  shows "finite {(a, b). f a * g b \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(a, b). f a * g b \<noteq> (0::'b)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {(a, b). f a * g b \<noteq> (0::'b)}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite {a. f a \<noteq> (0::'b)}
finite {b. g b \<noteq> (0::'b)}
[PROOF STEP]
have "finite (?F \<times> ?G)"
[PROOF STATE]
proof (prove)
using this:
finite {a. f a \<noteq> (0::'b)}
finite {b. g b \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})

goal (1 subgoal):
 1. finite {(a, b). f a * g b \<noteq> (0::'b)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})
[PROOF STEP]
have "finite {(a, b). f a \<noteq> 0 \<and> g b \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})

goal (1 subgoal):
 1. finite {(a, b). f a \<noteq> (0::'b) \<and> g b \<noteq> (0::'b)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {(a, b). f a \<noteq> (0::'b) \<and> g b \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {(a, b). f a * g b \<noteq> (0::'b)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {(a, b). f a \<noteq> (0::'b) \<and> g b \<noteq> (0::'b)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {(a, b). f a \<noteq> (0::'b) \<and> g b \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {(a, b). f a * g b \<noteq> (0::'b)}
[PROOF STEP]
by (rule rev_finite_subset) auto
[PROOF STATE]
proof (state)
this:
finite {(a, b). f a * g b \<noteq> (0::'b)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integrable_cong:
  "M = N \<Longrightarrow> (\<And>x. x \<in> space N \<Longrightarrow> f x = g x) \<Longrightarrow> integrable M f \<longleftrightarrow> integrable N g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M = N; \<And>x. x \<in> space N \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> integrable M f = integrable N g
[PROOF STEP]
by (simp cong: has_bochner_integral_cong add: integrable.simps)


[STATEMENT]
lemma sorted_wrt_mergesort:
  "sorted_wrt (\<lambda>x y. f x \<le> f y) (mergesort f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (\<lambda>x y. f x \<le> f y) (mergesort f xs)
[PROOF STEP]
by (induction f xs rule: mergesort.induct) (auto simp: split_at_take_drop_conv sorted_merge)


[STATEMENT]
lemma finite_bij_betwI:
  assumes "finite A" "finite B" "inj_on f A" "f \<in> A \<rightarrow> B" "card A = card B"
  shows "bij_betw f A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f A B
[PROOF STEP]
proof (intro bij_betw_imageI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on f A
 2. f ` A = B
[PROOF STEP]
show "inj_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f A
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
inj_on f A

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
show "f ` A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
have "card (f ` A) = card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (f ` A) = card B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
inj_on f A
f \<in> A \<rightarrow> B
card A = card B

goal (1 subgoal):
 1. card (f ` A) = card B
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
card (f ` A) = card B

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (f ` A) = card B

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
have "f ` A \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` A \<subseteq> B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
inj_on f A
f \<in> A \<rightarrow> B
card A = card B

goal (1 subgoal):
 1. f ` A \<subseteq> B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` A \<subseteq> B

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (f ` A) = card B
f ` A \<subseteq> B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (f ` A) = card B
f ` A \<subseteq> B

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card (f ` A) = card B
f ` A \<subseteq> B
finite A
finite B
inj_on f A
f \<in> A \<rightarrow> B
card A = card B

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
by (meson card_subset_eq)
[PROOF STATE]
proof (state)
this:
f ` A = B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ` A = B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inv_lists_succ_eq:
  assumes "distincts xss"
  shows "inv (lists_succ xss) = lists_succ (rev (map rev xss))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv (lists_succ xss) = lists_succ (rev (map rev xss))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inv (lists_succ xss) = lists_succ (rev (map rev xss))
[PROOF STEP]
have *: "\<And>f g. inv (\<lambda>b. f (g b)) = inv (f o g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f g. inv (\<lambda>b. f (g b)) = inv (f \<circ> g)
[PROOF STEP]
by (simp add: o_def)
[PROOF STATE]
proof (state)
this:
inv (\<lambda>b. ?f (?g b)) = inv (?f \<circ> ?g)

goal (1 subgoal):
 1. inv (lists_succ xss) = lists_succ (rev (map rev xss))
[PROOF STEP]
have **: "lists_succ [] = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lists_succ [] = id
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lists_succ [] = id

goal (1 subgoal):
 1. inv (lists_succ xss) = lists_succ (rev (map rev xss))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv (lists_succ xss) = lists_succ (rev (map rev xss))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distincts xss

goal (1 subgoal):
 1. inv (lists_succ xss) = lists_succ (rev (map rev xss))
[PROOF STEP]
by (induct xss) (auto simp: * ** lists_succ_snoc lists_succ_Cons_pf o_inv_distrib
      inv_list_succ_eq distincts_Cons bij_list_succ bij_lists_succ)
[PROOF STATE]
proof (state)
this:
inv (lists_succ xss) = lists_succ (rev (map rev xss))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_idx_nth:
  assumes "i < length xs"
  shows "(map_idx f xs n) ! i = f (xs ! i) (n + i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_idx f xs n ! i = f (xs ! i) (n + i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < length xs

goal (1 subgoal):
 1. map_idx f xs n ! i = f (xs ! i) (n + i)
[PROOF STEP]
by (simp add: map_idx_eq_map2)


[STATEMENT]
lemma not_on_circlepathI:
  assumes "cmod (z-z0) \<noteq> \<bar>r\<bar>"
  shows "z \<notin> path_image (part_circlepath z0 r st tt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> path_image (part_circlepath z0 r st tt)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> z \<notin> path_image (part_circlepath z0 r st tt)"
[PROOF STATE]
proof (state)
this:
\<not> z \<notin> path_image (part_circlepath z0 r st tt)

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> z \<notin> path_image (part_circlepath z0 r st tt)
[PROOF STEP]
have "z\<in>path_image (part_circlepath z0 r st tt)"
[PROOF STATE]
proof (prove)
using this:
\<not> z \<notin> path_image (part_circlepath z0 r st tt)

goal (1 subgoal):
 1. z \<in> path_image (part_circlepath z0 r st tt)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z \<in> path_image (part_circlepath z0 r st tt)

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> path_image (part_circlepath z0 r st tt)
[PROOF STEP]
obtain t where "t\<in>{0..1}" and *:"z = z0 + r * exp (\<i> * (linepath st tt t))"
[PROOF STATE]
proof (prove)
using this:
z \<in> path_image (part_circlepath z0 r st tt)

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>t \<in> {0..1}; z = z0 + complex_of_real r * exp (\<i> * complex_of_real (linepath st tt t))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding path_image_def image_def part_circlepath_def
[PROOF STATE]
proof (prove)
using this:
z \<in> {y. \<exists>x\<in>{0..1}. y = z0 + complex_of_real r * exp (\<i> * complex_of_real (linepath st tt x))}

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>t \<in> {0..1}; z = z0 + complex_of_real r * exp (\<i> * complex_of_real (linepath st tt t))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
t \<in> {0..1}
z = z0 + complex_of_real r * exp (\<i> * complex_of_real (linepath st tt t))

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
define \<theta> where "\<theta> = linepath st tt t"
[PROOF STATE]
proof (state)
this:
\<theta> = linepath st tt t

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<theta> = linepath st tt t
[PROOF STEP]
have "z-z0 = r * exp (\<i> * \<theta>)"
[PROOF STATE]
proof (prove)
using this:
\<theta> = linepath st tt t

goal (1 subgoal):
 1. z - z0 = complex_of_real r * exp (\<i> * complex_of_real \<theta>)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
\<theta> = linepath st tt t
z = z0 + complex_of_real r * exp (\<i> * complex_of_real (linepath st tt t))

goal (1 subgoal):
 1. z - z0 = complex_of_real r * exp (\<i> * complex_of_real \<theta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z - z0 = complex_of_real r * exp (\<i> * complex_of_real \<theta>)

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z - z0 = complex_of_real r * exp (\<i> * complex_of_real \<theta>)
[PROOF STEP]
have "cmod (z-z0) = cmod (r * exp (\<i> * \<theta>))"
[PROOF STATE]
proof (prove)
using this:
z - z0 = complex_of_real r * exp (\<i> * complex_of_real \<theta>)

goal (1 subgoal):
 1. cmod (z - z0) = cmod (complex_of_real r * exp (\<i> * complex_of_real \<theta>))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cmod (z - z0) = cmod (complex_of_real r * exp (\<i> * complex_of_real \<theta>))

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (z - z0) = cmod (complex_of_real r * exp (\<i> * complex_of_real \<theta>))

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = \<bar>r\<bar> * cmod (exp (\<i> * \<theta>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (complex_of_real r * exp (\<i> * complex_of_real \<theta>)) = \<bar>r\<bar> * cmod (exp (\<i> * complex_of_real \<theta>))
[PROOF STEP]
by (simp add: norm_mult)
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real r * exp (\<i> * complex_of_real \<theta>)) = \<bar>r\<bar> * cmod (exp (\<i> * complex_of_real \<theta>))

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real r * exp (\<i> * complex_of_real \<theta>)) = \<bar>r\<bar> * cmod (exp (\<i> * complex_of_real \<theta>))

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = \<bar>r\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>r\<bar> * cmod (exp (\<i> * complex_of_real \<theta>)) = \<bar>r\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>r\<bar> * cmod (exp (\<i> * complex_of_real \<theta>)) = \<bar>r\<bar>

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (z - z0) = \<bar>r\<bar>
[PROOF STEP]
have "cmod (z-z0) = \<bar>r\<bar>"
[PROOF STATE]
proof (prove)
using this:
cmod (z - z0) = \<bar>r\<bar>

goal (1 subgoal):
 1. cmod (z - z0) = \<bar>r\<bar>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cmod (z - z0) = \<bar>r\<bar>

goal (1 subgoal):
 1. \<not> z \<notin> path_image (part_circlepath z0 r st tt) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod (z - z0) = \<bar>r\<bar>
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
cmod (z - z0) = \<bar>r\<bar>

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cmod (z - z0) = \<bar>r\<bar>
cmod (z - z0) \<noteq> \<bar>r\<bar>

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_filter_greater_subset_drop:
  assumes "sorted xs" "i < length xs"
  shows   "{# x \<in># mset xs. x > xs ! i #} \<subseteq># mset (drop (Suc i) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset ((<) (xs ! i)) (mset xs) \<subseteq># mset (drop (Suc i) xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sorted xs
i < length xs

goal (1 subgoal):
 1. filter_mset ((<) (xs ! i)) (mset xs) \<subseteq># mset (drop (Suc i) xs)
[PROOF STEP]
proof (induction xs arbitrary: i rule: list.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. \<lbrakk>sorted []; i < length []\<rbrakk> \<Longrightarrow> filter_mset ((<) ([] ! i)) (mset []) \<subseteq># mset (drop (Suc i) [])
 2. \<And>x1 x2 i. \<lbrakk>\<And>i. \<lbrakk>sorted x2; i < length x2\<rbrakk> \<Longrightarrow> filter_mset ((<) (x2 ! i)) (mset x2) \<subseteq># mset (drop (Suc i) x2); sorted (x1 # x2); i < length (x1 # x2)\<rbrakk> \<Longrightarrow> filter_mset ((<) ((x1 # x2) ! i)) (mset (x1 # x2)) \<subseteq># mset (drop (Suc i) (x1 # x2))
[PROOF STEP]
case (Cons x xs i)
[PROOF STATE]
proof (state)
this:
\<lbrakk>sorted xs; ?i < length xs\<rbrakk> \<Longrightarrow> filter_mset ((<) (xs ! ?i)) (mset xs) \<subseteq># mset (drop (Suc ?i) xs)
sorted (x # xs)
i < length (x # xs)

goal (2 subgoals):
 1. \<And>i. \<lbrakk>sorted []; i < length []\<rbrakk> \<Longrightarrow> filter_mset ((<) ([] ! i)) (mset []) \<subseteq># mset (drop (Suc i) [])
 2. \<And>x1 x2 i. \<lbrakk>\<And>i. \<lbrakk>sorted x2; i < length x2\<rbrakk> \<Longrightarrow> filter_mset ((<) (x2 ! i)) (mset x2) \<subseteq># mset (drop (Suc i) x2); sorted (x1 # x2); i < length (x1 # x2)\<rbrakk> \<Longrightarrow> filter_mset ((<) ((x1 # x2) ! i)) (mset (x1 # x2)) \<subseteq># mset (drop (Suc i) (x1 # x2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
 2. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
 2. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
by (auto simp: sorted_append filter_mset_is_empty_iff)
[PROOF STATE]
proof (state)
this:
filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
case (Suc i')
[PROOF STATE]
proof (state)
this:
i = Suc i'

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
have "{#y \<in># mset (x # xs). y > (x # xs) ! i#} \<subseteq># {#y \<in># mset xs. y > xs ! i'#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># filter_mset ((<) (xs ! i')) (mset xs)
[PROOF STEP]
using Suc Cons.prems
[PROOF STATE]
proof (prove)
using this:
i = Suc i'
sorted (x # xs)
i < length (x # xs)

goal (1 subgoal):
 1. filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># filter_mset ((<) (xs ! i')) (mset xs)
[PROOF STEP]
by (auto simp: set_conv_nth)
[PROOF STATE]
proof (state)
this:
filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># filter_mset ((<) (xs ! i')) (mset xs)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># filter_mset ((<) (xs ! i')) (mset xs)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
have "\<dots> \<subseteq># mset (drop (Suc i') xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset ((<) (xs ! i')) (mset xs) \<subseteq># mset (drop (Suc i') xs)
[PROOF STEP]
using Cons.prems Suc
[PROOF STATE]
proof (prove)
using this:
sorted (x # xs)
i < length (x # xs)
i = Suc i'

goal (1 subgoal):
 1. filter_mset ((<) (xs ! i')) (mset xs) \<subseteq># mset (drop (Suc i') xs)
[PROOF STEP]
by (intro Cons.IH) (auto)
[PROOF STATE]
proof (state)
this:
filter_mset ((<) (xs ! i')) (mset xs) \<subseteq># mset (drop (Suc i') xs)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
filter_mset ((<) (xs ! i')) (mset xs) \<subseteq># mset (drop (Suc i') xs)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
have "\<dots> = mset (drop (Suc i) (x # xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (drop (Suc i') xs) = mset (drop (Suc i) (x # xs))
[PROOF STEP]
by (simp add: Suc)
[PROOF STATE]
proof (state)
this:
mset (drop (Suc i') xs) = mset (drop (Suc i) (x # xs))

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))

goal (1 subgoal):
 1. filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
filter_mset ((<) ((x # xs) ! i)) (mset (x # xs)) \<subseteq># mset (drop (Suc i) (x # xs))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>sorted []; i < length []\<rbrakk> \<Longrightarrow> filter_mset ((<) ([] ! i)) (mset []) \<subseteq># mset (drop (Suc i) [])
[PROOF STEP]
qed auto


[STATEMENT]
lemma sup_isomorphism_ord_isomorphism:
  assumes "sup_homomorphism (f::'a::semilattice_sup \<Rightarrow> 'b::semilattice_sup)"
      and "bij f"
    shows "x \<le> y \<longleftrightarrow> f x \<le> f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y) = (f x \<le> f y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<le> y \<Longrightarrow> f x \<le> f y
 2. f x \<le> f y \<Longrightarrow> x \<le> y
[PROOF STEP]
assume "x \<le> y"
[PROOF STATE]
proof (state)
this:
x \<le> y

goal (2 subgoals):
 1. x \<le> y \<Longrightarrow> f x \<le> f y
 2. f x \<le> f y \<Longrightarrow> x \<le> y
[PROOF STEP]
thus "f x \<le> f y"
[PROOF STATE]
proof (prove)
using this:
x \<le> y

goal (1 subgoal):
 1. f x \<le> f y
[PROOF STEP]
by (metis assms(1) le_iff_sup)
[PROOF STATE]
proof (state)
this:
f x \<le> f y

goal (1 subgoal):
 1. f x \<le> f y \<Longrightarrow> x \<le> y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x \<le> f y \<Longrightarrow> x \<le> y
[PROOF STEP]
assume "f x \<le> f y"
[PROOF STATE]
proof (state)
this:
f x \<le> f y

goal (1 subgoal):
 1. f x \<le> f y \<Longrightarrow> x \<le> y
[PROOF STEP]
hence "f (x \<squnion> y) = f y"
[PROOF STATE]
proof (prove)
using this:
f x \<le> f y

goal (1 subgoal):
 1. f (x \<squnion> y) = f y
[PROOF STEP]
by (simp add: assms(1) le_iff_sup)
[PROOF STATE]
proof (state)
this:
f (x \<squnion> y) = f y

goal (1 subgoal):
 1. f x \<le> f y \<Longrightarrow> x \<le> y
[PROOF STEP]
hence "x \<squnion> y = y"
[PROOF STATE]
proof (prove)
using this:
f (x \<squnion> y) = f y

goal (1 subgoal):
 1. x \<squnion> y = y
[PROOF STEP]
by (metis injD bij_is_inj assms(2))
[PROOF STATE]
proof (state)
this:
x \<squnion> y = y

goal (1 subgoal):
 1. f x \<le> f y \<Longrightarrow> x \<le> y
[PROOF STEP]
thus "x \<le> y"
[PROOF STATE]
proof (prove)
using this:
x \<squnion> y = y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in factorial_monoid) mult_factors_fmset:
  assumes afs: "factors G as a"
    and bfs: "factors G bs b"
    and cfs: "factors G cs (a \<otimes> b)"
    and "set as \<subseteq> carrier G"  "set bs \<subseteq> carrier G"  "set cs \<subseteq> carrier G"
  shows "fmset G cs = fmset G as + fmset G bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmset G cs = fmset G as + fmset G bs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
factors G as a
factors G bs b
factors G cs (a \<otimes> b)
set as \<subseteq> carrier G
set bs \<subseteq> carrier G
set cs \<subseteq> carrier G

goal (1 subgoal):
 1. fmset G cs = fmset G as + fmset G bs
[PROOF STEP]
by (blast intro: factors_wfactors mult_wfactors_fmset)


[STATEMENT]
lemma inverse_bounds_real:
  fixes f l u :: "real \<Rightarrow> real"
  shows "\<forall>x. l x > 0 \<longrightarrow> l x \<le> f x \<longrightarrow> f x \<le> u x \<longrightarrow> inverse (f x) \<in> {inverse (u x)..inverse (l x)}"
    and "\<forall>x. u x < 0 \<longrightarrow> l x \<le> f x \<longrightarrow> f x \<le> u x \<longrightarrow> inverse (f x) \<in> {inverse (u x)..inverse (l x)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. 0 < l x \<longrightarrow> l x \<le> f x \<longrightarrow> f x \<le> u x \<longrightarrow> inverse (f x) \<in> {inverse (u x)..inverse (l x)} &&& \<forall>x. u x < 0 \<longrightarrow> l x \<le> f x \<longrightarrow> f x \<le> u x \<longrightarrow> inverse (f x) \<in> {inverse (u x)..inverse (l x)}
[PROOF STEP]
by (auto simp: field_simps)


[STATEMENT]
lemma frechet_derivative_within_cbox:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
  assumes "\<And>i. i\<in>Basis \<Longrightarrow> a\<bullet>i < b\<bullet>i"
    and "x \<in> cbox a b"
    and "(f has_derivative f') (at x within cbox a b)"
  shows "frechet_derivative f (at x within cbox a b) = f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frechet_derivative f (at x within cbox a b) = f'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i \<in> Basis \<Longrightarrow> a \<bullet> ?i < b \<bullet> ?i
x \<in> cbox a b
(f has_derivative f') (at x within cbox a b)

goal (1 subgoal):
 1. frechet_derivative f (at x within cbox a b) = f'
[PROOF STEP]
by (metis Derivative.differentiableI frechet_derivative_unique_within_closed_interval frechet_derivative_works)


[STATEMENT]
lemma hypext_fun_polyn:
    fixes coef :: "nat \<Rightarrow> 'a :: {real_normed_field}"
      and n :: nat
  assumes "f twice_field_differentiable_at (Base x)"
    shows "(*h* (\<lambda>x. \<Sum>i<n. coef i * (f x)^i)) x = (\<Sum>i<n. (coef i) *\<^sub>H (((*h* f) x)^i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*h* (\<lambda>x. \<Sum>i<n. coef i * f x ^ i)) x = (\<Sum>i<n. coef i *\<^sub>H (*h* f) x ^ i)
[PROOF STEP]
using assms hypext_compose[of f x "\<lambda>x. (\<Sum>i<n. coef i * x^i)"]
[PROOF STATE]
proof (prove)
using this:
f twice_field_differentiable_at Base x
\<lbrakk>f twice_field_differentiable_at Base x; (\<lambda>x. \<Sum>i<n. coef i * x ^ i) twice_field_differentiable_at f (Base x)\<rbrakk> \<Longrightarrow> (*h* (\<lambda>x. \<Sum>i<n. coef i * f x ^ i)) x = (*h* (\<lambda>x. \<Sum>i<n. coef i * x ^ i)) ((*h* f) x)

goal (1 subgoal):
 1. (*h* (\<lambda>x. \<Sum>i<n. coef i * f x ^ i)) x = (\<Sum>i<n. coef i *\<^sub>H (*h* f) x ^ i)
[PROOF STEP]
by (simp add: hypext_polyn)


[STATEMENT]
lemma (in is_functor) op_obj_cf_comma_is_iso_functor:
  assumes "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
  shows "op_obj_cf_comma b \<FF> : op_cat (b \<down>\<^sub>C\<^sub>F \<FF>) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> (op_cf \<FF>) \<^sub>C\<^sub>F\<down> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_obj_cf_comma b \<FF> : op_cat (b \<down>\<^sub>C\<^sub>F \<FF>) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> (op_cf \<FF>) \<^sub>C\<^sub>F\<down> b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. op_obj_cf_comma b \<FF> : op_cat (b \<down>\<^sub>C\<^sub>F \<FF>) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> (op_cf \<FF>) \<^sub>C\<^sub>F\<down> b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
[PROOF STEP]
have cf_const: "cf_const (cat_1 0 0) \<BB> b : cat_1 0 0 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
[PROOF STATE]
proof (prove)
using this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) \<BB> b (\<BB>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : cat_1 []\<^sub>\<circ> []\<^sub>\<circ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (cs_concl cs_simp: cat_cs_simps cs_intro: V_cs_intros cat_cs_intros)
[PROOF STATE]
proof (state)
this:
dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) \<BB> b (\<BB>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : cat_1 []\<^sub>\<circ> []\<^sub>\<circ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. op_obj_cf_comma b \<FF> : op_cat (b \<down>\<^sub>C\<^sub>F \<FF>) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> (op_cf \<FF>) \<^sub>C\<^sub>F\<down> b
[PROOF STEP]
note cat_cf_obj_comma_def =
    is_functor.cat_cf_obj_comma_def[
      OF is_functor_op, unfolded cat_op_simps
      ]
[PROOF STATE]
proof (state)
this:
(op_cf \<FF>) \<^sub>C\<^sub>F\<down> ?b = (op_cf \<FF>) \<^sub>C\<^sub>F\<down>\<^sub>C\<^sub>F (dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) (op_cat \<BB>) ?b (\<BB>\<lparr>CId\<rparr>\<lparr>?b\<rparr>))

goal (1 subgoal):
 1. op_obj_cf_comma b \<FF> : op_cat (b \<down>\<^sub>C\<^sub>F \<FF>) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> (op_cf \<FF>) \<^sub>C\<^sub>F\<down> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_obj_cf_comma b \<FF> : op_cat (b \<down>\<^sub>C\<^sub>F \<FF>) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> (op_cf \<FF>) \<^sub>C\<^sub>F\<down> b
[PROOF STEP]
by
      (
        rule op_cf_comma_is_iso_functor
          [
            OF cf_const is_functor_axioms,
            folded cat_obj_cf_comma_def op_obj_cf_comma_def,
            unfolded cat_op_simps,
            folded cat_cf_obj_comma_def
          ]
      )
[PROOF STATE]
proof (state)
this:
op_obj_cf_comma b \<FF> : op_cat (b \<down>\<^sub>C\<^sub>F \<FF>) \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> (op_cf \<FF>) \<^sub>C\<^sub>F\<down> b

goal:
No subgoals!
[PROOF STEP]
qed