[STATEMENT]
lemma r01_r01_to_r01_def':
 "r01_r01_to_r01 (r1,r2) = (\<Sum>n. real (r01_r01_to_r01' (r1,r2) n) * (1/2)^(n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_r01_to_r01 (r1, r2) = (\<Sum>n. real (r01_r01_to_r01' (r1, r2) n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r01_r01_to_r01 (r1, r2) = (\<Sum>n. real (r01_r01_to_r01' (r1, r2) n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
have "r01_r01_to_r01_sum (r1,r2) = (\<lambda>n. (\<Sum>i = 0..n. real (r01_r01_to_r01' (r1,r2) i) * (1 / 2) ^ Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_r01_to_r01_sum (r1, r2) = (\<lambda>n. \<Sum>i = 0..n. real (r01_r01_to_r01' (r1, r2) i) * (1 / 2) ^ Suc i)
[PROOF STEP]
by(auto simp add: r01_r01_to_r01_sum_def r01_binary_sum_def)
[PROOF STATE]
proof (state)
this:
r01_r01_to_r01_sum (r1, r2) = (\<lambda>n. \<Sum>i = 0..n. real (r01_r01_to_r01' (r1, r2) i) * (1 / 2) ^ Suc i)

goal (1 subgoal):
 1. r01_r01_to_r01 (r1, r2) = (\<Sum>n. real (r01_r01_to_r01' (r1, r2) n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r01_r01_to_r01_sum (r1, r2) = (\<lambda>n. \<Sum>i = 0..n. real (r01_r01_to_r01' (r1, r2) i) * (1 / 2) ^ Suc i)

goal (1 subgoal):
 1. r01_r01_to_r01 (r1, r2) = (\<Sum>n. real (r01_r01_to_r01' (r1, r2) n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
using lim_sum_ai[of "\<lambda>n. r01_r01_to_r01' (r1,r2) n"] r01_r01_to_r01'in01
[PROOF STATE]
proof (prove)
using this:
r01_r01_to_r01_sum (r1, r2) = (\<lambda>n. \<Sum>i = 0..n. real (r01_r01_to_r01' (r1, r2) i) * (1 / 2) ^ Suc i)
(\<And>n. r01_r01_to_r01' (r1, r2) n \<in> {0, 1}) \<Longrightarrow> lim (\<lambda>n. \<Sum>i = 0..n. real (r01_r01_to_r01' (r1, r2) i) * (1 / 2) ^ Suc i) = (\<Sum>n. real (r01_r01_to_r01' (r1, r2) n) * (1 / 2) ^ Suc n)
r01_r01_to_r01' ?rs ?n \<in> {0, 1}

goal (1 subgoal):
 1. r01_r01_to_r01 (r1, r2) = (\<Sum>n. real (r01_r01_to_r01' (r1, r2) n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
by(simp add: r01_r01_to_r01_def)
[PROOF STATE]
proof (state)
this:
r01_r01_to_r01 (r1, r2) = (\<Sum>n. real (r01_r01_to_r01' (r1, r2) n) * (1 / 2) ^ (n + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma point_to_atom_equal:
  assumes "finite Xs"
  assumes "S = \<Union> Xs"
  assumes "x \<in> S"
  shows "point_to_atom Xs x = point_to_atom (gen_boolean_algebra S Xs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom Xs x = point_to_atom (gen_boolean_algebra S Xs) x
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
 2. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
show P0: "point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
[PROOF STEP]
have 0: "point_to_atom Xs x \<inter> point_to_atom (gen_boolean_algebra S Xs) x \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom Xs x \<inter> point_to_atom (gen_boolean_algebra S Xs) x \<noteq> {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite Xs
S = \<Union> Xs
x \<in> S

goal (1 subgoal):
 1. point_to_atom Xs x \<inter> point_to_atom (gen_boolean_algebra S Xs) x \<noteq> {}
[PROOF STEP]
by (metis IntI UnionI empty_iff gen_boolean_algebra.universe point_in_atom_of_type point_to_atom_def)
[PROOF STATE]
proof (state)
this:
point_to_atom Xs x \<inter> point_to_atom (gen_boolean_algebra S Xs) x \<noteq> {}

goal (1 subgoal):
 1. point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
[PROOF STEP]
have 1: "point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
using assms fin_gens_imp_fin_algebra[of Xs S]
[PROOF STATE]
proof (prove)
using this:
finite Xs
S = \<Union> Xs
x \<in> S
\<lbrakk>finite Xs; S = \<Union> Xs\<rbrakk> \<Longrightarrow> finite (gen_boolean_algebra S Xs)

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
by (meson UnionI atoms_of_gen_boolean_algebra gen_boolean_algebra.simps point_to_atom_closed subset_eq subset_refl)
[PROOF STATE]
proof (state)
this:
point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs

goal (1 subgoal):
 1. point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs

goal (1 subgoal):
 1. point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
[PROOF STEP]
using 0 finite_algebra_atoms_are_minimal[of Xs S "point_to_atom Xs x" "point_to_atom (gen_boolean_algebra S Xs) x"]
            assms(1) assms(2) assms(3) atoms_induced_by_points
[PROOF STATE]
proof (prove)
using this:
point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs
point_to_atom Xs x \<inter> point_to_atom (gen_boolean_algebra S Xs) x \<noteq> {}
\<lbrakk>finite Xs; \<Union> Xs \<subseteq> S; point_to_atom Xs x \<in> atoms_of Xs; point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs\<rbrakk> \<Longrightarrow> point_to_atom (gen_boolean_algebra S Xs) x \<inter> point_to_atom Xs x = {} \<or> point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
finite Xs
S = \<Union> Xs
x \<in> S
atoms_of ?Xs = point_to_atom ?Xs ` \<Union> ?Xs

goal (1 subgoal):
 1. point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
show "point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
have 0: "point_to_atom (gen_boolean_algebra S Xs) x \<inter> point_to_atom Xs x \<noteq>{}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<inter> point_to_atom Xs x \<noteq> {}
[PROOF STEP]
using assms P0 point_in_atom_of_type point_to_atom_def
[PROOF STATE]
proof (prove)
using this:
finite Xs
S = \<Union> Xs
x \<in> S
point_to_atom Xs x \<subseteq> point_to_atom (gen_boolean_algebra S Xs) x
?x \<in> \<Union> ?Xs \<Longrightarrow> ?x \<in> subset_to_atom ?Xs (point_to_type ?Xs ?x)
point_to_atom ?Xs ?a = subset_to_atom ?Xs (point_to_type ?Xs ?a)

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<inter> point_to_atom Xs x \<noteq> {}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
point_to_atom (gen_boolean_algebra S Xs) x \<inter> point_to_atom Xs x \<noteq> {}

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
have 1: "point_to_atom (gen_boolean_algebra S Xs) x \<in> (gen_boolean_algebra S Xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
using assms gen_boolean_algebra_idempotent[of S Xs] atoms_of_gen_boolean_algebra
[PROOF STATE]
proof (prove)
using this:
finite Xs
S = \<Union> Xs
x \<in> S
S = \<Union> Xs \<Longrightarrow> gen_boolean_algebra S (gen_boolean_algebra S Xs) = gen_boolean_algebra S Xs
\<lbrakk>?Xs \<subseteq> gen_boolean_algebra ?S ?B; finite ?Xs\<rbrakk> \<Longrightarrow> atoms_of ?Xs \<subseteq> gen_boolean_algebra ?S ?B

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
by (metis UnionI fin_gens_imp_fin_algebra gen_boolean_algebra.universe point_to_atom_closed subset_eq)
[PROOF STATE]
proof (state)
this:
point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
have 2: "\<Union> (gen_boolean_algebra S Xs) \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (gen_boolean_algebra S Xs) \<subseteq> S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite Xs
S = \<Union> Xs
x \<in> S

goal (1 subgoal):
 1. \<Union> (gen_boolean_algebra S Xs) \<subseteq> S
[PROOF STEP]
by (simp add: Sup_le_iff gen_boolean_algebra_subset)
[PROOF STATE]
proof (state)
this:
\<Union> (gen_boolean_algebra S Xs) \<subseteq> S

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
hence 3: "\<Union> (gen_boolean_algebra S Xs) = S"
[PROOF STATE]
proof (prove)
using this:
\<Union> (gen_boolean_algebra S Xs) \<subseteq> S

goal (1 subgoal):
 1. \<Union> (gen_boolean_algebra S Xs) = S
[PROOF STEP]
by (simp add: Union_upper gen_boolean_algebra.universe subset_antisym)
[PROOF STATE]
proof (state)
this:
\<Union> (gen_boolean_algebra S Xs) = S

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
have 4: "gen_boolean_algebra S (gen_boolean_algebra S Xs) = gen_boolean_algebra S Xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_boolean_algebra S (gen_boolean_algebra S Xs) = gen_boolean_algebra S Xs
[PROOF STEP]
using assms gen_boolean_algebra_idempotent[of S Xs]
[PROOF STATE]
proof (prove)
using this:
finite Xs
S = \<Union> Xs
x \<in> S
S = \<Union> Xs \<Longrightarrow> gen_boolean_algebra S (gen_boolean_algebra S Xs) = gen_boolean_algebra S Xs

goal (1 subgoal):
 1. gen_boolean_algebra S (gen_boolean_algebra S Xs) = gen_boolean_algebra S Xs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
gen_boolean_algebra S (gen_boolean_algebra S Xs) = gen_boolean_algebra S Xs

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
have 5: "point_to_atom Xs x \<in> gen_boolean_algebra S (gen_boolean_algebra S Xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom Xs x \<in> gen_boolean_algebra S (gen_boolean_algebra S Xs)
[PROOF STEP]
unfolding  4
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom Xs x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite Xs
S = \<Union> Xs
x \<in> S

goal (1 subgoal):
 1. point_to_atom Xs x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
by (metis (no_types, opaque_lifting) Int_absorb1 Int_commute Union_upper atoms_of_gen_boolean_algebra gen_boolean_algebra.generator point_to_atom_closed subsetD subsetI)
[PROOF STATE]
proof (state)
this:
point_to_atom Xs x \<in> gen_boolean_algebra S (gen_boolean_algebra S Xs)

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
using 2 5 finite_algebra_atoms_are_minimal[of "gen_boolean_algebra S Xs" S "point_to_atom (gen_boolean_algebra S Xs) x" "point_to_atom Xs x"] 0 1 2
[PROOF STATE]
proof (prove)
using this:
\<Union> (gen_boolean_algebra S Xs) \<subseteq> S
point_to_atom Xs x \<in> gen_boolean_algebra S (gen_boolean_algebra S Xs)
\<lbrakk>finite (gen_boolean_algebra S Xs); \<Union> (gen_boolean_algebra S Xs) \<subseteq> S; point_to_atom (gen_boolean_algebra S Xs) x \<in> atoms_of (gen_boolean_algebra S Xs); point_to_atom Xs x \<in> gen_boolean_algebra S (gen_boolean_algebra S Xs)\<rbrakk> \<Longrightarrow> point_to_atom Xs x \<inter> point_to_atom (gen_boolean_algebra S Xs) x = {} \<or> point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
point_to_atom (gen_boolean_algebra S Xs) x \<inter> point_to_atom Xs x \<noteq> {}
point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs
\<Union> (gen_boolean_algebra S Xs) \<subseteq> S

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
unfolding 4
[PROOF STATE]
proof (prove)
using this:
\<Union> (gen_boolean_algebra S Xs) \<subseteq> S
point_to_atom Xs x \<in> gen_boolean_algebra S Xs
\<lbrakk>finite (gen_boolean_algebra S Xs); \<Union> (gen_boolean_algebra S Xs) \<subseteq> S; point_to_atom (gen_boolean_algebra S Xs) x \<in> atoms_of (gen_boolean_algebra S Xs); point_to_atom Xs x \<in> gen_boolean_algebra S Xs\<rbrakk> \<Longrightarrow> point_to_atom Xs x \<inter> point_to_atom (gen_boolean_algebra S Xs) x = {} \<or> point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
point_to_atom (gen_boolean_algebra S Xs) x \<inter> point_to_atom Xs x \<noteq> {}
point_to_atom (gen_boolean_algebra S Xs) x \<in> gen_boolean_algebra S Xs
\<Union> (gen_boolean_algebra S Xs) \<subseteq> S

goal (1 subgoal):
 1. point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x
[PROOF STEP]
by (metis "3" Int_commute assms(1) assms(2) assms(3) fin_gens_imp_fin_algebra point_to_atom_closed)
[PROOF STATE]
proof (state)
this:
point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
point_to_atom (gen_boolean_algebra S Xs) x \<subseteq> point_to_atom Xs x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem set_vebt_delete[vebt_simps]: "invar_vebt t n \<Longrightarrow> set_vebt (vebt_delete t x) = set_vebt t - {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> set_vebt (vebt_delete t x) = set_vebt t - {x}
[PROOF STEP]
by (metis delete_correct invar_vebt_delete set_vebt_set_vebt'_valid)


[STATEMENT]
lemma upper_bound_cong:
  "eventually (\<lambda>x. f x = g x) at_top \<Longrightarrow> eventually (\<lambda>x. g x \<le> u x) at_top \<Longrightarrow>
     eventually (\<lambda>x. f x \<le> u x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in at_top. f x = g x; \<forall>\<^sub>F x in at_top. g x \<le> u x\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. f x \<le> u x
[PROOF STEP]
by (erule (1) eventually_elim2) simp


[STATEMENT]
lemma moebius_pt_moebius_rotation_zero [simp]:
  shows "moebius_pt (moebius_rotation \<phi>) 0\<^sub>h = 0\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt (moebius_rotation \<phi>) 0\<^sub>h = 0\<^sub>h
[PROOF STEP]
unfolding moebius_rotation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt (moebius_similarity (cis \<phi>) 0) 0\<^sub>h = 0\<^sub>h
[PROOF STEP]
by simp


[STATEMENT]
lemma fps_compose_linear:
  "fps_compose (f :: 'a :: comm_ring_1 fps) (fps_const c * fps_X) = Abs_fps (\<lambda>n. c^n * f $ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f oo fps_const c * fps_X = Abs_fps (\<lambda>n. c ^ n * f $ n)
[PROOF STEP]
by (simp add: fps_eq_iff fps_compose_def power_mult_distrib
                if_distrib cong: if_cong)


[STATEMENT]
lemma powrat_less_cancel_iff [simp]:
  "1 < x \<Longrightarrow> (x pow\<^sub>\<rat> r < x pow\<^sub>\<rat> s) = (r < s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> (x pow\<^sub>\<rat> r < x pow\<^sub>\<rat> s) = (r < s)
[PROOF STEP]
by (blast intro: powrat_less_cancel powrat_less_mono)


[STATEMENT]
lemma wp_fun_mono [simp]: "mono wp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono wp
[PROOF STEP]
apply (simp add: le_fun_def wp_def abs_wpt_def less_eq_Assertion_def mono_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> (\<forall>xa. wpt (x * {\<cdot> xa }) \<le> wpt (y * {\<cdot> xa }))
[PROOF STEP]
apply (simp add: wpt_def, safe)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa. x \<le> y \<Longrightarrow> x * {\<cdot> xa } * \<top> \<sqinter> (1::'a) \<le> y * {\<cdot> xa } * \<top>
[PROOF STEP]
apply (rule_tac y = " x * {\<cdot> xa } * \<top>" in order_trans, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa. x \<le> y \<Longrightarrow> x * {\<cdot> xa } * \<top> \<le> y * {\<cdot> xa } * \<top>
[PROOF STEP]
apply (rule le_comp_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa. x \<le> y \<Longrightarrow> x * {\<cdot> xa } \<le> y * {\<cdot> xa }
[PROOF STEP]
by (rule le_comp_right, simp)


[STATEMENT]
lemma (in pref_profile_wf) anonymous_profile_permute:
  assumes "\<sigma> permutes alts"  "finite agents"
  shows   "anonymous_profile (permute_profile \<sigma> R) =
             image_mset (map ((`) \<sigma>)) (anonymous_profile R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
\<sigma> permutes alts
[PROOF STEP]
interpret R': pref_profile_wf agents alts "permute_profile \<sigma> R"
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes alts

goal (1 subgoal):
 1. pref_profile_wf agents alts (permute_profile \<sigma> R)
[PROOF STEP]
by (rule wf_permute_alts)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
have "anonymous_profile (permute_profile \<sigma> R) =
          {#weak_ranking (map_relation (inv \<sigma>) (R x)). x \<in># mset_set agents#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = {#weak_ranking (map_relation (inv \<sigma>) (R x)). x \<in># mset_set agents#}
[PROOF STEP]
unfolding R'.anonymous_profile_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset (weak_ranking \<circ> permute_profile \<sigma> R) (mset_set agents) = {#weak_ranking (map_relation (inv \<sigma>) (R x)). x \<in># mset_set agents#}
[PROOF STEP]
by (simp add:  multiset.map_comp permute_profile_map_relation o_def)
[PROOF STATE]
proof (state)
this:
anonymous_profile (permute_profile \<sigma> R) = {#weak_ranking (map_relation (inv \<sigma>) (R x)). x \<in># mset_set agents#}

goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
anonymous_profile (permute_profile \<sigma> R) = {#weak_ranking (map_relation (inv \<sigma>) (R x)). x \<in># mset_set agents#}

goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<sigma> permutes alts
finite agents
[PROOF STEP]
have "\<dots> = {#map ((`) \<sigma>) (weak_ranking (R x)). x \<in># mset_set agents#}"
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes alts
finite agents

goal (1 subgoal):
 1. {#weak_ranking (map_relation (inv \<sigma>) (R x)). x \<in># mset_set agents#} = {#map ((`) \<sigma>) (weak_ranking (R x)). x \<in># mset_set agents#}
[PROOF STEP]
by (intro image_mset_cong)
       (simp add: finite_total_preorder_on.weak_ranking_permute[of alts])
[PROOF STATE]
proof (state)
this:
{#weak_ranking (map_relation (inv \<sigma>) (R x)). x \<in># mset_set agents#} = {#map ((`) \<sigma>) (weak_ranking (R x)). x \<in># mset_set agents#}

goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{#weak_ranking (map_relation (inv \<sigma>) (R x)). x \<in># mset_set agents#} = {#map ((`) \<sigma>) (weak_ranking (R x)). x \<in># mset_set agents#}

goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
have "\<dots> = image_mset (map ((`) \<sigma>)) (anonymous_profile R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#map ((`) \<sigma>) (weak_ranking (R x)). x \<in># mset_set agents#} = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
by (simp add: anonymous_profile_def multiset.map_comp o_def)
[PROOF STATE]
proof (state)
this:
{#map ((`) \<sigma>) (weak_ranking (R x)). x \<in># mset_set agents#} = image_mset (map ((`) \<sigma>)) (anonymous_profile R)

goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)

goal (1 subgoal):
 1. anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
anonymous_profile (permute_profile \<sigma> R) = image_mset (map ((`) \<sigma>)) (anonymous_profile R)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mset_merge: "\<lbrakk> is_root h1; is_root h2 \<rbrakk>
 \<Longrightarrow>  mset_tree (merge h1 h2) = mset_tree h1 + mset_tree h2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_root h1; is_root h2\<rbrakk> \<Longrightarrow> mset_tree (merge h1 h2) = mset_tree h1 + mset_tree h2
[PROOF STEP]
by (induction h1 h2 rule: merge.induct) (auto simp add: ac_simps)


[STATEMENT]
lemma set_sel_aux_reasonable_fin:
  "\<lbrakk>finite y; sel_reasonable f\<rbrakk> \<Longrightarrow> set_sel_aux f x y \<le> 1 \<and> set_sel_aux f x y > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite y; sel_reasonable f\<rbrakk> \<Longrightarrow> set_sel_aux f x y \<le> 1 \<and> 0 < set_sel_aux f x y
[PROOF STEP]
unfolding set_sel_aux_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite y; sel_reasonable f\<rbrakk> \<Longrightarrow> prod (f x) y \<le> 1 \<and> 0 < prod (f x) y
[PROOF STEP]
by(induction y rule: finite_induct) (auto simp: sel_reasonable_def mult_le_one)


[STATEMENT]
lemma sum_simps[simp]:
      "alphabet\<^sub>2 (sum AA) = \<Union> (alphabet\<^sub>1 ` set AA)"
      "initial\<^sub>2 (sum AA) = (\<Union> k < length AA. {k} \<times> initial\<^sub>1 (AA ! k))"
      "transition\<^sub>2 (sum AA) a (k, p) = {k} \<times> transition\<^sub>1 (AA ! k) a p"
      "condition\<^sub>2 (sum AA) = condition (map condition\<^sub>1 AA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (alphabet\<^sub>2 (local.sum AA) = \<Union> (alphabet\<^sub>1 ` set AA) &&& initial\<^sub>2 (local.sum AA) = (\<Union>k<length AA. {k} \<times> initial\<^sub>1 (AA ! k))) &&& transition\<^sub>2 (local.sum AA) a (k, p) = {k} \<times> transition\<^sub>1 (AA ! k) a p &&& condition\<^sub>2 (local.sum AA) = condition (map condition\<^sub>1 AA)
[PROOF STEP]
unfolding sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (alphabet\<^sub>2 (automaton\<^sub>2 (\<Union> (alphabet\<^sub>1 ` set AA)) (\<Union>k<length AA. {k} \<times> initial\<^sub>1 (AA ! k)) (\<lambda>a (k, p). {k} \<times> transition\<^sub>1 (AA ! k) a p) (condition (map condition\<^sub>1 AA))) = \<Union> (alphabet\<^sub>1 ` set AA) &&& initial\<^sub>2 (automaton\<^sub>2 (\<Union> (alphabet\<^sub>1 ` set AA)) (\<Union>k<length AA. {k} \<times> initial\<^sub>1 (AA ! k)) (\<lambda>a (k, p). {k} \<times> transition\<^sub>1 (AA ! k) a p) (condition (map condition\<^sub>1 AA))) = (\<Union>k<length AA. {k} \<times> initial\<^sub>1 (AA ! k))) &&& transition\<^sub>2 (automaton\<^sub>2 (\<Union> (alphabet\<^sub>1 ` set AA)) (\<Union>k<length AA. {k} \<times> initial\<^sub>1 (AA ! k)) (\<lambda>a (k, p). {k} \<times> transition\<^sub>1 (AA ! k) a p) (condition (map condition\<^sub>1 AA))) a (k, p) = {k} \<times> transition\<^sub>1 (AA ! k) a p &&& condition\<^sub>2 (automaton\<^sub>2 (\<Union> (alphabet\<^sub>1 ` set AA)) (\<Union>k<length AA. {k} \<times> initial\<^sub>1 (AA ! k)) (\<lambda>a (k, p). {k} \<times> transition\<^sub>1 (AA ! k) a p) (condition (map condition\<^sub>1 AA))) = condition (map condition\<^sub>1 AA)
[PROOF STEP]
by auto


[STATEMENT]
lemma sumlist_map_as_finsum:
  assumes "f : set xs \<rightarrow> carrier G" and "distinct xs"
  shows "sumlist (map f xs) = (\<Oplus>x \<in> set xs. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumlist (map f xs) = finsum G f (set xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> set xs \<rightarrow> carrier G
distinct xs

goal (1 subgoal):
 1. sumlist (map f xs) = finsum G f (set xs)
[PROOF STEP]
by (induct xs, auto)


[STATEMENT]
lemma fact_div_fact:
  assumes "m \<ge> n"
  shows "fact m div fact n = \<Prod>{n + 1..m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact m div fact n = \<Prod>{n + 1..m}
[PROOF STEP]
by (simp add: fact_eq_fact_times [OF assms])


[STATEMENT]
lemma DERIV_divide[derivative_intros]:
  "(f has_field_derivative D) (at x within s) \<Longrightarrow>
    (g has_field_derivative E) (at x within s) \<Longrightarrow> g x \<noteq> 0 \<Longrightarrow>
    ((\<lambda>x. f x / g x) has_field_derivative (D * g x - f x * E) / (g x * g x)) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative D) (at x within s); (g has_field_derivative E) (at x within s); g x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x / g x) has_field_derivative (D * g x - f x * E) / (g x * g x)) (at x within s)
[PROOF STEP]
by (rule has_derivative_imp_has_field_derivative[OF has_derivative_divide])
     (auto dest: has_field_derivative_imp_has_derivative simp: field_simps)


[STATEMENT]
lemma lead_coeff_prod: "lead_coeff (prod f A) = (\<Prod>x\<in>A. lead_coeff (f x))"
  for f :: "'a \<Rightarrow> 'b::{comm_semiring_1, semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (prod f A) = (\<Prod>x\<in>A. lead_coeff (f x))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto simp: lead_coeff_mult)


[STATEMENT]
lemma mulex1_mono:
  assumes "\<And>x y. \<lbrakk>x \<in> A; y \<in> A; P x y\<rbrakk> \<Longrightarrow> Q x y"
    and "M \<in> multisets A"
    and "N \<in> multisets A"
    and "mulex1 P M N"
  shows "mulex1 Q M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mulex1 Q M N
[PROOF STEP]
using mult1_mono [of A "{(x, y). P x y}" "{(x, y). Q x y}" M N]
    and assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. \<lbrakk>x \<in> A; y \<in> A; (x, y) \<in> {(x, y). P x y}\<rbrakk> \<Longrightarrow> (x, y) \<in> {(x, y). Q x y}; M \<in> multisets A; N \<in> multisets A; (M, N) \<in> mult1 {(x, y). P x y}\<rbrakk> \<Longrightarrow> (M, N) \<in> mult1 {(x, y). Q x y}
\<lbrakk>?x \<in> A; ?y \<in> A; P ?x ?y\<rbrakk> \<Longrightarrow> Q ?x ?y
M \<in> multisets A
N \<in> multisets A
mulex1 P M N

goal (1 subgoal):
 1. mulex1 Q M N
[PROOF STEP]
unfolding mulex1_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. \<lbrakk>x \<in> A; y \<in> A; (x, y) \<in> {(x, y). P x y}\<rbrakk> \<Longrightarrow> (x, y) \<in> {(x, y). Q x y}; M \<in> multisets A; N \<in> multisets A; (M, N) \<in> mult1 {(x, y). P x y}\<rbrakk> \<Longrightarrow> (M, N) \<in> mult1 {(x, y). Q x y}
\<lbrakk>?x \<in> A; ?y \<in> A; P ?x ?y\<rbrakk> \<Longrightarrow> Q ?x ?y
M \<in> multisets A
N \<in> multisets A
(M, N) \<in> mult1 {(x, y). P x y}

goal (1 subgoal):
 1. (M, N) \<in> mult1 {(x, y). Q x y}
[PROOF STEP]
by blast


[STATEMENT]
lemma (in finite_measure) finite_Lim_measure_incseq:
  assumes A: "range A \<subseteq> sets M" "incseq A"
  shows "(\<lambda>i. measure M (A i)) \<longlonglongrightarrow> measure M (\<Union>i. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. Sigma_Algebra.measure M (A i)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
using Lim_measure_incseq[OF A]
[PROOF STATE]
proof (prove)
using this:
emeasure M (\<Union> (range A)) \<noteq> \<infinity> \<Longrightarrow> (\<lambda>i. Sigma_Algebra.measure M (A i)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Union> (range A))

goal (1 subgoal):
 1. (\<lambda>i. Sigma_Algebra.measure M (A i)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
by simp


[STATEMENT]
lemma gauss_sum_int_cong:
  assumes "[a = b] (mod int n)"
  shows   "gauss_sum_int a = gauss_sum_int b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_sum_int a = gauss_sum_int b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gauss_sum_int a = gauss_sum_int b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
[a = b] (mod int n)
[PROOF STEP]
obtain k where k: "b = a + int n * k"
[PROOF STATE]
proof (prove)
using this:
[a = b] (mod int n)

goal (1 subgoal):
 1. (\<And>k. b = a + int n * k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (subst (asm) cong_iff_lin) auto
[PROOF STATE]
proof (state)
this:
b = a + int n * k

goal (1 subgoal):
 1. gauss_sum_int a = gauss_sum_int b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
b = a + int n * k

goal (1 subgoal):
 1. gauss_sum_int a = gauss_sum_int b
[PROOF STEP]
using gauss_sum_int.plus_of_int[of a k]
[PROOF STATE]
proof (prove)
using this:
b = a + int n * k
gauss_sum_int (a + of_int k * int n) = gauss_sum_int a

goal (1 subgoal):
 1. gauss_sum_int a = gauss_sum_int b
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
gauss_sum_int a = gauss_sum_int b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in group) AutoGroup: "group (AutoGroup G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (AutoGroup G)
[PROOF STEP]
by (simp add: AutoGroup_def subgroup.subgroup_is_group subgroup_auto
              group_BijGroup)


[STATEMENT]
lemma ccSUP_upper2: "countable A \<Longrightarrow> i \<in> A \<Longrightarrow> u \<le> f i \<Longrightarrow> u \<le> (SUP i \<in> A. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; i \<in> A; u \<le> f i\<rbrakk> \<Longrightarrow> u \<le> Sup (f ` A)
[PROOF STEP]
using ccSUP_upper [of A i f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>countable A; i \<in> A\<rbrakk> \<Longrightarrow> f i \<le> Sup (f ` A)

goal (1 subgoal):
 1. \<lbrakk>countable A; i \<in> A; u \<le> f i\<rbrakk> \<Longrightarrow> u \<le> Sup (f ` A)
[PROOF STEP]
by auto


[STATEMENT]
lemma bitAND_linear_sum:
  fixes x y :: "nat \<Rightarrow> nat"
    and c :: nat
    and q :: nat

defines b: "b == 2 ^ Suc c"

assumes xb: "\<forall>t. x t < 2 ^ Suc c - 1"
assumes yb: "\<forall>t. y t < 2 ^ Suc c - 1"

shows "(\<Sum>t = 0..q. (x t && y t) * b^t) =
       (\<Sum>t = 0..q. x t * b^t) && (\<Sum>t = 0..q. y t * b^t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)
[PROOF STEP]
proof (induction q)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>t = 0..0. (x t && y t) * b ^ t) = (\<Sum>t = 0..0. x t * b ^ t) && (\<Sum>t = 0..0. y t * b ^ t)
 2. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<Sum>t = 0..0. (x t && y t) * b ^ t) = (\<Sum>t = 0..0. x t * b ^ t) && (\<Sum>t = 0..0. y t * b ^ t)
 2. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..0. (x t && y t) * b ^ t) = (\<Sum>t = 0..0. x t * b ^ t) && (\<Sum>t = 0..0. y t * b ^ t)
[PROOF STEP]
by (auto simp: b B_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..0. (x t && y t) * b ^ t) = (\<Sum>t = 0..0. x t * b ^ t) && (\<Sum>t = 0..0. y t * b ^ t)

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
case (Suc q)
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
have "(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) && y (Suc q)) * b ^ Suc q
                                               + (\<Sum>t = 0..q. (x t && y t) * b ^ t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) && y (Suc q)) * b ^ Suc q + (\<Sum>t = 0..q. (x t && y t) * b ^ t)
[PROOF STEP]
by (auto cong: sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) && y (Suc q)) * b ^ Suc q + (\<Sum>t = 0..q. (x t && y t) * b ^ t)

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) && y (Suc q)) * b ^ Suc q + (\<Sum>t = 0..q. (x t && y t) * b ^ t)

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
have h0: "(x (Suc q) && y (Suc q)) * b ^ Suc q
                   = (x (Suc q) * b^Suc q) && (y (Suc q) * b^Suc q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x (Suc q) && y (Suc q)) * b ^ Suc q = x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q
[PROOF STEP]
using b bitAND_distrib
[PROOF STATE]
proof (prove)
using this:
b \<equiv> 2 ^ Suc c
2 ^ ?c * (?a && ?b) = 2 ^ ?c * ?a && 2 ^ ?c * ?b

goal (1 subgoal):
 1. (x (Suc q) && y (Suc q)) * b ^ Suc q = x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q
[PROOF STEP]
by (auto) (smt mult.commute power_Suc power_mult)
[PROOF STATE]
proof (state)
this:
(x (Suc q) && y (Suc q)) * b ^ Suc q = x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(x (Suc q) && y (Suc q)) * b ^ Suc q = x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
have h1: "(\<Sum>t = 0..q. (x t && y t) * b ^ t)
                   = (\<Sum>t = 0..q. x t * b^t) && (\<Sum>t = 0..q. y t * b^t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)
[PROOF STEP]
using Suc.IH
[PROOF STATE]
proof (prove)
using this:
(\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)

goal (1 subgoal):
 1. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) && y (Suc q)) * b ^ Suc q + (\<Sum>t = 0..q. (x t && y t) * b ^ t)
(x (Suc q) && y (Suc q)) * b ^ Suc q = x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q
(\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)
[PROOF STEP]
have h2: "(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t)
                = ((x (Suc q) * b^Suc q) && (y (Suc q) * b^Suc q))
                + ((\<Sum>t = 0..q. x t * b^t) && (\<Sum>t = 0..q. y t * b^t))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) && y (Suc q)) * b ^ Suc q + (\<Sum>t = 0..q. (x t && y t) * b ^ t)
(x (Suc q) && y (Suc q)) * b ^ Suc q = x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q
(\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)

goal (1 subgoal):
 1. (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t))

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
have sumxb: "(\<Sum>t = 0..q. x t * b ^ t) < b ^ Suc q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..q. x t * b ^ t) < b ^ Suc q
[PROOF STEP]
using base_summation_bound xb b B_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t. ?f t < 2 ^ Suc ?c - 1 \<Longrightarrow> (\<Sum>t = 0..?q. ?f t * B ?c ^ t) < B ?c ^ Suc ?q
\<forall>t. x t < 2 ^ Suc c - 1
b \<equiv> 2 ^ Suc c
B ?c = 2 ^ Suc ?c

goal (1 subgoal):
 1. (\<Sum>t = 0..q. x t * b ^ t) < b ^ Suc q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..q. x t * b ^ t) < b ^ Suc q

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
have sumyb: "(\<Sum>t = 0..q. y t * b ^ t) < b ^ Suc q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..q. y t * b ^ t) < b ^ Suc q
[PROOF STEP]
using base_summation_bound yb b B_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t. ?f t < 2 ^ Suc ?c - 1 \<Longrightarrow> (\<Sum>t = 0..?q. ?f t * B ?c ^ t) < B ?c ^ Suc ?q
\<forall>t. y t < 2 ^ Suc c - 1
b \<equiv> 2 ^ Suc c
B ?c = 2 ^ Suc ?c

goal (1 subgoal):
 1. (\<Sum>t = 0..q. y t * b ^ t) < b ^ Suc q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..q. y t * b ^ t) < b ^ Suc q

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
have h3: "((x (Suc q) * b^Suc q) && (y (Suc q) * b^Suc q))
          + ((\<Sum>t = 0..q. x t * b^t) && (\<Sum>t = 0..q. y t * b^t))
          = ((\<Sum>t = 0..q. x t * b^t) + x (Suc q) * b^Suc q)
         && ((\<Sum>t = 0..q. y t * b^t) + y (Suc q) * b^Suc q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)) = (\<Sum>t = 0..q. x t * b ^ t) + x (Suc q) * b ^ Suc q && (\<Sum>t = 0..q. y t * b ^ t) + y (Suc q) * b ^ Suc q
[PROOF STEP]
using sumxb sumyb bitAND_linear h2 h0
[PROOF STATE]
proof (prove)
using this:
(\<Sum>t = 0..q. x t * b ^ t) < b ^ Suc q
(\<Sum>t = 0..q. y t * b ^ t) < b ^ Suc q
?b < 2 ^ ?k \<and> ?d < 2 ^ ?k \<Longrightarrow> ?a * 2 ^ ?k + ?b && ?c * 2 ^ ?k + ?d = (?a && ?c) * 2 ^ ?k + (?b && ?d)
(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t))
(x (Suc q) && y (Suc q)) * b ^ Suc q = x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q

goal (1 subgoal):
 1. (x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)) = (\<Sum>t = 0..q. x t * b ^ t) + x (Suc q) * b ^ Suc q && (\<Sum>t = 0..q. y t * b ^ t) + y (Suc q) * b ^ Suc q
[PROOF STEP]
by (auto) (smt add.commute b power_Suc power_mult)
[PROOF STATE]
proof (state)
this:
(x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)) = (\<Sum>t = 0..q. x t * b ^ t) + x (Suc q) * b ^ Suc q && (\<Sum>t = 0..q. y t * b ^ t) + y (Suc q) * b ^ Suc q

goal (1 subgoal):
 1. \<And>q. (\<Sum>t = 0..q. (x t && y t) * b ^ t) = (\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t) \<Longrightarrow> (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)) = (\<Sum>t = 0..q. x t * b ^ t) + x (Suc q) * b ^ Suc q && (\<Sum>t = 0..q. y t * b ^ t) + y (Suc q) * b ^ Suc q

goal (1 subgoal):
 1. (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
using h2
[PROOF STATE]
proof (prove)
using this:
(x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t)) = (\<Sum>t = 0..q. x t * b ^ t) + x (Suc q) * b ^ Suc q && (\<Sum>t = 0..q. y t * b ^ t) + y (Suc q) * b ^ Suc q
(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (x (Suc q) * b ^ Suc q && y (Suc q) * b ^ Suc q) + ((\<Sum>t = 0..q. x t * b ^ t) && (\<Sum>t = 0..q. y t * b ^ t))

goal (1 subgoal):
 1. (\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)
[PROOF STEP]
by (auto cong: sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>t = 0..Suc q. (x t && y t) * b ^ t) = (\<Sum>t = 0..Suc q. x t * b ^ t) && (\<Sum>t = 0..Suc q. y t * b ^ t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma const_sum_list :
  "\<forall>x \<in> set xs. f x = a \<Longrightarrow> sum_list (map f xs) = a * (length xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. f x = a \<Longrightarrow> sum_list (map f xs) = a * length xs
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma Pi_fupd_iff: "i \<in> I \<Longrightarrow> f \<in> Pi I (B(i := A)) \<longleftrightarrow> f \<in> Pi (I - {i}) B \<and> f i \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> (f \<in> Pi I (B(i := A))) = (f \<in> Pi (I - {i}) B \<and> f i \<in> A)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>i \<in> I; f \<in> Pi I (B(i := A)); x \<in> I; f x \<notin> B x\<rbrakk> \<Longrightarrow> x = i
 2. \<lbrakk>i \<in> I; f \<in> Pi I (B(i := A))\<rbrakk> \<Longrightarrow> f i \<in> A
[PROOF STEP]
apply (metis PiE fun_upd_apply)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<in> I; f \<in> Pi I (B(i := A))\<rbrakk> \<Longrightarrow> f i \<in> A
[PROOF STEP]
by force


[STATEMENT]
lemma cnj_Dirichlet_L:
  "cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
assume *: "\<chi> \<noteq> \<chi>\<^sub>0" "s = 1"
[PROOF STATE]
proof (state)
this:
\<chi> \<noteq> \<chi>\<^sub>0
s = 1

goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
with summable_Dirichlet_L'[of 1]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<chi> \<noteq> \<chi>\<^sub>0; 0 < Re 1\<rbrakk> \<Longrightarrow> summable (\<lambda>n. \<chi> n * of_nat n powr - 1)
\<chi> \<noteq> \<chi>\<^sub>0
s = 1
[PROOF STEP]
have "(\<lambda>n. \<chi> n / n) sums eval_fds (fds \<chi>) 1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<chi> \<noteq> \<chi>\<^sub>0; 0 < Re 1\<rbrakk> \<Longrightarrow> summable (\<lambda>n. \<chi> n * of_nat n powr - 1)
\<chi> \<noteq> \<chi>\<^sub>0
s = 1

goal (1 subgoal):
 1. (\<lambda>n. \<chi> n / of_nat n) sums eval_fds (fds \<chi>) 1
[PROOF STEP]
by (simp add: eval_fds_def fds_nth_fds' powr_minus sums_iff divide_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<chi> n / of_nat n) sums eval_fds (fds \<chi>) 1

goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
hence "(\<lambda>n. inv_character \<chi> n / n) sums cnj (eval_fds (fds \<chi>) 1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<chi> n / of_nat n) sums eval_fds (fds \<chi>) 1

goal (1 subgoal):
 1. (\<lambda>n. inv_character \<chi> n / of_nat n) sums cnj (eval_fds (fds \<chi>) 1)
[PROOF STEP]
by (subst (asm) sums_cnj [symmetric]) (simp add: inv_character_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. inv_character \<chi> n / of_nat n) sums cnj (eval_fds (fds \<chi>) 1)

goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
hence "eval_fds (fds (inv_character \<chi>)) 1 = cnj (eval_fds (fds \<chi>) 1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. inv_character \<chi> n / of_nat n) sums cnj (eval_fds (fds \<chi>) 1)

goal (1 subgoal):
 1. eval_fds (fds (inv_character \<chi>)) 1 = cnj (eval_fds (fds \<chi>) 1)
[PROOF STEP]
by (simp add: eval_fds_def fds_nth_fds' inv_character_def sums_iff)
[PROOF STATE]
proof (state)
this:
eval_fds (fds (inv_character \<chi>)) 1 = cnj (eval_fds (fds \<chi>) 1)

goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<chi> \<noteq> \<chi>\<^sub>0; s = 1\<rbrakk> \<Longrightarrow> eval_fds (fds (inv_character \<chi>)) 1 = cnj (eval_fds (fds \<chi>) 1)

goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<chi> \<noteq> \<chi>\<^sub>0; s = 1\<rbrakk> \<Longrightarrow> eval_fds (fds (inv_character \<chi>)) 1 = cnj (eval_fds (fds \<chi>) 1)

goal (1 subgoal):
 1. cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)
[PROOF STEP]
by (auto simp add: Dirichlet_L_def cnj_powr eval_inv_character)
[PROOF STATE]
proof (state)
this:
cnj (Dirichlet_L n \<chi> s) = Dirichlet_L n (inv_character \<chi>) (cnj s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_less_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 < log a x \<longleftrightarrow> 1 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x\<rbrakk> \<Longrightarrow> (0 < log a x) = (1 < x)
[PROOF STEP]
using log_less_cancel_iff[of a 1 x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < a; 0 < 1; 0 < x\<rbrakk> \<Longrightarrow> (log a 1 < log a x) = (1 < x)

goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x\<rbrakk> \<Longrightarrow> (0 < log a x) = (1 < x)
[PROOF STEP]
by simp


[STATEMENT]
lemma bounded_inner_imp_bdd_below:
  assumes "bounded s"
    shows "bdd_below ((\<lambda>x. x \<bullet> a) ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_below ((\<lambda>x. x \<bullet> a) ` s)
[PROOF STEP]
by (simp add: assms bounded_imp_bdd_below bounded_linear_image bounded_linear_inner_left)


[STATEMENT]
lemma semigroup_add_ow_Ball_def:
  "semigroup_add_ow S pls \<longleftrightarrow>
  (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>c\<in>S. pls (pls a b) c =
    pls a (pls b c)) \<and> (\<forall>a\<in>S. \<forall>b\<in>S. pls a b \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semigroup_add_ow S pls = ((\<forall>a\<in>S. \<forall>b\<in>S. \<forall>c\<in>S. pls (pls a b) c = pls a (pls b c)) \<and> (\<forall>a\<in>S. \<forall>b\<in>S. pls a b \<in> S))
[PROOF STEP]
by (auto simp: semigroup_add_ow_def)


[STATEMENT]
lemma orthogonal_fst_QR_decomposition:
  shows "pairwise orthogonal (columns (fst (QR_decomposition A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal (columns (fst (QR_decomposition A)))
[PROOF STEP]
unfolding pairwise_def columns_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. \<forall>y\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<noteq> y \<longrightarrow> orthogonal x y
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i ia. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)) \<Longrightarrow> orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
fix i ia
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i ia. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)) \<Longrightarrow> orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
assume col_not_eq: "column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))"
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))

goal (1 subgoal):
 1. \<And>i ia. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)) \<Longrightarrow> orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
hence i_not_ia: "i \<noteq> ia"
[PROOF STATE]
proof (prove)
using this:
column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))

