[STATEMENT]
lemma wp_SetDC:
  assumes wp: "\<And>s x. x \<in> S s \<Longrightarrow> P x \<tturnstile> wp (f x) Q"
      and ne: "\<And>s. S s \<noteq> {}"
      and sP: "\<And>x. sound (P x)"
  shows "(\<lambda>s. Inf ((\<lambda>x. P x s) ` S s)) \<tturnstile> wp (SetDC f S) Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lambda>s. INF x\<in>S s. P x s \<tturnstile> wp (SetDC f S) Q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> S ?s \<Longrightarrow> P ?x \<tturnstile> wp (f ?x) Q
S ?s \<noteq> {}
sound (P ?x)

goal (1 subgoal):
 1. \<lambda>s. INF x\<in>S s. P x s \<tturnstile> wp (SetDC f S) Q
[PROOF STEP]
by(intro le_funI, simp add:wp_eval, blast intro!:cInf_mono)


[STATEMENT]
lemma squarefree_prod_coprime:
  fixes f :: "'a \<Rightarrow> 'b :: factorial_semiring_gcd"
  assumes "\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<noteq> b \<Longrightarrow> coprime (f a) (f b)"
  assumes "\<And>a. a \<in> A \<Longrightarrow> squarefree (f a)"
  shows   "squarefree (prod f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. squarefree (prod f A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> A; ?b \<in> A; ?a \<noteq> ?b\<rbrakk> \<Longrightarrow> coprime (f ?a) (f ?b)
?a \<in> A \<Longrightarrow> squarefree (f ?a)

goal (1 subgoal):
 1. squarefree (prod f A)
[PROOF STEP]
by (induction A rule: infinite_finite_induct)
     (auto intro!: squarefree_mult_coprime prod_coprime_right)


[STATEMENT]
lemma div_lt_nat: "(j :: nat) < x * y \<Longrightarrow> j div x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < x * y \<Longrightarrow> j div x < y
[PROOF STEP]
by (simp add: less_mult_imp_div_less mult.commute)


[STATEMENT]
lemma euler_genus_da: "H.euler_genus = G.euler_genus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H.euler_genus = G.euler_genus
[PROOF STEP]
unfolding G.euler_genus_def H.euler_genus_def G.euler_char_def H.euler_char_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int (2 * card H.sccs) - int (card H.isolated_verts) - (int (card (verts H)) - int (card (arcs H) div 2) + int (card H.face_cycle_sets))) div 2 = (int (2 * card G.sccs) - int (card G.isolated_verts) - (int (card (verts G)) - int (card (arcs G) div 2) + int (card G.face_cycle_sets))) div 2
[PROOF STEP]
by (simp add: card_isolated_verts_da verts_H card_arcs_da card_face_cycle_sets_da card_sccs_da)


[STATEMENT]
lemma not_isFault_iff: "(\<not> isFault t) = (\<forall>f. t \<noteq> Fault f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> isFault t) = (\<forall>f. t \<noteq> Fault f)
[PROOF STEP]
by (auto elim: isFaultE)


[STATEMENT]
lemma berlekamp_basis_basis:
  "Berlekamp_subspace.basis (set (berlekamp_basis u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Berlekamp_subspace.basis (set (berlekamp_basis u))
[PROOF STEP]
proof (unfold set_berlekamp_basis_eq, rule linear_map.linear_inj_image_is_basis)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. linear_map class_ring ?V (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (Poly \<circ> list_of_vec)
 2. inj_on (Poly \<circ> list_of_vec) (carrier ?V)
 3. (Poly \<circ> list_of_vec) ` carrier ?V = carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})
 4. vectorspace.basis class_ring ?V (set (find_base_vectors (berlekamp_resulting_mat u)))
 5. vectorspace.fin_dim class_ring ?V
[PROOF STEP]
show "linear_map class_ring V W (Poly \<circ> list_of_vec)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_map class_ring V (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (Poly \<circ> list_of_vec)
[PROOF STEP]
by (rule linear_map_Poly_list_of_vec')
[PROOF STATE]
proof (state)
this:
linear_map class_ring V (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (Poly \<circ> list_of_vec)

goal (4 subgoals):
 1. inj_on (Poly \<circ> list_of_vec) (carrier V)
 2. (Poly \<circ> list_of_vec) ` carrier V = carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})
 3. V.basis (set (find_base_vectors (berlekamp_resulting_mat u)))
 4. V.fin_dim
[PROOF STEP]
show "inj_on (Poly \<circ> list_of_vec) (carrier V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (Poly \<circ> list_of_vec) (carrier V)
[PROOF STEP]
proof (rule subset_inj_on[OF inj_Poly_list_of_vec])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. carrier V \<subseteq> carrier_vec ?n1
[PROOF STEP]
show "carrier V \<subseteq> carrier_vec (degree u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier V \<subseteq> carrier_vec (degree u)
[PROOF STEP]
by (auto simp add: mat_kernel_def)
[PROOF STATE]
proof (state)
this:
carrier V \<subseteq> carrier_vec (degree u)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on (Poly \<circ> list_of_vec) (carrier V)

goal (3 subgoals):
 1. (Poly \<circ> list_of_vec) ` carrier V = carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})
 2. V.basis (set (find_base_vectors (berlekamp_resulting_mat u)))
 3. V.fin_dim
[PROOF STEP]
show "(Poly \<circ> list_of_vec) ` carrier V = carrier W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Poly \<circ> list_of_vec) ` carrier V = carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})
[PROOF STEP]
using surj_Poly_list_of_vec[OF deg_u0]
[PROOF STATE]
proof (prove)
using this:
(Poly \<circ> list_of_vec) ` carrier V = carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})

goal (1 subgoal):
 1. (Poly \<circ> list_of_vec) ` carrier V = carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Poly \<circ> list_of_vec) ` carrier V = carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})

goal (2 subgoals):
 1. V.basis (set (find_base_vectors (berlekamp_resulting_mat u)))
 2. V.fin_dim
[PROOF STEP]
show b: "V.basis (set (find_base_vectors (berlekamp_resulting_mat u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V.basis (set (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
by (rule berlekamp_resulting_mat_basis)
[PROOF STATE]
proof (state)
this:
V.basis (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. V.fin_dim
[PROOF STEP]
show "V.fin_dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V.fin_dim
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V.fin_dim
[PROOF STEP]
have "finite (set (find_base_vectors (berlekamp_resulting_mat u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. V.fin_dim
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. V.fin_dim
[PROOF STEP]
have "set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V"
    and "V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V &&& V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
V.basis (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V &&& V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
unfolding V.basis_def
[PROOF STATE]
proof (prove)
using this:
V.lin_indpt (set (find_base_vectors (berlekamp_resulting_mat u))) \<and> V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u))) \<and> set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V

goal (1 subgoal):
 1. set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V &&& V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V
