[STATEMENT]
lemma bifunctor_flip_ArrMap_app:
  assumes "category \<alpha> \<AA>"
    and "category \<alpha> \<BB>"
    and "\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "g \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>"
    and "f \<in>\<^sub>\<circ> \<BB>\<lparr>Arr\<rparr>"
  shows "bifunctor_flip \<AA> \<BB> \<FF>\<lparr>ArrMap\<rparr>\<lparr>f, g\<rparr>\<^sub>\<bullet> = \<FF>\<lparr>ArrMap\<rparr>\<lparr>g, f\<rparr>\<^sub>\<bullet>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>bifunctor_flip \<AA> \<BB> \<FF>\<^esub> g = g \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>\<FF>\<^esub> f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
g \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>
f \<in>\<^sub>\<circ> \<BB>\<lparr>Arr\<rparr>

goal (1 subgoal):
 1. f \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>bifunctor_flip \<AA> \<BB> \<FF>\<^esub> g = g \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>\<FF>\<^esub> f
[PROOF STEP]
unfolding bifunctor_flip_components
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
g \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>
f \<in>\<^sub>\<circ> \<BB>\<lparr>Arr\<rparr>

goal (1 subgoal):
 1. fflip (\<FF>\<lparr>ArrMap\<rparr>) \<lparr>f, g\<rparr>\<^sub>\<bullet> = g \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>\<FF>\<^esub> f
[PROOF STEP]
by
    (
      cs_concl cs_shallow
        cs_simp: V_cs_simps cat_cs_simps cs_intro: cat_prod_cs_intros
    )


[STATEMENT]
lemma distinct_roots_of_complex_poly: "distinct (roots_of_complex_poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (roots_of_complex_poly p)
[PROOF STEP]
unfolding roots_of_complex_poly_def roots_of_complex_rf_polys_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (if p = 0 then [] else concat (map roots_of_complex_rf_poly (polys_rf (yun_polys p))))
[PROOF STEP]
using roots_of_rf_yun_polys_distinct[of roots_of_complex_rf_poly p, OF roots_of_complex_rf_poly]
[PROOF STATE]
proof (prove)
using this:
distinct (concat (map roots_of_complex_rf_poly (polys_rf (yun_polys p))))

goal (1 subgoal):
 1. distinct (if p = 0 then [] else concat (map roots_of_complex_rf_poly (polys_rf (yun_polys p))))
[PROOF STEP]
by auto


[STATEMENT]
lemma integrable_uniform_count_measure_finite:
  fixes g :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  shows "finite A \<Longrightarrow> integrable (uniform_count_measure A) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> integrable (uniform_count_measure A) g
[PROOF STEP]
unfolding uniform_count_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> integrable (point_measure A (\<lambda>x. ennreal (1 / real (card A)))) g
[PROOF STEP]
by (simp add: integrable_point_measure_finite)


[STATEMENT]
lemma residue_simple':
  assumes "open s" "0 \<in> s" "f holomorphic_on s"
  shows   "residue (\<lambda>w. f w / w) 0 = f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (\<lambda>w. f w / w) 0 = f 0
[PROOF STEP]
using residue_simple[of s 0 f] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>open s; 0 \<in> s; f holomorphic_on s\<rbrakk> \<Longrightarrow> residue (\<lambda>w. f w / (w - 0)) 0 = f 0
open s
0 \<in> s
f holomorphic_on s

goal (1 subgoal):
 1. residue (\<lambda>w. f w / w) 0 = f 0
[PROOF STEP]
by simp


[STATEMENT]
lemma bl2nat_simps[simp]: "bl2nat (Oc # Oc\<up>x) 0 = (2 * 2 ^ x - Suc 0)"
  "bl2nat (Bk\<up>x) n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bl2nat (Oc # Oc \<up> x) 0 = 2 * 2 ^ x - Suc 0 &&& bl2nat (Bk \<up> x) n = 0
[PROOF STEP]
by(induct x;force simp: bl2nat.simps bl2nat_double exp_ind)+


[STATEMENT]
lemma i0_ne_infinity [simp]: "0 \<noteq> (\<infinity>::enat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<noteq> \<infinity>
[PROOF STEP]
by (simp add: zero_enat_def)


[STATEMENT]
lemma sset_cycle[simp]:
  assumes "xs \<noteq> []"
  shows "sset (cycle xs) = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sset (cycle xs) = set xs
[PROOF STEP]
proof (intro set_eqI iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> sset (cycle xs) \<Longrightarrow> x \<in> set xs
 2. \<And>x. x \<in> set xs \<Longrightarrow> x \<in> sset (cycle xs)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> sset (cycle xs) \<Longrightarrow> x \<in> set xs
 2. \<And>x. x \<in> set xs \<Longrightarrow> x \<in> sset (cycle xs)
[PROOF STEP]
assume "x \<in> sset (cycle xs)"
[PROOF STATE]
proof (state)
this:
x \<in> sset (cycle xs)

goal (2 subgoals):
 1. \<And>x. x \<in> sset (cycle xs) \<Longrightarrow> x \<in> set xs
 2. \<And>x. x \<in> set xs \<Longrightarrow> x \<in> sset (cycle xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> sset (cycle xs)
[PROOF STEP]
show "x \<in> set xs"
[PROOF STATE]
proof (prove)
using this:
x \<in> sset (cycle xs)

goal (1 subgoal):
 1. x \<in> set xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> sset (cycle xs)
xs \<noteq> []

goal (1 subgoal):
 1. x \<in> set xs
[PROOF STEP]
by (induction "cycle xs" arbitrary: xs rule: sset_induct) (fastforce simp: neq_Nil_conv)+
[PROOF STATE]
proof (state)
this:
x \<in> set xs

goal (1 subgoal):
 1. \<And>x. x \<in> set xs \<Longrightarrow> x \<in> sset (cycle xs)
[PROOF STEP]
qed (metis assms UnI1 cycle_decomp sset_shift)


[STATEMENT]
lemma rat_to_normalized_int_poly_code[code]:
  "rat_to_normalized_int_poly p = (if p = 0 then (1,0) else case rat_to_int_poly p of (s,q)
    \<Rightarrow> let c = content q in (of_int c / of_int s, sdiv_poly q c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_to_normalized_int_poly p = (if p = 0 then (1, 0) else case rat_to_int_poly p of (s, q) \<Rightarrow> let c = content q in (rat_of_int c / rat_of_int s, sdiv_poly q c))
[PROOF STEP]
unfolding Let_def rat_to_normalized_int_poly_def primitive_part_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if p = 0 then (1, 0) else case rat_to_int_poly p of (s, q) \<Rightarrow> (rat_of_int (content q) / rat_of_int s, sdiv_poly q (content q))) = (if p = 0 then (1, 0) else case rat_to_int_poly p of (s, q) \<Rightarrow> (rat_of_int (content q) / rat_of_int s, sdiv_poly q (content q)))
[PROOF STEP]
..


[STATEMENT]
lemma pochhammer_product:
  "m \<le> n \<Longrightarrow> pochhammer z n = pochhammer z m * pochhammer (z + of_nat m) (n - m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> pochhammer z n = pochhammer z m * pochhammer (z + of_nat m) (n - m)
[PROOF STEP]
using pochhammer_product'[of z m "n - m"]
[PROOF STATE]
proof (prove)
using this:
pochhammer z (m + (n - m)) = pochhammer z m * pochhammer (z + of_nat m) (n - m)

goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> pochhammer z n = pochhammer z m * pochhammer (z + of_nat m) (n - m)
[PROOF STEP]
by simp


[STATEMENT]
lemma dca_language:
  "(\<And>w. to_stream w \<in> DCA.language \<AA> \<longleftrightarrow> w \<Turnstile>\<^sub>n \<phi>) \<Longrightarrow> DCA.language \<AA> = {w. to_omega w \<Turnstile>\<^sub>n \<phi>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>w. (to_stream w \<in> DCA.language \<AA>) = w \<Turnstile>\<^sub>n \<phi>) \<Longrightarrow> DCA.language \<AA> = {w. to_omega w \<Turnstile>\<^sub>n \<phi>}
[PROOF STEP]
by (metis (mono_tags, lifting) Collect_cong dca.language_def mem_Collect_eq to_stream_to_omega)


[STATEMENT]
lemma find_non0: assumes sel_fun: "det_selection_fun sel_fun"
  and res: "find_non0 l A = Some m"
  shows "A $$ (m,l) \<noteq> 0" "l < m" "m < dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (m, l) \<noteq> (0::'a) &&& l < m &&& m < dim_row A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A $$ (m, l) \<noteq> (0::'a)
 2. l < m
 3. m < dim_row A
[PROOF STEP]
let ?xs = "filter (\<lambda> (i,Ail). Ail \<noteq> 0) (map (\<lambda> i. (i, A $$ (i,l))) [Suc l..<dim_row A])"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A $$ (m, l) \<noteq> (0::'a)
 2. l < m
 3. m < dim_row A
[PROOF STEP]
from res[unfolded find_non0_def Let_def]
[PROOF STATE]
proof (chain)
picking this:
(case filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A]) of [] \<Rightarrow> None | a # list \<Rightarrow> Some (sel_fun (filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A])))) = Some m
[PROOF STEP]
have xs: "?xs \<noteq> []" and m: "m = sel_fun ?xs"
[PROOF STATE]
proof (prove)
using this:
(case filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A]) of [] \<Rightarrow> None | a # list \<Rightarrow> Some (sel_fun (filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A])))) = Some m

goal (1 subgoal):
 1. filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A]) \<noteq> [] &&& m = sel_fun (filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A]))
[PROOF STEP]
by (cases ?xs, auto)+
[PROOF STATE]
proof (state)
this:
filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A]) \<noteq> []
m = sel_fun (filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A]))