goal (1 subgoal):
 1. i \<noteq> ia
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<noteq> ia

goal (1 subgoal):
 1. \<And>i ia. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)) \<Longrightarrow> orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
from col_not_eq
[PROOF STATE]
proof (chain)
picking this:
column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))
[PROOF STEP]
obtain a
    where "(fst (QR_decomposition A)) $ a $ i \<noteq> (fst (QR_decomposition A)) $ a $ ia"
[PROOF STATE]
proof (prove)
using this:
column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))

goal (1 subgoal):
 1. (\<And>a. fst (QR_decomposition A) $ a $ i \<noteq> fst (QR_decomposition A) $ a $ ia \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding column_def
[PROOF STATE]
proof (prove)
using this:
(\<chi>ia. fst (QR_decomposition A) $ ia $ i) \<noteq> (\<chi>i. fst (QR_decomposition A) $ i $ ia)

goal (1 subgoal):
 1. (\<And>a. fst (QR_decomposition A) $ a $ i \<noteq> fst (QR_decomposition A) $ a $ ia \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
fst (QR_decomposition A) $ a $ i \<noteq> fst (QR_decomposition A) $ a $ ia

goal (1 subgoal):
 1. \<And>i ia. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)) \<Longrightarrow> orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
hence col_not_eq2: " (column i (Gram_Schmidt_matrix A)) \<noteq> (column ia (Gram_Schmidt_matrix A))"
[PROOF STATE]
proof (prove)
using this:
fst (QR_decomposition A) $ a $ i \<noteq> fst (QR_decomposition A) $ a $ ia