V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. V.fin_dim
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (set (find_base_vectors (berlekamp_resulting_mat u)))
set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V
V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (set (find_base_vectors (berlekamp_resulting_mat u)))
set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V
V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. V.fin_dim
[PROOF STEP]
unfolding V.fin_dim_def
[PROOF STATE]
proof (prove)
using this:
finite (set (find_base_vectors (berlekamp_resulting_mat u)))
set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier V
V.gen_set (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. \<exists>A. finite A \<and> A \<subseteq> carrier V \<and> V.gen_set A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V.fin_dim

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
V.fin_dim

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<alpha>_limit_set_eq:
  assumes "{..0} \<subseteq> existence_ivl0 x"
  shows "\<alpha>_limit_set x = (INF \<tau> \<in> {..0}. closure (flow0 x ` {..\<tau>}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha>_limit_set x = (\<Inter>\<tau>\<le>0. closure (flow0 x ` {..\<tau>}))
[PROOF STEP]
using rev.\<omega>_limit_set_eq[of x, OF assms[folded infinite_rev_existence_ivl0_rewrites]]
[PROOF STATE]
proof (prove)
using this:
rev.\<omega>_limit_set x = (\<Inter>\<tau>\<in>{0..}. closure (rev.flow0 x ` {\<tau>..}))

goal (1 subgoal):
 1. \<alpha>_limit_set x = (\<Inter>\<tau>\<le>0. closure (flow0 x ` {..\<tau>}))
[PROOF STEP]
unfolding \<alpha>_limit_set_eq_rev rev_flow_image_eq image_uminus_atLeast
[PROOF STATE]
proof (prove)
using this:
rev.\<omega>_limit_set x = (\<Inter>\<tau>\<in>{0..}. closure (flow0 x ` {..- \<tau>}))

goal (1 subgoal):
 1. rev.\<omega>_limit_set x = (\<Inter>\<tau>\<le>0. closure (flow0 x ` {..\<tau>}))
[PROOF STEP]
by (smt INT_extend_simps(10) Sup.SUP_cong image_uminus_atMost)


[STATEMENT]
lemma powhr_powhr: "\<And>a b x. (x powhr a) powhr b = x powhr (a * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b x. (x powhr a) powhr b = x powhr (a * b)
[PROOF STEP]
by transfer (rule powr_powr)


[STATEMENT]
lemma sgn_conic_sgn: "sgn (conic_sgn p) = conic_sgn p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (conic_sgn p) = conic_sgn p
[PROOF STEP]
by (unfold conic_sgn_def) simp


[STATEMENT]
lemma [simp]: "(r < s-(1::real)) = (r+1 < s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r < s - 1) = (r + 1 < s)
[PROOF STEP]
by arith


[STATEMENT]
lemma homeomorphic_rel_boundaries:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "S homeomorphic T" "rel_interior S = {} \<longleftrightarrow> rel_interior T = {}"
    shows "(S - rel_interior S) homeomorphic (T - rel_interior T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
proof (cases "rel_interior T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel_interior T = {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
 2. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
rel_interior T = {}

goal (2 subgoals):
 1. rel_interior T = {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
 2. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
rel_interior T = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
rel_interior T = {}

goal (1 subgoal):
 1. S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S - rel_interior S homeomorphic T - rel_interior T

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
rel_interior T \<noteq> {}

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
obtain f g
    where S: "\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x" and T: "\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y"
      and contf: "continuous_on S f" and contg: "continuous_on T g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using  assms [unfolded homeomorphic_minimal]
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
(rel_interior S = {}) = (rel_interior T = {})

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
have "aff_dim (affine hull S) \<le> aff_dim (affine hull T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
using False assms homeomorphic_aff_dim_le
[PROOF STATE]
proof (prove)
using this:
rel_interior T \<noteq> {}
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
\<lbrakk>?S homeomorphic ?T; rel_interior ?S \<noteq> {}\<rbrakk> \<Longrightarrow> aff_dim (affine hull ?S) \<le> aff_dim (affine hull ?T)

goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
have "aff_dim (affine hull T) \<le> aff_dim (affine hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
by (meson False assms(1) homeomorphic_aff_dim_le homeomorphic_sym)
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull T) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
have "aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
using this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
aff_dim (affine hull T) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. aff_dim S = aff_dim T
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
aff_dim S = aff_dim T

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim S = aff_dim T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim S = aff_dim T

goal (1 subgoal):
 1. S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
by (rule homeomorphic_rel_boundaries_same_dimension [OF \<open>S homeomorphic T\<close>])
[PROOF STATE]
proof (state)
this:
S - rel_interior S homeomorphic T - rel_interior T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fold_bind_random_permutation_foldl:
  assumes "finite A"
  shows   "fold_bind_random_permutation f g x A =
             do {xs \<leftarrow> pmf_of_set (permutations_of_set A); g (foldl (\<lambda>x y. f y x) x xs)}"
[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 (foldl (\<lambda>x y. f y x) x xs))
[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 (foldl (\<lambda>x y. f y x) x xs))
[PROOF STEP]
by (simp add: fold_bind_random_permutation_altdef bind_assoc_pmf
                            fold_random_permutation_foldl bind_return_pmf map_pmf_def)


[STATEMENT]
lemma subset_Collect_conv: "S \<subseteq> Collect P \<longleftrightarrow> (\<forall>x\<in>S. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<subseteq> Collect P) = (\<forall>x\<in>S. P x)
[PROOF STEP]
by auto


[STATEMENT]
lemma assoc_ell2'_tensor: \<open>assoc_ell2' *\<^sub>V tensor_ell2 a (tensor_ell2 b c) = tensor_ell2 (tensor_ell2 a b) c\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. assoc_ell2' *\<^sub>V a \<otimes>\<^sub>s b \<otimes>\<^sub>s c = (a \<otimes>\<^sub>s b) \<otimes>\<^sub>s c
[PROOF STEP]
apply (rule clinear_equal_ket[THEN fun_cong, where x=a])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. clinear (\<lambda>a. assoc_ell2' *\<^sub>V a \<otimes>\<^sub>s b \<otimes>\<^sub>s c)
 2. clinear (\<lambda>a. (a \<otimes>\<^sub>s b) \<otimes>\<^sub>s c)
 3. \<And>i. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s b \<otimes>\<^sub>s c = (ket i \<otimes>\<^sub>s b) \<otimes>\<^sub>s c
[PROOF STEP]
apply (simp add: cblinfun.add_right clinearI tensor_ell2_add1 tensor_ell2_scaleC1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. clinear (\<lambda>a. (a \<otimes>\<^sub>s b) \<otimes>\<^sub>s c)
 2. \<And>i. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s b \<otimes>\<^sub>s c = (ket i \<otimes>\<^sub>s b) \<otimes>\<^sub>s c
[PROOF STEP]
apply (simp add: clinearI tensor_ell2_add1 tensor_ell2_scaleC1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s b \<otimes>\<^sub>s c = (ket i \<otimes>\<^sub>s b) \<otimes>\<^sub>s c
[PROOF STEP]
apply (rule clinear_equal_ket[THEN fun_cong, where x=b])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i. clinear (\<lambda>a. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s a \<otimes>\<^sub>s c)
 2. \<And>i. clinear (\<lambda>a. (ket i \<otimes>\<^sub>s a) \<otimes>\<^sub>s c)
 3. \<And>i ia. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s ket ia \<otimes>\<^sub>s c = (ket i \<otimes>\<^sub>s ket ia) \<otimes>\<^sub>s c
[PROOF STEP]
apply (simp add: cblinfun.add_right clinearI tensor_ell2_add1 tensor_ell2_add2 tensor_ell2_scaleC1 tensor_ell2_scaleC2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. clinear (\<lambda>a. (ket i \<otimes>\<^sub>s a) \<otimes>\<^sub>s c)
 2. \<And>i ia. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s ket ia \<otimes>\<^sub>s c = (ket i \<otimes>\<^sub>s ket ia) \<otimes>\<^sub>s c
[PROOF STEP]
apply (simp add: clinearI tensor_ell2_add1 tensor_ell2_add2 tensor_ell2_scaleC1 tensor_ell2_scaleC2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s ket ia \<otimes>\<^sub>s c = (ket i \<otimes>\<^sub>s ket ia) \<otimes>\<^sub>s c
[PROOF STEP]
apply (rule clinear_equal_ket[THEN fun_cong, where x=c])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i ia. clinear (\<lambda>a. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s ket ia \<otimes>\<^sub>s a)
 2. \<And>i ia. clinear ((\<otimes>\<^sub>s) (ket i \<otimes>\<^sub>s ket ia))
 3. \<And>i ia ib. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s ket ia \<otimes>\<^sub>s ket ib = (ket i \<otimes>\<^sub>s ket ia) \<otimes>\<^sub>s ket ib
[PROOF STEP]
apply (simp add: cblinfun.add_right clinearI tensor_ell2_add2 tensor_ell2_scaleC2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i ia. clinear ((\<otimes>\<^sub>s) (ket i \<otimes>\<^sub>s ket ia))
 2. \<And>i ia ib. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s ket ia \<otimes>\<^sub>s ket ib = (ket i \<otimes>\<^sub>s ket ia) \<otimes>\<^sub>s ket ib
[PROOF STEP]
apply (simp add: clinearI tensor_ell2_add2 tensor_ell2_scaleC2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia ib. assoc_ell2' *\<^sub>V ket i \<otimes>\<^sub>s ket ia \<otimes>\<^sub>s ket ib = (ket i \<otimes>\<^sub>s ket ia) \<otimes>\<^sub>s ket ib
[PROOF STEP]
unfolding assoc_ell2'.rep_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia ib. assoc_ell20' (ket i \<otimes>\<^sub>s ket ia \<otimes>\<^sub>s ket ib) = (ket i \<otimes>\<^sub>s ket ia) \<otimes>\<^sub>s ket ib
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i ia ib. (\<lambda>((a, b), c). case (a, b, c) of (ic, j) \<Rightarrow> (if i = ic then 1 else 0) * (case j of (i, j) \<Rightarrow> (if ia = i then 1 else 0) * (if ib = j then 1 else 0))) = (\<lambda>(ic, j). (case ic of (ib, j) \<Rightarrow> (if i = ib then 1 else 0) * (if ia = j then 1 else 0)) * (if ib = j then 1 else 0))
[PROOF STEP]
by auto


[STATEMENT]
theorem notin_List_update[simp]:
 "\<And>x. a \<notin> set as \<Longrightarrow> List (h(a := y)) x as = List h x as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. a \<notin> set as \<Longrightarrow> List (h(a := y)) x as = List h x as
[PROOF STEP]
apply(induct as)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. a \<notin> set [] \<Longrightarrow> List (h(a := y)) x [] = List h x []
 2. \<And>aa as x. \<lbrakk>\<And>x. a \<notin> set as \<Longrightarrow> List (h(a := y)) x as = List h x as; a \<notin> set (aa # as)\<rbrakk> \<Longrightarrow> List (h(a := y)) x (aa # as) = List h x (aa # as)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa as x. \<lbrakk>\<And>x. a \<notin> set as \<Longrightarrow> List (h(a := y)) x as = List h x as; a \<notin> set (aa # as)\<rbrakk> \<Longrightarrow> List (h(a := y)) x (aa # as) = List h x (aa # as)
[PROOF STEP]
apply(clarsimp simp add:fun_upd_apply)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma from_hma\<^sub>v_diff: "from_hma\<^sub>v v - from_hma\<^sub>v w = from_hma\<^sub>v (v - w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mod_Type_Connect.from_hma\<^sub>v v - Mod_Type_Connect.from_hma\<^sub>v w = Mod_Type_Connect.from_hma\<^sub>v (v - w)
[PROOF STEP]
unfolding from_hma\<^sub>v_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.vec CARD('b) (\<lambda>i. v $h mod_type_class.from_nat i) - Matrix.vec CARD('b) (\<lambda>i. w $h mod_type_class.from_nat i) = Matrix.vec CARD('b) (\<lambda>i. (v - w) $h mod_type_class.from_nat i)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in \<Z>) op_cf_cf_scospan[cat_op_simps]:
  "op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>) = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>) = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>) = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>
[PROOF STEP]
have dom_lhs: "\<D>\<^sub>\<circ> (op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>)) = 4\<^sub>\<nat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>)) = 4\<^sub>\<nat>
[PROOF STEP]
unfolding op_cf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> [\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>\<lparr>ObjMap\<rparr>, \<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>\<lparr>ArrMap\<rparr>, op_cat (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>\<lparr>HomDom\<rparr>), op_cat (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>\<lparr>HomCod\<rparr>)]\<^sub>\<circ> = 4\<^sub>\<nat>
[PROOF STEP]
by (simp add: nat_omega_simps)
[PROOF STATE]
proof (state)
this:
\<D>\<^sub>\<circ> (op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>)) = 4\<^sub>\<nat>

goal (1 subgoal):
 1. op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>) = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>
[PROOF STEP]
have dom_rhs: "\<D>\<^sub>\<circ> (\<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>) = 4\<^sub>\<nat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>) = 4\<^sub>\<nat>
[PROOF STEP]
unfolding the_cf_scospan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> [\<lambda>a\<in>\<^sub>\<circ>\<rightarrow>\<bullet>\<leftarrow>\<^sub>C\<lparr>Obj\<rparr>. if a = \<aa>\<^sub>S\<^sub>S \<Rightarrow> \<aa> | a = \<bb>\<^sub>S\<^sub>S \<Rightarrow> \<bb> | otherwise \<Rightarrow> \<oo>, \<lambda>f\<in>\<^sub>\<circ>\<rightarrow>\<bullet>\<leftarrow>\<^sub>C\<lparr>Arr\<rparr>. if f = \<aa>\<^sub>S\<^sub>S \<Rightarrow> op_cat \<CC>\<lparr>CId\<rparr>\<lparr>\<aa>\<rparr> | f = \<bb>\<^sub>S\<^sub>S \<Rightarrow> op_cat \<CC>\<lparr>CId\<rparr>\<lparr>\<bb>\<rparr> | f = \<gg>\<^sub>S\<^sub>S \<Rightarrow> \<gg> | f = \<ff>\<^sub>S\<^sub>S \<Rightarrow> \<ff> | otherwise \<Rightarrow> op_cat \<CC>\<lparr>CId\<rparr>\<lparr>\<oo>\<rparr>, \<rightarrow>\<bullet>\<leftarrow>\<^sub>C, op_cat \<CC>]\<^sub>\<circ> = 4\<^sub>\<nat>
[PROOF STEP]
by (simp add: nat_omega_simps)
[PROOF STATE]
proof (state)
this:
\<D>\<^sub>\<circ> (\<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>) = 4\<^sub>\<nat>

goal (1 subgoal):
 1. op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>) = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>) = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>
[PROOF STEP]
proof(rule vsv_eqI, unfold dom_lhs dom_rhs)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. vsv (op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>))
 2. vsv (\<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>)
 3. 4\<^sub>\<nat> = 4\<^sub>\<nat>
 4. \<And>a. a \<in>\<^sub>\<circ> 4\<^sub>\<nat> \<Longrightarrow> op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>)\<lparr>a\<rparr> = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>\<lparr>a\<rparr>
[PROOF STEP]
show "op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>)\<lparr>a\<rparr> = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>\<lparr>a\<rparr>"
      if "a \<in>\<^sub>\<circ> 4\<^sub>\<nat>" for a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>)\<lparr>a\<rparr> = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>\<lparr>a\<rparr>
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
a \<in>\<^sub>\<circ> 4\<^sub>\<nat>

goal (1 subgoal):
 1. op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>)\<lparr>a\<rparr> = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>\<lparr>a\<rparr>
[PROOF STEP]
by
        (
          elim_in_numeral,
          fold dghm_field_simps,
          unfold cat_op_simps the_cf_sspan_components the_cf_scospan_components
        )
        (
          simp_all add:
            the_cat_scospan_components(1,2)
            the_cat_sspan_components(1,2)
            cat_op_simps
        )
[PROOF STATE]
proof (state)
this:
?a \<in>\<^sub>\<circ> 4\<^sub>\<nat> \<Longrightarrow> op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>)\<lparr>?a\<rparr> = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>\<lparr>?a\<rparr>

goal (3 subgoals):
 1. vsv (op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>))
 2. vsv (\<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>)
 3. 4\<^sub>\<nat> = 4\<^sub>\<nat>
[PROOF STEP]
qed (auto intro: cat_op_intros cat_ss_cs_intros)
[PROOF STATE]
proof (state)
this:
op_cf (\<langle>\<aa>\<leftarrow>\<gg>\<leftarrow>\<oo>\<rightarrow>\<ff>\<rightarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>\<CC>\<^esub>) = \<langle>\<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb>\<rangle>\<^sub>C\<^sub>F\<^bsub>op_cat \<CC>\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma c_ballI:
  assumes "x \<in> carrier Q\<^sub>p"
  assumes " val (x \<ominus> c) \<ge> n"
  shows "x \<in> c_ball n c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> B\<^bsub>n\<^esub>[c]
[PROOF STEP]
using assms c_ball_def
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Q\<^sub>p
eint n \<le> val (x \<ominus> c)
B\<^bsub>?n\<^esub>[?c] = {x \<in> carrier Q\<^sub>p. eint ?n \<le> val (x \<ominus> ?c)}

goal (1 subgoal):
 1. x \<in> B\<^bsub>n\<^esub>[c]
[PROOF STEP]
by blast


[STATEMENT]
lemma int_mod_zmod: "int (a mod b) = (int a) mod (int b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (a mod b) = int a mod int b
[PROOF STEP]
by (rule zmod_int)


[STATEMENT]
lemma "\<not>(\<exists>x. S(x)\<and>Q(x)) \<and> (\<forall>x. P(x) \<longrightarrow> Q(x)\<or>R(x)) \<and>
     (\<not>(\<exists>x. P(x)) \<longrightarrow> (\<exists>x. Q(x))) \<and> (\<forall>x. Q(x)\<or>R(x) \<longrightarrow> S(x))
    \<longrightarrow> (\<exists>x. P(x)\<and>R(x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>x. S x \<and> Q x) \<and> (\<forall>x. P x \<longrightarrow> Q x \<or> R x) \<and> ((\<nexists>x. P x) \<longrightarrow> (\<exists>x. Q x)) \<and> (\<forall>x. Q x \<or> R x \<longrightarrow> S x) \<longrightarrow> (\<exists>x. P x \<and> R x)
[PROOF STEP]
by blast


[STATEMENT]
lemma octo_subtract_cnj:
  "q - cnj q = 2 *\<^sub>R (Im1 q *\<^sub>R e1 + Im2 q *\<^sub>R e2 + Im3 q *\<^sub>R e3 +
                     Im4 q *\<^sub>R e4 + Im5 q *\<^sub>R e5 + Im6 q*\<^sub>R e6 + Im7 q *\<^sub>R e7)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q - Octonions.cnj q = 2 *\<^sub>R (Im1 q *\<^sub>R e1 + Im2 q *\<^sub>R e2 + Im3 q *\<^sub>R e3 + Im4 q *\<^sub>R e4 + Im5 q *\<^sub>R e5 + Im6 q *\<^sub>R e6 + Im7 q *\<^sub>R e7)
[PROOF STEP]
by (simp add: octo_eq_iff)


[STATEMENT]
lemma Int_empty_sum:"
  (\<Sum>k\<le>(n::nat). if {} \<inter> (I k) = {} then 0 else Suc 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. if {} \<inter> I k = {} then 0 else Suc 0) = 0
[PROOF STEP]
apply (rule sum_eq_0_iff[THEN iffD2])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {..n}
 2. \<forall>a\<in>{..n}. (if {} \<inter> I a = {} then 0 else Suc 0) = 0
[PROOF STEP]
apply (rule finite_atMost)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a\<in>{..n}. (if {} \<inter> I a = {} then 0 else Suc 0) = 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "filterlim (\<lambda>x::real. 4/9 * (exp (exp (5/2*x powr (-5/7) + 21/8*x powr (6/11) +
              2*x powr (-8) + 54/17*x powr (49/45))) ^ 8) / (ln (ln (-ln (4/3*x powr (-5/14))))))
         at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. 4 / 9 * exp (exp (5 / 2 * x powr (- 5 / 7) + 21 / 8 * x powr (6 / 11) + 2 * x powr - 8 + 54 / 17 * x powr (49 / 45))) ^ 8 / ln (ln (- ln (4 / 3 * x powr (- 5 / 14)))) :> at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma revorder_eq_mset: "mset (revorder t) = relations_mset t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (revorder t) = relations_mset t
