[STATEMENT]
lemma real_cond_exp_cmult [intro, simp]:
  fixes c::real
  assumes "integrable M f"
  shows "AE x in M. real_cond_exp M F (\<lambda>x. c * f x) x = c * real_cond_exp M F f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_cond_exp M F (\<lambda>x. c * f x) x = c * real_cond_exp M F f x
[PROOF STEP]
by (rule real_cond_exp_mult[where ?f = "\<lambda>x. c" and ?g = f], auto simp add: assms borel_measurable_integrable)


[STATEMENT]
lemma ordinal_exp_monoL [rule_format]:
"\<forall>x x'. x \<le> x' \<longrightarrow> x ** y \<le> x' ** (y::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x x'. x \<le> x' \<longrightarrow> x ** y \<le> x' ** y
[PROOF STEP]
apply (rule_tac a=y in oLimit_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>x x'. x \<le> x' \<longrightarrow> x ** 0 \<le> x' ** 0
 2. \<And>x. \<forall>xa x'. xa \<le> x' \<longrightarrow> xa ** x \<le> x' ** x \<Longrightarrow> \<forall>xa x'. xa \<le> x' \<longrightarrow> xa ** oSuc x \<le> x' ** oSuc x
 3. \<And>f. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x ** f n \<le> x' ** f n\<rbrakk> \<Longrightarrow> \<forall>x x'. x \<le> x' \<longrightarrow> x ** oLimit f \<le> x' ** oLimit f
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<forall>xa x'. xa \<le> x' \<longrightarrow> xa ** x \<le> x' ** x \<Longrightarrow> \<forall>xa x'. xa \<le> x' \<longrightarrow> xa ** oSuc x \<le> x' ** oSuc x
 2. \<And>f. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x ** f n \<le> x' ** f n\<rbrakk> \<Longrightarrow> \<forall>x x'. x \<le> x' \<longrightarrow> x ** oLimit f \<le> x' ** oLimit f
[PROOF STEP]
apply (simp add: ordinal_times_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x ** f n \<le> x' ** f n\<rbrakk> \<Longrightarrow> \<forall>x x'. x \<le> x' \<longrightarrow> x ** oLimit f \<le> x' ** oLimit f
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x x'. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x ** f n \<le> x' ** f n; x \<le> x'\<rbrakk> \<Longrightarrow> x ** oLimit f \<le> x' ** oLimit f
[PROOF STEP]
apply (case_tac "x = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x x'. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x ** f n \<le> x' ** f n; x \<le> x'; x \<noteq> 0\<rbrakk> \<Longrightarrow> x ** oLimit f \<le> x' ** oLimit f
[PROOF STEP]
apply (case_tac "x' = 0", simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x x'. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x ** f n \<le> x' ** f n; x \<le> x'; 0 < x; 0 < x'\<rbrakk> \<Longrightarrow> oLimit (\<lambda>n. x ** f n) \<le> oLimit (\<lambda>n. x' ** f n)
[PROOF STEP]
apply (rule oLimit_leI, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x x' n. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x ** f n \<le> x' ** f n; x \<le> x'; 0 < x; 0 < x'\<rbrakk> \<Longrightarrow> x ** f n \<le> oLimit (\<lambda>n. x' ** f n)
[PROOF STEP]
apply (rule_tac n=n in le_oLimitI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x x' n. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x ** f n \<le> x' ** f n; x \<le> x'; 0 < x; 0 < x'\<rbrakk> \<Longrightarrow> x ** f n \<le> x' ** f n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma notin_Lin_iff: "L : Lin \<Longrightarrow> x\<noteq>y \<Longrightarrow> (x,y) \<notin> L \<longleftrightarrow> (y,x) : L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>L \<in> Lin; x \<noteq> y\<rbrakk> \<Longrightarrow> ((x, y) \<notin> L) = ((y, x) \<in> L)
[PROOF STEP]
apply(auto simp add: slo_defs)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<noteq> y; trans L; \<forall>a. (a, a) \<notin> L; \<forall>x y. x \<noteq> y \<longrightarrow> (x, y) \<in> L \<or> (y, x) \<in> L; (y, x) \<in> L; (x, y) \<in> L\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply(metis trans_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma comp_mkArr:
    assumes "arr (mkArr A B F)" and "arr (mkArr B C G)"
    shows "mkArr B C G \<cdot> mkArr A B F = mkArr A C (G \<circ> F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mkArr B C G \<cdot> mkArr A B F = mkArr A C (G \<circ> F)
[PROOF STEP]
proof (intro arr_eqI\<^sub>S\<^sub>C)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. par (mkArr B C G \<cdot> mkArr A B F) (mkArr A C (G \<circ> F))
 2. Fun (mkArr B C G \<cdot> mkArr A B F) = Fun (mkArr A C (G \<circ> F))
[PROOF STEP]
have 1: "seq (mkArr B C G) (mkArr A B F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. seq (mkArr B C G) (mkArr A B F)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
arr (mkArr A B F)
arr (mkArr B C G)

goal (1 subgoal):
 1. seq (mkArr B C G) (mkArr A B F)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
seq (mkArr B C G) (mkArr A B F)

goal (2 subgoals):
 1. par (mkArr B C G \<cdot> mkArr A B F) (mkArr A C (G \<circ> F))
 2. Fun (mkArr B C G \<cdot> mkArr A B F) = Fun (mkArr A C (G \<circ> F))
[PROOF STEP]
have 2: "G o F \<in> A \<rightarrow> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<circ> F \<in> A \<rightarrow> C
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
arr (mkArr A B F)
arr (mkArr B C G)

goal (1 subgoal):
 1. G \<circ> F \<in> A \<rightarrow> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
G \<circ> F \<in> A \<rightarrow> C

goal (2 subgoals):
 1. par (mkArr B C G \<cdot> mkArr A B F) (mkArr A C (G \<circ> F))
 2. Fun (mkArr B C G \<cdot> mkArr A B F) = Fun (mkArr A C (G \<circ> F))
[PROOF STEP]
show "par (mkArr B C G \<cdot> mkArr A B F) (mkArr A C (G \<circ> F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. par (mkArr B C G \<cdot> mkArr A B F) (mkArr A C (G \<circ> F))
[PROOF STEP]
using assms 1 2
[PROOF STATE]
proof (prove)
using this:
arr (mkArr A B F)
arr (mkArr B C G)
seq (mkArr B C G) (mkArr A B F)
G \<circ> F \<in> A \<rightarrow> C

goal (1 subgoal):
 1. par (mkArr B C G \<cdot> mkArr A B F) (mkArr A C (G \<circ> F))
[PROOF STEP]
by (intro conjI) simp_all
[PROOF STATE]
proof (state)
this:
par (mkArr B C G \<cdot> mkArr A B F) (mkArr A C (G \<circ> F))

goal (1 subgoal):
 1. Fun (mkArr B C G \<cdot> mkArr A B F) = Fun (mkArr A C (G \<circ> F))
[PROOF STEP]
show "Fun (mkArr B C G \<cdot> mkArr A B F) = Fun (mkArr A C (G \<circ> F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fun (mkArr B C G \<cdot> mkArr A B F) = Fun (mkArr A C (G \<circ> F))
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
seq (mkArr B C G) (mkArr A B F)
G \<circ> F \<in> A \<rightarrow> C

goal (1 subgoal):
 1. Fun (mkArr B C G \<cdot> mkArr A B F) = Fun (mkArr A C (G \<circ> F))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Fun (mkArr B C G \<cdot> mkArr A B F) = Fun (mkArr A C (G \<circ> F))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma liminf_SUP_INF: "liminf f = (SUP n. INF m\<in>{n..}. f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liminf f = (SUP n. Inf (f ` {n..}))
[PROOF STEP]
unfolding Liminf_def eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP P\<in>{P. \<exists>N. \<forall>n\<ge>N. P n}. Inf (f ` Collect P)) = (SUP n. Inf (f ` {n..}))
[PROOF STEP]
by (rule SUP_eq) (auto simp: atLeast_def intro!: INF_mono)


[STATEMENT]
lemma emeasure_prod_count_space:
  assumes A: "A \<in> sets (count_space UNIV \<Otimes>\<^sub>M M)" (is "A \<in> sets (?A \<Otimes>\<^sub>M ?B)")
  shows "emeasure (?A \<Otimes>\<^sub>M ?B) A = (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator A (x, y) \<partial>?B \<partial>?A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (count_space UNIV \<Otimes>\<^sub>M M) A = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator A (x, y) \<partial>M \<partial>count_space UNIV
[PROOF STEP]
by (rule emeasure_measure_of[OF pair_measure_def])
     (auto simp: countably_additive_def positive_def suminf_indicator A
                 nn_integral_suminf[symmetric] dest: sets.sets_into_space)


[STATEMENT]
lemma ex_lit_cases: "(\<exists>L. P L) \<longleftrightarrow> (\<exists>A. P (Pos A) \<or> P (Neg A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>L. P L) = (\<exists>A. P (Pos A) \<or> P (Neg A))
[PROOF STEP]
by (metis literal.exhaust)


[STATEMENT]
lemma ereal_mult_strict_right_mono:
  assumes "a < b"
    and "0 < c"
    and "c < (\<infinity>::ereal)"
  shows "a * c < b * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * c < b * c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b
0 < c
c < \<infinity>

goal (1 subgoal):
 1. a * c < b * c
[PROOF STEP]
by (cases rule: ereal3_cases[of a b c]) (auto simp: zero_le_mult_iff)


[STATEMENT]
lemma elementOfPartitionOfFiniteSetIsFinite:
  assumes "finite X" "XX \<in> all_partitions X"
  shows "finite XX"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite XX
[PROOF STEP]
using all_partitions_def is_partition_of_def
[PROOF STATE]
proof (prove)
using this:
all_partitions ?A = {P. P partitions ?A}
?P partitions ?A = is_partition_of' ?P ?A

goal (1 subgoal):
 1. finite XX
[PROOF STEP]
by (metis assms(1) assms(2) finite_UnionD mem_Collect_eq)


[STATEMENT]
lemma simply_connected_iff_simple:
  fixes S :: "complex set"
  assumes "open S" "bounded S"
  shows "simply_connected S \<longleftrightarrow> connected S \<and> connected(- S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simply_connected S = (connected S \<and> connected (- S))
[PROOF STEP]
apply (simp add: simply_connected_eq_unbounded_complement_components assms, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>connected S; \<forall>C\<in>components (- S). \<not> bounded C\<rbrakk> \<Longrightarrow> connected (- S)
 2. \<And>C. \<lbrakk>connected S; connected (- S); C \<in> components (- S); bounded C\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (metis DIM_complex assms(2) cobounded_has_bounded_component double_compl order_refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C. \<lbrakk>connected S; connected (- S); C \<in> components (- S); bounded C\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (meson assms inside_bounded_complement_connected_empty simply_connected_eq_empty_inside simply_connected_eq_unbounded_complement_components)


[STATEMENT]
lemma vectorize_monomial:
  "vectorize_poly (monomial c v) = monomial (monomial c (pp_of_term v)) (component_of_term v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorize_poly (monomial c v) = monomial (monomial c (pp_of_term v)) (component_of_term v)
[PROOF STEP]
by (rule poly_mapping_eqI, simp add: lookup_vectorize_poly proj_monomial lookup_single)


[STATEMENT]
lemma contour_integral_continuous_on_linepath_2D:
  assumes "open U" and cont_dw: "\<And>w. w \<in> U \<Longrightarrow> F w contour_integrable_on (linepath a b)"
      and cond_uu: "continuous_on (U \<times> U) (\<lambda>(x,y). F x y)"
      and abu: "closed_segment a b \<subseteq> U"
    shows "continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
[PROOF STEP]
have *: "\<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow>
                         dist (contour_integral (linepath a b) (F x'))
                              (contour_integral (linepath a b) (F w)) \<le> \<epsilon>"
          if "w \<in> U" "0 < \<epsilon>" "a \<noteq> b" for w \<epsilon>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
obtain \<delta> where "\<delta>>0" and \<delta>: "cball w \<delta> \<subseteq> U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<delta>. \<lbrakk>0 < \<delta>; cball w \<delta> \<subseteq> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using open_contains_cball \<open>open U\<close> \<open>w \<in> U\<close>
[PROOF STATE]
proof (prove)
using this:
open ?S = (\<forall>x\<in>?S. \<exists>e>0. cball x e \<subseteq> ?S)
open U
w \<in> U

goal (1 subgoal):
 1. (\<And>\<delta>. \<lbrakk>0 < \<delta>; cball w \<delta> \<subseteq> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < \<delta>
cball w \<delta> \<subseteq> U

goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
let ?TZ = "cball w \<delta>  \<times> closed_segment a b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
have "uniformly_continuous_on ?TZ (\<lambda>(x,y). F x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniformly_continuous_on (cball w \<delta> \<times> closed_segment a b) (\<lambda>(x, y). F x y)
[PROOF STEP]
proof (rule compact_uniformly_continuous)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. continuous_on (cball w \<delta> \<times> closed_segment a b) (\<lambda>(x, y). F x y)
 2. compact (cball w \<delta> \<times> closed_segment a b)
[PROOF STEP]
show "continuous_on ?TZ (\<lambda>(x,y). F x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (cball w \<delta> \<times> closed_segment a b) (\<lambda>(x, y). F x y)
[PROOF STEP]
by (rule continuous_on_subset[OF cond_uu]) (use SigmaE \<delta> abu in blast)
[PROOF STATE]
proof (state)
this:
continuous_on (cball w \<delta> \<times> closed_segment a b) (\<lambda>(x, y). F x y)

goal (1 subgoal):
 1. compact (cball w \<delta> \<times> closed_segment a b)
[PROOF STEP]
show "compact ?TZ"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (cball w \<delta> \<times> closed_segment a b)
[PROOF STEP]
by (simp add: compact_Times)
[PROOF STATE]
proof (state)
this:
compact (cball w \<delta> \<times> closed_segment a b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
uniformly_continuous_on (cball w \<delta> \<times> closed_segment a b) (\<lambda>(x, y). F x y)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
uniformly_continuous_on (cball w \<delta> \<times> closed_segment a b) (\<lambda>(x, y). F x y)
[PROOF STEP]
obtain \<eta> where "\<eta>>0"
        and \<eta>: "\<And>x x'. \<lbrakk>x\<in>?TZ; x'\<in>?TZ; dist x' x < \<eta>\<rbrakk> \<Longrightarrow>
                         dist ((\<lambda>(x,y). F x y) x') ((\<lambda>(x,y). F x y) x) < \<epsilon>/norm(b - a)"
[PROOF STATE]
proof (prove)
using this:
uniformly_continuous_on (cball w \<delta> \<times> closed_segment a b) (\<lambda>(x, y). F x y)

goal (1 subgoal):
 1. (\<And>\<eta>. \<lbrakk>0 < \<eta>; \<And>x x'. \<lbrakk>x \<in> cball w \<delta> \<times> closed_segment a b; x' \<in> cball w \<delta> \<times> closed_segment a b; dist x' x < \<eta>\<rbrakk> \<Longrightarrow> dist (case x' of (x, y) \<Rightarrow> F x y) (case x of (x, y) \<Rightarrow> F x y) < \<epsilon> / cmod (b - a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>0 < \<epsilon>\<close> \<open>a \<noteq> b\<close>
[PROOF STATE]
proof (prove)
using this:
uniformly_continuous_on (cball w \<delta> \<times> closed_segment a b) (\<lambda>(x, y). F x y)
0 < \<epsilon>
a \<noteq> b

goal (1 subgoal):
 1. (\<And>\<eta>. \<lbrakk>0 < \<eta>; \<And>x x'. \<lbrakk>x \<in> cball w \<delta> \<times> closed_segment a b; x' \<in> cball w \<delta> \<times> closed_segment a b; dist x' x < \<eta>\<rbrakk> \<Longrightarrow> dist (case x' of (x, y) \<Rightarrow> F x y) (case x of (x, y) \<Rightarrow> F x y) < \<epsilon> / cmod (b - a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: uniformly_continuous_onE [where e = "\<epsilon>/norm(b - a)"])
[PROOF STATE]
proof (state)
this:
0 < \<eta>
\<lbrakk>?x \<in> cball w \<delta> \<times> closed_segment a b; ?x' \<in> cball w \<delta> \<times> closed_segment a b; dist ?x' ?x < \<eta>\<rbrakk> \<Longrightarrow> dist (case ?x' of (x, y) \<Rightarrow> F x y) (case ?x of (x, y) \<Rightarrow> F x y) < \<epsilon> / cmod (b - a)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
have \<eta>: "\<lbrakk>norm (w - x1) \<le> \<delta>;   x2 \<in> closed_segment a b;
              norm (w - x1') \<le> \<delta>;  x2' \<in> closed_segment a b; norm ((x1', x2') - (x1, x2)) < \<eta>\<rbrakk>
              \<Longrightarrow> norm (F x1' x2' - F x1 x2) \<le> \<epsilon> / cmod (b - a)"
             for x1 x2 x1' x2'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cmod (w - x1) \<le> \<delta>; x2 \<in> closed_segment a b; cmod (w - x1') \<le> \<delta>; x2' \<in> closed_segment a b; norm ((x1', x2') - (x1, x2)) < \<eta>\<rbrakk> \<Longrightarrow> cmod (F x1' x2' - F x1 x2) \<le> \<epsilon> / cmod (b - a)
[PROOF STEP]
using \<eta> [of "(x1,x2)" "(x1',x2')"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(x1, x2) \<in> cball w \<delta> \<times> closed_segment a b; (x1', x2') \<in> cball w \<delta> \<times> closed_segment a b; dist (x1', x2') (x1, x2) < \<eta>\<rbrakk> \<Longrightarrow> dist (case (x1', x2') of (x, y) \<Rightarrow> F x y) (case (x1, x2) of (x, y) \<Rightarrow> F x y) < \<epsilon> / cmod (b - a)

goal (1 subgoal):
 1. \<lbrakk>cmod (w - x1) \<le> \<delta>; x2 \<in> closed_segment a b; cmod (w - x1') \<le> \<delta>; x2' \<in> closed_segment a b; norm ((x1', x2') - (x1, x2)) < \<eta>\<rbrakk> \<Longrightarrow> cmod (F x1' x2' - F x1 x2) \<le> \<epsilon> / cmod (b - a)
[PROOF STEP]
by (force simp: dist_norm)
[PROOF STATE]
proof (state)
this:
\<lbrakk>cmod (w - ?x1.0) \<le> \<delta>; ?x2.0 \<in> closed_segment a b; cmod (w - ?x1') \<le> \<delta>; ?x2' \<in> closed_segment a b; norm ((?x1', ?x2') - (?x1.0, ?x2.0)) < \<eta>\<rbrakk> \<Longrightarrow> cmod (F ?x1' ?x2' - F ?x1.0 ?x2.0) \<le> \<epsilon> / cmod (b - a)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
have le_ee: "cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>"
                if "x' \<in> U" "cmod (x' - w) < \<delta>" "cmod (x' - w) < \<eta>"  for x'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>
[PROOF STEP]
have "(\<lambda>x. F x' x - F w x) contour_integrable_on linepath a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. F x' x - F w x) contour_integrable_on linepath a b
[PROOF STEP]
by (simp add: \<open>w \<in> U\<close> cont_dw contour_integrable_diff that)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. F x' x - F w x) contour_integrable_on linepath a b

goal (1 subgoal):
 1. cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. F x' x - F w x) contour_integrable_on linepath a b
[PROOF STEP]
have "cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>/norm(b - a) * norm(b - a)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. F x' x - F w x) contour_integrable_on linepath a b

goal (1 subgoal):
 1. cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon> / cmod (b - a) * cmod (b - a)
[PROOF STEP]
apply (rule has_contour_integral_bound_linepath [OF has_contour_integral_integral _ \<eta>])
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. 0 \<le> \<epsilon> / cmod (b - a)
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> cmod (w - w) \<le> \<delta>
 3. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> closed_segment a b
 4. \<And>x. x \<in> closed_segment a b \<Longrightarrow> cmod (w - x') \<le> \<delta>
 5. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> closed_segment a b
 6. \<And>x. x \<in> closed_segment a b \<Longrightarrow> norm ((x', x) - (w, x)) < \<eta>
[PROOF STEP]
using \<open>0 < \<epsilon>\<close> \<open>0 < \<delta>\<close> that
[PROOF STATE]
proof (prove)
using this:
0 < \<epsilon>
0 < \<delta>
x' \<in> U
cmod (x' - w) < \<delta>
cmod (x' - w) < \<eta>

goal (6 subgoals):
 1. 0 \<le> \<epsilon> / cmod (b - a)
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> cmod (w - w) \<le> \<delta>
 3. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> closed_segment a b
 4. \<And>x. x \<in> closed_segment a b \<Longrightarrow> cmod (w - x') \<le> \<delta>
 5. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> closed_segment a b
 6. \<And>x. x \<in> closed_segment a b \<Longrightarrow> norm ((x', x) - (w, x)) < \<eta>
[PROOF STEP]
by (auto simp: norm_minus_commute)
[PROOF STATE]
proof (state)
this:
cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon> / cmod (b - a) * cmod (b - a)

goal (1 subgoal):
 1. cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon> / cmod (b - a) * cmod (b - a)

goal (1 subgoal):
 1. cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>
[PROOF STEP]
have "\<dots> = \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<epsilon> / cmod (b - a) * cmod (b - a) = \<epsilon>
[PROOF STEP]
using \<open>a \<noteq> b\<close>
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b

goal (1 subgoal):
 1. \<epsilon> / cmod (b - a) * cmod (b - a) = \<epsilon>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<epsilon> / cmod (b - a) * cmod (b - a) = \<epsilon>

goal (1 subgoal):
 1. cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>

goal (1 subgoal):
 1. cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cmod (contour_integral (linepath a b) (\<lambda>x. F x' x - F w x)) \<le> \<epsilon>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x' \<in> U; cmod (?x' - w) < \<delta>; cmod (?x' - w) < \<eta>\<rbrakk> \<Longrightarrow> cmod (contour_integral (linepath a b) (\<lambda>x. F ?x' x - F w x)) \<le> \<epsilon>

goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>
[PROOF STEP]
apply (rule_tac x="min \<delta> \<eta>" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < min \<delta> \<eta> \<and> (\<forall>x'\<in>U. dist x' w < min \<delta> \<eta> \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>)
[PROOF STEP]
using \<open>0 < \<delta>\<close> \<open>0 < \<eta>\<close>
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>
0 < \<eta>

goal (1 subgoal):
 1. 0 < min \<delta> \<eta> \<and> (\<forall>x'\<in>U. dist x' w < min \<delta> \<eta> \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>)
[PROOF STEP]
by (auto simp: dist_norm contour_integral_diff [OF cont_dw cont_dw, symmetric] \<open>w \<in> U\<close> intro: le_ee)
[PROOF STATE]
proof (state)
this:
\<exists>d>0. \<forall>x'\<in>U. dist x' w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F w)) \<le> \<epsilon>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?w \<in> U; 0 < ?\<epsilon>; a \<noteq> b\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>x'\<in>U. dist x' ?w < d \<longrightarrow> dist (contour_integral (linepath a b) (F x')) (contour_integral (linepath a b) (F ?w)) \<le> ?\<epsilon>

goal (1 subgoal):
 1. continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
[PROOF STEP]
proof (cases "a=b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = b \<Longrightarrow> continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
 2. a \<noteq> b \<Longrightarrow> continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> b

goal (2 subgoals):
 1. a = b \<Longrightarrow> continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
 2. a \<noteq> b \<Longrightarrow> continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
[PROOF STEP]
by (rule continuous_onI) (use False in \<open>auto intro: *\<close>)
[PROOF STATE]
proof (state)
this:
continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))

goal (1 subgoal):
 1. a = b \<Longrightarrow> continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
continuous_on U (\<lambda>w. contour_integral (linepath a b) (F w))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bdd_above_image_mono:
  assumes "mono\<^sub>a\<^sub>b f" and "ord\<^sub>a.bdd_above A"
  shows "ord\<^sub>b.bdd_above (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord\<^sub>b.bdd_above (f ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mono\<^sub>a\<^sub>b f
ord\<^sub>a.bdd_above A

goal (1 subgoal):
 1. ord\<^sub>b.bdd_above (f ` A)
[PROOF STEP]
by (auto simp: bdd_def mono_def)


[STATEMENT]
lemma ordinal_plus_left_cancel_less [simp]:
"(w + x < w + y) = (x < (y::ordinal))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w + x < w + y) = (x < y)
[PROOF STEP]
by (rule normal.cancel_less[OF normal_plus])


[STATEMENT]
lemma (in ring) subdomainI:
  assumes "subcring H R"
    and "\<one> \<noteq> \<zero>"
    and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes> h2 = \<zero> \<Longrightarrow> h1 = \<zero> \<or> h2 = \<zero>"
  shows "subdomain H R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subdomain H R
[PROOF STEP]
unfolding subdomain_def subdomain_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subcring H R \<and> \<one> \<noteq> \<zero> \<and> (\<forall>h1 h2. h1 \<in> H \<longrightarrow> h2 \<in> H \<longrightarrow> h1 \<otimes> h2 = \<zero> \<longrightarrow> h1 = \<zero> \<or> h2 = \<zero>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subcring H R
\<one> \<noteq> \<zero>
\<lbrakk>?h1.0 \<in> H; ?h2.0 \<in> H; ?h1.0 \<otimes> ?h2.0 = \<zero>\<rbrakk> \<Longrightarrow> ?h1.0 = \<zero> \<or> ?h2.0 = \<zero>

goal (1 subgoal):
 1. subcring H R \<and> \<one> \<noteq> \<zero> \<and> (\<forall>h1 h2. h1 \<in> H \<longrightarrow> h2 \<in> H \<longrightarrow> h1 \<otimes> h2 = \<zero> \<longrightarrow> h1 = \<zero> \<or> h2 = \<zero>)
[PROOF STEP]
by simp+


[STATEMENT]
lemma valid_path_ITP2015: "
  (valid_path Pi [] \<longleftrightarrow> True)
  \<and> (valid_path Pi [s] \<longleftrightarrow> (s \<in> valid_states Pi))
  \<and> (valid_path Pi (s1 # s2 # rest) \<longleftrightarrow>
      (s1 \<in> valid_states Pi)
      \<and> (\<exists>a.
        (a \<in> Pi)
        \<and> (exec_plan s1 [a] = s2)
      )
      \<and> (valid_path Pi (s2 # rest))
  )
"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path Pi [] = True \<and> valid_path Pi [s] = (s \<in> valid_states Pi) \<and> valid_path Pi (s1 # s2 # rest) = (s1 \<in> valid_states Pi \<and> (\<exists>a. a \<in> Pi \<and> exec_plan s1 [a] = s2) \<and> valid_path Pi (s2 # rest))
[PROOF STEP]
using valid_states_def
[PROOF STATE]
proof (prove)
using this:
valid_states ?prob \<equiv> {s. fmdom' s = prob_dom ?prob}

goal (1 subgoal):
 1. valid_path Pi [] = True \<and> valid_path Pi [s] = (s \<in> valid_states Pi) \<and> valid_path Pi (s1 # s2 # rest) = (s1 \<in> valid_states Pi \<and> (\<exists>a. a \<in> Pi \<and> exec_plan s1 [a] = s2) \<and> valid_path Pi (s2 # rest))
[PROOF STEP]
by simp

\<comment> \<open>NOTE name shortened.\<close>
\<comment> \<open>NOTE second declaration skipped (declared twice in source).\<close>


[STATEMENT]
lemma Least_Hermite_of_row_i:
  assumes i: "\<not> is_zero_row i A"
  and e: "echelon_form A"
  and a: "ass_function ass"
  shows "(LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> 0) = (LEAST n. A $ i $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
let ?M="mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> 0)) div A $ i $ (LEAST n. A $ i $ n \<noteq> 0))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
let ?H="Hermite_reduce_above ?M (to_nat i) i (LEAST n. A $ i $ n \<noteq> 0) res"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
have "(LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> 0) = (LEAST n. ?H $ i $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res $ i $ n \<noteq> (0::'b))
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row i A

goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res $ i $ n \<noteq> (0::'b))
[PROOF STEP]
unfolding Hermite_of_row_i_def
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row i A

goal (1 subgoal):
 1. (LEAST n. (if is_zero_row i A then A else let j = LEAST n. A $ i $ n \<noteq> (0::'b); Aij = A $ i $ j; A' = mult_row A i (ass Aij div Aij) in Hermite_reduce_above A' (mod_type_class.to_nat i) i j res) $ i $ n \<noteq> (0::'b)) = (LEAST n. Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res $ i $ n \<noteq> (0::'b))
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row i A

goal (1 subgoal):
 1. (LEAST n. (if is_zero_row i A then A else Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res) $ i $ n \<noteq> (0::'b)) = (LEAST n. Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res $ i $ n \<noteq> (0::'b))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res $ i $ n \<noteq> (0::'b))

goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res $ i $ n \<noteq> (0::'b))

goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
have "... = (LEAST n. A $ i $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
by (rule Hermite_reduce_above_Least[OF e a i i])
       (rule not_zero_Hermite_reduce_above[OF i i e a], simp)
[PROOF STATE]
proof (state)
this:
(LEAST n. Hermite_reduce_above (mult_row A i (ass (A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b))) div A $ i $ (LEAST n. A $ i $ n \<noteq> (0::'b)))) (mod_type_class.to_nat i) i (LEAST n. A $ i $ n \<noteq> (0::'b)) res $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))

goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))

goal (1 subgoal):
 1. (LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(LEAST n. Hermite_of_row_i ass res A i $ i $ n \<noteq> (0::'b)) = (LEAST n. A $ i $ n \<noteq> (0::'b))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma find_index_eq_iff:
  "find_index P xs = i
  \<longleftrightarrow> (i\<le>length xs \<and> (\<forall>j<i. \<not>P (xs!j)) \<and> (i<length xs \<longrightarrow> P (xs!i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (find_index P xs = i) = (i \<le> length xs \<and> (\<forall>j<i. \<not> P (xs ! j)) \<and> (i < length xs \<longrightarrow> P (xs ! i)))
[PROOF STEP]
by (auto intro: find_index_eqI
         simp: nth_find_index find_index_le_size find_index_first)


[STATEMENT]
lemma echelon_form_of_column_k_det_unit:
  fixes A::"'a::{bezout_domain_div}^'n::{mod_type}^'n::{mod_type}"
  assumes det: "is_unit (det_P)"
  shows "is_unit (fst ((echelon_form_of_column_k_det bezout) (det_P,A,i) k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (fst (echelon_form_of_column_k_det bezout (det_P, A, i) k))
[PROOF STEP]
unfolding echelon_form_of_column_k_det_def Let_def fst_conv snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (fst (case (det_P, A, i) of (det_P, A, i) \<Rightarrow> if i \<noteq> nrows A \<and> A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a) \<and> (\<exists>m>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)) then (- (1::'a) * det_P, echelon_form_of_column_k bezout (A, i) k) else (det_P, echelon_form_of_column_k bezout (A, i) k)))
[PROOF STEP]
using det
[PROOF STATE]
proof (prove)
using this:
is_unit det_P

goal (1 subgoal):
 1. is_unit (fst (case (det_P, A, i) of (det_P, A, i) \<Rightarrow> if i \<noteq> nrows A \<and> A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a) \<and> (\<exists>m>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)) then (- (1::'a) * det_P, echelon_form_of_column_k bezout (A, i) k) else (det_P, echelon_form_of_column_k bezout (A, i) k)))
[PROOF STEP]
by auto


[STATEMENT]
lemma product_qbs_canonical1:
  assumes "\<And>i. i \<in> I \<Longrightarrow> f i \<in> Y \<rightarrow>\<^sub>Q X i"
      and "\<And>i. i \<notin> I \<Longrightarrow> f i = (\<lambda>y. undefined)"
    shows "(\<lambda>y i. f i y) \<in> Y \<rightarrow>\<^sub>Q (\<Pi>\<^sub>Q i\<in>I. X i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y i. f i y) \<in> Y \<rightarrow>\<^sub>Q PiQ I X
[PROOF STEP]
using qbs_morphismE(3)[simplified comp_def,OF assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i1 \<in> I; ?\<alpha> \<in> qbs_Mx Y\<rbrakk> \<Longrightarrow> (\<lambda>x. f ?i1 (?\<alpha> x)) \<in> qbs_Mx (X ?i1)
?i \<notin> I \<Longrightarrow> f ?i = (\<lambda>y. undefined)

goal (1 subgoal):
 1. (\<lambda>y i. f i y) \<in> Y \<rightarrow>\<^sub>Q PiQ I X
[PROOF STEP]
by(auto intro!: qbs_morphismI prod_qbs_MxI)


[STATEMENT]
lemma hom_group_mul_eq:
   "(\<lambda>(x,y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
     \<longleftrightarrow> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x)"
         (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G \<Longrightarrow> \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x
 2. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x \<Longrightarrow> (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G

goal (2 subgoals):
 1. (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G \<Longrightarrow> \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x
 2. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x \<Longrightarrow> (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G

goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x
[PROOF STEP]
using hom_group_mul_rev AG.subset BG.subset
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
\<lbrakk>(\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G ?A \<times>\<times> subgroup_generated G ?B) G; ?x \<in> carrier G; ?y \<in> carrier G; ?x \<in> ?A; ?y \<in> ?B\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y = ?y \<otimes> ?x
A \<subseteq> carrier G
B \<subseteq> carrier G

goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x

goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x \<Longrightarrow> (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x \<Longrightarrow> (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
assume R: ?rhs
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x

goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x \<Longrightarrow> (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
have subG: "generate G (carrier G \<inter> A) \<subseteq> carrier G" for A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generate G (carrier G \<inter> A) \<subseteq> carrier G
[PROOF STEP]
by (simp add: generate_incl)
[PROOF STATE]
proof (state)
this:
generate G (carrier G \<inter> ?A) \<subseteq> carrier G

goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x \<Longrightarrow> (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
have *: "x \<otimes> u \<otimes> (y \<otimes> v) = x \<otimes> y \<otimes> (u \<otimes> v)"
    if eq [rule_format]: "\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x"
      and gen: "x \<in> generate G (carrier G \<inter> A)" "y \<in> generate G (carrier G \<inter> B)"
      "u \<in> generate G (carrier G \<inter> A)" "v \<in> generate G (carrier G \<inter> B)"
    for x y u v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<otimes> u \<otimes> (y \<otimes> v) = x \<otimes> y \<otimes> (u \<otimes> v)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<otimes> u \<otimes> (y \<otimes> v) = x \<otimes> y \<otimes> (u \<otimes> v)
[PROOF STEP]
have "u \<otimes> y = y \<otimes> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<otimes> y = y \<otimes> u
[PROOF STEP]
by (metis AG.carrier_subgroup_generated_subgroup BG.carrier_subgroup_generated_subgroup carrier_subgroup_generated eq that(3) that(4))
[PROOF STATE]
proof (state)
this:
u \<otimes> y = y \<otimes> u

goal (1 subgoal):
 1. x \<otimes> u \<otimes> (y \<otimes> v) = x \<otimes> y \<otimes> (u \<otimes> v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<otimes> y = y \<otimes> u
[PROOF STEP]
have "x \<otimes> u \<otimes> y = x \<otimes> y \<otimes> u"
[PROOF STATE]
proof (prove)
using this:
u \<otimes> y = y \<otimes> u

goal (1 subgoal):
 1. x \<otimes> u \<otimes> y = x \<otimes> y \<otimes> u
[PROOF STEP]
using gen
[PROOF STATE]
proof (prove)
using this:
u \<otimes> y = y \<otimes> u
x \<in> generate G (carrier G \<inter> A)
y \<in> generate G (carrier G \<inter> B)
u \<in> generate G (carrier G \<inter> A)
v \<in> generate G (carrier G \<inter> B)

goal (1 subgoal):
 1. x \<otimes> u \<otimes> y = x \<otimes> y \<otimes> u
[PROOF STEP]
by (simp add: m_assoc subsetD [OF subG])
[PROOF STATE]
proof (state)
this:
x \<otimes> u \<otimes> y = x \<otimes> y \<otimes> u

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

goal (1 subgoal):
 1. x \<otimes> u \<otimes> (y \<otimes> v) = x \<otimes> y \<otimes> (u \<otimes> v)
[PROOF STEP]
using gen
[PROOF STATE]
proof (prove)
using this:
x \<otimes> u \<otimes> y = x \<otimes> y \<otimes> u
x \<in> generate G (carrier G \<inter> A)
y \<in> generate G (carrier G \<inter> B)
u \<in> generate G (carrier G \<inter> A)
v \<in> generate G (carrier G \<inter> B)

goal (1 subgoal):
 1. x \<otimes> u \<otimes> (y \<otimes> v) = x \<otimes> y \<otimes> (u \<otimes> v)
[PROOF STEP]
by (simp add: subsetD [OF subG] flip: m_assoc)
[PROOF STATE]
proof (state)
this:
x \<otimes> u \<otimes> (y \<otimes> v) = x \<otimes> y \<otimes> (u \<otimes> v)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x; ?x \<in> generate G (carrier G \<inter> A); ?y \<in> generate G (carrier G \<inter> B); ?u \<in> generate G (carrier G \<inter> A); ?v \<in> generate G (carrier G \<inter> B)\<rbrakk> \<Longrightarrow> ?x \<otimes> ?u \<otimes> (?y \<otimes> ?v) = ?x \<otimes> ?y \<otimes> (?u \<otimes> ?v)

goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x \<Longrightarrow> (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x

goal (1 subgoal):
 1. (\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
[PROOF STEP]
by (auto simp: hom_def carrier_subgroup_generated subsetD [OF subG] *)
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). x \<otimes> y) \<in> hom (subgroup_generated G A \<times>\<times> subgroup_generated G B) G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_pole_cong:
  assumes "eventually (\<lambda>x. f x = g x) (at a)" "a=b"
  shows "is_pole f a \<longleftrightarrow> is_pole g b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_pole f a = is_pole g b
[PROOF STEP]
unfolding is_pole_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f at_infinity (at a) = filterlim g at_infinity (at b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at a. f x = g x
a = b

goal (1 subgoal):
 1. filterlim f at_infinity (at a) = filterlim g at_infinity (at b)
[PROOF STEP]
by (intro filterlim_cong,auto)


[STATEMENT]
lemma p_nat_pow_factor_nat_pow:
  assumes "a \<in> carrier Q\<^sub>p"
  shows "(\<pp>[^](n::nat) \<otimes> a)[^](k::nat) = \<pp>[^](n*k) \<otimes> a[^]k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<pp> [^] n \<otimes> a) [^] k = \<pp> [^] (n * k) \<otimes> a [^] k
[PROOF STEP]
using Qp.nat_pow_distrib Qp_p_nat_pow_pow assms p_natpow_closed(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier Q\<^sub>p; ?y \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> (?x \<otimes> ?y) [^] ?n = ?x [^] ?n \<otimes> ?y [^] ?n
\<pp> [^] (?n * ?m) = (\<pp> [^] ?n) [^] ?m
a \<in> carrier Q\<^sub>p
\<pp> [^] ?n \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. (\<pp> [^] n \<otimes> a) [^] k = \<pp> [^] (n * k) \<otimes> a [^] k
[PROOF STEP]
by presburger


[STATEMENT]
lemma "Sup \<circ> atom_map = (id::'a::complete_atomic_boolean_algebra \<Rightarrow> 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup \<circ> atom_map = id
[PROOF STEP]
unfolding fun_eq_iff comp_def id_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<Squnion> atom_map x = x
[PROOF STEP]
by (metis Union_upper atom_map_atoms inj_atom_map inj_def rangeI surj_atom_map)


[STATEMENT]
lemma fresh_image:
  fixes f :: "'a \<Rightarrow> 'b::fs"  shows "finite A \<Longrightarrow> i \<sharp> f ` A \<longleftrightarrow> (\<forall>x\<in>A. i \<sharp> f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> i \<sharp> f ` A = (\<forall>x\<in>A. i \<sharp> f x)
[PROOF STEP]
by (induct rule: finite_induct) (auto simp: fresh_finite_insert)


[STATEMENT]
lemma index_update_mat2[simp]:
  assumes i': "i' < dim_row A" and j': "j' < dim_col A" and neq: "(i',j') \<noteq> ij"
  shows "(A |\<^sub>m ij \<mapsto> a) $$ (i',j') = A $$ (i',j')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A |\<^sub>m ij \<mapsto> a) $$ (i', j') = A $$ (i', j')
[PROOF STEP]
unfolding update_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_row A) (dim_col A) (\<lambda>ij'. if ij' = ij then a else A $$ ij') $$ (i', j') = A $$ (i', j')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i' < dim_row A
j' < dim_col A
(i', j') \<noteq> ij

goal (1 subgoal):
 1. mat (dim_row A) (dim_col A) (\<lambda>ij'. if ij' = ij then a else A $$ ij') $$ (i', j') = A $$ (i', j')
[PROOF STEP]
by auto


[STATEMENT]
lemma run_accept_eps_Un: "run_accept_eps (\<Union>x \<in> X. R x) bss bs \<longleftrightarrow>
  (\<exists>x \<in> X. run_accept_eps (R x) bss bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. run_accept_eps (\<Union> (R ` X)) bss bs = (\<exists>x\<in>X. run_accept_eps (R x) bss bs)
[PROOF STEP]
unfolding run_accept_eps_def run_Un accept_eps_Un
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x\<in>X. accept_eps (run (R x) bss) bs) = (\<exists>x\<in>X. accept_eps (run (R x) bss) bs)
[PROOF STEP]
by simp


[STATEMENT]
lemma power_div_same_base:
  "b ^ y \<noteq> 0 \<Longrightarrow> x \<ge> y \<Longrightarrow> b ^ x div b ^ y = b ^ (x - y)" for b :: "'a::semidom_divide"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b ^ y \<noteq> (0::'a); y \<le> x\<rbrakk> \<Longrightarrow> b ^ x div b ^ y = b ^ (x - y)
[PROOF STEP]
by (metis add_diff_inverse leD nonzero_mult_div_cancel_left power_add)


[STATEMENT]
lemma (in Module) fgs_single_span:"\<lbrakk>h \<in> carrier M; x \<in> (fgs R M {h})\<rbrakk> \<Longrightarrow>
              \<exists>a\<in>carrier R. x = a \<cdot>\<^sub>s h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>h \<in> carrier M; x \<in> fgs R M {h}\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier R. x = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (simp add:fgs_def linear_span_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>h \<in> carrier M; \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> {h}. \<exists>s\<in>{j. j \<le> n} \<rightarrow> carrier R. x = l_comb R M n s f\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier R. x = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (erule exE, (erule bexE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f s. \<lbrakk>h \<in> carrier M; f \<in> {j. j \<le> n} \<rightarrow> {h}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; x = l_comb R M n s f\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier R. x = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (cut_tac sc_Ring, frule Ring.whole_ideal)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f s. \<lbrakk>h \<in> carrier M; f \<in> {j. j \<le> n} \<rightarrow> {h}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; x = l_comb R M n s f; Ring R; ideal R (carrier R)\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier R. x = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (frule_tac A = "carrier R" and z = h and h = f and n = n and t = s in
        single_span, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f s. \<lbrakk>h \<in> carrier M; f \<in> {j. j \<le> n} \<rightarrow> {h}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; x = l_comb R M n s f; Ring R; ideal R (carrier R); \<exists>sa\<in>{0} \<rightarrow> carrier R. \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n = sa 0 \<cdot>\<^sub>s h\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier R. x = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (erule bexE, simp add:l_comb_def del: Pi_split_insert_domain)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f s sa. \<lbrakk>h \<in> carrier M; f \<in> {j. j \<le> n} \<rightarrow> {h}; s \<in> {j. j \<le> n} \<rightarrow> carrier R; x = sa 0 \<cdot>\<^sub>s h; Ring R; ideal R (carrier R); sa \<in> {0} \<rightarrow> carrier R; \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n = sa 0 \<cdot>\<^sub>s h\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier R. sa 0 \<cdot>\<^sub>s h = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (frule_tac f = sa and A = "{0}" and B = "carrier R" and
                 x = 0 in funcset_mem,  simp, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lexord_eq_alt_def2:
  \<open>(RETURN oo lexord_eq) xs ys =
     REC\<^sub>T (\<lambda>f (xs, ys).
        case (xs, ys) of
           ([], _) \<Rightarrow> RETURN True
         | (x # xs, y # ys) \<Rightarrow>
            if x < y then RETURN True
            else if x = y then f (xs, ys) else RETURN False
        | _ \<Rightarrow> RETURN False)
        (xs, ys)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (RETURN \<circ>\<circ> lexord_eq) xs ys = REC\<^sub>T (\<lambda>f (xs, ys). case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (xs, ys)
[PROOF STEP]
apply (subst eq_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. REC\<^sub>T (\<lambda>f (xs, ys). case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (xs, ys) = (RETURN \<circ>\<circ> lexord_eq) xs ys
[PROOF STEP]
apply (induction xs ys rule: lexord_eq.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>uu_. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) ([], uu_) = (RETURN \<circ>\<circ> lexord_eq) [] uu_
 2. \<And>x xs y ys. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (xs, ys) = (RETURN \<circ>\<circ> lexord_eq) xs ys \<Longrightarrow> REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (x # xs, y # ys) = (RETURN \<circ>\<circ> lexord_eq) (x # xs) (y # ys)
 3. \<And>v va. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (v # va, []) = (RETURN \<circ>\<circ> lexord_eq) (v # va) []
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) ([], uu_) = (RETURN \<circ>\<circ> lexord_eq) [] uu_
[PROOF STEP]
by (subst RECT_unfold, refine_mono) auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xs y ys. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (xs, ys) = (RETURN \<circ>\<circ> lexord_eq) xs ys \<Longrightarrow> REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (x # xs, y # ys) = (RETURN \<circ>\<circ> lexord_eq) (x # xs) (y # ys)
 2. \<And>v va. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (v # va, []) = (RETURN \<circ>\<circ> lexord_eq) (v # va) []
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (xs_, ys_) = (RETURN \<circ>\<circ> lexord_eq) xs_ ys_ \<Longrightarrow> REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (x_ # xs_, y_ # ys_) = (RETURN \<circ>\<circ> lexord_eq) (x_ # xs_) (y_ # ys_)
[PROOF STEP]
by (subst RECT_unfold, refine_mono) auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v va. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (v # va, []) = (RETURN \<circ>\<circ> lexord_eq) (v # va) []
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. REC\<^sub>T (\<lambda>f a. case a of (xs, ys) \<Rightarrow> case (xs, ys) of ([], x) \<Rightarrow> RETURN True | (xa # xs, []) \<Rightarrow> RETURN False | (xa # xs, y # ys) \<Rightarrow> if xa < y then RETURN True else if xa = y then f (xs, ys) else RETURN False) (v_ # va_, []) = (RETURN \<circ>\<circ> lexord_eq) (v_ # va_) []
[PROOF STEP]
by (subst RECT_unfold, refine_mono) auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_density_emeasure:
    "has_density M N f \<Longrightarrow> X \<in> sets M \<Longrightarrow> emeasure M X = \<integral>\<^sup>+x. f x * indicator X x \<partial>N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>has_density M N f; X \<in> sets M\<rbrakk> \<Longrightarrow> emeasure M X = set_nn_integral N X f
[PROOF STEP]
unfolding has_density_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable N \<and> space N \<noteq> {} \<and> M = density N f; X \<in> sets M\<rbrakk> \<Longrightarrow> emeasure M X = set_nn_integral N X f
[PROOF STEP]
by (simp_all add: emeasure_density)


[STATEMENT]
lemma zip_assoc: "map f (zip xs (zip ys zs)) = map (\<lambda>((x, y), z). f (x, (y, z))) (zip (zip xs ys) zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f (zip xs (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip xs ys) zs
[PROOF STEP]
apply (induct xs arbitrary: ys zs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys zs. map f (zip [] (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip [] ys) zs
 2. \<And>a xs ys zs. (\<And>ys zs. map f (zip xs (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip xs ys) zs) \<Longrightarrow> map f (zip (a # xs) (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip (a # xs) ys) zs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys zs. (\<And>ys zs. map f (zip xs (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip xs ys) zs) \<Longrightarrow> map f (zip (a # xs) (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip (a # xs) ys) zs
[PROOF STEP]
apply (case_tac ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs ys zs. \<lbrakk>\<And>ys zs. map f (zip xs (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip xs ys) zs; ys = []\<rbrakk> \<Longrightarrow> map f (zip (a # xs) (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip (a # xs) ys) zs
 2. \<And>a xs ys zs aa list. \<lbrakk>\<And>ys zs. map f (zip xs (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip xs ys) zs; ys = aa # list\<rbrakk> \<Longrightarrow> map f (zip (a # xs) (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip (a # xs) ys) zs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys zs aa list. \<lbrakk>\<And>ys zs. map f (zip xs (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip xs ys) zs; ys = aa # list\<rbrakk> \<Longrightarrow> map f (zip (a # xs) (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip (a # xs) ys) zs
[PROOF STEP]
apply (case_tac zs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs ys zs aa list. \<lbrakk>\<And>ys zs. map f (zip xs (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip xs ys) zs; ys = aa # list; zs = []\<rbrakk> \<Longrightarrow> map f (zip (a # xs) (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip (a # xs) ys) zs
 2. \<And>a xs ys zs aa list ab lista. \<lbrakk>\<And>ys zs. map f (zip xs (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip xs ys) zs; ys = aa # list; zs = ab # lista\<rbrakk> \<Longrightarrow> map f (zip (a # xs) (zip ys zs)) = map2 (\<lambda>(x, y) z. f (x, y, z)) (zip (a # xs) ys) zs
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma map_of_zip_is_Some:
  assumes "length xs = length ys"
  shows "x \<in> set xs \<longleftrightarrow> (\<exists>y. map_of (zip xs ys) x = Some y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set xs) = (\<exists>y. map_of (zip xs ys) x = Some y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. (x \<in> set xs) = (\<exists>y. map_of (zip xs ys) x = Some y)
[PROOF STEP]
by (induct rule: list_induct2) simp_all


[STATEMENT]
lemma monom_eq_iff': "monom c n = monom d m \<longleftrightarrow>  c = d \<and> (c = 0 \<or> n = m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (monom c n = monom d m) = (c = d \<and> (c = (0::'a) \<or> n = m))
[PROOF STEP]
by (auto simp: poly_eq_iff)


[STATEMENT]
lemma infsum_cnj[simp]: \<open>infsum (\<lambda>x. cnj (f x)) M = cnj (infsum f M)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>M. cnj (f x)) = cnj (infsum f M)
[PROOF STEP]
by (metis complex_cnj_zero infsumI has_sum_cnj_iff infsum_def summable_on_cnj_iff has_sum_infsum)


[STATEMENT]
lemma givenByI: "(\<And>x y. [| x \<in> A;  v x = v y |] ==> y \<in> A) ==> A \<in> givenBy v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> A; v x = v y\<rbrakk> \<Longrightarrow> y \<in> A) \<Longrightarrow> A \<in> givenBy v
[PROOF STEP]
by (subst givenBy_eq_all, blast)


[STATEMENT]
lemma iT_Minus_mem_iff: "(x \<in> k \<ominus> I) = (x \<le> k \<and> k - x \<in> I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> k \<ominus> I) = (x \<le> k \<and> k - x \<in> I)
[PROOF STEP]
by (simp add: iT_Minus_def)


[STATEMENT]
lemma le_of_int_ceiling [simp]: "x \<le> of_int \<lceil>x\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> of_int \<lceil>x\<rceil>
[PROOF STEP]
using ceiling_correct
[PROOF STATE]
proof (prove)
using this:
of_int \<lceil>?x\<rceil> - (1::?'a) < ?x \<and> ?x \<le> of_int \<lceil>?x\<rceil>

goal (1 subgoal):
 1. x \<le> of_int \<lceil>x\<rceil>
[PROOF STEP]
..


[STATEMENT]
lemma valid_path_finite_in_V: "\<lbrakk> valid_path P; enat n < llength P \<rbrakk> \<Longrightarrow> P $ n \<in> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valid_path P; enat n < llength P\<rbrakk> \<Longrightarrow> P $ n \<in> V
[PROOF STEP]
using valid_path_in_V lset_lnth_member
[PROOF STATE]
proof (prove)
using this:
valid_path ?P \<Longrightarrow> lset ?P \<subseteq> V
\<lbrakk>lset ?xs \<subseteq> ?A; enat ?n < llength ?xs\<rbrakk> \<Longrightarrow> ?xs $ ?n \<in> ?A

goal (1 subgoal):
 1. \<lbrakk>valid_path P; enat n < llength P\<rbrakk> \<Longrightarrow> P $ n \<in> V
[PROOF STEP]
by blast


[STATEMENT]
lemma Vfrom_sup: "Vfrom a (i \<squnion> j) = Vfrom a i \<squnion> Vfrom a j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Vfrom a (i \<squnion> j) = Vfrom a i \<squnion> Vfrom a j
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Vfrom a (i \<squnion> j) \<le> Vfrom a i \<squnion> Vfrom a j
 2. Vfrom a i \<squnion> Vfrom a j \<le> Vfrom a (i \<squnion> j)
[PROOF STEP]
show "Vfrom a (i \<squnion> j) \<le> Vfrom a i \<squnion> Vfrom a j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Vfrom a (i \<squnion> j) \<le> Vfrom a i \<squnion> Vfrom a j
[PROOF STEP]
by (simp add: Vfrom [of a "i \<squnion> j"] Vfrom [of a i] Vfrom [of a j] Sup_Un_distrib image_Un sup.assoc sup.left_commute)
[PROOF STATE]
proof (state)
this:
Vfrom a (i \<squnion> j) \<le> Vfrom a i \<squnion> Vfrom a j

goal (1 subgoal):
 1. Vfrom a i \<squnion> Vfrom a j \<le> Vfrom a (i \<squnion> j)
[PROOF STEP]
show "Vfrom a i \<squnion> Vfrom a j \<le> Vfrom a (i \<squnion> j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Vfrom a i \<squnion> Vfrom a j \<le> Vfrom a (i \<squnion> j)
[PROOF STEP]
by (metis Vfrom_mono2 le_supI sup_commute)
[PROOF STATE]
proof (state)
this:
Vfrom a i \<squnion> Vfrom a j \<le> Vfrom a (i \<squnion> j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "(y::nat) \<noteq> 0 \<Longrightarrow> (x mod y) < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<noteq> 0 \<Longrightarrow> x mod y < y
[PROOF STEP]
using mod_less_divisor
[PROOF STATE]
proof (prove)
using this:
0 < ?n \<Longrightarrow> ?m mod ?n < ?n

goal (1 subgoal):
 1. y \<noteq> 0 \<Longrightarrow> x mod y < y
[PROOF STEP]
by auto


[STATEMENT]
lemma tendsto_minus_cancel_right: "((\<lambda>x. -g x) \<longlongrightarrow> l) F \<longleftrightarrow> (g \<longlongrightarrow> -l) F"
  \<comment> \<open>cf @{thm tendsto_minus_cancel_left}\<close>
  for g::"_ \<Rightarrow> 'b::topological_group_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - g x) \<longlongrightarrow> l) F = (g \<longlongrightarrow> - l) F
[PROOF STEP]
by (simp add: tendsto_minus_cancel_left)


[STATEMENT]
lemma Ia''m_calc: "$(Ia'')^{m}_n = (\<Sum>j<n. (j+1)/m * (\<Sum>k=j*m..<(j+1)*m. $v.^(k/m)))"
  if "m \<noteq> 0" for n m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{1}a'')^{m}_n = (\<Sum>j<n. real (j + 1) / real m * (\<Sum>k = j * m..<(j + 1) * m. $v .^ (real k / real m)))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0

goal (1 subgoal):
 1. $(I^{1}a'')^{m}_n = (\<Sum>j<n. real (j + 1) / real m * (\<Sum>k = j * m..<(j + 1) * m. $v .^ (real k / real m)))
[PROOF STEP]
apply (subst Ila''m_Ilam; simp del: One_nat_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (1 + i) .^ (1 / real m) * $(I^{1}a)^{m}_n = (\<Sum>j<n. (real j + 1) * (\<Sum>k = j * m..<(j + 1) * m. $v .^ (real k / real m)) / real m)
[PROOF STEP]
apply (subst Iam_calc; simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (1 + i) .^ (1 / real m) * (\<Sum>j<n. (1 + real j) * (\<Sum>k = j * m..<m + j * m. $v .^ ((1 + real k) / real m)) / real m) = (\<Sum>j<n. (real j + 1) * (\<Sum>k = j * m..<m + j * m. $v .^ (real k / real m)) / real m)
[PROOF STEP]
apply (subst sum_distrib_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (\<Sum>n<n. (1 + i) .^ (1 / real m) * ((1 + real n) * (\<Sum>k = n * m..<m + n * m. $v .^ ((1 + real k) / real m)) / real m)) = (\<Sum>j<n. (real j + 1) * (\<Sum>k = j * m..<m + j * m. $v .^ (real k / real m)) / real m)
[PROOF STEP]
apply (rule sum.cong; simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 < m; x < n\<rbrakk> \<Longrightarrow> (1 + i) .^ (1 / real m) * ((1 + real x) * (\<Sum>k = x * m..<m + x * m. $v .^ ((1 + real k) / real m))) = (real x + 1) * (\<Sum>k = x * m..<m + x * m. $v .^ (real k / real m))
[PROOF STEP]
apply (subst sum_distrib_left)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 < m; x < n\<rbrakk> \<Longrightarrow> (\<Sum>n = x * m..<m + x * m. (1 + i) .^ (1 / real m) * ((1 + real x) * $v .^ ((1 + real n) / real m))) = (\<Sum>n = x * m..<m + x * m. (real x + 1) * $v .^ (real n / real m))
[PROOF STEP]
apply (rule sum.cong; simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x < n; x * m \<le> xa \<and> xa < m + x * m\<rbrakk> \<Longrightarrow> (1 + i) .^ (1 / real m) * ((1 + real x) * $v .^ ((1 + real xa) / real m)) = (real x + 1) * $v .^ (real xa / real m)
[PROOF STEP]
apply (subst i_v_powr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x < n; x * m \<le> xa \<and> xa < m + x * m\<rbrakk> \<Longrightarrow> $v .^ - (1 / real m) * ((1 + real x) * $v .^ ((1 + real xa) / real m)) = (real x + 1) * $v .^ (real xa / real m)
[PROOF STEP]
using powr_add[of "$v", THEN sym]
[PROOF STATE]
proof (prove)
using this:
$v .^ ?a1 * $v .^ ?b1 = $v .^ (?a1 + ?b1)

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x < n; x * m \<le> xa \<and> xa < m + x * m\<rbrakk> \<Longrightarrow> $v .^ - (1 / real m) * ((1 + real x) * $v .^ ((1 + real xa) / real m)) = (real x + 1) * $v .^ (real xa / real m)
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma gauss_int_norm_normalize [simp]: "gauss_int_norm (normalize x) = gauss_int_norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_int_norm (normalize x) = gauss_int_norm x
[PROOF STEP]
by (simp add: normalize_gauss_int_def gauss_int_norm_mult)


[STATEMENT]
lemma append_cols_nth:
  assumes "A \<in> carrier_mat nr nc1"
    and "B \<in> carrier_mat nr nc2"
  shows "i < nc1 \<Longrightarrow> col (A @\<^sub>c B) i = col A i"
    and "\<lbrakk> i \<ge> nc1; i < nc1 + nc2 \<rbrakk> \<Longrightarrow> col (A @\<^sub>c B) i = col B (i - nc1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < nc1 \<Longrightarrow> col (A @\<^sub>c B) i = col A i) &&& (\<lbrakk>nc1 \<le> i; i < nc1 + nc2\<rbrakk> \<Longrightarrow> col (A @\<^sub>c B) i = col B (i - nc1))
[PROOF STEP]
unfolding append_cols_def append_rows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < nc1 \<Longrightarrow> col (four_block_mat A\<^sup>T (0\<^sub>m (dim_row A\<^sup>T) 0) B\<^sup>T (0\<^sub>m (dim_row B\<^sup>T) 0))\<^sup>T i = col A i) &&& (\<lbrakk>nc1 \<le> i; i < nc1 + nc2\<rbrakk> \<Longrightarrow> col (four_block_mat A\<^sup>T (0\<^sub>m (dim_row A\<^sup>T) 0) B\<^sup>T (0\<^sub>m (dim_row B\<^sup>T) 0))\<^sup>T i = col B (i - nc1))
[PROOF STEP]
using row_four_block_mat assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?nr1.0 ?nc1.0; ?B \<in> carrier_mat ?nr1.0 ?nc2.0; ?C \<in> carrier_mat ?nr2.0 ?nc1.0; ?D \<in> carrier_mat ?nr2.0 ?nc2.0; ?i < ?nr1.0\<rbrakk> \<Longrightarrow> row (four_block_mat ?A ?B ?C ?D) ?i = row ?A ?i @\<^sub>v row ?B ?i
\<lbrakk>?A \<in> carrier_mat ?nr1.0 ?nc1.0; ?B \<in> carrier_mat ?nr1.0 ?nc2.0; ?C \<in> carrier_mat ?nr2.0 ?nc1.0; ?D \<in> carrier_mat ?nr2.0 ?nc2.0; \<not> ?i < ?nr1.0; ?i < ?nr1.0 + ?nr2.0\<rbrakk> \<Longrightarrow> row (four_block_mat ?A ?B ?C ?D) ?i = row ?C (?i - ?nr1.0) @\<^sub>v row ?D (?i - ?nr1.0)
A \<in> carrier_mat nr nc1
B \<in> carrier_mat nr nc2

goal (1 subgoal):
 1. (i < nc1 \<Longrightarrow> col (four_block_mat A\<^sup>T (0\<^sub>m (dim_row A\<^sup>T) 0) B\<^sup>T (0\<^sub>m (dim_row B\<^sup>T) 0))\<^sup>T i = col A i) &&& (\<lbrakk>nc1 \<le> i; i < nc1 + nc2\<rbrakk> \<Longrightarrow> col (four_block_mat A\<^sup>T (0\<^sub>m (dim_row A\<^sup>T) 0) B\<^sup>T (0\<^sub>m (dim_row B\<^sup>T) 0))\<^sup>T i = col B (i - nc1))
[PROOF STEP]
by auto


[STATEMENT]
lemma dghm_dag_Rel_ArrMap_app_vdomain[dg_cs_simps]:
  assumes "T : A \<mapsto>\<^bsub>dg_Rel \<alpha>\<^esub> B"
  shows "\<D>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<R>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<R>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<R>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
T : A \<mapsto>\<^bsub>dg_Rel \<alpha>\<^esub> B
[PROOF STEP]
interpret T: arr_Rel \<alpha> T
[PROOF STATE]
proof (prove)
using this:
T : A \<mapsto>\<^bsub>dg_Rel \<alpha>\<^esub> B

goal (1 subgoal):
 1. arr_Rel \<alpha> T
[PROOF STEP]
by (simp add: dg_Rel_is_arrD)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<R>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)
[PROOF STEP]
from dg_Rel_is_arrD(1)[OF assms]
[PROOF STATE]
proof (chain)
picking this:
arr_Rel \<alpha> T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arr_Rel \<alpha> T

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<R>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)
[PROOF STEP]
by (cs_concl cs_simp: dg_Rel_cs_simps V_cs_simps converse_Rel_components(1))
[PROOF STATE]
proof (state)
this:
\<D>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<R>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus_Bag [code]: "Bag xs - Bag ys = Bag (subtract_entries xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bag xs - Bag ys = Bag (subtract_entries xs ys)
[PROOF STEP]
by (rule multiset_eqI)
    (simp add: count_of_subtract_entries_raw alist.Alist_inverse
      distinct_subtract_entries_raw subtract_entries_def)


[STATEMENT]
lemma le_list_trans: "\<lbrakk> order r; xs [\<sqsubseteq>\<^bsub>r\<^esub>] ys; ys [\<sqsubseteq>\<^bsub>r\<^esub>] zs \<rbrakk> \<Longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; xs [\<sqsubseteq>\<^bsub>r\<^esub>] ys; ys [\<sqsubseteq>\<^bsub>r\<^esub>] zs\<rbrakk> \<Longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] zs
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; xs [\<sqsubseteq>\<^bsub>r\<^esub>] ys; ys [\<sqsubseteq>\<^bsub>r\<^esub>] zs\<rbrakk> \<Longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] zs
[PROOF STEP]
apply (unfold unfold_lesub_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; Listn.le r xs ys; Listn.le r ys zs\<rbrakk> \<Longrightarrow> Listn.le r xs zs
[PROOF STEP]
apply (unfold Listn.le_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; list_all2 (\<lambda>x. lesub x r) xs ys; list_all2 (\<lambda>x. lesub x r) ys zs\<rbrakk> \<Longrightarrow> list_all2 (\<lambda>x. lesub x r) xs zs
[PROOF STEP]
apply (rule list_all2_trans)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a b c. \<lbrakk>order r; list_all2 (\<lambda>x. lesub x r) xs ys; list_all2 (\<lambda>x. lesub x r) ys zs; ?P1.0 a b; ?P2.0 b c\<rbrakk> \<Longrightarrow> a \<sqsubseteq>\<^bsub>r\<^esub> c
 2. \<lbrakk>order r; list_all2 (\<lambda>x. lesub x r) xs ys; list_all2 (\<lambda>x. lesub x r) ys zs\<rbrakk> \<Longrightarrow> list_all2 ?P1.0 xs ?bs
 3. \<lbrakk>order r; list_all2 (\<lambda>x. lesub x r) xs ys; list_all2 (\<lambda>x. lesub x r) ys zs\<rbrakk> \<Longrightarrow> list_all2 ?P2.0 ?bs zs
[PROOF STEP]
apply (erule order_trans)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>a b c. \<lbrakk>list_all2 (\<lambda>x. lesub x r) xs ys; list_all2 (\<lambda>x. lesub x r) ys zs; ?P1.0 a b; ?P2.0 b c\<rbrakk> \<Longrightarrow> a \<sqsubseteq>\<^bsub>r\<^esub> ?y4 a b c
 2. \<And>a b c. \<lbrakk>list_all2 (\<lambda>x. lesub x r) xs ys; list_all2 (\<lambda>x. lesub x r) ys zs; ?P1.0 a b; ?P2.0 b c\<rbrakk> \<Longrightarrow> ?y4 a b c \<sqsubseteq>\<^bsub>r\<^esub> c
 3. \<lbrakk>order r; list_all2 (\<lambda>x. lesub x r) xs ys; list_all2 (\<lambda>x. lesub x r) ys zs\<rbrakk> \<Longrightarrow> list_all2 ?P1.0 xs ?bs
 4. \<lbrakk>order r; list_all2 (\<lambda>x. lesub x r) xs ys; list_all2 (\<lambda>x. lesub x r) ys zs\<rbrakk> \<Longrightarrow> list_all2 ?P2.0 ?bs zs
[PROOF STEP]
apply assumption+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gcd_poly_pseudo_mod:
  fixes p q :: "'a :: {factorial_ring_gcd,semiring_gcd_mult_normalize} poly"
  assumes nz: "q \<noteq> 0" and prim: "content p = 1" "content q = 1"
  shows   "gcd p q = gcd q (primitive_part (pseudo_mod p q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
define r s where "r = fst (pseudo_divmod p q)" and "s = snd (pseudo_divmod p q)"
[PROOF STATE]
proof (state)
this:
r = fst (pseudo_divmod p q)
s = snd (pseudo_divmod p q)

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
define a where "a = [:coeff q (degree q) ^ (Suc (degree p) - degree q):]"
[PROOF STATE]
proof (state)
this:
a = [:lead_coeff q ^ (Suc (degree p) - degree q):]

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
have [simp]: "primitive_part a = unit_factor a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part a = unit_factor a
[PROOF STEP]
by (simp add: a_def unit_factor_poly_def unit_factor_power monom_0)
[PROOF STATE]
proof (state)
this:
primitive_part a = unit_factor a

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
from nz
[PROOF STATE]
proof (chain)
picking this:
q \<noteq> 0
[PROOF STEP]
have [simp]: "a \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0

goal (1 subgoal):
 1. a \<noteq> 0
[PROOF STEP]
by (auto simp: a_def)
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
have rs: "pseudo_divmod p q = (r, s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pseudo_divmod p q = (r, s)
[PROOF STEP]
by (simp add: r_def s_def)
[PROOF STATE]
proof (state)
this:
pseudo_divmod p q = (r, s)

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
have "gcd (q * r + s) q = gcd q s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (q * r + s) q = gcd q s
[PROOF STEP]
using gcd_add_mult[of q r s]
[PROOF STATE]
proof (prove)
using this:
gcd q (r * q + s) = gcd q s

goal (1 subgoal):
 1. gcd (q * r + s) q = gcd q s
[PROOF STEP]
by (simp add: gcd.commute add_ac mult_ac)
[PROOF STATE]
proof (state)
this:
gcd (q * r + s) q = gcd q s

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
with pseudo_divmod(1)[OF nz rs]
[PROOF STATE]
proof (chain)
picking this:
smult (lead_coeff q ^ (Suc (degree p) - degree q)) p = q * r + s
gcd (q * r + s) q = gcd q s
[PROOF STEP]
have "gcd (p * a) q = gcd q s"
[PROOF STATE]
proof (prove)
using this:
smult (lead_coeff q ^ (Suc (degree p) - degree q)) p = q * r + s
gcd (q * r + s) q = gcd q s

goal (1 subgoal):
 1. gcd (p * a) q = gcd q s
[PROOF STEP]
by (simp add: a_def)
[PROOF STATE]
proof (state)
this:
gcd (p * a) q = gcd q s

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd (p * a) q = gcd q s

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
from prim
[PROOF STATE]
proof (chain)
picking this:
content p = (1::'a)
content q = (1::'a)
[PROOF STEP]
have "gcd (p * a) q = gcd p q"
[PROOF STATE]
proof (prove)
using this:
content p = (1::'a)
content q = (1::'a)

goal (1 subgoal):
 1. gcd (p * a) q = gcd p q
[PROOF STEP]
by (subst gcd_poly_decompose)
       (auto simp: primitive_part_mult gcd_mult_unit1 primitive_part_prim
             simp del: mult_pCons_right )
[PROOF STATE]
proof (state)
this:
gcd (p * a) q = gcd p q

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd (p * a) q = gcd p q

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
from prim
[PROOF STATE]
proof (chain)
picking this:
content p = (1::'a)
content q = (1::'a)
[PROOF STEP]
have "gcd q s = gcd q (primitive_part s)"
[PROOF STATE]
proof (prove)
using this:
content p = (1::'a)
content q = (1::'a)

goal (1 subgoal):
 1. gcd q s = gcd q (primitive_part s)
[PROOF STEP]
by (subst gcd_poly_decompose) (simp_all add: primitive_part_prim)
[PROOF STATE]
proof (state)
this:
gcd q s = gcd q (primitive_part s)

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd q s = gcd q (primitive_part s)

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
have "s = pseudo_mod p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s = pseudo_mod p q
[PROOF STEP]
by (simp add: s_def pseudo_mod_def)
[PROOF STATE]
proof (state)
this:
s = pseudo_mod p q

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gcd p q = gcd q (primitive_part (pseudo_mod p q))

goal (1 subgoal):
 1. gcd p q = gcd q (primitive_part (pseudo_mod p q))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
gcd p q = gcd q (primitive_part (pseudo_mod p q))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sift_up_step_aux2:
  fixes heap::"int \<Rightarrow> int"
  assumes
    "is_heap_except_up (\<le>) heap l r x"
    "parent l x \<ge> l"
    "heap x \<le> (heap (parent l x))"
    "bounded l r k"
    "parent l k = parent l x"
    "bounded l r (parent l (parent l k))"
  shows
    "swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_heap_except_up (\<le>) heap l r x
l \<le> parent l x
heap x \<le> heap (parent l x)
bounded l r k
parent l k = parent l x
bounded l r (parent l (parent l k))

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
unfolding is_heap_except_up_def
[PROOF STATE]
proof (prove)
using this:
\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa)
l \<le> parent l x
heap x \<le> heap (parent l x)
bounded l r k
parent l k = parent l x
bounded l r (parent l (parent l k))

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k))\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
let ?gp_k = "parent l (parent l k)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k))\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
let ?gp_x = "parent l (parent l x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k))\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
have gp_k_eq_gp_x: "swap heap (parent l x) x ?gp_k = heap ?gp_x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) = heap (parent l (parent l x))
[PROOF STEP]
by (metis assms(2,5) grand_parent_upper_bound less_irrefl swap_only_swaps)
[PROOF STATE]
proof (state)
this:
swap heap (parent l x) x (parent l (parent l k)) = heap (parent l (parent l x))

goal (1 subgoal):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k))\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_heap_except_up (\<le>) heap l r x
l \<le> parent l x
heap x \<le> heap (parent l x)
bounded l r k
parent l k = parent l x
bounded l r (parent l (parent l k))

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
unfolding is_heap_except_up_def
[PROOF STATE]
proof (prove)
using this:
\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa)
l \<le> parent l x
heap x \<le> heap (parent l x)
bounded l r k
parent l k = parent l x
bounded l r (parent l (parent l k))

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
proof(cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); ?P6\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
 2. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); \<not> ?P6\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
assume k_eq_x: "k = x"
[PROOF STATE]
proof (state)
this:
k = x

goal (2 subgoals):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); ?P6\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
 2. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); \<not> ?P6\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
have "swap heap (parent l x) x k = heap (parent l x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swap heap (parent l x) x k = heap (parent l x)
[PROOF STEP]
by (metis k_eq_x swap_swaps)
[PROOF STATE]
proof (state)
this:
swap heap (parent l x) x k = heap (parent l x)

goal (2 subgoals):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); ?P6\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
 2. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); \<not> ?P6\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
swap heap (parent l x) x k = heap (parent l x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
swap heap (parent l x) x k = heap (parent l x)

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
using assms(1,2,4,6)
[PROOF STATE]
proof (prove)
using this:
swap heap (parent l x) x k = heap (parent l x)
is_heap_except_up (\<le>) heap l r x
l \<le> parent l x
bounded l r k
bounded l r (parent l (parent l k))

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
unfolding is_heap_except_up_def
[PROOF STATE]
proof (prove)
using this:
swap heap (parent l x) x k = heap (parent l x)
\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa)
l \<le> parent l x
bounded l r k
bounded l r (parent l (parent l k))

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
by (metis gp_k_eq_gp_x k_eq_x parent_bounds parent_lower_bound)
[PROOF STATE]
proof (state)
this:
swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k

goal (1 subgoal):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); k \<noteq> x\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); k \<noteq> x\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
assume k_neq_x: "k \<noteq> x"
[PROOF STATE]
proof (state)
this:
k \<noteq> x

goal (1 subgoal):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); k \<noteq> x\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
have "swap heap (parent l x) x k = heap k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swap heap (parent l x) x k = heap k
[PROOF STEP]
by (metis assms(5) gp_k_eq_gp_x k_neq_x swap_only_swaps)
[PROOF STATE]
proof (state)
this:
swap heap (parent l x) x k = heap k

goal (1 subgoal):
 1. \<lbrakk>\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa); l \<le> parent l x; heap x \<le> heap (parent l x); bounded l r k; parent l k = parent l x; bounded l r (parent l (parent l k)); k \<noteq> x\<rbrakk> \<Longrightarrow> swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
swap heap (parent l x) x k = heap k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
swap heap (parent l x) x k = heap k

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
swap heap (parent l x) x k = heap k
is_heap_except_up (\<le>) heap l r x
l \<le> parent l x
heap x \<le> heap (parent l x)
bounded l r k
parent l k = parent l x
bounded l r (parent l (parent l k))

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
unfolding is_heap_except_up_def
[PROOF STATE]
proof (prove)
using this:
swap heap (parent l x) x k = heap k
\<forall>xa. bounded l r xa \<longrightarrow> (xa \<noteq> x \<longrightarrow> bounded l r (parent l xa) \<longrightarrow> heap (parent l xa) \<le> heap xa) \<and> (parent l xa = x \<longrightarrow> bounded l r (parent l (parent l xa)) \<longrightarrow> heap (parent l (parent l xa)) \<le> heap xa)
l \<le> parent l x
heap x \<le> heap (parent l x)
bounded l r k
parent l k = parent l x
bounded l r (parent l (parent l k))

goal (1 subgoal):
 1. swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k
[PROOF STEP]
by (metis gp_k_eq_gp_x k_neq_x order_trans parent_bounds parent_lower_bound)
[PROOF STATE]
proof (state)
this:
swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
swap heap (parent l x) x (parent l (parent l k)) \<le> swap heap (parent l x) x k

goal:
No subgoals!
[PROOF STEP]
qed