goal (1 subgoal):
 1. column i (Gram_Schmidt_matrix A) \<noteq> column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
using col_not_eq
[PROOF STATE]
proof (prove)
using this:
fst (QR_decomposition A) $ a $ i \<noteq> fst (QR_decomposition A) $ a $ ia
column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A))

goal (1 subgoal):
 1. column i (Gram_Schmidt_matrix A) \<noteq> column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
unfolding QR_decomposition_def Let_def fst_conv
[PROOF STATE]
proof (prove)
using this:
divide_by_norm (Gram_Schmidt_matrix A) $ a $ i \<noteq> divide_by_norm (Gram_Schmidt_matrix A) $ a $ ia
column i (divide_by_norm (Gram_Schmidt_matrix A)) \<noteq> column ia (divide_by_norm (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. column i (Gram_Schmidt_matrix A) \<noteq> column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
by (metis (lifting) divide_by_norm_def vec_lambda_beta)
[PROOF STATE]
proof (state)
this:
column i (Gram_Schmidt_matrix A) \<noteq> column ia (Gram_Schmidt_matrix A)

goal (1 subgoal):
 1. \<And>i ia. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)) \<Longrightarrow> orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
have d1: "column i (fst (QR_decomposition A))
    = (1 / norm (\<chi> ia. Gram_Schmidt_matrix A $ ia $ i)) *\<^sub>R (column i (Gram_Schmidt_matrix A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) = (1 / norm (\<chi>ia. Gram_Schmidt_matrix A $ ia $ i)) *\<^sub>R column i (Gram_Schmidt_matrix A)
[PROOF STEP]
unfolding QR_decomposition_def Let_def fst_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (divide_by_norm (Gram_Schmidt_matrix A)) = (1 / norm (\<chi>ia. Gram_Schmidt_matrix A $ ia $ i)) *\<^sub>R column i (Gram_Schmidt_matrix A)
[PROOF STEP]
unfolding divide_by_norm_def column_def normalize_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>ia. (\<chi>a b. ((1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ b)) *\<^sub>R (\<chi>i. Gram_Schmidt_matrix A $ i $ b)) $ a) $ ia $ i) = (1 / norm (\<chi>ia. Gram_Schmidt_matrix A $ ia $ i)) *\<^sub>R (\<chi>ia. Gram_Schmidt_matrix A $ ia $ i)
[PROOF STEP]
unfolding vec_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ia. (\<chi>ia. (\<chi>a b. ((1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ b)) *\<^sub>R (\<chi>i. Gram_Schmidt_matrix A $ i $ b)) $ a) $ ia $ i) $ ia = ((1 / norm (\<chi>ia. Gram_Schmidt_matrix A $ ia $ i)) *\<^sub>R (\<chi>ia. Gram_Schmidt_matrix A $ ia $ i)) $ ia
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) = (1 / norm (\<chi>ia. Gram_Schmidt_matrix A $ ia $ i)) *\<^sub>R column i (Gram_Schmidt_matrix A)