[PROOF STEP]
by(induction t) (auto)


[STATEMENT]
lemma DIM_complex[simp]: "DIM(complex) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. DIM(complex) = 2
[PROOF STEP]
unfolding Basis_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {1, \<i>} = 2
[PROOF STEP]
by simp


[STATEMENT]
lemma rbbl_Cons: "b # rev (bin_to_bl n x) = rev (bin_to_bl (Suc n) (of_bool b + 2 * x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b # rev (bin_to_bl n x) = rev (bin_to_bl (Suc n) (of_bool b + 2 * x))
[PROOF STEP]
by (simp add: bin_to_bl_def) (simp add: bin_to_bl_aux_alt)


[STATEMENT]
lemma ftrancl_map_both_fsubset:
  "finj_on f X \<Longrightarrow> R |\<subseteq>| X |\<times>| X \<Longrightarrow> (map_both f |`| R)|\<^sup>+| = map_both f |`| R|\<^sup>+|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finj_on f X; R |\<subseteq>| X |\<times>| X\<rbrakk> \<Longrightarrow> (map_both f |`| R)|\<^sup>+| = map_both f |`| R|\<^sup>+|
[PROOF STEP]
using ftrancl_map_both_fRestr[of f X R]
[PROOF STATE]
proof (prove)
using this:
finj_on f X \<Longrightarrow> (map_both f |`| (R |\<inter>| X |\<times>| X))|\<^sup>+| = map_both f |`| (R |\<inter>| X |\<times>| X)|\<^sup>+|

goal (1 subgoal):
 1. \<lbrakk>finj_on f X; R |\<subseteq>| X |\<times>| X\<rbrakk> \<Longrightarrow> (map_both f |`| R)|\<^sup>+| = map_both f |`| R|\<^sup>+|
[PROOF STEP]
by (simp add: inf_absorb1)


[STATEMENT]
lemma fmdrop_fmupd: "fmdrop x (fmupd y z m) = (if x = y then fmdrop x m else fmupd y z (fmdrop x m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmdrop x (fmupd y z m) = (if x = y then fmdrop x m else fmupd y z (fmdrop x m))
[PROOF STEP]
by transfer' (auto simp: map_drop_def map_filter_def map_upd_def)


[STATEMENT]
lemma bigo_const_mult [simp]: "(c::'a::linordered_field) \<noteq> 0 \<Longrightarrow>
    O(\<lambda>x. c * f x) = O(f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> O(\<lambda>x. c * f x) = O(f)
[PROOF STEP]
by (metis equalityI bigo_const_mult2 bigo_const_mult4)


[STATEMENT]
lemma of_nat_0:
  "\<lbrakk>of_nat n = (0::'a::len word); n < 2 ^ LENGTH('a)\<rbrakk> \<Longrightarrow> n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>word_of_nat n = 0; n < 2 ^ LENGTH('a)\<rbrakk> \<Longrightarrow> n = 0
[PROOF STEP]
by (auto simp add: word_of_nat_eq_0_iff)


[STATEMENT]
lemma PosOrd_assym:
  assumes "v1 :\<sqsubset>val v2"
  shows "\<not>(v2 :\<sqsubset>val v1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> v2 :\<sqsubset>val v1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v1 :\<sqsubset>val v2

goal (1 subgoal):
 1. \<not> v2 :\<sqsubset>val v1
[PROOF STEP]
using PosOrd_irrefl PosOrd_trans
[PROOF STATE]
proof (prove)
using this:
v1 :\<sqsubset>val v2
?v :\<sqsubset>val ?v \<Longrightarrow> False
\<lbrakk>?v1.0 :\<sqsubset>val ?v2.0; ?v2.0 :\<sqsubset>val ?v3.0\<rbrakk> \<Longrightarrow> ?v1.0 :\<sqsubset>val ?v3.0

goal (1 subgoal):
 1. \<not> v2 :\<sqsubset>val v1
[PROOF STEP]
by blast


[STATEMENT]
lemma mod_partition_count_Suc: "
  {k. k \<le> Suc n \<and> I \<inter> [k * d\<dots>,d - Suc 0] \<noteq> {}} =
  {k. k \<le> n \<and> I \<inter> [k * d\<dots>,d - Suc 0] \<noteq> {}} \<union>
    (if I \<inter> [Suc n * d\<dots>,d - Suc 0] \<noteq> {} then {Suc n} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {k. k \<le> Suc n \<and> I \<inter> [k * d\<dots>,d - Suc 0] \<noteq> {}} = {k. k \<le> n \<and> I \<inter> [k * d\<dots>,d - Suc 0] \<noteq> {}} \<union> (if I \<inter> [Suc n * d\<dots>,d - Suc 0] \<noteq> {} then {Suc n} else {})
[PROOF STEP]
apply (rule set_eqI, rename_tac x)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (x \<in> {k. k \<le> Suc n \<and> I \<inter> [k * d\<dots>,d - Suc 0] \<noteq> {}}) = (x \<in> {k. k \<le> n \<and> I \<inter> [k * d\<dots>,d - Suc 0] \<noteq> {}} \<union> (if I \<inter> [Suc n * d\<dots>,d - Suc 0] \<noteq> {} then {Suc n} else {}))
[PROOF STEP]
apply (simp add: le_less[of _ "Suc n"] less_Suc_eq_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (I \<inter> [d + n * d\<dots>,d - Suc 0] \<noteq> {} \<longrightarrow> ((x \<le> n \<or> x = Suc n) \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}) = (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {} \<or> x = Suc n)) \<and> (I \<inter> [d + n * d\<dots>,d - Suc 0] = {} \<longrightarrow> ((x \<le> n \<or> x = Suc n) \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}) = (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}))
[PROOF STEP]
apply (simp add: conj_disj_distribR)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (I \<inter> [d + n * d\<dots>,d - Suc 0] \<noteq> {} \<longrightarrow> (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {} \<or> x = Suc n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}) = (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {} \<or> x = Suc n)) \<and> (I \<inter> [d + n * d\<dots>,d - Suc 0] = {} \<longrightarrow> (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {} \<or> x = Suc n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}) = (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}))
[PROOF STEP]
apply (intro conjI impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. I \<inter> [d + n * d\<dots>,d - Suc 0] \<noteq> {} \<Longrightarrow> (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {} \<or> x = Suc n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}) = (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {} \<or> x = Suc n)
 2. \<And>x. I \<inter> [d + n * d\<dots>,d - Suc 0] = {} \<Longrightarrow> (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {} \<or> x = Suc n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}) = (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {})
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. I \<inter> [d + n * d\<dots>,d - Suc 0] = {} \<Longrightarrow> (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {} \<or> x = Suc n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {}) = (x \<le> n \<and> I \<inter> [x * d\<dots>,d - Suc 0] \<noteq> {})
[PROOF STEP]
apply (rule iffI, clarsimp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma \<phi>_zero_iff:
  "\<phi> (l,i) x = 0 \<longleftrightarrow> x \<notin> {real_of_int (i - 1) / 2^(l + 1) <..< real_of_int (i + 1) / 2^(l + 1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<phi> (l, i) x = 0) = (x \<notin> {real_of_int (i - 1) / 2 ^ (l + 1)<..<real_of_int (i + 1) / 2 ^ (l + 1)})
[PROOF STEP]
by (auto simp: \<phi>_def field_simps split: split_max)


[STATEMENT]
lemma set_stake_snth: "x \<in> set (stake n xs) \<longleftrightarrow> (\<exists> i < n. xs !! i = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set (stake n xs)) = (\<exists>i<n. xs !! i = x)
[PROOF STEP]
unfolding in_set_conv_nth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>i<length (stake n xs). stake n xs ! i = x) = (\<exists>i<n. xs !! i = x)
[PROOF STEP]
by auto


