[STATEMENT]
lemma sum_tendsto_fds_perzeta:
  assumes "Re s > 1"
  shows   "(\<lambda>n. \<Sum>k\<in>{0<..n}. exp (2 * real k * pi * q * \<i>) * of_nat k powr - s)
              \<longlonglongrightarrow> eval_fds (fds_perzeta q) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
have "(\<lambda>m. exp (2 * pi * \<i> * Suc m * q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
by (intro sums_fds_perzeta assms)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
hence "(\<lambda>n. \<Sum>k<n. exp (2 * real (Suc k) * pi * q * \<i>) * of_nat (Suc k) powr -s) \<longlonglongrightarrow>
           eval_fds (fds_perzeta q) s"
    (is "filterlim ?f _ _")
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k<n. exp (complex_of_real (2 * real (Suc k) * pi * q) * \<i>) * of_nat (Suc k) powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
by (simp add: sums_def powr_minus field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k<n. exp (complex_of_real (2 * real (Suc k) * pi * q) * \<i>) * of_nat (Suc k) powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k<n. exp (complex_of_real (2 * real (Suc k) * pi * q) * \<i>) * of_nat (Suc k) powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
have "?f = (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (2 * real k * pi * q * \<i>) * of_nat k powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k<n. exp (complex_of_real (2 * real (Suc k) * pi * q) * \<i>) * of_nat (Suc k) powr - s) = (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s)
[PROOF STEP]
by (intro ext sum.reindex_bij_betw sum.reindex_bij_witness[of _ "\<lambda>n. n - 1" Suc]) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k<n. exp (complex_of_real (2 * real (Suc k) * pi * q) * \<i>) * of_nat (Suc k) powr - s) = (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s)

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k\<in>{0<..n}. exp (complex_of_real (2 * real k * pi * q) * \<i>) * of_nat k powr - s) \<longlonglongrightarrow> eval_fds (fds_perzeta q) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma affine_hull_open_segment [simp]:
    fixes a :: "'a::euclidean_space"
    shows "affine hull (open_segment a b) = (if a = b then {} else affine hull {a,b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull open_segment a b = (if a = b then {} else affine hull {a, b})
[PROOF STEP]
by (metis affine_hull_convex_hull affine_hull_empty closure_open_segment closure_same_affine_hull segment_convex_hull)


[STATEMENT]
lemma count_mset_split_image_filter:
  assumes "\<And> x. x \<in>#A \<Longrightarrow> a \<noteq> g x"
  shows "count (image_mset (\<lambda>x. if P x then a else g x) A ) a = size (filter_mset P A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count {#if P x then a else g x. x \<in># A#} a = size (filter_mset P A)
[PROOF STEP]
using image_mset_If image_mset_filter_swap size_image_mset
[PROOF STATE]
proof (prove)
using this:
{#if ?P x then ?f x else ?g x. x \<in># ?A#} = image_mset ?f (filter_mset ?P ?A) + image_mset ?g {#x \<in># ?A. \<not> ?P x#}
image_mset ?f {#x \<in># ?M. ?P (?f x)#} = filter_mset ?P (image_mset ?f ?M)
size (image_mset ?f ?M) = size ?M

goal (1 subgoal):
 1. count {#if P x then a else g x. x \<in># A#} a = size (filter_mset P A)
[PROOF STEP]
by (smt (verit) assms count_size_set_repr filter_mset_cong)


[STATEMENT]
lemma openin_contains_ball:
    "openin (top_of_set T) S \<longleftrightarrow>
     S \<subseteq> T \<and> (\<forall>x \<in> S. \<exists>e. 0 < e \<and> ball x e \<inter> T \<subseteq> S)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set T) S = (S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. openin (top_of_set T) S \<Longrightarrow> S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S)
 2. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
openin (top_of_set T) S

goal (2 subgoals):
 1. openin (top_of_set T) S \<Longrightarrow> S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S)
 2. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
openin (top_of_set T) S
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
openin (top_of_set T) S

goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S)
[PROOF STEP]
apply (simp add: openin_open)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Ta. open Ta \<and> S = T \<inter> Ta \<Longrightarrow> S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S)
[PROOF STEP]
apply (metis Int_commute Int_mono inf.cobounded2 open_contains_ball order_refl subsetCE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S)

goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S)

goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S)
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S)

goal (1 subgoal):
 1. openin (top_of_set T) S