goal (1 subgoal):
 1. \<And>i ia. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)) \<Longrightarrow> orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
have d2: "column ia (fst (QR_decomposition A))
    = (1 / norm (\<chi> i. Gram_Schmidt_matrix A $ i $ ia)) *\<^sub>R (column ia (Gram_Schmidt_matrix A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column ia (fst (QR_decomposition A)) = (1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ ia)) *\<^sub>R column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
unfolding QR_decomposition_def Let_def fst_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column ia (divide_by_norm (Gram_Schmidt_matrix A)) = (1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ ia)) *\<^sub>R column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
unfolding divide_by_norm_def column_def normalize_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. (\<chi>a b. ((1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ b)) *\<^sub>R (\<chi>i. Gram_Schmidt_matrix A $ i $ b)) $ a) $ i $ ia) = (1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ ia)) *\<^sub>R (\<chi>i. Gram_Schmidt_matrix A $ i $ ia)
[PROOF STEP]
unfolding vec_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. (\<chi>i. (\<chi>a b. ((1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ b)) *\<^sub>R (\<chi>i. Gram_Schmidt_matrix A $ i $ b)) $ a) $ i $ ia) $ i = ((1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ ia)) *\<^sub>R (\<chi>i. Gram_Schmidt_matrix A $ i $ ia)) $ i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column ia (fst (QR_decomposition A)) = (1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ ia)) *\<^sub>R column ia (Gram_Schmidt_matrix A)

