[STATEMENT]
lemma is_aligned_mask_offset_unat:
  fixes off :: "('a::len) word"
  and     x :: "'a word"
  assumes al: "is_aligned x sz"
  and   offv: "off \<le> mask sz"
  shows  "unat x + unat off < 2 ^ LENGTH('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
 2. \<not> ?P \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
assume szv: "sz < LENGTH('a)"
[PROOF STATE]
proof (state)
this:
sz < LENGTH('a)

goal (2 subgoals):
 1. ?P \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
 2. \<not> ?P \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
from al
[PROOF STATE]
proof (chain)
picking this:
is_aligned x sz
[PROOF STEP]
obtain k where xv: "x = 2 ^ sz * (of_nat k)"
    and kl: "k < 2 ^ (LENGTH('a) - sz)"
[PROOF STATE]
proof (prove)
using this:
is_aligned x sz

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>x = 2 ^ sz * word_of_nat k; k < 2 ^ (LENGTH('a) - sz)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: is_alignedE)
[PROOF STATE]
proof (state)
this:
x = 2 ^ sz * word_of_nat k
k < 2 ^ (LENGTH('a) - sz)

goal (2 subgoals):
 1. ?P \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
 2. \<not> ?P \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
from offv szv
[PROOF STATE]
proof (chain)
picking this:
off \<le> mask sz
sz < LENGTH('a)
[PROOF STEP]
have offv': "unat off < 2 ^ sz"
[PROOF STATE]
proof (prove)
using this:
off \<le> mask sz
sz < LENGTH('a)

goal (1 subgoal):
 1. unat off < 2 ^ sz
[PROOF STEP]
by (simp add: mask_2pm1 unat_less_power)
[PROOF STATE]
proof (state)
this:
unat off < 2 ^ sz

goal (2 subgoals):
 1. ?P \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
 2. \<not> ?P \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
using szv
[PROOF STATE]
proof (prove)
using this:
sz < LENGTH('a)

goal (1 subgoal):
 1. unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
using al is_aligned_no_wrap''' offv'
[PROOF STATE]
proof (prove)
using this:
sz < LENGTH('a)
is_aligned x sz
\<lbrakk>is_aligned ?ptr ?sz; ?sz < LENGTH(?'a); ?off < 2 ^ ?sz\<rbrakk> \<Longrightarrow> unat ?ptr + ?off < 2 ^ LENGTH(?'a)
unat off < 2 ^ sz

goal (1 subgoal):
 1. unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
unat x + unat off < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. \<not> sz < LENGTH('a) \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> sz < LENGTH('a) \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
assume "\<not> sz < LENGTH('a)"
[PROOF STATE]
proof (state)
this:
\<not> sz < LENGTH('a)

goal (1 subgoal):
 1. \<not> sz < LENGTH('a) \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
with al
[PROOF STATE]
proof (chain)
picking this:
is_aligned x sz
\<not> sz < LENGTH('a)
[PROOF STEP]
have "x = 0"
[PROOF STATE]
proof (prove)
using this:
is_aligned x sz
\<not> sz < LENGTH('a)

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
by (meson is_aligned_get_word_bits)
[PROOF STATE]
proof (state)
this:
x = 0

goal (1 subgoal):
 1. \<not> sz < LENGTH('a) \<Longrightarrow> unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x = 0

goal (1 subgoal):
 1. unat x + unat off < 2 ^ LENGTH('a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
unat x + unat off < 2 ^ LENGTH('a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mpoly_to_mpoly_poly_monom: "mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
have "mpoly_to_mpoly_poly x (MPoly_Type.monom m a) =
    (\<Sum> m'. Polynomial.monom (MPoly_Type.monom (remove_key x m') a) (lookup m' x) when m' = m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = (\<Sum>m'. Polynomial.monom (MPoly_Type.monom (remove_key x m') a) (lookup m' x) when m' = m)
[PROOF STEP]
unfolding mpoly_to_mpoly_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ma. Polynomial.monom (MPoly_Type.monom (remove_key x ma) (MPoly_Type.coeff (MPoly_Type.monom m a) ma)) (lookup ma x)) = (\<Sum>m'. Polynomial.monom (MPoly_Type.monom (remove_key x m') a) (lookup m' x) when m' = m)
[PROOF STEP]
by (intro Sum_any.cong, auto simp: when_def More_MPoly_Type.coeff_monom)
[PROOF STATE]
proof (state)
this:
mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = (\<Sum>m'. Polynomial.monom (MPoly_Type.monom (remove_key x m') a) (lookup m' x) when m' = m)

goal (1 subgoal):
 1. mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = (\<Sum>m'. Polynomial.monom (MPoly_Type.monom (remove_key x m') a) (lookup m' x) when m' = m)

goal (1 subgoal):
 1. mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
have "\<dots> = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m'. Polynomial.monom (MPoly_Type.monom (remove_key x m') a) (lookup m' x) when m' = m) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
unfolding Sum_any_when_equal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>m'. Polynomial.monom (MPoly_Type.monom (remove_key x m') a) (lookup m' x) when m' = m) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)

goal (1 subgoal):
 1. mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)

goal (1 subgoal):
 1. mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mpoly_to_mpoly_poly x (MPoly_Type.monom m a) = Polynomial.monom (MPoly_Type.monom (remove_key x m) a) (lookup m x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_nhds_top:
  fixes P :: "'a :: {order_top,linorder_topology} \<Rightarrow> bool"
    and b :: 'a
  assumes "b < top"
  shows "eventually P (nhds top) \<longleftrightarrow> (\<exists>b<top. (\<forall>z. b < z \<longrightarrow> P z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (nhds top) = (\<exists>b<top. \<forall>z>b. P z)
[PROOF STEP]
unfolding eventually_nhds
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>S. open S \<and> top \<in> S \<and> Ball S P) = (\<exists>b<top. \<forall>z>b. P z)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>open S; top \<in> S; Ball S P\<rbrakk> \<Longrightarrow> \<exists>b<top. \<forall>z>b. P z
 2. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
fix S :: "'a set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>open S; top \<in> S; Ball S P\<rbrakk> \<Longrightarrow> \<exists>b<top. \<forall>z>b. P z
 2. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
assume "open S" "top \<in> S"
[PROOF STATE]
proof (state)
this:
open S
top \<in> S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>open S; top \<in> S; Ball S P\<rbrakk> \<Longrightarrow> \<exists>b<top. \<forall>z>b. P z
 2. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
note open_left[OF this \<open>b < top\<close>]
[PROOF STATE]
proof (state)
this:
\<exists>b<top. {b<..top} \<subseteq> S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>open S; top \<in> S; Ball S P\<rbrakk> \<Longrightarrow> \<exists>b<top. \<forall>z>b. P z
 2. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>b<top. {b<..top} \<subseteq> S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>open S; top \<in> S; Ball S P\<rbrakk> \<Longrightarrow> \<exists>b<top. \<forall>z>b. P z
 2. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
assume "\<forall>s\<in>S. P s"
[PROOF STATE]
proof (state)
this:
\<forall>s\<in>S. P s

goal (2 subgoals):
 1. \<And>S. \<lbrakk>open S; top \<in> S; Ball S P\<rbrakk> \<Longrightarrow> \<exists>b<top. \<forall>z>b. P z
 2. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>b<top. {b<..top} \<subseteq> S
\<forall>s\<in>S. P s
[PROOF STEP]
show "\<exists>b<top. \<forall>z>b. P z"
[PROOF STATE]
proof (prove)
using this:
\<exists>b<top. {b<..top} \<subseteq> S
\<forall>s\<in>S. P s

goal (1 subgoal):
 1. \<exists>b<top. \<forall>z>b. P z
[PROOF STEP]
by (auto simp: subset_eq Ball_def)
[PROOF STATE]
proof (state)
this:
\<exists>b<top. \<forall>z>b. P z

goal (1 subgoal):
 1. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
assume "b < top" "\<forall>z>b. P z"
[PROOF STATE]
proof (state)
this:
b < top
\<forall>z>b. P z

goal (1 subgoal):
 1. \<And>b. \<lbrakk>b < top; \<forall>z>b. P z\<rbrakk> \<Longrightarrow> \<exists>S. open S \<and> top \<in> S \<and> Ball S P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b < top
\<forall>z>b. P z
[PROOF STEP]
show "\<exists>S. open S \<and> top \<in> S \<and> (\<forall>xa\<in>S. P xa)"
[PROOF STATE]
proof (prove)
using this:
b < top
\<forall>z>b. P z

goal (1 subgoal):
 1. \<exists>S. open S \<and> top \<in> S \<and> (\<forall>xa\<in>S. P xa)
[PROOF STEP]
by (intro exI[of _ "{b <..}"]) auto
[PROOF STATE]
proof (state)
this:
\<exists>S. open S \<and> top \<in> S \<and> (\<forall>xa\<in>S. P xa)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cdf_lim_neg_infty: "((\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> measure M (\<Inter> i::nat. {.. - real i })"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Inter>i. {..- real i})
[PROOF STEP]
unfolding cdf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. Sigma_Algebra.measure M {..- real i}) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Inter>i. {..- real i})
[PROOF STEP]
by (rule finite_Lim_measure_decseq) (auto simp: decseq_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Inter>i. {..- real i})

goal (1 subgoal):
 1. (\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Inter>i. {..- real i})

goal (1 subgoal):
 1. (\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<Inter> i::nat. {..- real i}) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>i. {..- real i}) = {}
[PROOF STEP]
by auto (metis leD le_minus_iff reals_Archimedean2)
[PROOF STATE]
proof (state)
this:
(\<Inter>i. {..- real i}) = {}

goal (1 subgoal):
 1. (\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> Sigma_Algebra.measure M {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> Sigma_Algebra.measure M {}

goal (1 subgoal):
 1. (\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>i. cdf M (- real i)) \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isSucc_pred_in:
assumes "isSucc i"  shows "(pred i, i) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pred i, i) \<in> r
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (pred i, i) \<in> r
[PROOF STEP]
define j where "j = pred i"
[PROOF STATE]
proof (state)
this:
j = pred i

goal (1 subgoal):
 1. (pred i, i) \<in> r
[PROOF STEP]
have i: "i = succ j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = succ j
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isSucc i

goal (1 subgoal):
 1. i = succ j
[PROOF STEP]
unfolding j_def
[PROOF STATE]
proof (prove)
using this:
isSucc i

goal (1 subgoal):
 1. i = succ (pred i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i = succ j

goal (1 subgoal):
 1. (pred i, i) \<in> r
[PROOF STEP]
have a: "aboveS j \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.aboveS j \<noteq> {}
[PROOF STEP]
unfolding j_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.aboveS (pred i) \<noteq> {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isSucc i

goal (1 subgoal):
 1. local.aboveS (pred i) \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.aboveS j \<noteq> {}

goal (1 subgoal):
 1. (pred i, i) \<in> r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pred i, i) \<in> r
[PROOF STEP]
unfolding j_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j, i) \<in> r
[PROOF STEP]
unfolding i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j, succ j) \<in> r
[PROOF STEP]
using succ_in[OF a]
[PROOF STATE]
proof (prove)
using this:
(j, succ j) \<in> r

goal (1 subgoal):
 1. (j, succ j) \<in> r
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(pred i, i) \<in> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_to_iarray_row': "vec_to_iarray (row i A) = (matrix_to_iarray A) !! (to_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (row i A) = matrix_to_iarray A !! mod_type_class.to_nat i
[PROOF STEP]
unfolding row_def vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>ia. vec_lambda (($) (A $ i)) $ mod_type_class.from_nat ia) CARD('b) = matrix_to_iarray A !! mod_type_class.to_nat i
[PROOF STEP]
by (auto, metis IArray.sub_def IArray.of_fun_def vec_matrix vec_to_iarray_def)


[STATEMENT]
lemma content_ge_0_int: "content p \<ge> (0 :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> content p
[PROOF STEP]
unfolding content_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> gcd_list (coeffs p)
[PROOF STEP]
by (cases "coeffs p", auto)


[STATEMENT]
lemma id_id_cancel: "id (id x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. id (id x) = x
[PROOF STEP]
by (simp add: id_def)


[STATEMENT]
lemma drop_bit_numeral_minus_bit1 [simp]:
  \<open>drop_bit (numeral l) (- numeral (Num.Bit1 k)) = drop_bit (pred_numeral l) (- numeral (Num.inc k) :: int)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop_bit (numeral l) (- numeral (num.Bit1 k)) = drop_bit (pred_numeral l) (- numeral (Num.inc k))
[PROOF STEP]
by (simp add: numeral_eq_Suc numeral_Bit1_div_2)


[STATEMENT]
lemma sumhr_shift_bounds:
  "\<And>m n. sumhr (m + hypnat_of_nat k, n + hypnat_of_nat k, f) =
    sumhr (m, n, \<lambda>i. f (i + k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. sumhr (m + hypnat_of_nat k, n + hypnat_of_nat k, f) = sumhr (m, n, \<lambda>i. f (i + k))
[PROOF STEP]
unfolding sumhr_app
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. (*f2* (\<lambda>m n. sum f {m..<n})) (m + hypnat_of_nat k) (n + hypnat_of_nat k) = (*f2* (\<lambda>m n. \<Sum>i = m..<n. f (i + k))) m n
[PROOF STEP]
by transfer (rule sum.shift_bounds_nat_ivl)


[STATEMENT]
lemma Infinitesimal_add_hypreal_of_real_less:
  assumes "x < y" and u: "u \<in> Infinitesimal"
  shows "hypreal_of_real x + u < hypreal_of_real y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hypreal_of_real x + u < hypreal_of_real y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hypreal_of_real x + u < hypreal_of_real y
[PROOF STEP]
have "\<bar>u\<bar> < hypreal_of_real y - hypreal_of_real x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>u\<bar> < hypreal_of_real y - hypreal_of_real x
[PROOF STEP]
using InfinitesimalD \<open>x < y\<close> u
[PROOF STATE]
proof (prove)
using this:
?x \<in> Infinitesimal \<Longrightarrow> \<forall>r\<in>\<real>. 0 < r \<longrightarrow> hnorm ?x < r
x < y
u \<in> Infinitesimal

goal (1 subgoal):
 1. \<bar>u\<bar> < hypreal_of_real y - hypreal_of_real x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<bar>u\<bar> < hypreal_of_real y - hypreal_of_real x

goal (1 subgoal):
 1. hypreal_of_real x + u < hypreal_of_real y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>u\<bar> < hypreal_of_real y - hypreal_of_real x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>u\<bar> < hypreal_of_real y - hypreal_of_real x

goal (1 subgoal):
 1. hypreal_of_real x + u < hypreal_of_real y
[PROOF STEP]
by (simp add: abs_less_iff)
[PROOF STATE]
proof (state)
this:
hypreal_of_real x + u < hypreal_of_real y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_of_filter: "map_of (filter (\<lambda>x. P (fst x)) xs) = map_of xs |` Collect P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_of (filter (\<lambda>x. P (fst x)) xs) = map_of xs |` Collect P
[PROOF STEP]
by(induct xs)(simp_all add: fun_eq_iff restrict_map_def)


[STATEMENT]
lemma eexp_strict_mono[simp]: "eexp x < eexp y \<longleftrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eexp x < eexp y) = (x < y)
[PROOF STEP]
by (simp add: less_le)


[STATEMENT]
lemma A_in_listwordinterval_compress: "A \<in> set (listwordinterval_compress ss) \<Longrightarrow>
    interval_of A \<subseteq> (\<Union>s \<in> set ss. interval_of s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> set (listwordinterval_compress ss) \<Longrightarrow> interval_of A \<subseteq> \<Union> (interval_of ` set ss)
[PROOF STEP]
using listwordinterval_compress
[PROOF STATE]
proof (prove)
using this:
\<Union> (interval_of ` set (listwordinterval_compress ?ss)) = \<Union> (interval_of ` set ?ss)

goal (1 subgoal):
 1. A \<in> set (listwordinterval_compress ss) \<Longrightarrow> interval_of A \<subseteq> \<Union> (interval_of ` set ss)
[PROOF STEP]
by blast


[STATEMENT]
lemma (in comm_group) is_idirprod_subgroup_suffices:
  assumes "A = IDirProds G S I" "\<forall>i\<in>I. subgroup (S i) G" "compl_fam S I"
  shows "is_idirprod A S I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_idirprod A S I
[PROOF STEP]
unfolding is_idirprod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>I. S i \<lhd> G) \<and> A = IDirProds G S I \<and> compl_fam S I
[PROOF STEP]
using assms subgroup_imp_normal
[PROOF STATE]
proof (prove)
using this:
A = IDirProds G S I
\<forall>i\<in>I. subgroup (S i) G
compl_fam S I
subgroup ?A G \<Longrightarrow> ?A \<lhd> G

goal (1 subgoal):
 1. (\<forall>i\<in>I. S i \<lhd> G) \<and> A = IDirProds G S I \<and> compl_fam S I
[PROOF STEP]
by blast


[STATEMENT]
lemma is_Arg_Arg: "z \<noteq> 0 \<Longrightarrow> is_Arg z (Arg z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<noteq> 0 \<Longrightarrow> is_Arg z (Arg z)
[PROOF STEP]
by (simp add: Arg_eq is_Arg_def)


[STATEMENT]
lemma coreflexive_conv_closed:
  "coreflexive x \<Longrightarrow> coreflexive (x\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coreflexive x \<Longrightarrow> coreflexive (x\<^sup>T)
[PROOF STEP]
using conv_order
[PROOF STATE]
proof (prove)
using this:
(?x \<le> ?y) = (?x\<^sup>T \<le> ?y\<^sup>T)

goal (1 subgoal):
 1. coreflexive x \<Longrightarrow> coreflexive (x\<^sup>T)
[PROOF STEP]
by force


[STATEMENT]
lemma decr_grading_p_zero: "decr_grading_p d n 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. decr_grading_p d n 0 = 0
[PROOF STEP]
by (simp add: decr_grading_p_def)


[STATEMENT]
lemma nth_subarray: "\<lbrakk> k < j - i; j \<le> Array.length h a \<rbrakk> \<Longrightarrow> subarray i j a h ! k = Array.get h a ! (i + k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < j - i; j \<le> Array.length h a\<rbrakk> \<Longrightarrow> subarray i j a h ! k = Array.get h a ! (i + k)
[PROOF STEP]
unfolding Array.length_def subarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < j - i; j \<le> length (Array.get h a)\<rbrakk> \<Longrightarrow> nths' i j (Array.get h a) ! k = Array.get h a ! (i + k)
[PROOF STEP]
by (simp add: nth_nths')


[STATEMENT]
lemma ffold_finsert_idem:
    "ffold f z (finsert x A) = f x (ffold f z A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffold f z (finsert x A) = f x (ffold f z A)
[PROOF STEP]
by (transfer fixing: f) (rule fold_insert_idem)


[STATEMENT]
lemma list_max_Cons: "list_max (x # xs) = ord_term_lin.max x (list_max xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_max (x # xs) = ord_term_lin.max x (list_max xs)
[PROOF STEP]
unfolding list_max_def foldl_Cons
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl ord_term_lin.max (ord_term_lin.max min_term x) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. foldl ord_term_lin.max (ord_term_lin.max min_term x) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)
[PROOF STEP]
have "foldl ord_term_lin.max (ord_term_lin.max x min_term) xs =
          ord_term_lin.max x (foldl ord_term_lin.max min_term xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl ord_term_lin.max (ord_term_lin.max x min_term) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)
[PROOF STEP]
by (rule foldl_assoc, rule ord_term_lin.max.assoc)
[PROOF STATE]
proof (state)
this:
foldl ord_term_lin.max (ord_term_lin.max x min_term) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)

goal (1 subgoal):
 1. foldl ord_term_lin.max (ord_term_lin.max min_term x) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)
[PROOF STEP]
from this ord_term_lin.max.commute[of min_term x]
[PROOF STATE]
proof (chain)
picking this:
foldl ord_term_lin.max (ord_term_lin.max x min_term) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)
ord_term_lin.max min_term x = ord_term_lin.max x min_term
[PROOF STEP]
show "foldl ord_term_lin.max (ord_term_lin.max min_term x) xs =
            ord_term_lin.max x (foldl ord_term_lin.max min_term xs)"
[PROOF STATE]
proof (prove)
using this:
foldl ord_term_lin.max (ord_term_lin.max x min_term) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)
ord_term_lin.max min_term x = ord_term_lin.max x min_term

goal (1 subgoal):
 1. foldl ord_term_lin.max (ord_term_lin.max min_term x) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldl ord_term_lin.max (ord_term_lin.max min_term x) xs = ord_term_lin.max x (foldl ord_term_lin.max min_term xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SA_zero_set_of_zero:
"SA_zero_set m (\<zero>\<^bsub>SA m\<^esub>) = carrier (Q\<^sub>p\<^bsup>m\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SA_zero_set m \<zero>\<^bsub>SA m\<^esub> = carrier (Q\<^sub>p\<^bsup>m\<^esup>)
[PROOF STEP]
apply(rule equalityI')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> SA_zero_set m \<zero>\<^bsub>SA m\<^esub> \<Longrightarrow> x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>)
 2. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<Longrightarrow> x \<in> SA_zero_set m \<zero>\<^bsub>SA m\<^esub>
[PROOF STEP]
unfolding SA_zero_set_def mem_Collect_eq
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<and> \<zero>\<^bsub>SA m\<^esub> x = \<zero> \<Longrightarrow> x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>)
 2. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<Longrightarrow> x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<and> \<zero>\<^bsub>SA m\<^esub> x = \<zero>
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<Longrightarrow> x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<and> \<zero>\<^bsub>SA m\<^esub> x = \<zero>
[PROOF STEP]
using SA_zeroE
[PROOF STATE]
proof (prove)
using this:
?a \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>) \<Longrightarrow> \<zero>\<^bsub>SA ?n\<^esub> ?a = \<zero>

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<Longrightarrow> x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<and> \<zero>\<^bsub>SA m\<^esub> x = \<zero>
[PROOF STEP]
by blast


[STATEMENT]
lemma foldr_funion_fsingleton : "foldr (|\<union>|) xs x = ffUnion (fset_of_list (x#xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (|\<union>|) xs x = ffUnion (fset_of_list (x # xs))
[PROOF STEP]
by (induction xs; auto)


[STATEMENT]
lemma H_face_cycle_succ:
      "H.face_cycle_succ uw = wv"
      "H.face_cycle_succ vw = wu"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H.face_cycle_succ uw = rev_H vw &&& H.face_cycle_succ vw = rev_H uw
[PROOF STEP]
unfolding H.face_cycle_succ_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (edge_succ HM \<circ> rev_H) uw = rev_H vw &&& (edge_succ HM \<circ> rev_H) vw = rev_H uw
[PROOF STEP]
by (auto simp: edge_succ_w)


[STATEMENT]
lemma unique_root_cong:
  "unique_root (p,l,r) = unique_root (q,l,r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>!x. root_cond (p, l, r) x) = (\<exists>!x. root_cond (q, l, r) x)
[PROOF STEP]
unfolding root_cond_cong
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>!x. root_cond (q, l, r) x) = (\<exists>!x. root_cond (q, l, r) x)
[PROOF STEP]
..


[STATEMENT]
lemma rstar_increasing:
  assumes "has_least_prefixpoint (Rf y)"
    shows "y \<le> rstar y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> rstar y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<le> rstar y
[PROOF STEP]
have "Rf y (rstar y) \<le> rstar y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rf y (rstar y) \<le> rstar y
[PROOF STEP]
using assms pmu_unfold
[PROOF STATE]
proof (prove)
using this:
has_least_prefixpoint (Rf y)
has_least_prefixpoint ?f \<Longrightarrow> ?f (p\<mu> ?f) \<le> p\<mu> ?f

goal (1 subgoal):
 1. Rf y (rstar y) \<le> rstar y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Rf y (rstar y) \<le> rstar y

goal (1 subgoal):
 1. y \<le> rstar y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Rf y (rstar y) \<le> rstar y

goal (1 subgoal):
 1. y \<le> rstar y
[PROOF STEP]
by (metis le_supE mult_right_isotone mult_sub_right_one sup.absorb_iff2)
[PROOF STATE]
proof (state)
this:
y \<le> rstar y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_listset_nth: "x \<in> listset As \<Longrightarrow> i < length As \<Longrightarrow> x ! i \<in> As ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> listset As; i < length As\<rbrakk> \<Longrightarrow> x ! i \<in> As ! i
[PROOF STEP]
by (induction As arbitrary: x i) (auto simp: set_Cons_def nth_Cons split: nat.split)


[STATEMENT]
lemma lens_comp_cong_1: "X \<approx>\<^sub>L Y \<Longrightarrow> X ;\<^sub>L Z \<approx>\<^sub>L Y ;\<^sub>L Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<approx>\<^sub>L Y \<Longrightarrow> X ;\<^sub>L Z \<approx>\<^sub>L Y ;\<^sub>L Z
[PROOF STEP]
unfolding lens_equiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<subseteq>\<^sub>L Y \<and> Y \<subseteq>\<^sub>L X \<Longrightarrow> X ;\<^sub>L Z \<subseteq>\<^sub>L Y ;\<^sub>L Z \<and> Y ;\<^sub>L Z \<subseteq>\<^sub>L X ;\<^sub>L Z
[PROOF STEP]
by (metis (no_types, lifting) lens_comp_assoc sublens_def)


[STATEMENT]
lemma set_lbounds:
  "set(lbounds as) = {(i,ks)|i k ks. Le i (k#ks) \<in> set as \<and> k>0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (lbounds as) = {uu_. \<exists>i k ks. uu_ = (i, ks) \<and> Le i (k # ks) \<in> set as \<and> 0 < k}
[PROOF STEP]
by(auto simp: lbounds_def split:list.splits atom.splits if_splits)


[STATEMENT]
lemma possible_bit_word[simp]:
  \<open>possible_bit TYPE(('a :: len) word) m \<longleftrightarrow> m < LENGTH('a)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. possible_bit TYPE('a word) m = (m < LENGTH('a))
[PROOF STEP]
by (simp add: possible_bit_def linorder_not_le)


[STATEMENT]
lemma Arg2pi_minus:
  assumes "z \<noteq> 0" shows "Arg2pi (-z) = (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg2pi (- z) = (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi)
[PROOF STEP]
apply (rule Arg2pi_unique [of "norm z", OF complex_eqI])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. Re (complex_of_real (cmod z) * exp (\<i> * complex_of_real (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi))) = Re (- z)
 2. Im (complex_of_real (cmod z) * exp (\<i> * complex_of_real (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi))) = Im (- z)
 3. 0 < cmod z
 4. 0 \<le> (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi)
 5. (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi) < 2 * pi
[PROOF STEP]
using cos_Arg2pi sin_Arg2pi Arg2pi_ge_0 Arg2pi_lt_2pi [of z] assms
[PROOF STATE]
proof (prove)
using this:
cmod ?z * cos (Arg2pi ?z) = Re ?z
cmod ?z * sin (Arg2pi ?z) = Im ?z
0 \<le> Arg2pi ?z
Arg2pi z < 2 * pi
z \<noteq> 0

goal (5 subgoals):
 1. Re (complex_of_real (cmod z) * exp (\<i> * complex_of_real (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi))) = Re (- z)
 2. Im (complex_of_real (cmod z) * exp (\<i> * complex_of_real (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi))) = Im (- z)
 3. 0 < cmod z
 4. 0 \<le> (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi)
 5. (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi) < 2 * pi
[PROOF STEP]
by (auto simp: Re_exp Im_exp)


[STATEMENT]
lemma l0c: "(e*c)/(f2*(c-1)) \<le> l0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * c / (f2 * (c - 1)) \<le> real l0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e * c / (f2 * (c - 1)) \<le> real l0
[PROOF STEP]
have 0: "f2 * (l0 * min e c) \<le> c * (f2 * l0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f2 * (real l0 * min e c) \<le> c * (f2 * real l0)
[PROOF STEP]
by (simp add: min_def ac_simps mult_right_mono)
[PROOF STATE]
proof (state)
this:
f2 * (real l0 * min e c) \<le> c * (f2 * real l0)

goal (1 subgoal):
 1. e * c / (f2 * (c - 1)) \<le> real l0
[PROOF STEP]
from l0
[PROOF STATE]
proof (chain)
picking this:
e * c / (f2 * (min e c - 1)) \<le> real l0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
e * c / (f2 * (min e c - 1)) \<le> real l0

goal (1 subgoal):
 1. e * c / (f2 * (c - 1)) \<le> real l0
[PROOF STEP]
apply(simp add: field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * e + f2 * real l0 \<le> f2 * (real l0 * min e c) \<Longrightarrow> c * e + f2 * real l0 \<le> c * (f2 * real l0)
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
f2 * (real l0 * min e c) \<le> c * (f2 * real l0)

goal (1 subgoal):
 1. c * e + f2 * real l0 \<le> f2 * (real l0 * min e c) \<Longrightarrow> c * e + f2 * real l0 \<le> c * (f2 * real l0)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
e * c / (f2 * (c - 1)) \<le> real l0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma s1_1_inj2: "s1_1 x1 y1 = s1_1 x2 y2 \<Longrightarrow> y1=y2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s1_1 x1 y1 = s1_1 x2 y2 \<Longrightarrow> y1 = y2
[PROOF STEP]
by (frule s1_1_inj, drule conjunct2)


[STATEMENT]
lemma esssup_AE_cong:
  "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> AE x in M. f x = g x \<Longrightarrow> esssup M f = esssup M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M; AE x in M. f x = g x\<rbrakk> \<Longrightarrow> esssup M f = esssup M g
[PROOF STEP]
by (auto simp: esssup_def intro!: Limsup_eq)


[STATEMENT]
lemma WN_onI: "(\<And>a. a \<in> A \<Longrightarrow> \<exists>b. (a, b) \<in> r\<^sup>!) \<Longrightarrow> WN_on r A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a \<in> A \<Longrightarrow> \<exists>b. (a, b) \<in> r\<^sup>!) \<Longrightarrow> WN_on r A
[PROOF STEP]
by (auto simp: WN_defs)


[STATEMENT]
lemma approx_add_mono1: "b \<approx> c \<Longrightarrow> d + b \<approx> d + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<approx> c \<Longrightarrow> d + b \<approx> d + c
[PROOF STEP]
by (simp add: approx_add)


[STATEMENT]
lemma bit_numeral_simps [simp]:
  \<open>\<not> bit 1 (numeral n)\<close>
  \<open>bit (numeral (Num.Bit0 w)) (numeral n) \<longleftrightarrow> bit (numeral w) (pred_numeral n)\<close>
  \<open>bit (numeral (Num.Bit1 w)) (numeral n) \<longleftrightarrow> bit (numeral w) (pred_numeral n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> bit (1::'a) (numeral n) &&& bit (numeral (num.Bit0 w)) (numeral n) = bit (numeral w) (pred_numeral n) &&& bit (numeral (num.Bit1 w)) (numeral n) = bit (numeral w) (pred_numeral n)
[PROOF STEP]
by (simp_all add: bit_1_iff numeral_eq_Suc)


[STATEMENT]
lemma outside_convex:
  fixes S :: "'a :: {real_normed_vector, perfect_space} set"
  assumes "convex S"
    shows "outside S = - S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outside S = - S
[PROOF STEP]
by (metis ComplD assms convex_in_outside equalityI inside_Un_outside subsetI sup.cobounded2)


[STATEMENT]
lemma fcard0_if_mdeg_le1_not_single_suc:
  "\<lbrakk>\<forall>x. sucs t \<noteq> {|x|}; max_deg t \<le> 1\<rbrakk> \<Longrightarrow> fcard (sucs t) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. sucs t \<noteq> {|x|}; max_deg t \<le> 1\<rbrakk> \<Longrightarrow> fcard (sucs t) = 0
[PROOF STEP]
using fcard0_if_mdeg_le1_not_single[of "sucs t" "root t"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x. sucs t \<noteq> {|x|}; max_deg (Node (dtree.root t) (sucs t)) \<le> 1\<rbrakk> \<Longrightarrow> fcard (sucs t) = 0

goal (1 subgoal):
 1. \<lbrakk>\<forall>x. sucs t \<noteq> {|x|}; max_deg t \<le> 1\<rbrakk> \<Longrightarrow> fcard (sucs t) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma chain_ldropnI:
  assumes
    rel: "\<forall>j. j \<ge> i \<longrightarrow> enat (Suc j) < llength xs \<longrightarrow> R (lnth xs j) (lnth xs (Suc j))" and
    si_lt: "enat (Suc i) < llength xs"
  shows "chain R (ldropn i xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain R (ldropn i xs)
[PROOF STEP]
proof (rule lnth_rel_chain)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> lnull (ldropn i xs)
 2. \<forall>j. enat (j + 1) < llength (ldropn i xs) \<longrightarrow> R (lnth (ldropn i xs) j) (lnth (ldropn i xs) (j + 1))
[PROOF STEP]
show "\<not> lnull (ldropn i xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> lnull (ldropn i xs)
[PROOF STEP]
using si_lt
[PROOF STATE]
proof (prove)
using this:
enat (Suc i) < llength xs

goal (1 subgoal):
 1. \<not> lnull (ldropn i xs)
[PROOF STEP]
by (simp add: Suc_ile_eq less_le_not_le)
[PROOF STATE]
proof (state)
this:
\<not> lnull (ldropn i xs)

goal (1 subgoal):
 1. \<forall>j. enat (j + 1) < llength (ldropn i xs) \<longrightarrow> R (lnth (ldropn i xs) j) (lnth (ldropn i xs) (j + 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>j. enat (j + 1) < llength (ldropn i xs) \<longrightarrow> R (lnth (ldropn i xs) j) (lnth (ldropn i xs) (j + 1))
[PROOF STEP]
show "\<forall>j. enat (j + 1) < llength (ldropn i xs) \<longrightarrow>
    R (lnth (ldropn i xs) j) (lnth (ldropn i xs) (j + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j. enat (j + 1) < llength (ldropn i xs) \<longrightarrow> R (lnth (ldropn i xs) j) (lnth (ldropn i xs) (j + 1))
[PROOF STEP]
using rel
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<ge>i. enat (Suc j) < llength xs \<longrightarrow> R (lnth xs j) (lnth xs (Suc j))

goal (1 subgoal):
 1. \<forall>j. enat (j + 1) < llength (ldropn i xs) \<longrightarrow> R (lnth (ldropn i xs) j) (lnth (ldropn i xs) (j + 1))
[PROOF STEP]
by (smt (z3) One_nat_def Suc_ile_eq add.commute add.right_neutral add_Suc_right
        add_le_cancel_right ldropn_eq_LNil ldropn_ldropn less_le_not_le linorder_not_less
        lnth_ldropn not_less_zero)
[PROOF STATE]
proof (state)
this:
\<forall>j. enat (j + 1) < llength (ldropn i xs) \<longrightarrow> R (lnth (ldropn i xs) j) (lnth (ldropn i xs) (j + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proots_uball_eq:
  fixes z0::complex and r::real
  defines "q\<equiv>[:z0, of_real r:]"
  assumes "p\<noteq>0" and "r>0"
  shows "proots_count p (ball z0 r) = proots_count (p \<circ>\<^sub>p q) (ball 0 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p (ball z0 r) = proots_count (p \<circ>\<^sub>p q) (ball 0 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_count p (ball z0 r) = proots_count (p \<circ>\<^sub>p q) (ball 0 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p (ball z0 r) = proots_count (p \<circ>\<^sub>p q) (ball 0 1)
[PROOF STEP]
apply (rule proots_pcompose_bij_eq[OF _ \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. bij_betw (poly q) (ball 0 1) (ball z0 r)
 2. degree q = 1
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (poly q) (ball 0 1) (ball z0 r)
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (poly [:z0, complex_of_real r:]) (ball 0 1) (ball z0 r)
[PROOF STEP]
using bij_betw_ball_uball[OF \<open>r>0\<close>,of z0]
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>x. complex_of_real r * x + z0) (ball 0 1) (ball z0 r)

goal (1 subgoal):
 1. bij_betw (poly [:z0, complex_of_real r:]) (ball 0 1) (ball z0 r)
[PROOF STEP]
by (auto simp:algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree q = 1
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree q = 1
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree [:z0, complex_of_real r:] = 1
[PROOF STEP]
using \<open>r>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < r

goal (1 subgoal):
 1. degree [:z0, complex_of_real r:] = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
proots_count p (ball z0 r) = proots_count (p \<circ>\<^sub>p q) (ball 0 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fold_equality: "fold_graph f z B y \<Longrightarrow> B \<subseteq> A \<Longrightarrow> z \<in> A \<Longrightarrow> Finite_Set.fold f z B = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fold_graph f z B y; B \<subseteq> A; z \<in> A\<rbrakk> \<Longrightarrow> Finite_Set.fold f z B = y
[PROOF STEP]
by (cases "finite B")
  (auto simp add: Finite_Set.fold_def intro: fold_graph_determ dest: fold_graph_finite)


[STATEMENT]
lemma (in padic_integers) residue_closed[simp]:
  assumes "b \<in> carrier Zp"
  shows "b k \<in> carrier (Zp_res_ring k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b k \<in> carrier (residue_ring (p ^ k))
[PROOF STEP]
using Zp_def assms padic_integers.Zp_defs(3) padic_integers_axioms padic_set_res_closed
[PROOF STATE]
proof (prove)
using this:
Zp \<equiv> padic_int p
b \<in> carrier Zp
padic_integers ?p \<Longrightarrow> carrier (padic_int ?p) = padic_set ?p
padic_integers p
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))

goal (1 subgoal):
 1. b k \<in> carrier (residue_ring (p ^ k))
[PROOF STEP]
by auto


[STATEMENT]
lemma map_respect_eq: "((=) ===> eq ===> eq) map map"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((=) ===> equivclp cancel1 ===> equivclp cancel1) map map
[PROOF STEP]
apply(intro rel_funI; hypsubst)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa ya. equivclp cancel1 xa ya \<Longrightarrow> equivclp cancel1 (map y xa) (map y ya)
[PROOF STEP]
subgoal for _ f x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equivclp cancel1 x y \<Longrightarrow> equivclp cancel1 (map f x) (map f y)
[PROOF STEP]
by(induction rule: equivclp_induct)
      (auto dest: map_respect_cancel1[THEN rel_funD, THEN rel_funD, OF refl] intro: eq_sym equivclp_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mod_plus_minus_zero':
  assumes "b>0" "odd b"
  shows "0 mod+- b = (0::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 mod+- b = 0
[PROOF STEP]
using mod_plus_minus_rangeE[of 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<in> {- \<lfloor>real_of_int ?b / 2\<rfloor>..<\<lfloor>real_of_int ?b / 2\<rfloor>}; odd ?b\<rbrakk> \<Longrightarrow> 0 = 0 mod+- ?b

goal (1 subgoal):
 1. 0 mod+- b = 0
[PROOF STEP]
by (smt (verit, best) assms(1) assms(2) atLeastAtMost_iff
  atLeastLessThan_iff mod_plus_minus_range)


[STATEMENT]
lemma pattern_subst_ML_coincidence:
 "pattern t \<Longrightarrow> \<forall>i\<in>fv t. \<sigma> i = \<sigma>' i
  \<Longrightarrow> subst_ML \<sigma> (comp_pat t) = subst_ML \<sigma>' (comp_pat t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pattern t; \<forall>i\<in>fv t. \<sigma> i = \<sigma>' i\<rbrakk> \<Longrightarrow> subst\<^sub>M\<^sub>L \<sigma> (comp_pat t) = subst\<^sub>M\<^sub>L \<sigma>' (comp_pat t)
[PROOF STEP]
by(induct pred:pattern) auto


[STATEMENT]
lemma lemma_2_15_iii_1: "1 \<in> supremum {a, b} \<Longrightarrow> 1 \<in> supremum {a ^ (2 ^ n), b ^ (2 ^ n)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<in> supremum {a, b} \<Longrightarrow> (1::'a) \<in> supremum {a ^ 2 ^ n, b ^ 2 ^ n}
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (1::'a) \<in> supremum {a, b} \<Longrightarrow> (1::'a) \<in> supremum {a ^ 2 ^ 0, b ^ 2 ^ 0}
 2. \<And>n. \<lbrakk>(1::'a) \<in> supremum {a, b}; (1::'a) \<in> supremum {a ^ 2 ^ n, b ^ 2 ^ n}\<rbrakk> \<Longrightarrow> (1::'a) \<in> supremum {a ^ 2 ^ Suc n, b ^ 2 ^ Suc n}
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(1::'a) \<in> supremum {a, b}; (1::'a) \<in> supremum {a ^ 2 ^ n, b ^ 2 ^ n}\<rbrakk> \<Longrightarrow> (1::'a) \<in> supremum {a ^ 2 ^ Suc n, b ^ 2 ^ Suc n}
[PROOF STEP]
apply (drule drop_assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(1::'a) \<in> supremum {a ^ 2 ^ n, b ^ 2 ^ n}; True\<rbrakk> \<Longrightarrow> (1::'a) \<in> supremum {a ^ 2 ^ Suc n, b ^ 2 ^ Suc n}
[PROOF STEP]
apply (drule lemma_2_15_iii_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>True; (1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}\<rbrakk> \<Longrightarrow> (1::'a) \<in> supremum {a ^ 2 ^ Suc n, b ^ 2 ^ Suc n}
[PROOF STEP]
apply (subgoal_tac "\<forall>a . (a ^ (2::nat) ^ n)\<^sup>2 = a ^ (2::nat) ^ Suc n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>True; (1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}; \<forall>a. (a ^ 2 ^ n)\<^sup>2 = a ^ 2 ^ Suc n\<rbrakk> \<Longrightarrow> (1::'a) \<in> supremum {a ^ 2 ^ Suc n, b ^ 2 ^ Suc n}
 2. \<And>n. \<lbrakk>True; (1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}\<rbrakk> \<Longrightarrow> \<forall>a. (a ^ 2 ^ n)\<^sup>2 = a ^ 2 ^ Suc n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>True; (1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}\<rbrakk> \<Longrightarrow> \<forall>a. (a ^ 2 ^ n)\<^sup>2 = a ^ 2 ^ Suc n
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n aa. \<lbrakk>True; (1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}\<rbrakk> \<Longrightarrow> (aa ^ 2 ^ n)\<^sup>2 = aa ^ 2 ^ Suc n
[PROOF STEP]
apply (cut_tac a = aa and m = "2 ^ n" and n = 2 in  power_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n aa. \<lbrakk>True; (1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}; aa ^ (2 ^ n * 2) = (aa ^ 2 ^ n)\<^sup>2\<rbrakk> \<Longrightarrow> (aa ^ 2 ^ n)\<^sup>2 = aa ^ 2 ^ Suc n
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n aa. \<lbrakk>(1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}; aa ^ (2 ^ n * 2) = (aa ^ 2 ^ n)\<^sup>2\<rbrakk> \<Longrightarrow> (aa ^ 2 ^ n)\<^sup>2 = aa ^ (2 * 2 ^ n)
[PROOF STEP]
apply (subgoal_tac "((2::nat) ^ n * (2::nat)) = ((2::nat) * (2::nat) ^ n)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n aa. \<lbrakk>(1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}; aa ^ (2 ^ n * 2) = (aa ^ 2 ^ n)\<^sup>2; 2 ^ n * 2 = 2 * 2 ^ n\<rbrakk> \<Longrightarrow> (aa ^ 2 ^ n)\<^sup>2 = aa ^ (2 * 2 ^ n)
 2. \<And>n aa. \<lbrakk>(1::'a) \<in> supremum {(a ^ 2 ^ n)\<^sup>2, (b ^ 2 ^ n)\<^sup>2}; aa ^ (2 ^ n * 2) = (aa ^ 2 ^ n)\<^sup>2\<rbrakk> \<Longrightarrow> 2 ^ n * 2 = 2 * 2 ^ n
[PROOF STEP]
by simp_all


[STATEMENT]
lemma functions_of:
  assumes "finite A" "finite B"
  assumes "number_partition (card A) N"
  assumes "size N \<le> card B"
  shows "functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
obtain f where "f \<in> A \<rightarrow>\<^sub>E B" and eq_N: "image_mset (\<lambda>X. card X) (mset_set (((\<lambda>b. {x \<in> A. f x = b})) ` B - {{}})) = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f \<in> A \<rightarrow>\<^sub>E B; image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using obtain_extensional_function_from_number_partition \<open>finite A\<close> \<open>finite B\<close> \<open>number_partition (card A) N\<close> \<open>size N \<le> card B\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; finite ?B; number_partition (card ?A) ?N; size ?N \<le> card ?B\<rbrakk> \<Longrightarrow> \<exists>f\<in>?A \<rightarrow>\<^sub>E ?B. image_mset card (mset_set ((\<lambda>b. {x \<in> ?A. f x = b}) ` ?B - {{}})) = ?N
finite A
finite B
number_partition (card A) N
size N \<le> card B

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f \<in> A \<rightarrow>\<^sub>E B; image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f \<in> A \<rightarrow>\<^sub>E B
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N

goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
have "functions_of A B N = (domain_and_range_permutation A B) `` {f}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. functions_of A B N = domain_and_range_permutation A B `` {f}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. functions_of A B N \<subseteq> domain_and_range_permutation A B `` {f}
 2. domain_and_range_permutation A B `` {f} \<subseteq> functions_of A B N
[PROOF STEP]
show "functions_of A B N \<subseteq> domain_and_range_permutation A B `` {f}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. functions_of A B N \<subseteq> domain_and_range_permutation A B `` {f}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> functions_of A B N \<Longrightarrow> x \<in> domain_and_range_permutation A B `` {f}
[PROOF STEP]
fix f'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> functions_of A B N \<Longrightarrow> x \<in> domain_and_range_permutation A B `` {f}
[PROOF STEP]
assume "f' \<in> functions_of A B N"
[PROOF STATE]
proof (state)
this:
f' \<in> functions_of A B N

goal (1 subgoal):
 1. \<And>x. x \<in> functions_of A B N \<Longrightarrow> x \<in> domain_and_range_permutation A B `` {f}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
f' \<in> functions_of A B N
[PROOF STEP]
have eq_N': "N = image_mset (\<lambda>X. card X) (mset_set (((\<lambda>b. {x \<in> A. f' x = b})) ` B - {{}}))"
        and "f' \<in> A \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
using this:
f' \<in> functions_of A B N

goal (1 subgoal):
 1. N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) &&& f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
unfolding functions_of_def
[PROOF STATE]
proof (prove)
using this:
f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N}

goal (1 subgoal):
 1. N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) &&& f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}))
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. \<And>x. x \<in> functions_of A B N \<Longrightarrow> x \<in> domain_and_range_permutation A B `` {f}
[PROOF STEP]
from \<open>finite A\<close> \<open>finite B\<close> \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (chain)
picking this:
finite A
finite B
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
obtain p\<^sub>A p\<^sub>B where "p\<^sub>A permutes A" "p\<^sub>B permutes B" "\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))"
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. (\<And>p\<^sub>A p\<^sub>B. \<lbrakk>p\<^sub>A permutes A; p\<^sub>B permutes B; \<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using eq_N eq_N' multiset_of_partition_cards_eq_implies_permutes[of A B f f']
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N
N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}))
\<lbrakk>finite A; finite B; f \<in> A \<rightarrow>\<^sub>E B; f' \<in> A \<rightarrow>\<^sub>E B; image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})); \<And>p\<^sub>A p\<^sub>B. \<lbrakk>p\<^sub>A permutes A; p\<^sub>B permutes B; \<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>p\<^sub>A p\<^sub>B. \<lbrakk>p\<^sub>A permutes A; p\<^sub>B permutes B; \<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))

goal (1 subgoal):
 1. \<And>x. x \<in> functions_of A B N \<Longrightarrow> x \<in> domain_and_range_permutation A B `` {f}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))
[PROOF STEP]
show "f' \<in> domain_and_range_permutation A B `` {f}"
[PROOF STATE]
proof (prove)
using this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))

goal (1 subgoal):
 1. f' \<in> domain_and_range_permutation A B `` {f}
[PROOF STEP]
using \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (prove)
using this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f' \<in> domain_and_range_permutation A B `` {f}
[PROOF STEP]
unfolding domain_and_range_permutation_def
[PROOF STATE]
proof (prove)
using this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f' \<in> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p\<^sub>A p\<^sub>B. p\<^sub>A permutes A \<and> p\<^sub>B permutes B \<and> (\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))))} `` {f}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f' \<in> domain_and_range_permutation A B `` {f}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
functions_of A B N \<subseteq> domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. domain_and_range_permutation A B `` {f} \<subseteq> functions_of A B N
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. domain_and_range_permutation A B `` {f} \<subseteq> functions_of A B N
[PROOF STEP]
show "domain_and_range_permutation A B `` {f} \<subseteq> functions_of A B N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain_and_range_permutation A B `` {f} \<subseteq> functions_of A B N
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> functions_of A B N
[PROOF STEP]
fix f'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> functions_of A B N
[PROOF STEP]
assume "f' \<in> domain_and_range_permutation A B `` {f}"
[PROOF STATE]
proof (state)
this:
f' \<in> domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> functions_of A B N
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
f' \<in> domain_and_range_permutation A B `` {f}
[PROOF STEP]
have in_equiv_relation: "(f, f') \<in> domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
using this:
f' \<in> domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. (f, f') \<in> domain_and_range_permutation A B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f, f') \<in> domain_and_range_permutation A B

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> functions_of A B N
[PROOF STEP]
from eq_N \<open>finite B\<close>
[PROOF STATE]
proof (chain)
picking this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N
finite B
[PROOF STEP]
have "image_mset (\<lambda>X. card X) (mset_set (((\<lambda>b. {x \<in> A. f' x = b})) ` B - {{}})) = N"
[PROOF STATE]
proof (prove)
using this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N
finite B

goal (1 subgoal):
 1. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) = N
[PROOF STEP]
using congruentD[OF multiset_of_partition_cards_respects_domain_and_range_permutation in_equiv_relation]
[PROOF STATE]
proof (prove)
using this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N
finite B
finite B \<Longrightarrow> image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}))

goal (1 subgoal):
 1. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) = N
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) = N

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> functions_of A B N
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) = N

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> functions_of A B N
[PROOF STEP]
from \<open>(f, f') \<in> domain_and_range_permutation A B\<close>
[PROOF STATE]
proof (chain)
picking this:
(f, f') \<in> domain_and_range_permutation A B
[PROOF STEP]
have "f' \<in> A \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
using this:
(f, f') \<in> domain_and_range_permutation A B

goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
unfolding domain_and_range_permutation_def
[PROOF STATE]
proof (prove)
using this:
(f, f') \<in> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p\<^sub>A p\<^sub>B. p\<^sub>A permutes A \<and> p\<^sub>B permutes B \<and> (\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))))}

goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> functions_of A B N
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) = N
f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
show "f' \<in> functions_of A B N"
[PROOF STATE]
proof (prove)
using this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) = N
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f' \<in> functions_of A B N
[PROOF STEP]
unfolding functions_of_def
[PROOF STATE]
proof (prove)
using this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}})) = N
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f' \<in> functions_of A B N

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
domain_and_range_permutation A B `` {f} \<subseteq> functions_of A B N

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

goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
from this \<open>f \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (chain)
picking this:
functions_of A B N = domain_and_range_permutation A B `` {f}
f \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
functions_of A B N = domain_and_range_permutation A B `` {f}
f \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
by (auto intro: quotientI)
[PROOF STATE]
proof (state)
this:
functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_mod_right [simp]:
  "[b = c mod a] (mod a) \<longleftrightarrow> [b = c] (mod a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [b = c mod a] (mod a) = [b = c] (mod a)
[PROOF STEP]
by (simp add: cong_def)


[STATEMENT]
lemma iT_Minus_mono: "A \<subseteq> B \<Longrightarrow> k \<ominus> A \<subseteq> k \<ominus> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> k \<ominus> A \<subseteq> k \<ominus> B
[PROOF STEP]
by (simp add: subset_iff iT_Minus_mem_iff)


[STATEMENT]
lemma oFix_least:
"\<lbrakk>mono F; F x = x; a \<le> x\<rbrakk> \<Longrightarrow> oFix F a \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono F; F x = x; a \<le> x\<rbrakk> \<Longrightarrow> oFix F a \<le> x
[PROOF STEP]
apply (unfold oFix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono F; F x = x; a \<le> x\<rbrakk> \<Longrightarrow> oLimit (\<lambda>n. iter n F a) \<le> x
[PROOF STEP]
apply (rule oLimit_leI, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>mono F; F x = x; a \<le> x\<rbrakk> \<Longrightarrow> iter n F a \<le> x
[PROOF STEP]
apply (induct_tac n, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>mono F; F x = x; a \<le> x; iter na F a \<le> x\<rbrakk> \<Longrightarrow> F (iter na F a) \<le> x
[PROOF STEP]
apply (erule subst)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>mono F; a \<le> x; iter na F a \<le> x\<rbrakk> \<Longrightarrow> F (iter na F a) \<le> F x
[PROOF STEP]
apply (erule monoD, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in weak_partial_order) Upper_elemI:
  "\<lbrakk>!! y. y \<in> A \<Longrightarrow> y \<sqsubseteq> x; x \<in> carrier L\<rbrakk> \<Longrightarrow> x .\<in> Upper L A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>y. y \<in> A \<Longrightarrow> y \<sqsubseteq> x; x \<in> carrier L\<rbrakk> \<Longrightarrow> x .\<in> Upper L A
[PROOF STEP]
unfolding Upper_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>y. y \<in> A \<Longrightarrow> y \<sqsubseteq> x; x \<in> carrier L\<rbrakk> \<Longrightarrow> x .\<in> {u. \<forall>x. x \<in> A \<inter> carrier L \<longrightarrow> x \<sqsubseteq> u} \<inter> carrier L
[PROOF STEP]
by blast


[STATEMENT]
lemma range_lsu_iff [simp]: "((x::'a::unital_quantale) \<in> range \<nu>\<^sup>\<natural>) = (\<nu>\<^sup>\<natural> x = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> range \<nu>\<^sup>\<natural>) = (\<nu>\<^sup>\<natural> x = x)
[PROOF STEP]
by (simp add: lsu_range_fix)


[STATEMENT]
lemma fls_const_divide_const:
  fixes x y :: "'a::division_ring"
  shows "fls_const x / fls_const y = fls_const (x/y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_const x / fls_const y = fls_const (x / y)
[PROOF STEP]
by    (simp add: fls_divide_def fls_base_factor_to_fps_const fps_const_divide)


[STATEMENT]
lemma insert_nth_nth_index:
  "y \<noteq> z \<Longrightarrow> y \<in> set ys \<Longrightarrow> z \<in> set ys \<Longrightarrow> length ys = Suc (length xs) \<Longrightarrow> distinct ys \<Longrightarrow>
  insert_nth (index ys y) x xs ! index ys z =
  xs ! index (remove1 y ys) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<noteq> z; y \<in> set ys; z \<in> set ys; length ys = Suc (length xs); distinct ys\<rbrakk> \<Longrightarrow> insert_nth (index ys y) x xs ! index ys z = xs ! index (remove1 y ys) z
[PROOF STEP]
by (subst nth_insert_nth;
      auto simp: remove_nth_index[symmetric] index_remove_nth dest: index_less_size intro!: arg_cong[of _ _ "nth xs"] index_eqI)


[STATEMENT]
lemma convex_bound_lt:
  assumes "x < a" and "y < a" and "0 \<le> u" and "0 \<le> v" and "u + v = 1"
  shows "u * x + v * y < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * x + v * y < a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u * x + v * y < a
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x < a
y < a
(0::'a) \<le> u
(0::'a) \<le> v
u + v = (1::'a)
[PROOF STEP]
have "u * x + v * y < u * a + v * a"
[PROOF STATE]
proof (prove)
using this:
x < a
y < a
(0::'a) \<le> u
(0::'a) \<le> v
u + v = (1::'a)

goal (1 subgoal):
 1. u * x + v * y < u * a + v * a
[PROOF STEP]
by (cases "u = 0") (auto intro!: add_less_le_mono mult_strict_left_mono mult_left_mono)
[PROOF STATE]
proof (state)
this:
u * x + v * y < u * a + v * a

goal (1 subgoal):
 1. u * x + v * y < a
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x < a
y < a
(0::'a) \<le> u
(0::'a) \<le> v
u + v = (1::'a)
u * x + v * y < u * a + v * a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x < a
y < a
(0::'a) \<le> u
(0::'a) \<le> v
u + v = (1::'a)
u * x + v * y < u * a + v * a

goal (1 subgoal):
 1. u * x + v * y < a
[PROOF STEP]
unfolding distrib_right[symmetric]
[PROOF STATE]
proof (prove)
using this:
x < a
y < a
(0::'a) \<le> u
(0::'a) \<le> v
u + v = (1::'a)
u * x + v * y < (u + v) * a

goal (1 subgoal):
 1. u * x + v * y < a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u * x + v * y < a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma adds_antisym:
  assumes "s adds t" "t adds s"
  shows "s = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s = t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. s = t
[PROOF STEP]
from \<open>s adds t\<close>
[PROOF STATE]
proof (chain)
picking this:
s adds t
[PROOF STEP]
obtain u where u_def: "t = s + u"
[PROOF STATE]
proof (prove)
using this:
s adds t

goal (1 subgoal):
 1. (\<And>u. t = s + u \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding adds_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. t = s + k

goal (1 subgoal):
 1. (\<And>u. t = s + u \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
t = s + u

goal (1 subgoal):
 1. s = t
[PROOF STEP]
from \<open>t adds s\<close>
[PROOF STATE]
proof (chain)
picking this:
t adds s
[PROOF STEP]
obtain v where v_def: "s = t + v"
[PROOF STATE]
proof (prove)
using this:
t adds s

goal (1 subgoal):
 1. (\<And>v. s = t + v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding adds_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. s = t + k

goal (1 subgoal):
 1. (\<And>v. s = t + v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
s = t + v

goal (1 subgoal):
 1. s = t
[PROOF STEP]
from u_def v_def
[PROOF STATE]
proof (chain)
picking this:
t = s + u
s = t + v
[PROOF STEP]
have "s = (s + u) + v"
[PROOF STATE]
proof (prove)
using this:
t = s + u
s = t + v

goal (1 subgoal):
 1. s = s + u + v
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
s = s + u + v

goal (1 subgoal):
 1. s = t
[PROOF STEP]
hence "s + 0 = s + (u + v)"
[PROOF STATE]
proof (prove)
using this:
s = s + u + v

goal (1 subgoal):
 1. s + (0::'a) = s + (u + v)
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
s + (0::'a) = s + (u + v)

goal (1 subgoal):
 1. s = t
[PROOF STEP]
hence "u + v = 0"
[PROOF STATE]
proof (prove)
using this:
s + (0::'a) = s + (u + v)

goal (1 subgoal):
 1. u + v = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u + v = (0::'a)

goal (1 subgoal):
 1. s = t
[PROOF STEP]
hence "u = 0"
[PROOF STATE]
proof (prove)
using this:
u + v = (0::'a)

goal (1 subgoal):
 1. u = (0::'a)
[PROOF STEP]
using plus_eq_zero[of u v]
[PROOF STATE]
proof (prove)
using this:
u + v = (0::'a)
u + v = (0::'a) \<Longrightarrow> u = (0::'a)

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

goal (1 subgoal):
 1. s = t
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
u = (0::'a)

goal (1 subgoal):
 1. s = t
[PROOF STEP]
using u_def
[PROOF STATE]
proof (prove)
using this:
u = (0::'a)
t = s + u

goal (1 subgoal):
 1. s = t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s = t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subtensor_combine_subtensor[simp]:
assumes "dims A \<noteq> []"
shows "subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
have length_vec_A: "hd (dims A) * prod_list (tl (dims A)) = length (Tensor.vec A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (dims A) * prod_list (tl (dims A)) = length (vec A)
[PROOF STEP]
by (metis assms length_vec list.collapse prod_list.Cons)
[PROOF STATE]
proof (state)
this:
hd (dims A) * prod_list (tl (dims A)) = length (vec A)

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
let ?subtensor_vec = "fixed_length_sublist (vec A) (prod_list (tl (dims A)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
assume "i < hd (dims A)"
[PROOF STATE]
proof (state)
this:
i < hd (dims A)

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < hd (dims A)
[PROOF STEP]
have "(Suc i)*(prod_list (tl (dims A))) \<le> length (vec A)"
[PROOF STATE]
proof (prove)
using this:
i < hd (dims A)

goal (1 subgoal):
 1. Suc i * prod_list (tl (dims A)) \<le> length (vec A)
[PROOF STEP]
by (metis Suc_leI length_vec_A mult_le_mono1)
[PROOF STATE]
proof (state)
this:
Suc i * prod_list (tl (dims A)) \<le> length (vec A)

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc i * prod_list (tl (dims A)) \<le> length (vec A)
[PROOF STEP]
have "(vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (?subtensor_vec i))) i = ?subtensor_vec i"
[PROOF STATE]
proof (prove)
using this:
Suc i * prod_list (tl (dims A)) \<le> length (vec A)

goal (1 subgoal):
 1. (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) i = fixed_length_sublist (vec A) (prod_list (tl (dims A))) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) i = fixed_length_sublist (vec A) (prod_list (tl (dims A))) i

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 < hd (dims A) \<Longrightarrow> (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) ?i2 = fixed_length_sublist (vec A) (prod_list (tl (dims A))) ?i2

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i2 < hd (dims A) \<Longrightarrow> (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) ?i2 = fixed_length_sublist (vec A) (prod_list (tl (dims A))) ?i2
[PROOF STEP]
have 1:"map (Tensor.vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (?subtensor_vec i))) [0..<hd (dims A)]
              = map ?subtensor_vec [0..<hd (dims A)]"
[PROOF STATE]
proof (prove)
using this:
?i2 < hd (dims A) \<Longrightarrow> (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) ?i2 = fixed_length_sublist (vec A) (prod_list (tl (dims A))) ?i2

goal (1 subgoal):
 1. map (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) [0..<hd (dims A)] = map (fixed_length_sublist (vec A) (prod_list (tl (dims A)))) [0..<hd (dims A)]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) [0..<hd (dims A)] = map (fixed_length_sublist (vec A) (prod_list (tl (dims A)))) [0..<hd (dims A)]

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
map (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) [0..<hd (dims A)] = map (fixed_length_sublist (vec A) (prod_list (tl (dims A)))) [0..<hd (dims A)]
[PROOF STEP]
have "subtensor_combine (tl (dims A)) (map (\<lambda>i. subtensor A i) [0..<hd (dims A)]) = A"
[PROOF STATE]
proof (prove)
using this:
map (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) [0..<hd (dims A)] = map (fixed_length_sublist (vec A) (prod_list (tl (dims A)))) [0..<hd (dims A)]

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
unfolding subtensor_combine_def subtensor_def
[PROOF STATE]
proof (prove)
using this:
map (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) [0..<hd (dims A)] = map (fixed_length_sublist (vec A) (prod_list (tl (dims A)))) [0..<hd (dims A)]

goal (1 subgoal):
 1. tensor_from_vec (length (map (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i)) [0..<hd (dims A)]) # tl (dims A)) (concat (map vec (map (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i)) [0..<hd (dims A)]))) = A
[PROOF STEP]
using concat_parts_eq[OF length_vec_A]
[PROOF STATE]
proof (prove)
using this:
map (vec \<circ> (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i))) [0..<hd (dims A)] = map (fixed_length_sublist (vec A) (prod_list (tl (dims A)))) [0..<hd (dims A)]
concat (map (fixed_length_sublist (vec A) (prod_list (tl (dims A)))) [0..<hd (dims A)]) = vec A

goal (1 subgoal):
 1. tensor_from_vec (length (map (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i)) [0..<hd (dims A)]) # tl (dims A)) (concat (map vec (map (\<lambda>i. tensor_from_vec (tl (dims A)) (fixed_length_sublist (vec A) (prod_list (tl (dims A))) i)) [0..<hd (dims A)]))) = A
[PROOF STEP]
by (auto simp add: 1 assms)
[PROOF STATE]
proof (state)
this:
subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A

goal (1 subgoal):
 1. subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subtensor_combine (tl (dims A)) (map (subtensor A) [0..<hd (dims A)]) = A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_conv_abscissa_prod_le:
  assumes "\<And>x. x \<in> A \<Longrightarrow> abs_conv_abscissa (f x :: 'a :: dirichlet_series fds) \<le> d"
  shows   "abs_conv_abscissa (prod f A) \<le> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_conv_abscissa (prod f A) \<le> d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> abs_conv_abscissa (f ?x) \<le> d

goal (1 subgoal):
 1. abs_conv_abscissa (prod f A) \<le> d
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto intro!: abs_conv_abscissa_mult_leI)


[STATEMENT]
lemma has_derivative_component[simp]: \<comment> \<open> following @{thm has_derivative_componentwise_within} \<close>
  "(D f \<mapsto> f' at x within S) \<longleftrightarrow> (\<forall>i. D (\<lambda>s. f s $ i) \<mapsto> (\<lambda>s. f' s $ i) at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D f \<mapsto> f' at x within S = (\<forall>i. D (\<lambda>s. f s $ i) \<mapsto> (\<lambda>s. f' s $ i) at x within S)
[PROOF STEP]
by (simp add: has_derivative_within tendsto_nth_iff
      bounded_linear_component all_conj_distrib)


[STATEMENT]
lemma integrable_bounded_linear: "bounded_linear T \<Longrightarrow> integrable M f \<Longrightarrow> integrable M (\<lambda>x. T (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded_linear T; integrable M f\<rbrakk> \<Longrightarrow> integrable M (\<lambda>x. T (f x))
[PROOF STEP]
by (auto simp: integrable.simps intro: has_bochner_integral_bounded_linear)


[STATEMENT]
lemma distinct_delete_index [simp, intro]:
  assumes "distinct xs"
  shows   "distinct (delete_index n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (delete_index n xs)
[PROOF STEP]
proof (cases "n < length xs")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n < length xs \<Longrightarrow> distinct (delete_index n xs)
 2. \<not> n < length xs \<Longrightarrow> distinct (delete_index n xs)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n < length xs

goal (2 subgoals):
 1. n < length xs \<Longrightarrow> distinct (delete_index n xs)
 2. \<not> n < length xs \<Longrightarrow> distinct (delete_index n xs)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
distinct xs
n < length xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distinct xs
n < length xs

goal (1 subgoal):
 1. distinct (delete_index n xs)
[PROOF STEP]
by (induction n xs rule: delete_index.induct) (auto simp: set_delete_index_distinct)
[PROOF STATE]
proof (state)
this:
distinct (delete_index n xs)

goal (1 subgoal):
 1. \<not> n < length xs \<Longrightarrow> distinct (delete_index n xs)
[PROOF STEP]
qed (simp_all add: delete_index_ge_length assms)


[STATEMENT]
lemma set_dfs_Cons:
  "set (dfs f (x # xs)) = set (dfs f xs) \<union> set (dfs f [x])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (dfs f (x # xs)) = set (dfs f xs) \<union> set (dfs f [x])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (dfs f (x # xs)) = set (dfs f xs) \<union> set (dfs f [x])
[PROOF STEP]
have "set (dfs f (x # xs)) = set (dfs f (rev xs @ [x]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (dfs f (x # xs)) = set (dfs f (rev xs @ [x]))
[PROOF STEP]
using set_dfs_rev[of f "rev xs @ [x]"]
[PROOF STATE]
proof (prove)
using this:
set (dfs f (rev (rev xs @ [x]))) = set (dfs f (rev xs @ [x]))

goal (1 subgoal):
 1. set (dfs f (x # xs)) = set (dfs f (rev xs @ [x]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (dfs f (x # xs)) = set (dfs f (rev xs @ [x]))

goal (1 subgoal):
 1. set (dfs f (x # xs)) = set (dfs f xs) \<union> set (dfs f [x])
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
set (dfs f (x # xs)) = set (dfs f (rev xs @ [x]))

goal (1 subgoal):
 1. set (dfs f (x # xs)) = set (dfs f xs) \<union> set (dfs f [x])
[PROOF STEP]
by (simp add: dfs_append set_dfs_rev)
[PROOF STATE]
proof (state)
this:
set (dfs f (x # xs)) = set (dfs f xs) \<union> set (dfs f [x])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unbind_lambda_lambda2:
  shows "Lam [x].Lam [x].(Var x)\<mapsto>[y,z],(Var z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lam [x].Lam [x].Var x \<mapsto> [y, z],Var z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Lam [x].Lam [x].Var x \<mapsto> [y, z],Var z
[PROOF STEP]
have "Lam [x].Lam [x].(Var x) = Lam [y].Lam [z].(Var z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lam [x].Lam [x].Var x = Lam [y].Lam [z].Var z
[PROOF STEP]
by (auto simp add: lam.inject alpha calc_atm abs_fresh fresh_atm)
[PROOF STATE]
proof (state)
this:
Lam [x].Lam [x].Var x = Lam [y].Lam [z].Var z

goal (1 subgoal):
 1. Lam [x].Lam [x].Var x \<mapsto> [y, z],Var z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Lam [x].Lam [x].Var x = Lam [y].Lam [z].Var z

goal (1 subgoal):
 1. Lam [x].Lam [x].Var x \<mapsto> [y, z],Var z
[PROOF STEP]
have "Lam [y].Lam [z].(Var z) \<mapsto> [y,z],(Var z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lam [y].Lam [z].Var z \<mapsto> [y, z],Var z
[PROOF STEP]
by (auto intro: unbind.intros)
[PROOF STATE]
proof (state)
this:
Lam [y].Lam [z].Var z \<mapsto> [y, z],Var z

goal (1 subgoal):
 1. Lam [x].Lam [x].Var x \<mapsto> [y, z],Var z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Lam [x].Lam [x].Var x = Lam [y].Lam [z].Var z
Lam [y].Lam [z].Var z \<mapsto> [y, z],Var z
[PROOF STEP]
show "Lam [x].Lam [x].(Var x)\<mapsto>[y,z],(Var z)"
[PROOF STATE]
proof (prove)
using this:
Lam [x].Lam [x].Var x = Lam [y].Lam [z].Var z
Lam [y].Lam [z].Var z \<mapsto> [y, z],Var z

goal (1 subgoal):
 1. Lam [x].Lam [x].Var x \<mapsto> [y, z],Var z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Lam [x].Lam [x].Var x \<mapsto> [y, z],Var z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lstrict_prefix_llength_less:
  assumes "lstrict_prefix xs ys"
  shows "llength xs < llength ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength xs < llength ys
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> llength xs < llength ys \<Longrightarrow> False
[PROOF STEP]
assume "\<not> llength xs < llength ys"
[PROOF STATE]
proof (state)
this:
\<not> llength xs < llength ys

goal (1 subgoal):
 1. \<not> llength xs < llength ys \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> llength xs < llength ys

goal (1 subgoal):
 1. \<not> llength xs < llength ys \<Longrightarrow> False
[PROOF STEP]
from \<open>lstrict_prefix xs ys\<close>
[PROOF STATE]
proof (chain)
picking this:
lstrict_prefix xs ys
[PROOF STEP]
have "xs \<sqsubseteq> ys" "xs \<noteq> ys"
[PROOF STATE]
proof (prove)
using this:
lstrict_prefix xs ys

goal (1 subgoal):
 1. xs \<sqsubseteq> ys &&& xs \<noteq> ys
[PROOF STEP]
unfolding lstrict_prefix_def
[PROOF STATE]
proof (prove)
using this:
xs \<sqsubseteq> ys \<and> xs \<noteq> ys

goal (1 subgoal):
 1. xs \<sqsubseteq> ys &&& xs \<noteq> ys
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
xs \<sqsubseteq> ys
xs \<noteq> ys

goal (1 subgoal):
 1. \<not> llength xs < llength ys \<Longrightarrow> False
[PROOF STEP]
from \<open>xs \<sqsubseteq> ys\<close>
[PROOF STATE]
proof (chain)
picking this:
xs \<sqsubseteq> ys
[PROOF STEP]
have "llength xs \<le> llength ys"
[PROOF STATE]
proof (prove)
using this:
xs \<sqsubseteq> ys

goal (1 subgoal):
 1. llength xs \<le> llength ys
[PROOF STEP]
by(rule lprefix_llength_le)
[PROOF STATE]
proof (state)
this:
llength xs \<le> llength ys

goal (1 subgoal):
 1. \<not> llength xs < llength ys \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> llength xs < llength ys
llength xs \<le> llength ys
[PROOF STEP]
have "llength xs = llength ys"
[PROOF STATE]
proof (prove)
using this:
\<not> llength xs < llength ys
llength xs \<le> llength ys

goal (1 subgoal):
 1. llength xs = llength ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
llength xs = llength ys

goal (1 subgoal):
 1. \<not> llength xs < llength ys \<Longrightarrow> False
[PROOF STEP]
with \<open>xs \<sqsubseteq> ys\<close>
[PROOF STATE]
proof (chain)
picking this:
xs \<sqsubseteq> ys
llength xs = llength ys
[PROOF STEP]
have "xs = ys"
[PROOF STATE]
proof (prove)
using this:
xs \<sqsubseteq> ys
llength xs = llength ys

goal (1 subgoal):
 1. xs = ys
[PROOF STEP]
by(rule lprefix_llength_eq_imp_eq)
[PROOF STATE]
proof (state)
this:
xs = ys

goal (1 subgoal):
 1. \<not> llength xs < llength ys \<Longrightarrow> False
[PROOF STEP]
with \<open>xs \<noteq> ys\<close>
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> ys
xs = ys
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> ys
xs = ys

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_fun_add:
  fixes f :: "'a::join_semilattice_zero \<Rightarrow> 'b::join_semilattice_zero"
  assumes "finite (X :: 'a set)"
  and fstrict: "f 0 = 0"
  and fadd: "\<And>x y. f (x + y) = f x + f y"
  shows "f (\<Sum> X) = \<Sum>(f ` X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<Sum> X) = \<Sum> (f ` X)
[PROOF STEP]
proof (induct rule: finite_induct[OF assms(1)])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f (\<Sum> {}) = \<Sum> (f ` {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
show "f (\<Sum>{}) = \<Sum>(f ` {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<Sum> {}) = \<Sum> (f ` {})
[PROOF STEP]
by (metis fstrict image_empty sum.empty)
[PROOF STATE]
proof (state)
this:
f (\<Sum> {}) = \<Sum> (f ` {})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
fix x :: 'a and  F ::" 'a set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
assume finF: "finite F"
    and indhyp: "f (\<Sum>F) = \<Sum>(f ` F)"
[PROOF STATE]
proof (state)
this:
finite F
f (\<Sum> F) = \<Sum> (f ` F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
have "f (\<Sum>(insert x F)) = f (x + \<Sum>F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<Sum> (insert x F)) = f (x + \<Sum> F)
[PROOF STEP]
by (metis sum_insert finF)
[PROOF STATE]
proof (state)
this:
f (\<Sum> (insert x F)) = f (x + \<Sum> F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (\<Sum> (insert x F)) = f (x + \<Sum> F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
have "... = f x + (f (\<Sum>F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (x + \<Sum> F) = f x + f (\<Sum> F)
[PROOF STEP]
by (rule fadd)
[PROOF STATE]
proof (state)
this:
f (x + \<Sum> F) = f x + f (\<Sum> F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (x + \<Sum> F) = f x + f (\<Sum> F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
have "... = f x + \<Sum>(f ` F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x + f (\<Sum> F) = f x + \<Sum> (f ` F)
[PROOF STEP]
by (metis indhyp)
[PROOF STATE]
proof (state)
this:
f x + f (\<Sum> F) = f x + \<Sum> (f ` F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f x + f (\<Sum> F) = f x + \<Sum> (f ` F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
have "... = \<Sum>(f ` (insert x F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x + \<Sum> (f ` F) = \<Sum> (f ` insert x F)
[PROOF STEP]
by (metis finF sum_fun_insert)
[PROOF STATE]
proof (state)
this:
f x + \<Sum> (f ` F) = \<Sum> (f ` insert x F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; f (\<Sum> F) = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
show "f (\<Sum>(insert x F)) = \<Sum>(f ` insert x F)"
[PROOF STATE]
proof (prove)
using this:
f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)

goal (1 subgoal):
 1. f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f (\<Sum> (insert x F)) = \<Sum> (f ` insert x F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_on_scaleC_right [intro]:
  fixes f :: \<open>'a \<Rightarrow> 'b :: complex_normed_vector\<close>
  assumes "c \<noteq> 0 \<Longrightarrow> f summable_on A"
  shows   "(\<lambda>x. c *\<^sub>C f x) summable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c *\<^sub>C f x) summable_on A
[PROOF STEP]
apply (cases \<open>c \<noteq> 0\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<noteq> 0 \<Longrightarrow> (\<lambda>x. c *\<^sub>C f x) summable_on A
 2. \<not> c \<noteq> 0 \<Longrightarrow> (\<lambda>x. c *\<^sub>C f x) summable_on A
[PROOF STEP]
apply (subst asm_rl[of \<open>(\<lambda>x. c *\<^sub>C f x) = (\<lambda>y. c *\<^sub>C y) o f\<close>], simp add: o_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<noteq> 0 \<Longrightarrow> (*\<^sub>C) c \<circ> f summable_on A
 2. \<not> c \<noteq> 0 \<Longrightarrow> (\<lambda>x. c *\<^sub>C f x) summable_on A
[PROOF STEP]
apply (rule summable_on_comm_additive)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. c \<noteq> 0 \<Longrightarrow> additive ((*\<^sub>C) c)
 2. c \<noteq> 0 \<Longrightarrow> isCont ((*\<^sub>C) c) (infsum f A)
 3. c \<noteq> 0 \<Longrightarrow> f summable_on A
 4. \<not> c \<noteq> 0 \<Longrightarrow> (\<lambda>x. c *\<^sub>C f x) summable_on A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0 \<Longrightarrow> f summable_on A

goal (4 subgoals):
 1. c \<noteq> 0 \<Longrightarrow> additive ((*\<^sub>C) c)
 2. c \<noteq> 0 \<Longrightarrow> isCont ((*\<^sub>C) c) (infsum f A)
 3. c \<noteq> 0 \<Longrightarrow> f summable_on A
 4. \<not> c \<noteq> 0 \<Longrightarrow> (\<lambda>x. c *\<^sub>C f x) summable_on A
[PROOF STEP]
by (auto simp add: scaleC_right.additive_axioms)


[STATEMENT]
lemma isCont_powr_complex [continuous_intros]:
  assumes "f z \<notin> \<real>\<^sub>\<le>\<^sub>0" "isCont f z" "isCont g z"
  shows   "isCont (\<lambda>z. f z powr g z :: complex) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>z. f z powr g z) z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f z \<notin> \<real>\<^sub>\<le>\<^sub>0
isCont f z
isCont g z

goal (1 subgoal):
 1. isCont (\<lambda>z. f z powr g z) z
[PROOF STEP]
unfolding isCont_def
[PROOF STATE]
proof (prove)
using this:
f z \<notin> \<real>\<^sub>\<le>\<^sub>0
f \<midarrow>z\<rightarrow> f z
g \<midarrow>z\<rightarrow> g z

goal (1 subgoal):
 1. (\<lambda>z. f z powr g z) \<midarrow>z\<rightarrow> f z powr g z
[PROOF STEP]
by (intro tendsto_powr_complex) simp_all


[STATEMENT]
lemma valuate_nonpos:
  fixes v :: "'a::linordered_rational_vector valuation"
  assumes "\<forall> x \<in> vars p. (coeff p x > 0 \<longrightarrow> v x \<le> 0) \<and> (coeff p x < 0 \<longrightarrow> v x \<ge> 0)"
  shows "p \<lbrace> v \<rbrace> \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<lbrace> v \<rbrace> \<le> (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>vars p. (0 < coeff p x \<longrightarrow> v x \<le> (0::'a)) \<and> (coeff p x < 0 \<longrightarrow> (0::'a) \<le> v x)

goal (1 subgoal):
 1. p \<lbrace> v \<rbrace> \<le> (0::'a)
[PROOF STEP]
using valuate_opposite_val[of p v]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>vars p. (0 < coeff p x \<longrightarrow> v x \<le> (0::'a)) \<and> (coeff p x < 0 \<longrightarrow> (0::'a) \<le> v x)
p \<lbrace> \<lambda>x. - v x \<rbrace> = - p \<lbrace> v \<rbrace>

goal (1 subgoal):
 1. p \<lbrace> v \<rbrace> \<le> (0::'a)
[PROOF STEP]
using valuate_nonneg[of p "\<lambda> x. - v x"]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>vars p. (0 < coeff p x \<longrightarrow> v x \<le> (0::'a)) \<and> (coeff p x < 0 \<longrightarrow> (0::'a) \<le> v x)
p \<lbrace> \<lambda>x. - v x \<rbrace> = - p \<lbrace> v \<rbrace>
\<forall>x\<in>vars p. (0 < coeff p x \<longrightarrow> (0::'a) \<le> - v x) \<and> (coeff p x < 0 \<longrightarrow> - v x \<le> (0::'a)) \<Longrightarrow> (0::'a) \<le> p \<lbrace> \<lambda>x. - v x \<rbrace>

goal (1 subgoal):
 1. p \<lbrace> v \<rbrace> \<le> (0::'a)
[PROOF STEP]
using scaleRat_leq2[of "0::'a" _ "-1"]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>vars p. (0 < coeff p x \<longrightarrow> v x \<le> (0::'a)) \<and> (coeff p x < 0 \<longrightarrow> (0::'a) \<le> v x)
p \<lbrace> \<lambda>x. - v x \<rbrace> = - p \<lbrace> v \<rbrace>
\<forall>x\<in>vars p. (0 < coeff p x \<longrightarrow> (0::'a) \<le> - v x) \<and> (coeff p x < 0 \<longrightarrow> - v x \<le> (0::'a)) \<Longrightarrow> (0::'a) \<le> p \<lbrace> \<lambda>x. - v x \<rbrace>
\<lbrakk>(0::'a) \<le> ?b; - 1 < 0\<rbrakk> \<Longrightarrow> - 1 *R ?b \<le> - 1 *R (0::'a)

goal (1 subgoal):
 1. p \<lbrace> v \<rbrace> \<le> (0::'a)
[PROOF STEP]
using scaleRat_leq2[of _ "0::'a" "-1"]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>vars p. (0 < coeff p x \<longrightarrow> v x \<le> (0::'a)) \<and> (coeff p x < 0 \<longrightarrow> (0::'a) \<le> v x)
p \<lbrace> \<lambda>x. - v x \<rbrace> = - p \<lbrace> v \<rbrace>
\<forall>x\<in>vars p. (0 < coeff p x \<longrightarrow> (0::'a) \<le> - v x) \<and> (coeff p x < 0 \<longrightarrow> - v x \<le> (0::'a)) \<Longrightarrow> (0::'a) \<le> p \<lbrace> \<lambda>x. - v x \<rbrace>
\<lbrakk>(0::'a) \<le> ?b; - 1 < 0\<rbrakk> \<Longrightarrow> - 1 *R ?b \<le> - 1 *R (0::'a)
\<lbrakk>?a \<le> (0::'a); - 1 < 0\<rbrakk> \<Longrightarrow> - 1 *R (0::'a) \<le> - 1 *R ?a

goal (1 subgoal):
 1. p \<lbrace> v \<rbrace> \<le> (0::'a)
[PROOF STEP]
by force


[STATEMENT]
lemma algebraic_int_nth_root_real [intro]:
  assumes "algebraic_int x"
  shows   "algebraic_int (root n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_int (root n x)
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> algebraic_int (root n x)
 2. n \<noteq> 0 \<Longrightarrow> algebraic_int (root n x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> algebraic_int (root n x)
 2. n \<noteq> 0 \<Longrightarrow> algebraic_int (root n x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_int (root n x)
[PROOF STEP]
proof (rule algebraic_int_root)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. algebraic_int ?y
 2. poly ?p (root n x) = ?y
 3. \<forall>i. coeff ?p i \<in> \<int>
 4. lead_coeff ?p = 1
 5. 0 < degree ?p
[PROOF STEP]
show "poly (monom 1 n) (root n x) = (if even n then \<bar>x\<bar> else x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (monom 1 n) (root n x) = (if even n then \<bar>x\<bar> else x)
[PROOF STEP]
using sgn_power_root[of n x] False
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> sgn (root n x) * \<bar>root n x\<bar> ^ n = x
n \<noteq> 0

goal (1 subgoal):
 1. poly (monom 1 n) (root n x) = (if even n then \<bar>x\<bar> else x)
[PROOF STEP]
by (auto simp add: poly_monom sgn_if split: if_splits)
[PROOF STATE]
proof (state)
this:
poly (monom 1 n) (root n x) = (if even n then \<bar>x\<bar> else x)

goal (4 subgoals):
 1. algebraic_int (if even n then \<bar>x\<bar> else x)
 2. \<forall>i. coeff (monom 1 n) i \<in> \<int>
 3. lead_coeff (monom 1 n) = 1
 4. 0 < degree (monom 1 n)
[PROOF STEP]
qed (use False assms in \<open>auto simp: degree_monom_eq\<close>)
[PROOF STATE]
proof (state)
this:
algebraic_int (root n x)

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> algebraic_int (root n x)
[PROOF STEP]
qed auto


[STATEMENT]
lemma ereal_divide_le_posI:
  fixes x y z :: ereal
  shows "x > 0 \<Longrightarrow> z \<noteq> - \<infinity> \<Longrightarrow> z \<le> x * y \<Longrightarrow> z / x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; z \<noteq> - \<infinity>; z \<le> x * y\<rbrakk> \<Longrightarrow> z / x \<le> y
[PROOF STEP]
by (cases rule: ereal3_cases[of x y z])(auto simp: field_simps split: if_split_asm)


[STATEMENT]
lemma limit_nonempty:
  assumes fin: "finite (range x)"
  shows "\<exists>a. a \<in> limit x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. a \<in> limit x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a. a \<in> limit x
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite (range x)
[PROOF STEP]
obtain a where "a \<in> range x \<and> infinite (x -` {a})"
[PROOF STATE]
proof (prove)
using this:
finite (range x)

goal (1 subgoal):
 1. (\<And>a. a \<in> range x \<and> infinite (x -` {a}) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule inf_img_fin_domE) auto
[PROOF STATE]
proof (state)
this:
a \<in> range x \<and> infinite (x -` {a})

goal (1 subgoal):
 1. \<exists>a. a \<in> limit x
[PROOF STEP]
hence "a \<in> limit x"
[PROOF STATE]
proof (prove)
using this:
a \<in> range x \<and> infinite (x -` {a})

goal (1 subgoal):
 1. a \<in> limit x
[PROOF STEP]
by (auto simp add: limit_vimage)
[PROOF STATE]
proof (state)
this:
a \<in> limit x

goal (1 subgoal):
 1. \<exists>a. a \<in> limit x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> limit x

goal (1 subgoal):
 1. \<exists>a. a \<in> limit x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>a. a \<in> limit x

goal:
No subgoals!
[PROOF STEP]
qed