[STATEMENT]
lemma bind_pmf_aux_code_aux:
  assumes "finite A"
  shows   "bind_pmf_aux p f A =
             fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x))
               (mapping_of_pmf (f x))) A" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bind_pmf_aux p f A = fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A
[PROOF STEP]
proof (intro mapping_eqI'[where d = 0])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
assume "x \<in> Mapping.keys ?lhs"
[PROOF STATE]
proof (state)
this:
x \<in> Mapping.keys (bind_pmf_aux p f A)

goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> Mapping.keys (bind_pmf_aux p f A)
[PROOF STEP]
obtain y where y: "y \<in> A" "x \<in> set_pmf (f y)"
[PROOF STATE]
proof (prove)
using this:
x \<in> Mapping.keys (bind_pmf_aux p f A)

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> A; x \<in> set_pmf (f y)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> A
x \<in> set_pmf (f y)

goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
hence "Mapping.lookup_default 0 ?lhs x =
           measure_pmf.expectation p (\<lambda>y. indicator A y * pmf (f y) x)"
[PROOF STATE]
proof (prove)
using this:
y \<in> A
x \<in> set_pmf (f y)

goal (1 subgoal):
 1. Mapping.lookup_default 0 (bind_pmf_aux p f A) x = measure_pmf.expectation p (\<lambda>y. indicat_real A y * pmf (f y) x)
[PROOF STEP]
by (auto simp: lookup_default_bind_pmf_aux)
[PROOF STATE]
proof (state)
this:
Mapping.lookup_default 0 (bind_pmf_aux p f A) x = measure_pmf.expectation p (\<lambda>y. indicat_real A y * pmf (f y) x)

goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Mapping.lookup_default 0 (bind_pmf_aux p f A) x = measure_pmf.expectation p (\<lambda>y. indicat_real A y * pmf (f y) x)

goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have "\<dots> = (\<Sum>y\<in>A. pmf p y * pmf (f y) x)"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. measure_pmf.expectation p (\<lambda>y. indicat_real A y * pmf (f y) x) = (\<Sum>y\<in>A. pmf p y * pmf (f y) x)
[PROOF STEP]
by (subst integral_measure_pmf [of A])
       (auto simp: set_pmf_eq indicator_def mult_ac split: if_splits)
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation p (\<lambda>y. indicat_real A y * pmf (f y) x) = (\<Sum>y\<in>A. pmf p y * pmf (f y) x)

goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation p (\<lambda>y. indicat_real A y * pmf (f y) x) = (\<Sum>y\<in>A. pmf p y * pmf (f y) x)

goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have "\<dots> = Mapping.lookup_default 0 ?rhs x"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<Sum>y\<in>A. pmf p y * pmf (f y) x) = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
[PROOF STEP]
by (simp add: lookup_default_fold_combine_plus lookup_default_0_map_values
          lookup_default_mapping_of_pmf)
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>A. pmf p y * pmf (f y) x) = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x

goal (2 subgoals):
 1. \<And>x. x \<in> Mapping.keys (bind_pmf_aux p f A) \<Longrightarrow> Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
 2. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
[PROOF STEP]
show "Mapping.lookup_default 0 ?lhs x = Mapping.lookup_default 0 ?rhs x"
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x

goal (1 subgoal):
 1. Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Mapping.lookup_default 0 (bind_pmf_aux p f A) x = Mapping.lookup_default 0 (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A) x

goal (1 subgoal):
 1. Mapping.keys (bind_pmf_aux p f A) = Mapping.keys (fold_combine_plus (\<lambda>x. Mapping.map_values (\<lambda>_. (*) (pmf p x)) (mapping_of_pmf (f x))) A)
[PROOF STEP]
qed (insert assms, simp_all add: keys_fold_combine_plus)


[STATEMENT]
lemma (in product_sigma_finite) product_nn_integral_insert_rev:
  assumes I[simp]: "finite I" "i \<notin> I"
    and [measurable]: "f \<in> borel_measurable (Pi\<^sub>M (insert i I) M)"
  shows "integral\<^sup>N (Pi\<^sub>M (insert i I) M) f = (\<integral>\<^sup>+ y. (\<integral>\<^sup>+ x. f (x(i := y)) \<partial>(Pi\<^sub>M I M)) \<partial>(M i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (Pi\<^sub>M (insert i I) M) f = \<integral>\<^sup>+ y. \<integral>\<^sup>+ x. f (x(i := y)) \<partial>Pi\<^sub>M I M \<partial>M i