goal (1 subgoal):
 1. \<And>i ia. column i (fst (QR_decomposition A)) \<noteq> column ia (fst (QR_decomposition A)) \<Longrightarrow> orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
show "orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))
[PROOF STEP]
unfolding d1 d2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal ((1 / norm (\<chi>ia. Gram_Schmidt_matrix A $ ia $ i)) *\<^sub>R column i (Gram_Schmidt_matrix A)) ((1 / norm (\<chi>i. Gram_Schmidt_matrix A $ i $ ia)) *\<^sub>R column ia (Gram_Schmidt_matrix A))
[PROOF STEP]
apply (rule orthogonal_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal (column i (Gram_Schmidt_matrix A)) (column ia (Gram_Schmidt_matrix A))
[PROOF STEP]
using orthogonal_Gram_Schmidt_matrix[of A]
[PROOF STATE]
proof (prove)
using this:
pairwise orthogonal {column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV}

goal (1 subgoal):
 1. orthogonal (column i (Gram_Schmidt_matrix A)) (column ia (Gram_Schmidt_matrix A))
[PROOF STEP]
unfolding pairwise_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV}. \<forall>y\<in>{column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV}. x \<noteq> y \<longrightarrow> orthogonal x y

goal (1 subgoal):
 1. orthogonal (column i (Gram_Schmidt_matrix A)) (column ia (Gram_Schmidt_matrix A))
[PROOF STEP]
using col_not_eq2
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV}. \<forall>y\<in>{column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV}. x \<noteq> y \<longrightarrow> orthogonal x y
column i (Gram_Schmidt_matrix A) \<noteq> column ia (Gram_Schmidt_matrix A)

goal (1 subgoal):
 1. orthogonal (column i (Gram_Schmidt_matrix A)) (column ia (Gram_Schmidt_matrix A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
orthogonal (column i (fst (QR_decomposition A))) (column ia (fst (QR_decomposition A)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_deriv_1[simp]: "fps_deriv 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv 1 = 0
[PROOF STEP]
by (simp add: fps_deriv_def fps_eq_iff)


[STATEMENT]
lemma prime_gt_Suc_0_nat: "prime p \<Longrightarrow> p > Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> Suc 0 < p
[PROOF STEP]
using prime_gt_1_nat [of p]
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. prime p \<Longrightarrow> Suc 0 < p
[PROOF STEP]
by simp


[STATEMENT]
lemma proots_count_of_real:
  assumes "p\<noteq>0"
  shows "proots_count (map_poly of_real p) ((of_real::_\<Rightarrow>'a::{real_algebra_1,idom}) ` s)
            = proots_count p s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
define k where "k=(of_real::_\<Rightarrow>'a)"
[PROOF STATE]
proof (state)
this:
k = of_real

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
have "proots_within (map_poly of_real p) (k ` s) =k ` (proots_within p s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within (map_poly of_real p) (k ` s) = k ` proots_within p s
[PROOF STEP]
unfolding proots_within_def k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> of_real ` s. poly (map_poly of_real p) x = (0::'a)} = of_real ` {x \<in> s. poly p x = 0}
[PROOF STEP]
by (auto simp add:of_real_poly_map_poly[symmetric])
[PROOF STATE]
proof (state)
this:
proots_within (map_poly of_real p) (k ` s) = k ` proots_within p s

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proots_within (map_poly of_real p) (k ` s) = k ` proots_within p s
[PROOF STEP]
have "proots_count (map_poly of_real p) (k ` s)
                = (\<Sum>r\<in>k ` (proots_within p s). order r (map_poly of_real p))"
[PROOF STATE]
proof (prove)
using this:
proots_within (map_poly of_real p) (k ` s) = k ` proots_within p s

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (k ` s) = (\<Sum>r\<in>k ` proots_within p s. order r (map_poly of_real p))
[PROOF STEP]
unfolding proots_count_def
[PROOF STATE]
proof (prove)
using this:
proots_within (map_poly of_real p) (k ` s) = k ` proots_within p s

goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within (map_poly of_real p) (k ` s). order r (map_poly of_real p)) = (\<Sum>r\<in>k ` proots_within p s. order r (map_poly of_real p))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
proots_count (map_poly of_real p) (k ` s) = (\<Sum>r\<in>k ` proots_within p s. order r (map_poly of_real p))

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_count (map_poly of_real p) (k ` s) = (\<Sum>r\<in>k ` proots_within p s. order r (map_poly of_real p))

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
have "... = sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r\<in>k ` proots_within p s. order r (map_poly of_real p)) = sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s)
[PROOF STEP]
apply (subst sum.reindex)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on k (proots_within p s)
 2. sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s) = sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s)
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on of_real (proots_within p s)
 2. sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> of_real) (proots_within p s) = sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> of_real) (proots_within p s)