[STATEMENT]
lemma card_Field_natLeq_on:
"card(Field(natLeq_on n)) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (Field (natLeq_on n)) = n
[PROOF STEP]
using Field_natLeq_on card_atLeastLessThan
[PROOF STATE]
proof (prove)
using this:
Field (natLeq_on ?n) = {x. x < ?n}
card {?l..<?u} = ?u - ?l

goal (1 subgoal):
 1. card (Field (natLeq_on n)) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma E4_R: "\<turnstile>\<^sub>3 {\<up>(v>0) ** $(2*v) ** pointsto ''x'' (int v) }
            ''x'' ::= Plus (V ''x'') (N (- 1))
           {\<up>(v>0) ** $(2*v-1) ** pointsto ''x'' (int v-1) }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile>\<^sub>3 {\<up> (0 < v) \<and>* $ (2 * v) \<and>* ''x'' \<hookrightarrow> int v} ''x'' ::= Plus (V ''x'') (N (- 1)) { \<up> (0 < v) \<and>* $ (2 * v - 1) \<and>* ''x'' \<hookrightarrow> int v - 1}
[PROOF STEP]
apply(rule pureI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < v \<Longrightarrow> \<turnstile>\<^sub>3 {$ (2 * v) \<and>* ''x'' \<hookrightarrow> int v} ''x'' ::= Plus (V ''x'') (N (- 1)) { \<up> (0 < v) \<and>* $ (2 * v - 1) \<and>* ''x'' \<hookrightarrow> int v - 1}
[PROOF STEP]
apply(rule strongAssign)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 < v \<Longrightarrow> symeval ($ (2 * v) \<and>* ''x'' \<hookrightarrow> int v) (Plus (V ''x'') (N (- 1))) ?v2
 2. 0 < v \<Longrightarrow> Frame ($ (2 * v) \<and>* ''x'' \<hookrightarrow> int v) ($ 1 \<and>* ''x'' \<hookrightarrow> ?ds2) ?F2
 3. \<And>s. \<lbrakk>0 < v; (''x'' \<hookrightarrow> ?v2 \<and>* ?F2) s\<rbrakk> \<Longrightarrow> (\<up> (0 < v) \<and>* $ (2 * v - 1) \<and>* ''x'' \<hookrightarrow> int v - 1) s
[PROOF STEP]
apply(rule symeval | frame_inference)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>0 < v; (''x'' \<hookrightarrow> int v + - 1 \<and>* $ (2 * v - 1)) s\<rbrakk> \<Longrightarrow> (\<up> (0 < v) \<and>* $ (2 * v - 1) \<and>* ''x'' \<hookrightarrow> int v - 1) s
[PROOF STEP]
by (simp add:  sep_reorder_dollar )


[STATEMENT]
lemma ennreal_suminf_neq_top: "summable f \<Longrightarrow> (\<And>i. 0 \<le> f i) \<Longrightarrow> (\<Sum>i. ennreal (f i)) \<noteq> top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>i. 0 \<le> f i\<rbrakk> \<Longrightarrow> (\<Sum>i. ennreal (f i)) \<noteq> top
[PROOF STEP]
using sums_ennreal[of f "suminf f"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. 0 \<le> f i; 0 \<le> suminf f\<rbrakk> \<Longrightarrow> (\<lambda>i. ennreal (f i)) sums ennreal (suminf f) = f sums suminf f

goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>i. 0 \<le> f i\<rbrakk> \<Longrightarrow> (\<Sum>i. ennreal (f i)) \<noteq> top
[PROOF STEP]
by (simp add: suminf_nonneg flip: sums_unique summable_sums_iff del: sums_ennreal)


[STATEMENT]
lemma continuous_on_max [continuous_intros]:
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
  shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. max (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>x. max (f x) (g x))
[PROOF STEP]
by (auto simp: continuous_on_def intro!: tendsto_max)


[STATEMENT]
lemma inv_one_sub_Q':
  fixes Q :: "'c :: banach \<Rightarrow>\<^sub>L 'c"
  assumes onorm_le: "norm (id_blinfun - Q) < 1"
  shows "inv\<^sub>L Q = (\<Sum>i. (id_blinfun - Q)^^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv\<^sub>L Q = (\<Sum>i. (id_blinfun - Q) ^^ i)
[PROOF STEP]
by (metis inv\<^sub>L_I inv_one_sub_Q assms)


[STATEMENT]
lemma connecting_path_gen_str: "connecting_path u v xs \<Longrightarrow> (\<not> is_cycle xs) \<Longrightarrow> walk_length xs > 0 \<Longrightarrow> connecting_path_str u v xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connecting_path u v xs; \<not> is_cycle xs; 0 < walk_length xs\<rbrakk> \<Longrightarrow> connecting_path_str u v xs
[PROOF STEP]
unfolding connecting_path_def connecting_path_str_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_gen_path xs \<and> hd xs = u \<and> last xs = v; \<not> is_cycle xs; 0 < walk_length xs\<rbrakk> \<Longrightarrow> is_path xs \<and> hd xs = u \<and> last xs = v
[PROOF STEP]
using is_gen_path_path
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_gen_path ?p; 0 < walk_length ?p; \<not> is_cycle ?p\<rbrakk> \<Longrightarrow> is_path ?p

goal (1 subgoal):
 1. \<lbrakk>is_gen_path xs \<and> hd xs = u \<and> last xs = v; \<not> is_cycle xs; 0 < walk_length xs\<rbrakk> \<Longrightarrow> is_path xs \<and> hd xs = u \<and> last xs = v
[PROOF STEP]
by auto


[STATEMENT]
lemma snd_echelon_form_of_column_k_det:
  shows "(snd (echelon_form_of_column_k_det_iarrays (det_P, A, i, bezout) k))
  = echelon_form_of_column_k_iarrays (A,i,bezout) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (echelon_form_of_column_k_det_iarrays (det_P, A, i, bezout) k) = echelon_form_of_column_k_iarrays (A, i, bezout) k
[PROOF STEP]
unfolding echelon_form_of_column_k_det_iarrays_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (case (det_P, A, i, bezout) of (det_P, A, i, bezout) \<Rightarrow> if i \<noteq> nrows_iarray A \<and> A !! i !! k = (0::'a) \<and> \<not> vector_all_zero_from_index (i + 1, column_iarray k A) then (- (1::'a) * det_P, echelon_form_of_column_k_iarrays (A, i, bezout) k) else (det_P, echelon_form_of_column_k_iarrays (A, i, bezout) k)) = echelon_form_of_column_k_iarrays (A, i, bezout) k
[PROOF STEP]
by auto


[STATEMENT]
lemma max0_id: "max 0 (x :: 'a) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (0::'a) x = x
[PROOF STEP]
unfolding max_comm[of 0]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max x (0::'a) = x
[PROOF STEP]
by (rule max_id[OF zero_leastIII])


[STATEMENT]
lemma "(i::nat) mod 0 = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i mod 0 = i
[PROOF STEP]
using split_mod [of _ _ 0, linarith_split]
    \<comment> \<open>rule \<^text>\<open>split_mod\<close> is only declared by default for numerals\<close>
[PROOF STATE]
proof (prove)
using this:
?Q (?m mod 0) = ((0 = 0 \<longrightarrow> ?Q ?m) \<and> (0 \<noteq> 0 \<longrightarrow> (\<forall>i j. j < 0 \<and> ?m = 0 * i + j \<longrightarrow> ?Q j)))

goal (1 subgoal):
 1. i mod 0 = i
[PROOF STEP]
by linarith


[STATEMENT]
lemma (in Ring) csrp_diff_in_vpr:"\<lbrakk>ideal R I; x \<in> carrier R\<rbrakk> \<Longrightarrow>
              x \<plusminus> (-\<^sub>a (csrp_fn R I (pj R I x))) \<in> I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R I; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<plusminus> -\<^sub>a csrp_fn R I (pj R I x) \<in> I
[PROOF STEP]
apply (frule csrp_mem[of "I" "x"],
       frule csrp_same[of "I" "x"],
       simp add:pj_mem, assumption,
       frule  ar_coset_subsetD[of I x "csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I)"],
       assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R I; x \<in> carrier R; csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I) \<in> x \<uplus>\<^bsub>R\<^esub> I; csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I) \<in> carrier R\<rbrakk> \<Longrightarrow> x \<plusminus> -\<^sub>a csrp_fn R I (pj R I x) \<in> I
[PROOF STEP]
apply (frule belong_ar_coset2[of I x "csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I)"], assumption+,
     frule ideal_inv1_closed[of I "csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I) \<plusminus> -\<^sub>a x"], assumption+,
     cut_tac ring_is_ag,
     frule aGroup.ag_mOp_closed[of R x], assumption,
     simp add:aGroup.ag_pOp_commute[of R "csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I)" "-\<^sub>a x"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R I; x \<in> carrier R; csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I) \<in> x \<uplus>\<^bsub>R\<^esub> I; csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I) \<in> carrier R; -\<^sub>a x \<plusminus> csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I) \<in> I; -\<^sub>a (-\<^sub>a x \<plusminus> csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I)) \<in> I; aGroup R; -\<^sub>a x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<plusminus> -\<^sub>a csrp_fn R I (pj R I x) \<in> I