goal (3 subgoals):
 1. A $$ (m, l) \<noteq> (0::'a)
 2. l < m
 3. m < dim_row A
[PROOF STEP]
from det_selection_funD[OF sel_fun xs, folded m]
[PROOF STATE]
proof (chain)
picking this:
m \<in> fst ` set (filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A]))
[PROOF STEP]
show "A $$ (m, l) \<noteq> 0" "l < m" "m < dim_row A"
[PROOF STATE]
proof (prove)
using this:
m \<in> fst ` set (filter (\<lambda>(i, Ail). Ail \<noteq> (0::'a)) (map (\<lambda>i. (i, A $$ (i, l))) [Suc l..<dim_row A]))

goal (1 subgoal):
 1. A $$ (m, l) \<noteq> (0::'a) &&& l < m &&& m < dim_row A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A $$ (m, l) \<noteq> (0::'a)
l < m
m < dim_row A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_zip_rightI: "\<lbrakk> x \<in> set ys; length xs \<ge> length ys \<rbrakk> \<Longrightarrow> \<exists>z. (z, x) \<in> set (zip xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> set ys; length ys \<le> length xs\<rbrakk> \<Longrightarrow> \<exists>z. (z, x) \<in> set (zip xs ys)
[PROOF STEP]
by(fastforce simp add: in_set_zip in_set_conv_nth simp del: length_greater_0_conv intro!: nth_zip conjI[rotated])


[STATEMENT]
lemma row_mult[simp]: assumes m: "A \<in> carrier_mat nr n" "B \<in> carrier_mat n nc"
  and i: "i < nr"
  shows "row (A * B) i = vec nc (\<lambda> j. row A i \<bullet> col B j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (A * B) i = vec nc (\<lambda>j. row A i \<bullet> col B j)
[PROOF STEP]
by (rule eq_vecI, insert m i, auto)


[STATEMENT]
lemma DERIV_power[derivative_intros]:
  "(f has_field_derivative D) (at x within s) \<Longrightarrow>
    ((\<lambda>x. f x ^ n) has_field_derivative of_nat n * (D * f x ^ (n - Suc 0))) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative D) (at x within s) \<Longrightarrow> ((\<lambda>x. f x ^ n) has_field_derivative of_nat n * (D * f x ^ (n - Suc 0))) (at x within s)
[PROOF STEP]
by (rule has_derivative_imp_has_field_derivative[OF has_derivative_power])
     (auto simp: has_field_derivative_def)


[STATEMENT]
lemma not_span_independent_insert:
  fixes v :: "('a::real_vector)^'n"
  assumes "independent S" and "v \<notin> span S"
  shows "independent (insert v S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent (insert v S)
[PROOF STEP]
by (simp add: assms independent_insert)


[STATEMENT]
lemma merge_map: "sorted_distinct ns \<Longrightarrow> sorted_distinct ms \<Longrightarrow> set ns \<inter> set ms = {} \<Longrightarrow>
  map snd (merge (zip ns (map \<sigma> ns)) (zip ms (map \<sigma> ms))) = map \<sigma> (sort (ns @ ms))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted_distinct ns; sorted_distinct ms; set ns \<inter> set ms = {}\<rbrakk> \<Longrightarrow> map snd (merge (zip ns (map \<sigma> ns)) (zip ms (map \<sigma> ms))) = map \<sigma> (sort (ns @ ms))
[PROOF STEP]
using merge_map'[of "zip ns (map \<sigma> ns)" "zip ms (map \<sigma> ms)" \<sigma>]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sorted_distinct (map fst (zip ns (map \<sigma> ns))); sorted_distinct (map fst (zip ms (map \<sigma> ms))); fst ` set (zip ns (map \<sigma> ns)) \<inter> fst ` set (zip ms (map \<sigma> ms)) = {}; map snd (zip ns (map \<sigma> ns)) = map \<sigma> (map fst (zip ns (map \<sigma> ns))); map snd (zip ms (map \<sigma> ms)) = map \<sigma> (map fst (zip ms (map \<sigma> ms)))\<rbrakk> \<Longrightarrow> map snd (merge (zip ns (map \<sigma> ns)) (zip ms (map \<sigma> ms))) = map \<sigma> (sort (map fst (zip ns (map \<sigma> ns)) @ map fst (zip ms (map \<sigma> ms))))

goal (1 subgoal):
 1. \<lbrakk>sorted_distinct ns; sorted_distinct ms; set ns \<inter> set ms = {}\<rbrakk> \<Longrightarrow> map snd (merge (zip ns (map \<sigma> ns)) (zip ms (map \<sigma> ms))) = map \<sigma> (sort (ns @ ms))
[PROOF STEP]
by auto (metis length_map list.set_map map_fst_zip)


[STATEMENT]
lemma rel_fun_iff_geq_image2p: "rel_fun R S f g = (image2p f g R \<le> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_fun R S f g = (image2p f g R \<le> S)
[PROOF STEP]
unfolding rel_fun_def image2p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. R x y \<longrightarrow> S (f x) (g y)) = ((\<lambda>x y. \<exists>x' y'. R x' y' \<and> f x' = x \<and> g y' = y) \<le> S)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in weak_lower_semilattice) meet_le:
  assumes sub: "z \<sqsubseteq> x"  "z \<sqsubseteq> y"
    and x: "x \<in> carrier L" and y: "y \<in> carrier L" and z: "z \<in> carrier L"
  shows "z \<sqsubseteq> x \<sqinter> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<sqsubseteq> x \<sqinter> y
[PROOF STEP]
proof (rule meetI [OF _ x y])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. is_glb L i {x, y} \<Longrightarrow> z \<sqsubseteq> i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. is_glb L i {x, y} \<Longrightarrow> z \<sqsubseteq> i
[PROOF STEP]
assume "greatest L i (Lower L {x, y})"
[PROOF STATE]
proof (state)
this:
is_glb L i {x, y}

goal (1 subgoal):
 1. \<And>i. is_glb L i {x, y} \<Longrightarrow> z \<sqsubseteq> i
[PROOF STEP]
with sub z
[PROOF STATE]
proof (chain)
picking this:
z \<sqsubseteq> x
z \<sqsubseteq> y
z \<in> carrier L
is_glb L i {x, y}
[PROOF STEP]
show "z \<sqsubseteq> i"
[PROOF STATE]
proof (prove)
using this:
z \<sqsubseteq> x
z \<sqsubseteq> y
z \<in> carrier L
is_glb L i {x, y}

goal (1 subgoal):
 1. z \<sqsubseteq> i
[PROOF STEP]
by (fast elim: greatest_le intro: Lower_memI)
[PROOF STATE]
proof (state)
this:
z \<sqsubseteq> i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rep_account_plus [simp]:
  "\<pi> (\<alpha>\<^sub>1 + \<alpha>\<^sub>2) = (\<lambda> n. \<pi> \<alpha>\<^sub>1 n + \<pi> \<alpha>\<^sub>2 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> (\<alpha>\<^sub>1 + \<alpha>\<^sub>2) = (\<lambda>n. \<pi> \<alpha>\<^sub>1 n + \<pi> \<alpha>\<^sub>2 n)
[PROOF STEP]
unfolding plus_account_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> (\<iota> (\<lambda>n. \<pi> \<alpha>\<^sub>1 n + \<pi> \<alpha>\<^sub>2 n)) = (\<lambda>n. \<pi> \<alpha>\<^sub>1 n + \<pi> \<alpha>\<^sub>2 n)
[PROOF STEP]
by (metis (full_types)
        Abs_account_cases
        Abs_account_inverse
        fin_support_closed_under_addition)


[STATEMENT]
lemma null_set_Int1:
  assumes "B \<in> null_sets M" "A \<in> sets M" shows "A \<inter> B \<in> null_sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B \<in> null_sets M
[PROOF STEP]
proof (intro CollectI conjI null_setsI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. emeasure M (A \<inter> B) = 0
 2. A \<inter> B \<in> sets M
[PROOF STEP]
show "emeasure M (A \<inter> B) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (A \<inter> B) = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<in> null_sets M
A \<in> sets M

goal (1 subgoal):
 1. emeasure M (A \<inter> B) = 0
[PROOF STEP]
by (intro emeasure_eq_0[of B _ "A \<inter> B"]) auto
[PROOF STATE]
proof (state)
this:
emeasure M (A \<inter> B) = 0

goal (1 subgoal):
 1. A \<inter> B \<in> sets M
[PROOF STEP]
qed (insert assms, auto)


[STATEMENT]
lemma absolutely_integrable_bounded_variation:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes f: "f absolutely_integrable_on UNIV"
  obtains B where "\<forall>d. d division_of (\<Union>d) \<longrightarrow> sum (\<lambda>k. norm (integral k f)) d \<le> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (rule that[of "integral UNIV (\<lambda>x. norm (f x))"]; safe)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
fix d :: "'a set set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
assume d: "d division_of \<Union>d"
[PROOF STATE]
proof (state)
this:
d division_of \<Union> d

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
have *: "k \<in> d \<Longrightarrow> f absolutely_integrable_on k" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<in> d \<Longrightarrow> f absolutely_integrable_on k
[PROOF STEP]
using f[THEN set_integrable_subset, of k] division_ofD(2,4)[OF d, of k]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k \<in> sets lebesgue; k \<subseteq> UNIV\<rbrakk> \<Longrightarrow> f absolutely_integrable_on k
k \<in> d \<Longrightarrow> k \<subseteq> \<Union> d
k \<in> d \<Longrightarrow> \<exists>a b. k = cbox a b

goal (1 subgoal):
 1. k \<in> d \<Longrightarrow> f absolutely_integrable_on k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k \<in> d \<Longrightarrow> f absolutely_integrable_on ?k

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
note d' = division_ofD[OF d]
[PROOF STATE]
proof (state)
this:
finite d
?K \<in> d \<Longrightarrow> ?K \<subseteq> \<Union> d
?K \<in> d \<Longrightarrow> ?K \<noteq> {}
?K \<in> d \<Longrightarrow> \<exists>a b. ?K = cbox a b
\<lbrakk>?K1.0 \<in> d; ?K2.0 \<in> d; ?K1.0 \<noteq> ?K2.0\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}
\<Union> d = \<Union> d

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
have "(\<Sum>k\<in>d. norm (integral k f)) = (\<Sum>k\<in>d. norm (LINT x:k|lebesgue. f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>d. norm (integral k f)) = (\<Sum>k\<in>d. norm (set_lebesgue_integral lebesgue k f))
[PROOF STEP]
by (intro sum.cong refl arg_cong[where f=norm] set_lebesgue_integral_eq_integral(2)[symmetric] *)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. norm (integral k f)) = (\<Sum>k\<in>d. norm (set_lebesgue_integral lebesgue k f))

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. norm (integral k f)) = (\<Sum>k\<in>d. norm (set_lebesgue_integral lebesgue k f))

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
have "\<dots> \<le> (\<Sum>k\<in>d. LINT x:k|lebesgue. norm (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>d. norm (set_lebesgue_integral lebesgue k f)) \<le> (\<Sum>k\<in>d. \<integral>x\<in>k. norm (f x)\<partial>lebesgue)
[PROOF STEP]
by (intro sum_mono set_integral_norm_bound *)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. norm (set_lebesgue_integral lebesgue k f)) \<le> (\<Sum>k\<in>d. \<integral>x\<in>k. norm (f x)\<partial>lebesgue)

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. norm (set_lebesgue_integral lebesgue k f)) \<le> (\<Sum>k\<in>d. \<integral>x\<in>k. norm (f x)\<partial>lebesgue)

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
have "\<dots> = (\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>d. \<integral>x\<in>k. norm (f x)\<partial>lebesgue) = (\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x)))
[PROOF STEP]
by (intro sum.cong refl set_lebesgue_integral_eq_integral(2) set_integrable_norm *)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. \<integral>x\<in>k. norm (f x)\<partial>lebesgue) = (\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x)))

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. \<integral>x\<in>k. norm (f x)\<partial>lebesgue) = (\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x)))

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
have "\<dots> \<le> integral (\<Union>d) (\<lambda>x. norm (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x))) \<le> integral (\<Union> d) (\<lambda>x. norm (f x))
[PROOF STEP]
using integrable_on_subdivision[OF d] assms f
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f integrable_on ?S; \<Union> d \<subseteq> ?S\<rbrakk> \<Longrightarrow> ?f integrable_on \<Union> d
f absolutely_integrable_on UNIV
f absolutely_integrable_on UNIV

goal (1 subgoal):
 1. (\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x))) \<le> integral (\<Union> d) (\<lambda>x. norm (f x))
[PROOF STEP]
unfolding absolutely_integrable_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f integrable_on ?S; \<Union> d \<subseteq> ?S\<rbrakk> \<Longrightarrow> ?f integrable_on \<Union> d
f integrable_on UNIV \<and> (\<lambda>x. norm (f x)) integrable_on UNIV
f integrable_on UNIV \<and> (\<lambda>x. norm (f x)) integrable_on UNIV

goal (1 subgoal):
 1. (\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x))) \<le> integral (\<Union> d) (\<lambda>x. norm (f x))