[PROOF STEP]
by (auto simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>k ` proots_within p s. order r (map_poly of_real p)) = sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s)

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>k ` proots_within p s. order r (map_poly of_real p)) = sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s)

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
have "... = proots_count p s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s) = proots_count p s
[PROOF STEP]
unfolding proots_count_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s) = (\<Sum>r\<in>proots_within p s. order r p)
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. proots_within p s = proots_within p s
 2. \<And>x. x \<in> proots_within p s \<Longrightarrow> ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) x = order x p
[PROOF STEP]
unfolding k_def comp_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. proots_within p s = proots_within p s
 2. \<And>x. x \<in> proots_within p s \<Longrightarrow> order (of_real x) (map_poly of_real p) = order x p
[PROOF STEP]
using \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (2 subgoals):
 1. proots_within p s = proots_within p s
 2. \<And>x. x \<in> proots_within p s \<Longrightarrow> order (of_real x) (map_poly of_real p) = order x p
[PROOF STEP]
by (auto simp add:map_poly_order_of_real)
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>r. order r (map_poly of_real p)) \<circ> k) (proots_within p s) = proots_count p s

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
proots_count (map_poly of_real p) (k ` s) = proots_count p s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_count (map_poly of_real p) (k ` s) = proots_count p s

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
using this:
proots_count (map_poly of_real p) (of_real ` s) = proots_count p s

goal (1 subgoal):
 1. proots_count (map_poly of_real p) (of_real ` s) = proots_count p s
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
proots_count (map_poly of_real p) (of_real ` s) = proots_count p s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lset_lconcat_lfinite:
  "\<forall>xs \<in> lset xss. lfinite xs \<Longrightarrow> lset (lconcat xss) = (\<Union>xs\<in>lset xss. lset xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs\<in>lset xss. lfinite xs \<Longrightarrow> lset (lconcat xss) = \<Union> (lset ` lset xss)
[PROOF STEP]
by(induction xss) auto


