[STATEMENT]
lemma (in is_functor) op_cf_obj_comma_is_functor:
  assumes "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
  shows "op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)
[PROOF STEP]
by (rule is_iso_functorD(1)[OF op_cf_obj_comma_is_iso_functor[OF assms]])


[STATEMENT]
lemma convergent_limsup_cl:
  fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
  shows "convergent X \<Longrightarrow> limsup X = lim X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent X \<Longrightarrow> limsup X = lim X
[PROOF STEP]
by (auto simp: convergent_def limI lim_imp_Limsup)


[STATEMENT]
lemma (in Module) sc_r_distr:"\<lbrakk>a \<in> carrier R; m \<in> carrier M; n \<in> carrier M\<rbrakk> \<Longrightarrow>
                 a \<cdot>\<^sub>s (m \<plusminus> n) = a \<cdot>\<^sub>s m \<plusminus>  a \<cdot>\<^sub>s n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; m \<in> carrier M; n \<in> carrier M\<rbrakk> \<Longrightarrow> a \<cdot>\<^sub>s (m \<plusminus> n) = a \<cdot>\<^sub>s m \<plusminus> a \<cdot>\<^sub>s n
[PROOF STEP]
apply (simp add:sprod_r_distr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma det3_self23[simp]: "det3 a b b = 0"
  and det3_self12[simp]: "det3 b b a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det3 a b b = 0 &&& det3 b b a = 0
[PROOF STEP]
by (auto simp: det3_def')


[STATEMENT]
lemma c_IKKBZ_eq_c_list_cout_hlist:
  fixes f cf t
  defines "h \<equiv> (\<lambda>xs x. (list_sel_aux' f xs x) * cf x)"
  defines "xs \<equiv> revorder t"
  assumes "distinct_relations t"
      and "reasonable_cards cf f t"
      and "left_deep t"
  shows "c_IKKBZ (\<lambda>a b. ldeep_s f xs a * b) cf f t
        = c_list (ldeep_s f xs) cf (create_h_list h xs) (first_node t) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_IKKBZ (\<lambda>a. (*) (ldeep_s f xs a)) cf f t = c_list (ldeep_s f xs) cf (create_h_list h xs) (first_node t) xs
[PROOF STEP]
using assms c_IKKBZ_eq_c_list ldeep_s_h_eq_create_h_list'''[OF assms(3)]
[PROOF STATE]
proof (prove)
using this:
h \<equiv> \<lambda>xs x. list_sel_aux' f xs x * cf x
xs \<equiv> revorder t
distinct_relations t
reasonable_cards cf f t
left_deep t
\<lbrakk>distinct_relations ?t; reasonable_cards ?cf ?f ?t; left_deep ?t; \<forall>x\<in>relations ?t. ?h1.0 x (?cf x) = ?h2.0 x\<rbrakk> \<Longrightarrow> c_IKKBZ ?h1.0 ?cf ?f ?t = c_list (ldeep_s ?f (revorder ?t)) ?cf ?h2.0 (first_node ?t) (revorder ?t)
?x \<in> relations t \<Longrightarrow> ldeep_s ?f (revorder t) ?x * ?cf ?x = create_h_list (\<lambda>xs x. list_sel_aux' ?f xs x * ?cf x) (revorder t) ?x

goal (1 subgoal):
 1. c_IKKBZ (\<lambda>a. (*) (ldeep_s f xs a)) cf f t = c_list (ldeep_s f xs) cf (create_h_list h xs) (first_node t) xs
[PROOF STEP]
by fastforce


[STATEMENT]
lemma invimage_vunion_right: "r -`\<^sub>\<circ> (A \<union>\<^sub>\<circ> B) = r -`\<^sub>\<circ> A \<union>\<^sub>\<circ> r -`\<^sub>\<circ> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r -`\<^sub>\<circ> (A \<union>\<^sub>\<circ> B) = r -`\<^sub>\<circ> A \<union>\<^sub>\<circ> r -`\<^sub>\<circ> B
[PROOF STEP]
by (auto intro!: vsubset_antisym)


[STATEMENT]
lemma axxbyy: "a + m + m = b + n + n \<Longrightarrow> a = 0 \<or> a = 1 \<Longrightarrow> b = 0 \<or> b = 1 \<Longrightarrow> a = b \<and> m = n"
  for a b m n :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a + m + m = b + n + n; a = 0 \<or> a = 1; b = 0 \<or> b = 1\<rbrakk> \<Longrightarrow> a = b \<and> m = n
[PROOF STEP]
by arith


[STATEMENT]
lemma Zfun_norm_iff: "Zfun (\<lambda>x. norm (f x)) F = Zfun (\<lambda>x. f x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Zfun (\<lambda>x. norm (f x)) F = Zfun f F
[PROOF STEP]
unfolding Zfun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>r>0. \<forall>\<^sub>F x in F. norm (norm (f x)) < r) = (\<forall>r>0. \<forall>\<^sub>F x in F. norm (f x) < r)
[PROOF STEP]
by simp


[STATEMENT]
lemma divmod_integer_code [code]: \<^marker>\<open>contributor \<open>Ren? Thiemann\<close>\<close> \<^marker>\<open>contributor \<open>Akihisa Yamada\<close>\<close>
  "divmod_integer k l =
   (if k = 0 then (0, 0)
    else if l > 0 then
            (if k > 0 then Code_Numeral.divmod_abs k l
             else case Code_Numeral.divmod_abs k l of (r, s) \<Rightarrow>
                  if s = 0 then (- r, 0) else (- r - 1, l - s))
    else if l = 0 then (0, k)
    else apsnd uminus
            (if k < 0 then Code_Numeral.divmod_abs k l
             else case Code_Numeral.divmod_abs k l of (r, s) \<Rightarrow>
                  if s = 0 then (- r, 0) else (- r - 1, - l - s)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divmod_integer k l = (if k = 0 then (0, 0) else if 0 < l then if 0 < k then divmod_abs k l else case divmod_abs k l of (r, s) \<Rightarrow> if s = 0 then (- r, 0) else (- r - 1, l - s) else if l = 0 then (0, k) else apsnd uminus (if k < 0 then divmod_abs k l else case divmod_abs k l of (r, s) \<Rightarrow> if s = 0 then (- r, 0) else (- r - 1, - l - s)))
[PROOF STEP]
by (cases l "0 :: integer" rule: linorder_cases)
    (auto split: prod.splits simp add: divmod_integer_eq_cases)


[STATEMENT]
lemma fls_integral_const:
  fixes x :: "'a::division_ring"
  shows "fls_integral (fls_const x) = fls_const x * fls_X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_integral (fls_const x) = fls_const x * fls_X
[PROOF STEP]
by    (rule fls_integral_const'[OF inverse_1])


[STATEMENT]
lemma open_einterval[simp]: "open (einterval a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (einterval a b)
[PROOF STEP]
by (cases a b rule: ereal2_cases)
     (auto simp: einterval_def intro!: open_Collect_conj open_Collect_less continuous_intros)


[STATEMENT]
lemma lm045:
  "(\<forall>l \<in> set (g1 G). set (g2 l N) = f2 (set l) N) -->
     {f2 P N| P. P \<in> set (map set (g1 G))} = set [set (g2 l N). l <- g1 G]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>l\<in>set (g1 G). set (g2 l N) = f2 (set l) N) \<longrightarrow> {f2 P N |P. P \<in> set (map set (g1 G))} = set (map (\<lambda>l. set (g2 l N)) (g1 G))
[PROOF STEP]
by auto


[STATEMENT]
lemma vector_space_on_alt_def: "vector_space_on U\<^sub>V\<^sub>S = module_on U\<^sub>V\<^sub>S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_space_on U\<^sub>V\<^sub>S = module_on U\<^sub>V\<^sub>S
[PROOF STEP]
unfolding vector_space_on_def module_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>scale. ((\<forall>x y a. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> y \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale a (x + y) = scale a x + scale a y) \<and> (\<forall>x a b. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale (a + b) x = scale a x + scale b x) \<and> (\<forall>x a b. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale a (scale b x) = scale (a * b) x)) \<and> ((\<forall>x. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale (1::'a) x = x) \<and> (\<forall>x y. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> y \<in> U\<^sub>V\<^sub>S \<longrightarrow> x + y \<in> U\<^sub>V\<^sub>S)) \<and> (0::'b) \<in> U\<^sub>V\<^sub>S \<and> (\<forall>x a. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale a x \<in> U\<^sub>V\<^sub>S)) = (\<lambda>scale. ((\<forall>x y a. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> y \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale a (x + y) = scale a x + scale a y) \<and> (\<forall>x a b. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale (a + b) x = scale a x + scale b x) \<and> (\<forall>x a b. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale a (scale b x) = scale (a * b) x)) \<and> ((\<forall>x. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale (1::'a) x = x) \<and> (\<forall>x y. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> y \<in> U\<^sub>V\<^sub>S \<longrightarrow> x + y \<in> U\<^sub>V\<^sub>S)) \<and> (0::'b) \<in> U\<^sub>V\<^sub>S \<and> (\<forall>x a. x \<in> U\<^sub>V\<^sub>S \<longrightarrow> scale a x \<in> U\<^sub>V\<^sub>S))
[PROOF STEP]
by auto


[STATEMENT]
lemma lower_plus: "lower (p + q) v = lower p v + lower q v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower (p + q) v = lower p v + lower q v
[PROOF STEP]
by (rule poly_mapping_eqI, simp add: lookup_add lookup_lower)


[STATEMENT]
lemma ID_app: \<comment> \<open>Tag app first\<close>
  "\<lbrakk> INDEP I1; ID_OP x x' I1; ID_OP f f' (I1\<rightarrow>\<^sub>iI2) \<rbrakk>
  \<Longrightarrow> ID_OP (f$x) (f'$x') I2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>INDEP I1; ID_OP x x' I1; ID_OP f f' (I1 \<rightarrow>\<^sub>i I2)\<rbrakk> \<Longrightarrow> ID_OP (f $ x) (f' $ x') I2
[PROOF STEP]
by simp


[STATEMENT]
lemma cong_mid2__cong:
  assumes "M Midpoint A B" and
    "M' Midpoint A' B'" and
    "Cong A M A' M'"
  shows "Cong A B A' B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cong A B A' B'
[PROOF STEP]
by (meson assms(1) assms(2) assms(3) cong_inner_transitivity l2_11_b midpoint_bet midpoint_cong)


[STATEMENT]
lemma fmlookup_image_iff: "y |\<in>| fmimage m A \<longleftrightarrow> (\<exists>x. fmlookup m x = Some y \<and> x |\<in>| A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y |\<in>| fmimage m A) = (\<exists>x. fmlookup m x = Some y \<and> x |\<in>| A)
[PROOF STEP]
by transfer' (auto simp: ran_def)


[STATEMENT]
lemma insertl_replicate: "m \<le> n \<Longrightarrow>
  insertl m x (replicate n x) = x # replicate n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> insertl m x (replicate n x) = x # replicate n x
[PROOF STEP]
apply (induct n arbitrary: m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. m \<le> 0 \<Longrightarrow> insertl m x (replicate 0 x) = x # replicate 0 x
 2. \<And>n m. \<lbrakk>\<And>m. m \<le> n \<Longrightarrow> insertl m x (replicate n x) = x # replicate n x; m \<le> Suc n\<rbrakk> \<Longrightarrow> insertl m x (replicate (Suc n) x) = x # replicate (Suc n) x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. m \<le> n \<Longrightarrow> insertl m x (replicate n x) = x # replicate n x; m \<le> Suc n\<rbrakk> \<Longrightarrow> insertl m x (replicate (Suc n) x) = x # replicate (Suc n) x
[PROOF STEP]
apply (case_tac m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n m. \<lbrakk>\<And>m. m \<le> n \<Longrightarrow> insertl m x (replicate n x) = x # replicate n x; m \<le> Suc n; m = 0\<rbrakk> \<Longrightarrow> insertl m x (replicate (Suc n) x) = x # replicate (Suc n) x
 2. \<And>n m nat. \<lbrakk>\<And>m. m \<le> n \<Longrightarrow> insertl m x (replicate n x) = x # replicate n x; m \<le> Suc n; m = Suc nat\<rbrakk> \<Longrightarrow> insertl m x (replicate (Suc n) x) = x # replicate (Suc n) x
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma finite_UNION_then_finite:
  "finite (\<Union>(B ` A)) \<Longrightarrow> a \<in> A \<Longrightarrow> finite (B a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (\<Union> (B ` A)); a \<in> A\<rbrakk> \<Longrightarrow> finite (B a)
[PROOF STEP]
by (metis Set.set_insert UN_insert Un_infinite)


[STATEMENT]
lemma idiff_iless_mono2: "\<lbrakk> m < (n::enat); m < l \<rbrakk> \<Longrightarrow> l - n \<le> l - m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m < n; m < l\<rbrakk> \<Longrightarrow> l - n \<le> l - m
[PROOF STEP]
by (case_tac m, case_tac n, case_tac l, simp_all, case_tac l, simp_all)


[STATEMENT]
lemma utility_less_iff:
  "x \<in> carrier \<Longrightarrow> y \<in> carrier \<Longrightarrow> u x < u y \<longleftrightarrow> x \<prec>[le] y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier; y \<in> carrier\<rbrakk> \<Longrightarrow> (u x < u y) = x \<prec>[le] y
[PROOF STEP]
using utility_le_iff[of x y] utility_le_iff[of y x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<in> carrier; y \<in> carrier\<rbrakk> \<Longrightarrow> (u x \<le> u y) = le x y
\<lbrakk>y \<in> carrier; x \<in> carrier\<rbrakk> \<Longrightarrow> (u y \<le> u x) = le y x

goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier; y \<in> carrier\<rbrakk> \<Longrightarrow> (u x < u y) = x \<prec>[le] y
[PROOF STEP]
by (auto simp: strongly_preferred_def)


[STATEMENT]
lemma degree_qr_poly:
  "degree (qr_poly :: 'a :: qr_spec mod_ring poly) = deg_qr (TYPE('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree qr_poly = deg_qr TYPE('a)
[PROOF STEP]
unfolding qr_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (of_int_poly (qr_poly' TYPE('a))) = deg_qr TYPE('a)
[PROOF STEP]
using not_dvd_lead_coeff_qr_poly'[where ?'a = 'a]
[PROOF STATE]
proof (prove)
using this:
\<not> int CARD('a) dvd lead_coeff (qr_poly' TYPE('a))

goal (1 subgoal):
 1. degree (of_int_poly (qr_poly' TYPE('a))) = deg_qr TYPE('a)
[PROOF STEP]
by (subst degree_of_int_poly')
     (auto simp: of_int_mod_ring_eq_0_iff degree_qr_poly')


[STATEMENT]
lemma (in Group) i_m_closed:"\<lbrakk>a \<in> carrier G ; b \<in> carrier G\<rbrakk> \<Longrightarrow>
              (\<rho> a) \<cdot> b \<in> carrier G "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier G; b \<in> carrier G\<rbrakk> \<Longrightarrow> \<rho> a \<cdot> b \<in> carrier G
[PROOF STEP]
by (rule mult_closed,
       simp add:i_closed, assumption)


[STATEMENT]
lemma uMult_commute: "x *\<^sub># y = y *\<^sub># x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x *\<^sub># y = y *\<^sub># x
[PROOF STEP]
unfolding uMult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Lambda> x y. Discr (undiscr x * undiscr y))\<cdot>x\<cdot>y = (\<Lambda> x y. Discr (undiscr x * undiscr y))\<cdot>y\<cdot>x
[PROOF STEP]
by simp


[STATEMENT]
lemma valofn_ge_0: "0 \<le> valofn x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> valofn x
[PROOF STEP]
unfolding valofn_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 2 ^ IEEE.exponent x / 2 ^ bias TYPE(('a, 'b) IEEE.float) * (1 + real (fraction x) / 2 ^ LENGTH('b))
[PROOF STEP]
by simp


[STATEMENT]
lemma fset_both_sides: "(Abs_fset s = f) = (fset (Abs_fset s) = fset f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Abs_fset s = f) = (fset (Abs_fset s) = fset f)
[PROOF STEP]
by (simp add: fset_inject)


[STATEMENT]
lemma vint_vsubset_vreal: "\<int>\<^sub>\<circ> \<subseteq>\<^sub>\<circ> \<real>\<^sub>\<circ>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<int>\<^sub>\<circ> \<subseteq>\<^sub>\<circ> \<real>\<^sub>\<circ>
[PROOF STEP]
unfolding vint_def vint_of_int_def vreal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZFC_in_HOL.set (range (\<lambda>x. (real_of_int x)\<^sub>\<real>)) \<subseteq>\<^sub>\<circ> ZFC_in_HOL.set (range vreal_of_real)
[PROOF STEP]
using image_cong
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?M = ?N; \<And>x. x \<in> ?N \<Longrightarrow> ?f x = ?g x\<rbrakk> \<Longrightarrow> ?f ` ?M = ?g ` ?N

goal (1 subgoal):
 1. ZFC_in_HOL.set (range (\<lambda>x. (real_of_int x)\<^sub>\<real>)) \<subseteq>\<^sub>\<circ> ZFC_in_HOL.set (range vreal_of_real)
[PROOF STEP]
by auto


[STATEMENT]
lemma Ord_is_Transset: "Ord i \<Longrightarrow> Transset i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord i \<Longrightarrow> Transset i
[PROOF STEP]
by (simp add: Ord_def)


[STATEMENT]
lemma test_mult_glbI:  "test p \<Longrightarrow> test q \<Longrightarrow> test r \<Longrightarrow> p \<le> q \<Longrightarrow> p \<le> r \<Longrightarrow> p \<le> q \<cdot> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>test p; test q; test r; p \<le> q; p \<le> r\<rbrakk> \<Longrightarrow> p \<le> q \<cdot> r
[PROOF STEP]
by (metis (no_types) local.mult_isor test_leq_mult_def_var)


[STATEMENT]
lemma JN_Join_miniscope:
     "i \<in> I ==> (\<Squnion>i \<in> I. F i\<squnion>G) = ((\<Squnion>i \<in> I. F i)\<squnion>G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> (\<Squnion>i\<in>I. F i \<squnion> G) = JOIN I F \<squnion> G
[PROOF STEP]
by (auto simp add: JN_Join_distrib JN_constant)


[STATEMENT]
theorem wls_vsubstEnv_compose1:
assumes "wlsEnv rho"
shows "((rho &[y1 // y]_ys) &[y2 // y]_ys) = (rho &[(y1 @ys[y2 / y]_ys) // y]_ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[y1 // y]_ys &[y2 // y]_ys = rho &[y1 @ys[y2 / y]_ys // y]_ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho

goal (1 subgoal):
 1. rho &[y1 // y]_ys &[y2 // y]_ys = rho &[y1 @ys[y2 / y]_ys // y]_ys
[PROOF STEP]
by(simp add: vsubstEnv_compose1)


[STATEMENT]
lemma hm_exch_op_\<alpha>_correct: "hm_exch_op hm i j \<le>\<^sub>n SPEC (\<lambda>hm'.
      hm_valid hm i \<and> hm_valid hm j \<and> hm'=hm_exch hm i j
      )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hm_exch_op hm i j \<le>\<^sub>n SPEC (\<lambda>hm'. hm_valid hm i \<and> hm_valid hm j \<and> hm' = hm_exch hm i j)
[PROOF STEP]
unfolding hm_exch_op_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case hm of (pq, m) \<Rightarrow> \<lambda>i j. ASSERT (hm_valid (pq, m) i) \<bind> (\<lambda>_. ASSERT (hm_valid (pq, m) j) \<bind> (\<lambda>_. ASSERT (hmr_invar (pq, m)) \<bind> (\<lambda>_. mop_list_swap pq (i - 1) (j - 1) \<bind> (\<lambda>pq. RETURN (pq, m)))))) i j \<le>\<^sub>n SPEC (\<lambda>hm'. hm_valid hm i \<and> hm_valid hm j \<and> hm' = hm_exch hm i j)
[PROOF STEP]
apply refine_vcg
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x1 x2. \<lbrakk>hm = (x1, x2); hm_valid (x1, x2) i; hm_valid (x1, x2) j; hmr_invar (x1, x2); i - 1 < length x1 \<and> j - 1 < length x1\<rbrakk> \<Longrightarrow> hm_valid hm i
 2. \<And>x1 x2. \<lbrakk>hm = (x1, x2); hm_valid (x1, x2) i; hm_valid (x1, x2) j; hmr_invar (x1, x2); i - 1 < length x1 \<and> j - 1 < length x1\<rbrakk> \<Longrightarrow> hm_valid hm j
 3. \<And>x1 x2. \<lbrakk>hm = (x1, x2); hm_valid (x1, x2) i; hm_valid (x1, x2) j; hmr_invar (x1, x2); i - 1 < length x1 \<and> j - 1 < length x1\<rbrakk> \<Longrightarrow> (swap x1 (i - 1) (j - 1), x2) = hm_exch hm i j
[PROOF STEP]
apply (vc_solve simp: hm_valid_def hm_length_def heapmap_\<alpha>_def solve: asm_rl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>hm = (x1, x2); hmr_invar (x1, x2); 0 < i; i \<le> length x1; 0 < j; j \<le> length x1; i - Suc 0 < length x1; j - Suc 0 < length x1\<rbrakk> \<Longrightarrow> (swap x1 (i - Suc 0) (j - Suc 0), x2) = hm_exch (x1, x2) i j
[PROOF STEP]
apply (auto simp add: hm_key_of_def hm_exch_def swap_def) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma emeasure_cond_spmf:
  "emeasure (measure_spmf (cond_spmf p A)) B = emeasure (measure_spmf p) (A \<inter> B) / emeasure (measure_spmf p) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_spmf (cond_spmf p A)) B = emeasure (measure_spmf p) (A \<inter> B) / emeasure (measure_spmf p) A
[PROOF STEP]
apply(clarsimp simp add: cond_spmf_def emeasure_measure_spmf_conv_measure_pmf emeasure_measure_pmf_zero_iff set_pmf_Int_Some split!: if_split)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set_spmf p \<inter> A = {} \<Longrightarrow> set_spmf p \<inter> (A \<inter> B) = {}
 2. \<And>x. \<lbrakk>emeasure (measure_pmf (cond_pmf p (Some ` A))) (Some ` B) \<noteq> emeasure (measure_pmf p) (Some ` (A \<inter> B)) / emeasure (measure_pmf p) (Some ` A); x \<in> set_spmf p; x \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>emeasure (measure_pmf (cond_pmf p (Some ` A))) (Some ` B) \<noteq> emeasure (measure_pmf p) (Some ` (A \<inter> B)) / emeasure (measure_pmf p) (Some ` A); x \<in> set_spmf p; x \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply(subst (asm) emeasure_cond_pmf)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x \<in> set_spmf p; x \<in> A\<rbrakk> \<Longrightarrow> set_pmf p \<inter> Some ` A \<noteq> {}
 2. \<And>x. \<lbrakk>emeasure (measure_pmf p) (Some ` A \<inter> Some ` B) / emeasure (measure_pmf p) (Some ` A) \<noteq> emeasure (measure_pmf p) (Some ` (A \<inter> B)) / emeasure (measure_pmf p) (Some ` A); x \<in> set_spmf p; x \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by(auto simp add: set_pmf_Int_Some image_Int)


[STATEMENT]
lemma fixed_degree_in_varI:
  assumes "m \<in> monomials_of R P"
  assumes "count m i = n"
  shows "m \<in> fixed_degree_in_var R P i n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<in> fixed_degree_in_var R P i n
[PROOF STEP]
unfolding fixed_degree_in_var_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<in> {m \<in> monomials_of R P. count m i = n}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m \<in> monomials_of R P
count m i = n

goal (1 subgoal):
 1. m \<in> {m \<in> monomials_of R P. count m i = n}
[PROOF STEP]
by blast


[STATEMENT]
lemma of_int_poly_0 [simp]: "of_int_poly 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly 0 = 0
[PROOF STEP]
by transfer (simp add: fun_eq_iff)


[STATEMENT]
lemma mult_vars_rep:
  assumes "as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "i < n"
  assumes "j < n"
  shows "mult_vars i j as = Qp_ev ((pvar Q\<^sub>p i) \<otimes>\<^bsub>Q\<^sub>p[\<X>\<^bsub>n\<^esub>]\<^esub> (pvar Q\<^sub>p j)) as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult_vars i j as = eval_at_point Q\<^sub>p as (pvar Q\<^sub>p i \<otimes>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> pvar Q\<^sub>p j)
[PROOF STEP]
unfolding mult_vars_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. as ! i \<otimes> as ! j = eval_at_point Q\<^sub>p as (pvar Q\<^sub>p i \<otimes>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> pvar Q\<^sub>p j)
[PROOF STEP]
using assms eval_at_point_mult[of as n "pvar Q\<^sub>p i" "pvar Q\<^sub>p j"]
        eval_pvar[of i n as] eval_pvar[of j n as ]
[PROOF STATE]
proof (prove)
using this:
as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
i < n
j < n
\<lbrakk>as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>); pvar Q\<^sub>p i \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>]); pvar Q\<^sub>p j \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])\<rbrakk> \<Longrightarrow> eval_at_point Q\<^sub>p as (pvar Q\<^sub>p i \<otimes>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> pvar Q\<^sub>p j) = eval_at_point Q\<^sub>p as (pvar Q\<^sub>p i) \<otimes> eval_at_point Q\<^sub>p as (pvar Q\<^sub>p j)
\<lbrakk>i < n; as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> eval_at_point Q\<^sub>p as (pvar Q\<^sub>p i) = as ! i
\<lbrakk>j < n; as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> eval_at_point Q\<^sub>p as (pvar Q\<^sub>p j) = as ! j

goal (1 subgoal):
 1. as ! i \<otimes> as ! j = eval_at_point Q\<^sub>p as (pvar Q\<^sub>p i \<otimes>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> pvar Q\<^sub>p j)
[PROOF STEP]
by (metis pvar_closed)


[STATEMENT]
lemma Im4_tendsto_upperbound:
   "\<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im4 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im4 limit \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im4 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im4 limit \<le> b
[PROOF STEP]
by (blast intro: tendsto_upperbound [OF tendsto_Im4])


[STATEMENT]
lemma sup_le_union [simp]: "a \<le> b \<Longrightarrow> supremum (A \<union> {a, b}) = supremum (A \<union> {b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> supremum (A \<union> {a, b}) = supremum (A \<union> {b})
[PROOF STEP]
apply (simp add: supremum_def upper_bound_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> {aa. a \<le> aa \<and> b \<le> aa \<and> (\<forall>x\<in>A. x \<le> aa) \<and> (\<forall>x. a \<le> x \<and> b \<le> x \<and> (\<forall>xa\<in>A. xa \<le> x) \<longrightarrow> aa \<le> x)} = {a. b \<le> a \<and> (\<forall>x\<in>A. x \<le> a) \<and> (\<forall>x. b \<le> x \<and> (\<forall>xa\<in>A. xa \<le> x) \<longrightarrow> a \<le> x)}
[PROOF STEP]
by auto


[STATEMENT]
lemma us_bij: "bij (us::'a::order_with_dual \<Rightarrow> 'a upset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij us
[PROOF STEP]
by (simp add: bij_def us_surj us_inj)