[PROOF STEP]
by (subst integral_combine_division_topdown[OF _ d]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x))) \<le> integral (\<Union> d) (\<lambda>x. norm (f x))

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. integral k (\<lambda>x. norm (f x))) \<le> integral (\<Union> d) (\<lambda>x. norm (f x))

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
have "\<dots> \<le> integral UNIV (\<lambda>x. norm (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (\<Union> d) (\<lambda>x. norm (f x)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
using integrable_on_subdivision[OF d] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f integrable_on ?S; \<Union> d \<subseteq> ?S\<rbrakk> \<Longrightarrow> ?f integrable_on \<Union> d
f absolutely_integrable_on UNIV

goal (1 subgoal):
 1. integral (\<Union> d) (\<lambda>x. norm (f x)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
unfolding absolutely_integrable_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f integrable_on ?S; \<Union> d \<subseteq> ?S\<rbrakk> \<Longrightarrow> ?f integrable_on \<Union> d
f integrable_on UNIV \<and> (\<lambda>x. norm (f x)) integrable_on UNIV

goal (1 subgoal):
 1. integral (\<Union> d) (\<lambda>x. norm (f x)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
by (intro integral_subset_le) auto
[PROOF STATE]
proof (state)
this:
integral (\<Union> d) (\<lambda>x. norm (f x)) \<le> integral UNIV (\<lambda>x. norm (f x))

goal (1 subgoal):
 1. \<And>d. \<lbrakk>\<And>B. \<forall>d. d division_of \<Union> d \<longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> B \<Longrightarrow> thesis; d division_of \<Union> d\<rbrakk> \<Longrightarrow> (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
show "(\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))

goal (1 subgoal):
 1. (\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>d. norm (integral k f)) \<le> integral UNIV (\<lambda>x. norm (f x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma strict_sorted_imp_less_sets:
  "strict_sorted (as @ bs) \<Longrightarrow> (list.set as) \<lless> (list.set bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_sorted (as @ bs) \<Longrightarrow> set as \<lless> set bs
[PROOF STEP]
by (simp add: less_sets_def sorted_wrt_append)


[STATEMENT]
lemma range_is_csubspace[simp]:
  assumes a1: "clinear f"
  shows "csubspace (range f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csubspace (range f)
[PROOF STEP]
using assms complex_vector.linear_subspace_image complex_vector.subspace_UNIV
[PROOF STATE]
proof (prove)
using this:
clinear f
\<lbrakk>clinear ?f; csubspace ?S\<rbrakk> \<Longrightarrow> csubspace (?f ` ?S)
csubspace UNIV

goal (1 subgoal):
 1. csubspace (range f)
[PROOF STEP]
by blast


[STATEMENT]
lemma testN_post1:
  "f k \<Longrightarrow> adjoint (testN k) * post * testN k = testN k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f k \<Longrightarrow> adjoint (testN k) * post * testN k = testN k
[PROOF STEP]
apply (subst assoc_mult_mat[of _ N N _ N _ N])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. f k \<Longrightarrow> adjoint (testN k) \<in> carrier_mat N N
 2. f k \<Longrightarrow> post \<in> carrier_mat N N
 3. f k \<Longrightarrow> testN k \<in> carrier_mat N N
 4. f k \<Longrightarrow> adjoint (testN k) * (post * testN k) = testN k
[PROOF STEP]
apply (auto simp add: adjoint_dim testN_dim post_dim)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f k \<Longrightarrow> adjoint (testN k) * (post * testN k) = testN k
[PROOF STEP]
apply (subst post_mult_testNk, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f k \<Longrightarrow> adjoint (testN k) * testN k = testN k
[PROOF STEP]
unfolding hermitian_testN[unfolded hermitian_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f k \<Longrightarrow> testN k * testN k = testN k
[PROOF STEP]
using testN_mult_testN
[PROOF STATE]
proof (prove)
using this:
testN ?k * testN ?k = testN ?k

goal (1 subgoal):
 1. f k \<Longrightarrow> testN k * testN k = testN k
[PROOF STEP]
by auto


[STATEMENT]
lemma empty_set_less_aux [simp]: "{} \<sqsubset>' A \<longleftrightarrow> A \<noteq> {} \<and> finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({} \<sqsubset>' A) = (A \<noteq> {} \<and> finite A)
[PROOF STEP]
by(auto 4 3 simp add: set_less_aux_def intro!: Min_eqI intro: bexI[where x="Min A"] order_trans[where y="Min A"] Min_in)


[STATEMENT]
lemma landau_gt_1_in_cong:
  "landau_symbol L L' Lr \<Longrightarrow> (\<And>x::real. x > 1 \<Longrightarrow> f x = g x) \<Longrightarrow> f \<in> L at_top (h) \<longleftrightarrow> g \<in> L at_top (h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>landau_symbol L L' Lr; \<And>x. 1 < x \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> (f \<in> L at_top h) = (g \<in> L at_top h)
[PROOF STEP]
by (auto intro: eventually_mono [OF eventually_gt_at_top[of 1]] elim!: landau_symbol.in_cong)


[STATEMENT]
lemma wlp_while_unfold: "wlp (WHILE b DO c) Q s = (if bval b s then wlp c (wlp (WHILE b DO c) Q) s else Q s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.wlp (WHILE b DO c) Q s = (if bval b s then local.wlp c (local.wlp (WHILE b DO c) Q) s else Q s)
[PROOF STEP]
apply (subst wlp_equiv[OF while_unfold])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.wlp (IF b THEN c;; WHILE b DO c ELSE SKIP) Q s = (if bval b s then local.wlp c (local.wlp (WHILE b DO c) Q) s else Q s)
[PROOF STEP]
apply (simp add: wlp_eq')
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sup_pres_disj: "x \<in> disjunctive \<Longrightarrow> y \<in> disjunctive \<Longrightarrow> x \<squnion> y \<in> disjunctive"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> disjunctive; y \<in> disjunctive\<rbrakk> \<Longrightarrow> x \<squnion> y \<in> disjunctive
[PROOF STEP]
apply (subst disjunctive_def, safe)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ya z. \<lbrakk>x \<in> disjunctive; y \<in> disjunctive\<rbrakk> \<Longrightarrow> (x \<squnion> y) * (ya \<squnion> z) = (x \<squnion> y) * ya \<squnion> (x \<squnion> y) * z
[PROOF STEP]
apply (simp add: sup_comp disjunctiveD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ya z. \<lbrakk>x \<in> disjunctive; y \<in> disjunctive\<rbrakk> \<Longrightarrow> x * ya \<squnion> x * z \<squnion> (y * ya \<squnion> y * z) = x * ya \<squnion> y * ya \<squnion> (x * z \<squnion> y * z)
[PROOF STEP]
by (metis (opaque_lifting, no_types) sup_assoc sup_left_commute)


[STATEMENT]
lemma aux1[intro]: "\<lbrakk> set l \<subset> {0..<N}; distinct l \<rbrakk> \<Longrightarrow> length l < N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set l \<subset> {0..<N}; distinct l\<rbrakk> \<Longrightarrow> length l < N
[PROOF STEP]
apply (simp add: distinct_card[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set l \<subset> {0..<N}; distinct l\<rbrakk> \<Longrightarrow> card (set l) < N
[PROOF STEP]
apply (drule psubset_card_mono[rotated])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. distinct l \<Longrightarrow> finite {0..<N}
 2. \<lbrakk>distinct l; card (set l) < card {0..<N}\<rbrakk> \<Longrightarrow> card (set l) < N
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma degree_diff_less: "degree p < n \<Longrightarrow> degree q < n \<Longrightarrow> degree (p - q) < n"
  for p q :: "'a::ab_group_add poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>degree p < n; degree q < n\<rbrakk> \<Longrightarrow> degree (p - q) < n
[PROOF STEP]
using degree_add_less [of p n "- q"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>degree p < n; degree (- q) < n\<rbrakk> \<Longrightarrow> degree (p + - q) < n

goal (1 subgoal):
 1. \<lbrakk>degree p < n; degree q < n\<rbrakk> \<Longrightarrow> degree (p - q) < n
[PROOF STEP]
by simp


[STATEMENT]
lemma meet_above_iff:
  fixes x y z :: "'a :: Finite_Meet_cpo"
  shows "z \<sqsubseteq> x \<sqinter> y \<longleftrightarrow> z \<sqsubseteq> x \<and> z \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z \<sqsubseteq> x \<sqinter> y) = (z \<sqsubseteq> x \<and> z \<sqsubseteq> y)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (z \<sqsubseteq> x \<sqinter> y) = (z \<sqsubseteq> x \<and> z \<sqsubseteq> y)
[PROOF STEP]
obtain g where "{x,y} >>| g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. {x, y} >>| g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis binary_meet_exists')
[PROOF STATE]
proof (state)
this:
{x, y} >>| g

goal (1 subgoal):
 1. (z \<sqsubseteq> x \<sqinter> y) = (z \<sqsubseteq> x \<and> z \<sqsubseteq> y)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{x, y} >>| g

goal (1 subgoal):
 1. (z \<sqsubseteq> x \<sqinter> y) = (z \<sqsubseteq> x \<and> z \<sqsubseteq> y)
[PROOF STEP]
unfolding meet_def'
[PROOF STATE]
proof (prove)
using this:
{x, y} >>| g

goal (1 subgoal):
 1. (z \<sqsubseteq> \<Sqinter>{x, y}) = (z \<sqsubseteq> x \<and> z \<sqsubseteq> y)
[PROOF STEP]
by (simp add: glb_above)
[PROOF STATE]
proof (state)
this:
(z \<sqsubseteq> x \<sqinter> y) = (z \<sqsubseteq> x \<and> z \<sqsubseteq> y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma divide_atLeastAtMost_1_absI: "\<bar>x::real\<bar> \<le> \<bar>a\<bar> \<Longrightarrow> x/a \<in> {-1 .. 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<bar> \<le> \<bar>a\<bar> \<Longrightarrow> x / a \<in> {- 1..1}
[PROOF STEP]
by (intro atLeastAtMost_absI) (auto simp: divide_le_eq_1)


[STATEMENT]
lemma empty_tree_empty_V: "V\<^bsub>T\<^esub> = {} \<Longrightarrow> V = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V\<^bsub>T\<^esub> = {} \<Longrightarrow> V = {}
[PROOF STEP]
using bags_union
[PROOF STATE]
proof (prove)
using this:
\<Union> {bag t |t. t \<in> V\<^bsub>T\<^esub>} = V

goal (1 subgoal):
 1. V\<^bsub>T\<^esub> = {} \<Longrightarrow> V = {}
[PROOF STEP]
by simp


[STATEMENT]
lemma take_bit_Suc_minus_bit1:
  \<open>take_bit (Suc n) (- numeral (Num.Bit1 k)) = take_bit n (- numeral (Num.inc k)) * 2 + (1 :: int)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) (- numeral (num.Bit1 k)) = take_bit n (- numeral (Num.inc k)) * 2 + 1
[PROOF STEP]
by (simp add: take_bit_Suc numeral_Bit1_div_2 add_One)


[STATEMENT]
lemma rel_fun_iff_geq_image2p: "rel_fun R S f g = (image2p f g R \<le> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_fun R S f g = (image2p f g R \<le> S)
[PROOF STEP]
unfolding rel_fun_def image2p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. R x y \<longrightarrow> S (f x) (g y)) = ((\<lambda>x y. \<exists>x' y'. R x' y' \<and> f x' = x \<and> g y' = y) \<le> S)
[PROOF STEP]
by auto


[STATEMENT]
lemma prv_eqv_imp:
assumes "\<phi> \<in> fmla" and "\<chi> \<in> fmla"
shows "prv (imp (eqv \<phi> \<chi>) (eqv \<chi> \<phi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp (eqv \<phi> \<chi>) (eqv \<chi> \<phi>))
[PROOF STEP]
by (simp add: assms prv_imp_cnj prv_imp_cnjL prv_imp_cnjR eqv_def)


[STATEMENT]
lemma index_MM_Rel[transfer_rule]: "(MM_Rel ===> (=) ===> (=) ===> M_Rel)
    (\<lambda> M i j. if (i < dim_row M \<and> j < dim_col M) then M $$ (i, j) else 0)
   (\<lambda> M i j. if (i < dim_row M \<and> j < dim_col M) then M $$ (i, j) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MM_Rel ===> (=) ===> (=) ===> M_Rel) (\<lambda>M i j. if i < dim_row M \<and> j < dim_col M then M $$ (i, j) else 0) (\<lambda>M i j. if i < dim_row M \<and> j < dim_col M then M $$ (i, j) else 0)
[PROOF STEP]
using lt_dim_row_MM_Rel lt_dim_col_MM_Rel
[PROOF STATE]
proof (prove)
using this:
(MM_Rel ===> (=) ===> (=)) (\<lambda>M i. i < dim_row M) (\<lambda>M i. i < dim_row M)
(MM_Rel ===> (=) ===> (=)) (\<lambda>M j. j < dim_col M) (\<lambda>M j. j < dim_col M)

goal (1 subgoal):
 1. (MM_Rel ===> (=) ===> (=) ===> M_Rel) (\<lambda>M i j. if i < dim_row M \<and> j < dim_col M then M $$ (i, j) else 0) (\<lambda>M i j. if i < dim_row M \<and> j < dim_col M then M $$ (i, j) else 0)
[PROOF STEP]
unfolding  M_Rel_def M_def rel_fun_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. MM_Rel x y \<longrightarrow> (\<forall>xa ya. xa = ya \<longrightarrow> (xa < dim_row x) = (ya < dim_row y))
\<forall>x y. MM_Rel x y \<longrightarrow> (\<forall>xa ya. xa = ya \<longrightarrow> (xa < dim_col x) = (ya < dim_col y))

goal (1 subgoal):
 1. \<forall>x y. MM_Rel x y \<longrightarrow> (\<forall>xa ya. xa = ya \<longrightarrow> (\<forall>xb yb. xb = yb \<longrightarrow> (if xa < dim_row x \<and> xb < dim_col x then x $$ (xa, xb) else 0) mod m = to_int_mod_ring (if ya < dim_row y \<and> yb < dim_col y then y $$ (ya, yb) else 0)))
[PROOF STEP]
by (simp, metis mat_mod_index to_int_mat_index MM_Rel_def)


[STATEMENT]
lemma bouncing_ball_dyn: "g < 0 \<Longrightarrow> h \<ge> 0 \<Longrightarrow>
  \<^bold>{\<lambda>s. s$1 = h \<and> s$2 = 0\<^bold>}
  (LOOP
      ((EVOL (\<phi> g) (\<lambda> s. s$1 \<ge> 0) T);
       (IF (\<lambda> s. s$1 = 0) THEN (2 ::= (\<lambda>s. - s$2)) ELSE skip))
    INV (\<lambda>s. 0 \<le> s$1 \<and> 2 \<cdot> g \<cdot> s$1 = 2 \<cdot> g \<cdot> h + s$2 \<cdot> s$2)
  ) \<^bold>{\<lambda>s. 0 \<le> s$1 \<and> s$1 \<le> h\<^bold>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<^bold>{\<lambda>s. s $ 1 = h \<and> s $ 2 = 0\<^bold>}LOOP EVOL (\<lambda>\<tau> s. \<chi>i. if i = 1 then g \<cdot> \<tau>\<^sup>2 / 2 + s $ 2 \<cdot> \<tau> + s $ 1 else g \<cdot> \<tau> + s $ 2) (\<lambda>s. 0 \<le> s $ 1) T ; (IF (\<lambda>s. s $ 1 = 0) THEN (2 ::= (\<lambda>s. - s $ 2)) ELSE skip) INV (\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2) \<^bold>{\<lambda>s. 0 \<le> s $ 1 \<and> s $ 1 \<le> h\<^bold>}
[PROOF STEP]
apply(hyb_hoare "\<lambda>s::real^2. 0 \<le> s$1 \<and> 2 \<cdot> g \<cdot> s$1 = 2 \<cdot> g \<cdot> h + s$2 \<cdot> s$2")
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<^bold>{\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2\<^bold>}EVOL (\<lambda>\<tau> s. \<chi>i. if i = 1 then g \<cdot> \<tau>\<^sup>2 / 2 + s $ 2 \<cdot> \<tau> + s $ 1 else g \<cdot> \<tau> + s $ 2) (\<lambda>s. 0 \<le> s $ 1) T\<^bold>{\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2\<^bold>}
 2. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<forall>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2 \<and> s $ 1 = 0 \<longrightarrow> 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2 = 0
 3. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<^bold>{\<lambda>s. (0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2) \<and> s $ 1 \<noteq> 0\<^bold>}skip\<^bold>{\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2\<^bold>}
 4. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<lceil>\<lambda>s. s $ 1 = h \<and> s $ 2 = 0\<rceil> \<le> \<lceil>\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2\<rceil>
 5. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<lceil>\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 = 2 \<cdot> g \<cdot> h + s $ 2 \<cdot> s $ 2\<rceil> \<le> \<lceil>\<lambda>s. 0 \<le> s $ 1 \<and> s $ 1 \<le> h\<rceil>
[PROOF STEP]
by (auto simp: bb_real_arith)

\<comment> \<open>Verified with the flow \<close>


[STATEMENT]
lemma in_tset_conv_tnth: "x \<in> tset xs \<longleftrightarrow> (\<exists>n. enat n < tlength xs \<and> tnth xs n = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> tset xs) = (\<exists>n. enat n < tlength xs \<and> tnth xs n = x)
[PROOF STEP]
using tset_conv_tnth[of xs]
[PROOF STATE]
proof (prove)
using this:
tset xs = {tnth xs n |n. enat n < tlength xs}

goal (1 subgoal):
 1. (x \<in> tset xs) = (\<exists>n. enat n < tlength xs \<and> tnth xs n = x)
[PROOF STEP]
by auto


[STATEMENT]
lemma while_option_finite_decreasing_Some:
  fixes f :: "'a::order \<Rightarrow> 'a"
  assumes "mono f" and "finite (UNIV :: 'a set)" and "f s \<le> s"
  shows "\<exists>P. while_option (\<lambda>A. f A \<noteq> A) f s = Some P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. while_option (\<lambda>A. f A \<noteq> A) f s = Some P
[PROOF STEP]
by (rule wf_rel_while_option_Some[where R="{(x, y). x < y}" and P="\<lambda>A. f A \<le> A" and s="s"])
   (auto simp add: assms monoD intro: wf_finite_less[where C="UNIV::'a set", simplified])


[STATEMENT]
lemma aux_digit_shift: "(a * 2^t) \<exclamdown> (l+t) = a \<exclamdown> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * 2 ^ t) \<exclamdown> (l + t) = a \<exclamdown> l
[PROOF STEP]
using nth_bit_def
[PROOF STATE]
proof (prove)
using this:
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2

goal (1 subgoal):
 1. (a * 2 ^ t) \<exclamdown> (l + t) = a \<exclamdown> l
[PROOF STEP]
by (induct l; auto)
     (smt div_mult2_eq mult.commute nonzero_mult_div_cancel_right power_add power_not_zero zero_neq_numeral)


[STATEMENT]
lemma ccLinear_ccProd[simp]:
  "ccLinear S (ccProd S\<^sub>1 S\<^sub>2) \<longleftrightarrow> S\<^sub>1 \<inter> S = {} \<or> S\<^sub>2 \<inter> S = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccLinear S (S\<^sub>1 G\<times> S\<^sub>2) = (S\<^sub>1 \<inter> S = {} \<or> S\<^sub>2 \<inter> S = {})
[PROOF STEP]
unfolding ccLinear_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>S. \<forall>y\<in>S. x--y\<notin>(S\<^sub>1 G\<times> S\<^sub>2)) = (S\<^sub>1 \<inter> S = {} \<or> S\<^sub>2 \<inter> S = {})
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma suminf_mult2: "summable f \<Longrightarrow> suminf f * c = (\<Sum>n. f n * c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> suminf f * c = (\<Sum>n. f n * c)
[PROOF STEP]
by (rule bounded_linear.suminf [OF bounded_linear_mult_left])


[STATEMENT]
lemma map_nth_drop: "i < length xs \<Longrightarrow> map f (nth_drop i xs) = nth_drop i (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length xs \<Longrightarrow> map f (nth_drop i xs) = nth_drop i (map f xs)
[PROOF STEP]
by (induct xs arbitrary: i) (auto simp: take_Cons' nth_drop_def gr0_conv_Suc)


[STATEMENT]
lemma inj_on_fst_graph: "inj_on fst (graph m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on fst (graph m)
[PROOF STEP]
unfolding graph_def inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{(a, b) |a b. m a = Some b}. \<forall>y\<in>{(a, b) |a b. m a = Some b}. fst x = fst y \<longrightarrow> x = y
[PROOF STEP]
by force


[STATEMENT]
lemma set_baliL:
  "set_tree(baliL l a r) = set_tree l \<union> {a} \<union> set_tree r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tree2.set_tree (baliL l a r) = Tree2.set_tree l \<union> {a} \<union> Tree2.set_tree r
[PROOF STEP]
by(cases "(l,a,r)" rule: baliL.cases) (auto)


[STATEMENT]
lemma divisor_count_altdef: "divisor_count n = divisor_sigma 0 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count n = divisor_sigma 0 n
[PROOF STEP]
by (simp add: divisor_sigma_0_left)


[STATEMENT]
lemma index_f_cong:
     "\<lbrakk>dfa.language M = dfa.language N; dfa M; dfa N\<rbrakk> \<Longrightarrow> dfa.index_f M = dfa.index_f N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dfa.language M = dfa.language N; dfa M; dfa N\<rbrakk> \<Longrightarrow> dfa.index_f M = dfa.index_f N
[PROOF STEP]
by (simp add: dfa.index_f_def dfa.min_states_def)


[STATEMENT]
lemma d_nom_i_nom_v: "$d^{m} = $i^{m} * $v.^(1/m)" if "m \<noteq>0" for m::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $d^{m} = $i^{m} * $v .^ (1 / real m)
[PROOF STEP]
unfolding d_nom_def v_pres_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $i^{m} / (1 + $i^{m} / real m) = $i^{m} * (1 / (1 + i)) .^ (1 / real m)
[PROOF STEP]
using i_nom_i powr_divide v_futr_pos that
[PROOF STATE]
proof (prove)
using this:
?m \<noteq> 0 \<Longrightarrow> 1 + $i^{?m} / real ?m = (1 + i) .^ (1 / real ?m)
\<lbrakk>0 \<le> ?x; 0 \<le> ?y\<rbrakk> \<Longrightarrow> (?x / ?y) .^ ?a = ?x .^ ?a / ?y .^ ?a
0 < 1 + i
m \<noteq> 0

goal (1 subgoal):
 1. $i^{m} / (1 + $i^{m} / real m) = $i^{m} * (1 / (1 + i)) .^ (1 / real m)
[PROOF STEP]
by auto


[STATEMENT]
lemma powr_nonneg_iff[simp]: "a powr x \<le> 0 \<longleftrightarrow> a = 0"
  for a x::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a powr x \<le> 0) = (a = 0)
[PROOF STEP]
by (meson not_less powr_gt_zero)


[STATEMENT]
lemma rel_list_all2_Cons1:
  "list_all2 (fun_of S) (x#xs) ys =
  (\<exists>z zs. ys = z#zs \<and> (x,z) \<in> S \<and> list_all2 (fun_of S) xs zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (fun_of S) (x # xs) ys = (\<exists>z zs. ys = z # zs \<and> (x, z) \<in> S \<and> list_all2 (fun_of S) xs zs)
[PROOF STEP]
by (cases ys) auto


[STATEMENT]
lemma size_Bag[code]: "size (Bag ms) = DAList_Multiset.fold (\<lambda>a n. (+) n) 0 ms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (Bag ms) = DAList_Multiset.fold (\<lambda>a. (+)) 0 ms
[PROOF STEP]
unfolding size_fold
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_mset (\<lambda>_. Suc) 0 (Bag ms) = DAList_Multiset.fold (\<lambda>a. (+)) 0 ms
[PROOF STEP]
proof (rule comp_fun_commute.DAList_Multiset_fold, unfold_locales, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n x. n + x = (Suc ^^ n) x
[PROOF STEP]
fix a n x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n x. n + x = (Suc ^^ n) x
[PROOF STEP]
show "n + x = (Suc ^^ n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n + x = (Suc ^^ n) x
[PROOF STEP]
by (induct n) auto
[PROOF STATE]
proof (state)
this:
n + x = (Suc ^^ n) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smult_add_distrib_vec:
  assumes "v \<in> carrier_vec n" "w \<in> carrier_vec n"
  shows "(a::'a::ring) \<cdot>\<^sub>v (v + w) = a \<cdot>\<^sub>v v + a \<cdot>\<^sub>v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot>\<^sub>v (v + w) = a \<cdot>\<^sub>v v + a \<cdot>\<^sub>v w
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (a \<cdot>\<^sub>v v + a \<cdot>\<^sub>v w) \<Longrightarrow> (a \<cdot>\<^sub>v (v + w)) $ i = (a \<cdot>\<^sub>v v + a \<cdot>\<^sub>v w) $ i
 2. dim_vec (a \<cdot>\<^sub>v (v + w)) = dim_vec (a \<cdot>\<^sub>v v + a \<cdot>\<^sub>v w)
[PROOF STEP]
unfolding smult_vec_def plus_vec_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (vec (dim_vec (vec (dim_vec w) (\<lambda>i. a * w $ i))) (\<lambda>i. vec (dim_vec v) (\<lambda>i. a * v $ i) $ i + vec (dim_vec w) (\<lambda>i. a * w $ i) $ i)) \<Longrightarrow> vec (dim_vec (vec (dim_vec w) (\<lambda>i. v $ i + w $ i))) (\<lambda>i. a * vec (dim_vec w) (\<lambda>i. v $ i + w $ i) $ i) $ i = vec (dim_vec (vec (dim_vec w) (\<lambda>i. a * w $ i))) (\<lambda>i. vec (dim_vec v) (\<lambda>i. a * v $ i) $ i + vec (dim_vec w) (\<lambda>i. a * w $ i) $ i) $ i
 2. dim_vec (vec (dim_vec (vec (dim_vec w) (\<lambda>i. v $ i + w $ i))) (\<lambda>i. a * vec (dim_vec w) (\<lambda>i. v $ i + w $ i) $ i)) = dim_vec (vec (dim_vec (vec (dim_vec w) (\<lambda>i. a * w $ i))) (\<lambda>i. vec (dim_vec v) (\<lambda>i. a * v $ i) $ i + vec (dim_vec w) (\<lambda>i. a * w $ i) $ i))
[PROOF STEP]
using assms distrib_left
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
w \<in> carrier_vec n
?a * (?b + ?c) = ?a * ?b + ?a * ?c

goal (2 subgoals):
 1. \<And>i. i < dim_vec (vec (dim_vec (vec (dim_vec w) (\<lambda>i. a * w $ i))) (\<lambda>i. vec (dim_vec v) (\<lambda>i. a * v $ i) $ i + vec (dim_vec w) (\<lambda>i. a * w $ i) $ i)) \<Longrightarrow> vec (dim_vec (vec (dim_vec w) (\<lambda>i. v $ i + w $ i))) (\<lambda>i. a * vec (dim_vec w) (\<lambda>i. v $ i + w $ i) $ i) $ i = vec (dim_vec (vec (dim_vec w) (\<lambda>i. a * w $ i))) (\<lambda>i. vec (dim_vec v) (\<lambda>i. a * v $ i) $ i + vec (dim_vec w) (\<lambda>i. a * w $ i) $ i) $ i
 2. dim_vec (vec (dim_vec (vec (dim_vec w) (\<lambda>i. v $ i + w $ i))) (\<lambda>i. a * vec (dim_vec w) (\<lambda>i. v $ i + w $ i) $ i)) = dim_vec (vec (dim_vec (vec (dim_vec w) (\<lambda>i. a * w $ i))) (\<lambda>i. vec (dim_vec v) (\<lambda>i. a * v $ i) $ i + vec (dim_vec w) (\<lambda>i. a * w $ i) $ i))
[PROOF STEP]
by auto


[STATEMENT]
theorem turing_computable_total'_eq_turing_computable_total:
  "turing_computable_total' f = turing_computable_total f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_computable_total' f = turing_computable_total f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. turing_computable_total' f \<Longrightarrow> turing_computable_total f
 2. turing_computable_total f \<Longrightarrow> turing_computable_total' f
[PROOF STEP]
show "turing_computable_total' f \<Longrightarrow> turing_computable_total f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_computable_total' f \<Longrightarrow> turing_computable_total f
[PROOF STEP]
unfolding turing_computable_total_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_computable_total' f \<Longrightarrow> \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l))
[PROOF STEP]
unfolding turing_computable_total'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> fun_of_tm tm = f \<Longrightarrow> \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l))
[PROOF STEP]
using fun_of_tm_eq_Some_n_imp_same_numeral_result
[PROOF STATE]
proof (prove)
using this:
fun_of_tm ?tm ?ns = Some ?n \<Longrightarrow> \<exists>stp k l. steps0 (1, [], <?ns>) ?tm stp = (0, Bk \<up> k, <?n> @ Bk \<up> l)

goal (1 subgoal):
 1. \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> fun_of_tm tm = f \<Longrightarrow> \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
turing_computable_total' f \<Longrightarrow> turing_computable_total f

goal (1 subgoal):
 1. turing_computable_total f \<Longrightarrow> turing_computable_total' f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. turing_computable_total f \<Longrightarrow> turing_computable_total' f
[PROOF STEP]
show "turing_computable_total f \<Longrightarrow> turing_computable_total' f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_computable_total f \<Longrightarrow> turing_computable_total' f
[PROOF STEP]
unfolding turing_computable_total_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l)) \<Longrightarrow> turing_computable_total' f
[PROOF STEP]
unfolding turing_computable_total'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l)) \<Longrightarrow> \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> fun_of_tm tm = f
[PROOF STEP]
by (metis numeral_result_n_imp_fun_of_tm_eq_n tape_of_list_def turing_computable_partial'I turing_computable_partial'_def)
[PROOF STATE]
proof (state)
this:
turing_computable_total f \<Longrightarrow> turing_computable_total' f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_zerosign: "- (zerosign s a) = zerosign (1 - s) (- a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - zerosign s a = zerosign (1 - s) (- a)
[PROOF STEP]
by (auto simp: zerosign_def)


[STATEMENT]
lemma represents_2i: "poly_2i represents (2 * \<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_2i represents 2 * \<i>
[PROOF STEP]
unfolding represents_def poly_2i_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (complex_of_int_poly [:4, 0, 1:]) (2 * \<i>) = 0 \<and> [:4, 0, 1:] \<noteq> 0
[PROOF STEP]
by simp


[STATEMENT]
lemma fds_deriv_of_nat [simp]: "fds_deriv (of_nat n) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_deriv (of_nat n) = 0
[PROOF STEP]
by (simp only: fds_const_of_nat [symmetric] fds_deriv_const)


[STATEMENT]
lemma complex_cnj_minus [simp]: "cnj (- x) = - cnj x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (- x) = - cnj x
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma map_poly_add:
  assumes h0: "h 0 = 0"
      and h_add: "\<forall>p q. h (p + q) = h p + h q"
  shows "map_poly h (p + q) = map_poly h p + map_poly h q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly h (p + q) = map_poly h p + map_poly h q
[PROOF STEP]
proof (induct p arbitrary: q)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>q. map_poly h (0 + q) = map_poly h 0 + map_poly h q
 2. \<And>a p q. \<lbrakk>a \<noteq> (0::'b) \<or> p \<noteq> 0; \<And>q. map_poly h (p + q) = map_poly h p + map_poly h q\<rbrakk> \<Longrightarrow> map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q
[PROOF STEP]
case (pCons a p)
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'b) \<or> p \<noteq> 0
map_poly h (p + ?q) = map_poly h p + map_poly h ?q

goal (2 subgoals):
 1. \<And>q. map_poly h (0 + q) = map_poly h 0 + map_poly h q
 2. \<And>a p q. \<lbrakk>a \<noteq> (0::'b) \<or> p \<noteq> 0; \<And>q. map_poly h (p + q) = map_poly h p + map_poly h q\<rbrakk> \<Longrightarrow> map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q
[PROOF STEP]
note pIH = this
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'b) \<or> p \<noteq> 0
map_poly h (p + ?q) = map_poly h p + map_poly h ?q

goal (2 subgoals):
 1. \<And>q. map_poly h (0 + q) = map_poly h 0 + map_poly h q
 2. \<And>a p q. \<lbrakk>a \<noteq> (0::'b) \<or> p \<noteq> 0; \<And>q. map_poly h (p + q) = map_poly h p + map_poly h q\<rbrakk> \<Longrightarrow> map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q
[PROOF STEP]
proof(induct "q")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. map_poly h (pCons a p + 0) = map_poly h (pCons a p) + map_poly h 0
 2. \<And>aa q. \<lbrakk>aa \<noteq> (0::'b) \<or> q \<noteq> 0; map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q\<rbrakk> \<Longrightarrow> map_poly h (pCons a p + pCons aa q) = map_poly h (pCons a p) + map_poly h (pCons aa q)
[PROOF STEP]
case (pCons b q)
[PROOF STATE]
proof (state)
this:
b \<noteq> (0::'b) \<or> q \<noteq> 0
map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q

goal (2 subgoals):
 1. map_poly h (pCons a p + 0) = map_poly h (pCons a p) + map_poly h 0
 2. \<And>aa q. \<lbrakk>aa \<noteq> (0::'b) \<or> q \<noteq> 0; map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q\<rbrakk> \<Longrightarrow> map_poly h (pCons a p + pCons aa q) = map_poly h (pCons a p) + map_poly h (pCons aa q)
[PROOF STEP]
note qIH = this
[PROOF STATE]
proof (state)
this:
b \<noteq> (0::'b) \<or> q \<noteq> 0
map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q

goal (2 subgoals):
 1. map_poly h (pCons a p + 0) = map_poly h (pCons a p) + map_poly h 0
 2. \<And>aa q. \<lbrakk>aa \<noteq> (0::'b) \<or> q \<noteq> 0; map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q\<rbrakk> \<Longrightarrow> map_poly h (pCons a p + pCons aa q) = map_poly h (pCons a p) + map_poly h (pCons aa q)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly h (pCons a p + pCons b q) = map_poly h (pCons a p) + map_poly h (pCons b q)
[PROOF STEP]
unfolding map_poly_pCons[OF qIH(1)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly h (pCons a p + pCons b q) = map_poly h (pCons a p) + pCons (h b) (map_poly h q)
[PROOF STEP]
unfolding map_poly_pCons[OF pIH(1)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly h (pCons a p + pCons b q) = pCons (h a) (map_poly h p) + pCons (h b) (map_poly h q)
[PROOF STEP]
unfolding add_pCons
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly h (pCons (a + b) (p + q)) = pCons (h a + h b) (map_poly h p + map_poly h q)
[PROOF STEP]
unfolding pIH(2)[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly h (pCons (a + b) (p + q)) = pCons (h a + h b) (map_poly h (p + q))
[PROOF STEP]
unfolding h_add[rule_format,symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly h (pCons (a + b) (p + q)) = pCons (h (a + b)) (map_poly h (p + q))
[PROOF STEP]
unfolding map_poly_simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if a + b = (0::'b) \<and> p + q = 0 then 0 else pCons (h (a + b)) (map_poly h (p + q))) = pCons (h (a + b)) (map_poly h (p + q))
[PROOF STEP]
using h0
[PROOF STATE]
proof (prove)
using this:
h (0::'b) = (0::'a)

goal (1 subgoal):
 1. (if a + b = (0::'b) \<and> p + q = 0 then 0 else pCons (h (a + b)) (map_poly h (p + q))) = pCons (h (a + b)) (map_poly h (p + q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map_poly h (pCons a p + pCons b q) = map_poly h (pCons a p) + map_poly h (pCons b q)

goal (1 subgoal):
 1. map_poly h (pCons a p + 0) = map_poly h (pCons a p) + map_poly h 0
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
map_poly h (pCons a p + q) = map_poly h (pCons a p) + map_poly h q

goal (1 subgoal):
 1. \<And>q. map_poly h (0 + q) = map_poly h 0 + map_poly h q
[PROOF STEP]
qed auto


[STATEMENT]
lemma borel_measurable_continuous_on_indicator:
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
  shows "A \<in> sets borel \<Longrightarrow> continuous_on A f \<Longrightarrow> (\<lambda>x. indicator A x *\<^sub>R f x) \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> sets borel; continuous_on A f\<rbrakk> \<Longrightarrow> (\<lambda>x. indicat_real A x *\<^sub>R f x) \<in> borel_measurable borel
[PROOF STEP]
by (subst borel_measurable_restrict_space_iff[symmetric])
     (auto intro: borel_measurable_continuous_on_restrict)


[STATEMENT]
lemma round_mono: "x \<le> y \<Longrightarrow> round x \<le> round y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> round x \<le> round y
[PROOF STEP]
unfolding round_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> \<lfloor>x + (1::'a) / (2::'a)\<rfloor> \<le> \<lfloor>y + (1::'a) / (2::'a)\<rfloor>
[PROOF STEP]
by (intro floor_mono) simp


[STATEMENT]
lemma zip_map_option1: "zip_option (map_option f x) y = map_option (apfst f) (zip_option x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip_option (map_option f x) y = map_option (apfst f) (zip_option x y)
[PROOF STEP]
by(cases "(x, y)" rule: zip_option.cases) simp_all


[STATEMENT]
lemma hom_graph_insert:
  assumes "hom_graph f S x a"
  shows "hom_graph f (insert i S) x a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_graph f (insert i S) x a
[PROOF STEP]
proof (cases "i \<in> S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<in> S \<Longrightarrow> hom_graph f (insert i S) x a
 2. i \<notin> S \<Longrightarrow> hom_graph f (insert i S) x a
[PROOF STEP]
assume "i \<in> S"
[PROOF STATE]
proof (state)
this:
i \<in> S

goal (2 subgoals):
 1. i \<in> S \<Longrightarrow> hom_graph f (insert i S) x a
 2. i \<notin> S \<Longrightarrow> hom_graph f (insert i S) x a
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
hom_graph f S x a
i \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hom_graph f S x a
i \<in> S

goal (1 subgoal):
 1. hom_graph f (insert i S) x a
[PROOF STEP]
by (simp add: insert_absorb)
[PROOF STATE]
proof (state)
this:
hom_graph f (insert i S) x a

goal (1 subgoal):
 1. i \<notin> S \<Longrightarrow> hom_graph f (insert i S) x a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<notin> S \<Longrightarrow> hom_graph f (insert i S) x a
[PROOF STEP]
assume "i \<notin> S"
[PROOF STATE]
proof (state)
this:
i \<notin> S

goal (1 subgoal):
 1. i \<notin> S \<Longrightarrow> hom_graph f (insert i S) x a
[PROOF STEP]
hence "hom_graph f (insert i S) (ifte (var i) x x) (ifte (f i) a a)"
[PROOF STATE]
proof (prove)
using this:
i \<notin> S

goal (1 subgoal):
 1. hom_graph f (insert i S) (ifte (var i) x x) (ifte (f i) a a)
[PROOF STEP]
by (intro hom_graph.ifte assms)
[PROOF STATE]
proof (state)
this:
hom_graph f (insert i S) (ifte (var i) x x) (ifte (f i) a a)

goal (1 subgoal):
 1. i \<notin> S \<Longrightarrow> hom_graph f (insert i S) x a
[PROOF STEP]
thus "hom_graph f (insert i S) x a"
[PROOF STATE]
proof (prove)
using this:
hom_graph f (insert i S) (ifte (var i) x x) (ifte (f i) a a)

goal (1 subgoal):
 1. hom_graph f (insert i S) x a
[PROOF STEP]
by (simp only: ifte_same)
[PROOF STATE]
proof (state)
this:
hom_graph f (insert i S) x a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_nth_conv: "path E u p v \<longleftrightarrow> (let p'=p@[v] in
  u=p'!0 \<and>
  (\<forall>i<length p' - 1. (p'!i,p'!Suc i)\<in>E))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path E u p v = (let p' = p @ [v] in u = p' ! 0 \<and> (\<forall>i<length p' - 1. (p' ! i, p' ! Suc i) \<in> E))
[PROOF STEP]
apply (induct p arbitrary: v rule: rev_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>v. path E u [] v = (let p' = [] @ [v] in u = p' ! 0 \<and> (\<forall>i<length p' - 1. (p' ! i, p' ! Suc i) \<in> E))
 2. \<And>x xs v. (\<And>v. path E u xs v = (let p' = xs @ [v] in u = p' ! 0 \<and> (\<forall>i<length p' - 1. (p' ! i, p' ! Suc i) \<in> E))) \<Longrightarrow> path E u (xs @ [x]) v = (let p' = (xs @ [x]) @ [v] in u = p' ! 0 \<and> (\<forall>i<length p' - 1. (p' ! i, p' ! Suc i) \<in> E))
[PROOF STEP]
apply (auto simp: path_conc_conv path_cons_conv nth_append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma i_set0_mult_mod_gr0_div_not_in_i_set0:"
  \<lbrakk> 0 < k; 0 < d; 0 < k mod d \<rbrakk> \<Longrightarrow> \<exists>I\<in>i_set0_mult k. I \<oslash> d \<notin> i_set0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; 0 < d; 0 < k mod d\<rbrakk> \<Longrightarrow> \<exists>I\<in>i_set0_mult k. I \<oslash> d \<notin> i_set0
[PROOF STEP]
apply (frule i_set_mult_mod_gr0_div_not_in_i_set[of k d], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; 0 < d; 0 < k mod d; \<exists>I\<in>i_set_mult k. I \<oslash> d \<notin> i_set\<rbrakk> \<Longrightarrow> \<exists>I\<in>i_set0_mult k. I \<oslash> d \<notin> i_set0
[PROOF STEP]
apply (erule bexE, rename_tac I, rule_tac x=I in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>I. \<lbrakk>0 < k; 0 < d; 0 < k mod d; I \<in> i_set_mult k; I \<oslash> d \<notin> i_set\<rbrakk> \<Longrightarrow> I \<oslash> d \<notin> i_set0
 2. \<And>I. \<lbrakk>0 < k; 0 < d; 0 < k mod d; I \<in> i_set_mult k; I \<oslash> d \<notin> i_set\<rbrakk> \<Longrightarrow> I \<in> i_set0_mult k
[PROOF STEP]
apply (simp add: i_set0_def iT_Div_not_empty i_set_mult_imp_not_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>I. \<lbrakk>0 < k; 0 < d; 0 < k mod d; I \<in> i_set_mult k; I \<oslash> d \<notin> i_set\<rbrakk> \<Longrightarrow> I \<in> i_set0_mult k
[PROOF STEP]
apply (simp add: subsetD[OF i_set_mult_subset_i_set0_mult])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma abs_leq_squared: "\<bar>z::int\<bar> \<le> z\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>z\<bar> \<le> z\<^sup>2
[PROOF STEP]
using leq_squared[of "\<bar>z\<bar>"]
[PROOF STATE]
proof (prove)
using this:
\<bar>z\<bar> \<le> \<bar>z\<bar>\<^sup>2

goal (1 subgoal):
 1. \<bar>z\<bar> \<le> z\<^sup>2
[PROOF STEP]
by auto


[STATEMENT]
lemma Qp_res_eqI:
  assumes "a \<in> \<O>\<^sub>p"
  assumes "b \<in> \<O>\<^sub>p"
  assumes "Qp_res (a \<ominus> b) n = 0"
  shows "Qp_res a n = Qp_res b n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Qp_res a n = Qp_res b n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> \<O>\<^sub>p
b \<in> \<O>\<^sub>p
Qp_res (a \<ominus> b) n = 0

goal (1 subgoal):
 1. Qp_res a n = Qp_res b n
[PROOF STEP]
by (metis Qp_res_def val_ring_memE res_diff_zero_fact(1) to_Zp_closed to_Zp_minus)


[STATEMENT]
lemma meld_correct:
  assumes "invar q" "invar q'"
  shows
  "invar (meld q q')"
  "queue_to_multiset (meld q q') = queue_to_multiset q + queue_to_multiset q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar (meld q q') &&& queue_to_multiset (meld q q') = queue_to_multiset q + queue_to_multiset q'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invar q
invar q'

goal (1 subgoal):
 1. invar (meld q q') &&& queue_to_multiset (meld q q') = queue_to_multiset q + queue_to_multiset q'
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
using this:
queue_invar q \<and> rank_invar q
queue_invar q' \<and> rank_invar q'

goal (1 subgoal):
 1. queue_invar (meld q q') \<and> rank_invar (meld q q') &&& queue_to_multiset (meld q q') = queue_to_multiset q + queue_to_multiset q'
[PROOF STEP]
by (simp_all add: meld_queue_invar rank_invar_meld meld_mset)


[STATEMENT]
lemma image_group_truncate:
  fixes R :: "('a, 'b) monoid_scheme"
  shows "monoid.truncate (image_group f R) = image_group f (monoid.truncate R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoid.truncate (image_group f R) = image_group f (monoid.truncate R)
[PROOF STEP]
by (simp add: image_group_def monoid.defs)


[STATEMENT]
theorem erf_remainder_bigo: "erf_remainder n \<in> O(\<lambda>x. exp (-x\<^sup>2) / x ^ (2*n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf_remainder n \<in> O(\<lambda>x. exp (- x\<^sup>2) / x ^ (2 * n + 1))
[PROOF STEP]
using erf_remainder_integral_bigo[of n]
[PROOF STATE]
proof (prove)
using this:
erf_remainder_integral n \<in> O(\<lambda>x. exp (- x\<^sup>2) / x ^ (2 * n + 1))

goal (1 subgoal):
 1. erf_remainder n \<in> O(\<lambda>x. exp (- x\<^sup>2) / x ^ (2 * n + 1))
[PROOF STEP]
by (simp add: erf_remainder_def [abs_def])


[STATEMENT]
lemma hnorm_ge_zero [simp]: "\<And>x::'a::real_normed_vector star. 0 \<le> hnorm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 \<le> hnorm x
[PROOF STEP]
by transfer (rule norm_ge_zero)


[STATEMENT]
lemma Fake_analz_insert_Un:
  assumes "Y \<in> analz (insert X H)" and "X \<in> synth (analz G)"
  shows "Y \<in> synth (analz G) \<union> analz (G \<union> H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y \<in> synth (analz G) \<union> analz (G \<union> H)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Y \<in> synth (analz G) \<union> analz (G \<union> H)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Y \<in> analz (insert X H)
X \<in> synth (analz G)
[PROOF STEP]
have "Y \<in> analz (synth (analz G) \<union> H)"
[PROOF STATE]
proof (prove)
using this:
Y \<in> analz (insert X H)
X \<in> synth (analz G)

goal (1 subgoal):
 1. Y \<in> analz (synth (analz G) \<union> H)
[PROOF STEP]
by (blast intro: analz_mono [THEN [2] rev_subsetD]
                     analz_mono [THEN synth_mono, THEN [2] rev_subsetD])
[PROOF STATE]
proof (state)
this:
Y \<in> analz (synth (analz G) \<union> H)

goal (1 subgoal):
 1. Y \<in> synth (analz G) \<union> analz (G \<union> H)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Y \<in> analz (synth (analz G) \<union> H)

goal (1 subgoal):
 1. Y \<in> synth (analz G) \<union> analz (G \<union> H)
[PROOF STEP]
by (simp add: sup.commute)
[PROOF STATE]
proof (state)
this:
Y \<in> synth (analz G) \<union> analz (G \<union> H)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_mult2: "summable f \<Longrightarrow> suminf f * c = (\<Sum>n. f n * c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> suminf f * c = (\<Sum>n. f n * c)
[PROOF STEP]
by (rule bounded_linear.suminf [OF bounded_linear_mult_left])


[STATEMENT]
lemma plus_nmultiset_mono:
  assumes less: "(X, Y) < (X', Y')" and no_elem: "no_elem X" "no_elem Y" "no_elem X'" "no_elem Y'"
  shows "plus_nmultiset X Y < plus_nmultiset X' Y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. plus_nmultiset X Y < plus_nmultiset X' Y'
[PROOF STEP]
using less[unfolded less_le_not_le] no_elem
[PROOF STATE]
proof (prove)
using this:
(X, Y) \<le> (X', Y') \<and> \<not> (X', Y') \<le> (X, Y)
no_elem X
no_elem Y
no_elem X'
no_elem Y'

goal (1 subgoal):
 1. plus_nmultiset X Y < plus_nmultiset X' Y'
[PROOF STEP]
by (auto simp: plus_nmultiset_def plus_hmultiset_def less_multiset_ext\<^sub>D\<^sub>M_less less_eq_nmultiset_def
          union_less_mono type_definition.Abs_inverse[OF type_definition_hmultiset, simplified]
        elim!: no_elem.cases)


[STATEMENT]
lemma streams_UNIV[simp]: "streams UNIV = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. streams UNIV = UNIV
[PROOF STEP]
by (auto simp: streams_iff_sset)


[STATEMENT]
lemma vec_index_of_poly_n:
  assumes "i < n"
  shows "vec_of_poly_n p n $ i =
    (if i < n - Suc (degree p) then 0 else coeff p (n - i - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_poly_n p n $ i = (if i < n - Suc (degree p) then 0::'a else coeff p (n - i - 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. vec_of_poly_n p n $ i = (if i < n - Suc (degree p) then 0::'a else coeff p (n - i - 1))
[PROOF STEP]
by (auto simp: vec_of_poly_n_def Let_def)


[STATEMENT]
lemma rotation_bij_corollary: "r \<in> complex_rotations \<Longrightarrow> r x \<noteq> r y \<longleftrightarrow> x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in> complex_rotations \<Longrightarrow> (r x \<noteq> r y) = (x \<noteq> y)
[PROOF STEP]
using bij_def complex_rotations_bij inj_eq
[PROOF STATE]
proof (prove)
using this:
bij ?f = (inj ?f \<and> surj ?f)
?r \<in> complex_rotations \<Longrightarrow> bij ?r
inj ?f \<Longrightarrow> (?f ?x = ?f ?y) = (?x = ?y)

goal (1 subgoal):
 1. r \<in> complex_rotations \<Longrightarrow> (r x \<noteq> r y) = (x \<noteq> y)
[PROOF STEP]
by metis


[STATEMENT]
lemma Pi_inc: "Pi (Suc i) > Pi i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi i < Pi (Suc i)
[PROOF STEP]
proof(simp add: Pi.simps Np.simps)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Pi i < Min {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
[PROOF STEP]
let ?setx = "{y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Pi i < Min {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
[PROOF STEP]
have "finite ?setx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}

goal (1 subgoal):
 1. Pi i < Min {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}

goal (1 subgoal):
 1. Pi i < Min {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
[PROOF STEP]
have "?setx \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y} \<noteq> {}
[PROOF STEP]
using prime_ex[of "Pi i"]
[PROOF STATE]
proof (prove)
using this:
\<exists>p>Pi i. p \<le> Suc (Pi i!) \<and> Prime p

goal (1 subgoal):
 1. {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y} \<noteq> {}
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
{y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y} \<noteq> {}

goal (1 subgoal):
 1. Pi i < Min {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
{y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y} \<noteq> {}
[PROOF STEP]
show "Pi i < Min ?setx"
[PROOF STATE]
proof (prove)
using this:
finite {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
{y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y} \<noteq> {}

goal (1 subgoal):
 1. Pi i < Min {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Pi i < Min {y. y \<le> Suc (Pi i!) \<and> Pi i < y \<and> Prime y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_prime_factorization_nat' [simp]: "distinct (prime_factorization_nat' n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (prime_factorization_nat' n)
[PROOF STEP]
by (simp add: distinct_map inj_on_def prime_factorization_nat'_def Let_def)


[STATEMENT]
lemma ls_update_fst_set: "set (fst (ls_update k v l)) \<subseteq> insert (k, v) (set l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (fst (ls_update k v l)) \<subseteq> insert (k, v) (set l)
[PROOF STEP]
apply (induct l rule: ls_update.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k v. set (fst (ls_update k v [])) \<subseteq> insert (k, v) (set [])
 2. \<And>k v l w ls. (k \<noteq> l \<Longrightarrow> set (fst (ls_update k v ls)) \<subseteq> insert (k, v) (set ls)) \<Longrightarrow> set (fst (ls_update k v ((l, w) # ls))) \<subseteq> insert (k, v) (set ((l, w) # ls))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k v l w ls. (k \<noteq> l \<Longrightarrow> set (fst (ls_update k v ls)) \<subseteq> insert (k, v) (set ls)) \<Longrightarrow> set (fst (ls_update k v ((l, w) # ls))) \<subseteq> insert (k, v) (set ((l, w) # ls))
[PROOF STEP]
apply (auto simp add: Let_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bij_image: "bij f \<Longrightarrow> bij (image f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij f \<Longrightarrow> bij ((`) f)
[PROOF STEP]
using bij_betw_Pow
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> bij_betw ((`) ?f) (Pow ?A) (Pow ?B)

goal (1 subgoal):
 1. bij f \<Longrightarrow> bij ((`) f)
[PROOF STEP]
by force


[STATEMENT]
lemma plus_inj_eq:
  assumes x: "x < q"
    and x': "x' < q"
    and map: "((y :: nat) + x) mod q = (y + x') mod q"
shows "x = x'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = x'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = x'
[PROOF STEP]
have "((y :: nat) + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
have "((y:: nat) + x) mod q = (y + x') mod q \<Longrightarrow> [((y:: nat) + x) = (y + x')] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y + x) mod q = (y + x') mod q \<Longrightarrow> [y + x = y + x'] (mod q)
[PROOF STEP]
by(simp add: cong_def)
[PROOF STATE]
proof (state)
this:
(y + x) mod q = (y + x') mod q \<Longrightarrow> [y + x = y + x'] (mod q)

goal (1 subgoal):
 1. (y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(y + x) mod q = (y + x') mod q \<Longrightarrow> [y + x = y + x'] (mod q)

goal (1 subgoal):
 1. (y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
have "[((y:: nat) + x) = (y + x')] (mod q) \<Longrightarrow> [x = x'] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [y + x = y + x'] (mod q) \<Longrightarrow> [x = x'] (mod q)
[PROOF STEP]
by (simp add: cong_add_lcancel_nat)
[PROOF STATE]
proof (state)
this:
[y + x = y + x'] (mod q) \<Longrightarrow> [x = x'] (mod q)

goal (1 subgoal):
 1. (y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[y + x = y + x'] (mod q) \<Longrightarrow> [x = x'] (mod q)

goal (1 subgoal):
 1. (y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
have "[x = x'] (mod q) \<Longrightarrow> x mod q = x' mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x = x'] (mod q) \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
by(simp add: cong_def)
[PROOF STATE]
proof (state)
this:
[x = x'] (mod q) \<Longrightarrow> x mod q = x' mod q

goal (1 subgoal):
 1. (y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(y + x) mod q = (y + x') mod q \<Longrightarrow> [y + x = y + x'] (mod q)
[y + x = y + x'] (mod q) \<Longrightarrow> [x = x'] (mod q)
[x = x'] (mod q) \<Longrightarrow> x mod q = x' mod q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(y + x) mod q = (y + x') mod q \<Longrightarrow> [y + x = y + x'] (mod q)
[y + x = y + x'] (mod q) \<Longrightarrow> [x = x'] (mod q)
[x = x'] (mod q) \<Longrightarrow> x mod q = x' mod q

goal (1 subgoal):
 1. x mod q = x' mod q
[PROOF STEP]
by(simp add: map)
[PROOF STATE]
proof (state)
this:
x mod q = x' mod q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q

goal (1 subgoal):
 1. x = x'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q

goal (1 subgoal):
 1. x = x'
[PROOF STEP]
have "x mod q = x' mod q \<Longrightarrow> x = x'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x mod q = x' mod q \<Longrightarrow> x = x'
[PROOF STEP]
by(simp add: x x')
[PROOF STATE]
proof (state)
this:
x mod q = x' mod q \<Longrightarrow> x = x'

goal (1 subgoal):
 1. x = x'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
x mod q = x' mod q \<Longrightarrow> x = x'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(y + x) mod q = (y + x') mod q \<Longrightarrow> x mod q = x' mod q
x mod q = x' mod q \<Longrightarrow> x = x'

goal (1 subgoal):
 1. x = x'
[PROOF STEP]
by(simp add: map)
[PROOF STATE]
proof (state)
this:
x = x'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_minus_cancel: "((\<lambda>x. - f x) \<longlongrightarrow> - a) F \<Longrightarrow> (f \<longlongrightarrow> a) F"
  for a :: "'a::topological_group_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - f x) \<longlongrightarrow> - a) F \<Longrightarrow> (f \<longlongrightarrow> a) F
[PROOF STEP]
by (drule tendsto_minus) simp


[STATEMENT]
lemma explode_CartProd_eq: "explode (CartProd a b) = (% (x,y). Opair x y) ` ((explode a) \<times> (explode b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. explode (CartProd a b) = (\<lambda>(x, y). Opair x y) ` (explode a \<times> explode b)
[PROOF STEP]
by (simp add: explode_def set_eq_iff CartProd image_def)


[STATEMENT]
lemma atLeast_less_sets: "\<lbrakk>less_sets A {x}; B \<subseteq> {x..}\<rbrakk> \<Longrightarrow> less_sets A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<lless> {x}; B \<subseteq> {x..}\<rbrakk> \<Longrightarrow> A \<lless> B
[PROOF STEP]
by (force simp: less_sets_def subset_iff)


[STATEMENT]
lemma length_list[simp]: "finite A \<Longrightarrow> length (list A) = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> length (list A) = card A
[PROOF STEP]
by (metis distinct_card distinct_set_list)


[STATEMENT]
lemma locally_path_connected_sphere:
  fixes a :: "'a::euclidean_space"
  shows "locally path_connected (sphere a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally path_connected (sphere a r)
[PROOF STEP]
using ENR_imp_locally_path_connected ENR_sphere
[PROOF STATE]
proof (prove)
using this:
ENR ?S \<Longrightarrow> locally path_connected ?S
ENR (sphere ?a ?r)

goal (1 subgoal):
 1. locally path_connected (sphere a r)
[PROOF STEP]
by blast


[STATEMENT]
lemma components_UNIV [simp]: "components UNIV = {UNIV :: 'a::real_normed_vector set}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. components UNIV = {UNIV}
[PROOF STEP]
by (auto simp: components_eq_sing_iff)


[STATEMENT]
lemma of_nat_shiftl:
  "(of_nat x << n) = (of_nat (x * 2 ^ n) :: ('a::len) word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_of_nat x << n = word_of_nat (x * 2 ^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. word_of_nat x << n = word_of_nat (x * 2 ^ n)
[PROOF STEP]
have "(of_nat x::'a word) << n = of_nat (2 ^ n) * of_nat x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_of_nat x << n = word_of_nat (2 ^ n) * word_of_nat x
[PROOF STEP]
using shiftl_t2n
[PROOF STATE]
proof (prove)
using this:
?w << ?n = 2 ^ ?n * ?w

goal (1 subgoal):
 1. word_of_nat x << n = word_of_nat (2 ^ n) * word_of_nat x
[PROOF STEP]
by (metis word_unat_power)
[PROOF STATE]
proof (state)
this:
word_of_nat x << n = word_of_nat (2 ^ n) * word_of_nat x

goal (1 subgoal):
 1. word_of_nat x << n = word_of_nat (x * 2 ^ n)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
word_of_nat x << n = word_of_nat (2 ^ n) * word_of_nat x

goal (1 subgoal):
 1. word_of_nat x << n = word_of_nat (x * 2 ^ n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
word_of_nat x << n = word_of_nat (x * 2 ^ n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma axis_eq_0_iff [simp]:
  shows "axis m x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (axis m x = 0) = (x = (0::'a))
[PROOF STEP]
by (simp add: axis_def vec_eq_iff)


[STATEMENT]
lemma sin_product_formula_real':
  assumes "x \<noteq> (0::real)"
  shows   "(\<lambda>n. (\<Prod>k=1..n. 1 - x^2 / of_nat k^2)) \<longlonglongrightarrow> sin (pi * x) / (pi * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>k = 1..n. 1 - x\<^sup>2 / (real k)\<^sup>2) \<longlonglongrightarrow> sin (pi * x) / (pi * x)
[PROOF STEP]
using tendsto_divide[OF sin_product_formula_real[of x] tendsto_const[of "pi * x"]] assms
[PROOF STATE]
proof (prove)
using this:
pi * x \<noteq> 0 \<Longrightarrow> (\<lambda>xa. pi * x * (\<Prod>k = 1..xa. 1 - x\<^sup>2 / (real k)\<^sup>2) / (pi * x)) \<longlonglongrightarrow> sin (pi * x) / (pi * x)
x \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>n. \<Prod>k = 1..n. 1 - x\<^sup>2 / (real k)\<^sup>2) \<longlonglongrightarrow> sin (pi * x) / (pi * x)
[PROOF STEP]
by simp


[STATEMENT]
lemma multiplicity_prime_prime:
  "prime p \<Longrightarrow> prime q \<Longrightarrow> multiplicity p q = (if p = q then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; prime q\<rbrakk> \<Longrightarrow> multiplicity p q = (if p = q then 1 else 0)
[PROOF STEP]
by (simp add: prime_multiplicity_other)


[STATEMENT]
lemma rel_optionT_distr [relator_distr]: "rel_optionT A OO rel_optionT B = rel_optionT (A OO B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_optionT A OO rel_optionT B = rel_optionT (A OO B)
[PROOF STEP]
by(simp add: rel_optionT_def optionT.rel_compp[symmetric])


[STATEMENT]
lemma diagonal_to_Smith_PQ_JNF:
  assumes A: "isDiagonal_mat A" and ib: "is_bezout_ext bezout"
  and "A \<in> carrier_mat m n"
  and PBQ: "(P,S,Q) = diagonal_to_Smith_PQ_JNF A bezout"
(*The following two assumptions appear since mod_type requires 1<CARD.
Those cases could be treated separately.*)
  and n: "n>1" and m: "m>1"
  shows "S = P*A*Q \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S
  \<and> P \<in> carrier_mat m m \<and> S \<in> carrier_mat m n \<and> Q \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = P * A * Q \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S \<and> P \<in> carrier_mat m m \<and> S \<in> carrier_mat m n \<and> Q \<in> carrier_mat n n
[PROOF STEP]
using diagonal_to_Smith_PQ_JNF_canceled_both[OF _ _ m n]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{0..<int n} \<noteq> {}; {0..<int m} \<noteq> {}; isDiagonal_mat ?A; is_bezout_ext ?bezout; ?A \<in> carrier_mat m n; (?P, ?S, ?Q) = diagonal_to_Smith_PQ_JNF ?A ?bezout\<rbrakk> \<Longrightarrow> ?S = ?P * ?A * ?Q \<and> invertible_mat ?P \<and> invertible_mat ?Q \<and> Smith_normal_form_mat ?S \<and> ?P \<in> carrier_mat m m \<and> ?S \<in> carrier_mat m n \<and> ?Q \<in> carrier_mat n n

goal (1 subgoal):
 1. S = P * A * Q \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S \<and> P \<in> carrier_mat m m \<and> S \<in> carrier_mat m n \<and> Q \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{0..<int n} \<noteq> {}; {0..<int m} \<noteq> {}; isDiagonal_mat ?A; is_bezout_ext ?bezout; ?A \<in> carrier_mat m n; (?P, ?S, ?Q) = diagonal_to_Smith_PQ_JNF ?A ?bezout\<rbrakk> \<Longrightarrow> ?S = ?P * ?A * ?Q \<and> invertible_mat ?P \<and> invertible_mat ?Q \<and> Smith_normal_form_mat ?S \<and> ?P \<in> carrier_mat m m \<and> ?S \<in> carrier_mat m n \<and> ?Q \<in> carrier_mat n n
isDiagonal_mat A
is_bezout_ext bezout
A \<in> carrier_mat m n
(P, S, Q) = diagonal_to_Smith_PQ_JNF A bezout
1 < n
1 < m

goal (1 subgoal):
 1. S = P * A * Q \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S \<and> P \<in> carrier_mat m m \<and> S \<in> carrier_mat m n \<and> Q \<in> carrier_mat n n
[PROOF STEP]
by force


[STATEMENT]
lemma greaterThanAtMost_empty_iff2[simp]: "{} = {k<\<^sub>a..\<le>\<^sub>al} \<longleftrightarrow> \<not> k <\<^sub>a l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({} = {k<\<^sub>a..\<le>\<^sub>al}) = (\<not> k <\<^sub>a l)
[PROOF STEP]
unfolding interval_def ray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({} = {x \<in> UNIV. k <\<^sub>a x} \<inter> {x \<in> UNIV. x \<le>\<^sub>a l}) = (\<not> k <\<^sub>a l)
[PROOF STEP]
by (blast intro: less_le_trans)


[STATEMENT]
lemma word_minus_one_le_leq:
  "\<lbrakk> x - 1 < y \<rbrakk> \<Longrightarrow> x \<le> (y :: 'a :: len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - 1 < y \<Longrightarrow> x \<le> y
[PROOF STEP]
apply (cases "x = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x - 1 < y; x = 0\<rbrakk> \<Longrightarrow> x \<le> y
 2. \<lbrakk>x - 1 < y; x \<noteq> 0\<rbrakk> \<Longrightarrow> x \<le> y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x - 1 < y; x \<noteq> 0\<rbrakk> \<Longrightarrow> x \<le> y
[PROOF STEP]
apply (simp add: word_less_nat_alt word_le_nat_alt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>unat (x - 1) < unat y; x \<noteq> 0\<rbrakk> \<Longrightarrow> unat x \<le> unat y
[PROOF STEP]
apply (subst(asm) unat_minus_one)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<noteq> 0 \<Longrightarrow> x \<noteq> 0
 2. \<lbrakk>unat x - 1 < unat y; x \<noteq> 0\<rbrakk> \<Longrightarrow> unat x \<le> unat y
[PROOF STEP]
apply (simp add: word_less_nat_alt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>unat x - 1 < unat y; x \<noteq> 0\<rbrakk> \<Longrightarrow> unat x \<le> unat y
[PROOF STEP]
apply (cases "unat x")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>unat x - 1 < unat y; x \<noteq> 0; unat x = 0\<rbrakk> \<Longrightarrow> unat x \<le> unat y
 2. \<And>nat. \<lbrakk>unat x - 1 < unat y; x \<noteq> 0; unat x = Suc nat\<rbrakk> \<Longrightarrow> unat x \<le> unat y
[PROOF STEP]
apply (simp add: unat_eq_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>unat x - 1 < unat y; x \<noteq> 0; unat x = Suc nat\<rbrakk> \<Longrightarrow> unat x \<le> unat y
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma WtNFT_WtFT_1[simp]:
assumes "0 < length cl" and "WtFT cl \<noteq> 1"
shows "WtNFT cl / (1 - WtFT cl) = 1" (is "?A / ?B = 1")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. WtNFT cl / (1 - WtFT cl) = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. WtNFT cl / (1 - WtFT cl) = 1
[PROOF STEP]
have A: "?A = ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. WtNFT cl = 1 - WtFT cl
[PROOF STEP]
using assms WtNFT_1_WtFT
[PROOF STATE]
proof (prove)
using this:
0 < length cl
WtFT cl \<noteq> 1
0 < length ?cl \<Longrightarrow> WtNFT ?cl = 1 - WtFT ?cl

goal (1 subgoal):
 1. WtNFT cl = 1 - WtFT cl
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
WtNFT cl = 1 - WtFT cl

goal (1 subgoal):
 1. WtNFT cl / (1 - WtFT cl) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. WtNFT cl / (1 - WtFT cl) = 1
[PROOF STEP]
unfolding A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - WtFT cl) / (1 - WtFT cl) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < length cl
WtFT cl \<noteq> 1

goal (1 subgoal):
 1. (1 - WtFT cl) / (1 - WtFT cl) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
WtNFT cl / (1 - WtFT cl) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_insort: "sorted (insort xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (insort xs)
[PROOF STEP]
apply(induction xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sorted (insort [])
 2. \<And>a xs. sorted (insort xs) \<Longrightarrow> sorted (insort (a # xs))
[PROOF STEP]
apply(auto simp: sorted_insort1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma zero_le_power [simp]: "0 \<le> a \<Longrightarrow> 0 \<le> a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> a \<Longrightarrow> (0::'a) \<le> a ^ n
[PROOF STEP]
by (induct n) simp_all