[STATEMENT]
lemma (in ring) set_add_zero:
  assumes "A \<subseteq> carrier R"
  shows "{\<zero>} <+>\<^bsub>R\<^esub> A = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<zero>} <+> A = A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {\<zero>} <+> A = A
[PROOF STEP]
have "{\<zero>} <+>\<^bsub>R\<^esub> A = (\<Union>x\<in>A. {\<zero> \<oplus> x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<zero>} <+> A = (\<Union>x\<in>A. {\<zero> \<oplus> x})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier R

goal (1 subgoal):
 1. {\<zero>} <+> A = (\<Union>x\<in>A. {\<zero> \<oplus> x})
[PROOF STEP]
unfolding set_add_def set_mult_def
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier R

goal (1 subgoal):
 1. (\<Union>h\<in>{\<zero>}. \<Union>k\<in>A. {h \<otimes>\<^bsub>add_monoid R\<^esub> k}) = (\<Union>x\<in>A. {\<zero> \<oplus> x})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{\<zero>} <+> A = (\<Union>x\<in>A. {\<zero> \<oplus> x})

goal (1 subgoal):
 1. {\<zero>} <+> A = A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{\<zero>} <+> A = (\<Union>x\<in>A. {\<zero> \<oplus> x})

goal (1 subgoal):
 1. {\<zero>} <+> A = A
[PROOF STEP]
have "... = (\<Union>x\<in>A. {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>A. {\<zero> \<oplus> x}) = (\<Union>x\<in>A. {x})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier R

goal (1 subgoal):
 1. (\<Union>x\<in>A. {\<zero> \<oplus> x}) = (\<Union>x\<in>A. {x})
[PROOF STEP]
by (intro arg_cong[where f="Union"] image_cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>A. {\<zero> \<oplus> x}) = (\<Union>x\<in>A. {x})

goal (1 subgoal):
 1. {\<zero>} <+> A = A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>A. {\<zero> \<oplus> x}) = (\<Union>x\<in>A. {x})

goal (1 subgoal):
 1. {\<zero>} <+> A = A
[PROOF STEP]
have "... = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>A. {x}) = A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>A. {x}) = A

goal (1 subgoal):
 1. {\<zero>} <+> A = A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{\<zero>} <+> A = A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{\<zero>} <+> A = A

goal (1 subgoal):
 1. {\<zero>} <+> A = A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{\<zero>} <+> A = A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_mset_subset_singletonD:
  assumes "set_mset A \<subseteq> {x}"
  shows   "A = replicate_mset (size A) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = replicate_mset (size A) x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set_mset A \<subseteq> {x}

goal (1 subgoal):
 1. A = replicate_mset (size A) x
[PROOF STEP]
by (induction A) auto


[STATEMENT]
lemma (in comm_monoid_add) foldl_map_filter:
  "foldl (+) 0 (map f (filter P xs)) +
     foldl (+) 0 (map f (filter (not P) xs))
   = foldl (+) 0 (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs)
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. foldl (+) (0::'a) (map f (filter P [])) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) [])) = foldl (+) (0::'a) (map f [])
 2. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. foldl (+) (0::'a) (map f (filter P [])) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) [])) = foldl (+) (0::'a) (map f [])
 2. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (+) (0::'a) (map f (filter P [])) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) [])) = foldl (+) (0::'a) (map f [])
[PROOF STEP]
by clarsimp
[PROOF STATE]
proof (state)
this:
foldl (+) (0::'a) (map f (filter P [])) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) [])) = foldl (+) (0::'a) (map f [])

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs)

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
hence IH: "foldl (+) 0 (map f xs) =
               foldl (+) 0 (map f (filter P xs)) +
               foldl (+) 0 (map f [x\<leftarrow>xs . \<not> P x])"
[PROOF STATE]
proof (prove)
using this:
foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs)

goal (1 subgoal):
 1. foldl (+) (0::'a) (map f xs) = foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>x. \<not> P x) xs))
[PROOF STEP]
by (simp only: eq_commute)
[PROOF STATE]
proof (state)
this:
foldl (+) (0::'a) (map f xs) = foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>x. \<not> P x) xs))

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
have foldl_Cons':
    "\<And>x xs. foldl (+) 0 (x # xs) = x + (foldl (+) 0 xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xs. foldl (+) (0::'a) (x # xs) = x + foldl (+) (0::'a) xs
[PROOF STEP]
by (simp, subst foldl_absorb0[symmetric], rule refl)
[PROOF STATE]
proof (state)
this:
foldl (+) (0::'a) (?x1 # ?xs1) = ?x1 + foldl (+) (0::'a) ?xs1

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
foldl (+) (0::'a) (?x1 # ?xs1) = ?x1 + foldl (+) (0::'a) ?xs1

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
assume "P x"
[PROOF STATE]
proof (state)
this:
P x

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
hence ?case
[PROOF STATE]
proof (prove)
using this:
P x

goal (1 subgoal):
 1. foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))
[PROOF STEP]
by (auto simp del: foldl_Cons simp add: foldl_Cons' IH ac_simps)
[PROOF STATE]
proof (state)
this:
foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
P x \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P x \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
P x \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
assume "\<not> P x"
[PROOF STATE]
proof (state)
this:
\<not> P x

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
hence ?case
[PROOF STATE]
proof (prove)
using this:
\<not> P x

goal (1 subgoal):
 1. foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))
[PROOF STEP]
by (auto simp del: foldl_Cons simp add: foldl_Cons' IH ac_simps)
[PROOF STATE]
proof (state)
this:
foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> P x \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))

goal (1 subgoal):
 1. \<And>a xs. foldl (+) (0::'a) (map f (filter P xs)) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) xs)) = foldl (+) (0::'a) (map f xs) \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (a # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (a # xs))) = foldl (+) (0::'a) (map f (a # xs))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P x \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))
\<not> P x \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
P x \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))
\<not> P x \<Longrightarrow> foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))

goal (1 subgoal):
 1. foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