[STATEMENT]
lemma topological_basis_iff:
  assumes "\<And>B'. B' \<in> B \<Longrightarrow> open B'"
  shows "topological_basis B \<longleftrightarrow> (\<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'))"
    (is "_ \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topological_basis B = (\<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>O' x. \<lbrakk>topological_basis B; open O'; x \<in> O'\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'
 2. \<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O') \<Longrightarrow> topological_basis B
[PROOF STEP]
fix O' and x::'a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>O' x. \<lbrakk>topological_basis B; open O'; x \<in> O'\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'
 2. \<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O') \<Longrightarrow> topological_basis B
[PROOF STEP]
assume H: "topological_basis B" "open O'" "x \<in> O'"
[PROOF STATE]
proof (state)
this:
topological_basis B
open O'
x \<in> O'

goal (2 subgoals):
 1. \<And>O' x. \<lbrakk>topological_basis B; open O'; x \<in> O'\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'
 2. \<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O') \<Longrightarrow> topological_basis B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topological_basis B
open O'
x \<in> O'
[PROOF STEP]
have "(\<exists>B'\<subseteq>B. \<Union>B' = O')"
[PROOF STATE]
proof (prove)
using this:
topological_basis B
open O'
x \<in> O'

goal (1 subgoal):
 1. \<exists>B'\<subseteq>B. \<Union> B' = O'
[PROOF STEP]
by (simp add: topological_basis_def)
[PROOF STATE]
proof (state)
this:
\<exists>B'\<subseteq>B. \<Union> B' = O'

goal (2 subgoals):
 1. \<And>O' x. \<lbrakk>topological_basis B; open O'; x \<in> O'\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'
 2. \<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O') \<Longrightarrow> topological_basis B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>B'\<subseteq>B. \<Union> B' = O'
[PROOF STEP]
obtain B' where "B' \<subseteq> B" "O' = \<Union>B'"
[PROOF STATE]
proof (prove)
using this:
\<exists>B'\<subseteq>B. \<Union> B' = O'

goal (1 subgoal):
 1. (\<And>B'. \<lbrakk>B' \<subseteq> B; O' = \<Union> B'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B' \<subseteq> B
O' = \<Union> B'

goal (2 subgoals):
 1. \<And>O' x. \<lbrakk>topological_basis B; open O'; x \<in> O'\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'
 2. \<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O') \<Longrightarrow> topological_basis B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B' \<subseteq> B
O' = \<Union> B'
[PROOF STEP]
show "\<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'"
[PROOF STATE]
proof (prove)
using this:
B' \<subseteq> B
O' = \<Union> B'

goal (1 subgoal):
 1. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
B' \<subseteq> B
O' = \<Union> B'
topological_basis B
open O'
x \<in> O'

goal (1 subgoal):
 1. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'

goal (1 subgoal):
 1. \<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O') \<Longrightarrow> topological_basis B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O') \<Longrightarrow> topological_basis B
[PROOF STEP]
assume H: ?rhs
[PROOF STATE]
proof (state)
this:
\<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O')

goal (1 subgoal):
 1. \<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O') \<Longrightarrow> topological_basis B
[PROOF STEP]
show "topological_basis B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topological_basis B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?B' \<in> B \<Longrightarrow> open ?B'

goal (1 subgoal):
 1. topological_basis B
[PROOF STEP]
unfolding topological_basis_def
[PROOF STATE]
proof (prove)
using this:
?B' \<in> B \<Longrightarrow> open ?B'

goal (1 subgoal):
 1. Ball B open \<and> (\<forall>x. open x \<longrightarrow> (\<exists>B'\<subseteq>B. \<Union> B' = x))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; x \<in> B\<rbrakk> \<Longrightarrow> open x
 2. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; open x\<rbrakk> \<Longrightarrow> \<exists>B'\<subseteq>B. \<Union> B' = x
[PROOF STEP]
fix O' :: "'a set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; x \<in> B\<rbrakk> \<Longrightarrow> open x
 2. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; open x\<rbrakk> \<Longrightarrow> \<exists>B'\<subseteq>B. \<Union> B' = x
[PROOF STEP]
assume "open O'"
[PROOF STATE]
proof (state)
this:
open O'

goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; x \<in> B\<rbrakk> \<Longrightarrow> open x
 2. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; open x\<rbrakk> \<Longrightarrow> \<exists>B'\<subseteq>B. \<Union> B' = x
[PROOF STEP]
with H
[PROOF STATE]
proof (chain)
picking this:
\<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O')
open O'
[PROOF STEP]
obtain f where "\<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O'"
[PROOF STATE]
proof (prove)
using this:
\<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O')
open O'

goal (1 subgoal):
 1. (\<And>f. \<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force intro: bchoice simp: Bex_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O'

goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; x \<in> B\<rbrakk> \<Longrightarrow> open x
 2. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; open x\<rbrakk> \<Longrightarrow> \<exists>B'\<subseteq>B. \<Union> B' = x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O'
[PROOF STEP]
show "\<exists>B'\<subseteq>B. \<Union>B' = O'"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O'

goal (1 subgoal):
 1. \<exists>B'\<subseteq>B. \<Union> B' = O'
[PROOF STEP]
by (auto intro: exI[where x="{f x |x. x \<in> O'}"])
[PROOF STATE]
proof (state)
this:
\<exists>B'\<subseteq>B. \<Union> B' = O'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>B'. B' \<in> B \<Longrightarrow> open B'; x \<in> B\<rbrakk> \<Longrightarrow> open x
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
topological_basis B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hull_antimono: "\<forall>x. S x \<longrightarrow> T x \<Longrightarrow> (T hull s) \<subseteq> (S hull s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. S x \<longrightarrow> T x \<Longrightarrow> T hull s \<subseteq> S hull s
[PROOF STEP]
unfolding hull_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. S x \<longrightarrow> T x \<Longrightarrow> \<Inter> {t. T t \<and> s \<subseteq> t} \<subseteq> \<Inter> {t. S t \<and> s \<subseteq> t}
[PROOF STEP]
by blast


[STATEMENT]
lemma merge_Some_iff:
  "map_of (merge m n) k = Some x \<longleftrightarrow>
    map_of n k = Some x \<or> map_of n k = None \<and> map_of m k = Some x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map_of (merge m n) k = Some x) = (map_of n k = Some x \<or> map_of n k = None \<and> map_of m k = Some x)
[PROOF STEP]
by (simp add: merge_conv' map_add_Some_iff)


[STATEMENT]
lemma factorial2_time: "VARS i f t
 {t=0}
 i := (1::nat); t := t+1; f := 1; t := t+1;
 WHILE i \<le> n INV {f = fac(i - 1) & 1 \<le> i & i \<le> n+1 & t = 2*(i-1)+2}
 DO f := f*i; t := t+1; i := i+1; t := t+1 OD
 {f = fac n & t = 2*n+2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {t = 0}
i := 1; t := t + 1; f := 1; t := t + 1; WHILE i \<le> n INV {f = fac (i - 1) \<and> 1 \<le> i \<and> i \<le> n + 1 \<and> t = 2 * (i - 1) + 2}  VAR {0}
DO f := f * i; t := t + 1; i := i + 1; t := t + 1 OD
{f = fac n \<and> t = 2 * n + 2}
[PROOF STEP]
apply vcg_simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. Suc 0 \<le> i \<and> i \<le> Suc n \<and> i \<le> n \<Longrightarrow> Suc (Suc (2 * (i - Suc 0))) = 2 * i
 2. \<And>i. Suc 0 \<le> i \<and> i \<le> Suc n \<and> \<not> i \<le> n \<Longrightarrow> fac (i - Suc 0) = fac n \<and> i - Suc 0 = n
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> Suc n; \<not> i \<le> n\<rbrakk> \<Longrightarrow> fac (i - Suc 0) = fac n
[PROOF STEP]
apply(subgoal_tac "i = Suc n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. \<lbrakk>i \<le> Suc n; \<not> i \<le> n; i = Suc n\<rbrakk> \<Longrightarrow> fac (i - Suc 0) = fac n
 2. \<And>i. \<lbrakk>i \<le> Suc n; \<not> i \<le> n\<rbrakk> \<Longrightarrow> i = Suc n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> Suc n; \<not> i \<le> n\<rbrakk> \<Longrightarrow> i = Suc n
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma retract_of_locally_path_connected:
  assumes "locally path_connected T" "S retract_of T"
  shows "locally path_connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally path_connected S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
locally path_connected T
S retract_of T

goal (1 subgoal):
 1. locally path_connected S
[PROOF STEP]
by (auto simp: idempotent_imp_retraction intro!: retraction_openin_vimage_iff elim!: locally_path_connected_quotient_image retract_ofE)


[STATEMENT]
lemma coin_setD_iff: "pair \<in> \<CC> g h \<longleftrightarrow> g (fst pair) = h (snd pair)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pair \<in> \<CC> g h) = (g (fst pair) = h (snd pair))
[PROOF STEP]
unfolding coincidence_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pair \<in> {(r, s). g r = h s}) = (g (fst pair) = h (snd pair))
[PROOF STEP]
by force


[STATEMENT]
theorem bs_findMin_correct:
  assumes I: "bs_invar h"
  assumes NE: "h\<noteq>bs_empty"
  shows "bs_findMin h \<in># bs_to_mset h"
        "\<forall>y\<in>set_mset (bs_to_mset h). snd (bs_findMin h) \<le> snd y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bs_findMin h \<in># bs_to_mset h &&& \<forall>y\<in>#bs_to_mset h. snd (bs_findMin h) \<le> snd y
[PROOF STEP]
using I NE
[PROOF STATE]
proof (prove)
using this:
bs_invar h
h \<noteq> bs_empty

goal (1 subgoal):
 1. bs_findMin h \<in># bs_to_mset h &&& \<forall>y\<in>#bs_to_mset h. snd (bs_findMin h) \<le> snd y
[PROOF STEP]
apply (case_tac [!] h)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>a. \<lbrakk>bs_invar h; h \<noteq> bs_empty; h = Inl a\<rbrakk> \<Longrightarrow> bs_findMin h \<in># bs_to_mset h
 2. \<And>b. \<lbrakk>bs_invar h; h \<noteq> bs_empty; h = Inr b\<rbrakk> \<Longrightarrow> bs_findMin h \<in># bs_to_mset h
 3. \<And>a. \<lbrakk>bs_invar h; h \<noteq> bs_empty; h = Inl a\<rbrakk> \<Longrightarrow> \<forall>y\<in>#bs_to_mset h. snd (bs_findMin h) \<le> snd y
 4. \<And>b. \<lbrakk>bs_invar h; h \<noteq> bs_empty; h = Inr b\<rbrakk> \<Longrightarrow> \<forall>y\<in>#bs_to_mset h. snd (bs_findMin h) \<le> snd y
[PROOF STEP]
apply (auto simp add: bs_empty_def findMin_correct')
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma interval_3split:
  assumes "i < n"
  shows "[0..<n] = [0..<i] @ [i] @ [i+1..<n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<n] = [0..<i] @ [i] @ [i + 1..<n]
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [0..<n] = [0..<i] @ [i] @ [i + 1..<n]
[PROOF STEP]
have "[0..<n] = [0..<i + 1] @ [i + 1..<n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<n] = [0..<i + 1] @ [i + 1..<n]
[PROOF STEP]
using upt_add_eq_append[of 0 "i + 1" "n - i - 1"]
[PROOF STATE]
proof (prove)
using this:
0 \<le> i + 1 \<Longrightarrow> [0..<i + 1 + (n - i - 1)] = [0..<i + 1] @ [i + 1..<i + 1 + (n - i - 1)]

goal (1 subgoal):
 1. [0..<n] = [0..<i + 1] @ [i + 1..<n]
[PROOF STEP]
using \<open>i < n\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> i + 1 \<Longrightarrow> [0..<i + 1 + (n - i - 1)] = [0..<i + 1] @ [i + 1..<i + 1 + (n - i - 1)]
i < n

goal (1 subgoal):
 1. [0..<n] = [0..<i + 1] @ [i + 1..<n]
[PROOF STEP]
by (auto simp del: upt_Suc)
[PROOF STATE]
proof (state)
this:
[0..<n] = [0..<i + 1] @ [i + 1..<n]

goal (1 subgoal):
 1. [0..<n] = [0..<i] @ [i] @ [i + 1..<n]
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[0..<n] = [0..<i + 1] @ [i + 1..<n]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[0..<n] = [0..<i + 1] @ [i + 1..<n]

goal (1 subgoal):
 1. [0..<n] = [0..<i] @ [i] @ [i + 1..<n]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[0..<n] = [0..<i] @ [i] @ [i + 1..<n]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rbt_lookup_rbt_interwk:
  "\<lbrakk> rbt_sorted t1; rbt_sorted t2 \<rbrakk>
  \<Longrightarrow> rbt_lookup (rbt_inter_with_key f t1 t2) k =
  (case rbt_lookup t1 k of None \<Rightarrow> None
   | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> None
               | Some w \<Rightarrow> Some (f k v w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rbt_sorted t1; rbt_sorted t2\<rbrakk> \<Longrightarrow> rbt_lookup (rbt_inter_with_key f t1 t2) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> None | Some w \<Rightarrow> Some (f k v w))
[PROOF STEP]
using rbt_lookup_inter_rec
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>rbt_sorted ?t1.0; rbt_sorted ?t2.0\<rbrakk> \<Longrightarrow> rbt_sorted (rbt_inter_rec ?f ?t1.0 ?t2.0) \<and> rbt_lookup (rbt_inter_rec ?f ?t1.0 ?t2.0) ?k = (case rbt_lookup ?t1.0 ?k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup ?t2.0 ?k of None \<Rightarrow> None | Some w \<Rightarrow> Some (?f ?k v w))

goal (1 subgoal):
 1. \<lbrakk>rbt_sorted t1; rbt_sorted t2\<rbrakk> \<Longrightarrow> rbt_lookup (rbt_inter_with_key f t1 t2) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> None | Some w \<Rightarrow> Some (f k v w))
[PROOF STEP]
by (auto simp: rbt_inter_with_key_def rbt_inter_swap_rec)


[STATEMENT]
lemma (in prob_space) emeasure_eq_1_AE:
  "S \<in> sets M \<Longrightarrow> AE x in M. x \<in> S \<Longrightarrow> emeasure M S = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<in> events; AE x in M. x \<in> S\<rbrakk> \<Longrightarrow> emeasure M S = 1
[PROOF STEP]
by (subst emeasure_eq_AE[where B="space M"]) (auto simp: emeasure_space_1)


[STATEMENT]
lemma samp_uni_add_mult:
  assumes coprime: "coprime x (q::nat)"
    and x': "x' < q"
    and y': "y' < q"
    and map: "(y + x * x') mod q = (y + x * y') mod q"
  shows "x' = y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x' = y'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x' = y'
[PROOF STEP]
have "(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q
[PROOF STEP]
have "(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> [y + x*x' = y + x *y'] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> [y + x * x' = y + x * y'] (mod q)
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. (y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> [y + x * x' = y + x * y'] (mod q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> [y + x * x' = y + x * y'] (mod q)

goal (1 subgoal):
 1. (y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> [y + x * x' = y + x * y'] (mod q)

goal (1 subgoal):
 1. (y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q
[PROOF STEP]
have "[y + x*x' = y + x *y'] (mod q) \<Longrightarrow> [x' = y'] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [y + x * x' = y + x * y'] (mod q) \<Longrightarrow> [x' = y'] (mod q)
[PROOF STEP]
by(simp add: cong_add_lcancel_nat)(simp add: coprime cong_mult_lcancel_nat)
[PROOF STATE]
proof (state)
this:
[y + x * x' = y + x * y'] (mod q) \<Longrightarrow> [x' = y'] (mod q)

goal (1 subgoal):
 1. (y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> [y + x * x' = y + x * y'] (mod q)
[y + x * x' = y + x * y'] (mod q) \<Longrightarrow> [x' = y'] (mod q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> [y + x * x' = y + x * y'] (mod q)
[y + x * x' = y + x * y'] (mod q) \<Longrightarrow> [x' = y'] (mod q)

goal (1 subgoal):
 1. x' mod q = y' mod q
[PROOF STEP]
by(simp add: cong_def map)
[PROOF STATE]
proof (state)
this:
x' mod q = y' mod q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q

goal (1 subgoal):
 1. x' = y'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q

goal (1 subgoal):
 1. x' = y'
[PROOF STEP]
have "x' mod q = y' mod q \<Longrightarrow> x' = y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x' mod q = y' mod q \<Longrightarrow> x' = y'
[PROOF STEP]
by(simp add: x' y')
[PROOF STATE]
proof (state)
this:
x' mod q = y' mod q \<Longrightarrow> x' = y'

goal (1 subgoal):
 1. x' = y'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q
x' mod q = y' mod q \<Longrightarrow> x' = y'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(y + x * x') mod q = (y + x * y') mod q \<Longrightarrow> x' mod q = y' mod q
x' mod q = y' mod q \<Longrightarrow> x' = y'

goal (1 subgoal):
 1. x' = y'
[PROOF STEP]
by(simp add: map)
[PROOF STATE]
proof (state)
this:
x' = y'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uint_and_mask_or_full:
  fixes n :: "'a :: len word"
  assumes "bit n (LENGTH('a) - 1)"
  and "mask1 = mask (LENGTH('a) - 1)"
  and "mask2 = push_bit (LENGTH('a) - 1) 1"
  shows "uint (n AND mask1) OR mask2 = uint n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
have "mask2 = uint (push_bit (LENGTH('a) - 1) 1 :: 'a word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mask2 = uint (push_bit (LENGTH('a) - 1) 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bit n (LENGTH('a) - 1)
mask1 = mask (LENGTH('a) - 1)
mask2 = push_bit (LENGTH('a) - 1) 1

goal (1 subgoal):
 1. mask2 = uint (push_bit (LENGTH('a) - 1) 1)
[PROOF STEP]
by transfer (simp add: take_bit_push_bit)
[PROOF STATE]
proof (state)
this:
mask2 = uint (push_bit (LENGTH('a) - 1) 1)

goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
hence "uint (n AND mask1) OR mask2 = uint (n AND mask1 OR (push_bit (LENGTH('a) - 1) 1 :: 'a word))"
[PROOF STATE]
proof (prove)
using this:
mask2 = uint (push_bit (LENGTH('a) - 1) 1)

goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint (n AND mask1 OR push_bit (LENGTH('a) - 1) 1)
[PROOF STEP]
by(simp add: uint_or)
[PROOF STATE]
proof (state)
this:
uint (n AND mask1) OR mask2 = uint (n AND mask1 OR push_bit (LENGTH('a) - 1) 1)

goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
uint (n AND mask1) OR mask2 = uint (n AND mask1 OR push_bit (LENGTH('a) - 1) 1)

goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
have "\<dots> = uint (n AND mask (LENGTH('a) - 1 + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uint (n AND mask1 OR push_bit (LENGTH('a) - 1) 1) = uint (n AND mask (LENGTH('a) - 1 + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bit n (LENGTH('a) - 1)
mask1 = mask (LENGTH('a) - 1)
mask2 = push_bit (LENGTH('a) - 1) 1

goal (1 subgoal):
 1. uint (n AND mask1 OR push_bit (LENGTH('a) - 1) 1) = uint (n AND mask (LENGTH('a) - 1 + 1))
[PROOF STEP]
by(simp only: word_and_mask_or_conv_and_mask)
[PROOF STATE]
proof (state)
this:
uint (n AND mask1 OR push_bit (LENGTH('a) - 1) 1) = uint (n AND mask (LENGTH('a) - 1 + 1))

goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
uint (n AND mask1 OR push_bit (LENGTH('a) - 1) 1) = uint (n AND mask (LENGTH('a) - 1 + 1))

goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
have "\<dots> = uint n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uint (n AND mask (LENGTH('a) - 1 + 1)) = uint n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
uint (n AND mask (LENGTH('a) - 1 + 1)) = uint n

goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
uint (n AND mask1) OR mask2 = uint n

goal (1 subgoal):
 1. uint (n AND mask1) OR mask2 = uint n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
uint (n AND mask1) OR mask2 = uint n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem is_Inf_uniq: "is_Inf A inf \<Longrightarrow> is_Inf A inf' \<Longrightarrow> inf = inf'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_Inf A inf; is_Inf A inf'\<rbrakk> \<Longrightarrow> inf = inf'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>is_Inf A inf; is_Inf A inf'\<rbrakk> \<Longrightarrow> inf = inf'
[PROOF STEP]
assume inf: "is_Inf A inf"
[PROOF STATE]
proof (state)
this:
is_Inf A inf

goal (1 subgoal):
 1. \<lbrakk>is_Inf A inf; is_Inf A inf'\<rbrakk> \<Longrightarrow> inf = inf'
[PROOF STEP]
assume inf': "is_Inf A inf'"
[PROOF STATE]
proof (state)
this:
is_Inf A inf'

goal (1 subgoal):
 1. \<lbrakk>is_Inf A inf; is_Inf A inf'\<rbrakk> \<Longrightarrow> inf = inf'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf = inf'
[PROOF STEP]
proof (rule leq_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inf \<sqsubseteq> inf'
 2. inf' \<sqsubseteq> inf
[PROOF STEP]
from inf'
[PROOF STATE]
proof (chain)
picking this:
is_Inf A inf'
[PROOF STEP]
show "inf \<sqsubseteq> inf'"
[PROOF STATE]
proof (prove)
using this:
is_Inf A inf'

goal (1 subgoal):
 1. inf \<sqsubseteq> inf'
[PROOF STEP]
proof (rule is_Inf_greatest)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> inf \<sqsubseteq> x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> inf \<sqsubseteq> x
[PROOF STEP]
assume "x \<in> A"
[PROOF STATE]
proof (state)
this:
x \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> inf \<sqsubseteq> x
[PROOF STEP]
with inf
[PROOF STATE]
proof (chain)
picking this:
is_Inf A inf
x \<in> A
[PROOF STEP]
show "inf \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
using this:
is_Inf A inf
x \<in> A

goal (1 subgoal):
 1. inf \<sqsubseteq> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
inf \<sqsubseteq> x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inf \<sqsubseteq> inf'

goal (1 subgoal):
 1. inf' \<sqsubseteq> inf
[PROOF STEP]
from inf
[PROOF STATE]
proof (chain)
picking this:
is_Inf A inf
[PROOF STEP]
show "inf' \<sqsubseteq> inf"
[PROOF STATE]
proof (prove)
using this:
is_Inf A inf

goal (1 subgoal):
 1. inf' \<sqsubseteq> inf
[PROOF STEP]
proof (rule is_Inf_greatest)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> inf' \<sqsubseteq> x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> inf' \<sqsubseteq> x
[PROOF STEP]
assume "x \<in> A"
[PROOF STATE]
proof (state)
this:
x \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> inf' \<sqsubseteq> x
[PROOF STEP]
with inf'
[PROOF STATE]
proof (chain)
picking this:
is_Inf A inf'
x \<in> A
[PROOF STEP]
show "inf' \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
using this:
is_Inf A inf'
x \<in> A

goal (1 subgoal):
 1. inf' \<sqsubseteq> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
inf' \<sqsubseteq> x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inf' \<sqsubseteq> inf

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inf = inf'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bullet_1_going_to_at_top_neq_bot [simp]:
  "((\<lambda>s::'a::{real_normed_algebra_1, real_inner}. s \<bullet> 1) going_to at_top) \<noteq> bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>s. s \<bullet> (1::'a)) going_to at_top \<noteq> bot
[PROOF STEP]
unfolding going_to_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtercomap (\<lambda>s. s \<bullet> (1::'a)) at_top \<noteq> bot
[PROOF STEP]
by (rule filtercomap_neq_bot_surj[OF _ surj_bullet_1]) auto


[STATEMENT]
lemma affine_imp_convex: "affine s \<Longrightarrow> convex s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine s \<Longrightarrow> convex s
[PROOF STEP]
unfolding affine_def convex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>s. \<forall>y\<in>s. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s \<Longrightarrow> \<forall>x\<in>s. \<forall>y\<in>s. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s
[PROOF STEP]
by auto


[STATEMENT]
lemma LeadsTo_Un_distrib:
     "(F \<in> (A \<union> B) LeadsTo C)  = (F \<in> A LeadsTo C & F \<in> B LeadsTo C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<in> A \<union> B \<longmapsto>w C) = (F \<in> A \<longmapsto>w C \<and> F \<in> B \<longmapsto>w C)
[PROOF STEP]
by (blast intro: LeadsTo_Un LeadsTo_weaken_L)


[STATEMENT]
lemma nth_default_take: "nth_default x (take n xs) m = (if m < n then nth_default x xs m else x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default x (take n xs) m = (if m < n then nth_default x xs m else x)
[PROOF STEP]
by (auto simp add: nth_default_def add_ac)


[STATEMENT]
lemma connected_card_eq_iff_nontrivial:
  fixes S :: "'a::metric_space set"
  shows "connected S \<Longrightarrow> uncountable S \<longleftrightarrow> \<not>(\<exists>a. S \<subseteq> {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected S \<Longrightarrow> uncountable S = (\<nexists>a. S \<subseteq> {a})
[PROOF STEP]
by (metis connected_uncountable finite.emptyI finite.insertI rev_finite_subset singleton_iff subsetI uncountable_infinite)


[STATEMENT]
lemma T_def: "T = {tmin .. tmax}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T = {tmin..tmax}
[PROOF STEP]
using closed_segment_subset_interval[OF interval tmin(2) tmax(2)]
[PROOF STATE]
proof (prove)
using this:
{tmin--tmax} \<subseteq> T

goal (1 subgoal):
 1. T = {tmin..tmax}
[PROOF STEP]
by (auto simp: closed_segment_eq_real_ivl subset_iff intro!: tmin tmax)


[STATEMENT]
lemma min_ed_ix_min_ed: "min_ed_ix xs ys m n (i,j) = min_ed (slice xs i m) (slice ys j n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_ed_ix xs ys m n (i, j) = min_ed (map xs [i..<m]) (map ys [j..<n])
[PROOF STEP]
apply(induction "(i,j)" arbitrary: i j rule: min_ed_ix.induct[of m n])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>\<lbrakk>\<not> m \<le> i; \<not> n \<le> j\<rbrakk> \<Longrightarrow> min_ed_ix xs ys m n (i, j + 1) = min_ed (map xs [i..<m]) (map ys [j + 1..<n]); \<lbrakk>\<not> m \<le> i; \<not> n \<le> j\<rbrakk> \<Longrightarrow> min_ed_ix xs ys m n (i + 1, j) = min_ed (map xs [i + 1..<m]) (map ys [j..<n]); \<lbrakk>\<not> m \<le> i; \<not> n \<le> j\<rbrakk> \<Longrightarrow> min_ed_ix xs ys m n (i + 1, j + 1) = min_ed (map xs [i + 1..<m]) (map ys [j + 1..<n])\<rbrakk> \<Longrightarrow> min_ed_ix xs ys m n (i, j) = min_ed (map xs [i..<m]) (map ys [j..<n])
[PROOF STEP]
apply(simp add: min_ed_ix.simps upt_conv_Cons min_ed_Nil1 min_ed_Nil2 Suc_diff_Suc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma retract_of_path_connected:
    "\<lbrakk>path_connected T; S retract_of T\<rbrakk> \<Longrightarrow> path_connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path_connected T; S retract_of T\<rbrakk> \<Longrightarrow> path_connected S
[PROOF STEP]
by (metis path_connected_continuous_image retract_of_def retraction)


[STATEMENT]
lemma raw_has_prod_Suc:
  "raw_has_prod f (Suc M) a \<longleftrightarrow> raw_has_prod (\<lambda>n. f (Suc n)) M a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. raw_has_prod f (Suc M) a = raw_has_prod (\<lambda>n. f (Suc n)) M a
[PROOF STEP]
unfolding raw_has_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. \<Prod>i\<le>n. f (i + Suc M)) \<longlonglongrightarrow> a \<and> a \<noteq> (0::'a)) = ((\<lambda>n. \<Prod>i\<le>n. f (Suc (i + M))) \<longlonglongrightarrow> a \<and> a \<noteq> (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma "inorder(join l x r) = inorder l @ x # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tree2.inorder (Set2_Join_RBT.join l x r) = Tree2.inorder l @ x # Tree2.inorder r
[PROOF STEP]
by(auto simp: inorder_joinL inorder_joinR inorder_paint join_def
      split!: tree.splits color.splits if_splits
      dest!: arg_cong[where f = inorder])