[STATEMENT]
lemma (in group) weak_group_morphism_inv_into:
  assumes "weak_group_morphism f H G" and "a \<in> carrier G"
  obtains h h' where "h  \<in> H" "inv_into (carrier G) f (f a) = h \<otimes> a"
                 and "h' \<in> H" "inv_into (carrier G) f (f a) = a \<otimes> h'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h h'. \<lbrakk>h \<in> H; inv_into (carrier G) f (f a) = h \<otimes> a; h' \<in> H; inv_into (carrier G) f (f a) = a \<otimes> h'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>h h'. \<lbrakk>h \<in> H; inv_into (carrier G) f (f a) = h \<otimes> a; h' \<in> H; inv_into (carrier G) f (f a) = a \<otimes> h'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "inv_into (carrier G) f (f a) \<in> { b \<in> carrier G. f b = f a }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_into (carrier G) f (f a) \<in> {b \<in> carrier G. f b = f a}
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G

goal (1 subgoal):
 1. inv_into (carrier G) f (f a) \<in> {b \<in> carrier G. f b = f a}
[PROOF STEP]
by (auto simp add: inv_into_into f_inv_into_f)
[PROOF STATE]
proof (state)
this:
inv_into (carrier G) f (f a) \<in> {b \<in> carrier G. f b = f a}

goal (1 subgoal):
 1. (\<And>h h'. \<lbrakk>h \<in> H; inv_into (carrier G) f (f a) = h \<otimes> a; h' \<in> H; inv_into (carrier G) f (f a) = a \<otimes> h'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
thus thesis
[PROOF STATE]
proof (prove)
using this:
inv_into (carrier G) f (f a) \<in> {b \<in> carrier G. f b = f a}

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that vimage_eq_rcoset[OF assms]
[PROOF STATE]
proof (prove)
using this:
inv_into (carrier G) f (f a) \<in> {b \<in> carrier G. f b = f a}
\<lbrakk>?h \<in> H; inv_into (carrier G) f (f a) = ?h \<otimes> a; ?h' \<in> H; inv_into (carrier G) f (f a) = a \<otimes> ?h'\<rbrakk> \<Longrightarrow> thesis
{b \<in> carrier G. f b = f a} = H #> a
{b \<in> carrier G. f b = f a} = a <# H

goal (1 subgoal):
 1. thesis
[PROOF STEP]
unfolding r_coset_def l_coset_def
[PROOF STATE]
proof (prove)
using this:
inv_into (carrier G) f (f a) \<in> {b \<in> carrier G. f b = f a}
\<lbrakk>?h \<in> H; inv_into (carrier G) f (f a) = ?h \<otimes> a; ?h' \<in> H; inv_into (carrier G) f (f a) = a \<otimes> ?h'\<rbrakk> \<Longrightarrow> thesis
{b \<in> carrier G. f b = f a} = (\<Union>h\<in>H. {h \<otimes> a})
{b \<in> carrier G. f b = f a} = (\<Union>h\<in>H. {a \<otimes> h})

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_not_0_imp_lin_indpt_rows:
  assumes A: "A \<in> carrier_mat n n" and det: "det A \<noteq> 0"
  shows "lin_indpt (set (rows A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (set (rows A))
[PROOF STEP]
using lin_dep_rows_imp_det_0[OF A] det
[PROOF STATE]
proof (prove)
using this:
lin_dep (set (rows A)) \<Longrightarrow> det A = (0::'a)
det A \<noteq> (0::'a)

goal (1 subgoal):
 1. lin_indpt (set (rows A))
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_sum_distribute_mix_pmf:
  assumes "finite (set_pmf (mix_pmf a p q))"
  assumes "finite (set_pmf p)"
  assumes "finite (set_pmf q)"
  shows "(\<Sum>i \<in> set_pmf (mix_pmf a p q). pmf (mix_pmf a p q) i) = (\<Sum>i\<in>set_pmf p.  a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1-a) * pmf q i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = (\<Sum>i\<in>set_pmf p. a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1 - a) * pmf q i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = (\<Sum>i\<in>set_pmf p. a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1 - a) * pmf q i)
[PROOF STEP]
have fst: "(\<Sum>i \<in> set_pmf (mix_pmf a p q). pmf (mix_pmf a p q) i) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = 1
[PROOF STEP]
using sum_pmf_eq_1 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; set_pmf ?p \<subseteq> ?A\<rbrakk> \<Longrightarrow> sum (pmf ?p) ?A = 1
finite (set_pmf (mix_pmf a p q))
finite (set_pmf p)
finite (set_pmf q)

goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = 1

goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = (\<Sum>i\<in>set_pmf p. a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1 - a) * pmf q i)
[PROOF STEP]
have "(\<Sum>i\<in>set_pmf p.  a * pmf p i) = a * (\<Sum>i\<in>set_pmf p. pmf p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>set_pmf p. a * pmf p i) = a * sum (pmf p) (set_pmf p)
[PROOF STEP]
by (simp add: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>set_pmf p. a * pmf p i) = a * sum (pmf p) (set_pmf p)

goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = (\<Sum>i\<in>set_pmf p. a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1 - a) * pmf q i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>set_pmf p. a * pmf p i) = a * sum (pmf p) (set_pmf p)

goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = (\<Sum>i\<in>set_pmf p. a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1 - a) * pmf q i)
[PROOF STEP]
have "... = a * 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * sum (pmf p) (set_pmf p) = a * 1
[PROOF STEP]
using assms sum_pmf_eq_1
[PROOF STATE]
proof (prove)
using this:
finite (set_pmf (mix_pmf a p q))
finite (set_pmf p)
finite (set_pmf q)
\<lbrakk>finite ?A; set_pmf ?p \<subseteq> ?A\<rbrakk> \<Longrightarrow> sum (pmf ?p) ?A = 1

goal (1 subgoal):
 1. a * sum (pmf p) (set_pmf p) = a * 1
[PROOF STEP]
by (simp add: sum_pmf_eq_1)
[PROOF STATE]
proof (state)
this:
a * sum (pmf p) (set_pmf p) = a * 1

goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = (\<Sum>i\<in>set_pmf p. a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1 - a) * pmf q i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a * sum (pmf p) (set_pmf p) = a * 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a * sum (pmf p) (set_pmf p) = a * 1

goal (1 subgoal):
 1. sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = (\<Sum>i\<in>set_pmf p. a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1 - a) * pmf q i)
[PROOF STEP]
by (metis fst add.assoc add_diff_cancel_left' add_uminus_conv_diff assms(3)
        mult.right_neutral order_refl sum_distrib_left sum_pmf_eq_1)