[PROOF STEP]
apply (simp add: openin_euclidean_subtopology_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. ball x e \<inter> T \<subseteq> S) \<Longrightarrow> \<forall>x\<in>S. \<exists>e>0. \<forall>x'\<in>T. dist x' x < e \<longrightarrow> x' \<in> S
[PROOF STEP]
by (metis (no_types) Int_iff dist_commute inf.absorb_iff2 mem_ball)
[PROOF STATE]
proof (state)
this:
openin (top_of_set T) S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_product_topology_closure_of:
   "z \<in> (product_topology X I) closure_of S
        \<Longrightarrow> i \<in> I \<Longrightarrow> z i \<in> ((X i) closure_of ((\<lambda>x. x i) ` S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>z \<in> product_topology X I closure_of S; i \<in> I\<rbrakk> \<Longrightarrow> z i \<in> X i closure_of (\<lambda>x. x i) ` S
[PROOF STEP]
using continuous_map_product_projection
[PROOF STATE]
proof (prove)
using this:
?k \<in> ?I \<Longrightarrow> continuous_map (product_topology ?X ?I) (?X ?k) (\<lambda>x. x ?k)

goal (1 subgoal):
 1. \<lbrakk>z \<in> product_topology X I closure_of S; i \<in> I\<rbrakk> \<Longrightarrow> z i \<in> X i closure_of (\<lambda>x. x i) ` S
[PROOF STEP]
by (force simp: continuous_map_eq_image_closure_subset image_subset_iff)


[STATEMENT]
lemma Upair_fsteq: "(Upair a b = Upair a c) = ((a = b & a = c) | (b = c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Upair a b = Upair a c) = (a = b \<and> a = c \<or> b = c)
[PROOF STEP]
by (auto simp add: Ext[where x="Upair a b"] Upair)


[STATEMENT]
lemma linear_compose_sum:
  assumes lS: "\<forall>a \<in> S. linear s1 s2 (f a)"
  shows "linear s1 s2 (\<lambda>x. sum (\<lambda>a. f a x) S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
proof (cases "finite S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
 2. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite S

goal (2 subgoals):
 1. finite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
 2. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
using lS
[PROOF STATE]
proof (prove)
using this:
finite S
\<forall>a\<in>S. linear (*a) (*b) (f a)

goal (1 subgoal):
 1. linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
by induct (simp_all add: linear_zero linear_compose_add)
[PROOF STATE]
proof (state)
this:
linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)

goal (1 subgoal):
 1. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite S

goal (1 subgoal):
 1. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite S

goal (1 subgoal):
 1. linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
by (simp add: linear_zero)
[PROOF STATE]
proof (state)
this:
linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_slice_nth_eq_sublist_list: "
  m < length xs div k \<Longrightarrow> list_slice xs k ! m = sublist_list xs [m * k..<m * k + k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < length xs div k \<Longrightarrow> list_slice xs k ! m = sublist_list xs [m * k..<m * k + k]
[PROOF STEP]
apply (simp add: list_slice_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < length xs div k \<Longrightarrow> xs \<up> (m * k) \<down> k = sublist_list xs [m * k..<m * k + k]
[PROOF STEP]
apply (rule take_drop_eq_sublist_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < length xs div k \<Longrightarrow> m * k + k \<le> length xs
[PROOF STEP]
apply (rule less_div_imp_mult_add_divisor_le, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_nat_mult [simp]: "\<guillemotleft>i * j\<guillemotright>\<^sub>\<nat> = \<guillemotleft>i\<guillemotright>\<^sub>\<nat> \<otimes> \<guillemotleft>j\<guillemotright>\<^sub>\<nat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<guillemotleft>i * j\<guillemotright>\<^sub>\<nat> = \<guillemotleft>i\<guillemotright>\<^sub>\<nat> \<otimes> \<guillemotleft>j\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
by (induct i) (simp_all add: l_distr)


[STATEMENT]
lemma small_powers_of_2:
  "x \<ge> 3 \<Longrightarrow> x < 2 ^ (x - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 \<le> x \<Longrightarrow> x < 2 ^ (x - 1)
[PROOF STEP]
by (induct x; simp add: suc_le_pow_2)


[STATEMENT]
lemma convex_same_rel_interior_closure:
  fixes S :: "'n::euclidean_space set"
  shows "\<lbrakk>convex S; convex T\<rbrakk>
         \<Longrightarrow> rel_interior S = rel_interior T \<longleftrightarrow> closure S = closure T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex S; convex T\<rbrakk> \<Longrightarrow> (rel_interior S = rel_interior T) = (closure S = closure T)
[PROOF STEP]
by (simp add: closure_eq_rel_interior_eq)


[STATEMENT]
lemma digit_diff_split:
  fixes n::nat and nd::nat and x::nat
  shows "n = (\<Sum>x\<in>{..<nd}. (D x)*((10::nat)^x)) \<Longrightarrow>
             (n - (\<Sum>x<nd. (D x))) = (\<Sum>x<nd. (D x)*(10^x - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = (\<Sum>x<nd. D x * 10 ^ x) \<Longrightarrow> n - sum D {..<nd} = (\<Sum>x<nd. D x * (10 ^ x - 1))
[PROOF STEP]
by (simp add: sum_diff_distrib diff_mult_distrib2)


[STATEMENT]
lemma ENR_homeomorphic_ENR:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "ENR T" "S homeomorphic T"
    shows "ENR S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ENR S
[PROOF STEP]
unfolding ENR_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>U. open U \<and> S retract_of U
[PROOF STEP]
by (meson ENR_imp_absolute_neighbourhood_retract_UNIV assms homeomorphic_sym)


[STATEMENT]
lemma join_trees:
  assumes TREE: "tree g\<^sub>1" "tree g\<^sub>2"
  assumes DJ: "nodes g\<^sub>1 \<inter> nodes g\<^sub>2 = {}"
  assumes IN_NODES: "u\<in>nodes g\<^sub>1" "v\<in>nodes g\<^sub>2"
  shows "tree (ins_edge (u,v) (graph_join g\<^sub>1 g\<^sub>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tree (ins_edge (u, v) (graph_join g\<^sub>1 g\<^sub>2))
[PROOF STEP]
using assms join_cycle_free join_connected
[PROOF STATE]
proof (prove)
using this:
tree g\<^sub>1
tree g\<^sub>2
nodes g\<^sub>1 \<inter> nodes g\<^sub>2 = {}
u \<in> nodes g\<^sub>1
v \<in> nodes g\<^sub>2
\<lbrakk>cycle_free ?g\<^sub>1; cycle_free ?g\<^sub>2; nodes ?g\<^sub>1 \<inter> nodes ?g\<^sub>2 = {}; ?u \<in> nodes ?g\<^sub>1; ?v \<in> nodes ?g\<^sub>2\<rbrakk> \<Longrightarrow> cycle_free (ins_edge (?u, ?v) (graph_join ?g\<^sub>1 ?g\<^sub>2))
\<lbrakk>Undirected_Graph.connected ?g\<^sub>1; Undirected_Graph.connected ?g\<^sub>2; ?u \<in> nodes ?g\<^sub>1; ?v \<in> nodes ?g\<^sub>2\<rbrakk> \<Longrightarrow> Undirected_Graph.connected (ins_edge (?u, ?v) (graph_join ?g\<^sub>1 ?g\<^sub>2))

goal (1 subgoal):
 1. tree (ins_edge (u, v) (graph_join g\<^sub>1 g\<^sub>2))
[PROOF STEP]
unfolding tree_def
[PROOF STATE]
proof (prove)
using this:
Undirected_Graph.connected g\<^sub>1 \<and> cycle_free g\<^sub>1
Undirected_Graph.connected g\<^sub>2 \<and> cycle_free g\<^sub>2
nodes g\<^sub>1 \<inter> nodes g\<^sub>2 = {}
u \<in> nodes g\<^sub>1
v \<in> nodes g\<^sub>2
\<lbrakk>cycle_free ?g\<^sub>1; cycle_free ?g\<^sub>2; nodes ?g\<^sub>1 \<inter> nodes ?g\<^sub>2 = {}; ?u \<in> nodes ?g\<^sub>1; ?v \<in> nodes ?g\<^sub>2\<rbrakk> \<Longrightarrow> cycle_free (ins_edge (?u, ?v) (graph_join ?g\<^sub>1 ?g\<^sub>2))
\<lbrakk>Undirected_Graph.connected ?g\<^sub>1; Undirected_Graph.connected ?g\<^sub>2; ?u \<in> nodes ?g\<^sub>1; ?v \<in> nodes ?g\<^sub>2\<rbrakk> \<Longrightarrow> Undirected_Graph.connected (ins_edge (?u, ?v) (graph_join ?g\<^sub>1 ?g\<^sub>2))

goal (1 subgoal):
 1. Undirected_Graph.connected (ins_edge (u, v) (graph_join g\<^sub>1 g\<^sub>2)) \<and> cycle_free (ins_edge (u, v) (graph_join g\<^sub>1 g\<^sub>2))
[PROOF STEP]
by metis


[STATEMENT]
lemma inorder_join:
  "inorder(join l r) = inorder l @ inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tree2.inorder (join l r) = Tree2.inorder l @ Tree2.inorder r
[PROOF STEP]
by(induction l r rule: join.induct)
  (auto simp: inorder_baldL inorder_baldR split: tree.split color.split)


[STATEMENT]
lemma cis_times_cis_opposite [simp]:
  shows "cis \<phi> * cis (- \<phi>) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis \<phi> * cis (- \<phi>) = 1
[PROOF STEP]
by (simp add: cis_mult)


[STATEMENT]
lemma DERIV_local_min:
  fixes f :: "real \<Rightarrow> real"
  shows "DERIV f x :> l \<Longrightarrow> 0 < d \<Longrightarrow> \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> f x \<le> f y \<Longrightarrow> l = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_real_derivative l) (at x); 0 < d; \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> f x \<le> f y\<rbrakk> \<Longrightarrow> l = 0
[PROOF STEP]
by (drule DERIV_minus [THEN DERIV_local_max]) auto


[STATEMENT]
lemma extreme_point_of_convex_hull_convex_independent:
  fixes S :: "'a::euclidean_space set"
  assumes "compact S" and S: "\<And>a. a \<in> S \<Longrightarrow> a \<notin> convex hull (S - {a})"
  shows "(x extreme_point_of (convex hull S) \<longleftrightarrow> x \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x extreme_point_of convex hull S) = (x \<in> S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x extreme_point_of convex hull S) = (x \<in> S)
[PROOF STEP]
have "convex hull T \<noteq> convex hull S" if "T \<subset> S" for T
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull T \<noteq> convex hull S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex hull T \<noteq> convex hull S
[PROOF STEP]
obtain a where  "T \<subseteq> S" "a \<in> S" "a \<notin> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>T \<subseteq> S; a \<in> S; a \<notin> T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>T \<subset> S\<close>
[PROOF STATE]
proof (prove)
using this:
T \<subset> S

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>T \<subseteq> S; a \<in> S; a \<notin> T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
T \<subseteq> S
a \<in> S
a \<notin> T

goal (1 subgoal):
 1. convex hull T \<noteq> convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T \<subseteq> S
a \<in> S
a \<notin> T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> S
a \<in> S
a \<notin> T

goal (1 subgoal):
 1. convex hull T \<noteq> convex hull S
[PROOF STEP]
by (metis (full_types) Diff_eq_empty_iff Diff_insert0 S hull_mono hull_subset insert_Diff_single subsetCE)
[PROOF STATE]
proof (state)
this:
convex hull T \<noteq> convex hull S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?T \<subset> S \<Longrightarrow> convex hull ?T \<noteq> convex hull S

goal (1 subgoal):
 1. (x extreme_point_of convex hull S) = (x \<in> S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?T \<subset> S \<Longrightarrow> convex hull ?T \<noteq> convex hull S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?T \<subset> S \<Longrightarrow> convex hull ?T \<noteq> convex hull S

goal (1 subgoal):
 1. (x extreme_point_of convex hull S) = (x \<in> S)
[PROOF STEP]
by (rule extreme_point_of_convex_hull_eq [OF \<open>compact S\<close>])
[PROOF STATE]
proof (state)
this:
(x extreme_point_of convex hull S) = (x \<in> S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_CollectI: "B \<subseteq> A \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> Q x \<Longrightarrow> P x) \<Longrightarrow> ({x \<in> B. Q x} \<subseteq> {x \<in> A. P x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<subseteq> A; \<And>x. \<lbrakk>x \<in> B; Q x\<rbrakk> \<Longrightarrow> P x\<rbrakk> \<Longrightarrow> {x \<in> B. Q x} \<subseteq> {x \<in> A. P x}
[PROOF STEP]
by blast


[STATEMENT]
lemma ii_squared [simp]: "quat_ii\<^sup>2 = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i>\<^sup>2 = - 1
[PROOF STEP]
by (simp add: power2_eq_square quat.expand)


[STATEMENT]
lemma Qp_funs_add''':
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "(f \<oplus>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> g) x = f x \<oplus>\<^bsub>Q\<^sub>p\<^esub> g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<oplus>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g) x = f x \<oplus> g x
[PROOF STEP]
using assms function_ring_def[of "carrier (Q\<^sub>p\<^bsup>n\<^esup>)" "Q\<^sub>p"]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p = \<lparr>carrier = carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow>\<^sub>E carrier Q\<^sub>p, monoid.mult = function_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, one = function_one (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, zero = function_zero (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, add = function_add (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, smult = function_scalar_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<rparr>

goal (1 subgoal):
 1. (f \<oplus>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g) x = f x \<oplus> g x
[PROOF STEP]
unfolding function_add_def
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p = \<lparr>carrier = carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow>\<^sub>E carrier Q\<^sub>p, monoid.mult = function_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, one = function_one (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, zero = function_zero (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, add = \<lambda>f g. \<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<oplus> g x, smult = function_scalar_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<rparr>

goal (1 subgoal):
 1. (f \<oplus>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g) x = f x \<oplus> g x
[PROOF STEP]
by (metis (mono_tags, lifting) restrict_apply' ring_record_simps(12))


[STATEMENT]
lemma monom_valuate:
  assumes "is_monom m"
  shows "m\<lbrace>v\<rbrace> = (monom_coeff m) *R v (monom_var m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<lbrace> v \<rbrace> = monom_coeff m *R v (monom_var m)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_monom m

goal (1 subgoal):
 1. m \<lbrace> v \<rbrace> = monom_coeff m *R v (monom_var m)
[PROOF STEP]
using is_monom_vars_monom_var
[PROOF STATE]
proof (prove)
using this:
is_monom m
is_monom ?l \<Longrightarrow> vars ?l = {monom_var ?l}

goal (1 subgoal):
 1. m \<lbrace> v \<rbrace> = monom_coeff m *R v (monom_var m)
[PROOF STEP]
by (simp add: vars_def coeff_def monom_coeff_def valuate_def)


[STATEMENT]
lemma cross_ratio_inversion [simp]:
  assumes "u \<noteq> v" and "v \<noteq> w" and "u \<noteq> w"
  shows "cross_ratio (inversion z) (inversion u) (inversion v) (inversion w) =
         conjugate (cross_ratio z u v w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_ratio (inversion z) (inversion u) (inversion v) (inversion w) = conjugate (cross_ratio z u v w)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cross_ratio (inversion z) (inversion u) (inversion v) (inversion w) = conjugate (cross_ratio z u v w)
[PROOF STEP]
have "reciprocal u \<noteq> reciprocal v" "reciprocal u \<noteq> reciprocal w" "reciprocal v \<noteq> reciprocal w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal u \<noteq> reciprocal v &&& reciprocal u \<noteq> reciprocal w &&& reciprocal v \<noteq> reciprocal w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<noteq> v
v \<noteq> w
u \<noteq> w

goal (1 subgoal):
 1. reciprocal u \<noteq> reciprocal v &&& reciprocal u \<noteq> reciprocal w &&& reciprocal v \<noteq> reciprocal w
[PROOF STEP]
by ((subst moebius_reciprocal[symmetric])+, simp del: moebius_reciprocal)+
[PROOF STATE]
proof (state)
this:
reciprocal u \<noteq> reciprocal v
reciprocal u \<noteq> reciprocal w
reciprocal v \<noteq> reciprocal w

goal (1 subgoal):
 1. cross_ratio (inversion z) (inversion u) (inversion v) (inversion w) = conjugate (cross_ratio z u v w)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
reciprocal u \<noteq> reciprocal v
reciprocal u \<noteq> reciprocal w
reciprocal v \<noteq> reciprocal w

goal (1 subgoal):
 1. cross_ratio (inversion z) (inversion u) (inversion v) (inversion w) = conjugate (cross_ratio z u v w)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
reciprocal u \<noteq> reciprocal v
reciprocal u \<noteq> reciprocal w
reciprocal v \<noteq> reciprocal w
u \<noteq> v
v \<noteq> w
u \<noteq> w

goal (1 subgoal):
 1. cross_ratio (inversion z) (inversion u) (inversion v) (inversion w) = conjugate (cross_ratio z u v w)
[PROOF STEP]
unfolding inversion_def
[PROOF STATE]
proof (prove)
using this:
reciprocal u \<noteq> reciprocal v
reciprocal u \<noteq> reciprocal w
reciprocal v \<noteq> reciprocal w
u \<noteq> v
v \<noteq> w
u \<noteq> w

goal (1 subgoal):
 1. cross_ratio ((conjugate \<circ> reciprocal) z) ((conjugate \<circ> reciprocal) u) ((conjugate \<circ> reciprocal) v) ((conjugate \<circ> reciprocal) w) = conjugate (cross_ratio z u v w)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cross_ratio (inversion z) (inversion u) (inversion v) (inversion w) = conjugate (cross_ratio z u v w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma triangle_set_graph_edge_ss_bound:
  fixes G :: "ugraph" and Gnew :: "ugraph"
  assumes "uwellformed G" "finite (uverts G)" "uedges Gnew \<subseteq> uedges G" "uverts Gnew = uverts G"
  shows "card (triangle_set G) \<ge> card (triangle_set Gnew)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (triangle_set Gnew) \<le> card (triangle_set G)
[PROOF STEP]
by (simp add: assms card_mono finite_triangle_set triangle_set_graph_edge_ss)


[STATEMENT]
lemma rHom_one:"\<lbrakk> Ring A; Ring R;f \<in> rHom A R \<rbrakk> \<Longrightarrow> f (1\<^sub>r\<^bsub>A\<^esub>) = (1\<^sub>r\<^bsub>R\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; f \<in> rHom A R\<rbrakk> \<Longrightarrow> f 1\<^sub>r\<^bsub>A\<^esub> = 1\<^sub>r\<^bsub>R\<^esub>
[PROOF STEP]
by (simp add:rHom_def)


[STATEMENT]
lemma starP2_star_n: "( *p2* P) (star_n X) (star_n Y) = (eventually (\<lambda>n. P (X n) (Y n)) \<U>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*p2* P) (star_n X) (star_n Y) = (\<forall>\<^sub>F n in \<U>. P (X n) (Y n))
[PROOF STEP]
by (simp only: starP2_def star_of_def Ifun_star_n unstar_star_n)


[STATEMENT]
lemma Arcsin_Arccos_csqrt_pos:
    "(0 < Re z | Re z = 0 & 0 \<le> Im z) \<Longrightarrow> Arcsin z = Arccos(csqrt(1 - z\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re z \<or> Re z = 0 \<and> 0 \<le> Im z \<Longrightarrow> Arcsin z = Arccos (csqrt (1 - z\<^sup>2))
[PROOF STEP]
by (simp add: Arcsin_def Arccos_def Complex.csqrt_square add.commute)


[STATEMENT]
lemma supports_subset:
  fixes x  :: "'a"
  and   S1 :: "'x set"
  and   S2 :: "'x set"
  assumes  a: "S1 supports x"
  and      b: "S1 \<subseteq> S2"
  shows "S2 supports x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S2 supports x
[PROOF STEP]
using a b
[PROOF STATE]
proof (prove)
using this:
S1 supports x
S1 \<subseteq> S2

goal (1 subgoal):
 1. S2 supports x
[PROOF STEP]
by (force simp add: supports_def)


[STATEMENT]
lemma eval_pochhammer_poly: "poly (pochhammer_poly n) k = pochhammer k n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (pochhammer_poly n) k = pochhammer k n
[PROOF STEP]
by (cases n) (auto simp add: pochhammer_poly_altdef poly_prod add_ac lessThan_Suc_atMost
                               pochhammer_Suc_prod atLeast0AtMost)


[STATEMENT]
lemma transitive:
  fixes P :: pi
  and   Q :: pi
  and   R :: pi

  assumes "P \<simeq>\<^sup>s Q"
  and     "Q \<simeq>\<^sup>s R"

  shows "P \<simeq>\<^sup>s R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<simeq>\<^sup>s R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P \<simeq>\<^sup>s Q
Q \<simeq>\<^sup>s R

goal (1 subgoal):
 1. P \<simeq>\<^sup>s R
[PROOF STEP]
by(auto simp add: weakCongruenceSubst_def intro: Weak_Early_Cong.transitive)


[STATEMENT]
lemma inverse_mod_pow:
  "(inverse_mod x (p ^ n) * x) mod (p ^ n) = 1"
  if "coprime x p" "p > 1" "n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse_mod x (p ^ n) * x mod p ^ n = 1
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
comm_monoid_mult_class.coprime x p
1 < p
n \<noteq> 0

goal (1 subgoal):
 1. inverse_mod x (p ^ n) * x mod p ^ n = 1
[PROOF STEP]
by (auto intro: inverse_mod)


[STATEMENT]
lemma find_max_nat_correct:
  "\<lbrakk>P 0; 0<u\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i<u \<and> P i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0; 0 < u\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}
[PROOF STEP]
apply (induction u)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>P 0; 0 < 0\<rbrakk> \<Longrightarrow> find_max_nat 0 P = Max {i. i < 0 \<and> P i}
 2. \<And>u. \<lbrakk>\<lbrakk>P 0; 0 < u\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; 0 < Suc u\<rbrakk> \<Longrightarrow> find_max_nat (Suc u) P = Max {i. i < Suc u \<and> P i}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>u. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; P u\<rbrakk> \<Longrightarrow> u = Max {i. i < Suc u \<and> P i}
 2. \<And>u. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; \<not> P u\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i < Suc u \<and> P i}
[PROOF STEP]
apply (rule Max_eqI[THEN sym])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>u. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; P u\<rbrakk> \<Longrightarrow> finite {i. i < Suc u \<and> P i}
 2. \<And>u y. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; P u; y \<in> {i. i < Suc u \<and> P i}\<rbrakk> \<Longrightarrow> y \<le> u
 3. \<And>u. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; P u\<rbrakk> \<Longrightarrow> u \<in> {i. i < Suc u \<and> P i}
 4. \<And>u. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; \<not> P u\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i < Suc u \<and> P i}
[PROOF STEP]
apply auto [3]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; \<not> P u\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i < Suc u \<and> P i}
[PROOF STEP]
apply (case_tac u)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>u. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; \<not> P u; u = 0\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i < Suc u \<and> P i}
 2. \<And>u nat. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; \<not> P u; u = Suc nat\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i < Suc u \<and> P i}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u nat. \<lbrakk>0 < u \<Longrightarrow> find_max_nat u P = Max {i. i < u \<and> P i}; P 0; \<not> P u; u = Suc nat\<rbrakk> \<Longrightarrow> find_max_nat u P = Max {i. i < Suc u \<and> P i}
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>(if P nat then nat else find_max_nat nat P) = Max {i. i < Suc nat \<and> P i}; P 0; \<not> P (Suc nat)\<rbrakk> \<Longrightarrow> Max {i. i < Suc nat \<and> P i} = Max {i. i < Suc (Suc nat) \<and> P i}
[PROOF STEP]
by (metis less_SucI less_antisym)


[STATEMENT]
lemma list_append_idx_prop :
  "(\<forall> i . (i < length xs \<longrightarrow> P (xs ! i)))
    = (\<forall> j . ((j < length (ys@xs) \<and> j \<ge> length ys) \<longrightarrow> P ((ys@xs) ! j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<length xs. P (xs ! i)) = (\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>i<length xs. P (xs ! i)) = (\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j))
[PROOF STEP]
have "\<And> j . \<forall>i<length xs. P (xs ! i) \<Longrightarrow> j < length (ys @ xs)
              \<Longrightarrow> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>\<forall>i<length xs. P (xs ! i); j < length (ys @ xs)\<rbrakk> \<Longrightarrow> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j)
[PROOF STEP]
by (simp add: nth_append)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>i<length xs. P (xs ! i); ?j < length (ys @ xs)\<rbrakk> \<Longrightarrow> length ys \<le> ?j \<longrightarrow> P ((ys @ xs) ! ?j)

goal (1 subgoal):
 1. (\<forall>i<length xs. P (xs ! i)) = (\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>i<length xs. P (xs ! i); ?j < length (ys @ xs)\<rbrakk> \<Longrightarrow> length ys \<le> ?j \<longrightarrow> P ((ys @ xs) ! ?j)

goal (1 subgoal):
 1. (\<forall>i<length xs. P (xs ! i)) = (\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j))
[PROOF STEP]
have "\<And> i . (\<forall> j . ((j < length (ys@xs) \<and> j \<ge> length ys) \<longrightarrow> P ((ys@xs) ! j)))
                  \<Longrightarrow> i < length xs \<Longrightarrow> P (xs ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); i < length xs\<rbrakk> \<Longrightarrow> P (xs ! i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); i < length xs\<rbrakk> \<Longrightarrow> P (xs ! i)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); i < length xs\<rbrakk> \<Longrightarrow> P (xs ! i)
[PROOF STEP]
assume "(\<forall> j . ((j < length (ys@xs) \<and> j \<ge> length ys) \<longrightarrow> P ((ys@xs) ! j)))"
             and "i < length xs"
[PROOF STATE]
proof (state)
this:
\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j)
i < length xs

goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); i < length xs\<rbrakk> \<Longrightarrow> P (xs ! i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j)
i < length xs
[PROOF STEP]
have "P ((ys@xs) ! (length ys + i))"
[PROOF STATE]
proof (prove)
using this:
\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j)
i < length xs

goal (1 subgoal):
 1. P ((ys @ xs) ! (length ys + i))
[PROOF STEP]
by (metis add_strict_left_mono le_add1 length_append)
[PROOF STATE]
proof (state)
this:
P ((ys @ xs) ! (length ys + i))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); i < length xs\<rbrakk> \<Longrightarrow> P (xs ! i)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P ((ys @ xs) ! (length ys + i))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); i < length xs\<rbrakk> \<Longrightarrow> P (xs ! i)
[PROOF STEP]
have "P (xs ! i) = P ((ys@xs) ! (length ys + i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (xs ! i) = P ((ys @ xs) ! (length ys + i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P (xs ! i) = P ((ys @ xs) ! (length ys + i))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); i < length xs\<rbrakk> \<Longrightarrow> P (xs ! i)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P ((ys @ xs) ! (length ys + i))
P (xs ! i) = P ((ys @ xs) ! (length ys + i))
[PROOF STEP]
show "P (xs ! i)"
[PROOF STATE]
proof (prove)
using this:
P ((ys @ xs) ! (length ys + i))
P (xs ! i) = P ((ys @ xs) ! (length ys + i))

goal (1 subgoal):
 1. P (xs ! i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P (xs ! i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); ?i < length xs\<rbrakk> \<Longrightarrow> P (xs ! ?i)

goal (1 subgoal):
 1. (\<forall>i<length xs. P (xs ! i)) = (\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<forall>i<length xs. P (xs ! i); ?j < length (ys @ xs)\<rbrakk> \<Longrightarrow> length ys \<le> ?j \<longrightarrow> P ((ys @ xs) ! ?j)
\<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); ?i < length xs\<rbrakk> \<Longrightarrow> P (xs ! ?i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>i<length xs. P (xs ! i); ?j < length (ys @ xs)\<rbrakk> \<Longrightarrow> length ys \<le> ?j \<longrightarrow> P ((ys @ xs) ! ?j)
\<lbrakk>\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j); ?i < length xs\<rbrakk> \<Longrightarrow> P (xs ! ?i)

goal (1 subgoal):
 1. (\<forall>i<length xs. P (xs ! i)) = (\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>i<length xs. P (xs ! i)) = (\<forall>j. j < length (ys @ xs) \<and> length ys \<le> j \<longrightarrow> P ((ys @ xs) ! j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_greaterThanAtMost: "m < n \<Longrightarrow> Max {m<..(n::nat)} = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < n \<Longrightarrow> Max {m<..n} = n
[PROOF STEP]
by (simp add: atLeastSucAtMost_greaterThanAtMost[symmetric] atLeastLessThanSuc_atLeastAtMost[symmetric] Max_atLeastLessThan)


[STATEMENT]
lemma abs_tan_ge: "\<bar>x\<bar> < pi/2 \<Longrightarrow> \<bar>x\<bar> \<le> \<bar>tan x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<bar> < pi / 2 \<Longrightarrow> \<bar>x\<bar> \<le> \<bar>tan x\<bar>
[PROOF STEP]
by (metis abs_arctan_le abs_less_iff arctan_tan minus_less_iff)


[STATEMENT]
lemma three_step2_phase_Suc:
  "three_step r = 2 \<Longrightarrow> (3 * (Suc (three_phase r)) - 1) = r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. three_step r = 2 \<Longrightarrow> 3 * Suc (three_phase r) - 1 = r
[PROOF STEP]
apply(simp add: three_step_def three_phase_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r mod 3 = 2 \<Longrightarrow> Suc (Suc (3 * (r div 3))) = r
[PROOF STEP]
by (metis add_2_eq_Suc' mult_div_mod_eq)


[STATEMENT]
lemma "\<forall>x::'a::linordered_field. \<exists>y z w.
  min (5 * x + 3 * z) (17 * w) + 5 * \<bar>y - 8 * x + z\<bar> \<le> max y (7 * z - x + w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<exists>y z w. min ((5::'a) * x + (3::'a) * z) ((17::'a) * w) + (5::'a) * \<bar>y - (8::'a) * x + z\<bar> \<le> max y ((7::'a) * z - x + w)
[PROOF STEP]
by ferrack


[STATEMENT]
lemma cauchyI: "(\<And>r. 0 < r \<Longrightarrow> \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r) \<Longrightarrow> cauchy X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. 0 < r \<Longrightarrow> \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r) \<Longrightarrow> cauchy X
[PROOF STEP]
unfolding cauchy_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. 0 < r \<Longrightarrow> \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r) \<Longrightarrow> \<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r
[PROOF STEP]
by simp


[STATEMENT]
lemma "!!a::int. a+b+c <= i+j+k & a<=b & b<=c & i<=j & j<=k --> a+a+a <= k+k+k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a + b + c \<le> i + j + k \<and> a \<le> b \<and> b \<le> c \<and> i \<le> j \<and> j \<le> k \<longrightarrow> a + a + a \<le> k + k + k
[PROOF STEP]
by arith


[STATEMENT]
lemma esssup_eq: "f \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> esssup M f = Inf {z. emeasure M {x \<in> space M. f x > z} = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> borel_measurable M \<Longrightarrow> esssup M f = Inf {z. emeasure M {x \<in> space M. z < f x} = 0}
[PROOF STEP]
by (auto simp add: esssup_eq_AE not_less[symmetric] AE_iff_measurable[OF _ refl] intro!: arg_cong[where f=Inf])


[STATEMENT]
lemma finite_iff_g_le_Aleph0: "small X \<Longrightarrow> finite X \<longleftrightarrow> gcard X < \<aleph>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. small X \<Longrightarrow> finite X = (gcard X < \<aleph>0)
[PROOF STEP]
by (metis Aleph_0 eqpoll_finite_iff finite_iff_less_Aleph0 gcard_eq_vcard gcard_eqpoll gcardinal_cong)


[STATEMENT]
lemma i_State_Change_Init_exists_set: "
  \<lbrakk> n1 \<le> n2; n1 \<in> I; n2 \<in> I;
    \<not> P (i_Exec_Comp_Stream_Init trans_fun input c n1);
    P (i_Exec_Comp_Stream_Init trans_fun input c n2) \<rbrakk> \<Longrightarrow>
  \<exists>n\<in>I. n1 \<le> n \<and> n < n2 \<and>
    \<not> P (i_Exec_Comp_Stream_Init trans_fun input c n) \<and>
    P (i_Exec_Comp_Stream_Init trans_fun input c (inext n I))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n1 \<le> n2; n1 \<in> I; n2 \<in> I; \<not> P (i_Exec_Comp_Stream_Init trans_fun input c n1); P (i_Exec_Comp_Stream_Init trans_fun input c n2)\<rbrakk> \<Longrightarrow> \<exists>n\<in>I. n1 \<le> n \<and> n < n2 \<and> \<not> P (i_Exec_Comp_Stream_Init trans_fun input c n) \<and> P (i_Exec_Comp_Stream_Init trans_fun input c (inext n I))
[PROOF STEP]
by (rule inext_predicate_change_exists)


[STATEMENT]
lemma mndet_FD_subset : "A \<noteq> {} \<Longrightarrow> A \<subseteq> B \<Longrightarrow> ((\<sqinter> x \<in> B \<rightarrow> P x)  \<le> (\<sqinter> x \<in> A \<rightarrow> P x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; A \<subseteq> B\<rbrakk> \<Longrightarrow> mndet B P \<le> mndet A P
[PROOF STEP]
using  mndet_distrib [of "B - A" "A"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>B - A \<noteq> {}; A \<noteq> {}\<rbrakk> \<Longrightarrow> mndet (B - A \<union> A) ?P = (mndet (B - A) ?P |-| mndet A ?P)

goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; A \<subseteq> B\<rbrakk> \<Longrightarrow> mndet B P \<le> mndet A P
[PROOF STEP]
by (metis bot.extremum_uniqueI mndet_distrib mono_ndet_FD_right order_refl sup.absorb_iff1)


[STATEMENT]
lemma filter_filter_mset: "filter_mset P (filter_mset Q M) = {#x \<in># M. Q x \<and> P x#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset P (filter_mset Q M) = {#x \<in># M. Q x \<and> P x#}
[PROOF STEP]
by (auto simp: multiset_eq_iff)


[STATEMENT]
lemma unity_root_pow: "unity_root k n ^ m = unity_root k (n * m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unity_root k n ^ m = unity_root k (n * int m)
[PROOF STEP]
using unity_root_def
[PROOF STATE]
proof (prove)
using this:
unity_root ?k ?n = cis (2 * pi * real_of_int ?n / real ?k)

goal (1 subgoal):
 1. unity_root k n ^ m = unity_root k (n * int m)
[PROOF STEP]
by (simp add: Complex.DeMoivre mult.commute algebra_split_simps(6))


[STATEMENT]
lemma unionFinestPart:
  "{Y | Y. \<exists>x.((Y \<in> finestpart x) \<and> (x \<in> X))} = \<Union>(finestpart`X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Y |Y. \<exists>x. Y \<in> finestpart x \<and> x \<in> X} = \<Union> (finestpart ` X)
[PROOF STEP]
by auto


[STATEMENT]
lemma of_nat_fract: "of_nat k = Fract (of_nat k) 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat k = Fract (of_nat k) (1::'a)
[PROOF STEP]
by (induct k) (simp_all add: Zero_fract_def One_fract_def)


[STATEMENT]
lemma log_le_iff: "m \<le> n \<Longrightarrow> log m \<le> log n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> local.log m \<le> local.log n
[PROOF STEP]
by (rule monoD [OF log_mono])


[STATEMENT]
theorem MPair_MPair_eq [iff]:
  shows "(MPair X Y = MPair X' Y') = (X=X' & Y=Y')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MPair X Y = MPair X' Y') = (X = X' \<and> Y = Y')
[PROOF STEP]
by (blast dest: MPair_imp_eq_left MPair_imp_eq_right)


[STATEMENT]
lemma has_bochner_integral_lebesgue_real_affine_iff:
  fixes i :: "'a :: euclidean_space"
  shows "c \<noteq> 0 \<Longrightarrow>
    has_bochner_integral lebesgue f i \<longleftrightarrow>
    has_bochner_integral lebesgue (\<lambda>x. f(t + c * x)) (i /\<^sub>R \<bar>c\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> has_bochner_integral lebesgue f i = has_bochner_integral lebesgue (\<lambda>x. f (t + c * x)) (i /\<^sub>R \<bar>c\<bar>)
[PROOF STEP]
unfolding has_bochner_integral_iff lebesgue_integrable_real_affine_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> (integrable lebesgue f \<and> integral\<^sup>L lebesgue f = i) = (integrable lebesgue f \<and> LINT x|lebesgue. f (t + c * x) = i /\<^sub>R \<bar>c\<bar>)
[PROOF STEP]
by (simp_all add: lebesgue_integral_real_affine[symmetric] divideR_right cong: conj_cong)


[STATEMENT]
lemma bij_lists: "bij_betw f X Y \<Longrightarrow> bij_betw (map f) (lists X) (lists Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f X Y \<Longrightarrow> bij_betw (map f) (lists X) (lists Y)
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f X \<and> f ` X = Y \<Longrightarrow> inj_on (map f) (lists X) \<and> map f ` lists X = lists Y
[PROOF STEP]
using inj_on_map_lists lists_image
[PROOF STATE]
proof (prove)
using this:
inj_on ?f ?A \<Longrightarrow> inj_on (map ?f) (lists ?A)
lists (?f ` ?A) = map ?f ` lists ?A

goal (1 subgoal):
 1. inj_on f X \<and> f ` X = Y \<Longrightarrow> inj_on (map f) (lists X) \<and> map f ` lists X = lists Y
[PROOF STEP]
by metis


[STATEMENT]
lemma f_Exec_Stream_expand_aggregate_map_nth: "
  \<lbrakk> 0 < k; n < length xs \<rbrakk> \<Longrightarrow>
  f_aggregate (map f (f_Exec_Comp_Stream trans_fun (xs \<odot>\<^sub>f k) c)) k ag ! n =
  ag (map f (f_Exec_Comp_Stream trans_fun (xs ! n # \<NoMsg>\<^bsup>k - Suc 0\<^esup>)
    (f_Exec_Comp trans_fun (xs \<down> n \<odot>\<^sub>f k) c)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; n < length xs\<rbrakk> \<Longrightarrow> f_aggregate (map f (f_Exec_Comp_Stream trans_fun (xs \<odot> k) c)) k ag ! n = ag (map f (f_Exec_Comp_Stream trans_fun (xs ! n # NoMsg\<^bsup>k - Suc 0\<^esup>) (f_Exec_Comp trans_fun (xs \<down> n \<odot> k) c)))
[PROOF STEP]
apply (simp add: f_aggregate_nth take_map drop_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; n < length xs\<rbrakk> \<Longrightarrow> ag (map f (f_Exec_Comp_Stream trans_fun (xs \<odot> k) c \<up> (n * k) \<down> k)) = ag (f (trans_fun (xs ! n) (f_Exec_Comp trans_fun (xs \<down> n \<odot> k) c)) # map f (f_Exec_Comp_Stream trans_fun NoMsg\<^bsup>k - Suc 0\<^esup> (trans_fun (xs ! n) (f_Exec_Comp trans_fun (xs \<down> n \<odot> k) c))))
[PROOF STEP]
apply (simp add: take_map drop_map f_Exec_Stream_drop f_Exec_Stream_take f_expand_take_mod f_expand_drop_mod drop_take_1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fls_inverse_shift_nonzero:
  fixes   f :: "'a::{comm_monoid_add,inverse,mult_zero,uminus} fls"
  assumes "f \<noteq> 0"
  shows   "inverse (fls_shift m f) = fls_shift (-m) (inverse f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (fls_shift m f) = fls_shift (- m) (inverse f)
[PROOF STEP]
using   assms fls_lr_inverse_shift_nonzero(2)[of f m "inverse (f $$ fls_subdegree f)"]
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0
f \<noteq> 0 \<Longrightarrow> fls_right_inverse (fls_shift m f) (inverse (f $$ fls_subdegree f)) = fls_shift (- m) (fls_right_inverse f (inverse (f $$ fls_subdegree f)))

goal (1 subgoal):
 1. inverse (fls_shift m f) = fls_shift (- m) (inverse f)
[PROOF STEP]
by      (simp add: fls_inverse_def')


[STATEMENT]
lemma to_Zp_one:
  shows "to_Zp \<one> = \<one>\<^bsub>Z\<^sub>p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_Zp \<one> = \<one>\<^bsub>Z\<^sub>p\<^esub>
[PROOF STEP]
using Zp_def Zp.one_closed \<iota>_def inc_of_one inc_to_Zp padic_integers_axioms
[PROOF STATE]
proof (prove)
using this:
Z\<^sub>p \<equiv> padic_int p
\<one>\<^bsub>Z\<^sub>p\<^esub> \<in> carrier Z\<^sub>p
\<iota> \<equiv> Frac_inc Z\<^sub>p
\<iota> \<one>\<^bsub>Z\<^sub>p\<^esub> = \<one>
?b \<in> carrier Z\<^sub>p \<Longrightarrow> to_Zp (\<iota> ?b) = ?b
padic_integers p

goal (1 subgoal):
 1. to_Zp \<one> = \<one>\<^bsub>Z\<^sub>p\<^esub>
[PROOF STEP]
by fastforce


[STATEMENT]
lemma states_Plus [simp]: "states (Plus fsm1 fsm2) = states fsm1 + states fsm2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. states (Plus fsm1 fsm2) = states fsm1 + states fsm2
[PROOF STEP]
by (simp add: Plus_def)


[STATEMENT]
theorem induced_function_integral_nonergodic:
  fixes f::"'a \<Rightarrow> real"
  assumes [measurable]: "A \<in> sets M" "integrable M f"
  shows "integrable M (induced_function A f)"
        "(\<integral>y. induced_function A f y \<partial>M) = (\<integral>x \<in> (\<Union>n. (T^^n)--`A). f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (induced_function A f) &&& integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have U_meas [measurable]: "(\<Union>n. (T^^n)--`A) \<in> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>n. (T ^^ n) --` A) \<in> sets M