[PROOF STEP]
apply (subst product_nn_integral_insert[OF assms])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f (x(i := y)) \<partial>M i \<partial>Pi\<^sub>M I M = \<integral>\<^sup>+ y. \<integral>\<^sup>+ x. f (x(i := y)) \<partial>Pi\<^sub>M I M \<partial>M i
[PROOF STEP]
apply (rule pair_sigma_finite.Fubini')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. pair_sigma_finite (M i) (Pi\<^sub>M I M)
 2. (\<lambda>(x, y). f (y(i := x))) \<in> borel_measurable (M i \<Otimes>\<^sub>M Pi\<^sub>M I M)
[PROOF STEP]
apply intro_locales []
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sigma_finite_measure (Pi\<^sub>M I M)
 2. (\<lambda>(x, y). f (y(i := x))) \<in> borel_measurable (M i \<Otimes>\<^sub>M Pi\<^sub>M I M)
[PROOF STEP]
apply (rule sigma_finite[OF I(1)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f (y(i := x))) \<in> borel_measurable (M i \<Otimes>\<^sub>M Pi\<^sub>M I M)
[PROOF STEP]
apply measurable
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma S'_A_eq_S'_alpha_A: "\<And>A::type_scheme list.
      $ (\<lambda>n. if n : free_tv A Un free_tv t then S n else TVar n) A =
      $ ((\<lambda>x. if x : free_tv A Un free_tv t then S x else TVar x) \<circ>
         (\<lambda>x. if x : free_tv A then x else n + x)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. $ (\<lambda>n. if n \<in> free_tv A \<union> free_tv t then S n else TVar n) A = $ ((\<lambda>x. if x \<in> free_tv A \<union> free_tv t then S x else TVar x) \<circ> (\<lambda>x. if x \<in> free_tv A then x else n + x)) A
[PROOF STEP]
apply (subst S_o_alpha_type_scheme_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. $ (\<lambda>n. if n \<in> free_tv A \<union> free_tv t then S n else TVar n) A = $ (\<lambda>x. if x \<in> free_tv A \<union> free_tv t then S x else TVar x) ($ (\<lambda>x. TVar (if x \<in> free_tv A then x else n + x)) A)
[PROOF STEP]
apply (subst alpha_A)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. $ (\<lambda>n. if n \<in> free_tv A \<union> free_tv t then S n else TVar n) A = $ (\<lambda>x. if x \<in> free_tv A \<union> free_tv t then S x else TVar x) A
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pow_equals:
  assumes "PoW t n = PoW t n'"
  and "n'\<ge>n"
  and "n''\<ge>n"
  and "n''\<le>n'"
shows "PoW t n = PoW t n''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. PoW t n = PoW t n''
[PROOF STEP]
by (metis pow_mono assms(1) assms(3) assms(4) eq_iff)


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


[STATEMENT]
lemma finite_bot_prod:
  "(bot :: ('a::finite_lattice_complete \<times> 'b::finite_lattice_complete)) =
    Inf_fin UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bot = \<Sqinter>\<^sub>f\<^sub>i\<^sub>n UNIV
[PROOF STEP]
by (metis Inf_fin.coboundedI UNIV_I bot.extremum_uniqueI finite_UNIV)


[STATEMENT]
lemma all_edges_between_Un2:
  "all_edges_between X (Y \<union> Z) = all_edges_between X Y \<union> all_edges_between X Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_edges_between X (Y \<union> Z) = all_edges_between X Y \<union> all_edges_between X Z
[PROOF STEP]
by (auto simp: all_edges_between_def)


[STATEMENT]
lemma range_mult [simp]:
  fixes a::"real" shows "range ((*) a) = (if a=0 then {0} else UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range ((*) a) = (if a = 0 then {0} else UNIV)
[PROOF STEP]
by (simp add: surj_def) (meson dvdE dvd_field_iff)


[STATEMENT]
lemma (in category) op_cat_is_iso_arr[cat_op_simps]:
  "f : b \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>op_cat \<CC>\<^esub> a \<longleftrightarrow> f : a \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f : b \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>op_cat \<CC>\<^esub> a = f : a \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> b
[PROOF STEP]
unfolding is_iso_arr_def cat_op_simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f : a \<mapsto>\<^bsub>\<CC>\<^esub> b \<and> (\<exists>g. is_inverse \<CC> g f)) = (f : a \<mapsto>\<^bsub>\<CC>\<^esub> b \<and> (\<exists>g. is_inverse \<CC> g f))
[PROOF STEP]
by simp


[STATEMENT]
lemma (in flowgraph) ntrp_add_context: "\<lbrakk>
    ((s,c),w,(s',c'))\<in>trcl (ntrp fg);
    mon_ww fg (map le_rem_s w) \<inter> mon_c fg cn = {}
  \<rbrakk> \<Longrightarrow> ((s,c+cn),w,(s',c'+cn))\<in>trcl (ntrp fg)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>((s, c), w, s', c') \<in> trcl (ntrp fg); mon_ww fg (map le_rem_s w) \<inter> mon_c fg cn = {}\<rbrakk> \<Longrightarrow> ((s, c + cn), w, s', c' + cn) \<in> trcl (ntrp fg)
[PROOF STEP]
by (induct rule: trcl_pair_induct) (simp, force dest: ntrp_add_context_s)


[STATEMENT]
lemma prod_mset_replicate_mset [simp]:
  "prod_mset (replicate_mset n a) = a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_mset (replicate_mset n a) = a ^ n
[PROOF STEP]
by (induct n) simp_all


[STATEMENT]
lemma fls_subdegree_integral:
  fixes   f :: "'a::{division_ring,ring_char_0} fls"
  assumes "f \<noteq> 0" "fls_subdegree f \<noteq> -1"
  shows   "fls_subdegree (fls_integral f) = fls_subdegree f + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_subdegree (fls_integral f) = fls_subdegree f + 1
[PROOF STEP]
using   assms of_int_0_eq_iff[of "fls_subdegree f + 1"] fls_subdegree_integral_ge
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0
fls_subdegree f \<noteq> - 1
((0::?'a) = of_int (fls_subdegree f + 1)) = (fls_subdegree f + 1 = 0)
fls_integral ?f \<noteq> 0 \<Longrightarrow> fls_subdegree ?f + 1 \<le> fls_subdegree (fls_integral ?f)

goal (1 subgoal):
 1. fls_subdegree (fls_integral f) = fls_subdegree f + 1
[PROOF STEP]
by      (intro fls_subdegree_eqI) simp_all


[STATEMENT]
lemma mod_ring_uminus_integer: "(mod_ring_rel_integer ===> mod_ring_rel_integer) (uminus_p_integer pp) uminus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mod_ring_rel_integer ===> mod_ring_rel_integer) (uminus_p_integer pp) uminus
[PROOF STEP]
using urel_integer_uminus mod_ring_uminus
[PROOF STATE]
proof (prove)
using this:
urel_integer ?x ?y \<Longrightarrow> urel_integer (uminus_p_integer pp ?x) (uminus_p p ?y)
(mod_ring_rel ===> mod_ring_rel) (uminus_p p) uminus

goal (1 subgoal):
 1. (mod_ring_rel_integer ===> mod_ring_rel_integer) (uminus_p_integer pp) uminus
[PROOF STEP]
unfolding mod_ring_rel_integer_def rel_fun_def
[PROOF STATE]
proof (prove)
using this:
urel_integer ?x ?y \<Longrightarrow> urel_integer (uminus_p_integer pp ?x) (uminus_p p ?y)
\<forall>x y. mod_ring_rel x y \<longrightarrow> mod_ring_rel (uminus_p p x) (- y)

goal (1 subgoal):
 1. \<forall>x y. (\<exists>z. urel_integer x z \<and> mod_ring_rel z y) \<longrightarrow> (\<exists>z. urel_integer (uminus_p_integer pp x) z \<and> mod_ring_rel z (- y))
[PROOF STEP]
by blast


[STATEMENT]
lemma gc_fair_new_proof:
  assumes
    gc: "chain (\<leadsto>GC) Ns" and
    init: "active_subset (lhd Ns) = {}" and
    lim: "passive_subset (Liminf_llist Ns) = {}"
  shows "fair Ns"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. empty_ord.fair Ns
[PROOF STEP]
unfolding fair_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
have "Inf_from (Liminf_llist Ns) \<subseteq> Inf_from (active_subset (Liminf_llist Ns))" (is "?lhs \<subseteq> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Inf_from (active_subset (Liminf_llist Ns))
[PROOF STEP]
using lim
[PROOF STATE]
proof (prove)
using this:
passive_subset (Liminf_llist Ns) = {}

goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Inf_from (active_subset (Liminf_llist Ns))
[PROOF STEP]
unfolding active_subset_def passive_subset_def
[PROOF STATE]
proof (prove)
using this:
{CL \<in> Liminf_llist Ns. snd CL \<noteq> active} = {}

goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Inf_from {CL \<in> Liminf_llist Ns. snd CL = active}
[PROOF STEP]
by (metis (no_types, lifting) Inf_from_mono empty_Collect_eq mem_Collect_eq subsetI)
[PROOF STATE]
proof (state)
this:
Inf_from (Liminf_llist Ns) \<subseteq> Inf_from (active_subset (Liminf_llist Ns))

goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Inf_from (Liminf_llist Ns) \<subseteq> Inf_from (active_subset (Liminf_llist Ns))

goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
have "... \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)" (is "_ \<subseteq> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_from (active_subset (Liminf_llist Ns)) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
using gc_invar_infinity[OF chain_not_lnull[OF gc]] gc_invar_gc[OF gc init]
[PROOF STATE]
proof (prove)
using this:
\<forall>i. enat i < llength Ns \<longrightarrow> gc_invar Ns (enat i) \<Longrightarrow> gc_invar Ns \<infinity>
?i < llength Ns \<Longrightarrow> gc_invar Ns ?i

goal (1 subgoal):
 1. Inf_from (active_subset (Liminf_llist Ns)) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
unfolding gc_invar_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i. enat i < llength Ns \<longrightarrow> Inf_from (active_subset (Liminf_upto_llist Ns (enat i))) \<subseteq> Sup_upto_llist (lmap Red_I_\<G> Ns) (enat i) \<Longrightarrow> Inf_from (active_subset (Liminf_upto_llist Ns \<infinity>)) \<subseteq> Sup_upto_llist (lmap Red_I_\<G> Ns) \<infinity>
?i < llength Ns \<Longrightarrow> Inf_from (active_subset (Liminf_upto_llist Ns ?i)) \<subseteq> Sup_upto_llist (lmap Red_I_\<G> Ns) ?i

goal (1 subgoal):
 1. Inf_from (active_subset (Liminf_llist Ns)) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Inf_from (active_subset (Liminf_llist Ns)) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)

goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
show "?lhs \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
using this:
Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)

goal (1 subgoal):
 1. Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Inf_from (Liminf_llist Ns) \<subseteq> Sup_llist (lmap Red_I_\<G> Ns)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iMin_Int_ge1: "(A \<inter> B) \<noteq> {} \<Longrightarrow> iMin A \<le> iMin (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B \<noteq> {} \<Longrightarrow> iMin A \<le> iMin (A \<inter> B)
[PROOF STEP]
by (rule iMin_subset[OF _ Int_lower1])


[STATEMENT]
lemma sup_inf_distrib2_lgroup: "(b \<sqinter> c) \<squnion> a = (b \<squnion> a) \<sqinter> (c \<squnion> a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<sqinter> c \<squnion> a = (b \<squnion> a) \<sqinter> (c \<squnion> a)
[PROOF STEP]
by (rule sup_inf_distrib2)


[STATEMENT]
lemma order_linear': "order a [: b, 1:] = (if b = -a then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order a [:b, 1::'a:] = (if b = - a then 1 else 0)
[PROOF STEP]
using order_linear_power'[of a b 0]
[PROOF STATE]
proof (prove)
using this:
order a ([:b, 1::'a:] ^ Suc 0) = (if b = - a then Suc 0 else 0)

goal (1 subgoal):
 1. order a [:b, 1::'a:] = (if b = - a then 1 else 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma L5: "map f (xs @ ys) = (map f xs) @ (map f ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f (xs @ ys) = map f xs @ map f ys
[PROOF STEP]
using List.map_append
[PROOF STATE]
proof (prove)
using this:
map ?f (?xs @ ?ys) = map ?f ?xs @ map ?f ?ys

goal (1 subgoal):
 1. map f (xs @ ys) = map f xs @ map f ys
[PROOF STEP]
by simp


[STATEMENT]
lemma univ_for_pr_lm_4_1: "c_fst (c_fst key) mod 7 = 4 \<Longrightarrow> univ_for_pr key = univ_for_pr (c_pair (c_fst (c_snd (c_fst key))) (univ_for_pr (c_pair (c_snd (c_snd (c_fst key))) (c_snd key))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_fst (c_fst key) mod 7 = 4 \<Longrightarrow> univ_for_pr key = univ_for_pr (c_pair (c_fst (c_snd (c_fst key))) (univ_for_pr (c_pair (c_snd (c_snd (c_fst key))) (c_snd key))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_fst (c_fst key) mod 7 = 4 \<Longrightarrow> univ_for_pr key = univ_for_pr (c_pair (c_fst (c_snd (c_fst key))) (univ_for_pr (c_pair (c_snd (c_snd (c_fst key))) (c_snd key))))
[PROOF STEP]
assume A: "c_fst (c_fst key) mod 7 = 4"
[PROOF STATE]
proof (state)
this:
c_fst (c_fst key) mod 7 = 4

goal (1 subgoal):
 1. c_fst (c_fst key) mod 7 = 4 \<Longrightarrow> univ_for_pr key = univ_for_pr (c_pair (c_fst (c_snd (c_fst key))) (univ_for_pr (c_pair (c_snd (c_snd (c_fst key))) (c_snd key))))
[PROOF STEP]
have S1: "univ_for_pr key = nat_to_pr (c_fst key) (c_snd key)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ_for_pr key = nat_to_pr (c_fst key) (c_snd key)
[PROOF STEP]
by (simp add: univ_for_pr_def pr_conv_2_to_1_def)
[PROOF STATE]
proof (state)
this:
univ_for_pr key = nat_to_pr (c_fst key) (c_snd key)

goal (1 subgoal):
 1. c_fst (c_fst key) mod 7 = 4 \<Longrightarrow> univ_for_pr key = univ_for_pr (c_pair (c_fst (c_snd (c_fst key))) (univ_for_pr (c_pair (c_snd (c_snd (c_fst key))) (c_snd key))))
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
c_fst (c_fst key) mod 7 = 4
univ_for_pr key = nat_to_pr (c_fst key) (c_snd key)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_fst (c_fst key) mod 7 = 4
univ_for_pr key = nat_to_pr (c_fst key) (c_snd key)

goal (1 subgoal):
 1. univ_for_pr key = univ_for_pr (c_pair (c_fst (c_snd (c_fst key))) (univ_for_pr (c_pair (c_snd (c_snd (c_fst key))) (c_snd key))))
[PROOF STEP]
by (simp add: nat_to_pr_lm_4 univ_for_pr_def pr_conv_2_to_1_def)
[PROOF STATE]
proof (state)
this:
univ_for_pr key = univ_for_pr (c_pair (c_fst (c_snd (c_fst key))) (univ_for_pr (c_pair (c_snd (c_snd (c_fst key))) (c_snd key))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [code]:
  \<open>Word.the_int (v * w) = take_bit LENGTH('a) (Word.the_int v * Word.the_int w)\<close>
  for v w :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Word.the_int (v * w) = take_bit LENGTH('a) (Word.the_int v * Word.the_int w)
[PROOF STEP]
by transfer (simp add: take_bit_mult)


[STATEMENT]
lemma fps_monom_aux:
  "Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly 1 k) / (1 - fps_X) ^ (k+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
proof (cases "k = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
 2. k \<noteq> 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
assume [simp]: "k = 0"
[PROOF STATE]
proof (state)
this:
k = 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
 2. k \<noteq> 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
hence "Abs_fps (\<lambda>n. of_nat n ^ k :: 'a) = Abs_fps (\<lambda>_. 1)"
[PROOF STATE]
proof (prove)
using this:
k = 0

goal (1 subgoal):
 1. Abs_fps (\<lambda>n. of_nat n ^ k) = Abs_fps (\<lambda>_. 1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Abs_fps (\<lambda>n. of_nat n ^ k) = Abs_fps (\<lambda>_. 1::'a)

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
 2. k \<noteq> 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Abs_fps (\<lambda>n. of_nat n ^ k) = Abs_fps (\<lambda>_. 1::'a)

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
 2. k \<noteq> 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
have "\<dots> = 1 / (1 - fps_X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_fps (\<lambda>_. 1::'a) = 1 / (1 - fps_X)
[PROOF STEP]
by (subst gp [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
Abs_fps (\<lambda>_. 1::'a) = 1 / (1 - fps_X)

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
 2. k \<noteq> 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Abs_fps (\<lambda>n. of_nat n ^ k) = 1 / (1 - fps_X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Abs_fps (\<lambda>n. of_nat n ^ k) = 1 / (1 - fps_X)

goal (1 subgoal):
 1. Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
by (simp add: fps_monom_poly_def)
[PROOF STATE]
proof (state)
this:
Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)

goal (1 subgoal):
 1. k \<noteq> 0 \<Longrightarrow> Abs_fps (\<lambda>n. of_nat n ^ k) = fps_of_poly (fps_monom_poly (1::'a) k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
qed (insert eulerian_poly''[of k, where ?'a = 'a], simp add: fps_monom_poly_def)


[STATEMENT]
lemma (in is_cat_obj_prod_2) cat_obj_prod_2_unique':
  assumes "\<pi>' : P' <\<^sub>C\<^sub>F\<^sub>.\<^sub>\<times> {a,b} : 2\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  shows
    "\<exists>!f'. f' : P' \<mapsto>\<^bsub>\<CC>\<^esub> P \<and>
      proj_fst \<pi>' = proj_fst \<pi> \<circ>\<^sub>A\<^bsub>\<CC>\<^esub> f' \<and>
      proj_snd \<pi>' = proj_snd \<pi> \<circ>\<^sub>A\<^bsub>\<CC>\<^esub> f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!f'. f' : P' \<mapsto>\<^bsub>\<CC>\<^esub> P \<and> \<pi>'\<lparr>NTMap\<rparr>\<lparr>[]\<^sub>\<circ>\<rparr> = \<pi>\<lparr>NTMap\<rparr>\<lparr>[]\<^sub>\<circ>\<rparr> \<circ>\<^sub>A\<^bsub>\<CC>\<^esub> f' \<and> \<pi>'\<lparr>NTMap\<rparr>\<lparr>1\<^sub>\<nat>\<rparr> = \<pi>\<lparr>NTMap\<rparr>\<lparr>1\<^sub>\<nat>\<rparr> \<circ>\<^sub>A\<^bsub>\<CC>\<^esub> f'
[PROOF STEP]
by
    (
      rule cat_obj_prod_unique'[
        OF is_cat_obj_prod_2D[OF assms],
        unfolded helper_I2_proj_fst_proj_snd_iff
        ]
    )


[STATEMENT]
lemma Ints_mat_elements_mat: "A \<in> \<int>\<^sub>m = (elements_mat A \<subseteq> \<int>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<in> \<int>\<^sub>m) = (elements_mat A \<subseteq> \<int>)
[PROOF STEP]
unfolding Ints_mat_def elements_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<in> {A. \<forall>i<dim_row A. \<forall>j<dim_col A. A $$ (i, j) \<in> \<int>}) = (set (concat (map (\<lambda>i. map (\<lambda>j. A $$ (i, j)) [0..<dim_col A]) [0..<dim_row A])) \<subseteq> \<int>)
[PROOF STEP]
by force


[STATEMENT]
lemma "(\<lambda>x. (exp (sin b) - exp (sin (b * x))) * tan (pi * x / 2)) \<midarrow>1\<rightarrow>
         (2*b/pi * exp (sin b) * cos b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (exp (sin b) - exp (sin (b * x))) * tan (pi * x / 2)) \<midarrow>1\<rightarrow> 2 * b / pi * exp (sin b) * cos b
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma AE_lim_stream:
  assumes x[simp]: "x \<in> space M" and P[measurable]: "Measurable.pred (stream_space M) P"
  shows "(AE \<omega> in lim_stream x. P \<omega>) \<longleftrightarrow> (AE y in K x. AE \<omega> in lim_stream y. P (y ## \<omega>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_everywhere (lim_stream x) P = (AE y in K x. AE \<omega> in lim_stream y. P (y ## \<omega>))
[PROOF STEP]
unfolding lim_stream_eq[OF x]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_everywhere (K x \<bind> (\<lambda>y. lim_stream y \<bind> (\<lambda>\<omega>. return (stream_space M) (y ## \<omega>)))) P = (AE y in K x. AE \<omega> in lim_stream y. P (y ## \<omega>))
[PROOF STEP]
by (simp_all add: space_K space_lim_stream space_stream_space AE_return AE_bind[OF measurable_prob_algebraD P] cong: AE_cong_simp)


[STATEMENT]
lemma "eventually (\<lambda>x::real. 1 / x^2 \<ge> 1 / x) (at_left 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_left 0. 1 / x \<le> 1 / x\<^sup>2
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma union_le_diff_plus: "P \<subseteq># M \<Longrightarrow> N < P \<Longrightarrow> M - P + N < M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P \<subseteq># M; N < P\<rbrakk> \<Longrightarrow> M - P + N < M
[PROOF STEP]
by (drule subset_mset.diff_add[symmetric]) (metis union_le_mono2)


[STATEMENT]
lemma is_right_adjoint_functor:
    shows "right_adjoint_functor C D F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F
[PROOF STEP]
obtain G \<eta> \<epsilon> where E: "adjoint_equivalence C D G F \<eta> \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>G \<eta> \<epsilon>. adjoint_equivalence (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F \<eta> \<epsilon> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using extends_to_adjoint_equivalence
[PROOF STATE]
proof (prove)
using this:
\<exists>G \<eta> \<epsilon>. adjoint_equivalence (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F \<eta> \<epsilon>

goal (1 subgoal):
 1. (\<And>G \<eta> \<epsilon>. adjoint_equivalence (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F \<eta> \<epsilon> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint_equivalence (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F \<eta> \<epsilon>

goal (1 subgoal):
 1. right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F
[PROOF STEP]
interpret E: adjoint_equivalence C D G F \<eta> \<epsilon>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint_equivalence (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F \<eta> \<epsilon>
[PROOF STEP]
using E
[PROOF STATE]
proof (prove)
using this:
adjoint_equivalence (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F \<eta> \<epsilon>

goal (1 subgoal):
 1. adjoint_equivalence (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F \<eta> \<epsilon>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F
[PROOF STEP]
interpret Adj: meta_adjunction C D G F E.\<phi> E.\<psi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. meta_adjunction (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F E.\<phi> E.\<psi>
[PROOF STEP]
using E.induces_meta_adjunction
[PROOF STATE]
proof (prove)
using this:
meta_adjunction (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F E.\<phi> E.\<psi>

goal (1 subgoal):
 1. meta_adjunction (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G F E.\<phi> E.\<psi>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F
[PROOF STEP]
using Adj.has_right_adjoint_functor
[PROOF STATE]
proof (prove)
using this:
right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F

goal (1 subgoal):
 1. right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
right_adjoint_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma triangle_ineq_sumsets:
  assumes hA: "finite A" and hB: "finite B" and hC: "finite C" and
  hAG : "A \<subseteq> G" and hBG: "B \<subseteq> G" and hCG: "C \<subseteq> G"
  shows "card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
proof(cases "A = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
 2. A \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
 2. A \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A = {}

goal (1 subgoal):
 1. card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
case hAne: False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
show "card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
proof(cases "B = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B = {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
 2. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
B = {}

goal (2 subgoals):
 1. B = {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
 2. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B = {}

goal (1 subgoal):
 1. card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
case hBne: False
[PROOF STATE]
proof (state)
this:
B \<noteq> {}

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
define KS where "KS \<equiv> (\<lambda>X. card (sumset X C) / real (card X)) ` (Pow A - {{}})"
[PROOF STATE]
proof (state)
this:
KS \<equiv> (\<lambda>X. real (card (sumset X C)) / real (card X)) ` (Pow A - {{}})

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
define K where "K \<equiv> Min KS"
[PROOF STATE]
proof (state)
this:
K \<equiv> Min KS

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
define X where "X \<equiv> @X. X \<in> Pow A - {{}} \<and> K = card (sumset X C) / real (card X)"
[PROOF STATE]
proof (state)
this:
X \<equiv> SOME X. X \<in> Pow A - {{}} \<and> K = real (card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
obtain KS: "finite KS" "KS \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>finite KS; KS \<noteq> {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using KS_def hA hAne
[PROOF STATE]
proof (prove)
using this:
KS \<equiv> (\<lambda>X. real (card (sumset X C)) / real (card X)) ` (Pow A - {{}})
finite A
A \<noteq> {}

goal (1 subgoal):
 1. (\<lbrakk>finite KS; KS \<noteq> {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite KS
KS \<noteq> {}

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite KS
KS \<noteq> {}
[PROOF STEP]
have "K \<in> KS"
[PROOF STATE]
proof (prove)
using this:
finite KS
KS \<noteq> {}

goal (1 subgoal):
 1. K \<in> KS
[PROOF STEP]
using K_def Min_in
[PROOF STATE]
proof (prove)
using this:
finite KS
KS \<noteq> {}
K \<equiv> Min KS
\<lbrakk>finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> Min ?A \<in> ?A

goal (1 subgoal):
 1. K \<in> KS
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
K \<in> KS

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
K \<in> KS
[PROOF STEP]
have "\<exists>X. X \<in> Pow A - {{}} \<and> K = card (sumset X C) / real (card X)"
[PROOF STATE]
proof (prove)
using this:
K \<in> KS

goal (1 subgoal):
 1. \<exists>X. X \<in> Pow A - {{}} \<and> K = real (card (sumset X C)) / real (card X)
[PROOF STEP]
using KS_def
[PROOF STATE]
proof (prove)
using this:
K \<in> KS
KS \<equiv> (\<lambda>X. real (card (sumset X C)) / real (card X)) ` (Pow A - {{}})

goal (1 subgoal):
 1. \<exists>X. X \<in> Pow A - {{}} \<and> K = real (card (sumset X C)) / real (card X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>X. X \<in> Pow A - {{}} \<and> K = real (card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>X. X \<in> Pow A - {{}} \<and> K = real (card (sumset X C)) / real (card X)
[PROOF STEP]
obtain "X \<in> Pow A - {{}}" and Keq: "K = card (sumset X C) / real (card X)"
[PROOF STATE]
proof (prove)
using this:
\<exists>X. X \<in> Pow A - {{}} \<and> K = real (card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. (\<lbrakk>X \<in> Pow A - {{}}; K = real (card (sumset X C)) / real (card X)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (mono_tags, lifting) X_def someI_ex)
[PROOF STATE]
proof (state)
this:
X \<in> Pow A - {{}}
K = real (card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X \<in> Pow A - {{}}
K = real (card (sumset X C)) / real (card X)
[PROOF STEP]
have hX: "X \<subseteq> A" "X \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
X \<in> Pow A - {{}}
K = real (card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. X \<subseteq> A &&& X \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<subseteq> A
X \<noteq> {}

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
have hXmin : "\<And> Y. Y \<subseteq> A \<Longrightarrow> Y \<noteq> {} \<Longrightarrow>
      card (sumset X C) / card X \<le> card (sumset Y C) / card Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Y \<subseteq> A; Y \<noteq> {}\<rbrakk> \<Longrightarrow> real (card (sumset X C)) / real (card X) \<le> real (card (sumset Y C)) / real (card Y)
[PROOF STEP]
using K_def KS_def Keq Min_le KS(1)
[PROOF STATE]
proof (prove)
using this:
K \<equiv> Min KS
KS \<equiv> (\<lambda>X. real (card (sumset X C)) / real (card X)) ` (Pow A - {{}})
K = real (card (sumset X C)) / real (card X)
\<lbrakk>finite ?A; ?x \<in> ?A\<rbrakk> \<Longrightarrow> Min ?A \<le> ?x
finite KS

goal (1 subgoal):
 1. \<And>Y. \<lbrakk>Y \<subseteq> A; Y \<noteq> {}\<rbrakk> \<Longrightarrow> real (card (sumset X C)) / real (card X) \<le> real (card (sumset Y C)) / real (card Y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?Y \<subseteq> A; ?Y \<noteq> {}\<rbrakk> \<Longrightarrow> real (card (sumset X C)) / real (card X) \<le> real (card (sumset ?Y C)) / real (card ?Y)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?Y \<subseteq> A; ?Y \<noteq> {}\<rbrakk> \<Longrightarrow> real (card (sumset X C)) / real (card X) \<le> real (card (sumset ?Y C)) / real (card ?Y)
[PROOF STEP]
have hXAineq: "card (sumset X C) / card X \<le> card (sumset A C) / card A"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?Y \<subseteq> A; ?Y \<noteq> {}\<rbrakk> \<Longrightarrow> real (card (sumset X C)) / real (card X) \<le> real (card (sumset ?Y C)) / real (card ?Y)

goal (1 subgoal):
 1. real (card (sumset X C)) / real (card X) \<le> real (card (sumset A C)) / real (card A)
[PROOF STEP]
by (metis hAne subset_refl)
[PROOF STATE]
proof (state)
this:
real (card (sumset X C)) / real (card X) \<le> real (card (sumset A C)) / real (card A)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
have haux: "real (card (sumset X (sumset B C))) / real (card (sumset X B))
      \<le> real (card (sumset X C)) / real (card X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset B C))) / real (card (sumset X B)) \<le> real (card (sumset X C)) / real (card X)
[PROOF STEP]
using triangle_ineq_sumsets_aux[of "X" "C" "B"]
      hXmin hX hA hAG finite_subset hB hC hBne hBG hC hCG subset_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite X; finite C; X \<subseteq> G; C \<subseteq> G; X \<noteq> {}; \<And>Y. \<lbrakk>Y \<subseteq> X; Y \<noteq> {}\<rbrakk> \<Longrightarrow> real (card (sumset X C)) / real (card X) \<le> real (card (sumset Y C)) / real (card Y); finite B; B \<noteq> {}; B \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset B C))) / real (card (sumset X B)) \<le> real (card (sumset X C)) / real (card X)
\<lbrakk>?Y \<subseteq> A; ?Y \<noteq> {}\<rbrakk> \<Longrightarrow> real (card (sumset X C)) / real (card X) \<le> real (card (sumset ?Y C)) / real (card ?Y)
X \<subseteq> A
X \<noteq> {}
finite A
A \<subseteq> G
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
finite B
finite C
B \<noteq> {}
B \<subseteq> G
finite C
C \<subseteq> G
\<lbrakk>?A \<subseteq> ?B; ?B \<subseteq> ?C\<rbrakk> \<Longrightarrow> ?A \<subseteq> ?C

goal (1 subgoal):
 1. real (card (sumset X (sumset B C))) / real (card (sumset X B)) \<le> real (card (sumset X C)) / real (card X)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset B C))) / real (card (sumset X B)) \<le> real (card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
have hXAsumset : "real (card (sumset X B)) \<le> card (sumset A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X B)) \<le> real (card (sumset A B))
[PROOF STEP]
using hX(1) card_mono hA finite_sumset hB order_refl sumset_mono
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> A
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B
finite A
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
finite B
?x \<le> ?x
\<lbrakk>?A' \<subseteq> ?A; ?B' \<subseteq> ?B\<rbrakk> \<Longrightarrow> sumset ?A' ?B' \<subseteq> sumset ?A ?B

goal (1 subgoal):
 1. real (card (sumset X B)) \<le> real (card (sumset A B))
[PROOF STEP]
by (metis of_nat_le_iff)
[PROOF STATE]
proof (state)
this:
real (card (sumset X B)) \<le> real (card (sumset A B))

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
have "card (sumset B C) \<le> card (sumset X (sumset B C))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset B C) \<le> card (sumset X (sumset B C))
[PROOF STEP]
using assms hX
      finite_sumset hAG card_le_sumset
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
finite C
A \<subseteq> G
B \<subseteq> G
C \<subseteq> G
X \<subseteq> A
X \<noteq> {}
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
A \<subseteq> G
\<lbrakk>finite ?A; ?a \<in> ?A; ?a \<in> G; finite ?B; ?B \<subseteq> G\<rbrakk> \<Longrightarrow> card ?B \<le> card (sumset ?A ?B)

goal (1 subgoal):
 1. card (sumset B C) \<le> card (sumset X (sumset B C))
[PROOF STEP]
by (metis bot.extremum_uniqueI dual_order.trans infinite_super subsetD subsetI
        sumset_subset_carrier)
[PROOF STATE]
proof (state)
this:
card (sumset B C) \<le> card (sumset X (sumset B C))

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (sumset B C) \<le> card (sumset X (sumset B C))

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
have "... \<le> (card (sumset X C) / card X) * card (sumset X B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset B C))) \<le> real (card (sumset X C)) / real (card X) * real (card (sumset X B))
[PROOF STEP]
using haux divide_le_eq
      card_sumset_0_iff hBne hX hB hA finite_subset card_0_eq
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X (sumset B C))) / real (card (sumset X B)) \<le> real (card (sumset X C)) / real (card X)
(?b / ?c \<le> ?a) = (if (0::?'a) < ?c then ?b \<le> ?a * ?c else if ?c < (0::?'a) then ?a * ?c \<le> ?b else (0::?'a) \<le> ?a)
\<lbrakk>?A \<subseteq> G; ?B \<subseteq> G\<rbrakk> \<Longrightarrow> (card (sumset ?A ?B) = 0) = (card ?A = 0 \<or> card ?B = 0)
B \<noteq> {}
X \<subseteq> A
X \<noteq> {}
finite B
finite A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
finite ?A \<Longrightarrow> (card ?A = 0) = (?A = {})

goal (1 subgoal):
 1. real (card (sumset X (sumset B C))) \<le> real (card (sumset X C)) / real (card X) * real (card (sumset X B))
[PROOF STEP]
by (smt (verit) hCG mult_eq_0_iff
      of_nat_0_eq_iff of_nat_0_le_iff sumset_assoc sumset_subset_carrier)
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset B C))) \<le> real (card (sumset X C)) / real (card X) * real (card (sumset X B))

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset B C))) \<le> real (card (sumset X C)) / real (card X) * real (card (sumset X B))

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
have "... \<le> (card (sumset A C) / card A) * card (sumset A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X C)) / real (card X) * real (card (sumset X B)) \<le> real (card (sumset A C)) / real (card A) * real (card (sumset A B))
[PROOF STEP]
using hXAineq hXAsumset
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X C)) / real (card X) \<le> real (card (sumset A C)) / real (card A)
real (card (sumset X B)) \<le> real (card (sumset A B))

goal (1 subgoal):
 1. real (card (sumset X C)) / real (card X) * real (card (sumset X B)) \<le> real (card (sumset A C)) / real (card A) * real (card (sumset A B))
[PROOF STEP]
by (meson divide_nonneg_nonneg mult_mono' of_nat_0_le_iff)
[PROOF STATE]
proof (state)
this:
real (card (sumset X C)) / real (card X) * real (card (sumset X B)) \<le> real (card (sumset A C)) / real (card A) * real (card (sumset A B))

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card (sumset B C)) \<le> real (card (sumset A C)) / real (card A) * real (card (sumset A B))
[PROOF STEP]
have "card (sumset B C) \<le> (card (sumset A C) * card (sumset A B)) / card A"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card (sumset B C)) \<le> real (card (sumset A C)) / real (card A) * real (card (sumset A B))

goal (1 subgoal):
 1. real (card (sumset B C)) \<le> real (card (sumset A C) * card (sumset A B)) / real (card A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (card (sumset B C)) \<le> real (card (sumset A C) * card (sumset A B)) / real (card A)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card (sumset B C)) \<le> real (card (sumset A C) * card (sumset A B)) / real (card A)
[PROOF STEP]
have "card (sumset B C) * card A \<le> card (sumset A C) * card (sumset A B)"
[PROOF STATE]
proof (prove)
using this:
real (card (sumset B C)) \<le> real (card (sumset A C) * card (sumset A B)) / real (card A)

goal (1 subgoal):
 1. card (sumset B C) * card A \<le> card (sumset A C) * card (sumset A B)
[PROOF STEP]
using le_divide_eq hAne hA card_gt_0_iff
[PROOF STATE]
proof (prove)
using this:
real (card (sumset B C)) \<le> real (card (sumset A C) * card (sumset A B)) / real (card A)
(?a \<le> ?b / ?c) = (if (0::?'a) < ?c then ?a * ?c \<le> ?b else if ?c < (0::?'a) then ?b \<le> ?a * ?c else ?a \<le> (0::?'a))
A \<noteq> {}
finite A
(0 < card ?A) = (?A \<noteq> {} \<and> finite ?A)

goal (1 subgoal):
 1. card (sumset B C) * card A \<le> card (sumset A C) * card (sumset A B)
[PROOF STEP]
by (smt (verit, ccfv_threshold)
      card_0_eq of_nat_le_0_iff of_nat_le_iff of_nat_mult)
[PROOF STATE]
proof (state)
this:
card (sumset B C) * card A \<le> card (sumset A C) * card (sumset A B)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
thus "card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)"
[PROOF STATE]
proof (prove)
using this:
card (sumset B C) * card A \<le> card (sumset A C) * card (sumset A B)

goal (1 subgoal):
 1. card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card A * card (sumset B C) \<le> card (sumset A B) * card (sumset A C)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Stirling_n_0: "Stirling n 0 = (if n = 0 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stirling n 0 = (if n = 0 then 1 else 0)
[PROOF STEP]
by (cases n) simp_all


[STATEMENT]
lemma (in weak_lattice) weak_le_iff_meet:
  assumes "x \<in> carrier L" "y \<in> carrier L"
  shows "x \<sqsubseteq> y \<longleftrightarrow> (x \<squnion> y) .= y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<sqsubseteq> y) = (x \<squnion> y .= y)
[PROOF STEP]
by (meson assms(1) assms(2) join_closed join_le join_left join_right le_cong_r local.le_refl weak_le_antisym)


[STATEMENT]
lemma of_hypnat_mult [simp]: "\<And>m n. of_hypnat (m * n) = of_hypnat m * of_hypnat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. of_hypnat (m * n) = of_hypnat m * of_hypnat n
[PROOF STEP]
by transfer (rule of_nat_mult)


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


[STATEMENT]
lemma continuous_ln:
  "continuous F f \<Longrightarrow> f (Lim F (\<lambda>x. x)) \<noteq> 0 \<Longrightarrow> continuous F (\<lambda>x. ln (f x :: real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; f (Lim F (\<lambda>x. x)) \<noteq> 0\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. ln (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F; f (Lim F (\<lambda>x. x)) \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. ln (f x)) \<longlongrightarrow> ln (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_ln)


[STATEMENT]
lemma mid_sums_cons: "mid_sums (x#xs) = front_sums (x#xs) \<union> mid_sums xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mid_sums (x # xs) = front_sums (x # xs) \<union> mid_sums xs
[PROOF STEP]
unfolding mid_sums_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list ` mids (x # xs) = front_sums (x # xs) \<union> sum_list ` mids xs
[PROOF STEP]
by (auto simp: mids_cons front_sums_def)


[STATEMENT]
lemma angular_component_mult:
  assumes "x \<in> nonzero Q\<^sub>p"
  assumes "y \<in> nonzero Q\<^sub>p"
  shows "angular_component (x \<otimes> y) = (angular_component  x) \<otimes>\<^bsub>Z\<^sub>p\<^esub> (angular_component  y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
obtain a b where "a = numer x" and
                   "b = denom x" and
                   a_nz: "a \<in> nonzero Z\<^sub>p" and
                   b_nz: "b \<in> nonzero Z\<^sub>p" and
                   x_frac: "x = frac a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a = numerator Z\<^sub>p x; b = denominator Z\<^sub>p x; a \<in> nonzero Z\<^sub>p; b \<in> nonzero Z\<^sub>p; x = fraction Z\<^sub>p a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms Qp.nonzero_memE[of x]
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p
y \<in> nonzero Q\<^sub>p
x \<in> nonzero Q\<^sub>p \<Longrightarrow> x \<in> carrier Q\<^sub>p
x \<in> nonzero Q\<^sub>p \<Longrightarrow> x \<noteq> \<zero>

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a = numerator Z\<^sub>p x; b = denominator Z\<^sub>p x; a \<in> nonzero Z\<^sub>p; b \<in> nonzero Z\<^sub>p; x = fraction Z\<^sub>p a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson local.numer_denom_facts(1) local.numer_denom_facts(2)
        local.numer_denom_facts(3) local.numer_denom_facts(5) not_nonzero_Zp)
[PROOF STATE]
proof (state)
this:
a = numerator Z\<^sub>p x
b = denominator Z\<^sub>p x
a \<in> nonzero Z\<^sub>p
b \<in> nonzero Z\<^sub>p
x = fraction Z\<^sub>p a b

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
obtain c d where "c = numer y" and
                   "d = denom y" and
                   c_nz: "c \<in> nonzero Z\<^sub>p" and
                   d_nz: "d \<in> nonzero Z\<^sub>p" and
                   y_frac: "y = frac c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c d. \<lbrakk>c = numerator Z\<^sub>p y; d = denominator Z\<^sub>p y; c \<in> nonzero Z\<^sub>p; d \<in> nonzero Z\<^sub>p; y = fraction Z\<^sub>p c d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms Qp.nonzero_memE[of y]
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p
y \<in> nonzero Q\<^sub>p
y \<in> nonzero Q\<^sub>p \<Longrightarrow> y \<in> carrier Q\<^sub>p
y \<in> nonzero Q\<^sub>p \<Longrightarrow> y \<noteq> \<zero>

goal (1 subgoal):
 1. (\<And>c d. \<lbrakk>c = numerator Z\<^sub>p y; d = denominator Z\<^sub>p y; c \<in> nonzero Z\<^sub>p; d \<in> nonzero Z\<^sub>p; y = fraction Z\<^sub>p c d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson local.numer_denom_facts(1) local.numer_denom_facts(2) local.numer_denom_facts(3) local.numer_denom_facts(5) not_nonzero_Zp)
[PROOF STATE]
proof (state)
this:
c = numerator Z\<^sub>p y
d = denominator Z\<^sub>p y
c \<in> nonzero Z\<^sub>p
d \<in> nonzero Z\<^sub>p
y = fraction Z\<^sub>p c d

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
have 0: "(x \<otimes> y) = frac (a \<otimes>\<^bsub>Z\<^sub>p\<^esub> c) (b \<otimes>\<^bsub>Z\<^sub>p\<^esub> d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<otimes> y = fraction Z\<^sub>p (a \<otimes>\<^bsub>Z\<^sub>p\<^esub> c) (b \<otimes>\<^bsub>Z\<^sub>p\<^esub> d)
[PROOF STEP]
using  a_nz b_nz c_nz d_nz frac_mult x_frac y_frac
[PROOF STATE]
proof (prove)
using this:
a \<in> nonzero Z\<^sub>p
b \<in> nonzero Z\<^sub>p
c \<in> nonzero Z\<^sub>p
d \<in> nonzero Z\<^sub>p
\<lbrakk>?a \<in> carrier Z\<^sub>p; ?b \<in> nonzero Z\<^sub>p; ?c \<in> carrier Z\<^sub>p; ?d \<in> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> fraction Z\<^sub>p ?a ?b \<otimes> fraction Z\<^sub>p ?c ?d = fraction Z\<^sub>p (?a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ?c) (?b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ?d)
x = fraction Z\<^sub>p a b
y = fraction Z\<^sub>p c d

goal (1 subgoal):
 1. x \<otimes> y = fraction Z\<^sub>p (a \<otimes>\<^bsub>Z\<^sub>p\<^esub> c) (b \<otimes>\<^bsub>Z\<^sub>p\<^esub> d)
[PROOF STEP]
by (simp add: Zp.nonzero_closed)
[PROOF STATE]
proof (state)
this:
x \<otimes> y = fraction Z\<^sub>p (a \<otimes>\<^bsub>Z\<^sub>p\<^esub> c) (b \<otimes>\<^bsub>Z\<^sub>p\<^esub> d)

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
have 1: "angular_component (x \<otimes> y) = (ac_Zp (a \<otimes>\<^bsub>Z\<^sub>p\<^esub> c)) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp (b \<otimes>\<^bsub>Z\<^sub>p\<^esub> d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angular_component (x \<otimes> y) = ac_Zp (a \<otimes>\<^bsub>Z\<^sub>p\<^esub> c) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp (b \<otimes>\<^bsub>Z\<^sub>p\<^esub> d)
[PROOF STEP]
by (metis (mono_tags, lifting) "0" Qp.nonzero_mult_closed Zp.integral_iff Zp.nonzero_closed Zp.nonzero_mult_closed a_nz ac_fract assms(1) assms(2) b_nz c_nz d_nz not_nonzero_Zp)
[PROOF STATE]
proof (state)
this:
angular_component (x \<otimes> y) = ac_Zp (a \<otimes>\<^bsub>Z\<^sub>p\<^esub> c) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp (b \<otimes>\<^bsub>Z\<^sub>p\<^esub> d)

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
have 2: "angular_component (x \<otimes> y) = (ac_Zp a) \<otimes>\<^bsub>Z\<^sub>p\<^esub> (ac_Zp c) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ((ac_Zp b) \<otimes>\<^bsub>Z\<^sub>p\<^esub> (ac_Zp d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp d)
[PROOF STEP]
by (simp add: "1" a_nz ac_Zp_mult b_nz c_nz d_nz)
[PROOF STATE]
proof (state)
this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp d)

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
have 3: "angular_component (x \<otimes> y) = (ac_Zp a) \<otimes>\<^bsub>Z\<^sub>p\<^esub> (ac_Zp c) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp b) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp d)

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d
[PROOF STEP]
by (simp add: Zp.inv_of_prod Zp.nonzero_closed Zp.nonzero_memE(2) ac_Zp_is_Unit b_nz d_nz mult_assoc)
[PROOF STATE]
proof (state)
this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
have 4: "angular_component (x \<otimes> y) = (ac_Zp a) \<otimes>\<^bsub>Z\<^sub>p\<^esub>  inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp b) \<otimes>\<^bsub>Z\<^sub>p\<^esub>  (ac_Zp c) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d
[PROOF STEP]
using "3"  a_nz ac_Zp_in_Zp ac_Zp_is_Unit b_nz c_nz m_assoc mult_comm
          mult_assoc
[PROOF STATE]
proof (prove)
using this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d
a \<in> nonzero Z\<^sub>p
\<lbrakk>?x \<in> carrier Z\<^sub>p; ?x \<noteq> \<zero>\<^bsub>Z\<^sub>p\<^esub>\<rbrakk> \<Longrightarrow> ac_Zp ?x \<in> carrier Z\<^sub>p
\<lbrakk>?x \<in> carrier Z\<^sub>p; ?x \<noteq> \<zero>\<^bsub>Z\<^sub>p\<^esub>\<rbrakk> \<Longrightarrow> ac_Zp ?x \<in> Units Z\<^sub>p
b \<in> nonzero Z\<^sub>p
c \<in> nonzero Z\<^sub>p
\<lbrakk>?x \<in> carrier (UP Q\<^sub>p); ?y \<in> carrier (UP Q\<^sub>p); ?z \<in> carrier (UP Q\<^sub>p)\<rbrakk> \<Longrightarrow> ?x \<otimes>\<^bsub>UP Q\<^sub>p\<^esub> ?y \<otimes>\<^bsub>UP Q\<^sub>p\<^esub> ?z = ?x \<otimes>\<^bsub>UP Q\<^sub>p\<^esub> (?y \<otimes>\<^bsub>UP Q\<^sub>p\<^esub> ?z)
?a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ?b = ?b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ?a
?a \<otimes>\<^bsub>Z\<^sub>p\<^esub> ?b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ?c = ?a \<otimes>\<^bsub>Z\<^sub>p\<^esub> (?b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ?c)

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
have 5: "angular_component (x \<otimes> y) = ((ac_Zp a) \<otimes>\<^bsub>Z\<^sub>p\<^esub>  inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp b)) \<otimes>\<^bsub>Z\<^sub>p\<^esub> ( (ac_Zp c) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> (ac_Zp d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> (ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d)
[PROOF STEP]
using 4
[PROOF STATE]
proof (prove)
using this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> (ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d)
[PROOF STEP]
by (simp add: mult_assoc)
[PROOF STATE]
proof (state)
this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> (ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d)

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> (ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
angular_component (x \<otimes> y) = ac_Zp a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp b \<otimes>\<^bsub>Z\<^sub>p\<^esub> (ac_Zp c \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp d)

goal (1 subgoal):
 1. angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y
[PROOF STEP]
by (simp add: Z\<^sub>p_def \<open>a = numer x\<close> \<open>b = denom x\<close> \<open>c = numer y\<close> \<open>d = denom y\<close>
        padic_fields.angular_component_def padic_fields_axioms)
[PROOF STATE]
proof (state)
this:
angular_component (x \<otimes> y) = angular_component x \<otimes>\<^bsub>Z\<^sub>p\<^esub> angular_component y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma connected_edgeRtc: "connected u v \<longleftrightarrow> (u, v) \<in> E\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected u v = ((u, v) \<in> E\<^sup>*)
[PROOF STEP]
using isPath_rtc rtc_isPath
[PROOF STATE]
proof (prove)
using this:
isPath ?u ?p ?v \<Longrightarrow> (?u, ?v) \<in> E\<^sup>*
(?u, ?v) \<in> E\<^sup>* \<Longrightarrow> \<exists>p. isPath ?u p ?v

goal (1 subgoal):
 1. connected u v = ((u, v) \<in> E\<^sup>*)
[PROOF STEP]
unfolding connected_def
[PROOF STATE]
proof (prove)
using this:
isPath ?u ?p ?v \<Longrightarrow> (?u, ?v) \<in> E\<^sup>*
(?u, ?v) \<in> E\<^sup>* \<Longrightarrow> \<exists>p. isPath ?u p ?v

goal (1 subgoal):
 1. (\<exists>p. isPath u p v) = ((u, v) \<in> E\<^sup>*)
[PROOF STEP]
by blast


[STATEMENT]
lemma (in state_space)
  shows "\<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace>
          \<lbrace>\<acute>Abr = ''Break''\<rbrace>\<bullet> WHILE True INV \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
           DO IF \<acute>M = a THEN RAISE \<acute>Abr :== ''Break''
              ELSE \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1
              FI
           OD
          \<lbrace>\<acute>S = a * b\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> \<lbrace>\<acute>Abr = ''Break''\<rbrace>\<bullet>WHILE True INV \<lbrace>\<acute>S = \<acute>M * b\<rbrace> DO IF \<acute>M = a THEN RAISE \<acute>Abr :== ''Break'' ELSE \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 FI OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
apply vcg
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>M S. \<lbrakk>M = 0; S = 0\<rbrakk> \<Longrightarrow> S = M * b
 2. \<And>M S. \<lbrakk>S = M * b; True\<rbrakk> \<Longrightarrow> (M = a \<longrightarrow> S = a * b) \<and> (M \<noteq> a \<longrightarrow> S + b = (M + 1) * b)
 3. \<And>M S. \<lbrakk>S = M * b; \<not> True\<rbrakk> \<Longrightarrow> S = a * b
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma to_poly_a_inv:
  assumes "a \<in> carrier R"
  shows "to_poly (\<ominus> a) =  \<ominus>\<^bsub>P\<^esub> to_poly a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_polynomial R (\<ominus> a) = \<ominus>\<^bsub>P\<^esub> to_polynomial R a
[PROOF STEP]
by (metis P_def assms monom_a_inv to_polynomial_def)


[STATEMENT]
lemma has_real_derivative_neg_dec_left:
  fixes f :: "real \<Rightarrow> real"
  assumes der: "(f has_real_derivative l) (at x within S)"
    and "l < 0"
  shows "\<exists>d > 0. \<forall>h > 0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
from \<open>l < 0\<close>
[PROOF STATE]
proof (chain)
picking this:
l < 0
[PROOF STEP]
have l: "- l > 0"
[PROOF STATE]
proof (prove)
using this:
l < 0

goal (1 subgoal):
 1. 0 < - l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < - l

goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
from der [THEN has_field_derivativeD, THEN tendstoD, OF l, unfolded eventually_at]
[PROOF STATE]
proof (chain)
picking this:
\<exists>d>0. \<forall>xa\<in>S. xa \<noteq> x \<and> dist xa x < d \<longrightarrow> dist ((f xa - f x) / (xa - x)) l < - l
[PROOF STEP]
obtain s where s: "0 < s"
    and all: "\<And>xa. xa\<in>S \<Longrightarrow> xa \<noteq> x \<and> dist xa x < s \<longrightarrow> \<bar>(f xa - f x) / (xa - x) - l\<bar> < - l"
[PROOF STATE]
proof (prove)
using this:
\<exists>d>0. \<forall>xa\<in>S. xa \<noteq> x \<and> dist xa x < d \<longrightarrow> dist ((f xa - f x) / (xa - x)) l < - l

goal (1 subgoal):
 1. (\<And>s. \<lbrakk>0 < s; \<And>xa. xa \<in> S \<Longrightarrow> xa \<noteq> x \<and> dist xa x < s \<longrightarrow> \<bar>(f xa - f x) / (xa - x) - l\<bar> < - l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: dist_real_def)
[PROOF STATE]
proof (state)
this:
0 < s
?xa \<in> S \<Longrightarrow> ?xa \<noteq> x \<and> dist ?xa x < s \<longrightarrow> \<bar>(f ?xa - f x) / (?xa - x) - l\<bar> < - l

goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < s
?xa \<in> S \<Longrightarrow> ?xa \<noteq> x \<and> dist ?xa x < s \<longrightarrow> \<bar>(f ?xa - f x) / (?xa - x) - l\<bar> < - l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < s
?xa \<in> S \<Longrightarrow> ?xa \<noteq> x \<and> dist ?xa x < s \<longrightarrow> \<bar>(f ?xa - f x) / (?xa - x) - l\<bar> < - l

goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
proof (intro exI conjI strip)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>0 < s; \<And>xa. xa \<in> S \<Longrightarrow> xa \<noteq> x \<and> dist xa x < s \<longrightarrow> \<bar>(f xa - f x) / (xa - x) - l\<bar> < - l\<rbrakk> \<Longrightarrow> 0 < ?d3
 2. \<And>h. \<lbrakk>0 < s; \<And>xa. xa \<in> S \<Longrightarrow> xa \<noteq> x \<and> dist xa x < s \<longrightarrow> \<bar>(f xa - f x) / (xa - x) - l\<bar> < - l; 0 < h; x - h \<in> S; h < ?d3\<rbrakk> \<Longrightarrow> f x < f (x - h)
[PROOF STEP]
show "0 < s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < s
[PROOF STEP]
by (rule s)
[PROOF STATE]
proof (state)
this:
0 < s

goal (1 subgoal):
 1. \<And>h. \<lbrakk>0 < s; \<And>xa. xa \<in> S \<Longrightarrow> xa \<noteq> x \<and> dist xa x < s \<longrightarrow> \<bar>(f xa - f x) / (xa - x) - l\<bar> < - l; 0 < h; x - h \<in> S; h < s\<rbrakk> \<Longrightarrow> f x < f (x - h)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>h. \<lbrakk>0 < s; \<And>xa. xa \<in> S \<Longrightarrow> xa \<noteq> x \<and> dist xa x < s \<longrightarrow> \<bar>(f xa - f x) / (xa - x) - l\<bar> < - l; 0 < h; x - h \<in> S; h < s\<rbrakk> \<Longrightarrow> f x < f (x - h)
[PROOF STEP]
fix h :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>h. \<lbrakk>0 < s; \<And>xa. xa \<in> S \<Longrightarrow> xa \<noteq> x \<and> dist xa x < s \<longrightarrow> \<bar>(f xa - f x) / (xa - x) - l\<bar> < - l; 0 < h; x - h \<in> S; h < s\<rbrakk> \<Longrightarrow> f x < f (x - h)
[PROOF STEP]
assume "0 < h" "h < s" "x - h \<in> S"
[PROOF STATE]
proof (state)
this:
0 < h
h < s
x - h \<in> S

goal (1 subgoal):
 1. \<And>h. \<lbrakk>0 < s; \<And>xa. xa \<in> S \<Longrightarrow> xa \<noteq> x \<and> dist xa x < s \<longrightarrow> \<bar>(f xa - f x) / (xa - x) - l\<bar> < - l; 0 < h; x - h \<in> S; h < s\<rbrakk> \<Longrightarrow> f x < f (x - h)
[PROOF STEP]
with all [of "x - h"]
[PROOF STATE]
proof (chain)
picking this:
x - h \<in> S \<Longrightarrow> x - h \<noteq> x \<and> dist (x - h) x < s \<longrightarrow> \<bar>(f (x - h) - f x) / (x - h - x) - l\<bar> < - l
0 < h
h < s
x - h \<in> S
[PROOF STEP]
show "f x < f (x-h)"
[PROOF STATE]
proof (prove)
using this:
x - h \<in> S \<Longrightarrow> x - h \<noteq> x \<and> dist (x - h) x < s \<longrightarrow> \<bar>(f (x - h) - f x) / (x - h - x) - l\<bar> < - l
0 < h
h < s
x - h \<in> S

goal (1 subgoal):
 1. f x < f (x - h)
[PROOF STEP]
proof (simp add: abs_if pos_less_divide_eq dist_real_def split: if_split_asm)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 < h; h < s; x - h \<in> S; - ((f (x - h) - f x) / h) < l; 2 * l + (f (x - h) - f x) / h < 0\<rbrakk> \<Longrightarrow> f x < f (x - h)
[PROOF STEP]
assume "- ((f (x-h) - f x) / h) < l" and h: "0 < h"
[PROOF STATE]
proof (state)
this:
- ((f (x - h) - f x) / h) < l
0 < h

goal (1 subgoal):
 1. \<lbrakk>0 < h; h < s; x - h \<in> S; - ((f (x - h) - f x) / h) < l; 2 * l + (f (x - h) - f x) / h < 0\<rbrakk> \<Longrightarrow> f x < f (x - h)
[PROOF STEP]
with l
[PROOF STATE]
proof (chain)
picking this:
0 < - l
- ((f (x - h) - f x) / h) < l
0 < h
[PROOF STEP]
have "0 < (f (x-h) - f x) / h"
[PROOF STATE]
proof (prove)
using this:
0 < - l
- ((f (x - h) - f x) / h) < l
0 < h

goal (1 subgoal):
 1. 0 < (f (x - h) - f x) / h
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
0 < (f (x - h) - f x) / h

goal (1 subgoal):
 1. \<lbrakk>0 < h; h < s; x - h \<in> S; - ((f (x - h) - f x) / h) < l; 2 * l + (f (x - h) - f x) / h < 0\<rbrakk> \<Longrightarrow> f x < f (x - h)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < (f (x - h) - f x) / h
[PROOF STEP]
show "f x < f (x - h)"
[PROOF STATE]
proof (prove)
using this:
0 < (f (x - h) - f x) / h

goal (1 subgoal):
 1. f x < f (x - h)
[PROOF STEP]
by (simp add: pos_less_divide_eq h)
[PROOF STATE]
proof (state)
this:
f x < f (x - h)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f x < f (x - h)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>d>0. \<forall>h>0. x - h \<in> S \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pow_is_concat_replicate: "u\<^sup>@n = concat (replicate n u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<^sup>@ n = concat (replicate n u)
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma real_dist_normal_dist: "real_distribution std_normal_distribution"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_distribution std_normal_distribution
[PROOF STEP]
using prob_space_normal_density
[PROOF STATE]
proof (prove)
using this:
0 < ?\<sigma> \<Longrightarrow> prob_space (density lborel (\<lambda>x. ennreal (normal_density ?\<mu> ?\<sigma> x)))

goal (1 subgoal):
 1. real_distribution std_normal_distribution
[PROOF STEP]
by (auto simp: real_distribution_def real_distribution_axioms_def)


[STATEMENT]
lemma hcomplex_numeral_hcmod [simp]: "hcmod (numeral v :: hcomplex) = (numeral v :: hypreal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hcmod (numeral v) = numeral v
[PROOF STEP]
by transfer (rule norm_numeral)


[STATEMENT]
lemma ordinal_plus_monoR: "y \<le> y' \<Longrightarrow> x + y \<le> x + (y'::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> y' \<Longrightarrow> x + y \<le> x + y'
[PROOF STEP]
by (rule normal.monoD[OF normal_plus])


[STATEMENT]
lemma trans_less_add2_hmset: "i < j \<Longrightarrow> i < m + j" for i j m :: hmultiset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < j \<Longrightarrow> i < m + j
[PROOF STEP]
by (simp add: add.commute trans_less_add1_hmset)


[STATEMENT]
lemma AE_borel_affine:
  fixes P :: "real \<Rightarrow> bool"
  shows "c \<noteq> 0 \<Longrightarrow> Measurable.pred borel P \<Longrightarrow> AE x in lborel. P x \<Longrightarrow> AE x in lborel. P (t + c * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> 0; Measurable.pred borel P; almost_everywhere lborel P\<rbrakk> \<Longrightarrow> AE x in lborel. P (t + c * x)
[PROOF STEP]
by (subst lborel_real_affine[where t="- t / c" and c="1 / c"])
     (simp_all add: AE_density AE_distr_iff field_simps)


[STATEMENT]
lemma cong_right_commutativity:
  assumes "Cong A B C D"
  shows "Cong A B D C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cong A B D C
[PROOF STEP]
using assms cong_left_commutativity cong_symmetry
[PROOF STATE]
proof (prove)
using this:
Cong A B C D
Cong ?A ?B ?C ?D \<Longrightarrow> Cong ?B ?A ?C ?D
Cong ?A ?B ?C ?D \<Longrightarrow> Cong ?C ?D ?A ?B

goal (1 subgoal):
 1. Cong A B D C
[PROOF STEP]
by blast


[STATEMENT]
lemma fold_bind_random_permutation_foldr:
  assumes "finite A"
  shows   "fold_bind_random_permutation f g x A =
             do {xs \<leftarrow> pmf_of_set (permutations_of_set A); g (foldr f xs x)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_bind_random_permutation f g x A = pmf_of_set (permutations_of_set A) \<bind> (\<lambda>xs. g (foldr f xs x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. fold_bind_random_permutation f g x A = pmf_of_set (permutations_of_set A) \<bind> (\<lambda>xs. g (foldr f xs x))
[PROOF STEP]
by (simp add: fold_bind_random_permutation_altdef bind_assoc_pmf
                            fold_random_permutation_foldr bind_return_pmf map_pmf_def)


[STATEMENT]
lemma (in metric_space) metric_CauchyD:
  "Cauchy X \<Longrightarrow> 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Cauchy X; 0 < e\<rbrakk> \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < e
[PROOF STEP]
by (simp add: Cauchy_def)


[STATEMENT]
lemma cindependent_some_chilbert_basis[simp]: \<open>cindependent some_chilbert_basis\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindependent some_chilbert_basis
[PROOF STEP]
using is_ortho_set_cindependent is_ortho_set_some_chilbert_basis
[PROOF STATE]
proof (prove)
using this:
is_ortho_set ?A \<Longrightarrow> cindependent ?A
is_ortho_set some_chilbert_basis

goal (1 subgoal):
 1. cindependent some_chilbert_basis
[PROOF STEP]
by blast


[STATEMENT]
theorem Class_invertible:
  "a \<in> G \<Longrightarrow> quotient.invertible (Class a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> G \<Longrightarrow> quotient.invertible (Class a)
[PROOF STEP]
by (blast intro!: Class_right_inverse Class_left_inverse)+


[STATEMENT]
lemma completely_specified_alt_def :
  "completely_specified M = (\<forall> q \<in> states M . \<forall> x \<in> inputs M . \<exists> q' y . (q,x,y,q') \<in> transitions M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_specified M = (\<forall>q\<in>FSM.states M. \<forall>x\<in>FSM.inputs M. \<exists>q' y. (q, x, y, q') \<in> FSM.transitions M)
[PROOF STEP]
by force


[STATEMENT]
lemma represents_csqrt:
  assumes alg: "p represents x" shows "(poly_nth_root 2 p) represents (csqrt x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_nth_root 2 p represents csqrt x
[PROOF STEP]
by (rule represents_nth_root[OF _ _ alg], auto)


[STATEMENT]
lemma closed_lift2_sup:
  "\<lbrakk> closed (err A) (lift2 f); closed (err B) (lift2 g) \<rbrakk> \<Longrightarrow>
  closed (err(A\<times>B)) (lift2(sup f g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closed (err A) (lift2 f); closed (err B) (lift2 g)\<rbrakk> \<Longrightarrow> closed (err (A \<times> B)) (lift2 (Product.sup f g))
[PROOF STEP]
apply (unfold closed_def plussub_def lift2_def err_def sup_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>insert Err {x. \<exists>y\<in>A. x = OK y}. \<forall>y\<in>insert Err {x. \<exists>y\<in>A. x = OK y}. (case x of Err \<Rightarrow> Err | OK x \<Rightarrow> case y of Err \<Rightarrow> Err | OK y \<Rightarrow> f x y) \<in> insert Err {x. \<exists>y\<in>A. x = OK y}; \<forall>x\<in>insert Err {x. \<exists>y\<in>B. x = OK y}. \<forall>y\<in>insert Err {x. \<exists>y\<in>B. x = OK y}. (case x of Err \<Rightarrow> Err | OK x \<Rightarrow> case y of Err \<Rightarrow> Err | OK y \<Rightarrow> g x y) \<in> insert Err {x. \<exists>y\<in>B. x = OK y}\<rbrakk> \<Longrightarrow> \<forall>x\<in>insert Err {x. \<exists>y\<in>A \<times> B. x = OK y}. \<forall>y\<in>insert Err {x. \<exists>y\<in>A \<times> B. x = OK y}. (case x of Err \<Rightarrow> Err | OK x \<Rightarrow> case y of Err \<Rightarrow> Err | OK y \<Rightarrow> (case x of (a1, b1) \<Rightarrow> \<lambda>(a2, b2). Err.sup Pair (f a1 a2) (g b1 b2)) y) \<in> insert Err {x. \<exists>y\<in>A \<times> B. x = OK y}
[PROOF STEP]
apply (simp split: err.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>y\<in>A. \<forall>ya\<in>A. f y ya = Err \<or> (\<exists>yb\<in>A. f y ya = OK yb); \<forall>y\<in>B. \<forall>ya\<in>B. g y ya = Err \<or> (\<exists>yb\<in>B. g y ya = OK yb)\<rbrakk> \<Longrightarrow> \<forall>a b. a \<in> A \<and> b \<in> B \<longrightarrow> (\<forall>aa ba. aa \<in> A \<and> ba \<in> B \<longrightarrow> f a aa = Err \<or> g b ba = Err \<or> (\<exists>x\<in>A. f a aa = OK x) \<and> (\<exists>y\<in>B. g b ba = OK y))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in sigma_algebra) countably_additive_eq:
  "(\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> countably_additive M \<mu>' = countably_additive M \<mu>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> countably_additive M \<mu>' = countably_additive M \<mu>
[PROOF STEP]
unfolding countably_additive_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> \<Union> (range A) \<in> M \<longrightarrow> (\<Sum>i. \<mu>' (A i)) = \<mu>' (\<Union> (range A))) = (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> \<Union> (range A) \<in> M \<longrightarrow> (\<Sum>i. \<mu> (A i)) = \<mu> (\<Union> (range A)))
[PROOF STEP]
by (intro arg_cong[where f=All] ext) (auto simp add: countably_additive_def subset_eq)


[STATEMENT]
lemma llcp_ltake1: "llcp (ltake n xs) ys = min n (llcp xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llcp (ltake n xs) ys = min n (llcp xs ys)
[PROOF STEP]
by(coinduction arbitrary: n xs ys rule: enat_coinduct)(auto simp add: llcp_eq_0_iff enat_min_eq_0_iff epred_llcp ltl_ltake)


[STATEMENT]
lemma dverts_combine_sub_not_combined:
  "wf_dlverts (Node r {|(t1,e1)|}) \<Longrightarrow> dverts (Node (r @ Dtree.root t1) (sucs t1))
  \<subseteq> {r@Dtree.root t1} \<union> {x. x \<in> dverts (Node r {|(t1,e1)|}) \<and> x \<noteq> r \<and> x \<noteq> Dtree.root t1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dlverts (Node r {|(t1, e1)|}) \<Longrightarrow> dverts (Node (r @ dtree.root t1) (sucs t1)) \<subseteq> {r @ dtree.root t1} \<union> {x \<in> dverts (Node r {|(t1, e1)|}). x \<noteq> r \<and> x \<noteq> dtree.root t1}
[PROOF STEP]
using dverts_combine_orig_not_combined
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_dlverts (Node ?r {|(?t1.0, ?e1.0)|}); ?x \<in> dverts (Node (?r @ dtree.root ?t1.0) (sucs ?t1.0)); ?x \<noteq> ?r @ dtree.root ?t1.0\<rbrakk> \<Longrightarrow> ?x \<in> dverts (Node ?r {|(?t1.0, ?e1.0)|}) \<and> ?x \<noteq> ?r \<and> ?x \<noteq> dtree.root ?t1.0

goal (1 subgoal):
 1. wf_dlverts (Node r {|(t1, e1)|}) \<Longrightarrow> dverts (Node (r @ dtree.root t1) (sucs t1)) \<subseteq> {r @ dtree.root t1} \<union> {x \<in> dverts (Node r {|(t1, e1)|}). x \<noteq> r \<and> x \<noteq> dtree.root t1}
[PROOF STEP]
by fast


[STATEMENT]
lemma sums_Suc:
  assumes "(\<lambda>n. f (Suc n)) sums l"
  shows "f sums (l + f 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f sums (l + f 0)
[PROOF STEP]
proof  -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f sums (l + f 0)
[PROOF STEP]
have "(\<lambda>n. (\<Sum>i<n. f (Suc i)) + f 0) \<longlonglongrightarrow> l + f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. f (Suc i)) + f 0) \<longlonglongrightarrow> l + f 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. f (Suc n)) sums l

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. f (Suc i)) + f 0) \<longlonglongrightarrow> l + f 0
[PROOF STEP]
by (auto intro!: tendsto_add simp: sums_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<Sum>i<n. f (Suc i)) + f 0) \<longlonglongrightarrow> l + f 0

goal (1 subgoal):
 1. f sums (l + f 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<Sum>i<n. f (Suc i)) + f 0) \<longlonglongrightarrow> l + f 0

goal (1 subgoal):
 1. f sums (l + f 0)
[PROOF STEP]
have "(\<Sum>i<n. f (Suc i)) + f 0 = (\<Sum>i<Suc n. f i)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. f (Suc i)) + f 0 = sum f {..<Suc n}
[PROOF STEP]
unfolding lessThan_Suc_eq_insert_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. f (Suc i)) + f 0 = sum f (insert 0 (Suc ` {..<n}))
[PROOF STEP]
by (simp add: ac_simps sum.atLeast1_atMost_eq image_Suc_lessThan)
[PROOF STATE]
proof (state)
this:
(\<Sum>i<?n. f (Suc i)) + f 0 = sum f {..<Suc ?n}

goal (1 subgoal):
 1. f sums (l + f 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (\<Sum>i<n. f (Suc i)) + f 0) \<longlonglongrightarrow> l + f 0
(\<Sum>i<?n. f (Suc i)) + f 0 = sum f {..<Suc ?n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (\<Sum>i<n. f (Suc i)) + f 0) \<longlonglongrightarrow> l + f 0
(\<Sum>i<?n. f (Suc i)) + f 0 = sum f {..<Suc ?n}

goal (1 subgoal):
 1. f sums (l + f 0)
[PROOF STEP]
by (auto simp: sums_def simp del: sum.lessThan_Suc intro: filterlim_sequentially_Suc[THEN iffD1])
[PROOF STATE]
proof (state)
this:
f sums (l + f 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma atms_of_plus[simp]: "atms_of (C + D) = atms_of C \<union> atms_of D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atms_of (C + D) = atms_of C \<union> atms_of D
[PROOF STEP]
unfolding atms_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atm_of ` set_mset (C + D) = atm_of ` set_mset C \<union> atm_of ` set_mset D
[PROOF STEP]
by auto


[STATEMENT]
lemma cut_greater_Min_greater: "
  I \<down>> t \<noteq> {} \<Longrightarrow> iMin (I \<down>> t) > t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<down>> t \<noteq> {} \<Longrightarrow> t < iMin (I \<down>> t)
[PROOF STEP]
by (rule cut_greater_bound[OF iMinI_ex2])


[STATEMENT]
lemma power_sq_power: "power_sq x n = p_power (1\<^sub>\<sigma> + x) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. power_sq x n = p_power (1\<^sub>\<sigma> + x) n
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. power_sq x 0 = p_power (1\<^sub>\<sigma> + x) 0
 2. \<And>n. power_sq x n = p_power (1\<^sub>\<sigma> + x) n \<Longrightarrow> power_sq x (Suc n) = p_power (1\<^sub>\<sigma> + x) (Suc n)
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. power_sq x n = p_power (1\<^sub>\<sigma> + x) n \<Longrightarrow> power_sq x (Suc n) = p_power (1\<^sub>\<sigma> + x) (Suc n)
[PROOF STEP]
using Suc_eq_plus1 pow_prop power_sq.simps(2)
[PROOF STATE]
proof (prove)
using this:
Suc ?n = ?n + 1
p_power (1\<^sub>\<sigma> + ?x) (?n + 1) = 1\<^sub>\<sigma> + ?x \<cdot> p_power (1\<^sub>\<sigma> + ?x) ?n
power_sq ?x (Suc ?n) = 1\<^sub>\<sigma> + ?x \<cdot> power_sq ?x ?n

goal (1 subgoal):
 1. \<And>n. power_sq x n = p_power (1\<^sub>\<sigma> + x) n \<Longrightarrow> power_sq x (Suc n) = p_power (1\<^sub>\<sigma> + x) (Suc n)
[PROOF STEP]
by simp


[STATEMENT]
lemma Lcm_fin_least:
  "Lcm\<^sub>f\<^sub>i\<^sub>n A dvd a" if "finite A" and "\<And>b. b \<in> A \<Longrightarrow> b dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm\<^sub>f\<^sub>i\<^sub>n A dvd a
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
finite A
?b1 \<in> A \<Longrightarrow> ?b1 dvd a

goal (1 subgoal):
 1. Lcm\<^sub>f\<^sub>i\<^sub>n A dvd a
[PROOF STEP]
by (induct A) simp_all


[STATEMENT]
lemma advantage\<^sub>1_nonneg: "advantage\<^sub>1 \<A> \<eta> \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> advantage\<^sub>1 \<A> \<eta>
[PROOF STEP]
by(simp add: advantage\<^sub>1_def pmf_nonneg)


[STATEMENT]
lemma continuous_within_cos: "continuous (at z within s) cos"
  for z :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at z within s) cos
[PROOF STEP]
by (simp add: continuous_within tendsto_cos)


[STATEMENT]
lemma of_int_round_ge: "of_int (round x) \<ge> x - 1/2"
  and of_int_round_le: "of_int (round x) \<le> x + 1/2"
  and of_int_round_abs_le: "\<bar>of_int (round x) - x\<bar> \<le> 1/2"
  and of_int_round_gt: "of_int (round x) > x - 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - (1::'a) / (2::'a) \<le> of_int (round x) &&& of_int (round x) \<le> x + (1::'a) / (2::'a)) &&& \<bar>of_int (round x) - x\<bar> \<le> (1::'a) / (2::'a) &&& x - (1::'a) / (2::'a) < of_int (round x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. x - (1::'a) / (2::'a) \<le> of_int (round x)
 2. of_int (round x) \<le> x + (1::'a) / (2::'a)
 3. \<bar>of_int (round x) - x\<bar> \<le> (1::'a) / (2::'a)
 4. x - (1::'a) / (2::'a) < of_int (round x)
[PROOF STEP]
from floor_correct[of "x + 1/2"]
[PROOF STATE]
proof (chain)
picking this:
of_int \<lfloor>x + (1::'a) / (2::'a)\<rfloor> \<le> x + (1::'a) / (2::'a) \<and> x + (1::'a) / (2::'a) < of_int (\<lfloor>x + (1::'a) / (2::'a)\<rfloor> + 1)
[PROOF STEP]
have "x + 1/2 < of_int (round x) + 1"
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>x + (1::'a) / (2::'a)\<rfloor> \<le> x + (1::'a) / (2::'a) \<and> x + (1::'a) / (2::'a) < of_int (\<lfloor>x + (1::'a) / (2::'a)\<rfloor> + 1)

goal (1 subgoal):
 1. x + (1::'a) / (2::'a) < of_int (round x) + (1::'a)
[PROOF STEP]
by (simp add: round_def)
[PROOF STATE]
proof (state)
this:
x + (1::'a) / (2::'a) < of_int (round x) + (1::'a)

goal (4 subgoals):
 1. x - (1::'a) / (2::'a) \<le> of_int (round x)
 2. of_int (round x) \<le> x + (1::'a) / (2::'a)
 3. \<bar>of_int (round x) - x\<bar> \<le> (1::'a) / (2::'a)
 4. x - (1::'a) / (2::'a) < of_int (round x)
[PROOF STEP]
from add_strict_right_mono[OF this, of "-1"]
[PROOF STATE]
proof (chain)
picking this:
x + (1::'a) / (2::'a) + - (1::'a) < of_int (round x) + (1::'a) + - (1::'a)
[PROOF STEP]
show A: "of_int (round x) > x - 1/2"
[PROOF STATE]
proof (prove)
using this:
x + (1::'a) / (2::'a) + - (1::'a) < of_int (round x) + (1::'a) + - (1::'a)

goal (1 subgoal):
 1. x - (1::'a) / (2::'a) < of_int (round x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x - (1::'a) / (2::'a) < of_int (round x)

goal (3 subgoals):
 1. x - (1::'a) / (2::'a) \<le> of_int (round x)
 2. of_int (round x) \<le> x + (1::'a) / (2::'a)
 3. \<bar>of_int (round x) - x\<bar> \<le> (1::'a) / (2::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - (1::'a) / (2::'a) < of_int (round x)
[PROOF STEP]
show "of_int (round x) \<ge> x - 1/2"
[PROOF STATE]
proof (prove)
using this:
x - (1::'a) / (2::'a) < of_int (round x)

goal (1 subgoal):
 1. x - (1::'a) / (2::'a) \<le> of_int (round x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x - (1::'a) / (2::'a) \<le> of_int (round x)

goal (2 subgoals):
 1. of_int (round x) \<le> x + (1::'a) / (2::'a)
 2. \<bar>of_int (round x) - x\<bar> \<le> (1::'a) / (2::'a)
[PROOF STEP]
from floor_correct[of "x + 1/2"]
[PROOF STATE]
proof (chain)
picking this:
of_int \<lfloor>x + (1::'a) / (2::'a)\<rfloor> \<le> x + (1::'a) / (2::'a) \<and> x + (1::'a) / (2::'a) < of_int (\<lfloor>x + (1::'a) / (2::'a)\<rfloor> + 1)
[PROOF STEP]
show "of_int (round x) \<le> x + 1/2"
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>x + (1::'a) / (2::'a)\<rfloor> \<le> x + (1::'a) / (2::'a) \<and> x + (1::'a) / (2::'a) < of_int (\<lfloor>x + (1::'a) / (2::'a)\<rfloor> + 1)

goal (1 subgoal):
 1. of_int (round x) \<le> x + (1::'a) / (2::'a)
[PROOF STEP]
by (simp add: round_def)
[PROOF STATE]
proof (state)
this:
of_int (round x) \<le> x + (1::'a) / (2::'a)

goal (1 subgoal):
 1. \<bar>of_int (round x) - x\<bar> \<le> (1::'a) / (2::'a)
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
x - (1::'a) / (2::'a) < of_int (round x)
of_int (round x) \<le> x + (1::'a) / (2::'a)
[PROOF STEP]
show "\<bar>of_int (round x) - x\<bar> \<le> 1/2"
[PROOF STATE]
proof (prove)
using this:
x - (1::'a) / (2::'a) < of_int (round x)
of_int (round x) \<le> x + (1::'a) / (2::'a)

goal (1 subgoal):
 1. \<bar>of_int (round x) - x\<bar> \<le> (1::'a) / (2::'a)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<bar>of_int (round x) - x\<bar> \<le> (1::'a) / (2::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_arcs_app_iso_eq:
  assumes "digraph_isomorphism hom" and "u \<in> verts G"
  shows "in_arcs (app_iso hom G) (iso_verts hom u) = iso_arcs hom ` in_arcs G u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_arcs (app_iso hom G) (iso_verts hom u) = iso_arcs hom ` in_arcs G u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
digraph_isomorphism hom
u \<in> verts G

goal (1 subgoal):
 1. in_arcs (app_iso hom G) (iso_verts hom u) = iso_arcs hom ` in_arcs G u
[PROOF STEP]
unfolding in_arcs_def
[PROOF STATE]
proof (prove)
using this:
digraph_isomorphism hom
u \<in> verts G

goal (1 subgoal):
 1. {e \<in> arcs (app_iso hom G). head (app_iso hom G) e = iso_verts hom u} = iso_arcs hom ` {e \<in> arcs G. head G e = u}
[PROOF STEP]
by (auto simp: iso_verts_head)