[STATEMENT]
lemma length_decompose [simp]: "length (decompose x ys) = length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (decompose x ys) = length ys
[PROOF STEP]
proof (induction x ys rule: decompose.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. length (decompose x []) = length []
 2. \<And>x y. length (decompose x [y]) = length [y]
 3. \<And>x y v va. (\<And>xa ya. (xa, ya) = bezout_coefficients y (prod_list (v # va)) \<Longrightarrow> length (decompose (xa * x) (v # va)) = length (v # va)) \<Longrightarrow> length (decompose x (y # v # va)) = length (y # v # va)
[PROOF STEP]
case (3 x y z ys)
[PROOF STATE]
proof (state)
this:
(?xa, ?ya) = bezout_coefficients y (prod_list (z # ys)) \<Longrightarrow> length (decompose (?xa * x) (z # ys)) = length (z # ys)

goal (3 subgoals):
 1. \<And>x. length (decompose x []) = length []
 2. \<And>x y. length (decompose x [y]) = length [y]
 3. \<And>x y v va. (\<And>xa ya. (xa, ya) = bezout_coefficients y (prod_list (v # va)) \<Longrightarrow> length (decompose (xa * x) (v # va)) = length (v # va)) \<Longrightarrow> length (decompose x (y # v # va)) = length (y # v # va)
[PROOF STEP]
obtain a b where ab: "(a,b) = bezout_coefficients y (prod_list (z#ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. (a, b) = bezout_coefficients y (prod_list (z # ys)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "bezout_coefficients y (z * prod_list ys)") simp_all
[PROOF STATE]
proof (state)
this:
(a, b) = bezout_coefficients y (prod_list (z # ys))

goal (3 subgoals):
 1. \<And>x. length (decompose x []) = length []
 2. \<And>x y. length (decompose x [y]) = length [y]
 3. \<And>x y v va. (\<And>xa ya. (xa, ya) = bezout_coefficients y (prod_list (v # va)) \<Longrightarrow> length (decompose (xa * x) (v # va)) = length (v # va)) \<Longrightarrow> length (decompose x (y # v # va)) = length (y # v # va)
[PROOF STEP]
from 3[OF ab] ab[symmetric]
[PROOF STATE]
proof (chain)
picking this:
length (decompose (a * x) (z # ys)) = length (z # ys)
bezout_coefficients y (prod_list (z # ys)) = (a, b)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length (decompose (a * x) (z # ys)) = length (z # ys)
bezout_coefficients y (prod_list (z # ys)) = (a, b)

goal (1 subgoal):
 1. length (decompose x (y # z # ys)) = length (y # z # ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (decompose x (y # z # ys)) = length (y # z # ys)

goal (2 subgoals):
 1. \<And>x. length (decompose x []) = length []
 2. \<And>x y. length (decompose x [y]) = length [y]
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma hypext_fun_add:
  assumes "f twice_field_differentiable_at (Base x)"
      and "g twice_field_differentiable_at (Base x)"
    shows "(*h* (\<lambda>x. f x + g x)) x = (*h* f) x + (*h* g) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*h* (\<lambda>x. f x + g x)) x = (*h* f) x + (*h* g) x
[PROOF STEP]
proof (simp add: hyperdual_eq_iff distrib_left[symmetric], intro conjI disjI2)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)
 2. deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)
 3. Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))
[PROOF STEP]
show goal1: "deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)
[PROOF STEP]
by (simp add: assms once_field_differentiable_at distrib_left)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)

goal (2 subgoals):
 1. deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)
 2. Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)
[PROOF STEP]
show "deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)"
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)

goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. f x + g x) (Base x) = deriv f (Base x) + deriv g (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))
[PROOF STEP]
have "deriv (deriv (\<lambda>x. f x + g x)) (Base x) = deriv (\<lambda>w. deriv f w + deriv g w) (Base x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (deriv (\<lambda>x. f x + g x)) (Base x) = deriv (\<lambda>w. deriv f w + deriv g w) (Base x)
[PROOF STEP]
by (simp add: assms deriv_cong_ev eventually_deriv_add)
[PROOF STATE]
proof (state)
this:
deriv (deriv (\<lambda>x. f x + g x)) (Base x) = deriv (\<lambda>w. deriv f w + deriv g w) (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
deriv (deriv (\<lambda>x. f x + g x)) (Base x) = deriv (\<lambda>w. deriv f w + deriv g w) (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))
[PROOF STEP]
have "Eps12 x * deriv f (Base x) + Eps12 x * deriv g (Base x) = Eps12 x * deriv (\<lambda>x. f x + g x) (Base x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Eps12 x * deriv f (Base x) + Eps12 x * deriv g (Base x) = Eps12 x * deriv (\<lambda>x. f x + g x) (Base x)
[PROOF STEP]
by (metis distrib_left goal1)
[PROOF STATE]
proof (state)
this:
Eps12 x * deriv f (Base x) + Eps12 x * deriv g (Base x) = Eps12 x * deriv (\<lambda>x. f x + g x) (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
deriv (deriv (\<lambda>x. f x + g x)) (Base x) = deriv (\<lambda>w. deriv f w + deriv g w) (Base x)
Eps12 x * deriv f (Base x) + Eps12 x * deriv g (Base x) = Eps12 x * deriv (\<lambda>x. f x + g x) (Base x)
[PROOF STEP]
show "Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) +
    Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) =
    Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) +
    (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))"
[PROOF STATE]
proof (prove)
using this:
deriv (deriv (\<lambda>x. f x + g x)) (Base x) = deriv (\<lambda>w. deriv f w + deriv g w) (Base x)
Eps12 x * deriv f (Base x) + Eps12 x * deriv g (Base x) = Eps12 x * deriv (\<lambda>x. f x + g x) (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))
[PROOF STEP]
using deriv_add[OF deriv_field_differentiable_at deriv_field_differentiable_at, OF assms]
[PROOF STATE]
proof (prove)
using this:
deriv (deriv (\<lambda>x. f x + g x)) (Base x) = deriv (\<lambda>w. deriv f w + deriv g w) (Base x)
Eps12 x * deriv f (Base x) + Eps12 x * deriv g (Base x) = Eps12 x * deriv (\<lambda>x. f x + g x) (Base x)
deriv (\<lambda>w. deriv f w + deriv g w) (Base x) = deriv (deriv f) (Base x) + deriv (deriv g) (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))
[PROOF STEP]
by (simp add: distrib_left add.left_commute)
[PROOF STATE]
proof (state)
this:
Eps12 x * deriv (\<lambda>x. f x + g x) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>x. f x + g x)) (Base x) = Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x) + (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subseteq_qleD2: "M \<subseteq>\<^sub>\<preceq> N \<Longrightarrow> x \<in> M \<Longrightarrow> \<exists>y \<in> N. x \<preceq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M \<subseteq>\<^sub>\<preceq> N; x \<in> M\<rbrakk> \<Longrightarrow> \<exists>y\<in>N. x \<preceq> y
[PROOF STEP]
by (auto simp add: subseteq_qle_def in_qle_def)


[STATEMENT]
lemma items_le_split_via_eq: "items_le (Suc k) J = items_le k J \<union> items_eq (Suc k) J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. items_le (Suc k) J = items_le k J \<union> items_eq (Suc k) J
[PROOF STEP]
by (auto simp add: items_le_def items_eq_def)


[STATEMENT]
lemma (in group_hom) kernel_to_trivial_group:
   "trivial_group H \<Longrightarrow> kernel G H h = carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trivial_group H \<Longrightarrow> kernel G H h = carrier G
[PROOF STEP]
unfolding kernel_def trivial_group_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group H \<and> carrier H = {\<one>\<^bsub>H\<^esub>} \<Longrightarrow> {x \<in> carrier G. h x = \<one>\<^bsub>H\<^esub>} = carrier G
[PROOF STEP]
using hom_closed
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier G \<Longrightarrow> h ?x \<in> carrier H

goal (1 subgoal):
 1. Group.group H \<and> carrier H = {\<one>\<^bsub>H\<^esub>} \<Longrightarrow> {x \<in> carrier G. h x = \<one>\<^bsub>H\<^esub>} = carrier G
[PROOF STEP]
by blast


[STATEMENT]
lemma "(2::int) + 3 * (- 4) * (- 1) = 14"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + 3 * - 4 * - 1 = 14
[PROOF STEP]
by normalization


[STATEMENT]
lemma write_sops_mono: "\<And>ys. set xs \<subseteq> set ys \<Longrightarrow> write_sops xs \<subseteq> write_sops ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ys. set xs \<subseteq> set ys \<Longrightarrow> write_sops xs \<subseteq> write_sops ys
[PROOF STEP]
by (fastforce simp add: in_write_sops_conv)


[STATEMENT]
lemma euclidean_size_lcm_less2:
  assumes "a \<noteq> 0" and "\<not> a dvd b"
  shows "euclidean_size b < euclidean_size (lcm a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euclidean_size b < euclidean_size (lcm a b)
[PROOF STEP]
using assms euclidean_size_lcm_less1 [of a b]
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)
\<not> a dvd b
\<lbrakk>a \<noteq> (0::'a); \<not> a dvd b\<rbrakk> \<Longrightarrow> euclidean_size b < euclidean_size (lcm b a)

goal (1 subgoal):
 1. euclidean_size b < euclidean_size (lcm a b)
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma same_nbt_same_pref:
  assumes "x \<in> carrier" "y \<in> carrier"
  shows "x \<in> no_better_than y carrier relation \<and>
         y \<in> no_better_than x carrier relation \<longleftrightarrow> x \<approx> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> no_better_than y carrier relation \<and> y \<in> no_better_than x carrier relation) = (x \<succeq> y \<and> y \<succeq> x)
[PROOF STEP]
by (metis (mono_tags, lifting) CollectD contra_subsetD no_better_subset_pref
        no_better_than_def worse_in_no_better)


[STATEMENT]
lemma col_vec_mat_Tensor:fixes j M v
 assumes "j < (length M)"
 shows "col (vec_mat_Tensor v M) j = vec_vec_Tensor v (col M j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (vec_mat_Tensor v M) j = vec_vec_Tensor v (col M j)
[PROOF STEP]
using col_vec_mat_Tensor_prelim assms
[PROOF STATE]
proof (prove)
using this:
\<forall>j<length ?M. col (vec_mat_Tensor ?v ?M) j = vec_vec_Tensor ?v (col ?M j)
j < length M

goal (1 subgoal):
 1. col (vec_mat_Tensor v M) j = vec_vec_Tensor v (col M j)
[PROOF STEP]
by auto


[STATEMENT]
lemma scalar_prod_int_rat[simp]: "dim_vec x = dim_vec y \<Longrightarrow> x \<bullet>i y = map_vec of_int x \<bullet> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec x = dim_vec y \<Longrightarrow> x \<bullet>i y = of_int_hom.vec_hom x \<bullet> y
[PROOF STEP]
unfolding scalar_prod_int_rat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec x = dim_vec y \<Longrightarrow> y \<bullet> of_int_hom.vec_hom x = of_int_hom.vec_hom x \<bullet> y
[PROOF STEP]
by (intro comm_scalar_prod[of _ "dim_vec x"], auto intro: carrier_vecI)


[STATEMENT]
lemma reversepath_translation: "reversepath((\<lambda>x. a + x) \<circ> g) = (\<lambda>x. a + x) \<circ> reversepath g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reversepath ((+) a \<circ> g) = (+) a \<circ> reversepath g
[PROOF STEP]
by (rule ext) (simp add: reversepath_def)


[STATEMENT]
lemma multiset_concat_gen: "M + mset (concat xs) = fold (\<lambda>x M. M + mset x) xs M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M + mset (concat xs) = fold (\<lambda>x M. M + mset x) xs M
[PROOF STEP]
by (induct xs arbitrary: M) (auto, metis union_assoc)


[STATEMENT]
lemma has_contour_integral_bound_part_circlepath:
      "\<lbrakk>(f has_contour_integral i) (part_circlepath z r s t);
        0 \<le> B; 0 < r; s \<le> t;
        \<And>x. x \<in> path_image(part_circlepath z r s t) \<Longrightarrow> norm(f x) \<le> B\<rbrakk>
       \<Longrightarrow> norm i \<le> B*r*(t - s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_contour_integral i) (part_circlepath z r s t); 0 \<le> B; 0 < r; s \<le> t; \<And>x. x \<in> path_image (part_circlepath z r s t) \<Longrightarrow> cmod (f x) \<le> B\<rbrakk> \<Longrightarrow> cmod i \<le> B * r * (t - s)
[PROOF STEP]
by (auto intro: has_contour_integral_bound_part_circlepath_strong)


[STATEMENT]
lemma obtain_shortest_path:
  obtains p where "path s p u" "\<delta> s u = sum_list p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>path s p u; \<delta> s u = sum_list p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<delta>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>path s p u; (LEAST w. w \<in> sum_list ` paths s u) = sum_list p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using paths_ne
[PROOF STATE]
proof (prove)
using this:
paths ?u ?v \<noteq> {}

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>path s p u; (LEAST w. w \<in> sum_list ` paths s u) = sum_list p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (smt Collect_empty_eq LeastI_ex WGraph.paths_def imageI image_iff
          mem_Collect_eq paths_def)


[STATEMENT]
lemma buffon_prob_aux:
  "emeasure Buffon {(x,\<phi>). needle l x \<phi> \<inter> {-d/2, d/2} \<noteq> {}} =
     emeasure lborel Buffon_set / ennreal (2 * d * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
have [measurable]: "A \<times> B \<in> sets borel" if "A \<in> sets borel" "B \<in> sets borel"
    for A B :: "real set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<times> B \<in> sets borel
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
A \<in> sets borel
B \<in> sets borel

goal (1 subgoal):
 1. A \<times> B \<in> sets borel
[PROOF STEP]
unfolding borel_prod [symmetric]
[PROOF STATE]
proof (prove)
using this:
A \<in> sets borel
B \<in> sets borel

goal (1 subgoal):
 1. A \<times> B \<in> sets (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?A1 \<in> sets borel; ?B1 \<in> sets borel\<rbrakk> \<Longrightarrow> ?A1 \<times> ?B1 \<in> sets borel

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
have "{(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} \<in> sets borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} \<in> sets borel
[PROOF STEP]
by (intro pred_Collect_borel)
       (simp add: borel_prod [symmetric] needle_def closed_segment_eq_real_ivl case_prod_unfold)
[PROOF STATE]
proof (state)
this:
{(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} \<in> sets borel

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
hence "emeasure Buffon {(x,\<phi>). needle l x \<phi> \<inter> {-d/2, d/2} \<noteq> {}} =
           emeasure lborel (({-d/2..d/2} \<times> {- pi..pi}) \<inter> {(x,\<phi>). needle l x \<phi> \<inter> {-d/2, d/2} \<noteq> {}}) /
           emeasure lborel ({-(d/2)..d/2} \<times> {-pi..pi})"
[PROOF STATE]
proof (prove)
using this:
{(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} \<in> sets borel

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel ({- d / 2..d / 2} \<times> {- pi..pi} \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}}) / emeasure lborel ({- (d / 2)..d / 2} \<times> {- pi..pi})
[PROOF STEP]
unfolding Buffon_def Buffon_set_def
[PROOF STATE]
proof (prove)
using this:
{(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} \<in> sets borel

goal (1 subgoal):
 1. emeasure (uniform_measure lborel ({- d / 2..d / 2} \<times> {- pi..pi})) {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel ({- d / 2..d / 2} \<times> {- pi..pi} \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}}) / emeasure lborel ({- (d / 2)..d / 2} \<times> {- pi..pi})
[PROOF STEP]
by (subst emeasure_uniform_measure) simp_all
[PROOF STATE]
proof (state)
this:
emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel ({- d / 2..d / 2} \<times> {- pi..pi} \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}}) / emeasure lborel ({- (d / 2)..d / 2} \<times> {- pi..pi})

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel ({- d / 2..d / 2} \<times> {- pi..pi} \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}}) / emeasure lborel ({- (d / 2)..d / 2} \<times> {- pi..pi})

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
have "({-d/2..d/2} \<times> {- pi..pi}) \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {-d/2, d/2} \<noteq> {}} = Buffon_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {- d / 2..d / 2} \<times> {- pi..pi} \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = Buffon_set
[PROOF STEP]
unfolding Buffon_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {- d / 2..d / 2} \<times> {- pi..pi} \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = {(x, \<phi>). (x, \<phi>) \<in> {- d / 2..d / 2} \<times> {- pi..pi} \<and> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{- d / 2..d / 2} \<times> {- pi..pi} \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = Buffon_set

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{- d / 2..d / 2} \<times> {- pi..pi} \<inter> {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = Buffon_set

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
have "emeasure lborel ({-(d/2)..d/2} \<times> {-pi..pi}) = ennreal (2 * d * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel ({- (d / 2)..d / 2} \<times> {- pi..pi}) = ennreal (2 * d * pi)
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
0 < d

goal (1 subgoal):
 1. emeasure lborel ({- (d / 2)..d / 2} \<times> {- pi..pi}) = ennreal (2 * d * pi)
[PROOF STEP]
by (simp flip: lborel_prod ennreal_mult add: lborel.emeasure_pair_measure_Times)
[PROOF STATE]
proof (state)
this:
emeasure lborel ({- (d / 2)..d / 2} \<times> {- pi..pi}) = ennreal (2 * d * pi)

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure local.Buffon {a. case a of (x, \<phi>) \<Rightarrow> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure local.Buffon {a. case a of (x, \<phi>) \<Rightarrow> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = emeasure lborel Buffon_set / ennreal (2 * d * pi)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma orthogonal_complement_zero[simp]:
  "orthogonal_complement {0} = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement {0::'a} = UNIV
[PROOF STEP]
unfolding orthogonal_complement_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x |x. \<forall>y\<in>{0::'a}. is_orthogonal x y} = UNIV
[PROOF STEP]
by auto


[STATEMENT]
lemma iT_Plus_neg_assoc: "(I \<oplus>- a) \<oplus>- b = I \<oplus>- (a + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<oplus>- a \<oplus>- b = I \<oplus>- a + b
[PROOF STEP]
apply (simp add: iT_Plus_neg_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x + b + a \<in> I} = {x. x + (a + b) \<in> I}
[PROOF STEP]
apply (simp add: add.assoc add.commute[of b])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma del_list_sorted5:
  "sorted1 (xs @ (a,a') # ys @ (b,b') # zs @ (c,c') # us @ (d,d') # vs) \<Longrightarrow> x < d \<Longrightarrow>
   del_list x (xs @ (a,a') # ys @ (b,b') # zs @ (c,c') # us @ (d,d') # vs) =
   del_list x (xs @ (a,a') # ys @ (b,b') # zs @ (c,c') # us) @ (d,d') # vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted1 (xs @ (a, a') # ys @ (b, b') # zs @ (c, c') # us @ (d, d') # vs); x < d\<rbrakk> \<Longrightarrow> del_list x (xs @ (a, a') # ys @ (b, b') # zs @ (c, c') # us @ (d, d') # vs) = del_list x (xs @ (a, a') # ys @ (b, b') # zs @ (c, c') # us) @ (d, d') # vs
[PROOF STEP]
by (auto simp: del_list_sorted sorted_lems)


[STATEMENT]
lemma eq_\<rho>:
  assumes "is_open U" and "is_open V" and "is_open W" and "W \<subseteq> U \<inter> V" and "s \<in> \<FF> U" and "t \<in> \<FF> V"
    and "\<rho> U W s = \<rho> V W t" and "is_open W'" and "W' \<subseteq> W"
  shows "\<rho> U W' s = \<rho> V W' t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rho> U W' s = \<rho> V W' t
[PROOF STEP]
by (metis Int_subset_iff assms assoc_comp comp_apply)


[STATEMENT]
lemma sum_mset_replicate_mset [simp]:
  "sum_mset (replicate_mset n a) = of_nat n * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (replicate_mset n a) = of_nat n * a
[PROOF STEP]
by (induction n) (simp_all add: algebra_simps)


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


[STATEMENT]
lemma convex_on_subset: "convex_on t f \<Longrightarrow> S \<subseteq> t \<Longrightarrow> convex_on S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex_on t f; S \<subseteq> t\<rbrakk> \<Longrightarrow> convex_on S f
[PROOF STEP]
unfolding convex_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>t. \<forall>y\<in>t. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y; S \<subseteq> t\<rbrakk> \<Longrightarrow> \<forall>x\<in>S. \<forall>y\<in>S. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
by auto


[STATEMENT]
lemma abs_conv_abscissa_diff_le:
  "abs_conv_abscissa (f - g :: 'a :: dirichlet_series fds) \<le>
     max (abs_conv_abscissa f) (abs_conv_abscissa g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_conv_abscissa (f - g) \<le> max (abs_conv_abscissa f) (abs_conv_abscissa g)
[PROOF STEP]
using abs_conv_abscissa_add_le[of f "-g"]
[PROOF STATE]
proof (prove)
using this:
abs_conv_abscissa (f + - g) \<le> max (abs_conv_abscissa f) (abs_conv_abscissa (- g))

goal (1 subgoal):
 1. abs_conv_abscissa (f - g) \<le> max (abs_conv_abscissa f) (abs_conv_abscissa g)
[PROOF STEP]
by auto


[STATEMENT]
lemma shiftl_eq_mult:
  \<open>x << n = x * 2 ^ n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x << n = x * (2::'a) ^ n
[PROOF STEP]
unfolding shiftl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. push_bit n x = x * (2::'a) ^ n
[PROOF STEP]
by (fact push_bit_eq_mult)


[STATEMENT]
lemma Infinitesimal_inverse_HInfinite: "x \<in> Infinitesimal \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> inverse x \<in> HInfinite"
  for x :: "'a::real_normed_div_algebra star"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> Infinitesimal; x \<noteq> 0\<rbrakk> \<Longrightarrow> inverse x \<in> HInfinite
[PROOF STEP]
by (metis Infinitesimal_HFinite_mult not_HFinite_HInfinite one_not_Infinitesimal right_inverse)


[STATEMENT]
lemma bounded_valid_path_image: "valid_path g \<Longrightarrow> bounded(path_image g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path g \<Longrightarrow> bounded (path_image g)
[PROOF STEP]
by (metis bounded_path_image valid_path_imp_path)


[STATEMENT]
lemma remdups_id_iff_distinct [simp]: "remdups xs = xs \<longleftrightarrow> distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (remdups xs = xs) = distinct xs
[PROOF STEP]
by (metis distinct_remdups distinct_remdups_id)


[STATEMENT]
lemma bounded_closure_image: "bounded (f ` closure S) \<Longrightarrow> bounded (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (f ` closure S) \<Longrightarrow> bounded (f ` S)
[PROOF STEP]
by (simp add: bounded_subset closure_subset image_mono)


[STATEMENT]
lemma adj_idem1:
  fixes f :: "'a::preorder \<Rightarrow> 'b::order"
  shows "f \<stileturn> g \<Longrightarrow> (f \<circ> g) \<circ> (f \<circ> g) = f \<circ> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<stileturn> g \<Longrightarrow> f \<circ> g \<circ> (f \<circ> g) = f \<circ> g
[PROOF STEP]
by (simp add: adj_cancel_eq1 rewriteL_comp_comp)


[STATEMENT]
lemma transfer_semigroup:
  assumes "Derive.iso f g"
  shows "semigroup_law MULT \<Longrightarrow> semigroup_law (\<lambda>x y. g (MULT (f x) (f y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semigroup_law MULT \<Longrightarrow> semigroup_law (\<lambda>x y. g (MULT (f x) (f y)))
[PROOF STEP]
unfolding semigroup_law_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y z. MULT (MULT x y) z = MULT x (MULT y z) \<Longrightarrow> \<forall>x y z. g (MULT (f (g (MULT (f x) (f y)))) (f z)) = g (MULT (f x) (f (g (MULT (f y) (f z)))))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Derive.iso f g

goal (1 subgoal):
 1. \<forall>x y z. MULT (MULT x y) z = MULT x (MULT y z) \<Longrightarrow> \<forall>x y z. g (MULT (f (g (MULT (f x) (f y)))) (f z)) = g (MULT (f x) (f (g (MULT (f y) (f z)))))
[PROOF STEP]
unfolding Derive.iso_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>a. g (f a) = a) \<and> (\<forall>b. f (g b) = b)

goal (1 subgoal):
 1. \<forall>x y z. MULT (MULT x y) z = MULT x (MULT y z) \<Longrightarrow> \<forall>x y z. g (MULT (f (g (MULT (f x) (f y)))) (f z)) = g (MULT (f x) (f (g (MULT (f y) (f z)))))
[PROOF STEP]
by simp


[STATEMENT]
lemma reducing_sys_satisfies_properties:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "nat list list"
  fixes signs :: "rat list list"
  fixes matrix:: "rat mat"
  assumes nonzero: "p \<noteq> 0"
  assumes nontriv: "length qs > 0"
  assumes pairwise_rel_prime: "\<forall>q. ((List.member qs q) \<longrightarrow> (coprime p q))"
  assumes satisfies_properties_sys: "satisfies_properties p qs subsets signs matrix"
  shows  "satisfies_properties p qs (get_subsets (reduce_system p (qs,matrix,subsets,signs)))
  (get_signs (reduce_system p (qs,matrix,subsets,signs)))
  (get_matrix (reduce_system p (qs,matrix,subsets,signs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
have h1: " all_list_constr (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (length qs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_list_constr (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (length qs)
[PROOF STEP]
using reduction_doesnt_break_subsets assms reduction_subsets_is_get_subsets satisfies_properties_def satisfies_properties_sys
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p \<noteq> 0; all_list_constr ?subsets (length ?qs); satisfy_equation ?p ?qs ?subsets ?signs; invertible_mat (M_mat ?signs ?subsets)\<rbrakk> \<Longrightarrow> all_list_constr (reduction_subsets ?p ?qs ?signs ?subsets (M_mat ?signs ?subsets)) (length ?qs)
p \<noteq> 0
0 < length qs
\<forall>q. List.member qs q \<longrightarrow> coprime p q
satisfies_properties p qs subsets signs matrix
reduction_subsets ?p ?qs ?signs ?subsets ?m = get_subsets (reduce_system ?p (?qs, ?m, ?subsets, ?signs))
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)
satisfies_properties p qs subsets signs matrix

goal (1 subgoal):
 1. all_list_constr (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (length qs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
all_list_constr (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (length qs)

goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
have h2: "well_def_signs (length qs) (get_signs (reduce_system p (qs, matrix, subsets, signs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_def_signs (length qs) (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
using reduction_doesnt_break_length_signs[of signs qs p subsets] assms reduction_signs_is_get_signs satisfies_properties_def well_def_signs_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<in>set signs. length x = length qs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (reduction_signs p qs signs subsets (M_mat signs subsets)). length x = length qs
p \<noteq> 0
0 < length qs
\<forall>q. List.member qs q \<longrightarrow> coprime p q
satisfies_properties p qs subsets signs matrix
reduction_signs ?p ?qs ?signs ?subsets ?m = get_signs (reduce_system ?p (?qs, ?m, ?subsets, ?signs))
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)
well_def_signs ?num_polys ?sign_conds \<equiv> \<forall>signs\<in>set ?sign_conds. length signs = ?num_polys

goal (1 subgoal):
 1. well_def_signs (length qs) (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
well_def_signs (length qs) (get_signs (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
have h3: "distinct (get_signs (reduce_system p (qs, matrix, subsets, signs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
using reduction_signs_are_distinct[of p qs subsets signs] assms reduction_signs_is_get_signs satisfies_properties_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets); distinct signs\<rbrakk> \<Longrightarrow> distinct (reduction_signs p qs signs subsets (M_mat signs subsets))
p \<noteq> 0
0 < length qs
\<forall>q. List.member qs q \<longrightarrow> coprime p q
satisfies_properties p qs subsets signs matrix
reduction_signs ?p ?qs ?signs ?subsets ?m = get_signs (reduce_system ?p (?qs, ?m, ?subsets, ?signs))
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)

goal (1 subgoal):
 1. distinct (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (get_signs (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
have h4: "satisfy_equation p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs)))
     (get_signs (reduce_system p (qs, matrix, subsets, signs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfy_equation p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
using reduce_system_matrix_equation_preserved[of p qs signs subsets] assms satisfies_properties_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; all_list_constr subsets (length qs); distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets); \<forall>q. List.member qs q \<longrightarrow> coprime p q\<rbrakk> \<Longrightarrow> satisfy_equation p qs (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs)))
p \<noteq> 0
0 < length qs
\<forall>q. List.member qs q \<longrightarrow> coprime p q
satisfies_properties p qs subsets signs matrix
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)

goal (1 subgoal):
 1. satisfy_equation p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
satisfy_equation p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
have h5: "invertible_mat (get_matrix (reduce_system p (qs, matrix, subsets, signs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
using reduction_doesnt_break_things_invertibility assms same_size satisfies_properties_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length ?subsets = length ?signs; invertible_mat (M_mat ?signs ?subsets); ?p \<noteq> 0; well_def_signs (length ?qs) ?signs; distinct ?signs; set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs; satisfy_equation ?p ?qs ?subsets ?signs\<rbrakk> \<Longrightarrow> invertible_mat (get_matrix (reduce_system ?p (?qs, M_mat ?signs ?subsets, ?subsets, ?signs)))
p \<noteq> 0
0 < length qs
\<forall>q. List.member qs q \<longrightarrow> coprime p q
satisfies_properties p qs subsets signs matrix
invertible_mat (M_mat ?signs ?subsets) \<Longrightarrow> length ?subsets = length ?signs
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)

goal (1 subgoal):
 1. invertible_mat (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
invertible_mat (get_matrix (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
have h6: "get_matrix (reduce_system p (qs, matrix, subsets, signs)) =
    matrix_A (get_signs (reduce_system p (qs, matrix, subsets, signs)))
     (get_subsets (reduce_system p (qs, matrix, subsets, signs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. get_matrix (reduce_system p (qs, matrix, subsets, signs)) = M_mat (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_subsets (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
using reduce_system_matrix_match[of p qs signs subsets] assms satisfies_properties_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> M_mat (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) (get_subsets (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = get_matrix (reduce_system p (qs, M_mat signs subsets, subsets, signs))
p \<noteq> 0
0 < length qs
\<forall>q. List.member qs q \<longrightarrow> coprime p q
satisfies_properties p qs subsets signs matrix
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)

goal (1 subgoal):
 1. get_matrix (reduce_system p (qs, matrix, subsets, signs)) = M_mat (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_subsets (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
get_matrix (reduce_system p (qs, matrix, subsets, signs)) = M_mat (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_subsets (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
have h7: "set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
using reduction_doesnt_break_things_signs[of p qs signs subsets] assms reduction_signs_is_get_signs satisfies_properties_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (reduction_signs p qs signs subsets (M_mat signs subsets))
p \<noteq> 0
0 < length qs
\<forall>q. List.member qs q \<longrightarrow> coprime p q
satisfies_properties p qs subsets signs matrix
reduction_signs ?p ?qs ?signs ?subsets ?m = get_signs (reduce_system ?p (?qs, ?m, ?subsets, ?signs))
satisfies_properties ?p ?qs ?subsets ?signs ?matrix = (all_list_constr ?subsets (length ?qs) \<and> well_def_signs (length ?qs) ?signs \<and> distinct ?signs \<and> satisfy_equation ?p ?qs ?subsets ?signs \<and> invertible_mat ?matrix \<and> ?matrix = M_mat ?signs ?subsets \<and> set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs)

goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
unfolding satisfies_properties_def
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. all_list_constr (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (length qs) \<and> well_def_signs (length qs) (get_signs (reduce_system p (qs, matrix, subsets, signs))) \<and> distinct (get_signs (reduce_system p (qs, matrix, subsets, signs))) \<and> satisfy_equation p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) \<and> invertible_mat (get_matrix (reduce_system p (qs, matrix, subsets, signs))) \<and> get_matrix (reduce_system p (qs, matrix, subsets, signs)) = M_mat (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_subsets (reduce_system p (qs, matrix, subsets, signs))) \<and> set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
using h1 h2 h3 h4 h5 h6 h7
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))
all_list_constr (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (length qs)
well_def_signs (length qs) (get_signs (reduce_system p (qs, matrix, subsets, signs)))
distinct (get_signs (reduce_system p (qs, matrix, subsets, signs)))
satisfy_equation p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs)))
invertible_mat (get_matrix (reduce_system p (qs, matrix, subsets, signs)))
get_matrix (reduce_system p (qs, matrix, subsets, signs)) = M_mat (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_subsets (reduce_system p (qs, matrix, subsets, signs)))
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))

goal (1 subgoal):
 1. all_list_constr (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (length qs) \<and> well_def_signs (length qs) (get_signs (reduce_system p (qs, matrix, subsets, signs))) \<and> distinct (get_signs (reduce_system p (qs, matrix, subsets, signs))) \<and> satisfy_equation p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) \<and> invertible_mat (get_matrix (reduce_system p (qs, matrix, subsets, signs))) \<and> get_matrix (reduce_system p (qs, matrix, subsets, signs)) = M_mat (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_subsets (reduce_system p (qs, matrix, subsets, signs))) \<and> set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set (get_signs (reduce_system p (qs, matrix, subsets, signs)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
satisfies_properties p qs (get_subsets (reduce_system p (qs, matrix, subsets, signs))) (get_signs (reduce_system p (qs, matrix, subsets, signs))) (get_matrix (reduce_system p (qs, matrix, subsets, signs)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_within_Arccos_real:
    "continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
proof (cases "z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} \<Longrightarrow> continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
 2. z \<notin> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} \<Longrightarrow> continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}

goal (2 subgoals):
 1. z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} \<Longrightarrow> continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
 2. z \<notin> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} \<Longrightarrow> continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}

goal (1 subgoal):
 1. continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
using continuous_on_Arccos_real continuous_on_eq_continuous_within
[PROOF STATE]
proof (prove)
using this:
z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}
continuous_on {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} Arccos
continuous_on ?s ?f = (\<forall>x\<in>?s. continuous (at x within ?s) ?f)

goal (1 subgoal):
 1. continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos

goal (1 subgoal):
 1. z \<notin> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} \<Longrightarrow> continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<notin> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} \<Longrightarrow> continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z \<notin> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}

goal (1 subgoal):
 1. z \<notin> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} \<Longrightarrow> continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
with closed_real_abs_le [of 1]
[PROOF STATE]
proof (chain)
picking this:
closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}
z \<notin> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}
z \<notin> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}

goal (1 subgoal):
 1. continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos
[PROOF STEP]
by (rule continuous_within_closed_nontrivial)
[PROOF STATE]
proof (state)
this:
continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_lran: "set (lran a l h) = a`{l..<h}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (lran a l h) = a ` {l..<h}
[PROOF STEP]
apply (induction a l h rule: lran.induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l h. (l < h \<Longrightarrow> set (lran a (l + 1) h) = a ` {l + 1..<h}) \<Longrightarrow> set (lran a l h) = a ` {l..<h}
[PROOF STEP]
apply (rewrite in "\<hole> = _" lran.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l h. (l < h \<Longrightarrow> set (lran a (l + 1) h) = a ` {l + 1..<h}) \<Longrightarrow> set (if l < h then a l # lran a (l + 1) h else []) = a ` {l..<h}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l h xa. \<lbrakk>set (tl (lran a l h)) = a ` {l + 1..<h}; a xa \<notin> a ` {l + 1..<h}; l \<le> xa; xa < h\<rbrakk> \<Longrightarrow> a xa = a l
[PROOF STEP]
by (metis atLeastLessThan_iff image_iff not_less not_less_iff_gr_or_eq zless_imp_add1_zle)


[STATEMENT]
lemma ev_alpha_norm_v: "norm_v (\<alpha> *s v) = (norm \<alpha> *s norm_v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_vector cmod (\<alpha> *s v) = cmod \<alpha> *s map_vector cmod v
[PROOF STEP]
by (auto simp: map_vector_def norm_mult vec_eq_iff)


[STATEMENT]
lemma rel_star_contl: "X ; Y^* = (\<Union>i. X ; rel_d.power Y i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X ; Y\<^sup>* = (\<Union>i. X ; rel_d.power Y i)
[PROOF STEP]
by (simp add: rel_star_def relcomp_UNION_distrib)


[STATEMENT]
lemma fls_X_inv_shift:
  "fls_shift (int n) fls_X_inv = fls_X_inv ^ Suc n"
  "fls_shift (- int (Suc n)) fls_X_inv = fls_X ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_shift (int n) fls_X_inv = fls_X_inv ^ Suc n &&& fls_shift (- int (Suc n)) fls_X_inv = fls_X ^ n
[PROOF STEP]
using fls_X_inv_power_conv_shift_1[of "Suc n", symmetric]
[PROOF STATE]
proof (prove)
using this:
fls_shift (int (Suc n)) 1 = fls_X_inv ^ Suc n

goal (1 subgoal):
 1. fls_shift (int n) fls_X_inv = fls_X_inv ^ Suc n &&& fls_shift (- int (Suc n)) fls_X_inv = fls_X ^ n
[PROOF STEP]
by    (simp_all add: fls_X_inv_conv_shift_1 fls_X_power_conv_shift_1)


[STATEMENT]
lemma real_archimedian_rdiv_eq_0:
  assumes x0: "x \<ge> 0"
    and c: "c \<ge> 0"
    and xc: "\<And>m::nat. m > 0 \<Longrightarrow> real m * x \<le> c"
  shows "x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = 0
[PROOF STEP]
by (metis reals_Archimedean3 dual_order.order_iff_strict le0 le_less_trans not_le x0 xc)


[STATEMENT]
lemma lfp_lowerbound:
  "\<lbrakk> a : L i;  f a \<le> a \<rbrakk> \<Longrightarrow> lfp f i \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> L i; f a \<le> a\<rbrakk> \<Longrightarrow> local.lfp f i \<le> a
[PROOF STEP]
by (auto simp add: lfp_def intro: Glb_lower)


[STATEMENT]
lemma prime_square_sum_nat_decomp_code_aux:
  assumes "prime p" "p = 2 \<or> [p = 1] (mod 4)"
  defines "z \<equiv> the_elem (Set.filter (\<lambda>(x,y). x ^ 2 + y ^ 2 = p) (SIGMA x:{0..p}. {x..p}))"
  shows "prime_square_sum_nat_decomp p = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = z
[PROOF STEP]
let ?A = "Set.filter (\<lambda>(x,y). x ^ 2 + y ^ 2 = p) (SIGMA x:{0..p}. {x..p})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = z
[PROOF STEP]
have eq: "?A = {(x,y). x \<le> y \<and> x ^ 2 + y ^ 2 = p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Set.filter (\<lambda>(x, y). x\<^sup>2 + y\<^sup>2 = p) (SIGMA x:{0..p}. {x..p}) = {(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p}
[PROOF STEP]
using sum_of_squares_nat_bound [of _ _ p] sum_of_squares_nat_bound' [of _ _ p]
[PROOF STATE]
proof (prove)
using this:
?x\<^sup>2 + ?y\<^sup>2 = p \<Longrightarrow> ?x \<le> p
?x\<^sup>2 + ?y\<^sup>2 = p \<Longrightarrow> ?y \<le> p

goal (1 subgoal):
 1. Set.filter (\<lambda>(x, y). x\<^sup>2 + y\<^sup>2 = p) (SIGMA x:{0..p}. {x..p}) = {(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Set.filter (\<lambda>(x, y). x\<^sup>2 + y\<^sup>2 = p) (SIGMA x:{0..p}. {x..p}) = {(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p}

goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = z
[PROOF STEP]
have z: "z \<in> Set.filter (\<lambda>(x,y). x ^ 2 + y ^ 2 = p) (SIGMA x:{0..p}. {x..p})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> Set.filter (\<lambda>(x, y). x\<^sup>2 + y\<^sup>2 = p) (SIGMA x:{0..p}. {x..p})
[PROOF STEP]
unfolding z_def eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_elem {(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p} \<in> {(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p}
[PROOF STEP]
using prime_sum_of_squares_unique[OF assms(1,2)]
[PROOF STATE]
proof (prove)
using this:
\<exists>!(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. the_elem {(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p} \<in> {(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p}
[PROOF STEP]
by (intro the_elemI) (simp add: is_singleton_conv_Ex1)
[PROOF STATE]
proof (state)
this:
z \<in> Set.filter (\<lambda>(x, y). x\<^sup>2 + y\<^sup>2 = p) (SIGMA x:{0..p}. {x..p})

goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = z
[PROOF STEP]
have "prime_square_sum_nat_decomp p = (fst z, snd z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = (fst z, snd z)
[PROOF STEP]
using z
[PROOF STATE]
proof (prove)
using this:
z \<in> Set.filter (\<lambda>(x, y). x\<^sup>2 + y\<^sup>2 = p) (SIGMA x:{0..p}. {x..p})

goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = (fst z, snd z)
[PROOF STEP]
by (intro prime_square_sum_nat_decomp_eqI[OF assms(1)]) auto
[PROOF STATE]
proof (state)
this:
prime_square_sum_nat_decomp p = (fst z, snd z)

goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_square_sum_nat_decomp p = (fst z, snd z)

goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = z
[PROOF STEP]
have "\<dots> = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fst z, snd z) = z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(fst z, snd z) = z

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

goal (1 subgoal):
 1. prime_square_sum_nat_decomp p = z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prime_square_sum_nat_decomp p = z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lfp_eqI':
  assumes "mono f"
    and "f C = C"
    and "\<forall>X \<in> Pow C. f X = X \<longrightarrow> X = C"
  shows "lfp f = C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp f = C
[PROOF STEP]
by (metis PowI assms lfp_lowerbound lfp_unfold subset_refl)


[STATEMENT]
lemma butterfly_if_rank1: \<open>(\<exists>\<psi> \<phi>. A = butterfly \<psi> \<phi>) \<longleftrightarrow> rank1 A \<or> A = 0\<close>
  for A :: \<open>_::complex_inner \<Rightarrow>\<^sub>C\<^sub>L _::chilbert_space\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>\<psi> \<phi>. A = butterfly \<psi> \<phi>) = (rank1 A \<or> A = 0)
[PROOF STEP]
by (metis butterfly_0_left rank1_iff_butterfly)


[STATEMENT]
lemma sum_list_take_pdevs_val_eq:
  "sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
have "sum_list (take d xs) = 1 *\<^sub>R sum_list (take d xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (take d xs) = 1 *\<^sub>R sum_list (take d xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (take d xs) = 1 *\<^sub>R sum_list (take d xs)

goal (1 subgoal):
 1. sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (take d xs) = 1 *\<^sub>R sum_list (take d xs)

goal (1 subgoal):
 1. sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
note pdevs_val_const_pdevs_of_list[symmetric]
[PROOF STATE]
proof (state)
this:
?c *\<^sub>R sum_list ?xs = pdevs_val (\<lambda>_. ?c) (pdevs_of_list ?xs)

goal (1 subgoal):
 1. sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
?c *\<^sub>R sum_list ?xs = pdevs_val (\<lambda>_. ?c) (pdevs_of_list ?xs)

goal (1 subgoal):
 1. sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
have "pdevs_val (\<lambda>_. 1) (pdevs_of_list (take d xs)) =
      pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdevs_val (\<lambda>_. 1) (pdevs_of_list (take d xs)) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
by (auto simp: pdevs_apply_pdevs_of_list split: if_split_asm intro!: pdevs_val_eqI)
[PROOF STATE]
proof (state)
this:
pdevs_val (\<lambda>_. 1) (pdevs_of_list (take d xs)) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)

goal (1 subgoal):
 1. sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)

goal (1 subgoal):
 1. sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_list (take d xs) = pdevs_val (\<lambda>i. if i < d then 1 else 0) (pdevs_of_list xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Suc_fMax_pred_fimage[simp]:
  assumes "Suc p |\<in>| P" "0 |\<notin>| P"
  shows "Suc (fMax ((\<lambda>x. x - Suc 0) |`| P)) = fMax P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (fMax ((\<lambda>x. x - Suc 0) |`| P)) = fMax P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Suc p |\<in>| P
0 |\<notin>| P

goal (1 subgoal):
 1. Suc (fMax ((\<lambda>x. x - Suc 0) |`| P)) = fMax P
[PROOF STEP]
by (subst mono_fMax_commute[of Suc, unfolded mono_def, simplified]) (auto simp: o_def)


[STATEMENT]
lemma geodesic_segment_endpoints [simp]:
  assumes "geodesic_segment_between G x y"
  shows "x \<in> G" "y \<in> G" "G \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> G &&& y \<in> G &&& G \<noteq> {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
geodesic_segment_between G x y

goal (1 subgoal):
 1. x \<in> G &&& y \<in> G &&& G \<noteq> {}
[PROOF STEP]
unfolding geodesic_segment_between_def
[PROOF STATE]
proof (prove)
using this:
\<exists>g. g 0 = x \<and> g (dist x y) = y \<and> isometry_on {0..dist x y} g \<and> G = g ` {0..dist x y}

goal (1 subgoal):
 1. x \<in> G &&& y \<in> G &&& G \<noteq> {}
[PROOF STEP]
by (auto, metis atLeastAtMost_iff image_eqI less_eq_real_def zero_le_dist)


[STATEMENT]
lemma equalitySubsetI: "(\<And>x . x \<in> A \<Longrightarrow> x \<in> B) \<Longrightarrow> (\<And>x . x \<in> B \<Longrightarrow> x \<in> A) \<Longrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> A \<Longrightarrow> x \<in> B; \<And>x. x \<in> B \<Longrightarrow> x \<in> A\<rbrakk> \<Longrightarrow> A = B
[PROOF STEP]
by blast


[STATEMENT]
lemma InternalSets_Compl: "X \<in> InternalSets \<Longrightarrow> - X \<in> InternalSets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<in> InternalSets \<Longrightarrow> - X \<in> InternalSets
[PROOF STEP]
by (auto simp add: InternalSets_def starset_n_Compl [symmetric])


[STATEMENT]
lemma limsup_MInfty:
  fixes X :: "nat \<Rightarrow> ereal"
  shows "X \<longlonglongrightarrow> -\<infinity> \<longleftrightarrow> limsup X = -\<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<longlonglongrightarrow> - \<infinity> = (limsup X = - \<infinity>)
[PROOF STEP]
by (metis Limsup_MInfty trivial_limit_sequentially)


[STATEMENT]
lemma rel_fun2:
  assumes "is_equality R0" "\<And>x. Rel R1 (f x) (g x)"
  shows "Rel (rel_fun R0 R1) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rel (R0 ===> R1) f g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_equality R0
Rel R1 (f ?x1) (g ?x1)

goal (1 subgoal):
 1. Rel (R0 ===> R1) f g
[PROOF STEP]
unfolding is_equality_def Rel_def
[PROOF STATE]
proof (prove)
using this:
R0 = (=)
R1 (f ?x1) (g ?x1)

goal (1 subgoal):
 1. (R0 ===> R1) f g
[PROOF STEP]
by auto


[STATEMENT]
lemma nasc_seqn1:"\<lbrakk>(a::nat) \<in> A; \<not> (\<exists>m. m\<in>A \<and> (\<forall>x\<in>A. x \<le> m))\<rbrakk> \<Longrightarrow>
                             Suc (nasc_seq A a n) \<le> (nasc_seq A a (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. x \<le> m)\<rbrakk> \<Longrightarrow> Suc (nasc_seq A a n) \<le> nasc_seq A a (Suc n)
[PROOF STEP]
apply (frule nasc_seqn [of "a" "A" "n"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. x \<le> m); nasc_seq A a n < nasc_seq A a (Suc n)\<rbrakk> \<Longrightarrow> Suc (nasc_seq A a n) \<le> nasc_seq A a (Suc n)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Group) cond_nsg:"\<lbrakk>G \<guillemotright> H; \<forall>a\<in>carrier G. \<forall>h\<in>H. a \<cdot> h \<cdot> (\<rho> a) \<in> H \<rbrakk>
                            \<Longrightarrow> G \<triangleright> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<guillemotright> H ; \<forall>a\<in>carrier G. \<forall>h\<in>H. a \<cdot> h \<cdot> \<rho> a \<in> H\<rbrakk> \<Longrightarrow> G \<triangleright> H
[PROOF STEP]
apply (subst nsg_def, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<guillemotright> H ; \<forall>a\<in>carrier G. \<forall>h\<in>H. a \<cdot> h \<cdot> \<rho> a \<in> H\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier G. H \<bullet> x = x \<diamondsuit> H
[PROOF STEP]
apply (rule ballI, rule sg_nsg1, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma transpose_eq_iff:
  \<open>transpose a b c = d \<longleftrightarrow> (c \<noteq> a \<and> c \<noteq> b \<and> d = c) \<or> (c = a \<and> d = b) \<or> (c = b \<and> d = a)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Transposition.transpose a b c = d) = (c \<noteq> a \<and> c \<noteq> b \<and> d = c \<or> c = a \<and> d = b \<or> c = b \<and> d = a)
[PROOF STEP]
by (auto simp add: transpose_def)


[STATEMENT]
lemma le_mask_iff_lt_2n:
  "n < len_of TYPE ('a) = (((w :: 'a :: len word) \<le> mask n) = (w < 2 ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n < LENGTH('a)) = ((w \<le> mask n) = (w < 2 ^ n))
[PROOF STEP]
unfolding mask_2pm1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n < LENGTH('a)) = ((w \<le> 2 ^ n - 1) = (w < 2 ^ n))
[PROOF STEP]
by (rule trans [OF p2_gt_0 [THEN sym] le_m1_iff_lt])


[STATEMENT]
lemma distinct_pair_filter_n: "distinct (map fst xs) \<Longrightarrow> a \<notin> set (map fst xs) \<Longrightarrow> (map snd (filter (\<lambda>(x,y). x = a) xs)) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct (map fst xs); a \<notin> set (map fst xs)\<rbrakk> \<Longrightarrow> map snd (filter (\<lambda>(x, y). x = a) xs) = []
[PROOF STEP]
by (induct xs) (auto simp add: distinct_map_filter image_def)


[STATEMENT]
lemma mono_minus_ivl: "iv1 \<le> iv2 \<Longrightarrow> -iv1 \<le> -(iv2::ivl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iv1 \<le> iv2 \<Longrightarrow> - iv1 \<le> - iv2
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>iv1 iv2. le_rep iv1 iv2 \<Longrightarrow> le_rep (uminus_rep iv1) (uminus_rep iv2)
[PROOF STEP]
apply(auto simp: uminus_rep_def le_iff_subset split: if_splits prod.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2 x1a x2a x. \<lbrakk>\<gamma>_rep (x1, x2) \<subseteq> \<gamma>_rep (x1a, x2a); x \<in> \<gamma>_rep (- x2, - x1)\<rbrakk> \<Longrightarrow> x \<in> \<gamma>_rep (- x2a, - x1a)
[PROOF STEP]
by(auto simp: \<gamma>_rep_cases split: extended.splits)


[STATEMENT]
lemma read_actions_not_write_actions:
  "\<lbrakk> a \<in> read_actions E; a \<in> write_actions E \<rbrakk> \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> read_actions E; a \<in> write_actions E\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by(auto elim!: read_actions.cases write_actions.cases)


[STATEMENT]
lemma currentD_OUT_eq_0:
  assumes "current \<Gamma> f"
  shows "d_OUT f x = 0 \<longleftrightarrow> (\<forall>y. f (x, y) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d_OUT f x = 0) = (\<forall>y. f (x, y) = 0)
[PROOF STEP]
by(simp add: d_OUT_def nn_integral_0_iff emeasure_count_space_eq_0)


[STATEMENT]
lemma (in infinite_coin_toss_space) bernoulli_discounted_integrable:
  assumes "N = bernoulli_stream q"
and "0 < q"
and "q < 1"
  and "der \<in> borel_measurable (nat_filtration n)"
and "-1 < r"
  shows "integrable N (discounted_value r (\<lambda>m. der) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable N (discounted_value r (\<lambda>m. der) m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integrable N (discounted_value r (\<lambda>m. der) m)
[PROOF STEP]
have "prob_space N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
N = bernoulli_stream q
0 < q
q < 1
der \<in> borel_measurable (nat_filtration n)
- 1 < r

goal (1 subgoal):
 1. prob_space N
[PROOF STEP]
by (simp add: bernoulli bernoulli_stream_def prob_space.prob_space_stream_space prob_space_measure_pmf)
[PROOF STATE]
proof (state)
this:
prob_space N

goal (1 subgoal):
 1. integrable N (discounted_value r (\<lambda>m. der) m)
[PROOF STEP]
have "integrable N der"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable N der
[PROOF STEP]
proof (rule infinite_coin_toss_space.nat_filtration_borel_measurable_integrable)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. infinite_coin_toss_space ?p N
 2. der \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N ?n)
[PROOF STEP]
show "infinite_coin_toss_space q N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite_coin_toss_space q N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
N = bernoulli_stream q
0 < q
q < 1
der \<in> borel_measurable (nat_filtration n)
- 1 < r

goal (1 subgoal):
 1. infinite_coin_toss_space q N
[PROOF STEP]
by (simp add: infinite_coin_toss_space_def)
[PROOF STATE]
proof (state)
this:
infinite_coin_toss_space q N

goal (1 subgoal):
 1. der \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N ?n)
[PROOF STEP]
show "der \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. der \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N n)
[PROOF STEP]
using assms filt_equiv_filtration
[PROOF STATE]
proof (prove)
using this:
N = bernoulli_stream q
0 < q
q < 1
der \<in> borel_measurable (nat_filtration n)
- 1 < r
filt_equiv ?F ?M ?N \<Longrightarrow> Filtration.filtration ?N ?F

goal (1 subgoal):
 1. der \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N n)
[PROOF STEP]
by (simp add: assms(1) measurable_def nat_filtration_from_eq_sets nat_filtration_space)
[PROOF STATE]
proof (state)
this:
der \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integrable N der

goal (1 subgoal):
 1. integrable N (discounted_value r (\<lambda>m. der) m)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable N der

goal (1 subgoal):
 1. integrable N (discounted_value r (\<lambda>m. der) m)
[PROOF STEP]
using discounted_integrable assms
[PROOF STATE]
proof (prove)
using this:
integrable N der
\<lbrakk>integrable ?N (?X ?n); - 1 < ?r; space ?N = space M\<rbrakk> \<Longrightarrow> integrable ?N (discounted_value ?r ?X ?n)
N = bernoulli_stream q
0 < q
q < 1
der \<in> borel_measurable (nat_filtration n)
- 1 < r

goal (1 subgoal):
 1. integrable N (discounted_value r (\<lambda>m. der) m)
[PROOF STEP]
by (metis \<open>prob_space N\<close> prob_space.discounted_integrable)
[PROOF STATE]
proof (state)
this:
integrable N (discounted_value r (\<lambda>m. der) m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prefix_trans: "\<lbrakk> prefix xs ys; prefix (ys::'a list) zs \<rbrakk> \<Longrightarrow> prefix xs zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prefix xs ys; prefix ys zs\<rbrakk> \<Longrightarrow> prefix xs zs
[PROOF STEP]
by (rule prefix_order.order_trans)


[STATEMENT]
lemma ex_prop_equiv:
     "ex_prop X = (\<forall>G. G \<in> X = (\<forall>H. (G component_of H) --> H \<in> X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ex_prop X = (\<forall>G. (G \<in> X) = (\<forall>H. G component_of H \<longrightarrow> H \<in> X))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>G H. \<lbrakk>ex_prop X; G \<in> X; G component_of H\<rbrakk> \<Longrightarrow> H \<in> X
 2. \<forall>G. (G \<in> X) = (\<forall>H. G component_of H \<longrightarrow> H \<in> X) \<Longrightarrow> ex_prop X
[PROOF STEP]
apply (unfold ex_prop_def component_of_def, safe, blast, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>F G. \<lbrakk>\<forall>G. (G \<in> X) = (\<forall>H. (\<exists>Ga. G ok Ga \<and> G \<squnion> Ga = H) \<longrightarrow> H \<in> X); F ok G; G \<in> X\<rbrakk> \<Longrightarrow> F \<squnion> G \<in> X
[PROOF STEP]
apply (subst Join_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>F G. \<lbrakk>\<forall>G. (G \<in> X) = (\<forall>H. (\<exists>Ga. G ok Ga \<and> G \<squnion> Ga = H) \<longrightarrow> H \<in> X); F ok G; G \<in> X\<rbrakk> \<Longrightarrow> G \<squnion> F \<in> X
[PROOF STEP]
apply (drule ok_sym, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma squarefree_primorial [intro]: "squarefree (primorial x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. squarefree (primorial x)
[PROOF STEP]
unfolding primorial_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. squarefree (\<Prod>{p. prime p \<and> real p \<le> x})
[PROOF STEP]
by (intro squarefree_prod_coprime) (auto simp: squarefree_prime intro: primes_coprime)


[STATEMENT]
lemma hrealpow_hyperpow_Infinitesimal_iff:
  "(x ^ n \<in> Infinitesimal) \<longleftrightarrow> x pow (hypnat_of_nat n) \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x ^ n \<in> Infinitesimal) = (x pow hypnat_of_nat n \<in> Infinitesimal)
[PROOF STEP]
by (simp only: hyperpow_hypnat_of_nat)


[STATEMENT]
lemma (in cpx_sq_mat) rank_1_proj_unitary:
  assumes "A \<in> fc_mats"
and "Complex_Matrix.unitary A"
and "j < dimR"
and "k < dimR"
shows "rank_1_proj (Matrix.col A j) * (rank_1_proj (Matrix.col A k)) =
  (1\<^sub>m dimR) $$ (j,k) \<cdot>\<^sub>m (outer_prod (Matrix.col A j) (Matrix.col A k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
have "rank_1_proj (Matrix.col A j) * (rank_1_proj (Matrix.col A k)) =
    Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
using outer_prod_mult_outer_prod assms Matrix.col_dim local.fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> carrier_vec ?d1.0; ?b \<in> carrier_vec ?d2.0; ?c \<in> carrier_vec ?d2.0; ?d \<in> carrier_vec ?d3.0\<rbrakk> \<Longrightarrow> outer_prod ?a ?b * outer_prod ?c ?d = Complex_Matrix.inner_prod ?b ?c \<cdot>\<^sub>m outer_prod ?a ?d
A \<in> fc_mats
Complex_Matrix.unitary A
j < dimR
k < dimR
Matrix.col ?A ?i \<in> carrier_vec (dim_row ?A)
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
unfolding rank_1_proj_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> carrier_vec ?d1.0; ?b \<in> carrier_vec ?d2.0; ?c \<in> carrier_vec ?d2.0; ?d \<in> carrier_vec ?d3.0\<rbrakk> \<Longrightarrow> outer_prod ?a ?b * outer_prod ?c ?d = Complex_Matrix.inner_prod ?b ?c \<cdot>\<^sub>m outer_prod ?a ?d
A \<in> fc_mats
Complex_Matrix.unitary A
j < dimR
k < dimR
Matrix.col ?A ?i \<in> carrier_vec (dim_row ?A)
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. outer_prod (Matrix.col A j) (Matrix.col A j) * outer_prod (Matrix.col A k) (Matrix.col A k) = Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
have "... = (Complex_Matrix.adjoint A * A) $$ (j, k)\<cdot>\<^sub>m (outer_prod (Matrix.col A j) (Matrix.col A k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k) = (Complex_Matrix.adjoint A * A) $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
using inner_prod_adjoint_comp[of A dimR A] assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<in> carrier_mat dimR dimR; A \<in> carrier_mat dimR dimR; ?i < dimR; ?j < dimR\<rbrakk> \<Longrightarrow> Complex_Matrix.inner_prod (Matrix.col A ?i) (Matrix.col A ?j) = (Complex_Matrix.adjoint A * A) $$ (?i, ?j)
A \<in> fc_mats
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k) = (Complex_Matrix.adjoint A * A) $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k) = (Complex_Matrix.adjoint A * A) $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (Matrix.col A j) (Matrix.col A k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k) = (Complex_Matrix.adjoint A * A) $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
have "... = (1\<^sub>m dimR) $$ (j,k) \<cdot>\<^sub>m (outer_prod (Matrix.col A j) (Matrix.col A k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Complex_Matrix.adjoint A * A) $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
Complex_Matrix.unitary A
j < dimR
k < dimR

goal (1 subgoal):
 1. (Complex_Matrix.adjoint A * A) $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
unfolding Complex_Matrix.unitary_def
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
A \<in> carrier_mat (dim_row A) (dim_row A) \<and> inverts_mat A (Complex_Matrix.adjoint A)
j < dimR
k < dimR

goal (1 subgoal):
 1. (Complex_Matrix.adjoint A * A) $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
by (metis add_commute assms(2) index_add_mat(2) index_one_mat(2) one_mem unitary_simps(1))
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint A * A) $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rank_1_proj (Matrix.col A j) * rank_1_proj (Matrix.col A k) = 1\<^sub>m dimR $$ (j, k) \<cdot>\<^sub>m outer_prod (Matrix.col A j) (Matrix.col A k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma MaxI_ex: "\<lbrakk> \<exists>x. x \<in> A; finite A \<rbrakk> \<Longrightarrow> Max A \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. x \<in> A; finite A\<rbrakk> \<Longrightarrow> Max A \<in> A
[PROOF STEP]
by (blast intro: MaxI)


[STATEMENT]
lemma mod_div_injTr:"\<lbrakk>(0::nat) < r; x mod r = y mod r; x div r = y div r\<rbrakk>
                      \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; x mod r = y mod r; x div r = y div r\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (cut_tac div_mult_mod_eq[of "x" "r"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; x mod r = y mod r; x div r = y div r; x div r * r + x mod r = x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Un_range_binary: "a \<union> b = (\<Union>i::nat. binary a b i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<union> b = \<Union> (range (binary a b))
[PROOF STEP]
by (simp add: range_binary_eq cong del: SUP_cong_simp)


[STATEMENT]
lemma ALGxy_wholerange: "ALGxy A qs init x y
    = (\<Sum>i<(length qs). (if qs ! i \<in> {y, x}
          then ALG' A qs init i y + ALG' A qs init i x
          else 0 ))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
have "ALGxy A qs init x y
      = (\<Sum>i\<in> {i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}.
       ALG' A qs init i y + ALG' A qs init i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i\<in>{i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x)
[PROOF STEP]
unfolding ALGxy_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{..<length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x) = (\<Sum>i\<in>{i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x)
[PROOF STEP]
apply(rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {..<length qs} \<inter> {i. qs ! i \<in> {y, x}} = {i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}
 2. \<And>xa. xa \<in> {i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}} \<Longrightarrow> ALG' A qs init xa y + ALG' A qs init xa x = ALG' A qs init xa y + ALG' A qs init xa x
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {..<length qs} \<inter> {i. qs ! i = y \<or> qs ! i = x} = {i. i < length qs} \<inter> {i. qs ! i = y \<or> qs ! i = x}
 2. \<And>xa. xa \<in> {i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}} \<Longrightarrow> ALG' A qs init xa y + ALG' A qs init xa x = ALG' A qs init xa y + ALG' A qs init xa x
[PROOF STEP]
apply(blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}} \<Longrightarrow> ALG' A qs init xa y + ALG' A qs init xa x = ALG' A qs init xa y + ALG' A qs init xa x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ALGxy A qs init x y = (\<Sum>i\<in>{i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x)

goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ALGxy A qs init x y = (\<Sum>i\<in>{i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x)

goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<in>{i. i < length qs}.  if i \<in> {i. qs ! i \<in> {y, x}}
                                    then ALG' A qs init i y + ALG' A qs init i x
                                    else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x) = (\<Sum>i | i < length qs. if i \<in> {i. qs ! i \<in> {y, x}} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
by(rule sum.inter_restrict) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x) = (\<Sum>i | i < length qs. if i \<in> {i. qs ! i \<in> {y, x}} then ALG' A qs init i y + ALG' A qs init i x else 0)

goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i < length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x) = (\<Sum>i | i < length qs. if i \<in> {i. qs ! i \<in> {y, x}} then ALG' A qs init i y + ALG' A qs init i x else 0)

goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
have "\<dots> = (\<Sum>i<(length qs). (if qs ! i \<in> {y, x}
          then ALG' A qs init i y + ALG' A qs init i x
          else 0 ))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i < length qs. if i \<in> {i. qs ! i \<in> {y, x}} then ALG' A qs init i y + ALG' A qs init i x else 0) = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
apply(rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {i. i < length qs} = {..<length qs}
 2. \<And>xa. xa \<in> {..<length qs} \<Longrightarrow> (if xa \<in> {i. qs ! i \<in> {y, x}} then ALG' A qs init xa y + ALG' A qs init xa x else 0) = (if qs ! xa \<in> {y, x} then ALG' A qs init xa y + ALG' A qs init xa x else 0)
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i < length qs. if i \<in> {i. qs ! i \<in> {y, x}} then ALG' A qs init i y + ALG' A qs init i x else 0) = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)

goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)

goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ALGxy A qs init x y = (\<Sum>i<length qs. if qs ! i \<in> {y, x} then ALG' A qs init i y + ALG' A qs init i x else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Corps) mprod_mem:"\<lbrakk>\<forall>j \<le> n. e j \<in> Zset; \<forall>j \<le> n. f j \<in> ((carrier K) - {\<zero>})\<rbrakk> \<Longrightarrow>  (mprod_exp K e f n) \<in> ((carrier K) - {\<zero>})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>j\<le>n. e j \<in> Zset; \<forall>j\<le>n. f j \<in> carrier K - {\<zero>}\<rbrakk> \<Longrightarrow> mprod_exp K e f n \<in> carrier K - {\<zero>}
[PROOF STEP]
apply (cut_tac mprod_memTr[of n e f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>j\<le>n. e j \<in> Zset; \<forall>j\<le>n. f j \<in> carrier K - {\<zero>}; (\<forall>j\<le>n. e j \<in> Zset) \<and> (\<forall>j\<le>n. f j \<in> carrier K - {\<zero>}) \<longrightarrow> mprod_exp K e f n \<in> carrier K - {\<zero>}\<rbrakk> \<Longrightarrow> mprod_exp K e f n \<in> carrier K - {\<zero>}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in module) lincomb_elim_if [simp]:
  fixes b c S
  assumes h1: "S \<subseteq> carrier M" and h2: "\<And>v. v\<in>S\<Longrightarrow> \<not>P v" and h3: "c\<in>S\<rightarrow>carrier R"
  shows "lincomb (\<lambda>w. if P w then b w else c w) S = lincomb c S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb (\<lambda>w. if P w then b w else c w) S = lincomb c S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier M
?v \<in> S \<Longrightarrow> \<not> P ?v
c \<in> S \<rightarrow> carrier R

goal (1 subgoal):
 1. lincomb (\<lambda>w. if P w then b w else c w) S = lincomb c S
[PROOF STEP]
by (auto cong: finsum_cong2
        simp add: lincomb_def finsum_Un_disjoint summands_valid ring_subset_carrier disj_if)


[STATEMENT]
theorem minimal_APR:
    assumes "dfa.states M = accessible"
      shows "dfa.minimal (APR M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dfa.minimal (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dfa.minimal (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))
[PROOF STEP]
have PR: "dfa (APR M)"
               "dfa (nfa.Power_dfa (Reverse_nfa M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dfa (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M))) &&& dfa (nfa.Power_dfa (Reverse_nfa M))
[PROOF STEP]
by (auto simp: dfa.dfa_Accessible nfa.dfa_Power nfa_Reverse_nfa)
[PROOF STATE]
proof (state)
this:
dfa (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))
dfa (nfa.Power_dfa (Reverse_nfa M))

goal (1 subgoal):
 1. dfa.minimal (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dfa (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))
dfa (nfa.Power_dfa (Reverse_nfa M))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dfa (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))
dfa (nfa.Power_dfa (Reverse_nfa M))

goal (1 subgoal):
 1. dfa.minimal (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))
[PROOF STEP]
apply (simp add: dfa.minimal_def dfa.states_Accessible_dfa dfa.Accessible_accessible)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dfa (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M))); dfa (nfa.Power_dfa (Reverse_nfa M))\<rbrakk> \<Longrightarrow> inj_on (dfa.right_lang (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))) (dfa.accessible (nfa.Power_dfa (Reverse_nfa M)))
[PROOF STEP]
apply (simp add: inj_on_def dfa.Accessible_right_lang_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dfa (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M))); dfa (nfa.Power_dfa (Reverse_nfa M))\<rbrakk> \<Longrightarrow> \<forall>x\<in>dfa.accessible (nfa.Power_dfa (Reverse_nfa M)). \<forall>y\<in>dfa.accessible (nfa.Power_dfa (Reverse_nfa M)). dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) x = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) y \<longrightarrow> x = y
[PROOF STEP]
apply (meson assms dfa.accessible_imp_states inj_onD inj_on_right_lang_PR)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
dfa.minimal (dfa.Accessible_dfa (nfa.Power_dfa (Reverse_nfa M)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mcont_ldropn_aux: "mcont lSup lprefix (fun_lub lSup) (fun_ord lprefix) (\<lambda>xs n. ldropn n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mcont lSup (\<sqsubseteq>) llist.lub_fun llist.le_fun (\<lambda>xs n. ldropn n xs)
[PROOF STEP]
by(rule llist_lift.fixp_preserves_mcont1[OF ldrop_mono ldrop_conv_fixp])
  (simp add: ldropn_fixp_case_conv mcont_fun_lub_apply)


[STATEMENT]
lemma transfer_all [transfer_intro]:
  "(\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>) \<Longrightarrow>
    \<forall>x::'a star. p x \<equiv> eventually (\<lambda>n. \<forall>x. P n x) \<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. p (star_n X) \<equiv> \<forall>\<^sub>F n in \<U>. P n (X n)) \<Longrightarrow> \<forall>x. p x \<equiv> \<forall>\<^sub>F n in \<U>. \<forall>x. P n x
[PROOF STEP]
by (simp only: all_star_eq FreeUltrafilterNat.eventually_all_iff)


[STATEMENT]
lemma distinct_mset_remove1_All: "distinct_mset C \<Longrightarrow> remove1_mset L C = removeAll_mset L C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct_mset C \<Longrightarrow> remove1_mset L C = removeAll_mset L C
[PROOF STEP]
by (auto simp: multiset_eq_iff distinct_mset_count_less_1)


[STATEMENT]
lemma nn_set_integral_add:
  assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
          "A \<in> sets M"
  shows "(\<integral>\<^sup>+x \<in> A. (f x + g x) \<partial>M) = (\<integral>\<^sup>+x \<in> A. f x \<partial>M) + (\<integral>\<^sup>+x \<in> A. g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g
[PROOF STEP]
have "(\<integral>\<^sup>+x \<in> A. (f x + g x) \<partial>M) = (\<integral>\<^sup>+x. (f x * indicator A x + g x * indicator A x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = \<integral>\<^sup>+ x. f x * indicator A x + g x * indicator A x \<partial>M
[PROOF STEP]
by (auto simp add: indicator_def intro!: nn_integral_cong)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = \<integral>\<^sup>+ x. f x * indicator A x + g x * indicator A x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = \<integral>\<^sup>+ x. f x * indicator A x + g x * indicator A x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g
[PROOF STEP]
have "... = (\<integral>\<^sup>+x. f x * indicator A x \<partial>M) + (\<integral>\<^sup>+x. g x * indicator A x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * indicator A x + g x * indicator A x \<partial>M = set_nn_integral M A f + set_nn_integral M A g
[PROOF STEP]
apply (rule nn_integral_add)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>x. f x * indicator A x) \<in> borel_measurable M
 2. (\<lambda>x. g x * indicator A x) \<in> borel_measurable M
[PROOF STEP]
using assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable M
g \<in> borel_measurable M

goal (2 subgoals):
 1. (\<lambda>x. f x * indicator A x) \<in> borel_measurable M
 2. (\<lambda>x. g x * indicator A x) \<in> borel_measurable M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * indicator A x + g x * indicator A x \<partial>M = set_nn_integral M A f + set_nn_integral M A g

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = set_nn_integral M A f + set_nn_integral M A g

goal:
No subgoals!
[PROOF STEP]
qed