[PROOF STEP]
by measurable
[PROOF STATE]
proof (state)
this:
(\<Union>n. (T ^^ n) --` A) \<in> sets M

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
define g where "g = (\<lambda>x. max (f x) 0)"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. max (f x) 0)

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have g_int [measurable]: "integrable M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M g
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. max (f x) 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
integrable M f

goal (1 subgoal):
 1. integrable M (\<lambda>x. max (f x) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M g

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable M g
[PROOF STEP]
have g_int2: "integrable M (induced_function A g)"
[PROOF STATE]
proof (prove)
using this:
integrable M g

goal (1 subgoal):
 1. integrable M (induced_function A g)
[PROOF STEP]
using induced_function_integral_aux(1) g_def
[PROOF STATE]
proof (prove)
using this:
integrable M g
\<lbrakk>?A \<in> sets M; integrable M ?f; \<And>x. 0 \<le> ?f x\<rbrakk> \<Longrightarrow> integrable M (induced_function ?A ?f)
g = (\<lambda>x. max (f x) 0)

goal (1 subgoal):
 1. integrable M (induced_function A g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M (induced_function A g)

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
define h where "h = (\<lambda>x. max (-f x) 0)"
[PROOF STATE]
proof (state)
this:
h = (\<lambda>x. max (- f x) 0)

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have h_int [measurable]: "integrable M h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M h
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. max (- f x) 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
integrable M f

goal (1 subgoal):
 1. integrable M (\<lambda>x. max (- f x) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M h

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable M h
[PROOF STEP]
have h_int2: "integrable M (induced_function A h)"
[PROOF STATE]
proof (prove)
using this:
integrable M h

goal (1 subgoal):
 1. integrable M (induced_function A h)
[PROOF STEP]
using induced_function_integral_aux(1) h_def
[PROOF STATE]
proof (prove)
using this:
integrable M h
\<lbrakk>?A \<in> sets M; integrable M ?f; \<And>x. 0 \<le> ?f x\<rbrakk> \<Longrightarrow> integrable M (induced_function ?A ?f)
h = (\<lambda>x. max (- f x) 0)

goal (1 subgoal):
 1. integrable M (induced_function A h)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M (induced_function A h)

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have D1: "f = (\<lambda>x. g x - h x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = (\<lambda>x. g x - h x)
[PROOF STEP]
unfolding g_def h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = (\<lambda>x. max (f x) 0 - max (- f x) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. g x - h x)

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have D2: "induced_function A f = (\<lambda>x. induced_function A g x - induced_function A h x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. induced_function A f = (\<lambda>x. induced_function A g x - induced_function A h x)
[PROOF STEP]
unfolding induced_function_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<Sum>i<return_time_function A x. f ((T ^^ i) x)) = (\<lambda>x. (\<Sum>i<return_time_function A x. g ((T ^^ i) x)) - (\<Sum>i<return_time_function A x. h ((T ^^ i) x)))
[PROOF STEP]
using D1
[PROOF STATE]
proof (prove)
using this:
f = (\<lambda>x. g x - h x)

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>i<return_time_function A x. f ((T ^^ i) x)) = (\<lambda>x. (\<Sum>i<return_time_function A x. g ((T ^^ i) x)) - (\<Sum>i<return_time_function A x. h ((T ^^ i) x)))
[PROOF STEP]
by (simp add: sum_subtractf)
[PROOF STATE]
proof (state)
this:
induced_function A f = (\<lambda>x. induced_function A g x - induced_function A h x)

goal (2 subgoals):
 1. integrable M (induced_function A f)
 2. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
induced_function A f = (\<lambda>x. induced_function A g x - induced_function A h x)
[PROOF STEP]
show "integrable M (induced_function A f)"
[PROOF STATE]
proof (prove)
using this:
induced_function A f = (\<lambda>x. induced_function A g x - induced_function A h x)

goal (1 subgoal):
 1. integrable M (induced_function A f)
[PROOF STEP]
using g_int2 h_int2
[PROOF STATE]
proof (prove)
using this:
induced_function A f = (\<lambda>x. induced_function A g x - induced_function A h x)
integrable M (induced_function A g)
integrable M (induced_function A h)

goal (1 subgoal):
 1. integrable M (induced_function A f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M (induced_function A f)

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have "(\<integral>x. induced_function A f x \<partial>M) = (\<integral>x. induced_function A g x - induced_function A h x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = LINT x|M. induced_function A g x - induced_function A h x
[PROOF STEP]
using D2
[PROOF STATE]
proof (prove)
using this:
induced_function A f = (\<lambda>x. induced_function A g x - induced_function A h x)

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = LINT x|M. induced_function A g x - induced_function A h x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M (induced_function A f) = LINT x|M. induced_function A g x - induced_function A h x

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M (induced_function A f) = LINT x|M. induced_function A g x - induced_function A h x

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have "... = (\<integral>x. induced_function A g x \<partial>M) - (\<integral>x. induced_function A h x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. induced_function A g x - induced_function A h x = integral\<^sup>L M (induced_function A g) - integral\<^sup>L M (induced_function A h)
[PROOF STEP]
using g_int2 h_int2
[PROOF STATE]
proof (prove)
using this:
integrable M (induced_function A g)
integrable M (induced_function A h)

goal (1 subgoal):
 1. LINT x|M. induced_function A g x - induced_function A h x = integral\<^sup>L M (induced_function A g) - integral\<^sup>L M (induced_function A h)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
LINT x|M. induced_function A g x - induced_function A h x = integral\<^sup>L M (induced_function A g) - integral\<^sup>L M (induced_function A h)

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT x|M. induced_function A g x - induced_function A h x = integral\<^sup>L M (induced_function A g) - integral\<^sup>L M (induced_function A h)

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have "... = (\<integral>x \<in> (\<Union>n. (T^^n)--`A). g x \<partial>M) - (\<integral>x \<in> (\<Union>n. (T^^n)--`A). h x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A g) - integral\<^sup>L M (induced_function A h) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) g - set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) h
[PROOF STEP]
using induced_function_integral_aux(2) g_def h_def g_int h_int
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> sets M; integrable M ?f; \<And>x. 0 \<le> ?f x\<rbrakk> \<Longrightarrow> integral\<^sup>L M (induced_function ?A ?f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` ?A) ?f
g = (\<lambda>x. max (f x) 0)
h = (\<lambda>x. max (- f x) 0)
integrable M g
integrable M h

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A g) - integral\<^sup>L M (induced_function A h) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) g - set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) h
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M (induced_function A g) - integral\<^sup>L M (induced_function A h) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) g - set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) h

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M (induced_function A g) - integral\<^sup>L M (induced_function A h) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) g - set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) h

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have "... = (\<integral>x \<in> (\<Union>n. (T^^n)--`A). (g x - h x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) g - set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) h = \<integral>x\<in>(\<Union>n. (T ^^ n) --` A). (g x - h x)\<partial>M
[PROOF STEP]
apply (rule set_integral_diff(2)[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set_integrable M (\<Union>n. (T ^^ n) --` A) g
 2. set_integrable M (\<Union>n. (T ^^ n) --` A) h
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. integrable M (\<lambda>x. indicat_real (\<Union>n. (T ^^ n) --` A) x *\<^sub>R g x)
 2. integrable M (\<lambda>x. indicat_real (\<Union>n. (T ^^ n) --` A) x *\<^sub>R h x)
[PROOF STEP]
using g_int h_int integrable_mult_indicator[OF U_meas]
[PROOF STATE]
proof (prove)
using this:
integrable M g
integrable M h
integrable M ?f \<Longrightarrow> integrable M (\<lambda>x. indicat_real (\<Union>n. (T ^^ n) --` A) x *\<^sub>R ?f x)

goal (2 subgoals):
 1. integrable M (\<lambda>x. indicat_real (\<Union>n. (T ^^ n) --` A) x *\<^sub>R g x)
 2. integrable M (\<lambda>x. indicat_real (\<Union>n. (T ^^ n) --` A) x *\<^sub>R h x)
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) g - set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) h = \<integral>x\<in>(\<Union>n. (T ^^ n) --` A). (g x - h x)\<partial>M

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) g - set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) h = \<integral>x\<in>(\<Union>n. (T ^^ n) --` A). (g x - h x)\<partial>M

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
have "... = (\<integral>x \<in> (\<Union>n. (T^^n)--`A). f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>x\<in>(\<Union>n. (T ^^ n) --` A). (g x - h x)\<partial>M = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
using D1
[PROOF STATE]
proof (prove)
using this:
f = (\<lambda>x. g x - h x)

goal (1 subgoal):
 1. \<integral>x\<in>(\<Union>n. (T ^^ n) --` A). (g x - h x)\<partial>M = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>x\<in>(\<Union>n. (T ^^ n) --` A). (g x - h x)\<partial>M = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
show "(\<integral>x. induced_function A f x \<partial>M) = (\<integral>x \<in> (\<Union>n. (T^^n)--`A). f x \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f

goal (1 subgoal):
 1. integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M (induced_function A f) = set_lebesgue_integral M (\<Union>n. (T ^^ n) --` A) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_pmf_altdef'':
  assumes p: "p \<in> {0..1}"
  shows   "binomial_pmf n p =
           map_pmf (\<lambda>f. card {x. x < n \<and> f x}) (Pi_pmf {..<n} dflt (\<lambda>_. bernoulli_pmf p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x. x < n \<and> f x}) (Pi_pmf.Pi_pmf {..<n} dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x. x < n \<and> f x}) (Pi_pmf.Pi_pmf {..<n} dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
by (subst binomial_pmf_altdef'[of "{..<n}"]) (auto)