[PROOF STATE]
proof (state)
this:
sum (pmf (mix_pmf a p q)) (set_pmf (mix_pmf a p q)) = (\<Sum>i\<in>set_pmf p. a * pmf p i) + (\<Sum>i\<in>set_pmf q. (1 - a) * pmf q i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hyperplane_eq_UNIV:
   "{x. a \<bullet> x = b} = UNIV \<longleftrightarrow> a = 0 \<and> b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x. a \<bullet> x = b} = UNIV) = (a = (0::'a) \<and> b = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ({x. a \<bullet> x = b} = UNIV) = (a = (0::'a) \<and> b = 0)
[PROOF STEP]
have "a = 0 \<and> b = 0" if "UNIV \<subseteq> {x. a \<bullet> x = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = (0::'a) \<and> b = 0
[PROOF STEP]
using subsetD [OF that, where c = "((b+1) / (a \<bullet> a)) *\<^sub>R a"]
[PROOF STATE]
proof (prove)
using this:
((b + 1) / (a \<bullet> a)) *\<^sub>R a \<in> UNIV \<Longrightarrow> ((b + 1) / (a \<bullet> a)) *\<^sub>R a \<in> {x. a \<bullet> x = b}

goal (1 subgoal):
 1. a = (0::'a) \<and> b = 0
[PROOF STEP]
by (simp add: field_split_simps split: if_split_asm)
[PROOF STATE]
proof (state)
this:
UNIV \<subseteq> {x. a \<bullet> x = b} \<Longrightarrow> a = (0::'a) \<and> b = 0

goal (1 subgoal):
 1. ({x. a \<bullet> x = b} = UNIV) = (a = (0::'a) \<and> b = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
UNIV \<subseteq> {x. a \<bullet> x = b} \<Longrightarrow> a = (0::'a) \<and> b = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
UNIV \<subseteq> {x. a \<bullet> x = b} \<Longrightarrow> a = (0::'a) \<and> b = 0

goal (1 subgoal):
 1. ({x. a \<bullet> x = b} = UNIV) = (a = (0::'a) \<and> b = 0)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
({x. a \<bullet> x = b} = UNIV) = (a = (0::'a) \<and> b = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dag_less_le:
  fixes x::dag and y
  shows "(x < y) = (x \<le> y \<and> x \<noteq> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x < y) = (x \<le> y \<and> x \<noteq> y)
[PROOF STEP]
by (auto simp add: less_dag_def le_dag_def dest: subdag_neq)


[STATEMENT]
lemma compute_bitlen [code]:
  "bitlen x = (if x > 0 then bitlen (x div 2) + 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bitlen x = (if 0 < x then bitlen (x div 2) + 1 else 0)
[PROOF STEP]
by (simp add: bitlen_def nat_div_distrib compute_floorlog)


[STATEMENT]
lemma arcosh_eq_0_iff:
  fixes x::real
  assumes "x \<ge> 1"
  shows "arcosh x = 0 \<longleftrightarrow> x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arcosh x = 0) = (x = 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. (arcosh x = 0) = (x = 1)
[PROOF STEP]
using cosh_arcosh
[PROOF STATE]
proof (prove)
using this:
1 \<le> x
1 \<le> ?x \<Longrightarrow> cosh (arcosh ?x) = ?x

goal (1 subgoal):
 1. (arcosh x = 0) = (x = 1)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma fraction_not_in_ints:
  assumes "\<not>(n dvd m)" "n \<noteq> 0"
  shows   "of_int m / of_int n \<notin> (\<int> :: 'a :: {division_ring,ring_char_0} set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int m / of_int n \<notin> \<int>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int m / of_int n \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
assume "of_int m / (of_int n :: 'a) \<in> \<int>"
[PROOF STATE]
proof (state)
this:
of_int m / of_int n \<in> \<int>

goal (1 subgoal):
 1. of_int m / of_int n \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_int m / of_int n \<in> \<int>
[PROOF STEP]
obtain k where "of_int m / of_int n = (of_int k :: 'a)"
[PROOF STATE]
proof (prove)
using this:
of_int m / of_int n \<in> \<int>

goal (1 subgoal):
 1. (\<And>k. of_int m / of_int n = of_int k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim Ints_cases)
[PROOF STATE]
proof (state)
this:
of_int m / of_int n = of_int k

goal (1 subgoal):
 1. of_int m / of_int n \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
\<not> n dvd m
n \<noteq> 0
of_int m / of_int n = of_int k
[PROOF STEP]
have "of_int m = (of_int (k * n) :: 'a)"
[PROOF STATE]
proof (prove)
using this:
\<not> n dvd m
n \<noteq> 0
of_int m / of_int n = of_int k

goal (1 subgoal):
 1. of_int m = of_int (k * n)
[PROOF STEP]
by (auto simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
of_int m = of_int (k * n)

goal (1 subgoal):
 1. of_int m / of_int n \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
hence "m = k * n"
[PROOF STATE]
proof (prove)
using this:
of_int m = of_int (k * n)

goal (1 subgoal):
 1. m = k * n
[PROOF STEP]
by (subst (asm) of_int_eq_iff)
[PROOF STATE]
proof (state)
this:
m = k * n

goal (1 subgoal):
 1. of_int m / of_int n \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
hence "n dvd m"
[PROOF STATE]
proof (prove)
using this:
m = k * n

goal (1 subgoal):
 1. n dvd m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n dvd m

goal (1 subgoal):
 1. of_int m / of_int n \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
with assms(1)
[PROOF STATE]
proof (chain)
picking this:
\<not> n dvd m
n dvd m
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> n dvd m
n dvd m

goal (1 subgoal):
 1. False
[PROOF STEP]
by contradiction
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gen_boolean_algebra_finite_union:
  assumes "\<And>a. a \<in> A \<Longrightarrow> a \<in> gen_boolean_algebra S B"
  assumes "finite A"
  shows "\<Union>A \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> A \<in> gen_boolean_algebra S B
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> A \<in> gen_boolean_algebra S B
[PROOF STEP]
have "(\<forall>a \<in> A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union>A \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> A \<in> gen_boolean_algebra S B
[PROOF STEP]
apply(rule finite.induct[of A])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite A
 2. (\<forall>a\<in>{}. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> {} \<in> gen_boolean_algebra S B
 3. \<And>A a. \<lbrakk>finite A; (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> A \<in> gen_boolean_algebra S B\<rbrakk> \<Longrightarrow> (\<forall>a\<in>insert a A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> (insert a A) \<in> gen_boolean_algebra S B
[PROOF STEP]
apply (simp add: assms(2); fail)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>a\<in>{}. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> {} \<in> gen_boolean_algebra S B
 2. \<And>A a. \<lbrakk>finite A; (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> A \<in> gen_boolean_algebra S B\<rbrakk> \<Longrightarrow> (\<forall>a\<in>insert a A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> (insert a A) \<in> gen_boolean_algebra S B
[PROOF STEP]
apply (metis DiffE Union_empty ex_in_conv  gen_boolean_algebra.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> A \<in> gen_boolean_algebra S B\<rbrakk> \<Longrightarrow> (\<forall>a\<in>insert a A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> (insert a A) \<in> gen_boolean_algebra S B
[PROOF STEP]
by (metis Union_insert gen_boolean_algebra.simps insert_iff)
[PROOF STATE]
proof (state)
this:
(\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> A \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. \<Union> A \<in> gen_boolean_algebra S B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> A \<in> gen_boolean_algebra S B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> A \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. \<Union> A \<in> gen_boolean_algebra S B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<longrightarrow> \<Union> A \<in> gen_boolean_algebra S B
?a \<in> A \<Longrightarrow> ?a \<in> gen_boolean_algebra S B
finite A

goal (1 subgoal):
 1. \<Union> A \<in> gen_boolean_algebra S B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<Union> A \<in> gen_boolean_algebra S B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_dom_map_of: "distinct (map fst al) \<Longrightarrow> card (dom (map_of al)) = length al"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map fst al) \<Longrightarrow> card (dom (map_of al)) = length al
[PROOF STEP]
by(induct al)(auto simp add: card_insert_if finite_dom_map_of dom_map_of_conv_image_fst)


[STATEMENT]
lemma poly_shift_0 [simp]: "poly_shift n 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_shift n 0 = 0
[PROOF STEP]
by (simp add: poly_eq_iff coeff_poly_shift)


[STATEMENT]
lemma dvd_all_coeffs_iff:
  fixes x :: "'a :: comm_semiring_1" (* No addition needed! *)
  shows "(\<forall>pi \<in> set (coeffs p). x dvd pi) \<longleftrightarrow> (\<forall>i. x dvd coeff p i)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)
[PROOF STEP]
have "?r = (\<forall>i\<in>{..degree p} \<union> {Suc (degree p)..}. x dvd coeff p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i. x dvd coeff p i) = (\<forall>i\<in>{..degree p} \<union> {Suc (degree p)..}. x dvd coeff p i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>i. x dvd coeff p i) = (\<forall>i\<in>{..degree p} \<union> {Suc (degree p)..}. x dvd coeff p i)

goal (1 subgoal):
 1. (\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>i. x dvd coeff p i) = (\<forall>i\<in>{..degree p} \<union> {Suc (degree p)..}. x dvd coeff p i)

goal (1 subgoal):
 1. (\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)
[PROOF STEP]
have "... = (\<forall>i\<le>degree p. x dvd coeff p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>{..degree p} \<union> {Suc (degree p)..}. x dvd coeff p i) = (\<forall>i\<le>degree p. x dvd coeff p i)
[PROOF STEP]
by (auto simp add: ball_Un coeff_eq_0)
[PROOF STATE]
proof (state)
this:
(\<forall>i\<in>{..degree p} \<union> {Suc (degree p)..}. x dvd coeff p i) = (\<forall>i\<le>degree p. x dvd coeff p i)

goal (1 subgoal):
 1. (\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>i\<in>{..degree p} \<union> {Suc (degree p)..}. x dvd coeff p i) = (\<forall>i\<le>degree p. x dvd coeff p i)

goal (1 subgoal):
 1. (\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)
[PROOF STEP]
have "... = ?l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<le>degree p. x dvd coeff p i) = (\<forall>pi\<in>set (coeffs p). x dvd pi)
[PROOF STEP]
by (auto simp: coeffs_def)
[PROOF STATE]
proof (state)
this:
(\<forall>i\<le>degree p. x dvd coeff p i) = (\<forall>pi\<in>set (coeffs p). x dvd pi)

goal (1 subgoal):
 1. (\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<forall>i. x dvd coeff p i) = (\<forall>pi\<in>set (coeffs p). x dvd pi)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<forall>i. x dvd coeff p i) = (\<forall>pi\<in>set (coeffs p). x dvd pi)

goal (1 subgoal):
 1. (\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<forall>pi\<in>set (coeffs p). x dvd pi) = (\<forall>i. x dvd coeff p i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finsert [code]:
  "finsert a (fset_of_list as) = fset_of_list (List.insert a as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsert a (fset_of_list as) = fset_of_list (List.insert a as)
[PROOF STEP]
by (simp add: List.insert_def finsert_absorb fset_of_list_elem)


[STATEMENT]
lemma sorted_insort_remove1: "sorted w \<Longrightarrow> (insort a (remove1 a w)) = sorted_list_of_set (insert a (set w)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted w \<Longrightarrow> insort a (remove1 a w) = sorted_list_of_set (insert a (set w))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sorted_Less.sorted w \<Longrightarrow> insort a (remove1 a w) = sorted_list_of_set (insert a (set w))
[PROOF STEP]
assume "sorted w"
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted w

goal (1 subgoal):
 1. Sorted_Less.sorted w \<Longrightarrow> insort a (remove1 a w) = sorted_list_of_set (insert a (set w))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted w
[PROOF STEP]
have "(sorted_list_of_set (set w - {a})) = remove1 a w"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted w

goal (1 subgoal):
 1. sorted_list_of_set (set w - {a}) = remove1 a w
[PROOF STEP]
using sorted_less_set_eq
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted w
Sorted_Less.sorted ?xs \<Longrightarrow> ?xs = sorted_list_of_set (set ?xs)

goal (1 subgoal):
 1. sorted_list_of_set (set w - {a}) = remove1 a w
[PROOF STEP]
by (fastforce simp add:sorted_list_of_set_remove)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (set w - {a}) = remove1 a w

goal (1 subgoal):
 1. Sorted_Less.sorted w \<Longrightarrow> insort a (remove1 a w) = sorted_list_of_set (insert a (set w))
[PROOF STEP]
hence "insort a (remove1 a w) = insort a (sorted_list_of_set (set w - {a}))"
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set (set w - {a}) = remove1 a w

goal (1 subgoal):
 1. insort a (remove1 a w) = insort a (sorted_list_of_set (set w - {a}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
insort a (remove1 a w) = insort a (sorted_list_of_set (set w - {a}))

goal (1 subgoal):
 1. Sorted_Less.sorted w \<Longrightarrow> insort a (remove1 a w) = sorted_list_of_set (insert a (set w))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
insort a (remove1 a w) = insort a (sorted_list_of_set (set w - {a}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
insort a (remove1 a w) = insort a (sorted_list_of_set (set w - {a}))

goal (1 subgoal):
 1. insort a (remove1 a w) = sorted_list_of_set (insert a (set w))
[PROOF STEP]
by (auto simp add:sorted_list_of_set_insert)
[PROOF STATE]
proof (state)
this:
insort a (remove1 a w) = sorted_list_of_set (insert a (set w))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_mod_poly:
  assumes "(k::nat)>0"
  shows "(k - 1) * (\<Sum> n\<in>{..<q}. k^n) < k^q "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k - 1) * sum ((^) k) {..<q} < k ^ q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (k - 1) * sum ((^) k) {..<q} < k ^ q
[PROOF STEP]
have "int ((k - 1) * (\<Sum>n<q. k ^ n)) =
        (int k - 1) * (\<Sum>n<q. int k ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int ((k - 1) * sum ((^) k) {..<q}) = (int k - 1) * sum ((^) (int k)) {..<q}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. int ((k - 1) * sum ((^) k) {..<q}) = (int k - 1) * sum ((^) (int k)) {..<q}
[PROOF STEP]
by (simp add: of_nat_diff)
[PROOF STATE]
proof (state)
this:
int ((k - 1) * sum ((^) k) {..<q}) = (int k - 1) * sum ((^) (int k)) {..<q}

goal (1 subgoal):
 1. (k - 1) * sum ((^) k) {..<q} < k ^ q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int ((k - 1) * sum ((^) k) {..<q}) = (int k - 1) * sum ((^) (int k)) {..<q}

goal (1 subgoal):
 1. (k - 1) * sum ((^) k) {..<q} < k ^ q
[PROOF STEP]
have "\<dots> = int k ^ q - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int k - 1) * sum ((^) (int k)) {..<q} = int k ^ q - 1
[PROOF STEP]
by (induction q) (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
(int k - 1) * sum ((^) (int k)) {..<q} = int k ^ q - 1

goal (1 subgoal):
 1. (k - 1) * sum ((^) k) {..<q} < k ^ q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(int k - 1) * sum ((^) (int k)) {..<q} = int k ^ q - 1

goal (1 subgoal):
 1. (k - 1) * sum ((^) k) {..<q} < k ^ q
[PROOF STEP]
have "\<dots> < int (k ^ q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int k ^ q - 1 < int (k ^ q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int k ^ q - 1 < int (k ^ q)

goal (1 subgoal):
 1. (k - 1) * sum ((^) k) {..<q} < k ^ q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int ((k - 1) * sum ((^) k) {..<q}) < int (k ^ q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
int ((k - 1) * sum ((^) k) {..<q}) < int (k ^ q)

goal (1 subgoal):
 1. (k - 1) * sum ((^) k) {..<q} < k ^ q
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(k - 1) * sum ((^) k) {..<q} < k ^ q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_set_prefixes[simp]: "xs \<in> set (prefixes ys) \<longleftrightarrow> prefix xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs \<in> set (prefixes ys)) = prefix xs ys
[PROOF STEP]
proof (induct xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. ([] \<in> set (prefixes ys)) = prefix [] ys
 2. \<And>a xs ys. (\<And>ys. (xs \<in> set (prefixes ys)) = prefix xs ys) \<Longrightarrow> (a # xs \<in> set (prefixes ys)) = prefix (a # xs) ys
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>ys. ([] \<in> set (prefixes ys)) = prefix [] ys
 2. \<And>a xs ys. (\<And>ys. (xs \<in> set (prefixes ys)) = prefix xs ys) \<Longrightarrow> (a # xs \<in> set (prefixes ys)) = prefix (a # xs) ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([] \<in> set (prefixes ys)) = prefix [] ys
[PROOF STEP]
by (cases ys) auto
[PROOF STATE]
proof (state)
this:
([] \<in> set (prefixes ys)) = prefix [] ys

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (xs \<in> set (prefixes ys)) = prefix xs ys) \<Longrightarrow> (a # xs \<in> set (prefixes ys)) = prefix (a # xs) ys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (xs \<in> set (prefixes ys)) = prefix xs ys) \<Longrightarrow> (a # xs \<in> set (prefixes ys)) = prefix (a # xs) ys
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
(xs \<in> set (prefixes ?ys)) = prefix xs ?ys

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (xs \<in> set (prefixes ys)) = prefix xs ys) \<Longrightarrow> (a # xs \<in> set (prefixes ys)) = prefix (a # xs) ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(xs \<in> set (prefixes ?ys)) = prefix xs ?ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(xs \<in> set (prefixes ?ys)) = prefix xs ?ys

goal (1 subgoal):
 1. (a # xs \<in> set (prefixes ys)) = prefix (a # xs) ys
[PROOF STEP]
by (cases ys) auto
[PROOF STATE]
proof (state)
this:
(a # xs \<in> set (prefixes ys)) = prefix (a # xs) ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_const_mult_left:
  "fps_const (c::'a::{comm_monoid_add,mult_zero}) * f = Abs_fps (\<lambda>n. c * f$n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_const c * f = Abs_fps (\<lambda>n. c * f $ n)
[PROOF STEP]
unfolding fps_eq_iff fps_mult_nth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. (\<Sum>i = 0..n. fps_const c $ i * f $ (n - i)) = Abs_fps (\<lambda>n. c * f $ n) $ n
[PROOF STEP]
by (simp add: fps_const_def mult_delta_left)


[STATEMENT]
lemma pdevs_val_const_pdevs_of_list: "pdevs_val (\<lambda>_. c) (pdevs_of_list xs) = c *\<^sub>R sum_list xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdevs_val (\<lambda>_. c) (pdevs_of_list xs) = c *\<^sub>R sum_list xs
[PROOF STEP]
unfolding pdevs_val_zip split_beta' scaleR_sum_list
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>zip [0..<length xs] xs. c *\<^sub>R snd x) = sum_list (map ((*\<^sub>R) c) xs)
[PROOF STEP]
by (rule arg_cong) (auto intro!: nth_equalityI)


[STATEMENT]
lemma snd_quotient_plus_leq:
  defines "de\<equiv>(snd o quotient_of)"
  shows "de (x+y) \<le> de x * de y "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. de (x + y) \<le> de x * de y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. de (x + y) \<le> de x * de y
[PROOF STEP]
obtain x1 x2 y1 y2 where xy: "quotient_of x = (x1,x2)" "quotient_of y=(y1,y2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x1 x2 y1 y2. \<lbrakk>quotient_of x = (x1, x2); quotient_of y = (y1, y2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson surj_pair)
[PROOF STATE]
proof (state)
this:
quotient_of x = (x1, x2)
quotient_of y = (y1, y2)

goal (1 subgoal):
 1. de (x + y) \<le> de x * de y
[PROOF STEP]
have "x2>0" "y2>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x2 &&& 0 < y2
[PROOF STEP]
using xy quotient_of_denom_pos
[PROOF STATE]
proof (prove)
using this:
quotient_of x = (x1, x2)
quotient_of y = (y1, y2)
quotient_of ?r = (?p, ?q) \<Longrightarrow> 0 < ?q

goal (1 subgoal):
 1. 0 < x2 &&& 0 < y2
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
0 < x2
0 < y2

goal (1 subgoal):
 1. de (x + y) \<le> de x * de y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < x2
0 < y2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < x2
0 < y2

goal (1 subgoal):
 1. de (x + y) \<le> de x * de y
[PROOF STEP]
unfolding de_def comp_def rat_plus_code xy
[PROOF STATE]
proof (prove)
using this:
0 < x2
0 < y2

goal (1 subgoal):
 1. snd (let (a, c) = (x1, x2); (b, d) = (y1, y2) in Rat.normalize (a * d + b * c, c * d)) \<le> snd (x1, x2) * snd (y1, y2)
[PROOF STEP]
apply (auto split:prod.split simp:Rat.normalize_def Let_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x2; 0 < y2\<rbrakk> \<Longrightarrow> x2 * y2 div gcd (x1 * y2 + y1 * x2) (x2 * y2) \<le> x2 * y2
[PROOF STEP]
by (smt div_by_1 gcd_pos_int int_div_less_self mult_eq_0_iff mult_sign_intros(1))
[PROOF STATE]
proof (state)
this:
de (x + y) \<le> de x * de y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_mod:
  "(inverse_mod x m * x) mod m = 1"
  if "coprime x m" "m > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse_mod x m * x mod m = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inverse_mod x m * x mod m = 1
[PROOF STEP]
from bezout_coefficients [of x m "inverse_mod x m" "snd (bezout_coefficients x m)"]
[PROOF STATE]
proof (chain)
picking this:
bezout_coefficients x m = (inverse_mod x m, snd (bezout_coefficients x m)) \<Longrightarrow> inverse_mod x m * x + snd (bezout_coefficients x m) * m = gcd x m
[PROOF STEP]
have "inverse_mod x m * x + snd (bezout_coefficients x m) * m = gcd x m"
[PROOF STATE]
proof (prove)
using this:
bezout_coefficients x m = (inverse_mod x m, snd (bezout_coefficients x m)) \<Longrightarrow> inverse_mod x m * x + snd (bezout_coefficients x m) * m = gcd x m

goal (1 subgoal):
 1. inverse_mod x m * x + snd (bezout_coefficients x m) * m = gcd x m
[PROOF STEP]
by (simp add: inverse_mod_def)
[PROOF STATE]
proof (state)
this:
inverse_mod x m * x + snd (bezout_coefficients x m) * m = gcd x m

goal (1 subgoal):
 1. inverse_mod x m * x mod m = 1
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
comm_monoid_mult_class.coprime x m
1 < m
inverse_mod x m * x + snd (bezout_coefficients x m) * m = gcd x m
[PROOF STEP]
have "inverse_mod x m * x + snd (bezout_coefficients x m) * m = 1"
[PROOF STATE]
proof (prove)
using this:
comm_monoid_mult_class.coprime x m
1 < m
inverse_mod x m * x + snd (bezout_coefficients x m) * m = gcd x m

goal (1 subgoal):
 1. inverse_mod x m * x + snd (bezout_coefficients x m) * m = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse_mod x m * x + snd (bezout_coefficients x m) * m = 1

goal (1 subgoal):
 1. inverse_mod x m * x mod m = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inverse_mod x m * x + snd (bezout_coefficients x m) * m = 1
[PROOF STEP]
have "(inverse_mod x m * x + snd (bezout_coefficients x m) * m) mod m = 1 mod m"
[PROOF STATE]
proof (prove)
using this:
inverse_mod x m * x + snd (bezout_coefficients x m) * m = 1

goal (1 subgoal):
 1. (inverse_mod x m * x + snd (bezout_coefficients x m) * m) mod m = 1 mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(inverse_mod x m * x + snd (bezout_coefficients x m) * m) mod m = 1 mod m

goal (1 subgoal):
 1. inverse_mod x m * x mod m = 1
[PROOF STEP]
with \<open>m > 1\<close>
[PROOF STATE]
proof (chain)
picking this:
1 < m
(inverse_mod x m * x + snd (bezout_coefficients x m) * m) mod m = 1 mod m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 < m
(inverse_mod x m * x + snd (bezout_coefficients x m) * m) mod m = 1 mod m

goal (1 subgoal):
 1. inverse_mod x m * x mod m = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse_mod x m * x mod m = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ListUpdate_E: "ListUpdateE f xs = ListUpdate f xs (%e x. e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ListUpdateE f xs = ListUpdate f xs (\<lambda>e x. e)
[PROOF STEP]
apply(induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ListUpdateE f [] = ListUpdate f [] (\<lambda>e x. e)
 2. \<And>a xs. ListUpdateE f xs = ListUpdate f xs (\<lambda>e x. e) \<Longrightarrow> ListUpdateE f (a # xs) = ListUpdate f (a # xs) (\<lambda>e x. e)
[PROOF STEP]
apply(simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. ListUpdateE f xs = ListUpdate f xs (\<lambda>e x. e) \<Longrightarrow> ListUpdateE f (a # xs) = ListUpdate f (a # xs) (\<lambda>e x. e)
[PROOF STEP]
subgoal for a xs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ListUpdateE f xs = ListUpdate f xs (\<lambda>e x. e) \<Longrightarrow> ListUpdateE f (a # xs) = ListUpdate f (a # xs) (\<lambda>e x. e)
[PROOF STEP]
apply(cases a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>ListUpdateE f xs = ListUpdate f xs (\<lambda>e x. e); a = (aa, b)\<rbrakk> \<Longrightarrow> ListUpdateE f (a # xs) = ListUpdate f (a # xs) (\<lambda>e x. e)
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma VPow_mono:
  assumes "A \<subseteq>\<^sub>\<circ> B"
  shows "VPow A \<subseteq>\<^sub>\<circ> VPow B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VPow A \<subseteq>\<^sub>\<circ> VPow B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq>\<^sub>\<circ> B

goal (1 subgoal):
 1. VPow A \<subseteq>\<^sub>\<circ> VPow B
[PROOF STEP]
by simp


[STATEMENT]
lemma lm091:
  assumes "finite G" "a \<in> allAllocations N G" "aa \<in> allAllocations N G"
  shows "real(sum(maxbid a N G)(pseudoAllocation a)) -
            sum(maxbid a N G)(pseudoAllocation aa) =
         real (card G) -
            card (pseudoAllocation aa \<inter> (pseudoAllocation a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
let ?p = pseudoAllocation
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
let ?f = finestpart
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
let ?m = maxbid
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
let ?B = "?m a N G"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
have "?p aa \<subseteq> N \<times> ?f G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pseudoAllocation aa \<subseteq> N \<times> finestpart G
[PROOF STEP]
using assms lm073
[PROOF STATE]
proof (prove)
using this:
finite G
a \<in> allAllocations N G
aa \<in> allAllocations N G
?a \<in> allAllocations ?N ?G \<Longrightarrow> pseudoAllocation ?a \<subseteq> ?N \<times> finestpart ?G

goal (1 subgoal):
 1. pseudoAllocation aa \<subseteq> N \<times> finestpart G
[PROOF STEP]
by (metis (lifting, mono_tags))
[PROOF STATE]
proof (state)
this:
pseudoAllocation aa \<subseteq> N \<times> finestpart G

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pseudoAllocation aa \<subseteq> N \<times> finestpart G
[PROOF STEP]
have "?p aa \<subseteq> ?p a \<union> (N \<times> ?f G)"
[PROOF STATE]
proof (prove)
using this:
pseudoAllocation aa \<subseteq> N \<times> finestpart G

goal (1 subgoal):
 1. pseudoAllocation aa \<subseteq> pseudoAllocation a \<union> N \<times> finestpart G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pseudoAllocation aa \<subseteq> pseudoAllocation a \<union> N \<times> finestpart G

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
pseudoAllocation aa \<subseteq> pseudoAllocation a \<union> N \<times> finestpart G

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
have "finite (?p aa)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (pseudoAllocation aa)
[PROOF STEP]
using assms lm034 lm040
[PROOF STATE]
proof (prove)
using this:
finite G
a \<in> allAllocations N G
aa \<in> allAllocations N G
\<lbrakk>?a \<in> allAllocations ?N ?G; finite ?G\<rbrakk> \<Longrightarrow> card (pseudoAllocation ?a) = card ?G
\<lbrakk>?a \<in> allAllocations ?N ?G; finite ?G\<rbrakk> \<Longrightarrow> finite (pseudoAllocation ?a)

goal (1 subgoal):
 1. finite (pseudoAllocation aa)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (pseudoAllocation aa)

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
pseudoAllocation aa \<subseteq> pseudoAllocation a \<union> N \<times> finestpart G
finite (pseudoAllocation aa)
[PROOF STEP]
have "real(sum ?B (?p a)) - sum ?B (?p aa) =
                   real(card (?p a))-card(?p aa \<inter> (?p a))"
[PROOF STATE]
proof (prove)
using this:
pseudoAllocation aa \<subseteq> pseudoAllocation a \<union> N \<times> finestpart G
finite (pseudoAllocation aa)

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
using differenceSumVsCardinalityReal
[PROOF STATE]
proof (prove)
using this:
pseudoAllocation aa \<subseteq> pseudoAllocation a \<union> N \<times> finestpart G
finite (pseudoAllocation aa)
\<lbrakk>?Z \<subseteq> ?X \<union> ?Y; finite ?Z\<rbrakk> \<Longrightarrow> real (sum (?X <| ?Y) ?X) - real (sum (?X <| ?Y) ?Z) = real (card ?X) - real (card (?Z \<inter> ?X))

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
have "... = real (card G) - card (?p aa \<inter> (?p a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
using assms lm034
[PROOF STATE]
proof (prove)
using this:
finite G
a \<in> allAllocations N G
aa \<in> allAllocations N G
\<lbrakk>?a \<in> allAllocations ?N ?G; finite ?G\<rbrakk> \<Longrightarrow> card (pseudoAllocation ?a) = card ?G

goal (1 subgoal):
 1. real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
by (metis (lifting, mono_tags))
[PROOF STATE]
proof (state)
this:
real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
real (card (pseudoAllocation a)) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))

goal (1 subgoal):
 1. real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation a)) - real (sum (pseudoAllocation a <| (N \<times> finestpart G)) (pseudoAllocation aa)) = real (card G) - real (card (pseudoAllocation aa \<inter> pseudoAllocation a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma loop_semantics_kappa_mu_nu:
  "\<kappa> (\<lambda>x . y * x \<squnion> z) = n(y\<^sup>\<omega>) * L \<squnion> y\<^sup>\<star> * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> (\<lambda>x. y * x \<squnion> z) = n (y\<^sup>\<omega>) * L \<squnion> y\<^sup>\<star> * z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<kappa> (\<lambda>x. y * x \<squnion> z) = n (y\<^sup>\<omega>) * L \<squnion> y\<^sup>\<star> * z
[PROOF STEP]
have "\<kappa> (\<lambda>x . y * x \<squnion> z) = y\<^sup>\<star> * z \<squnion> n(y\<^sup>\<omega> \<squnion> y\<^sup>\<star> * z) * L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> (\<lambda>x. y * x \<squnion> z) = y\<^sup>\<star> * z \<squnion> n (y\<^sup>\<omega> \<squnion> y\<^sup>\<star> * z) * L
[PROOF STEP]
using apx.least_fixpoint_char omega_loop_nu star_loop_mu loop_apx_least_fixpoint
[PROOF STATE]
proof (prove)
using this:
order.is_least_fixpoint (\<sqsubseteq>) ?f ?x = (order.has_least_fixpoint (\<sqsubseteq>) ?f \<and> ?x = \<kappa> ?f)
\<nu> (\<lambda>x. ?y * x \<squnion> ?z) = ?y\<^sup>\<omega> \<squnion> ?y\<^sup>\<star> * ?z
\<mu> (\<lambda>x. ?y * x \<squnion> ?z) = ?y\<^sup>\<star> * ?z
order.is_least_fixpoint (\<sqsubseteq>) (\<lambda>x. ?y * x \<squnion> ?z) (\<mu> (\<lambda>x. ?y * x \<squnion> ?z) \<squnion> n (\<nu> (\<lambda>x. ?y * x \<squnion> ?z)) * L)

goal (1 subgoal):
 1. \<kappa> (\<lambda>x. y * x \<squnion> z) = y\<^sup>\<star> * z \<squnion> n (y\<^sup>\<omega> \<squnion> y\<^sup>\<star> * z) * L
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<kappa> (\<lambda>x. y * x \<squnion> z) = y\<^sup>\<star> * z \<squnion> n (y\<^sup>\<omega> \<squnion> y\<^sup>\<star> * z) * L

goal (1 subgoal):
 1. \<kappa> (\<lambda>x. y * x \<squnion> z) = n (y\<^sup>\<omega>) * L \<squnion> y\<^sup>\<star> * z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<kappa> (\<lambda>x. y * x \<squnion> z) = y\<^sup>\<star> * z \<squnion> n (y\<^sup>\<omega> \<squnion> y\<^sup>\<star> * z) * L

goal (1 subgoal):
 1. \<kappa> (\<lambda>x. y * x \<squnion> z) = n (y\<^sup>\<omega>) * L \<squnion> y\<^sup>\<star> * z
[PROOF STEP]
by (smt n_dist_omega_star sup_assoc mult_right_dist_sup sup_commute le_iff_sup n_L_decreasing)
[PROOF STATE]
proof (state)
this:
\<kappa> (\<lambda>x. y * x \<squnion> z) = n (y\<^sup>\<omega>) * L \<squnion> y\<^sup>\<star> * z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma GreenThm_diamond:
  assumes "analytically_valid (cubeImage (diamond_cube)) (\<lambda>x. F x \<bullet> i) j"
    "analytically_valid (cubeImage (diamond_cube)) (\<lambda>x. F x \<bullet> j) i"
  shows "integral (cubeImage (diamond_cube)) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) =
         one_chain_line_integral F {i, j} (boundary (diamond_cube))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have 0: "\<forall>(k, \<gamma>)\<in>boundary (diamond_cube). valid_path \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(k, \<gamma>)\<in>boundary diamond_cube. valid_path \<gamma>
[PROOF STEP]
using diamond_cube_boundary_valid d_gt_0
[PROOF STATE]
proof (prove)
using this:
(?k, ?\<gamma>) \<in> boundary diamond_cube \<Longrightarrow> valid_path ?\<gamma>
0 < d

goal (1 subgoal):
 1. \<forall>(k, \<gamma>)\<in>boundary diamond_cube. valid_path \<gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>(k, \<gamma>)\<in>boundary diamond_cube. valid_path \<gamma>

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have "\<And>twoCube. twoCube \<in> {diamond_cube} \<Longrightarrow> typeI_twoCube twoCube"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>twoCube. twoCube \<in> {diamond_cube} \<Longrightarrow> typeI_twoCube twoCube
[PROOF STEP]
using assms diamond_cube_is_type_I
[PROOF STATE]
proof (prove)
using this:
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> i) j
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> j) i
typeI_twoCube diamond_cube

goal (1 subgoal):
 1. \<And>twoCube. twoCube \<in> {diamond_cube} \<Longrightarrow> typeI_twoCube twoCube
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?twoCube2 \<in> {diamond_cube} \<Longrightarrow> typeI_twoCube ?twoCube2

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?twoCube2 \<in> {diamond_cube} \<Longrightarrow> typeI_twoCube ?twoCube2

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have "valid_two_chain {diamond_cube}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_two_chain {diamond_cube}
[PROOF STEP]
using assms(1) diamond_cube_valid_two_cube valid_two_chain_def
[PROOF STATE]
proof (prove)
using this:
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> i) j
valid_two_cube diamond_cube
valid_two_chain ?twoChain \<equiv> (\<forall>twoCube\<in>?twoChain. valid_two_cube twoCube) \<and> pairwise (\<lambda>c1 c2. boundary c1 \<inter> boundary c2 = {}) ?twoChain \<and> inj_on cubeImage ?twoChain

goal (1 subgoal):
 1. valid_two_chain {diamond_cube}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
valid_two_chain {diamond_cube}

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
valid_two_chain {diamond_cube}

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have "gen_division (cubeImage (diamond_cube)) (cubeImage ` {diamond_cube})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_division (cubeImage diamond_cube) (cubeImage ` {diamond_cube})
[PROOF STEP]
by (simp add: gen_division_def)
[PROOF STATE]
proof (state)
this:
gen_division (cubeImage diamond_cube) (cubeImage ` {diamond_cube})

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
gen_division (cubeImage diamond_cube) (cubeImage ` {diamond_cube})

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have "(\<forall>twoCube\<in>({rot_diamond_cube}). typeII_twoCube twoCube)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>twoCube\<in>{rot_diamond_cube}. typeII_twoCube twoCube
[PROOF STEP]
using assms rot_diamond_cube_is_type_II
[PROOF STATE]
proof (prove)
using this:
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> i) j
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> j) i
typeII_twoCube rot_diamond_cube

goal (1 subgoal):
 1. \<forall>twoCube\<in>{rot_diamond_cube}. typeII_twoCube twoCube
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>twoCube\<in>{rot_diamond_cube}. typeII_twoCube twoCube

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>twoCube\<in>{rot_diamond_cube}. typeII_twoCube twoCube

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have "valid_two_chain {rot_diamond_cube}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_two_chain {rot_diamond_cube}
[PROOF STEP]
using assms(1) rot_diamond_cube_valid_two_cube valid_two_chain_def
[PROOF STATE]
proof (prove)
using this:
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> i) j
valid_two_cube rot_diamond_cube
valid_two_chain ?twoChain \<equiv> (\<forall>twoCube\<in>?twoChain. valid_two_cube twoCube) \<and> pairwise (\<lambda>c1 c2. boundary c1 \<inter> boundary c2 = {}) ?twoChain \<and> inj_on cubeImage ?twoChain

goal (1 subgoal):
 1. valid_two_chain {rot_diamond_cube}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
valid_two_chain {rot_diamond_cube}

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
valid_two_chain {rot_diamond_cube}

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have "gen_division (cubeImage (diamond_cube)) (cubeImage ` {rot_diamond_cube})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_division (cubeImage diamond_cube) (cubeImage ` {rot_diamond_cube})
[PROOF STEP]
using rot_diamond_gen_div_diamond
[PROOF STATE]
proof (prove)
using this:
gen_division (cubeImage diamond_cube) (cubeImage ` {rot_diamond_cube})

goal (1 subgoal):
 1. gen_division (cubeImage diamond_cube) (cubeImage ` {rot_diamond_cube})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gen_division (cubeImage diamond_cube) (cubeImage ` {rot_diamond_cube})

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
gen_division (cubeImage diamond_cube) (cubeImage ` {rot_diamond_cube})

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have 3: "only_vertical_division (boundary (diamond_cube)) {diamond_cube}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. only_vertical_division (boundary diamond_cube) {diamond_cube}
[PROOF STEP]
using twoChainVertDiv_of_itself[of "{diamond_cube}"] diamond_cube_boundary_valid assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {diamond_cube}; \<forall>(k, \<gamma>)\<in>two_chain_boundary {diamond_cube}. valid_path \<gamma>\<rbrakk> \<Longrightarrow> only_vertical_division (two_chain_boundary {diamond_cube}) {diamond_cube}
(?k, ?\<gamma>) \<in> boundary diamond_cube \<Longrightarrow> valid_path ?\<gamma>
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> i) j
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> j) i

goal (1 subgoal):
 1. only_vertical_division (boundary diamond_cube) {diamond_cube}
[PROOF STEP]
by(auto simp add: two_chain_boundary_def)
[PROOF STATE]
proof (state)
this:
only_vertical_division (boundary diamond_cube) {diamond_cube}

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
only_vertical_division (boundary diamond_cube) {diamond_cube}

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have 4: "\<forall>twoC\<in>{diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>twoC\<in>{diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> i) j
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> j) i

goal (1 subgoal):
 1. \<forall>twoC\<in>{diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>twoC\<in>{diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>twoC\<in>{diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
have 5: "\<forall>twoC\<in>{rot_diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> j) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>twoC\<in>{rot_diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> j) i
[PROOF STEP]
using assms diamond_eq_characterisations_fun rot_img_eq
[PROOF STATE]
proof (prove)
using this:
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> i) j
analytically_valid (cubeImage diamond_cube) (\<lambda>x. F x \<bullet> j) i
diamond_cube = diamond_cube_gen
cubeImage diamond_cube_gen = cubeImage rot_diamond_cube

goal (1 subgoal):
 1. \<forall>twoC\<in>{rot_diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> j) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>twoC\<in>{rot_diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> j) i

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?twoCube2 \<in> {diamond_cube} \<Longrightarrow> typeI_twoCube ?twoCube2
valid_two_chain {diamond_cube}
gen_division (cubeImage diamond_cube) (cubeImage ` {diamond_cube})
\<forall>twoCube\<in>{rot_diamond_cube}. typeII_twoCube twoCube
valid_two_chain {rot_diamond_cube}
gen_division (cubeImage diamond_cube) (cubeImage ` {rot_diamond_cube})
only_vertical_division (boundary diamond_cube) {diamond_cube}
\<forall>twoC\<in>{diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j
\<forall>twoC\<in>{rot_diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> j) i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?twoCube2 \<in> {diamond_cube} \<Longrightarrow> typeI_twoCube ?twoCube2
valid_two_chain {diamond_cube}
gen_division (cubeImage diamond_cube) (cubeImage ` {diamond_cube})
\<forall>twoCube\<in>{rot_diamond_cube}. typeII_twoCube twoCube
valid_two_chain {rot_diamond_cube}
gen_division (cubeImage diamond_cube) (cubeImage ` {rot_diamond_cube})
only_vertical_division (boundary diamond_cube) {diamond_cube}
\<forall>twoC\<in>{diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j
\<forall>twoC\<in>{rot_diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> j) i

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
using green_typeI_typeII_chain.GreenThm_typeI_typeII_divisible_region_finite_holes[of "(cubeImage (diamond_cube))" i j F "{diamond_cube}" "{rot_diamond_cube}", OF _ 0 3 diamond_cube_is_only_horizontal_div_of_rot _]
      R2_axioms
[PROOF STATE]
proof (prove)
using this:
?twoCube2 \<in> {diamond_cube} \<Longrightarrow> typeI_twoCube ?twoCube2
valid_two_chain {diamond_cube}
gen_division (cubeImage diamond_cube) (cubeImage ` {diamond_cube})
\<forall>twoCube\<in>{rot_diamond_cube}. typeII_twoCube twoCube
valid_two_chain {rot_diamond_cube}
gen_division (cubeImage diamond_cube) (cubeImage ` {rot_diamond_cube})
only_vertical_division (boundary diamond_cube) {diamond_cube}
\<forall>twoC\<in>{diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> i) j
\<forall>twoC\<in>{rot_diamond_cube}. analytically_valid (cubeImage twoC) (\<lambda>x. F x \<bullet> j) i
\<lbrakk>green_typeI_typeII_chain (cubeImage diamond_cube) i j F {diamond_cube} {rot_diamond_cube}; cubeImage diamond_cube = cubeImage diamond_cube\<rbrakk> \<Longrightarrow> integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
R2 i j

goal (1 subgoal):
 1. integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)
[PROOF STEP]
by(auto simp add: green_typeI_typeII_chain_def green_typeI_chain_def green_typeII_chain_def green_typeI_chain_axioms_def green_typeII_chain_axioms_def)
[PROOF STATE]
proof (state)
this:
integral (cubeImage diamond_cube) (\<lambda>x. partial_vector_derivative (\<lambda>x. F x \<bullet> j) i x - partial_vector_derivative (\<lambda>x. F x \<bullet> i) j x) = one_chain_line_integral F {i, j} (boundary diamond_cube)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fact_numeral: "fact (numeral k) = numeral k * fact (pred_numeral k)"
  \<comment> \<open>Evaluation for specific numerals\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (numeral k) = numeral k * fact (pred_numeral k)
[PROOF STEP]
by (metis fact_Suc numeral_eq_Suc of_nat_numeral)


[STATEMENT]
lemma RDirProd_iso3:
  "(\<lambda>((x, y), z). (x, (y, z))) \<in> ring_iso (RDirProd (RDirProd R S) T) (RDirProd R (RDirProd S T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>((x, y), z). (x, y, z)) \<in> ring_iso (RDirProd (RDirProd R S) T) (RDirProd R (RDirProd S T))
[PROOF STEP]
unfolding ring_iso_def ring_hom_def bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>((x, y), z). (x, y, z)) \<in> {h \<in> {h \<in> carrier (RDirProd (RDirProd R S) T) \<rightarrow> carrier (RDirProd R (RDirProd S T)). (\<forall>x y. x \<in> carrier (RDirProd (RDirProd R S) T) \<and> y \<in> carrier (RDirProd (RDirProd R S) T) \<longrightarrow> h (x \<otimes>\<^bsub>RDirProd (RDirProd R S) T\<^esub> y) = h x \<otimes>\<^bsub>RDirProd R (RDirProd S T)\<^esub> h y \<and> h (x \<oplus>\<^bsub>RDirProd (RDirProd R S) T\<^esub> y) = h x \<oplus>\<^bsub>RDirProd R (RDirProd S T)\<^esub> h y) \<and> h \<one>\<^bsub>RDirProd (RDirProd R S) T\<^esub> = \<one>\<^bsub>RDirProd R (RDirProd S T)\<^esub>}. (\<forall>x\<in>carrier (RDirProd (RDirProd R S) T). \<forall>y\<in>carrier (RDirProd (RDirProd R S) T). h x = h y \<longrightarrow> x = y) \<and> h ` carrier (RDirProd (RDirProd R S) T) = carrier (RDirProd R (RDirProd S T))}
[PROOF STEP]
by (auto simp add: image_iff RDirProd_def DirProd_def monoid.defs)


[STATEMENT]
lemma add_mult_one_time_pad:
  assumes coprime: "coprime x q"
  shows "map_spmf (\<lambda> b. (y + x*b) mod q) (sample_uniform q) = (sample_uniform q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf (\<lambda>b. (y + x * b) mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
using inj_on_add_mult surj_on_add_mult one_time_pad coprime
[PROOF STATE]
proof (prove)
using this:
coprime ?x ?q \<Longrightarrow> inj_on (\<lambda>b. (?y + ?x * b) mod ?q) {..<?q}
\<lbrakk>coprime ?x ?q; inj_on (\<lambda>b. (?y + ?x * b) mod ?q) {..<?q}\<rbrakk> \<Longrightarrow> (\<lambda>b. (?y + ?x * b) mod ?q) ` {..<?q} = {..<?q}
\<lbrakk>inj_on ?f {..<?q}; ?f ` {..<?q} = {..<?q}\<rbrakk> \<Longrightarrow> map_spmf ?f (sample_uniform ?q) = sample_uniform ?q
coprime x q

goal (1 subgoal):
 1. map_spmf (\<lambda>b. (y + x * b) mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
by simp


[STATEMENT]
lemma not_empty_card_gr0_conv: "finite A \<Longrightarrow> (A \<noteq> {}) = (0 < card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> (A \<noteq> {}) = (0 < card A)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma integral_differentiable:
  fixes f :: "real \<Rightarrow> 'a::banach"
  assumes "continuous_on {a..b} f"
    and "x \<in> {a..b}"
  shows "(\<lambda>u. integral {a..u} f) differentiable at x within {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>u. integral {a..u} f) differentiable at x within {a..b}
[PROOF STEP]
using integral_has_vector_derivative[OF assms]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>u. integral {a..u} f) has_vector_derivative f x) (at x within {a..b})

goal (1 subgoal):
 1. (\<lambda>u. integral {a..u} f) differentiable at x within {a..b}
[PROOF STEP]
by blast


[STATEMENT]
lemma "A - B \<subseteq> C \<longleftrightarrow> (\<forall>a\<in>A. a \<in> C \<or> a \<in> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A - B \<subseteq> C) = (\<forall>a\<in>A. a \<in> C \<or> a \<in> B)
[PROOF STEP]
by blast


[STATEMENT]
theorem card_partitions:
  "card {p. p partitions n} = (\<Sum>k\<le>n. Partition n k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
have seteq: "{p. p partitions n} = \<Union>((\<lambda>k. {p. p partitions n \<and> (\<Sum>i\<le>n. p i) = k}) ` {..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. p partitions n} = (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k})
[PROOF STEP]
by (auto intro: partitions_parts_bounded)
[PROOF STATE]
proof (state)
this:
{p. p partitions n} = (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k})

goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
have finite: "\<And>k. finite {p. p partitions n \<and> sum p {..n} = k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. finite {p. p partitions n \<and> sum p {..n} = k}
[PROOF STEP]
by (simp add: finite_partitions)
[PROOF STATE]
proof (state)
this:
finite {p. p partitions n \<and> sum p {..n} = ?k}

goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
have "card {p. p partitions n} = card (\<Union>((\<lambda>k. {p. p partitions n \<and> (\<Sum>i\<le>n. p i) = k}) ` {..n}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {p. p partitions n} = card (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k})
[PROOF STEP]
using finite
[PROOF STATE]
proof (prove)
using this:
finite {p. p partitions n \<and> sum p {..n} = ?k}

goal (1 subgoal):
 1. card {p. p partitions n} = card (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k})
[PROOF STEP]
by (simp add: seteq)
[PROOF STATE]
proof (state)
this:
card {p. p partitions n} = card (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k})

goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {p. p partitions n} = card (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k})

goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
have "... = (\<Sum>x\<le>n. card {p. p partitions n \<and> sum p {..n} = x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k}) = (\<Sum>x\<le>n. card {p. p partitions n \<and> sum p {..n} = x})
[PROOF STEP]
using finite
[PROOF STATE]
proof (prove)
using this:
finite {p. p partitions n \<and> sum p {..n} = ?k}

goal (1 subgoal):
 1. card (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k}) = (\<Sum>x\<le>n. card {p. p partitions n \<and> sum p {..n} = x})
[PROOF STEP]
by (subst card_UN_disjoint) auto
[PROOF STATE]
proof (state)
this:
card (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k}) = (\<Sum>x\<le>n. card {p. p partitions n \<and> sum p {..n} = x})

goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (\<Union>k\<le>n. {p. p partitions n \<and> sum p {..n} = k}) = (\<Sum>x\<le>n. card {p. p partitions n \<and> sum p {..n} = x})

goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
have "... = (\<Sum>k\<le>n. Partition n k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<le>n. card {p. p partitions n \<and> sum p {..n} = x}) = sum (Partition n) {..n}
[PROOF STEP]
by (simp add: card_partitions_k_parts)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<le>n. card {p. p partitions n \<and> sum p {..n} = x}) = sum (Partition n) {..n}

goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {p. p partitions n} = sum (Partition n) {..n}

goal (1 subgoal):
 1. card {p. p partitions n} = sum (Partition n) {..n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {p. p partitions n} = sum (Partition n) {..n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem c_sum_as_b_least: "c_sum = (\<lambda> u. b_least2 (\<lambda> u z. (sgn1 (sf(z+1) - u))) u (Suc u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_sum = (\<lambda>u. b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u))
[PROOF STEP]
proof (rule ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
fix u
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
show "c_sum u = b_least2 (\<lambda> u z. (sgn1 (sf(z+1) - u))) u (Suc u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
have lm_1: "(\<lambda> x y. (sgn1 (sf(y+1) - x) \<noteq> 0)) = (\<lambda> x y. (x < sf(y+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. sgn1 (sf (y + 1) - x) \<noteq> 0) = (\<lambda>x y. x < sf (y + 1))
[PROOF STEP]
proof (rule ext, rule ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (sgn1 (sf (y + 1) - x) \<noteq> 0) = (x < sf (y + 1))
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (sgn1 (sf (y + 1) - x) \<noteq> 0) = (x < sf (y + 1))
[PROOF STEP]
show "(sgn1 (sf(y+1) - x) \<noteq> 0) = (x < sf(y+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sgn1 (sf (y + 1) - x) \<noteq> 0) = (x < sf (y + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (sgn1 (sf (y + 1) - x) \<noteq> 0) = (x < sf (y + 1))
[PROOF STEP]
have "(sgn1 (sf(y+1) - x) \<noteq> 0) = (sf(y+1) - x > 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sgn1 (sf (y + 1) - x) \<noteq> 0) = (0 < sf (y + 1) - x)
[PROOF STEP]
by (rule sgn1_nz_eq_arg_pos)
[PROOF STATE]
proof (state)
this:
(sgn1 (sf (y + 1) - x) \<noteq> 0) = (0 < sf (y + 1) - x)

goal (1 subgoal):
 1. (sgn1 (sf (y + 1) - x) \<noteq> 0) = (x < sf (y + 1))
[PROOF STEP]
thus "(sgn1 (sf(y+1) - x) \<noteq> 0) = (x < sf(y+1))"
[PROOF STATE]
proof (prove)
using this:
(sgn1 (sf (y + 1) - x) \<noteq> 0) = (0 < sf (y + 1) - x)

goal (1 subgoal):
 1. (sgn1 (sf (y + 1) - x) \<noteq> 0) = (x < sf (y + 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(sgn1 (sf (y + 1) - x) \<noteq> 0) = (x < sf (y + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(sgn1 (sf (y + 1) - x) \<noteq> 0) = (x < sf (y + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. sgn1 (sf (y + 1) - x) \<noteq> 0) = (\<lambda>x y. x < sf (y + 1))

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
(* lm_1 *)
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. sgn1 (sf (y + 1) - x) \<noteq> 0) = (\<lambda>x y. x < sf (y + 1))

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
let ?f = "\<lambda> u z. (sgn1 (sf(z+1) - u))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
have S1: "?f u u \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
have S1_1: "u+1 \<le> sf(u+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u + 1 \<le> sf (u + 1)
[PROOF STEP]
by (rule arg_le_sf)
[PROOF STATE]
proof (state)
this:
u + 1 \<le> sf (u + 1)

goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
have S1_2: "u < u+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u < u + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u < u + 1

goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
from S1_1 S1_2
[PROOF STATE]
proof (chain)
picking this:
u + 1 \<le> sf (u + 1)
u < u + 1
[PROOF STEP]
have S1_3: "u < sf(u+1)"
[PROOF STATE]
proof (prove)
using this:
u + 1 \<le> sf (u + 1)
u < u + 1

goal (1 subgoal):
 1. u < sf (u + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u < sf (u + 1)

goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
from S1_3
[PROOF STATE]
proof (chain)
picking this:
u < sf (u + 1)
[PROOF STEP]
have S1_4: "sf(u+1) - u > 0"
[PROOF STATE]
proof (prove)
using this:
u < sf (u + 1)

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

goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
from S1_4
[PROOF STATE]
proof (chain)
picking this:
0 < sf (u + 1) - u
[PROOF STEP]
have S1_5: "sgn1 (sf(u+1)-u) = 1"
[PROOF STATE]
proof (prove)
using this:
0 < sf (u + 1) - u

goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sgn1 (sf (u + 1) - u) = 1

goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
from S1_5
[PROOF STATE]
proof (chain)
picking this:
sgn1 (sf (u + 1) - u) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sgn1 (sf (u + 1) - u) = 1

goal (1 subgoal):
 1. sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sgn1 (sf (u + 1) - u) \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sgn1 (sf (u + 1) - u) \<noteq> 0

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
have S3: "u < Suc u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u < Suc u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u < Suc u

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
from S3 S1
[PROOF STATE]
proof (chain)
picking this:
u < Suc u
sgn1 (sf (u + 1) - u) \<noteq> 0
[PROOF STEP]
have S4: "b_least2 ?f u (Suc u) = (Least (%z. (?f u z) \<noteq> 0))"
[PROOF STATE]
proof (prove)
using this:
u < Suc u
sgn1 (sf (u + 1) - u) \<noteq> 0

goal (1 subgoal):
 1. b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u) = (LEAST z. sgn1 (sf (z + 1) - u) \<noteq> 0)
[PROOF STEP]
by (rule b_least2_less_impl_eq2)
[PROOF STATE]
proof (state)
this:
b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u) = (LEAST z. sgn1 (sf (z + 1) - u) \<noteq> 0)

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
let ?P = "\<lambda> u z. ?f u z \<noteq> 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
let ?Q = "\<lambda> u z. u < sf(z+1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
from lm_1
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x y. sgn1 (sf (y + 1) - x) \<noteq> 0) = (\<lambda>x y. x < sf (y + 1))
[PROOF STEP]
have S6: "?P = ?Q"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x y. sgn1 (sf (y + 1) - x) \<noteq> 0) = (\<lambda>x y. x < sf (y + 1))

goal (1 subgoal):
 1. (\<lambda>u z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (\<lambda>u z. u < sf (z + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>u z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (\<lambda>u z. u < sf (z + 1))

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
from S6
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>u z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (\<lambda>u z. u < sf (z + 1))
[PROOF STEP]
have S7: "(%z. ?P u z) = (%z. ?Q u z)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>u z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (\<lambda>u z. u < sf (z + 1))

goal (1 subgoal):
 1. (\<lambda>z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (\<lambda>z. u < sf (z + 1))
[PROOF STEP]
by (rule fun_cong)
[PROOF STATE]
proof (state)
this:
(\<lambda>z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (\<lambda>z. u < sf (z + 1))

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
from S7
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (\<lambda>z. u < sf (z + 1))
[PROOF STEP]
have S8: "(Least (%z. ?P u z)) = (Least (%z. ?Q u z))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (\<lambda>z. u < sf (z + 1))

goal (1 subgoal):
 1. (LEAST z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (LEAST z. u < sf (z + 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(LEAST z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (LEAST z. u < sf (z + 1))

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
from S4 S8
[PROOF STATE]
proof (chain)
picking this:
b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u) = (LEAST z. sgn1 (sf (z + 1) - u) \<noteq> 0)
(LEAST z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (LEAST z. u < sf (z + 1))
[PROOF STEP]
have S9: "b_least2 ?f u (Suc u) = (Least (%z. u < sf(z+1)))"
[PROOF STATE]
proof (prove)
using this:
b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u) = (LEAST z. sgn1 (sf (z + 1) - u) \<noteq> 0)
(LEAST z. sgn1 (sf (z + 1) - u) \<noteq> 0) = (LEAST z. u < sf (z + 1))

goal (1 subgoal):
 1. b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u) = (LEAST z. u < sf (z + 1))
[PROOF STEP]
by (rule trans)
[PROOF STATE]
proof (state)
this:
b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u) = (LEAST z. u < sf (z + 1))

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u) = (LEAST z. u < sf (z + 1))

goal (1 subgoal):
 1. c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)
[PROOF STEP]
by (simp add: c_sum_def)
[PROOF STATE]
proof (state)
this:
c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c_sum u = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u)) u (Suc u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma top_unique:
  "x \<squnion> -x = y \<squnion> -y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> - x = y \<squnion> - y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<squnion> - x = y \<squnion> - y
[PROOF STEP]
have "x \<squnion> -x = y \<squnion> -(--y \<squnion> -x) \<squnion> -(--y \<squnion> --x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> - x = y \<squnion> - (- - y \<squnion> - x) \<squnion> - (- - y \<squnion> - - x)
[PROOF STEP]
by (smt associative commutative huntington)
[PROOF STATE]
proof (state)
this:
x \<squnion> - x = y \<squnion> - (- - y \<squnion> - x) \<squnion> - (- - y \<squnion> - - x)

goal (1 subgoal):
 1. x \<squnion> - x = y \<squnion> - y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<squnion> - x = y \<squnion> - (- - y \<squnion> - x) \<squnion> - (- - y \<squnion> - - x)

goal (1 subgoal):
 1. x \<squnion> - x = y \<squnion> - y
[PROOF STEP]
by (metis associative huntington)
[PROOF STATE]
proof (state)
this:
x \<squnion> - x = y \<squnion> - y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lookup_insert: "lookup (insert (k, v) xs) k' = (if k = k' then v else lookup xs k')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (local.insert (k, v) xs) k' = (if k = k' then v else lookup xs k')
[PROOF STEP]
by (simp add: lookup_def lookup_raw_update_by_raw oalist_inv_list_of_oalist split del: if_split cong: if_cong)


[STATEMENT]
lemma continuous_attains_inf:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
  shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f \<Longrightarrow> (\<exists>x\<in>s. \<forall>y\<in>s. f x \<le> f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>compact s; s \<noteq> {}; continuous_on s f\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. \<forall>y\<in>s. f x \<le> f y
[PROOF STEP]
using compact_attains_inf[of "f ` s"] compact_continuous_image[of s f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>compact (f ` s); f ` s \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>sa\<in>f ` s. \<forall>t\<in>f ` s. sa \<le> t
\<lbrakk>continuous_on s f; compact s\<rbrakk> \<Longrightarrow> compact (f ` s)

goal (1 subgoal):
 1. \<lbrakk>compact s; s \<noteq> {}; continuous_on s f\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. \<forall>y\<in>s. f x \<le> f y
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_lr_inverse_one_minus_fps_X:
  fixes   ones :: "'a :: ring_1 fps"
  defines "ones \<equiv> Abs_fps (\<lambda>n. 1)"
  shows "fps_left_inverse (1 - fps_X) 1 = ones"
  and   "fps_right_inverse (1 - fps_X) 1 = ones"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (1 - fps_X) (1::'a) = ones &&& fps_right_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fps_left_inverse (1 - fps_X) (1::'a) = ones
 2. fps_right_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
have "fps_left_inverse ones 1 = 1 - fps_X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
using fps_lr_inverse_gp_ring1'(1)
[PROOF STATE]
proof (prove)
using this:
fps_left_inverse (Abs_fps (\<lambda>n. 1::?'a)) (1::?'a) = 1 - fps_X

goal (1 subgoal):
 1. fps_left_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
by (simp add: ones_def)
[PROOF STATE]
proof (state)
this:
fps_left_inverse ones (1::'a) = 1 - fps_X

goal (2 subgoals):
 1. fps_left_inverse (1 - fps_X) (1::'a) = ones
 2. fps_right_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
thus "fps_left_inverse (1 - fps_X) 1 = ones"
[PROOF STATE]
proof (prove)
using this:
fps_left_inverse ones (1::'a) = 1 - fps_X

goal (1 subgoal):
 1. fps_left_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
using fps_left_inverse_idempotent_ring1[of 1 ones 1]
[PROOF STATE]
proof (prove)
using this:
fps_left_inverse ones (1::'a) = 1 - fps_X
\<lbrakk>(1::'a) * ones $ 0 = (1::'a); (1::'a) * (1::'a) = (1::'a)\<rbrakk> \<Longrightarrow> fps_left_inverse (fps_left_inverse ones (1::'a)) (1::'a) = ones

goal (1 subgoal):
 1. fps_left_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
by (simp add: ones_def)
[PROOF STATE]
proof (state)
this:
fps_left_inverse (1 - fps_X) (1::'a) = ones

goal (1 subgoal):
 1. fps_right_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
have "fps_right_inverse ones 1 = 1 - fps_X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_right_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
using fps_lr_inverse_gp_ring1'(2)
[PROOF STATE]
proof (prove)
using this:
fps_right_inverse (Abs_fps (\<lambda>n. 1::?'a)) (1::?'a) = 1 - fps_X

goal (1 subgoal):
 1. fps_right_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
by (simp add: ones_def)
[PROOF STATE]
proof (state)
this:
fps_right_inverse ones (1::'a) = 1 - fps_X

goal (1 subgoal):
 1. fps_right_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
thus "fps_right_inverse (1 - fps_X) 1 = ones"
[PROOF STATE]
proof (prove)
using this:
fps_right_inverse ones (1::'a) = 1 - fps_X

goal (1 subgoal):
 1. fps_right_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
using fps_right_inverse_idempotent_ring1[of ones 1 1]
[PROOF STATE]
proof (prove)
using this:
fps_right_inverse ones (1::'a) = 1 - fps_X
\<lbrakk>ones $ 0 * (1::'a) = (1::'a); (1::'a) * (1::'a) = (1::'a)\<rbrakk> \<Longrightarrow> fps_right_inverse (fps_right_inverse ones (1::'a)) (1::'a) = ones

goal (1 subgoal):
 1. fps_right_inverse (1 - fps_X) (1::'a) = ones
[PROOF STEP]
by (simp add: ones_def)
[PROOF STATE]
proof (state)
this:
fps_right_inverse (1 - fps_X) (1::'a) = ones

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma IntegralE:
  assumes "Integral (a, b) f k" and "0 < e"
  obtains \<delta> where "gauge {a..b} \<delta>" and "\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<delta>. \<lbrakk>gauge {a..b} \<delta>; \<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Integral (a, b) f k
0 < e

goal (1 subgoal):
 1. (\<And>\<delta>. \<lbrakk>gauge {a..b} \<delta>; \<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Integral_def
[PROOF STATE]
proof (prove)
using this:
(case (a, b) of (a, b) \<Rightarrow> \<lambda>f k. \<forall>e>0. \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e)) f k
0 < e

goal (1 subgoal):
 1. (\<And>\<delta>. \<lbrakk>gauge {a..b} \<delta>; \<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma sumhr_hrabs: "\<And>m n. \<bar>sumhr (m, n, f)\<bar> \<le> sumhr (m, n, \<lambda>i. \<bar>f i\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. \<bar>sumhr (m, n, f)\<bar> \<le> sumhr (m, n, \<lambda>i. \<bar>f i\<bar>)
[PROOF STEP]
unfolding sumhr_app
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. \<bar>(*f2* (\<lambda>m n. sum f {m..<n})) m n\<bar> \<le> (*f2* (\<lambda>m n. \<Sum>i = m..<n. \<bar>f i\<bar>)) m n
[PROOF STEP]
by transfer (rule sum_abs)


[STATEMENT]
lemma set_spmf_sample_set_excl [simp]:
  assumes "finite (Q - P)"
  shows "set_spmf (sample_set_excl Q P) = (Q - P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_spmf (sample_set_excl Q P) = Q - P
[PROOF STEP]
unfolding  sample_set_excl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_spmf (spmf_of_set (Q - P)) = Q - P
[PROOF STEP]
by (metis set_spmf_of_set assms)+


[STATEMENT]
lemma eq_set_preserves_inter:
  fixes eq set
  assumes "\<And>r s. eq r s \<Longrightarrow> set r = set s" and "Ss \<noteq> {}"
  shows "(\<Inter>As\<in>Ss. {(x, x'). eq x x'} `` {x. set x \<subseteq> As}) \<subseteq> {(x, x'). eq x x'} `` {x. set x \<subseteq> \<Inter> Ss}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>As\<in>Ss. {(x, x'). eq x x'} `` {x. set x \<subseteq> As}) \<subseteq> {(x, x'). eq x x'} `` {x. set x \<subseteq> \<Inter> Ss}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
eq ?r ?s \<Longrightarrow> set ?r = set ?s
Ss \<noteq> {}

goal (1 subgoal):
 1. (\<Inter>As\<in>Ss. {(x, x'). eq x x'} `` {x. set x \<subseteq> As}) \<subseteq> {(x, x'). eq x x'} `` {x. set x \<subseteq> \<Inter> Ss}
[PROOF STEP]
by (auto simp: subset_eq) metis


[STATEMENT]
lemma octo_of_real_add [simp]: "octo_of_real (x + y) = octo_of_real x + octo_of_real y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. octo_of_real (x + y) = octo_of_real x + octo_of_real y
[PROOF STEP]
by (simp add: octo_of_real_def scaleR_left_distrib)


[STATEMENT]
lemma ordinal_of_hmset_0[simp]: "ordinal_of_hmset 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_of_hmset 0 = 0
[PROOF STEP]
unfolding zero_hmultiset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_of_hmset (HMSet {#}) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma antisym_subset:
  "\<lbrakk> antisymp r; \<And>a a'. s a a' \<Longrightarrow> r a a' \<rbrakk> \<Longrightarrow> antisymp s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>antisymp r; \<And>a a'. s a a' \<Longrightarrow> r a a'\<rbrakk> \<Longrightarrow> antisymp s
[PROOF STEP]
by (blast intro: antisymp_less_eq [of s r])


[STATEMENT]
lemma lfp_arg: "(\<lambda>t. lfp (F t)) = lfp (\<lambda>x t. F t (x t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. lfp (F t)) = lfp (\<lambda>x t. F t (x t))
[PROOF STEP]
apply (auto simp: lfp_def le_fun_def fun_eq_iff intro!: Inf_eqI Inf_greatest)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x i. F x i \<le> i \<Longrightarrow> (\<Sqinter>f\<in>{u. \<forall>x. F x (u x) \<le> u x}. f x) \<le> i
[PROOF STEP]
subgoal for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F x y \<le> y \<Longrightarrow> (\<Sqinter>f\<in>{u. \<forall>x. F x (u x) \<le> u x}. f x) \<le> y
[PROOF STEP]
by (rule INF_lower2[of "top(x := y)"]) auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fst_Gauss_Jordan_det_P_not_0:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
shows "fst (Gauss_Jordan_det_P A) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_det_P A) \<noteq> (0::'a)
[PROOF STEP]
unfolding det_fst_Gauss_Jordan_PA_eq_fst_Gauss_Jordan_det_P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (fst (Gauss_Jordan_PA A)) \<noteq> (0::'a)
[PROOF STEP]
by (metis (mono_tags) det_I det_mul invertible_fst_Gauss_Jordan_PA matrix_inv_right mult_zero_left zero_neq_one)


[STATEMENT]
lemma length_odd_filter: "length [f i .  i <- (filter odd [0..<l])] = l div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map f (filter odd [0..<l])) = l div 2
[PROOF STEP]
by(induction l) auto


[STATEMENT]
lemma "0 \<le> (x::real) \<and> 0 \<le> y \<and> x * y = 1 \<longrightarrow> x * y * (x + y) \<le> x\<^sup>2 + y\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<and> 0 \<le> y \<and> x * y = 1 \<longrightarrow> x * y * (x + y) \<le> x\<^sup>2 + y\<^sup>2
[PROOF STEP]
by sos


[STATEMENT]
lemma x_is_2n_arith[simp]:
  "\<lbrakk>x < Suc (Suc (2 * n)); Suc x mod 2 = Suc 0; \<not> x < 2 * n\<rbrakk>
 \<Longrightarrow> x = 2*n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < Suc (Suc (2 * n)); Suc x mod 2 = Suc 0; \<not> x < 2 * n\<rbrakk> \<Longrightarrow> x = 2 * n
[PROOF STEP]
by arith


[STATEMENT]
lemma Delta_def: "\<Delta> = 1/\<alpha> - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Delta> = 1 / \<alpha> - 1
[PROOF STEP]
unfolding \<alpha>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Delta> = 1 / (1 / (\<Delta> + 1)) - 1
[PROOF STEP]
by auto


[STATEMENT]
lemma fw_int_aux_Suc_b:
  assumes "\<forall> i \<le> n. \<forall> j \<le> n. (fw M n) a b n i j \<noteq> \<infinity> \<longrightarrow> get_const ((fw M n) a b n i j) \<in> \<int>"
          "a \<le> n" "Suc b \<le> n" "c \<le> n" "i \<le> n" "j \<le> n" "((fw M n) a (Suc b) c) i j \<noteq> \<infinity>"
  shows "get_const (((fw M n) a (Suc b) c) i j) \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. get_const (fw M n a (Suc b) c i j) \<in> \<int>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. \<forall>j\<le>n. fw M n a b n i j \<noteq> \<infinity> \<longrightarrow> get_const (fw M n a b n i j) \<in> \<int>
a \<le> n
Suc b \<le> n
c \<le> n
i \<le> n
j \<le> n
fw M n a (Suc b) c i j \<noteq> \<infinity>

goal (1 subgoal):
 1. get_const (fw M n a (Suc b) c i j) \<in> \<int>
[PROOF STEP]
by (induction c arbitrary: i j) (auto intro: int_fw_upd[of n])


[STATEMENT]
lemma mono_Sup:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
  shows "mono f \<Longrightarrow> Sup (f`S) \<le> f (Sup S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> Sup (f ` S) \<le> f (Sup S)
[PROOF STEP]
apply (rule Sup_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>mono f; x \<in> f ` S\<rbrakk> \<Longrightarrow> x \<le> f (Sup S)
[PROOF STEP]
apply (erule imageE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>mono f; x = f xa; xa \<in> S\<rbrakk> \<Longrightarrow> x \<le> f (Sup S)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>mono f; x = f xa; xa \<in> S\<rbrakk> \<Longrightarrow> f xa \<le> f (Sup S)
[PROOF STEP]
apply (erule monoD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x = f xa; xa \<in> S\<rbrakk> \<Longrightarrow> xa \<le> Sup S
[PROOF STEP]
apply (erule Sup_upper)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nn_integral_pmf_eq_1: "(\<integral>\<^sup>+ x. ennreal (pmf p x) \<partial>count_space UNIV) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (pmf p x) \<partial>count_space UNIV = 1
[PROOF STEP]
by transfer simp_all


[STATEMENT]
lemma states_Times [simp]: "states (Times fsm1 fsm2) = states fsm1 * states fsm2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. states (Times fsm1 fsm2) = states fsm1 * states fsm2
[PROOF STEP]
by (simp add: Times_def)


[STATEMENT]
lemma nth_prime_Suc: "nth_prime (Suc n) = smallest_prime_beyond (Suc (nth_prime n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_prime (Suc n) = smallest_prime_beyond (Suc (nth_prime n))
[PROOF STEP]
by (rule nth_prime_eqI'') (simp_all add: \<pi>_smallest_prime_beyond)


[STATEMENT]
lemma gcd_neg_numeral_1 [simp]: "gcd (- numeral n) a = gcd (numeral n) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (- numeral n) a = gcd (numeral n) a
[PROOF STEP]
by (fact gcd_neg1)


[STATEMENT]
lemma less_two_pow_divI:
  "\<lbrakk> (x :: nat) < 2 ^ (n - m); m \<le> n \<rbrakk> \<Longrightarrow> x < 2 ^ n div 2 ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < 2 ^ (n - m); m \<le> n\<rbrakk> \<Longrightarrow> x < 2 ^ n div 2 ^ m
[PROOF STEP]
by (simp add: power_sub)