[PROOF STEP]
apply (simp add:aGroup.ag_p_inv[of R "-\<^sub>a x" "csrp_fn R I (x \<uplus>\<^bsub>R\<^esub> I)"],
       simp add:aGroup.ag_inv_inv,
       cut_tac Ring, simp add:pj_mem[of R I x])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mset_size_partition_dep: "size {# a \<in># A . P a \<or> Q a #} =
    size {# a \<in># A . P a #} +  size {# a \<in># A . Q a #} -  size {# a \<in># A . P a \<and> Q a #}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size {#a \<in># A. P a \<or> Q a#} = size (filter_mset P A) + size (filter_mset Q A) - size {#a \<in># A. P a \<and> Q a#}
[PROOF STEP]
by (simp add: mset_bunion_filter mset_inter_filter mset_union_size_inter)


[STATEMENT]
theorem "harry_meas xs = (LEAST n. True \<notin> set ((harry_step ^^ n) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harry_meas xs = (LEAST n. True \<notin> set ((harry_step ^^ n) xs))
[PROOF STEP]
proof (rule sym, rule Least_equality, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. True \<notin> set ((harry_step ^^ harry_meas xs) xs)
 2. \<And>y. True \<notin> set ((harry_step ^^ y) xs) \<Longrightarrow> harry_meas xs \<le> y
[PROOF STEP]
show "True \<notin> set ((harry_step ^^ harry_meas xs) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. True \<notin> set ((harry_step ^^ harry_meas xs) xs)
[PROOF STEP]
by (rule True_notin_funpow_harry_step)
[PROOF STATE]
proof (state)
this:
True \<notin> set ((harry_step ^^ harry_meas xs) xs)

goal (1 subgoal):
 1. \<And>y. True \<notin> set ((harry_step ^^ y) xs) \<Longrightarrow> harry_meas xs \<le> y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. True \<notin> set ((harry_step ^^ y) xs) \<Longrightarrow> harry_meas xs \<le> y
[PROOF STEP]
case (2 y)
[PROOF STATE]
proof (state)
this:
True \<notin> set ((harry_step ^^ y) xs)

goal (1 subgoal):
 1. \<And>y. True \<notin> set ((harry_step ^^ y) xs) \<Longrightarrow> harry_meas xs \<le> y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harry_meas xs \<le> y
[PROOF STEP]
by (rule ccontr) (use 2 True_in_funpow_harry_step[of y] in auto)
[PROOF STATE]
proof (state)
this:
harry_meas xs \<le> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fv_get_and: "(\<Union>x\<in>(set (get_and_list \<phi>)). fvi b x) = fvi b \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (fvi b ` set (get_and_list \<phi>)) = fvi b \<phi>
[PROOF STEP]
by (induction \<phi> rule: get_and_list.induct) simp_all


[STATEMENT]
lemma one_is_fermat_liar[simp]: "1 < n \<Longrightarrow> fermat_liar 1 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < n \<Longrightarrow> fermat_liar 1 n
[PROOF STEP]
using fermat_liar_def
[PROOF STATE]
proof (prove)
using this:
fermat_liar ?a ?n = [?a ^ (?n - 1) = 1] (mod ?n)

goal (1 subgoal):
 1. 1 < n \<Longrightarrow> fermat_liar 1 n
[PROOF STEP]
by auto


[STATEMENT]
lemma equiv_with_lucas: "nth_digit = Lucas_Theorem.nth_digit_general"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit = nth_digit_general
[PROOF STEP]
unfolding nth_digit_def Lucas_Theorem.nth_digit_general_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>num k base. num div base ^ k mod base) = (\<lambda>num i base. num div base ^ i mod base)
[PROOF STEP]
by simp


[STATEMENT]
lemma map_member_minus:
  "(x, y) \<in>\<^sub>m f -- g \<longleftrightarrow> (x, y) \<in>\<^sub>m f \<and> (\<not> (x, y) \<in>\<^sub>m g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in>\<^sub>m f -- g) = ((x, y) \<in>\<^sub>m f \<and> \<not> (x, y) \<in>\<^sub>m g)
[PROOF STEP]
by (auto simp add: map_minus_def)


[STATEMENT]
lemma all_fin_gen_ideals_are_principal_imp_bezout:
  assumes all: "\<forall>I::'a set. finitely_generated_ideal I \<longrightarrow> principal_ideal I"
  shows "OFCLASS ('a, bezout_ring_class)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OFCLASS('a, bezout_ring_class)
[PROOF STEP]
proof (intro_classes)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
fix a b::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
obtain d where ideal_d: "ideal_generated {a,b} = ideal_generated {d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. ideal_generated {a, b} = ideal_generated {d} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using all
[PROOF STATE]
proof (prove)
using this:
\<forall>I. finitely_generated_ideal I \<longrightarrow> principal_ideal I

goal (1 subgoal):
 1. (\<And>d. ideal_generated {a, b} = ideal_generated {d} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding finitely_generated_ideal_def
[PROOF STATE]
proof (prove)
using this:
\<forall>I. ideal I \<and> (\<exists>S. finite S \<and> ideal_generated S = I) \<longrightarrow> principal_ideal I

goal (1 subgoal):
 1. (\<And>d. ideal_generated {a, b} = ideal_generated {d} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis finite.emptyI finite_insert ideal_ideal_generated principal_ideal_def)
[PROOF STATE]
proof (state)
this:
ideal_generated {a, b} = ideal_generated {d}

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
have a_in_d: "a \<in> ideal_generated {d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> ideal_generated {d}
[PROOF STEP]
using ideal_d ideal_generated_subset_generator
[PROOF STATE]
proof (prove)
using this:
ideal_generated {a, b} = ideal_generated {d}
ideal_generated ?A = ?I \<Longrightarrow> ?A \<subseteq> ?I

goal (1 subgoal):
 1. a \<in> ideal_generated {d}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> ideal_generated {d}

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
have b_in_d: "b \<in> ideal_generated {d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> ideal_generated {d}
[PROOF STEP]
using ideal_d ideal_generated_subset_generator
[PROOF STATE]
proof (prove)
using this:
ideal_generated {a, b} = ideal_generated {d}
ideal_generated ?A = ?I \<Longrightarrow> ?A \<subseteq> ?I

goal (1 subgoal):
 1. b \<in> ideal_generated {d}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> ideal_generated {d}

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
have d_in_ab: "d \<in> ideal_generated {a,b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<in> ideal_generated {a, b}
[PROOF STEP]
using ideal_d ideal_generated_subset_generator
[PROOF STATE]
proof (prove)
using this:
ideal_generated {a, b} = ideal_generated {d}
ideal_generated ?A = ?I \<Longrightarrow> ?A \<subseteq> ?I

goal (1 subgoal):
 1. d \<in> ideal_generated {a, b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d \<in> ideal_generated {a, b}

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
obtain f where "(\<Sum>i\<in>{a,b}. f i * i) = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. (\<Sum>i\<in>{a, b}. f i * i) = d \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using obtain_sum_ideal_generated[OF d_in_ab]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {a, b}; \<And>f. (\<Sum>i\<in>{a, b}. f i * i) = d \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>f. (\<Sum>i\<in>{a, b}. f i * i) = d \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{a, b}. f i * i) = d

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<in>{a, b}. f i * i) = d
[PROOF STEP]
obtain p q where d_eq: "d = p*a + q*b"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>{a, b}. f i * i) = d

goal (1 subgoal):
 1. (\<And>p q. d = p * a + q * b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using sum_two_elements'
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>{a, b}. f i * i) = d
\<lbrakk>(\<Sum>i\<in>{?a, ?b}. ?f i * i) = ?d; \<And>p q. ?d = p * ?a + q * ?b \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>p q. d = p * a + q * b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
d = p * a + q * b

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
d = p * a + q * b

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
have d_dvd_a: "d dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d dvd a
[PROOF STEP]
by (metis dvd_ideal_generated_singleton ideal_d ideal_generated_subset insert_commute
        subset_insertI)
[PROOF STATE]
proof (state)
this:
d dvd a

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
d dvd a

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
have "d dvd b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d dvd b
[PROOF STEP]
by (metis dvd_ideal_generated_singleton ideal_d ideal_generated_subset subset_insertI)
[PROOF STATE]
proof (state)
this:
d dvd b

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
d dvd b

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
have "d' dvd d" if d'_dvd: "d' dvd a \<and> d' dvd b" for d'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
obtain s1 s2 where s1_dvd: "a = s1*d'" and s2_dvd: "b = s2*d'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s1 s2. \<lbrakk>a = s1 * d'; b = s2 * d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using mult.commute d'_dvd
[PROOF STATE]
proof (prove)
using this:
?a * ?b = ?b * ?a
d' dvd a \<and> d' dvd b

goal (1 subgoal):
 1. (\<And>s1 s2. \<lbrakk>a = s1 * d'; b = s2 * d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
?a * ?b = ?b * ?a
(\<exists>k. a = d' * k) \<and> (\<exists>k. b = d' * k)

goal (1 subgoal):
 1. (\<And>s1 s2. \<lbrakk>a = s1 * d'; b = s2 * d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = s1 * d'
b = s2 * d'

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
have "d = p*a + q*b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d = p * a + q * b
[PROOF STEP]
using d_eq
[PROOF STATE]
proof (prove)
using this:
d = p * a + q * b

goal (1 subgoal):
 1. d = p * a + q * b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
d = p * a + q * b

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d = p * a + q * b

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
have "...= p * s1 * d' + q * s2 *d'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * a + q * b = p * s1 * d' + q * s2 * d'
[PROOF STEP]
unfolding s1_dvd s2_dvd
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * (s1 * d') + q * (s2 * d') = p * s1 * d' + q * s2 * d'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p * a + q * b = p * s1 * d' + q * s2 * d'

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p * a + q * b = p * s1 * d' + q * s2 * d'

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
have "... = (p * s1 + q * s2) * d'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * s1 * d' + q * s2 * d' = (p * s1 + q * s2) * d'
[PROOF STEP]
by (simp add: ring_class.ring_distribs(2))
[PROOF STATE]
proof (state)
this:
p * s1 * d' + q * s2 * d' = (p * s1 + q * s2) * d'

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
d = (p * s1 + q * s2) * d'
[PROOF STEP]
show "d' dvd d"
[PROOF STATE]
proof (prove)
using this:
d = (p * s1 + q * s2) * d'

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
using mult.commute
[PROOF STATE]
proof (prove)
using this:
d = (p * s1 + q * s2) * d'
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
d = (p * s1 + q * s2) * d'
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. \<exists>k. d = d' * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d' dvd d

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?d' dvd a \<and> ?d' dvd b \<Longrightarrow> ?d' dvd d

goal (1 subgoal):
 1. \<And>a b. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
d = p * a + q * b
d dvd a
d dvd b
?d' dvd a \<and> ?d' dvd b \<Longrightarrow> ?d' dvd d
[PROOF STEP]
show "\<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b
  \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)"
[PROOF STATE]
proof (prove)
using this:
d = p * a + q * b
d dvd a
d dvd b
?d' dvd a \<and> ?d' dvd b \<Longrightarrow> ?d' dvd d

goal (1 subgoal):
 1. \<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>p q d. p * a + q * b = d \<and> d dvd a \<and> d dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem size_greater_than_median_of_medians:
  fixes xs :: "'a :: linorder list" and d :: nat
  assumes median: "\<And>xs. xs \<noteq> [] \<Longrightarrow> length xs \<le> Suc (2 * d) \<Longrightarrow> is_median (med xs) xs"
  assumes median': "is_median x (map med (chop (Suc (2*d)) xs))"
  defines "n \<equiv> length xs"
  defines "c \<equiv> (3 * real d + 1) / (2 * (2 * d + 1))"
  shows   "size {#y \<in># mset xs. y > x#} \<le> nat \<lceil>c * n\<rceil> + (5 * d) div 2 + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
include lifting_syntax
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
define med' where "med' = (\<lambda>xs. to_dual_ord (med (map of_dual_ord xs)))"
[PROOF STATE]
proof (state)
this:
med' = (\<lambda>xs. to_dual_ord (med (map of_dual_ord xs)))

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "xs = map of_dual_ord ys" if "list_all2 cr_dual_ord xs ys" for xs :: "'a list" and ys
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = map of_dual_ord ys
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
list_all2 cr_dual_ord xs ys

goal (1 subgoal):
 1. xs = map of_dual_ord ys
[PROOF STEP]
by induction (auto simp: cr_dual_ord_def)
[PROOF STATE]
proof (state)
this:
list_all2 cr_dual_ord ?xs ?ys \<Longrightarrow> ?xs = map of_dual_ord ?ys

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
hence [transfer_rule]: "(list_all2 (pcr_dual_ord (=)) ===> pcr_dual_ord (=)) med med'"
[PROOF STATE]
proof (prove)
using this:
list_all2 cr_dual_ord ?xs ?ys \<Longrightarrow> ?xs = map of_dual_ord ?ys

goal (1 subgoal):
 1. (list_all2 (pcr_dual_ord (=)) ===> pcr_dual_ord (=)) med med'
[PROOF STEP]
by (auto simp: rel_fun_def pcr_dual_ord_def OO_def med'_def cr_dual_ord_def
                   dual_ord.to_dual_ord_inverse)
[PROOF STATE]
proof (state)
this:
(list_all2 (pcr_dual_ord (=)) ===> pcr_dual_ord (=)) med med'

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "size {#y \<in># mset xs. y > x#} = length (filter (\<lambda>y. y > x) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) = length (filter ((<) x) xs)
[PROOF STEP]
by (subst size_mset [symmetric]) (simp only: mset_filter)
[PROOF STATE]
proof (state)
this:
size (filter_mset ((<) x) (mset xs)) = length (filter ((<) x) xs)

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size (filter_mset ((<) x) (mset xs)) = length (filter ((<) x) xs)

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> = length (map to_dual_ord (filter (\<lambda>y. y > x) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter ((<) x) xs) = length (map to_dual_ord (filter ((<) x) xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (filter ((<) x) xs) = length (map to_dual_ord (filter ((<) x) xs))

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (filter ((<) x) xs) = length (map to_dual_ord (filter ((<) x) xs))

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "(\<lambda>y. y > x) = (\<lambda>y. to_dual_ord y < to_dual_ord x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (<) x = (\<lambda>y. to_dual_ord y < to_dual_ord x)
[PROOF STEP]
by transfer simp_all
[PROOF STATE]
proof (state)
this:
(<) x = (\<lambda>y. to_dual_ord y < to_dual_ord x)

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
hence "length (map to_dual_ord (filter (\<lambda>y. y > x) xs)) = length (map to_dual_ord (filter \<dots> xs))"
[PROOF STATE]
proof (prove)
using this:
(<) x = (\<lambda>y. to_dual_ord y < to_dual_ord x)

goal (1 subgoal):
 1. length (map to_dual_ord (filter ((<) x) xs)) = length (map to_dual_ord (filter (\<lambda>y. to_dual_ord y < to_dual_ord x) xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (map to_dual_ord (filter ((<) x) xs)) = length (map to_dual_ord (filter (\<lambda>y. to_dual_ord y < to_dual_ord x) xs))

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (map to_dual_ord (filter ((<) x) xs)) = length (map to_dual_ord (filter (\<lambda>y. to_dual_ord y < to_dual_ord x) xs))

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> = length (filter (\<lambda>y. y < to_dual_ord x) (map to_dual_ord xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map to_dual_ord (filter (\<lambda>y. to_dual_ord y < to_dual_ord x) xs)) = length (filter (\<lambda>y. y < to_dual_ord x) (map to_dual_ord xs))
[PROOF STEP]
unfolding filter_map o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map to_dual_ord (filter (\<lambda>y. to_dual_ord y < to_dual_ord x) xs)) = length (map to_dual_ord (filter (\<lambda>xa. to_dual_ord xa < to_dual_ord x) xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (map to_dual_ord (filter (\<lambda>y. to_dual_ord y < to_dual_ord x) xs)) = length (filter (\<lambda>y. y < to_dual_ord x) (map to_dual_ord xs))

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (map to_dual_ord (filter (\<lambda>y. to_dual_ord y < to_dual_ord x) xs)) = length (filter (\<lambda>y. y < to_dual_ord x) (map to_dual_ord xs))

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> = size {#y \<in># mset (map to_dual_ord xs). y < to_dual_ord x#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter (\<lambda>y. y < to_dual_ord x) (map to_dual_ord xs)) = size {#y \<in># mset (map to_dual_ord xs). y < to_dual_ord x#}
[PROOF STEP]
by (subst size_mset [symmetric]) (simp only: mset_filter)
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>y. y < to_dual_ord x) (map to_dual_ord xs)) = size {#y \<in># mset (map to_dual_ord xs). y < to_dual_ord x#}

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>y. y < to_dual_ord x) (map to_dual_ord xs)) = size {#y \<in># mset (map to_dual_ord xs). y < to_dual_ord x#}

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
have "\<dots> \<le> nat \<lceil>(3 * real d + 1) / real (2 * (2 * d + 1)) * length (map to_dual_ord xs)\<rceil>
                    + 5 * d div 2 + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size {#y \<in># mset (map to_dual_ord xs). y < to_dual_ord x#} \<le> nat \<lceil>(3 * real d + 1) / real (2 * (2 * d + 1)) * real (length (map to_dual_ord xs))\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
proof (intro size_less_than_median_of_medians)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<noteq> []; length xs \<le> Suc (2 * d)\<rbrakk> \<Longrightarrow> is_median (?med xs) xs
 2. is_median (to_dual_ord x) (map ?med (chop (Suc (2 * d)) (map to_dual_ord xs)))
[PROOF STEP]
fix xs :: "'a dual_ord list"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<noteq> []; length xs \<le> Suc (2 * d)\<rbrakk> \<Longrightarrow> is_median (?med xs) xs
 2. is_median (to_dual_ord x) (map ?med (chop (Suc (2 * d)) (map to_dual_ord xs)))
[PROOF STEP]
assume xs: "xs \<noteq> []" "length xs \<le> Suc (2 * d)"
[PROOF STATE]
proof (state)
this:
xs \<noteq> []
length xs \<le> Suc (2 * d)

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<noteq> []; length xs \<le> Suc (2 * d)\<rbrakk> \<Longrightarrow> is_median (?med xs) xs
 2. is_median (to_dual_ord x) (map ?med (chop (Suc (2 * d)) (map to_dual_ord xs)))
[PROOF STEP]
from xs
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
length xs \<le> Suc (2 * d)
[PROOF STEP]
show "is_median (med' xs) xs"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
length xs \<le> Suc (2 * d)

goal (1 subgoal):
 1. is_median (med' xs) xs
[PROOF STEP]
by (transfer fixing: d) (rule median)
[PROOF STATE]
proof (state)
this:
is_median (med' xs) xs

goal (1 subgoal):
 1. is_median (to_dual_ord x) (map med' (chop (Suc (2 * d)) (map to_dual_ord xs)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_median (to_dual_ord x) (map med' (chop (Suc (2 * d)) (map to_dual_ord xs)))
[PROOF STEP]
show "is_median (to_dual_ord x) (map med' (chop (Suc (2 * d)) (map to_dual_ord xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_median (to_dual_ord x) (map med' (chop (Suc (2 * d)) (map to_dual_ord xs)))
[PROOF STEP]
by (transfer fixing: d x xs) (use median' in simp_all)
[PROOF STATE]
proof (state)
this:
is_median (to_dual_ord x) (map med' (chop (Suc (2 * d)) (map to_dual_ord xs)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
size {#y \<in># mset (map to_dual_ord xs). y < to_dual_ord x#} \<le> nat \<lceil>(3 * real d + 1) / real (2 * (2 * d + 1)) * real (length (map to_dual_ord xs))\<rceil> + 5 * d div 2 + 1

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>(3 * real d + 1) / real (2 * (2 * d + 1)) * real (length (map to_dual_ord xs))\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>(3 * real d + 1) / real (2 * (2 * d + 1)) * real (length (map to_dual_ord xs))\<rceil> + 5 * d div 2 + 1

goal (1 subgoal):
 1. size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1
[PROOF STEP]
by (simp add: n_def c_def)
[PROOF STATE]
proof (state)
this:
size (filter_mset ((<) x) (mset xs)) \<le> nat \<lceil>c * real n\<rceil> + 5 * d div 2 + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_in_bounds:
  "\<not> (in_bounds x v (lb, ub)) = (v x <\<^sub>l\<^sub>b lb x \<or> v x >\<^sub>u\<^sub>b ub x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_bounds x v (lb, ub) \<noteq> (v x <\<^sub>l\<^sub>b lb x \<or> v x >\<^sub>u\<^sub>b ub x)
[PROOF STEP]
using bounds_compare_contradictory(7)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?c <\<^sub>l\<^sub>b ?b; ?c \<ge>\<^sub>l\<^sub>b ?b\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. in_bounds x v (lb, ub) \<noteq> (v x <\<^sub>l\<^sub>b lb x \<or> v x >\<^sub>u\<^sub>b ub x)
[PROOF STEP]
using bounds_compare_contradictory(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?c <\<^sub>l\<^sub>b ?b; ?c \<ge>\<^sub>l\<^sub>b ?b\<rbrakk> \<Longrightarrow> False
\<lbrakk>?c \<le>\<^sub>u\<^sub>b ?b; ?c >\<^sub>u\<^sub>b ?b\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. in_bounds x v (lb, ub) \<noteq> (v x <\<^sub>l\<^sub>b lb x \<or> v x >\<^sub>u\<^sub>b ub x)
[PROOF STEP]
using neg_bounds_compare(7)[of "v x" "lb x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?c <\<^sub>l\<^sub>b ?b; ?c \<ge>\<^sub>l\<^sub>b ?b\<rbrakk> \<Longrightarrow> False
\<lbrakk>?c \<le>\<^sub>u\<^sub>b ?b; ?c >\<^sub>u\<^sub>b ?b\<rbrakk> \<Longrightarrow> False
\<not> v x <\<^sub>l\<^sub>b lb x \<Longrightarrow> v x \<ge>\<^sub>l\<^sub>b lb x

goal (1 subgoal):
 1. in_bounds x v (lb, ub) \<noteq> (v x <\<^sub>l\<^sub>b lb x \<or> v x >\<^sub>u\<^sub>b ub x)
[PROOF STEP]
using neg_bounds_compare(2)[of "v x" "ub x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?c <\<^sub>l\<^sub>b ?b; ?c \<ge>\<^sub>l\<^sub>b ?b\<rbrakk> \<Longrightarrow> False
\<lbrakk>?c \<le>\<^sub>u\<^sub>b ?b; ?c >\<^sub>u\<^sub>b ?b\<rbrakk> \<Longrightarrow> False
\<not> v x <\<^sub>l\<^sub>b lb x \<Longrightarrow> v x \<ge>\<^sub>l\<^sub>b lb x
\<not> v x \<le>\<^sub>u\<^sub>b ub x \<Longrightarrow> v x >\<^sub>u\<^sub>b ub x

goal (1 subgoal):
 1. in_bounds x v (lb, ub) \<noteq> (v x <\<^sub>l\<^sub>b lb x \<or> v x >\<^sub>u\<^sub>b ub x)
[PROOF STEP]
by auto


[STATEMENT]
lemma REC_mono[refine_mono]:
  assumes [simp]: "trimono B"
  assumes LE: "\<And>F x. (B F x) \<le> (B' F x)"
  shows "(REC B x) \<le> (REC B' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. REC B x \<le> REC B' x
[PROOF STEP]
unfolding REC_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if trimono B then lfp B x else top) \<le> (if trimono B' then lfp B' x else top)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trimono B' \<Longrightarrow> lfp B x \<le> lfp B' x
[PROOF STEP]
apply (rule lfp_mono[THEN le_funD])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Z. trimono B' \<Longrightarrow> B Z \<le> B' Z
[PROOF STEP]
apply (rule LE[THEN le_funI])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma INF_eq_minf: "(INF i\<in>I. f i::ereal) \<noteq> -\<infinity> \<longleftrightarrow> (\<exists>b>-\<infinity>. \<forall>i\<in>I. b \<le> f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Inf (f ` I) \<noteq> - \<infinity>) = (\<exists>b>- \<infinity>. \<forall>i\<in>I. b \<le> f i)
[PROOF STEP]
unfolding bot_ereal_def[symmetric] INF_eq_bot_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (\<forall>x>bot. \<exists>i\<in>I. f i < x)) = (\<exists>b>bot. \<forall>i\<in>I. b \<le> f i)
[PROOF STEP]
by (auto simp: not_less)


[STATEMENT]
theorem nn_integral_dominated_convergence:
  assumes [measurable]:
       "\<And>i. u i \<in> borel_measurable M" "u' \<in> borel_measurable M" "w \<in> borel_measurable M"
    and bound: "\<And>j. AE x in M. u j x \<le> w x"
    and w: "(\<integral>\<^sup>+x. w x \<partial>M) < \<infinity>"
    and u': "AE x in M. (\<lambda>i. u i x) \<longlonglongrightarrow> u' x"
  shows "(\<lambda>i. (\<integral>\<^sup>+x. u i x \<partial>M)) \<longlonglongrightarrow> (\<integral>\<^sup>+x. u' x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
have "limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> (\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> \<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M
[PROOF STEP]
by (intro nn_integral_limsup[OF _ _ bound w]) auto
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> \<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> \<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
have "(\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M) = (\<integral>\<^sup>+ x. u' x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'
[PROOF STEP]
using u'
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>i. u i x) \<longlonglongrightarrow> u' x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'
[PROOF STEP]
by (intro nn_integral_cong_AE, eventually_elim) (metis tendsto_iff_Liminf_eq_Limsup sequentially_bot)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
have "(\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M) = (\<integral>\<^sup>+ x. u' x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'
[PROOF STEP]
using u'
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>i. u i x) \<longlonglongrightarrow> u' x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'
[PROOF STEP]
by (intro nn_integral_cong_AE, eventually_elim) (metis tendsto_iff_Liminf_eq_Limsup sequentially_bot)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
have "(\<integral>\<^sup>+x. liminf (\<lambda>n. u n x) \<partial>M) \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))
[PROOF STEP]
by (intro nn_integral_liminf) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
have "liminf (\<lambda>n. integral\<^sup>N M (u n)) \<le> limsup (\<lambda>n. integral\<^sup>N M (u n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liminf (\<lambda>n. integral\<^sup>N M (u n)) \<le> limsup (\<lambda>n. integral\<^sup>N M (u n))
[PROOF STEP]
by (intro Liminf_le_Limsup sequentially_bot)
[PROOF STATE]
proof (state)
this:
liminf (\<lambda>n. integral\<^sup>N M (u n)) \<le> limsup (\<lambda>n. integral\<^sup>N M (u n))

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> \<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M
\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'
\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'
\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))
liminf (\<lambda>n. integral\<^sup>N M (u n)) \<le> limsup (\<lambda>n. integral\<^sup>N M (u n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> \<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M
\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'
\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M = integral\<^sup>N M u'
\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))
liminf (\<lambda>n. integral\<^sup>N M (u n)) \<le> limsup (\<lambda>n. integral\<^sup>N M (u n))

goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'
[PROOF STEP]
by (intro Liminf_eq_Limsup) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. integral\<^sup>N M (u i)) \<longlonglongrightarrow> integral\<^sup>N M u'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insertion_altdef:
  "insertion f p = Sum_any (\<lambda>m. coeff p m * Prod_any (\<lambda>i. f i ^ lookup m i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f p = (\<Sum>m. MPoly_Type.coeff p m * (\<Prod>i. f i ^ lookup m i))
[PROOF STEP]
by (transfer', transfer') (simp add: insertion_fun_def)


[STATEMENT]
lemma Fract_add_one: "n \<noteq> 0 \<Longrightarrow> Fract (m + n) n = Fract m n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> Fract (m + n) n = Fract m n + 1
[PROOF STEP]
by (simp add: rat_number_expand)


[STATEMENT]
lemma dual_space_eq:
  "dual_space S = {E. linear_fun_on S E} \<inter> {E. extensional0 S E}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual_space S = {E. linear_fun_on S E} \<inter> {E. extensional0 S E}
[PROOF STEP]
by (auto simp: dual_space_def)


[STATEMENT]
lemma mdeg_child_if_gt_fcard:
  "max_deg (Node r xs) > fcard xs \<Longrightarrow> \<exists>t \<in> fst ` fset xs. max_deg t = max_deg (Node r xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcard xs < max_deg (Node r xs) \<Longrightarrow> \<exists>t\<in>fst ` fset xs. max_deg t = max_deg (Node r xs)
[PROOF STEP]
unfolding mdeg_Max_if_gt_fcard
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcard xs < max_deg (Node r xs) \<Longrightarrow> \<exists>t\<in>fst ` fset xs. max_deg t = Max (max_deg ` fst ` fset xs)
[PROOF STEP]
using Max_in[OF mdeg_img_fin mdeg_img_nempty]
[PROOF STATE]
proof (prove)
using this:
fcard ?xs1 < max_deg (Node ?r1 ?xs1) \<Longrightarrow> Max (max_deg ` fst ` fset ?xs1) \<in> max_deg ` fst ` fset ?xs1

goal (1 subgoal):
 1. fcard xs < max_deg (Node r xs) \<Longrightarrow> \<exists>t\<in>fst ` fset xs. max_deg t = Max (max_deg ` fst ` fset xs)
[PROOF STEP]
by force


[STATEMENT]
lemma continuous_on_max [continuous_intros]:
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
  shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. max (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>x. max (f x) (g x))
[PROOF STEP]
by (auto simp: continuous_on_def intro!: tendsto_max)


[STATEMENT]
lemma of_rat_less_eq: "(of_rat r :: 'a::linordered_field) \<le> of_rat s \<longleftrightarrow> r \<le> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_rat r \<le> of_rat s) = (r \<le> s)
[PROOF STEP]
unfolding le_less
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_rat r < of_rat s \<or> of_rat r = of_rat s) = (r < s \<or> r = s)
[PROOF STEP]
by (auto simp add: of_rat_less)


[STATEMENT]
lemma generates_max_idealD:
  assumes "generates_max_ideal X F"
  shows "ideal F \<noteq> UNIV" and "F' \<subseteq> P[X] \<Longrightarrow> ideal F \<subset> ideal F' \<Longrightarrow> ideal F' = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal F \<noteq> UNIV &&& (\<lbrakk>F' \<subseteq> P[X]; ideal F \<subset> ideal F'\<rbrakk> \<Longrightarrow> ideal F' = UNIV)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
generates_max_ideal X F

goal (1 subgoal):
 1. ideal F \<noteq> UNIV &&& (\<lbrakk>F' \<subseteq> P[X]; ideal F \<subset> ideal F'\<rbrakk> \<Longrightarrow> ideal F' = UNIV)
[PROOF STEP]
by (simp_all add: generates_max_ideal_def)


[STATEMENT]
lemma (in monoid_cancel) assoc_l_cancel:
  assumes "a \<in> carrier G"  "b \<in> carrier G"  "b' \<in> carrier G" "a \<otimes> b \<sim> a \<otimes> b'"
  shows "b \<sim> b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<sim> b'
[PROOF STEP]
by (meson assms associated_def divides_mult_l)


[STATEMENT]
lemma homeomorphic_imp_homotopy_eqv: "S homeomorphic T \<Longrightarrow> S homotopy_eqv T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T \<Longrightarrow> S homotopy_eqv T
[PROOF STEP]
unfolding homeomorphic_def homeomorphism_def homotopy_equivalent_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f g. (\<forall>x\<in>S. g (f x) = x) \<and> f ` S = T \<and> continuous_on S f \<and> (\<forall>y\<in>T. f (g y) = y) \<and> g ` T = S \<and> continuous_on T g \<Longrightarrow> \<exists>f g. continuous_map (top_of_set S) (top_of_set T) f \<and> continuous_map (top_of_set T) (top_of_set S) g \<and> homotopic_with_canon (\<lambda>x. True) S S (g \<circ> f) id \<and> homotopic_with_canon (\<lambda>x. True) T T (f \<circ> g) id
[PROOF STEP]
by (metis continuous_map_subtopology_eu homotopic_with_id2 openin_imp_subset openin_subtopology_self topspace_euclidean_subtopology)


[STATEMENT]
lemma trunc_simps:
  assumes "f \<in> carrier P"
  shows "f = (trunc f) \<oplus>\<^bsub>P\<^esub> (ltrm f)"
        "f \<ominus>\<^bsub>P\<^esub> (trunc f) = ltrm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = Cring_Poly.truncate R f \<oplus>\<^bsub>P\<^esub> monom P (f (deg R f)) (deg R f) &&& f \<ominus>\<^bsub>P\<^esub> Cring_Poly.truncate R f = monom P (f (deg R f)) (deg R f)
[PROOF STEP]
apply (metis ltrm_closed P.add.inv_solve_right P.minus_closed P_def a_minus_def assms Cring_Poly.truncate_def leading_term_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> Cring_Poly.truncate R f = monom P (f (deg R f)) (deg R f)
[PROOF STEP]
using trunc_closed[of f] ltrm_closed[of f] P_def P.add.inv_solve_right[of "ltrm f" f "trunc f"]
        assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier P \<Longrightarrow> Cring_Poly.truncate R f \<in> carrier P
f \<in> carrier P \<Longrightarrow> monom P (f (deg R f)) (deg R f) \<in> carrier P
P \<equiv> UP R
\<lbrakk>monom P (f (deg R f)) (deg R f) \<in> carrier P; f \<in> carrier P; Cring_Poly.truncate R f \<in> carrier P\<rbrakk> \<Longrightarrow> (monom P (f (deg R f)) (deg R f) = f \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> Cring_Poly.truncate R f) = (f = monom P (f (deg R f)) (deg R f) \<oplus>\<^bsub>P\<^esub> Cring_Poly.truncate R f)
f \<in> carrier P

goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> Cring_Poly.truncate R f = monom P (f (deg R f)) (deg R f)
[PROOF STEP]
unfolding UP_cring_def
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier P \<Longrightarrow> Cring_Poly.truncate R f \<in> carrier P
f \<in> carrier P \<Longrightarrow> monom P (f (deg R f)) (deg R f) \<in> carrier P
P \<equiv> UP R
\<lbrakk>monom P (f (deg R f)) (deg R f) \<in> carrier P; f \<in> carrier P; Cring_Poly.truncate R f \<in> carrier P\<rbrakk> \<Longrightarrow> (monom P (f (deg R f)) (deg R f) = f \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> Cring_Poly.truncate R f) = (f = monom P (f (deg R f)) (deg R f) \<oplus>\<^bsub>P\<^esub> Cring_Poly.truncate R f)
f \<in> carrier P

goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> Cring_Poly.truncate R f = monom P (f (deg R f)) (deg R f)
[PROOF STEP]
by (metis P.add.inv_closed P.add.m_lcomm P.add.r_inv_ex P.minus_eq P.minus_minus
      P.r_neg2 P.r_zero Cring_Poly.truncate_def leading_term_def)


[STATEMENT]
lemma cos_arccos [simp]: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> cos (arccos y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> cos (arccos y) = y
[PROOF STEP]
by (blast dest: arccos)


[STATEMENT]
lemma (in abelian_group) a_coset_join1:
     "[| H +> x = H;  x \<in> carrier G;  subgroup H (add_monoid G) |] ==> x \<in> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H +> x = H; x \<in> carrier G; subgroup H (add_monoid G)\<rbrakk> \<Longrightarrow> x \<in> H
[PROOF STEP]
by (rule group.coset_join1 [OF a_group,
    folded a_r_coset_def, simplified monoid_record_simps])


[STATEMENT]
lemma Inf_dual_var: "\<partial> (\<Sqinter>X) = \<Squnion>(\<partial> ` X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<partial> (\<Sqinter> X) = \<Squnion> (\<partial> ` X)
[PROOF STEP]
using comp_eq_dest Inf_dual
[PROOF STATE]
proof (prove)
using this:
?a \<circ> ?b = ?c \<circ> ?d \<Longrightarrow> ?a (?b ?v) = ?c (?d ?v)
\<partial> \<circ> Inf = Sup \<circ> (`) \<partial>

goal (1 subgoal):
 1. \<partial> (\<Sqinter> X) = \<Squnion> (\<partial> ` X)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma (in Finite_Graph) sum_outgoing_alt: "\<lbrakk>\<forall>e. 0 \<le> g e \<and> g e \<le> c e\<rbrakk> \<Longrightarrow>
  \<forall>v \<in> V. (\<Sum>e \<in> outgoing v. g e) = (\<Sum>u \<in> V. g (v, u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e. (0::'a) \<le> g e \<and> g e \<le> c e \<Longrightarrow> \<forall>v\<in>V. sum g (outgoing v) = (\<Sum>u\<in>V. g (v, u))
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. \<lbrakk>\<forall>e. (0::'a) \<le> g e \<and> g e \<le> c e; v \<in> V\<rbrakk> \<Longrightarrow> sum g (outgoing v) = (\<Sum>u\<in>V. g (v, u))
[PROOF STEP]
apply (rule sum_outgoing_extend)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v u. \<lbrakk>\<forall>e. (0::'a) \<le> g e \<and> g e \<le> c e; v \<in> V; u \<in> V; (v, u) \<notin> E\<rbrakk> \<Longrightarrow> g (v, u) = (0::'a)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v u. \<lbrakk>\<forall>a b. (0::'a) \<le> g (a, b) \<and> g (a, b) \<le> c (a, b); v \<in> V; u \<in> V; (v, u) \<notin> E\<rbrakk> \<Longrightarrow> g (v, u) = (0::'a)
[PROOF STEP]
by (metis antisym zero_cap_simp)


[STATEMENT]
lemma cf_eval_ObjMap_vdomain[cat_cs_simps]:
  "\<D>\<^sub>\<circ> (cf_eval \<alpha> \<beta> \<CC>\<lparr>ObjMap\<rparr>) = (cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>) \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_eval \<alpha> \<beta> \<CC>\<lparr>ObjMap\<rparr>) = (cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>) \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cf_eval_components
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<lambda>\<FF>d\<in>\<^sub>\<circ>(cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>) \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>. \<FF>d\<lparr>[]\<^sub>\<circ>\<rparr>\<lparr>ObjMap\<rparr>\<lparr>\<FF>d\<lparr>1\<^sub>\<nat>\<rparr>\<rparr>) = (cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>) \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>
[PROOF STEP]
by simp


[STATEMENT]
lemma bl_word_and: "to_bl (v AND w) = map2 (\<and>) (to_bl v) (to_bl w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_bl (v AND w) = map2 (\<and>) (to_bl v) (to_bl w)
[PROOF STEP]
by transfer (simp flip: bl_and_bin)


[STATEMENT]
lemma lowered_lotteries: "lowered.lotteries \<subseteq> lotteries"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lowered.lotteries \<subseteq> lotteries
[PROOF STEP]
unfolding lotteries_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. set_pmf p \<subseteq> alts'} \<subseteq> {p. set_pmf p \<subseteq> alts}
[PROOF STEP]
using alts'_subset
[PROOF STATE]
proof (prove)
using this:
alts' \<subseteq> alts

goal (1 subgoal):
 1. {p. set_pmf p \<subseteq> alts'} \<subseteq> {p. set_pmf p \<subseteq> alts}
[PROOF STEP]
by blast