foldl (+) (0::'a) (map f (filter P (x # xs))) + foldl (+) (0::'a) (map f (filter (\<lambda>s. \<not> P s) (x # xs))) = foldl (+) (0::'a) (map f (x # xs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma elem_permutation_of_set_empty_iff: "finite A \<Longrightarrow> xs \<in> permutations_of_set A \<Longrightarrow>
    xs = [] \<longleftrightarrow> A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; xs \<in> permutations_of_set A\<rbrakk> \<Longrightarrow> (xs = []) = (A = {})
[PROOF STEP]
using permutations_of_setD(1)
[PROOF STATE]
proof (prove)
using this:
?xs \<in> permutations_of_set ?A \<Longrightarrow> set ?xs = ?A

goal (1 subgoal):
 1. \<lbrakk>finite A; xs \<in> permutations_of_set A\<rbrakk> \<Longrightarrow> (xs = []) = (A = {})
[PROOF STEP]
by fastforce


[STATEMENT]
lemma algebraic_int_minus [intro]:
  assumes "algebraic_int x"
  shows   "algebraic_int (-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
algebraic_int x
[PROOF STEP]
obtain p where p: "lead_coeff p = 1" "\<forall>i. coeff p i \<in> \<int>" "poly p x = 0"
[PROOF STATE]
proof (prove)
using this:
algebraic_int x

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>lead_coeff p = (1::'a); \<forall>i. coeff p i \<in> \<int>; poly p x = (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: algebraic_int.simps)
[PROOF STATE]
proof (state)
this:
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
define s where "s = (if even (degree p) then 1 else -1 :: 'a)"
[PROOF STATE]
proof (state)
this:
s = (if even (degree p) then 1::'a else - (1::'a))

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
define q where "q = Polynomial.smult s (pcompose p [:0, -1:])"
[PROOF STATE]
proof (state)
this:
q = smult s (p \<circ>\<^sub>p [:0::'a, - (1::'a):])

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
have "lead_coeff q = s * lead_coeff (pcompose p [:0, -1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff q = s * lead_coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):])
[PROOF STEP]
by (simp add: q_def)
[PROOF STATE]
proof (state)
this:
lead_coeff q = s * lead_coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):])

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lead_coeff q = s * lead_coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):])

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
have "lead_coeff (pcompose p [:0, -1:]) = lead_coeff p * (- 1) ^ degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):]) = lead_coeff p * (- (1::'a)) ^ degree p
[PROOF STEP]
by (subst lead_coeff_comp) auto
[PROOF STATE]
proof (state)
this:
lead_coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):]) = lead_coeff p * (- (1::'a)) ^ degree p

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lead_coeff q = s * (lead_coeff p * (- (1::'a)) ^ degree p)
[PROOF STEP]
have "poly q (-x) = 0" and "lead_coeff q = 1"
[PROOF STATE]
proof (prove)
using this:
lead_coeff q = s * (lead_coeff p * (- (1::'a)) ^ degree p)

goal (1 subgoal):
 1. poly q (- x) = (0::'a) &&& lead_coeff q = (1::'a)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
lead_coeff q = s * (lead_coeff p * (- (1::'a)) ^ degree p)
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)

goal (1 subgoal):
 1. poly q (- x) = (0::'a) &&& lead_coeff q = (1::'a)
[PROOF STEP]
by (auto simp: q_def poly_pcompose s_def)
[PROOF STATE]
proof (state)
this:
poly q (- x) = (0::'a)
lead_coeff q = (1::'a)

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly q (- x) = (0::'a)
lead_coeff q = (1::'a)

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
have "coeff q i \<in> \<int>" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff q i \<in> \<int>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff q i \<in> \<int>
[PROOF STEP]
have "coeff (pcompose p [:0, -1:]) i \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):]) i \<in> \<int>
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)

goal (1 subgoal):
 1. coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):]) i \<in> \<int>
[PROOF STEP]
by (intro coeff_pcompose_semiring_closed) (auto simp: coeff_pCons split: nat.splits)
[PROOF STATE]
proof (state)
this:
coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):]) i \<in> \<int>

goal (1 subgoal):
 1. coeff q i \<in> \<int>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff (p \<circ>\<^sub>p [:0::'a, - (1::'a):]) i \<in> \<int>

goal (1 subgoal):
 1. coeff q i \<in> \<int>
[PROOF STEP]
by (simp add: q_def s_def)
[PROOF STATE]
proof (state)
this:
coeff q i \<in> \<int>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coeff q ?i \<in> \<int>

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
poly q (- x) = (0::'a)
lead_coeff q = (1::'a)
coeff q ?i \<in> \<int>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly q (- x) = (0::'a)
lead_coeff q = (1::'a)
coeff q ?i \<in> \<int>

goal (1 subgoal):
 1. algebraic_int (- x)
[PROOF STEP]
by (auto simp: algebraic_int.simps)
[PROOF STATE]
proof (state)
this:
algebraic_int (- x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cauchy_not_vanishes_cases:
  assumes X: "cauchy X"
  assumes nz: "\<not> vanishes X"
  shows "\<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
obtain r where "0 < r" and r: "\<forall>k. \<exists>n\<ge>k. r \<le> \<bar>X n\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; \<forall>k. \<exists>n\<ge>k. r \<le> \<bar>X n\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using nz
[PROOF STATE]
proof (prove)
using this:
\<not> vanishes X

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; \<forall>k. \<exists>n\<ge>k. r \<le> \<bar>X n\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding vanishes_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>r>0. \<exists>k. \<forall>n\<ge>k. \<bar>X n\<bar> < r)

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; \<forall>k. \<exists>n\<ge>k. r \<le> \<bar>X n\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: not_less)
[PROOF STATE]
proof (state)
this:
0 < r
\<forall>k. \<exists>n\<ge>k. r \<le> \<bar>X n\<bar>

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
obtain s t where s: "0 < s" and t: "0 < t" and "r = s + t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s t. \<lbrakk>0 < s; 0 < t; r = s + t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>0 < r\<close>
[PROOF STATE]
proof (prove)
using this:
0 < r

goal (1 subgoal):
 1. (\<And>s t. \<lbrakk>0 < s; 0 < t; r = s + t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule obtain_pos_sum)
[PROOF STATE]
proof (state)
this:
0 < s
0 < t
r = s + t

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
obtain i where i: "\<forall>m\<ge>i. \<forall>n\<ge>i. \<bar>X m - X n\<bar> < s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<forall>m\<ge>i. \<forall>n\<ge>i. \<bar>X m - X n\<bar> < s \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cauchyD [OF X s]
[PROOF STATE]
proof (prove)
using this:
\<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < s

goal (1 subgoal):
 1. (\<And>i. \<forall>m\<ge>i. \<forall>n\<ge>i. \<bar>X m - X n\<bar> < s \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<forall>m\<ge>i. \<forall>n\<ge>i. \<bar>X m - X n\<bar> < s

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
obtain k where "i \<le> k" and "r \<le> \<bar>X k\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>i \<le> k; r \<le> \<bar>X k\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
\<forall>k. \<exists>n\<ge>k. r \<le> \<bar>X n\<bar>

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>i \<le> k; r \<le> \<bar>X k\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i \<le> k
r \<le> \<bar>X k\<bar>

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
have k: "\<forall>n\<ge>k. \<bar>X n - X k\<bar> < s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<ge>k. \<bar>X n - X k\<bar> < s
[PROOF STEP]
using i \<open>i \<le> k\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<ge>i. \<forall>n\<ge>i. \<bar>X m - X n\<bar> < s
i \<le> k

goal (1 subgoal):
 1. \<forall>n\<ge>k. \<bar>X n - X k\<bar> < s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>k. \<bar>X n - X k\<bar> < s

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
have "X k \<le> - r \<or> r \<le> X k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X k \<le> - r \<or> r \<le> X k
[PROOF STEP]
using \<open>r \<le> \<bar>X k\<bar>\<close>
[PROOF STATE]
proof (prove)
using this:
r \<le> \<bar>X k\<bar>

goal (1 subgoal):
 1. X k \<le> - r \<or> r \<le> X k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X k \<le> - r \<or> r \<le> X k

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X k \<le> - r \<or> r \<le> X k
[PROOF STEP]
have "(\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)"
[PROOF STATE]
proof (prove)
using this:
X k \<le> - r \<or> r \<le> X k

goal (1 subgoal):
 1. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
[PROOF STEP]
unfolding \<open>r = s + t\<close>
[PROOF STATE]
proof (prove)
using this:
X k \<le> - (s + t) \<or> s + t \<le> X k

goal (1 subgoal):
 1. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
X k \<le> - (s + t) \<or> s + t \<le> X k
\<forall>n\<ge>k. \<bar>X n - X k\<bar> < s

goal (1 subgoal):
 1. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
[PROOF STEP]
have "\<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)"
[PROOF STATE]
proof (prove)
using this:
(\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)

goal (1 subgoal):
 1. \<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)

goal (1 subgoal):
 1. \<exists>b>0. \<exists>k. (\<forall>n\<ge>k. b < - X n) \<or> (\<forall>n\<ge>k. b < X n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
[PROOF STEP]
show "\<exists>t>0. \<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)

goal (1 subgoal):
 1. \<exists>t>0. \<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
[PROOF STEP]
using t
[PROOF STATE]
proof (prove)
using this:
\<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
0 < t

goal (1 subgoal):
 1. \<exists>t>0. \<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>t>0. \<exists>k. (\<forall>n\<ge>k. t < - X n) \<or> (\<forall>n\<ge>k. t < X n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugate_scalar_prod:
  fixes v w :: "'a::conjugatable_ring vec"
  assumes "dim_vec v = dim_vec w"
  shows "conjugate (v \<bullet> w) = conjugate v \<bullet> conjugate w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (v \<bullet> w) = conjugate v \<bullet>c w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec w

goal (1 subgoal):
 1. conjugate (v \<bullet> w) = conjugate v \<bullet>c w
[PROOF STEP]
by (simp add: scalar_prod_def sum_conjugate conjugate_dist_mul)


[STATEMENT]
lemma fds_abs_converges_subseries [simp, intro]:
  assumes "fds_abs_converges f s"
  shows   "fds_abs_converges (fds_subseries P f) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_abs_converges (fds_subseries P f) s
[PROOF STEP]
unfolding fds_abs_converges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. norm (fds_nth (fds_subseries P f) n / nat_power n s))
[PROOF STEP]
proof (rule summable_comparison_test_ev)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F n in sequentially. norm (norm (fds_nth (fds_subseries P f) n / nat_power n s)) \<le> ?g n
 2. summable ?g
[PROOF STEP]
show "summable (\<lambda>n. norm (fds_nth f n / nat_power n s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. norm (fds_nth f n / nat_power n s))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fds_abs_converges f s

goal (1 subgoal):
 1. summable (\<lambda>n. norm (fds_nth f n / nat_power n s))
[PROOF STEP]
unfolding fds_abs_converges_def
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. norm (fds_nth f n / nat_power n s))

goal (1 subgoal):
 1. summable (\<lambda>n. norm (fds_nth f n / nat_power n s))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. norm (fds_nth f n / nat_power n s))

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (norm (fds_nth (fds_subseries P f) n / nat_power n s)) \<le> norm (fds_nth f n / nat_power n s)
[PROOF STEP]
qed (auto simp: fds_nth_subseries)


[STATEMENT]
lemma onorm_le:
  fixes f :: "'a::{real_normed_vector, perfect_space} \<Rightarrow> 'b::real_normed_vector"
  assumes "\<And>x. norm (f x) \<le> b * norm x"
  shows "onorm f \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm f \<le> b
[PROOF STEP]
proof (rule onorm_bound [OF _ assms])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> b
[PROOF STEP]
have "{0::'a} \<noteq> UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0::'a} \<noteq> UNIV
[PROOF STEP]
by (metis not_open_singleton open_UNIV)
[PROOF STATE]
proof (state)
this:
{0::'a} \<noteq> UNIV

goal (1 subgoal):
 1. 0 \<le> b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{0::'a} \<noteq> UNIV
[PROOF STEP]
obtain a :: 'a where "a \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
{0::'a} \<noteq> UNIV

goal (1 subgoal):
 1. (\<And>a. a \<noteq> (0::'a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. 0 \<le> b
[PROOF STEP]
have "0 \<le> b * norm a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> b * norm a
[PROOF STEP]
by (rule order_trans [OF norm_ge_zero assms])
[PROOF STATE]
proof (state)
this:
0 \<le> b * norm a

goal (1 subgoal):
 1. 0 \<le> b
[PROOF STEP]
with \<open>a \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a)
0 \<le> b * norm a
[PROOF STEP]
show "0 \<le> b"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)
0 \<le> b * norm a

goal (1 subgoal):
 1. 0 \<le> b
[PROOF STEP]
by (simp add: zero_le_mult_iff)
[PROOF STATE]
proof (state)
this:
0 \<le> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partial_vector_derivative_works:
  assumes "partially_vector_differentiable F base_vec a"
  shows "has_partial_vector_derivative F base_vec (partial_vector_derivative F base_vec a) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_partial_vector_derivative F base_vec (partial_vector_derivative F base_vec a) a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. has_partial_vector_derivative F base_vec (partial_vector_derivative F base_vec a) a
[PROOF STEP]
obtain F' where F'_prop: "((\<lambda>x. F( (a - ((a \<bullet> base_vec) *\<^sub>R base_vec)) + x *\<^sub>R base_vec ))
                            has_vector_derivative F') (at (a \<bullet> base_vec))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>F'. ((\<lambda>x. F (a - (a \<bullet> base_vec) *\<^sub>R base_vec + x *\<^sub>R base_vec)) has_vector_derivative F') (at (a \<bullet> base_vec)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms partially_vector_differentiable_def has_partial_vector_derivative_def
[PROOF STATE]
proof (prove)
using this:
partially_vector_differentiable F base_vec a
partially_vector_differentiable ?F ?base_vec ?p \<equiv> \<exists>F'. has_partial_vector_derivative ?F ?base_vec F' ?p
has_partial_vector_derivative ?F ?base_vec ?F' ?a \<equiv> ((\<lambda>x. ?F (?a - (?a \<bullet> ?base_vec) *\<^sub>R ?base_vec + x *\<^sub>R ?base_vec)) has_vector_derivative ?F') (at (?a \<bullet> ?base_vec))

goal (1 subgoal):
 1. (\<And>F'. ((\<lambda>x. F (a - (a \<bullet> base_vec) *\<^sub>R base_vec + x *\<^sub>R base_vec)) has_vector_derivative F') (at (a \<bullet> base_vec)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. F (a - (a \<bullet> base_vec) *\<^sub>R base_vec + x *\<^sub>R base_vec)) has_vector_derivative F') (at (a \<bullet> base_vec))

goal (1 subgoal):
 1. has_partial_vector_derivative F base_vec (partial_vector_derivative F base_vec a) a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_partial_vector_derivative F base_vec (partial_vector_derivative F base_vec a) a
[PROOF STEP]
using Derivative.differentiableI_vector[OF F'_prop]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. F (a - (a \<bullet> base_vec) *\<^sub>R base_vec + x *\<^sub>R base_vec)) differentiable at (a \<bullet> base_vec)

goal (1 subgoal):
 1. has_partial_vector_derivative F base_vec (partial_vector_derivative F base_vec a) a
[PROOF STEP]
by(simp add: vector_derivative_works partial_vector_derivative_def[symmetric]
        has_partial_vector_derivative_def[symmetric])
[PROOF STATE]
proof (state)
this:
has_partial_vector_derivative F base_vec (partial_vector_derivative F base_vec a) a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_nth_exp_Suc_0 [simp]: "fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)
[PROOF STEP]
have "fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1) * (\<Sum>k. 0 ^ k /\<^sub>R fact k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1) * (\<Sum>k. (0::'a) ^ k /\<^sub>R fact k)
[PROOF STEP]
by (simp add: fds_exp_def)
[PROOF STATE]
proof (state)
this:
fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1) * (\<Sum>k. (0::'a) ^ k /\<^sub>R fact k)

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1) * (\<Sum>k. (0::'a) ^ k /\<^sub>R fact k)

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)
[PROOF STEP]
have "(\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (\<Sum>k. if k = 0 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (\<Sum>k. if k = 0 then 1::'a else (0::'a))
[PROOF STEP]
by (intro suminf_cong) (auto simp: power_0_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (\<Sum>k. if k = 0 then 1::'a else (0::'a))

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (\<Sum>k. if k = 0 then 1::'a else (0::'a))

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k. if k = 0 then 1::'a else (0::'a)) = (1::'a)
[PROOF STEP]
using sums_If_finite[of "\<lambda>k. k = 0" "\<lambda>_. 1 :: 'a"]
[PROOF STATE]
proof (prove)
using this:
finite {r. r = 0} \<Longrightarrow> (\<lambda>r. if r = 0 then 1::'a else (0::'a)) sums (\<Sum>r | r = 0. (1::'a))

goal (1 subgoal):
 1. (\<Sum>k. if k = 0 then 1::'a else (0::'a)) = (1::'a)
[PROOF STEP]
by (simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>k. if k = 0 then 1::'a else (0::'a)) = (1::'a)

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1) * (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1) * (1::'a)

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in vectorspace) span_is_subspace:
  fixes S
  assumes h2: "S\<subseteq>carrier V"
  shows "subspace K (span S) V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace K (span S) V
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subspace K (span S) V
[PROOF STEP]
have 0: "vectorspace K V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace K V
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
vectorspace K V

goal (1 subgoal):
 1. subspace K (span S) V
[PROOF STEP]
from h2
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier V
[PROOF STEP]
have 1: "submodule K (span S) V"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier V

goal (1 subgoal):
 1. LinearCombinations.submodule K (span S) V
[PROOF STEP]
by (rule span_is_submodule)
[PROOF STATE]
proof (state)
this:
LinearCombinations.submodule K (span S) V

goal (1 subgoal):
 1. subspace K (span S) V
[PROOF STEP]
from 0 1
[PROOF STATE]
proof (chain)
picking this:
vectorspace K V
LinearCombinations.submodule K (span S) V
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vectorspace K V
LinearCombinations.submodule K (span S) V

goal (1 subgoal):
 1. subspace K (span S) V
[PROOF STEP]
by (unfold subspace_def mod_hom_def linear_map_def, auto)
[PROOF STATE]
proof (state)
this:
subspace K (span S) V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_infinite:
  assumes a: "finite {b::'x. P b}"
  and     b: "infinite (UNIV::'x set)"
  shows "infinite {b. \<not>P b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {b. \<not> P b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite {b. \<not> P b}
[PROOF STEP]
from a b
[PROOF STATE]
proof (chain)
picking this:
finite {b. P b}
infinite UNIV
[PROOF STEP]
have "infinite (UNIV - {b::'x. P b})"
[PROOF STATE]
proof (prove)
using this:
finite {b. P b}
infinite UNIV

goal (1 subgoal):
 1. infinite (UNIV - {b. P b})
[PROOF STEP]
by (simp add: Diff_infinite_finite)
[PROOF STATE]
proof (state)
this:
infinite (UNIV - {b. P b})

goal (1 subgoal):
 1. infinite {b. \<not> P b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
infinite (UNIV - {b. P b})

goal (1 subgoal):
 1. infinite {b. \<not> P b}
[PROOF STEP]
have "{b::'x. \<not>P b} = UNIV - {b::'x. P b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {b. \<not> P b} = UNIV - {b. P b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{b. \<not> P b} = UNIV - {b. P b}

goal (1 subgoal):
 1. infinite {b. \<not> P b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
infinite (UNIV - {b. P b})
{b. \<not> P b} = UNIV - {b. P b}
[PROOF STEP]
show "infinite {b::'x. \<not>P b}"
[PROOF STATE]
proof (prove)
using this:
infinite (UNIV - {b. P b})
{b. \<not> P b} = UNIV - {b. P b}

goal (1 subgoal):
 1. infinite {b. \<not> P b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
infinite {b. \<not> P b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma erf_remainder_integral_0_conv_erfc:
  assumes "(x::real) > 0"
  shows   "erf_remainder_integral 0 x = sqrt pi / 2 * erfc x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
have "(\<lambda>m. sqrt pi / 2 * (erf (x + real m) - erf x)) \<longlonglongrightarrow> sqrt pi / 2 * erfc x"
    (is "filterlim ?f _ _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. sqrt pi / 2 * (erf (x + real m) - erf x)) \<longlonglongrightarrow> sqrt pi / 2 * erfc x
[PROOF STEP]
unfolding erfc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. sqrt pi / 2 * (erf (x + real m) - erf x)) \<longlonglongrightarrow> sqrt pi / 2 * (1 - erf x)
[PROOF STEP]
by (intro tendsto_intros filterlim_tendsto_add_at_top[OF
          tendsto_const filterlim_real_sequentially])
[PROOF STATE]
proof (state)
this:
(\<lambda>m. sqrt pi / 2 * (erf (x + real m) - erf x)) \<longlonglongrightarrow> sqrt pi / 2 * erfc x

goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>m. sqrt pi / 2 * (erf (x + real m) - erf x)) \<longlonglongrightarrow> sqrt pi / 2 * erfc x

goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
have "?f = (\<lambda>m. integral {x..x+real m} (\<lambda>t. exp (-t\<^sup>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. sqrt pi / 2 * (erf (x + real m) - erf x)) = (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2)))
[PROOF STEP]
by (auto simp: fun_eq_iff integral_unique[OF integral_exp_minus_squared_real])
[PROOF STATE]
proof (state)
this:
(\<lambda>m. sqrt pi / 2 * (erf (x + real m) - erf x)) = (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2)))

goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> sqrt pi / 2 * erfc x
[PROOF STEP]
have "(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> sqrt pi / 2 * erfc x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> sqrt pi / 2 * erfc x

goal (1 subgoal):
 1. (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> sqrt pi / 2 * erfc x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> sqrt pi / 2 * erfc x

goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> sqrt pi / 2 * erfc x

goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
have "(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> erf_remainder_integral 0 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> erf_remainder_integral 0 x
[PROOF STEP]
using LIMSEQ_erf_remainder_integral[of x 0] assms
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * 0))) \<longlonglongrightarrow> erf_remainder_integral 0 x
0 < x

goal (1 subgoal):
 1. (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> erf_remainder_integral 0 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> erf_remainder_integral 0 x

goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> sqrt pi / 2 * erfc x
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> erf_remainder_integral 0 x
[PROOF STEP]
show "erf_remainder_integral 0 x = sqrt pi / 2 * erfc x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> sqrt pi / 2 * erfc x
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))) \<longlonglongrightarrow> erf_remainder_integral 0 x

goal (1 subgoal):
 1. erf_remainder_integral 0 x = sqrt pi / 2 * erfc x
[PROOF STEP]
by (intro LIMSEQ_unique)
[PROOF STATE]
proof (state)
this:
erf_remainder_integral 0 x = sqrt pi / 2 * erfc x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma out_degree_0_no_arcs:
  assumes "out_degree G v = 0" and "finite (arcs G)"
  shows "\<forall>y. (v,y) \<notin> arcs_ends G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. (v, y) \<notin> arcs_ends G
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>y. (v, y) \<notin> arcs_ends G) \<Longrightarrow> False
[PROOF STEP]
assume "\<not>(\<forall>y. (v,y) \<notin> arcs_ends G)"
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>y. (v, y) \<notin> arcs_ends G)

goal (1 subgoal):
 1. \<not> (\<forall>y. (v, y) \<notin> arcs_ends G) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<forall>y. (v, y) \<notin> arcs_ends G)
[PROOF STEP]
obtain y where y_def: "(v,y) \<in> arcs_ends G"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>y. (v, y) \<notin> arcs_ends G)

goal (1 subgoal):
 1. (\<And>y. v \<rightarrow> y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v \<rightarrow> y

goal (1 subgoal):
 1. \<not> (\<forall>y. (v, y) \<notin> arcs_ends G) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v \<rightarrow> y
[PROOF STEP]
obtain a where a_def: "a \<in> arcs G \<and> tail G a = v \<and> head G a = y"
[PROOF STATE]
proof (prove)
using this:
v \<rightarrow> y

goal (1 subgoal):
 1. (\<And>a. a \<in> arcs G \<and> tail G a = v \<and> head G a = y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> arcs G \<and> tail G a = v \<and> head G a = y

goal (1 subgoal):
 1. \<not> (\<forall>y. (v, y) \<notin> arcs_ends G) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> arcs G \<and> tail G a = v \<and> head G a = y
[PROOF STEP]
have "a \<in> {e \<in> arcs G. tail G e = v}"
[PROOF STATE]
proof (prove)
using this:
a \<in> arcs G \<and> tail G a = v \<and> head G a = y

goal (1 subgoal):
 1. a \<in> {e \<in> arcs G. tail G e = v}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<in> {e \<in> arcs G. tail G e = v}

goal (1 subgoal):
 1. \<not> (\<forall>y. (v, y) \<notin> arcs_ends G) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> {e \<in> arcs G. tail G e = v}
[PROOF STEP]
have "Finite_Set.card {e \<in> arcs G. tail G e = v} > 0"
[PROOF STATE]
proof (prove)
using this:
a \<in> {e \<in> arcs G. tail G e = v}

goal (1 subgoal):
 1. 0 < card {e \<in> arcs G. tail G e = v}
[PROOF STEP]
using assms(2) card_gt_0_iff
[PROOF STATE]
proof (prove)
using this:
a \<in> {e \<in> arcs G. tail G e = v}
finite (arcs G)
(0 < card ?A) = (?A \<noteq> {} \<and> finite ?A)

goal (1 subgoal):
 1. 0 < card {e \<in> arcs G. tail G e = v}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < card {e \<in> arcs G. tail G e = v}

goal (1 subgoal):
 1. \<not> (\<forall>y. (v, y) \<notin> arcs_ends G) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < card {e \<in> arcs G. tail G e = v}
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
0 < card {e \<in> arcs G. tail G e = v}

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
0 < card {e \<in> arcs G. tail G e = v}
out_degree G v = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
by (metis less_nat_zero_code out_arcs_def out_degree_def)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dominate_trans:
  assumes "dominate n1 n2"
      and "dominate n2 n3"
    shows "dominate n1 n3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dominate n1 n2
dominate n2 n3

goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
proof(cases "n1 = n2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>dominate n1 n2; dominate n2 n3; n1 = n2\<rbrakk> \<Longrightarrow> dominate n1 n3
 2. \<lbrakk>dominate n1 n2; dominate n2 n3; n1 \<noteq> n2\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n1 = n2

goal (2 subgoals):
 1. \<lbrakk>dominate n1 n2; dominate n2 n3; n1 = n2\<rbrakk> \<Longrightarrow> dominate n1 n3
 2. \<lbrakk>dominate n1 n2; dominate n2 n3; n1 \<noteq> n2\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n1 = n2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n1 = n2

goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
n1 = n2
dominate n2 n3

goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dominate n1 n3

goal (1 subgoal):
 1. \<lbrakk>dominate n1 n2; dominate n2 n3; n1 \<noteq> n2\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>dominate n1 n2; dominate n2 n3; n1 \<noteq> n2\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n1 \<noteq> n2

goal (1 subgoal):
 1. \<lbrakk>dominate n1 n2; dominate n2 n3; n1 \<noteq> n2\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n1 \<noteq> n2
[PROOF STEP]
show "dominate n1 n3"
[PROOF STATE]
proof (prove)
using this:
n1 \<noteq> n2

goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
proof (cases "n1 = n3")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>n1 \<noteq> n2; n1 = n3\<rbrakk> \<Longrightarrow> dominate n1 n3
 2. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n1 = n3

goal (2 subgoals):
 1. \<lbrakk>n1 \<noteq> n2; n1 = n3\<rbrakk> \<Longrightarrow> dominate n1 n3
 2. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n1 = n3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n1 = n3

goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
by (auto simp add:dominate_def)
[PROOF STATE]
proof (state)
this:
dominate n1 n3

goal (1 subgoal):
 1. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n1 \<noteq> n3

goal (1 subgoal):
 1. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3\<rbrakk> \<Longrightarrow> dominate n1 n3
[PROOF STEP]
show "dominate n1 n3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
proof (cases "n2 = n3")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n2 = n3 \<Longrightarrow> dominate n1 n3
 2. n2 \<noteq> n3 \<Longrightarrow> dominate n1 n3
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n2 = n3

goal (2 subgoals):
 1. n2 = n3 \<Longrightarrow> dominate n1 n3
 2. n2 \<noteq> n3 \<Longrightarrow> dominate n1 n3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n2 = n3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n2 = n3

goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
n2 = n3
dominate n1 n2

goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dominate n1 n3

goal (1 subgoal):
 1. n2 \<noteq> n3 \<Longrightarrow> dominate n1 n3
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n2 \<noteq> n3 \<Longrightarrow> dominate n1 n3
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n2 \<noteq> n3

goal (1 subgoal):
 1. n2 \<noteq> n3 \<Longrightarrow> dominate n1 n3
[PROOF STEP]
with \<open>n1 \<noteq> n2\<close> \<open>n1 \<noteq> n3\<close>
[PROOF STATE]
proof (chain)
picking this:
n1 \<noteq> n2
n1 \<noteq> n3
n2 \<noteq> n3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n1 \<noteq> n2
n1 \<noteq> n3
n2 \<noteq> n3

goal (1 subgoal):
 1. dominate n1 n3
[PROOF STEP]
proof (auto simp add: dominate_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>pa. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3; n2 \<noteq> n3; path_entry (g_E G) pa n3\<rbrakk> \<Longrightarrow> n1 \<in> set pa
[PROOF STEP]
fix pa
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>pa. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3; n2 \<noteq> n3; path_entry (g_E G) pa n3\<rbrakk> \<Longrightarrow> n1 \<in> set pa
[PROOF STEP]
assume "n1 \<noteq> n2" and "n1 \<noteq> n3" and "n2 \<noteq> n3"
[PROOF STATE]
proof (state)
this:
n1 \<noteq> n2
n1 \<noteq> n3
n2 \<noteq> n3

goal (1 subgoal):
 1. \<And>pa. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3; n2 \<noteq> n3; path_entry (g_E G) pa n3\<rbrakk> \<Longrightarrow> n1 \<in> set pa
[PROOF STEP]
from \<open>n1 \<noteq> n2\<close> assms(1)
[PROOF STATE]
proof (chain)
picking this:
n1 \<noteq> n2
dominate n1 n2
[PROOF STEP]
have n1_n2_pa: "\<forall>pa. path_entry (g_E G) pa n2 \<longrightarrow> n1 \<in> set pa"
[PROOF STATE]
proof (prove)
using this:
n1 \<noteq> n2
dominate n1 n2

goal (1 subgoal):
 1. \<forall>pa. path_entry (g_E G) pa n2 \<longrightarrow> n1 \<in> set pa
[PROOF STEP]
by (auto simp add:dominate_def)
[PROOF STATE]
proof (state)
this:
\<forall>pa. path_entry (g_E G) pa n2 \<longrightarrow> n1 \<in> set pa

goal (1 subgoal):
 1. \<And>pa. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3; n2 \<noteq> n3; path_entry (g_E G) pa n3\<rbrakk> \<Longrightarrow> n1 \<in> set pa
[PROOF STEP]
from \<open>n2 \<noteq> n3\<close> assms(2)
[PROOF STATE]
proof (chain)
picking this:
n2 \<noteq> n3
dominate n2 n3
[PROOF STEP]
have "\<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n2 \<in> set pa"
[PROOF STATE]
proof (prove)
using this:
n2 \<noteq> n3
dominate n2 n3

goal (1 subgoal):
 1. \<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n2 \<in> set pa
[PROOF STEP]
by (auto simp add:dominate_def)
[PROOF STATE]
proof (state)
this:
\<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n2 \<in> set pa

goal (1 subgoal):
 1. \<And>pa. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3; n2 \<noteq> n3; path_entry (g_E G) pa n3\<rbrakk> \<Longrightarrow> n1 \<in> set pa
[PROOF STEP]
with n1_n2_pa
[PROOF STATE]
proof (chain)
picking this:
\<forall>pa. path_entry (g_E G) pa n2 \<longrightarrow> n1 \<in> set pa
\<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n2 \<in> set pa
[PROOF STEP]
have "\<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n1 \<in> set pa"
[PROOF STATE]
proof (prove)
using this:
\<forall>pa. path_entry (g_E G) pa n2 \<longrightarrow> n1 \<in> set pa
\<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n2 \<in> set pa

goal (1 subgoal):
 1. \<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n1 \<in> set pa
[PROOF STEP]
by (rule path_entry_gt)
[PROOF STATE]
proof (state)
this:
\<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n1 \<in> set pa

goal (1 subgoal):
 1. \<And>pa. \<lbrakk>n1 \<noteq> n2; n1 \<noteq> n3; n2 \<noteq> n3; path_entry (g_E G) pa n3\<rbrakk> \<Longrightarrow> n1 \<in> set pa
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n1 \<in> set pa
[PROOF STEP]
show "\<And>pa. path_entry (g_E G) pa n3 \<Longrightarrow> n1 \<in> set pa"
[PROOF STATE]
proof (prove)
using this:
\<forall>pa. path_entry (g_E G) pa n3 \<longrightarrow> n1 \<in> set pa

goal (1 subgoal):
 1. \<And>pa. path_entry (g_E G) pa n3 \<Longrightarrow> n1 \<in> set pa
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path_entry (g_E G) ?pa n3 \<Longrightarrow> n1 \<in> set ?pa

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dominate n1 n3

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dominate n1 n3

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dominate n1 n3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_le_one_le: "\<And>x y::real. 0 < x \<Longrightarrow> x \<le> 1 \<Longrightarrow> 1 \<le> y \<Longrightarrow> x powr y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
fix x y :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
assume "0 < x" "x \<le> 1" "1 \<le> y"
[PROOF STATE]
proof (state)
this:
0 < x
x \<le> 1
1 \<le> y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
have "x powr y = (1 / (1 / x)) powr y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr y = (1 / (1 / x)) powr y
[PROOF STEP]
using \<open>0 < x\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x

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

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x powr y = (1 / (1 / x)) powr y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
have "\<dots> = 1 / (1 / x) powr y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / (1 / x)) powr y = 1 / (1 / x) powr y
[PROOF STEP]
using \<open>0 < x\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x

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

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 / (1 / x)) powr y = 1 / (1 / x) powr y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
have "\<dots> \<le> 1 / (1 / x) powr 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / (1 / x) powr y \<le> 1 / (1 / x) powr 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / (1 / x) powr y \<le> 1 / (1 / x) powr 1
[PROOF STEP]
have "1 \<le> 1 / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> 1 / x
[PROOF STEP]
using \<open>0 < x\<close> \<open>x \<le> 1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x
x \<le> 1

goal (1 subgoal):
 1. 1 \<le> 1 / x
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
1 \<le> 1 / x

goal (1 subgoal):
 1. 1 / (1 / x) powr y \<le> 1 / (1 / x) powr 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> 1 / x
[PROOF STEP]
have "(1 / x) powr 1  \<le> (1 / x) powr y"
[PROOF STATE]
proof (prove)
using this:
1 \<le> 1 / x

goal (1 subgoal):
 1. (1 / x) powr 1 \<le> (1 / x) powr y
[PROOF STEP]
using \<open>0 < x\<close>
[PROOF STATE]
proof (prove)
using this:
1 \<le> 1 / x
0 < x

goal (1 subgoal):
 1. (1 / x) powr 1 \<le> (1 / x) powr y
[PROOF STEP]
using \<open>1 \<le> y\<close>
[PROOF STATE]
proof (prove)
using this:
1 \<le> 1 / x
0 < x
1 \<le> y

goal (1 subgoal):
 1. (1 / x) powr 1 \<le> (1 / x) powr y
[PROOF STEP]
by ( simp only: powr_mono)
[PROOF STATE]
proof (state)
this:
(1 / x) powr 1 \<le> (1 / x) powr y

goal (1 subgoal):
 1. 1 / (1 / x) powr y \<le> 1 / (1 / x) powr 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 / x) powr 1 \<le> (1 / x) powr y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(1 / x) powr 1 \<le> (1 / x) powr y

goal (1 subgoal):
 1. 1 / (1 / x) powr y \<le> 1 / (1 / x) powr 1
[PROOF STEP]
by (metis \<open>1 \<le> 1 / x\<close> \<open>1 \<le> y\<close> neg_le_iff_le powr_minus_divide powr_mono)
[PROOF STATE]
proof (state)
this:
1 / (1 / x) powr y \<le> 1 / (1 / x) powr 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 / (1 / x) powr y \<le> 1 / (1 / x) powr 1

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / (1 / x) powr y \<le> 1 / (1 / x) powr 1

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
have "\<dots> \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / (1 / x) powr 1 \<le> x
[PROOF STEP]
using \<open>0 < x\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. 1 / (1 / x) powr 1 \<le> x
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
1 / (1 / x) powr 1 \<le> x

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; x \<le> 1; 1 \<le> y\<rbrakk> \<Longrightarrow> x powr y \<le> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x powr y \<le> x
[PROOF STEP]
show "?thesis x y"
[PROOF STATE]
proof (prove)
using this:
x powr y \<le> x

goal (1 subgoal):
 1. x powr y \<le> x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x powr y \<le> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fba_Diff: "S \<in> fba \<Longrightarrow> T \<in> fba \<Longrightarrow> S - T \<in> fba"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<in> fba; T \<in> fba\<rbrakk> \<Longrightarrow> S - T \<in> fba
[PROOF STEP]
unfolding Diff_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<in> fba; T \<in> fba\<rbrakk> \<Longrightarrow> S \<inter> - T \<in> fba
[PROOF STEP]
by (intro fba.inter fba.Compl)


[STATEMENT]
lemma mset_permute_list [simp]:
  fixes xs :: "'a list"
  assumes "f permutes {..<length xs}"
  shows "mset (permute_list f xs) = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (permute_list f xs) = mset xs
[PROOF STEP]
proof (rule multiset_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
fix y :: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f permutes {..<length xs}
[PROOF STEP]
have [simp]: "f x < length xs \<longleftrightarrow> x < length xs" for x
[PROOF STATE]
proof (prove)
using this:
f permutes {..<length xs}

goal (1 subgoal):
 1. (f x < length xs) = (x < length xs)
[PROOF STEP]
using permutes_in_image[OF assms]
[PROOF STATE]
proof (prove)
using this:
f permutes {..<length xs}
(f ?x \<in> {..<length xs}) = (?x \<in> {..<length xs})

goal (1 subgoal):
 1. (f x < length xs) = (x < length xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f ?x < length xs) = (?x < length xs)

goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
have "count (mset (permute_list f xs)) y = card ((\<lambda>i. xs ! f i) -` {y} \<inter> {..<length xs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (mset (permute_list f xs)) y = card ((\<lambda>i. xs ! f i) -` {y} \<inter> {..<length xs})
[PROOF STEP]
by (simp add: permute_list_def count_image_mset atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
count (mset (permute_list f xs)) y = card ((\<lambda>i. xs ! f i) -` {y} \<inter> {..<length xs})

goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count (mset (permute_list f xs)) y = card ((\<lambda>i. xs ! f i) -` {y} \<inter> {..<length xs})

goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
have "(\<lambda>i. xs ! f i) -` {y} \<inter> {..<length xs} = f -` {i. i < length xs \<and> y = xs ! i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. xs ! f i) -` {y} \<inter> {..<length xs} = f -` {i. i < length xs \<and> y = xs ! i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. xs ! f i) -` {y} \<inter> {..<length xs} = f -` {i. i < length xs \<and> y = xs ! i}

goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. xs ! f i) -` {y} \<inter> {..<length xs} = f -` {i. i < length xs \<and> y = xs ! i}

goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f permutes {..<length xs}
[PROOF STEP]
have "card \<dots> = card {i. i < length xs \<and> y = xs ! i}"
[PROOF STATE]
proof (prove)
using this:
f permutes {..<length xs}

goal (1 subgoal):
 1. card (f -` {i. i < length xs \<and> y = xs ! i}) = card {i. i < length xs \<and> y = xs ! i}
[PROOF STEP]
by (intro card_vimage_inj) (auto simp: permutes_inj permutes_surj)
[PROOF STATE]
proof (state)
this:
card (f -` {i. i < length xs \<and> y = xs ! i}) = card {i. i < length xs \<and> y = xs ! i}

goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (f -` {i. i < length xs \<and> y = xs ! i}) = card {i. i < length xs \<and> y = xs ! i}

goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
have "\<dots> = count (mset xs) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i < length xs \<and> y = xs ! i} = count (mset xs) y
[PROOF STEP]
by (simp add: count_mset length_filter_conv_card)
[PROOF STATE]
proof (state)
this:
card {i. i < length xs \<and> y = xs ! i} = count (mset xs) y

goal (1 subgoal):
 1. \<And>x. count (mset (permute_list f xs)) x = count (mset xs) x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count (mset (permute_list f xs)) y = count (mset xs) y
[PROOF STEP]
show "count (mset (permute_list f xs)) y = count (mset xs) y"
[PROOF STATE]
proof (prove)
using this:
count (mset (permute_list f xs)) y = count (mset xs) y

goal (1 subgoal):
 1. count (mset (permute_list f xs)) y = count (mset xs) y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count (mset (permute_list f xs)) y = count (mset xs) y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mset_drop_upto: \<open>mset (drop a N) = {#N!i. i \<in># mset_set {a..<length N}#}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})
[PROOF STEP]
proof (induction N arbitrary: a)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. mset (drop a []) = image_mset ((!) []) (mset_set {a..<length []})
 2. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>a. mset (drop a []) = image_mset ((!) []) (mset_set {a..<length []})
 2. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (drop a []) = image_mset ((!) []) (mset_set {a..<length []})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mset (drop a []) = image_mset ((!) []) (mset_set {a..<length []})

goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
case (Cons c N)
[PROOF STATE]
proof (state)
this:
mset (drop ?a N) = image_mset ((!) N) (mset_set {?a..<length N})

goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
have upt: \<open>{0..<Suc (length N)} = insert 0 {1..<Suc (length N)}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<Suc (length N)} = insert 0 {1..<Suc (length N)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<Suc (length N)} = insert 0 {1..<Suc (length N)}

goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{0..<Suc (length N)} = insert 0 {1..<Suc (length N)}
[PROOF STEP]
have H: \<open>mset_set {0..<Suc (length N)} = add_mset 0 (mset_set {1..<Suc (length N)})\<close>
[PROOF STATE]
proof (prove)
using this:
{0..<Suc (length N)} = insert 0 {1..<Suc (length N)}

goal (1 subgoal):
 1. mset_set {0..<Suc (length N)} = add_mset 0 (mset_set {1..<Suc (length N)})
[PROOF STEP]
unfolding upt
[PROOF STATE]
proof (prove)
using this:
insert 0 {1..<Suc (length N)} = insert 0 {1..<Suc (length N)}

goal (1 subgoal):
 1. mset_set (insert 0 {1..<Suc (length N)}) = add_mset 0 (mset_set {1..<Suc (length N)})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mset_set {0..<Suc (length N)} = add_mset 0 (mset_set {1..<Suc (length N)})

goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
have mset_case_Suc: \<open>{#case x of 0 \<Rightarrow> c | Suc x \<Rightarrow> N ! x . x \<in># mset_set {Suc a..<Suc b}#} =
    {#N ! (x-1) . x \<in># mset_set {Suc a..<Suc b}#}\<close> for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#case x of 0 \<Rightarrow> c | Suc x \<Rightarrow> N ! x. x \<in># mset_set {Suc a..<Suc b}#} = {#N ! (x - 1). x \<in># mset_set {Suc a..<Suc b}#}
[PROOF STEP]
by (rule image_mset_cong) (auto split: nat.splits)
[PROOF STATE]
proof (state)
this:
{#case x of 0 \<Rightarrow> c | Suc x \<Rightarrow> N ! x. x \<in># mset_set {Suc ?a..<Suc ?b}#} = {#N ! (x - 1). x \<in># mset_set {Suc ?a..<Suc ?b}#}

goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
have Suc_Suc: \<open>{Suc a..<Suc b} = Suc ` {a..<b}\<close> for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Suc a..<Suc b} = Suc ` {a..<b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{Suc ?a..<Suc ?b} = Suc ` {?a..<?b}

goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{Suc ?a..<Suc ?b} = Suc ` {?a..<?b}
[PROOF STEP]
have mset_set_Suc_Suc: \<open>mset_set {Suc a..<Suc b} = {#Suc n. n \<in># mset_set {a..<b}#}\<close> for a b
[PROOF STATE]
proof (prove)
using this:
{Suc ?a..<Suc ?b} = Suc ` {?a..<?b}

goal (1 subgoal):
 1. mset_set {Suc a..<Suc b} = image_mset Suc (mset_set {a..<b})
[PROOF STEP]
unfolding Suc_Suc
[PROOF STATE]
proof (prove)
using this:
Suc ` {?a..<?b} = Suc ` {?a..<?b}

goal (1 subgoal):
 1. mset_set (Suc ` {a..<b}) = image_mset Suc (mset_set {a..<b})
[PROOF STEP]
by (subst image_mset_mset_set[symmetric]) auto
[PROOF STATE]
proof (state)
this:
mset_set {Suc ?a..<Suc ?b} = image_mset Suc (mset_set {?a..<?b})

goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
have *: \<open>{#N ! (x-Suc 0) . x \<in># mset_set {Suc a..<Suc b}#} = {#N ! x . x \<in># mset_set {a..<b}#}\<close>
    for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#N ! (x - Suc 0). x \<in># mset_set {Suc a..<Suc b}#} = image_mset ((!) N) (mset_set {a..<b})
[PROOF STEP]
by (auto simp add: mset_set_Suc_Suc)
[PROOF STATE]
proof (state)
this:
{#N ! (x - Suc 0). x \<in># mset_set {Suc ?a..<Suc ?b}#} = image_mset ((!) N) (mset_set {?a..<?b})

goal (1 subgoal):
 1. \<And>a N aa. (\<And>a. mset (drop a N) = image_mset ((!) N) (mset_set {a..<length N})) \<Longrightarrow> mset (drop aa (a # N)) = image_mset ((!) (a # N)) (mset_set {aa..<length (a # N)})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (drop a (c # N)) = image_mset ((!) (c # N)) (mset_set {a..<length (c # N)})
[PROOF STEP]
apply (cases a)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a = 0 \<Longrightarrow> mset (drop a (c # N)) = image_mset ((!) (c # N)) (mset_set {a..<length (c # N)})
 2. \<And>nat. a = Suc nat \<Longrightarrow> mset (drop a (c # N)) = image_mset ((!) (c # N)) (mset_set {a..<length (c # N)})
[PROOF STEP]
using Cons[of 0] Cons
[PROOF STATE]
proof (prove)
using this:
mset (drop 0 N) = image_mset ((!) N) (mset_set {0..<length N})
mset (drop ?a N) = image_mset ((!) N) (mset_set {?a..<length N})

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> mset (drop a (c # N)) = image_mset ((!) (c # N)) (mset_set {a..<length (c # N)})
 2. \<And>nat. a = Suc nat \<Longrightarrow> mset (drop a (c # N)) = image_mset ((!) (c # N)) (mset_set {a..<length (c # N)})
[PROOF STEP]
by (auto simp: nth_Cons drop_Cons H mset_case_Suc *)
[PROOF STATE]
proof (state)
this:
mset (drop a (c # N)) = image_mset ((!) (c # N)) (mset_set {a..<length (c # N)})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vconverse_inject[simp]:
  assumes "vbrelation r" and "vbrelation s"
  shows "r\<inverse>\<^sub>\<circ> = s\<inverse>\<^sub>\<circ> \<longleftrightarrow> r = s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r\<inverse>\<^sub>\<circ> = s\<inverse>\<^sub>\<circ>) = (r = s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
vbrelation r
vbrelation s

goal (1 subgoal):
 1. (r\<inverse>\<^sub>\<circ> = s\<inverse>\<^sub>\<circ>) = (r = s)
[PROOF STEP]
by fast


[STATEMENT]
lemma singleton_set_some:
 "(\<exists>Y. Y \<in> singleton_set X) = (\<exists>x. x \<in> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>Y. Y \<in> singleton_set X) = (\<exists>x. x \<in> X)
[PROOF STEP]
proof (rule iffI, simp_all add: singleton_set_def, erule_tac [!] exE, erule bexE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Y x. \<lbrakk>x \<in> X; Y = {x}\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Y x. \<lbrakk>x \<in> X; Y = {x}\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
assume "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (2 subgoals):
 1. \<And>Y x. \<lbrakk>x \<in> X; Y = {x}\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
thus "\<exists>x. x \<in> X"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. \<exists>x. x \<in> X
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>x. x \<in> X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
assume A: "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
have "{x} = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x} = {x}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
{x} = {x}

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
hence "\<exists>x' \<in> X. {x} = {x'}"
[PROOF STATE]
proof (prove)
using this:
{x} = {x}

goal (1 subgoal):
 1. \<exists>x'\<in>X. {x} = {x'}
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
{x} = {x}
x \<in> X

goal (1 subgoal):
 1. \<exists>x'\<in>X. {x} = {x'}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>x'\<in>X. {x} = {x'}

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> \<exists>Y. \<exists>x\<in>X. Y = {x}
[PROOF STEP]
thus "\<exists>Y. \<exists>x' \<in> X. Y = {x'}"
[PROOF STATE]
proof (prove)
using this:
\<exists>x'\<in>X. {x} = {x'}

goal (1 subgoal):
 1. \<exists>Y. \<exists>x'\<in>X. Y = {x'}
[PROOF STEP]
by (rule exI)
[PROOF STATE]
proof (state)
this:
\<exists>Y. \<exists>x'\<in>X. Y = {x'}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma splay_bstL: "bst t \<Longrightarrow> splay a t = Node l e r \<Longrightarrow> x \<in> set_tree l \<Longrightarrow> x < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bst t; splay a t = \<langle>l, e, r\<rangle>; x \<in> set_tree l\<rbrakk> \<Longrightarrow> x < a
[PROOF STEP]
by (metis bst_iff_sorted_wrt_less list.set_intros(1) set_inorder sorted_splay sorted_wrt_append)


[STATEMENT]
lemma (in prob_grw) geom_rand_walk_diff_induct:
  shows "\<And>w. (geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False)) = (geom_proc n w * (u - d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
have "geom_proc (Suc n) (spick w n True) = u * geom_proc n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n True) = u * geom_proc n w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n True) = u * geom_proc n w
[PROOF STEP]
have "snth (spick w n True) n = True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spick w n True !! n = True
[PROOF STEP]
by (simp add: spickI)
[PROOF STATE]
proof (state)
this:
spick w n True !! n = True

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n True) = u * geom_proc n w
[PROOF STEP]
hence "(\<lambda>w. (case w !! n of True \<Rightarrow> u | False \<Rightarrow> d)) (spick w n True) = u"
[PROOF STATE]
proof (prove)
using this:
spick w n True !! n = True

goal (1 subgoal):
 1. (case spick w n True !! n of True \<Rightarrow> u | False \<Rightarrow> d) = u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(case spick w n True !! n of True \<Rightarrow> u | False \<Rightarrow> d) = u

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n True) = u * geom_proc n w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(case spick w n True !! n of True \<Rightarrow> u | False \<Rightarrow> d) = u

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n True) = u * geom_proc n w
[PROOF STEP]
using geometric_process geom_rand_walk.simps(2)[of u d init n]
[PROOF STATE]
proof (prove)
using this:
(case spick w n True !! n of True \<Rightarrow> u | False \<Rightarrow> d) = u
geom_proc = geom_rand_walk u d init
geom_rand_walk u d init (Suc n) = (\<lambda>w. (case w !! n of True \<Rightarrow> u | False \<Rightarrow> d) * geom_rand_walk u d init n w)

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n True) = u * geom_proc n w
[PROOF STEP]
by (metis comp_apply geom_rand_walk_pseudo_proj_True pseudo_proj_True_def spickI)
[PROOF STATE]
proof (state)
this:
geom_proc (Suc n) (spick w n True) = u * geom_proc n w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
geom_proc (Suc n) (spick w n True) = u * geom_proc n w

goal (1 subgoal):
 1. \<And>w. geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
geom_proc (Suc n) (spick w n True) = u * geom_proc n w

goal (1 subgoal):
 1. \<And>w. geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
have "geom_proc (Suc n) (spick w n False) = d * geom_proc n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n False) = d * geom_proc n w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n False) = d * geom_proc n w
[PROOF STEP]
have "snth (spick w n False) n = False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spick w n False !! n = False
[PROOF STEP]
by (simp add: spickI)
[PROOF STATE]
proof (state)
this:
spick w n False !! n = False

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n False) = d * geom_proc n w
[PROOF STEP]
hence "(\<lambda>w. (case w !! n of True \<Rightarrow> u | False \<Rightarrow> d)) (spick w n False) = d"
[PROOF STATE]
proof (prove)
using this:
spick w n False !! n = False

goal (1 subgoal):
 1. (case spick w n False !! n of True \<Rightarrow> u | False \<Rightarrow> d) = d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(case spick w n False !! n of True \<Rightarrow> u | False \<Rightarrow> d) = d

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n False) = d * geom_proc n w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(case spick w n False !! n of True \<Rightarrow> u | False \<Rightarrow> d) = d

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n False) = d * geom_proc n w
[PROOF STEP]
using geometric_process geom_rand_walk.simps(2)[of u d init n]
[PROOF STATE]
proof (prove)
using this:
(case spick w n False !! n of True \<Rightarrow> u | False \<Rightarrow> d) = d
geom_proc = geom_rand_walk u d init
geom_rand_walk u d init (Suc n) = (\<lambda>w. (case w !! n of True \<Rightarrow> u | False \<Rightarrow> d) * geom_rand_walk u d init n w)

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n False) = d * geom_proc n w
[PROOF STEP]
by (metis comp_apply geom_rand_walk_pseudo_proj_True pseudo_proj_True_def spickI)
[PROOF STATE]
proof (state)
this:
geom_proc (Suc n) (spick w n False) = d * geom_proc n w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
geom_proc (Suc n) (spick w n False) = d * geom_proc n w

goal (1 subgoal):
 1. \<And>w. geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
geom_proc (Suc n) (spick w n True) = u * geom_proc n w
geom_proc (Suc n) (spick w n False) = d * geom_proc n w
[PROOF STEP]
show "(geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False)) = (geom_proc n w * (u - d))"
[PROOF STATE]
proof (prove)
using this:
geom_proc (Suc n) (spick w n True) = u * geom_proc n w
geom_proc (Suc n) (spick w n False) = d * geom_proc n w

goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
by (simp add:field_simps)
[PROOF STATE]
proof (state)
this:
geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_rank_less:
  assumes "finite A" "x \<in> A"
  shows   "linorder_rank R A x < card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_rank R A x < card A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linorder_rank R A x < card A
[PROOF STEP]
have "linorder_rank R A x \<le> card (A - {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_rank R A x \<le> card (A - {x})
[PROOF STEP]
unfolding linorder_rank_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {y \<in> A - {x}. (y, x) \<in> R} \<le> card (A - {x})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
x \<in> A

goal (1 subgoal):
 1. card {y \<in> A - {x}. (y, x) \<in> R} \<le> card (A - {x})
[PROOF STEP]
by (intro card_mono) auto
[PROOF STATE]
proof (state)
this:
linorder_rank R A x \<le> card (A - {x})

goal (1 subgoal):
 1. linorder_rank R A x < card A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
linorder_rank R A x \<le> card (A - {x})

goal (1 subgoal):
 1. linorder_rank R A x < card A
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
x \<in> A
[PROOF STEP]
have "\<dots> < card A"
[PROOF STATE]
proof (prove)
using this:
finite A
x \<in> A

goal (1 subgoal):
 1. card (A - {x}) < card A
[PROOF STEP]
by (intro psubset_card_mono) auto
[PROOF STATE]
proof (state)
this:
card (A - {x}) < card A

goal (1 subgoal):
 1. linorder_rank R A x < card A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
linorder_rank R A x < card A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
linorder_rank R A x < card A

goal (1 subgoal):
 1. linorder_rank R A x < card A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
linorder_rank R A x < card A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma float_plus_minus:
  assumes "is_finite a" "is_finite b" "is_finite (a - b)"
  shows "(a + - b) \<doteq> (a - b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
have nab: "\<not> is_nan a" "\<not> is_nan (- b)" "\<not> is_infinity a" "\<not> is_infinity (-  b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> is_nan a &&& \<not> is_nan (- b)) &&& \<not> is_infinity a &&& \<not> is_infinity (- b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_finite a
is_finite b
is_finite (a - b)

goal (1 subgoal):
 1. (\<not> is_nan a &&& \<not> is_nan (- b)) &&& \<not> is_infinity a &&& \<not> is_infinity (- b)
[PROOF STEP]
by (auto simp: finite_nan finite_infinity)
[PROOF STATE]
proof (state)
this:
\<not> is_nan a
\<not> is_nan (- b)
\<not> is_infinity a
\<not> is_infinity (- b)

goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
have "a - b = (zerosign
        (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then (sign a) else 0)
        (round To_nearest (valof a - valof b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - b = zerosign (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then sign a else 0) (IEEE.round To_nearest (valof a - valof b))
[PROOF STEP]
using nab
[PROOF STATE]
proof (prove)
using this:
\<not> is_nan a
\<not> is_nan (- b)
\<not> is_infinity a
\<not> is_infinity (- b)

goal (1 subgoal):
 1. a - b = zerosign (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then sign a else 0) (IEEE.round To_nearest (valof a - valof b))
[PROOF STEP]
by (auto simp: minus_float_def fsub_def)
[PROOF STATE]
proof (state)
this:
a - b = zerosign (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then sign a else 0) (IEEE.round To_nearest (valof a - valof b))

goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a - b = zerosign (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then sign a else 0) (IEEE.round To_nearest (valof a - valof b))

goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
have "\<dots> =
    (zerosign
        (if is_zero a \<and> is_zero (- b) \<and> sign a = sign (- b) then sign a else 0)
        (round To_nearest (valof a + valof (- b))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zerosign (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then sign a else 0) (IEEE.round To_nearest (valof a - valof b)) = zerosign (if is_zero a \<and> is_zero (- b) \<and> sign a = sign (- b) then sign a else 0) (IEEE.round To_nearest (valof a + valof (- b)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_finite a
is_finite b
is_finite (a - b)

goal (1 subgoal):
 1. zerosign (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then sign a else 0) (IEEE.round To_nearest (valof a - valof b)) = zerosign (if is_zero a \<and> is_zero (- b) \<and> sign a = sign (- b) then sign a else 0) (IEEE.round To_nearest (valof a + valof (- b)))
[PROOF STEP]
by (simp add: float_neg_sign1 float_neg_add)
[PROOF STATE]
proof (state)
this:
zerosign (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then sign a else 0) (IEEE.round To_nearest (valof a - valof b)) = zerosign (if is_zero a \<and> is_zero (- b) \<and> sign a = sign (- b) then sign a else 0) (IEEE.round To_nearest (valof a + valof (- b)))

goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
zerosign (if is_zero a \<and> is_zero b \<and> sign a \<noteq> sign b then sign a else 0) (IEEE.round To_nearest (valof a - valof b)) = zerosign (if is_zero a \<and> is_zero (- b) \<and> sign a = sign (- b) then sign a else 0) (IEEE.round To_nearest (valof a + valof (- b)))

goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
have "\<dots> = a + - b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zerosign (if is_zero a \<and> is_zero (- b) \<and> sign a = sign (- b) then sign a else 0) (IEEE.round To_nearest (valof a + valof (- b))) = a + - b
[PROOF STEP]
using nab
[PROOF STATE]
proof (prove)
using this:
\<not> is_nan a
\<not> is_nan (- b)
\<not> is_infinity a
\<not> is_infinity (- b)

goal (1 subgoal):
 1. zerosign (if is_zero a \<and> is_zero (- b) \<and> sign a = sign (- b) then sign a else 0) (IEEE.round To_nearest (valof a + valof (- b))) = a + - b
[PROOF STEP]
by (auto simp: float_defs fadd_def plus_float_def)
[PROOF STATE]
proof (state)
this:
zerosign (if is_zero a \<and> is_zero (- b) \<and> sign a = sign (- b) then sign a else 0) (IEEE.round To_nearest (valof a + valof (- b))) = a + - b

goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a - b = a + - b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a - b = a + - b

goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a - b = a + - b
is_finite a
is_finite b
is_finite (a - b)

goal (1 subgoal):
 1. (a + - b) \<doteq> (a - b)
[PROOF STEP]
by (metis float_eq)
[PROOF STATE]
proof (state)
this:
(a + - b) \<doteq> (a - b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma carrier_vec_code[code]: "carrier_vec n = Collect_set (\<lambda> v. dim_vec v = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier_vec n = Collect_set (\<lambda>v. dim_vec v = n)
[PROOF STEP]
unfolding carrier_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {v. dim_vec v = n} = Collect_set (\<lambda>v. dim_vec v = n)
[PROOF STEP]
by auto


[STATEMENT]
theorem vsubstEnv_psubstEnv_idEnv:
"(rho &[z // y]_ys) = (rho &[idEnv [y \<leftarrow> Var ys z]_ys])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[z // y]_ys = rho &[idEnv [y \<leftarrow> Var ys z]_ys]
[PROOF STEP]
unfolding vsubstEnv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[Var ys z / y]_ys = rho &[idEnv [y \<leftarrow> Var ys z]_ys]
[PROOF STEP]
by (simp add: substEnv_psubstEnv_idEnv)


[STATEMENT]
lemma unitarily_equiv_carrier':
  assumes "unitarily_equiv A B U"
  shows "A \<in> carrier_mat (dim_row A) (dim_row A)"
    "B \<in> carrier_mat (dim_row A) (dim_row A)"
    "U\<in> carrier_mat (dim_row A) (dim_row A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat (dim_row A) (dim_row A) &&& B \<in> carrier_mat (dim_row A) (dim_row A) &&& U \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A \<in> carrier_mat (dim_row A) (dim_row A)
 2. B \<in> carrier_mat (dim_row A) (dim_row A)
 3. U \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
show "A \<in> carrier_mat (dim_row A) (dim_row A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
by (metis assms carrier_mat_triv similar_mat_witD2(4) unitarily_equivD(2))
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat (dim_row A) (dim_row A)

goal (2 subgoals):
 1. B \<in> carrier_mat (dim_row A) (dim_row A)
 2. U \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
thus "U \<in> carrier_mat (dim_row A) (dim_row A)"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat (dim_row A) (dim_row A)

goal (1 subgoal):
 1. U \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
using assms unitarily_equiv_carrier(2)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat (dim_row A) (dim_row A)
unitarily_equiv A B U
\<lbrakk>?A \<in> carrier_mat ?n ?n; unitarily_equiv ?A ?B ?U\<rbrakk> \<Longrightarrow> ?U \<in> carrier_mat ?n ?n

goal (1 subgoal):
 1. U \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
U \<in> carrier_mat (dim_row A) (dim_row A)

goal (1 subgoal):
 1. B \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
show "B \<in> carrier_mat (dim_row A) (dim_row A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
by (metis assms similar_mat_witD(5) unitarily_equivD(2))
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat (dim_row A) (dim_row A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in cpx_sq_mat) make_pm_square:
  assumes "A\<in> fc_mats"
  and "hermitian A"
and "i < proj_meas_size (make_pm A)"
shows "meas_outcome_prj (proj_meas_outcomes (make_pm A) i) \<in> fc_mats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. meas_outcome_prj (proj_meas_outcomes (make_pm A) i) \<in> fc_mats
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. meas_outcome_prj (proj_meas_outcomes (make_pm A) i) \<in> fc_mats
[PROOF STEP]
have "proj_measurement (proj_meas_size (make_pm A)) (proj_meas_outcomes (make_pm A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_measurement (proj_meas_size (make_pm A)) (proj_meas_outcomes (make_pm A))
[PROOF STEP]
using assms make_pm_proj_measurement'
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
hermitian A
i < proj_meas_size (make_pm A)
\<lbrakk>?A \<in> fc_mats; hermitian ?A\<rbrakk> \<Longrightarrow> proj_measurement (proj_meas_size (make_pm ?A)) (proj_meas_outcomes (make_pm ?A))

goal (1 subgoal):
 1. proj_measurement (proj_meas_size (make_pm A)) (proj_meas_outcomes (make_pm A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
proj_measurement (proj_meas_size (make_pm A)) (proj_meas_outcomes (make_pm A))

goal (1 subgoal):
 1. meas_outcome_prj (proj_meas_outcomes (make_pm A) i) \<in> fc_mats
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
proj_measurement (proj_meas_size (make_pm A)) (proj_meas_outcomes (make_pm A))

goal (1 subgoal):
 1. meas_outcome_prj (proj_meas_outcomes (make_pm A) i) \<in> fc_mats
[PROOF STEP]
using proj_measurement_square assms
[PROOF STATE]
proof (prove)
using this:
proj_measurement (proj_meas_size (make_pm A)) (proj_meas_outcomes (make_pm A))
\<lbrakk>proj_measurement ?p ?M; ?i < ?p\<rbrakk> \<Longrightarrow> meas_outcome_prj (?M ?i) \<in> fc_mats
A \<in> fc_mats
hermitian A
i < proj_meas_size (make_pm A)

goal (1 subgoal):
 1. meas_outcome_prj (proj_meas_outcomes (make_pm A) i) \<in> fc_mats
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
meas_outcome_prj (proj_meas_outcomes (make_pm A) i) \<in> fc_mats

goal:
No subgoals!
[PROOF STEP]
qed