[STATEMENT]
lemma inj_on_finite:
  \<open>finite (f ` A) \<longleftrightarrow> finite A\<close> if \<open>inj_on f A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (f ` A) = finite A
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
inj_on f A

goal (1 subgoal):
 1. finite (f ` A) = finite A
[PROOF STEP]
by (fact finite_image_iff)


[STATEMENT]
lemma convex_rel_open_linear_preimage:
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
  assumes "linear f"
    and "convex S"
    and "rel_open S"
  shows "convex (f -` S) \<and> rel_open (f -` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
proof (cases "f -` (rel_interior S) = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f -` rel_interior S = {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
 2. f -` rel_interior S \<noteq> {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f -` rel_interior S = {}

goal (2 subgoals):
 1. f -` rel_interior S = {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
 2. f -` rel_interior S \<noteq> {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f -` rel_interior S = {}
[PROOF STEP]
have "f -` S = {}"
[PROOF STATE]
proof (prove)
using this:
f -` rel_interior S = {}

goal (1 subgoal):
 1. f -` S = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f -` rel_interior S = {}
linear f
convex S
rel_open S

goal (1 subgoal):
 1. f -` S = {}
[PROOF STEP]
unfolding rel_open_def
[PROOF STATE]
proof (prove)
using this:
f -` rel_interior S = {}
linear f
convex S
rel_interior S = S

goal (1 subgoal):
 1. f -` S = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f -` S = {}

goal (2 subgoals):
 1. f -` rel_interior S = {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
 2. f -` rel_interior S \<noteq> {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f -` S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f -` S = {}

goal (1 subgoal):
 1. convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
unfolding rel_open_def
[PROOF STATE]
proof (prove)
using this:
f -` S = {}

goal (1 subgoal):
 1. convex (f -` S) \<and> rel_interior (f -` S) = f -` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex (f -` S) \<and> rel_open (f -` S)

goal (1 subgoal):
 1. f -` rel_interior S \<noteq> {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f -` rel_interior S \<noteq> {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f -` rel_interior S \<noteq> {}

goal (1 subgoal):
 1. f -` rel_interior S \<noteq> {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f -` rel_interior S \<noteq> {}
[PROOF STEP]
have "rel_open (f -` S)"
[PROOF STATE]
proof (prove)
using this:
f -` rel_interior S \<noteq> {}

goal (1 subgoal):
 1. rel_open (f -` S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f -` rel_interior S \<noteq> {}
linear f
convex S
rel_open S

goal (1 subgoal):
 1. rel_open (f -` S)
[PROOF STEP]
unfolding rel_open_def
[PROOF STATE]
proof (prove)
using this:
f -` rel_interior S \<noteq> {}
linear f
convex S
rel_interior S = S

goal (1 subgoal):
 1. rel_interior (f -` S) = f -` S
[PROOF STEP]
using rel_interior_convex_linear_preimage[of f S]
[PROOF STATE]
proof (prove)
using this:
f -` rel_interior S \<noteq> {}
linear f
convex S
rel_interior S = S
\<lbrakk>linear f; convex S; f -` rel_interior S \<noteq> {}\<rbrakk> \<Longrightarrow> rel_interior (f -` S) = f -` rel_interior S

goal (1 subgoal):
 1. rel_interior (f -` S) = f -` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_open (f -` S)

goal (1 subgoal):
 1. f -` rel_interior S \<noteq> {} \<Longrightarrow> convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_open (f -` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rel_open (f -` S)

goal (1 subgoal):
 1. convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
using convex_linear_vimage assms
[PROOF STATE]
proof (prove)
using this:
rel_open (f -` S)
\<lbrakk>linear ?f; convex ?S\<rbrakk> \<Longrightarrow> convex (?f -` ?S)
linear f
convex S
rel_open S

goal (1 subgoal):
 1. convex (f -` S) \<and> rel_open (f -` S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex (f -` S) \<and> rel_open (f -` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_topspace_imp_discrete_topology:
   "\<lbrakk>topspace X = U; finite U; Hausdorff_space X\<rbrakk> \<Longrightarrow> X = discrete_topology U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>topspace X = U; finite U; Hausdorff_space X\<rbrakk> \<Longrightarrow> X = discrete_topology U
[PROOF STEP]
using Hausdorff_imp_t1_space finite_t1_space_imp_discrete_topology
[PROOF STATE]
proof (prove)
using this:
Hausdorff_space ?X \<Longrightarrow> t1_space ?X
\<lbrakk>topspace ?X = ?U; finite ?U; t1_space ?X\<rbrakk> \<Longrightarrow> ?X = discrete_topology ?U

goal (1 subgoal):
 1. \<lbrakk>topspace X = U; finite U; Hausdorff_space X\<rbrakk> \<Longrightarrow> X = discrete_topology U
[PROOF STEP]
by blast


[STATEMENT]
lemma LIM_Re: "f \<midarrow>a\<rightarrow> L \<Longrightarrow> (\<lambda>x. Re (f x)) \<midarrow>a\<rightarrow> Re L"
  for f :: "'a::real_normed_vector \<Rightarrow> complex"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> L \<Longrightarrow> (\<lambda>x. Re (f x)) \<midarrow>a\<rightarrow> Re L
[PROOF STEP]
by (simp add: LIM_NSLIM_iff NSLIM_Re)


[STATEMENT]
lemma submachine_simps :
  assumes "is_submachine A B"
shows "initial A = initial B"
and   "states A \<subseteq> states B"
and   "inputs A = inputs B"
and   "outputs A = outputs B"
and   "transitions A \<subseteq> transitions B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (FSM.initial A = FSM.initial B &&& FSM.states A \<subseteq> FSM.states B) &&& FSM.inputs A = FSM.inputs B &&& FSM.outputs A = FSM.outputs B &&& FSM.transitions A \<subseteq> FSM.transitions B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_submachine A B

goal (1 subgoal):
 1. (FSM.initial A = FSM.initial B &&& FSM.states A \<subseteq> FSM.states B) &&& FSM.inputs A = FSM.inputs B &&& FSM.outputs A = FSM.outputs B &&& FSM.transitions A \<subseteq> FSM.transitions B
[PROOF STEP]
unfolding is_submachine.simps
[PROOF STATE]
proof (prove)
using this:
FSM.initial A = FSM.initial B \<and> FSM.transitions A \<subseteq> FSM.transitions B \<and> FSM.inputs A = FSM.inputs B \<and> FSM.outputs A = FSM.outputs B \<and> FSM.states A \<subseteq> FSM.states B

goal (1 subgoal):
 1. (FSM.initial A = FSM.initial B &&& FSM.states A \<subseteq> FSM.states B) &&& FSM.inputs A = FSM.inputs B &&& FSM.outputs A = FSM.outputs B &&& FSM.transitions A \<subseteq> FSM.transitions B
[PROOF STEP]
by blast+


[STATEMENT]
lemma sum_ennreal[simp]: "(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (\<Sum>i\<in>I. ennreal (f i)) = ennreal (sum f I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (\<Sum>i\<in>I. ennreal (f i)) = ennreal (sum f I)
[PROOF STEP]
by (induction I rule: infinite_finite_induct) (auto simp: sum_nonneg)


[STATEMENT]
lemma mono_downclosed_iff: "mono f = (\<forall>Y. downclosed_set Y \<longrightarrow> downclosed_set (f -` Y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f = (\<forall>Y. downclosed_set Y \<longrightarrow> downclosed_set (f -` Y))
[PROOF STEP]
using mono_downclosed downclosed_mono
[PROOF STATE]
proof (prove)
using this:
mono ?f \<Longrightarrow> \<forall>Y. downclosed_set Y \<longrightarrow> downclosed_set (?f -` Y)
\<forall>Y. downclosed_set Y \<longrightarrow> downclosed_set (?f -` Y) \<Longrightarrow> mono ?f

goal (1 subgoal):
 1. mono f = (\<forall>Y. downclosed_set Y \<longrightarrow> downclosed_set (f -` Y))
[PROOF STEP]
by auto


[STATEMENT]
lemma absolutely_integrable_reflect_real[simp]:
  fixes f :: "real \<Rightarrow> 'b::euclidean_space"
  shows "(\<lambda>x. f(-x)) absolutely_integrable_on {-b .. -a} \<longleftrightarrow> f absolutely_integrable_on {a..b::real}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (- x)) absolutely_integrable_on {- b..- a}) = (f absolutely_integrable_on {a..b})
[PROOF STEP]
unfolding box_real[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (- x)) absolutely_integrable_on cbox (- b) (- a)) = (f absolutely_integrable_on cbox a b)
[PROOF STEP]
by (rule absolutely_integrable_reflect)


[STATEMENT]
lemma eq_ket_vec:
  fixes u v:: "complex Matrix.vec"
  assumes "u = v"
  shows "|u\<rangle> = |v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |u\<rangle> = |v\<rangle>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u = v

goal (1 subgoal):
 1. |u\<rangle> = |v\<rangle>
[PROOF STEP]
by simp


[STATEMENT]
theorem (in linorder) rbt_lookup_map: "rbt_lookup (map f t) x = map_option (f x) (rbt_lookup t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rbt_lookup (RBT_Impl.map f t) x = map_option (f x) (rbt_lookup t x)
[PROOF STEP]
by (induct t) (auto simp: antisym_conv3)


[STATEMENT]
lemma not_primepow_Suc_0_nat [simp]: "\<not>primepow (Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> primepow (Suc 0)
[PROOF STEP]
using primepow_gt_Suc_0[of "Suc 0"]
[PROOF STATE]
proof (prove)
using this:
primepow (Suc 0) \<Longrightarrow> Suc 0 < Suc 0

goal (1 subgoal):
 1. \<not> primepow (Suc 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma Setcompr_subset: "\<And>f P S. {f x | x. P x} \<subseteq> S = (\<forall> x. P x \<longrightarrow> f x \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f P S. ({f x |x. P x} \<subseteq> S) = (\<forall>x. P x \<longrightarrow> f x \<in> S)
[PROOF STEP]
by blast


[STATEMENT]
lemma Sublists_conv_Suffixes: "Sublists A = Suffixes (Prefixes A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sublists A = Suffixes (Prefixes A)
[PROOF STEP]
by (auto simp: Sublists_def Prefixes_def Suffixes_def sublist_def)


[STATEMENT]
lemma fps_left_inverse_idempotent_comm_ring1:
  fixes   f :: "'a::comm_ring_1 fps"
  assumes "x * f$0 = 1"
  shows   "fps_left_inverse (fps_left_inverse f x) (f$0) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (fps_left_inverse f x) (f $ 0) = f
[PROOF STEP]
using   assms fps_left_inverse_idempotent_ring1[of x f "f$0"]
[PROOF STATE]
proof (prove)
using this:
x * f $ 0 = (1::'a)
\<lbrakk>x * f $ 0 = (1::'a); f $ 0 * x = (1::'a)\<rbrakk> \<Longrightarrow> fps_left_inverse (fps_left_inverse f x) (f $ 0) = f

goal (1 subgoal):
 1. fps_left_inverse (fps_left_inverse f x) (f $ 0) = f
[PROOF STEP]
by      (simp add: mult.commute)


[STATEMENT]
lemma zero_less_card_calM: "card calM > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card calM
[PROOF STEP]
by (simp add: card_calM zero_less_binomial le_extend_mult zero_less_m)


[STATEMENT]
lemma concat_leaf_nodes_leaves: "(concat (map leaves (leaf_nodes t))) = leaves t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map leaves (leaf_nodes t)) = leaves t
[PROOF STEP]
apply(induction t rule: leaf_nodes.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs. concat (map leaves (leaf_nodes (Leaf xs))) = leaves (Leaf xs)
 2. \<And>ts t. \<lbrakk>\<And>x. x \<in> set (subtrees ts) \<Longrightarrow> concat (map leaves (leaf_nodes x)) = leaves x; concat (map leaves (leaf_nodes t)) = leaves t\<rbrakk> \<Longrightarrow> concat (map leaves (leaf_nodes (Node ts t))) = leaves (Node ts t)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map leaves (leaf_nodes (Leaf xs_))) = leaves (Leaf xs_)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ts t. \<lbrakk>\<And>x. x \<in> set (subtrees ts) \<Longrightarrow> concat (map leaves (leaf_nodes x)) = leaves x; concat (map leaves (leaf_nodes t)) = leaves t\<rbrakk> \<Longrightarrow> concat (map leaves (leaf_nodes (Node ts t))) = leaves (Node ts t)
[PROOF STEP]
subgoal for ts t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> set (subtrees ts) \<Longrightarrow> concat (map leaves (leaf_nodes x)) = leaves x; concat (map leaves (leaf_nodes t)) = leaves t\<rbrakk> \<Longrightarrow> concat (map leaves (leaf_nodes (Node ts t))) = leaves (Node ts t)
[PROOF STEP]
apply(induction ts)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<And>x. x \<in> set (subtrees []) \<Longrightarrow> concat (map leaves (leaf_nodes x)) = leaves x; concat (map leaves (leaf_nodes t)) = leaves t\<rbrakk> \<Longrightarrow> concat (map leaves (leaf_nodes (Node [] t))) = leaves (Node [] t)
 2. \<And>a ts. \<lbrakk>\<lbrakk>\<And>x. x \<in> set (subtrees ts) \<Longrightarrow> concat (map leaves (leaf_nodes x)) = leaves x; concat (map leaves (leaf_nodes t)) = leaves t\<rbrakk> \<Longrightarrow> concat (map leaves (leaf_nodes (Node ts t))) = leaves (Node ts t); \<And>x. x \<in> set (subtrees (a # ts)) \<Longrightarrow> concat (map leaves (leaf_nodes x)) = leaves x; concat (map leaves (leaf_nodes t)) = leaves t\<rbrakk> \<Longrightarrow> concat (map leaves (leaf_nodes (Node (a # ts) t))) = leaves (Node (a # ts) t)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a ts. \<lbrakk>\<lbrakk>\<And>x. x \<in> set (subtrees ts) \<Longrightarrow> concat (map leaves (leaf_nodes x)) = leaves x; concat (map leaves (leaf_nodes t)) = leaves t\<rbrakk> \<Longrightarrow> concat (map leaves (leaf_nodes (Node ts t))) = leaves (Node ts t); \<And>x. x \<in> set (subtrees (a # ts)) \<Longrightarrow> concat (map leaves (leaf_nodes x)) = leaves x; concat (map leaves (leaf_nodes t)) = leaves t\<rbrakk> \<Longrightarrow> concat (map leaves (leaf_nodes (Node (a # ts) t))) = leaves (Node (a # ts) t)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma poly_higher_pderiv_aux2:
  fixes c :: "'a :: {idom, semiring_char_0}"
  shows   "poly ((pderiv ^^ n) ([:-c, 1:] ^ n * p)) c = fact n * poly p c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly ((pderiv ^^ n) ([:- c, 1::'a:] ^ n * p)) c = fact n * poly p c
[PROOF STEP]
proof (induction n arbitrary: p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p. poly ((pderiv ^^ 0) ([:- c, 1::'a:] ^ 0 * p)) c = fact 0 * poly p c
 2. \<And>n p. (\<And>p. poly ((pderiv ^^ n) ([:- c, 1::'a:] ^ n * p)) c = fact n * poly p c) \<Longrightarrow> poly ((pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p)) c = fact (Suc n) * poly p c
[PROOF STEP]
case (Suc n p)
[PROOF STATE]
proof (state)
this:
poly ((pderiv ^^ n) ([:- c, 1::'a:] ^ n * ?p)) c = fact n * poly ?p c

goal (2 subgoals):
 1. \<And>p. poly ((pderiv ^^ 0) ([:- c, 1::'a:] ^ 0 * p)) c = fact 0 * poly p c
 2. \<And>n p. (\<And>p. poly ((pderiv ^^ n) ([:- c, 1::'a:] ^ n * p)) c = fact n * poly p c) \<Longrightarrow> poly ((pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p)) c = fact (Suc n) * poly p c
[PROOF STEP]
have "(pderiv ^^ Suc n) ([:- c, 1:] ^ Suc n * p) =
          (pderiv ^^ n) ([:- c, 1:] ^ Suc n * pderiv p) +
            (pderiv ^^ n) ([:- c, 1:] ^ n * smult (1 + of_nat n) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p) = (pderiv ^^ n) ([:- c, 1::'a:] ^ Suc n * pderiv p) + (pderiv ^^ n) ([:- c, 1::'a:] ^ n * Polynomial.smult ((1::'a) + of_nat n) p)
[PROOF STEP]
by (simp del: funpow.simps power_Suc add: funpow_Suc_right pderiv_mult
          pderiv_power_Suc higher_pderiv_add pderiv_pCons mult_ac)
[PROOF STATE]
proof (state)
this:
(pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p) = (pderiv ^^ n) ([:- c, 1::'a:] ^ Suc n * pderiv p) + (pderiv ^^ n) ([:- c, 1::'a:] ^ n * Polynomial.smult ((1::'a) + of_nat n) p)

goal (2 subgoals):
 1. \<And>p. poly ((pderiv ^^ 0) ([:- c, 1::'a:] ^ 0 * p)) c = fact 0 * poly p c
 2. \<And>n p. (\<And>p. poly ((pderiv ^^ n) ([:- c, 1::'a:] ^ n * p)) c = fact n * poly p c) \<Longrightarrow> poly ((pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p)) c = fact (Suc n) * poly p c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p) = (pderiv ^^ n) ([:- c, 1::'a:] ^ Suc n * pderiv p) + (pderiv ^^ n) ([:- c, 1::'a:] ^ n * Polynomial.smult ((1::'a) + of_nat n) p)

goal (2 subgoals):
 1. \<And>p. poly ((pderiv ^^ 0) ([:- c, 1::'a:] ^ 0 * p)) c = fact 0 * poly p c
 2. \<And>n p. (\<And>p. poly ((pderiv ^^ n) ([:- c, 1::'a:] ^ n * p)) c = fact n * poly p c) \<Longrightarrow> poly ((pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p)) c = fact (Suc n) * poly p c
[PROOF STEP]
have "[:- c, 1:] ^ Suc n * pderiv p = [:- c, 1:] ^ n * ([:-c, 1:] * pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:- c, 1::'a:] ^ Suc n * pderiv p = [:- c, 1::'a:] ^ n * ([:- c, 1::'a:] * pderiv p)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
[:- c, 1::'a:] ^ Suc n * pderiv p = [:- c, 1::'a:] ^ n * ([:- c, 1::'a:] * pderiv p)

goal (2 subgoals):
 1. \<And>p. poly ((pderiv ^^ 0) ([:- c, 1::'a:] ^ 0 * p)) c = fact 0 * poly p c
 2. \<And>n p. (\<And>p. poly ((pderiv ^^ n) ([:- c, 1::'a:] ^ n * p)) c = fact n * poly p c) \<Longrightarrow> poly ((pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p)) c = fact (Suc n) * poly p c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p) = (pderiv ^^ n) ([:- c, 1::'a:] ^ n * ([:- c, 1::'a:] * pderiv p)) + (pderiv ^^ n) ([:- c, 1::'a:] ^ n * Polynomial.smult ((1::'a) + of_nat n) p)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p) = (pderiv ^^ n) ([:- c, 1::'a:] ^ n * ([:- c, 1::'a:] * pderiv p)) + (pderiv ^^ n) ([:- c, 1::'a:] ^ n * Polynomial.smult ((1::'a) + of_nat n) p)

goal (1 subgoal):
 1. poly ((pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p)) c = fact (Suc n) * poly p c
[PROOF STEP]
by (simp add: Suc.IH del: mult_smult_right power_Suc)
[PROOF STATE]
proof (state)
this:
poly ((pderiv ^^ Suc n) ([:- c, 1::'a:] ^ Suc n * p)) c = fact (Suc n) * poly p c

goal (1 subgoal):
 1. \<And>p. poly ((pderiv ^^ 0) ([:- c, 1::'a:] ^ 0 * p)) c = fact 0 * poly p c
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma matrix_to_iarray_fst_Gauss_Jordan_PA:
shows "matrix_to_iarray (fst (Gauss_Jordan_PA A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (fst (Gauss_Jordan_PA A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))
[PROOF STEP]
unfolding Gauss_Jordan_PA_def Gauss_Jordan_iarrays_PA_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (fst (Gauss_Jordan_upt_k_PA A (ncols A - 1))) = fst (Gauss_Jordan_upt_k_iarrays_PA (matrix_to_iarray A) (ncols_iarray (matrix_to_iarray A) - 1))
[PROOF STEP]
using matrix_to_iarray_fst_Gauss_Jordan_upt_k_PA[of "ncols A - 1" A]
[PROOF STATE]
proof (prove)
using this:
ncols A - 1 < ncols A \<Longrightarrow> matrix_to_iarray (fst (Gauss_Jordan_upt_k_PA A (ncols A - 1))) = fst (Gauss_Jordan_upt_k_iarrays_PA (matrix_to_iarray A) (ncols A - 1))

goal (1 subgoal):
 1. matrix_to_iarray (fst (Gauss_Jordan_upt_k_PA A (ncols A - 1))) = fst (Gauss_Jordan_upt_k_iarrays_PA (matrix_to_iarray A) (ncols_iarray (matrix_to_iarray A) - 1))
[PROOF STEP]
by (simp add: ncols_def ncols_eq_card_columns)


[STATEMENT]
lemma weight_spmf_eq_nn_integral_support:
  "weight_spmf p = \<integral>\<^sup>+ x. spmf p x \<partial>count_space (set_spmf p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (weight_spmf p) = \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space (set_spmf p)
[PROOF STEP]
unfolding weight_spmf_eq_nn_integral_spmf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space UNIV = \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space (set_spmf p)
[PROOF STEP]
by(auto simp add: nn_integral_count_space_indicator in_set_spmf_iff_spmf intro!: nn_integral_cong split: split_indicator)


[STATEMENT]
lemma arcsin_arccos_eq: "-1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arcsin x = pi/2 - arccos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> arcsin x = pi / 2 - arccos x
[PROOF STEP]
using arcsin_plus_arccos
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 \<le> ?x; ?x \<le> 1\<rbrakk> \<Longrightarrow> arcsin ?x + arccos ?x = pi / 2

goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> arcsin x = pi / 2 - arccos x
[PROOF STEP]
by force


[STATEMENT]
lemma size_greater_than_median: "size {#y \<in># mset xs. y > median xs#} \<le> length xs div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
proof (cases "xs = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
 2. xs \<noteq> [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
xs \<noteq> []

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
 2. xs \<noteq> [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
hence "length xs > 0"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []

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

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
 2. xs \<noteq> [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
hence less: "(length xs - 1) div 2 < length xs"
[PROOF STATE]
proof (prove)
using this:
0 < length xs

goal (1 subgoal):
 1. (length xs - 1) div 2 < length xs
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(length xs - 1) div 2 < length xs

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
 2. xs \<noteq> [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
have "size {#y \<in># mset xs. y > median xs#} < length xs - (length xs - 1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (filter_mset ((<) (median xs)) (mset xs)) < length xs - (length xs - 1) div 2
[PROOF STEP]
using size_greater_than_select[OF less]
[PROOF STATE]
proof (prove)
using this:
size (filter_mset ((<) (select ((length xs - 1) div 2) xs)) (mset xs)) < length xs - (length xs - 1) div 2

goal (1 subgoal):
 1. size (filter_mset ((<) (median xs)) (mset xs)) < length xs - (length xs - 1) div 2
[PROOF STEP]
by (simp add: median_def)
[PROOF STATE]
proof (state)
this:
size (filter_mset ((<) (median xs)) (mset xs)) < length xs - (length xs - 1) div 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
 2. xs \<noteq> [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size (filter_mset ((<) (median xs)) (mset xs)) < length xs - (length xs - 1) div 2

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
 2. xs \<noteq> [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
have "\<dots> = length xs div 2 + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs - (length xs - 1) div 2 = length xs div 2 + 1
[PROOF STEP]
using \<open>length xs > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < length xs

goal (1 subgoal):
 1. length xs - (length xs - 1) div 2 = length xs div 2 + 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
length xs - (length xs - 1) div 2 = length xs div 2 + 1

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
 2. xs \<noteq> [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size (filter_mset ((<) (median xs)) (mset xs)) < length xs div 2 + 1
[PROOF STEP]
show "size {#y \<in># mset xs. y > median xs#} \<le> length xs div 2"
[PROOF STATE]
proof (prove)
using this:
size (filter_mset ((<) (median xs)) (mset xs)) < length xs div 2 + 1

goal (1 subgoal):
 1. size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2

goal (1 subgoal):
 1. xs = [] \<Longrightarrow> size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2
[PROOF STEP]
qed auto


[STATEMENT]
lemma (in Ring) nprod_eqTr:" f \<in> {j. j \<le> (n::nat)} \<rightarrow> carrier R \<and>
       g \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> (\<forall>j \<le> n. f j = g j) \<longrightarrow>
       nprod R f n = nprod R g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> g \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> (\<forall>j\<le>n. f j = g j) \<longrightarrow> e\<Pi>\<^bsub>R,n\<^esub> f = e\<Pi>\<^bsub>R,n\<^esub> g
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f \<in> {j. j \<le> 0} \<rightarrow> carrier R \<and> g \<in> {j. j \<le> 0} \<rightarrow> carrier R \<and> (\<forall>j\<le>0. f j = g j) \<longrightarrow> e\<Pi>\<^bsub>R,0\<^esub> f = e\<Pi>\<^bsub>R,0\<^esub> g
 2. \<And>n. f \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> g \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> (\<forall>j\<le>n. f j = g j) \<longrightarrow> e\<Pi>\<^bsub>R,n\<^esub> f = e\<Pi>\<^bsub>R,n\<^esub> g \<Longrightarrow> f \<in> {j. j \<le> Suc n} \<rightarrow> carrier R \<and> g \<in> {j. j \<le> Suc n} \<rightarrow> carrier R \<and> (\<forall>j\<le>Suc n. f j = g j) \<longrightarrow> e\<Pi>\<^bsub>R,Suc n\<^esub> f = e\<Pi>\<^bsub>R,Suc n\<^esub> g
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. f \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> g \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> (\<forall>j\<le>n. f j = g j) \<longrightarrow> e\<Pi>\<^bsub>R,n\<^esub> f = e\<Pi>\<^bsub>R,n\<^esub> g \<Longrightarrow> f \<in> {j. j \<le> Suc n} \<rightarrow> carrier R \<and> g \<in> {j. j \<le> Suc n} \<rightarrow> carrier R \<and> (\<forall>j\<le>Suc n. f j = g j) \<longrightarrow> e\<Pi>\<^bsub>R,Suc n\<^esub> f = e\<Pi>\<^bsub>R,Suc n\<^esub> g
[PROOF STEP]
apply (rule impI, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> g \<in> {j. j \<le> n} \<rightarrow> carrier R \<and> (\<forall>j\<le>n. f j = g j) \<longrightarrow> e\<Pi>\<^bsub>R,n\<^esub> f = e\<Pi>\<^bsub>R,n\<^esub> g; f \<in> {j. j \<le> Suc n} \<rightarrow> carrier R; g \<in> {j. j \<le> Suc n} \<rightarrow> carrier R; \<forall>j\<le>Suc n. f j = g j\<rbrakk> \<Longrightarrow> e\<Pi>\<^bsub>R,Suc n\<^esub> f = e\<Pi>\<^bsub>R,Suc n\<^esub> g
[PROOF STEP]
apply (frule func_pre[of f], frule func_pre[of g],
         cut_tac n = n in Nsetn_sub_mem1, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in comm_group) abelian_ord_mul_divides:
   "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
        \<Longrightarrow> ord (x \<otimes> y) dvd (ord x * ord y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> ord (x \<otimes> y) dvd ord x * ord y
[PROOF STEP]
by (simp add: ord_mul_divides m_comm)


[STATEMENT]
lemma integral_eucl_le:
  fixes f g::"'a::euclidean_space \<Rightarrow> 'b::ordered_euclidean_space"
  assumes "f integrable_on s"
    and "g integrable_on s"
    and "\<And>x. x \<in> s \<Longrightarrow> f x \<le> g x"
  shows "integral s f \<le> integral s g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral s f \<le> integral s g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f integrable_on s
g integrable_on s
?x \<in> s \<Longrightarrow> f ?x \<le> g ?x

goal (1 subgoal):
 1. integral s f \<le> integral s g
[PROOF STEP]
by (auto intro!: integral_component_le simp: eucl_le[where 'a='b])


[STATEMENT]
theorem homomorphism_thm:
  assumes "group_hom G G h"
  shows "G Mod kernel G (G\<lparr>carrier := h ` carrier G\<rparr>) h \<cong> G \<lparr>carrier := h ` carrier G\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G Mod kernel G (G\<lparr>carrier := h ` carrier G\<rparr>) h \<cong> G\<lparr>carrier := h ` carrier G\<rparr>
[PROOF STEP]
by (intro group_hom.FactGroup_iso group_hom_imp_group_hom_image assms) simp


[STATEMENT]
lemma CARD_length_enum: "CARD('a) = length ENUM('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a) = length enum_class.enum
[PROOF STEP]
by (simp add: length_enum_CARD)


[STATEMENT]
lemma foldr_scene_concat:
  "\<lbrakk> pairwise (##\<^sub>S) (set (concat xs)) \<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S (concat xs) = \<Squnion>\<^sub>S (map \<Squnion>\<^sub>S xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (##\<^sub>S) (set (concat xs)) \<Longrightarrow> \<Squnion>\<^sub>S (concat xs) = \<Squnion>\<^sub>S (map \<Squnion>\<^sub>S xs)
[PROOF STEP]
by (induct xs, simp_all, metis foldr_append foldr_scene_append pairwise_subset set_append set_concat sup_ge2)


[STATEMENT]
theorem exp_cf5_upper_bound_pos: "0 \<le> x \<Longrightarrow> numer_cf5 (-x) > 0 \<Longrightarrow> exp x \<le> exp_cf5 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 < numer_cf5 (- x)\<rbrakk> \<Longrightarrow> exp x \<le> exp_cf5 x
[PROOF STEP]
using ln_exp_cf5_upper_bound_nonneg [of x] exp_cf5_pos [of x] numer_cf5_pos [of x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> x; 0 < numer_cf5 (- x)\<rbrakk> \<Longrightarrow> x \<le> ln (exp_cf5 x)
\<lbrakk>0 < numer_cf5 x; 0 < numer_cf5 (- x)\<rbrakk> \<Longrightarrow> 0 < exp_cf5 x
- (7293 / 10 ^ 3) \<le> x \<Longrightarrow> 0 < numer_cf5 x

goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 < numer_cf5 (- x)\<rbrakk> \<Longrightarrow> exp x \<le> exp_cf5 x
[PROOF STEP]
by auto (metis exp_le_cancel_iff exp_ln_iff)


[STATEMENT]
lemma fixed_length_sublist_plus:
assumes "length xs1 = c * l" "length xs2 = c * l" "i < c"
shows "fixed_length_sublist (vec_plus xs1 xs2) l i
          = vec_plus (fixed_length_sublist xs1 l i) (fixed_length_sublist xs2 l i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fixed_length_sublist (vec_plus xs1 xs2) l i = vec_plus (fixed_length_sublist xs1 l i) (fixed_length_sublist xs2 l i)
[PROOF STEP]
unfolding vec_plus_def fixed_length_sublist_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take l (drop (l * i) (map2 (+) xs1 xs2)) = map2 (+) (take l (drop (l * i) xs1)) (take l (drop (l * i) xs2))
[PROOF STEP]
using drop_map drop_zip take_map take_zip
[PROOF STATE]
proof (prove)
using this:
drop ?n (map ?f ?xs) = map ?f (drop ?n ?xs)
drop ?n (zip ?xs ?ys) = zip (drop ?n ?xs) (drop ?n ?ys)
take ?n (map ?f ?xs) = map ?f (take ?n ?xs)
take ?n (zip ?xs ?ys) = zip (take ?n ?xs) (take ?n ?ys)

goal (1 subgoal):
 1. take l (drop (l * i) (map2 (+) xs1 xs2)) = map2 (+) (take l (drop (l * i) xs1)) (take l (drop (l * i) xs2))
[PROOF STEP]
by metis


[STATEMENT]
lemma "((P \<and> (Q\<longrightarrow>R))\<longrightarrow>S)  =  ((\<not>P \<or> Q \<or> S) \<and> (\<not>P \<or> \<not>R \<or> S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<and> (Q \<longrightarrow> R) \<longrightarrow> S) = ((\<not> P \<or> Q \<or> S) \<and> (\<not> P \<or> \<not> R \<or> S))
[PROOF STEP]
by blast


[STATEMENT]
lemma powhr_minus: "\<And>a x. x powhr (- a) = inverse (x powhr a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a x. x powhr - a = inverse (x powhr a)
[PROOF STEP]
by transfer (rule powr_minus)


[STATEMENT]
lemma bigo_sum2: "\<forall>y. 0 <= h y \<Longrightarrow>
    \<exists>c. \<forall>y. \<bar>f y\<bar> <= c * (h y) \<Longrightarrow>
      (\<lambda>x. \<Sum>y \<in> A x. f y) =o O(\<lambda>x. \<Sum>y \<in> A x. h y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>y. (0::'b) \<le> h y; \<exists>c. \<forall>y. \<bar>f y\<bar> \<le> c * h y\<rbrakk> \<Longrightarrow> (\<lambda>x. sum f (A x)) \<in> O(\<lambda>x. sum h (A x))
[PROOF STEP]
apply (rule bigo_sum1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>y. (0::'b) \<le> h y; \<exists>c. \<forall>y. \<bar>f y\<bar> \<le> c * h y\<rbrakk> \<Longrightarrow> \<forall>x y. (0::'b) \<le> h y
 2. \<lbrakk>\<forall>y. (0::'b) \<le> h y; \<exists>c. \<forall>y. \<bar>f y\<bar> \<le> c * h y\<rbrakk> \<Longrightarrow> \<exists>c. \<forall>x y. \<bar>f y\<bar> \<le> c * h y
[PROOF STEP]
by metis+


[STATEMENT]
lemma M_1_1: "M 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M 1 = 1
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 mod m = 1
[PROOF STEP]
unfolding m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 mod int CARD('a) = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma finitely_many_partition_on:
  assumes "finite A"
  shows "finite {P. partition_on A P}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {P. partition_on A P}
[PROOF STEP]
proof (rule finite_subset)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {P. partition_on A P} \<subseteq> ?B
 2. finite ?B
[PROOF STEP]
show "{P. partition_on A P} \<subseteq> Pow (Pow A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {P. partition_on A P} \<subseteq> Pow (Pow A)
[PROOF STEP]
unfolding partition_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {P. \<Union> P = A \<and> disjoint P \<and> {} \<notin> P} \<subseteq> Pow (Pow A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{P. partition_on A P} \<subseteq> Pow (Pow A)

goal (1 subgoal):
 1. finite (Pow (Pow A))
[PROOF STEP]
show "finite (Pow (Pow A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Pow (Pow A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite (Pow (Pow A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (Pow (Pow A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lim_1_over_Ln: "((\<lambda>n. 1 / Ln(of_nat n)) \<longlongrightarrow> 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / Ln (of_nat n)) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (clarsimp simp add: lim_sequentially dist_norm norm_divide field_split_simps)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
fix r::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
assume "0 < r"
[PROOF STATE]
proof (state)
this:
0 < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
have ir: "inverse (exp (inverse r)) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < inverse (exp (inverse r))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < inverse (exp (inverse r))

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
obtain n where n: "1 < of_nat n * inverse (exp (inverse r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. 1 < real n * inverse (exp (inverse r)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_less_of_nat_mult [of _ 1, OF ir]
[PROOF STATE]
proof (prove)
using this:
\<exists>n. 1 < real n * inverse (exp (inverse r))

goal (1 subgoal):
 1. (\<And>n. 1 < real n * inverse (exp (inverse r)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < real n * inverse (exp (inverse r))

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < real n * inverse (exp (inverse r))
[PROOF STEP]
have "exp (inverse r) < of_nat n"
[PROOF STATE]
proof (prove)
using this:
1 < real n * inverse (exp (inverse r))

goal (1 subgoal):
 1. exp (inverse r) < real n
[PROOF STEP]
by (simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
exp (inverse r) < real n

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exp (inverse r) < real n
[PROOF STEP]
have "ln (exp (inverse r)) < ln (of_nat n)"
[PROOF STATE]
proof (prove)
using this:
exp (inverse r) < real n

goal (1 subgoal):
 1. ln (exp (inverse r)) < ln (real n)
[PROOF STEP]
by (metis exp_gt_zero less_trans ln_exp ln_less_cancel_iff)
[PROOF STATE]
proof (state)
this:
ln (exp (inverse r)) < ln (real n)

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
with \<open>0 < r\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < r
ln (exp (inverse r)) < ln (real n)
[PROOF STEP]
have "1 < r * ln (real_of_nat n)"
[PROOF STATE]
proof (prove)
using this:
0 < r
ln (exp (inverse r)) < ln (real n)

goal (1 subgoal):
 1. 1 < r * ln (real n)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
1 < r * ln (real n)

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 < r * ln (real n)

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
have "n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
1 < real n * inverse (exp (inverse r))

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
using neq0_conv
[PROOF STATE]
proof (prove)
using this:
1 < real n * inverse (exp (inverse r))
(?n \<noteq> 0) = (0 < ?n)

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n. Ln (of_nat n) \<noteq> 0 \<longrightarrow> no \<le> n \<longrightarrow> 1 < r * cmod (Ln (of_nat n))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 < r * ln (real n)
0 < n
[PROOF STEP]
show "\<exists>no. \<forall>k. Ln (of_nat k) \<noteq> 0 \<longrightarrow> no \<le> k \<longrightarrow> 1 < r * cmod (Ln (of_nat k))"
[PROOF STATE]
proof (prove)
using this:
1 < r * ln (real n)
0 < n

goal (1 subgoal):
 1. \<exists>no. \<forall>k. Ln (of_nat k) \<noteq> 0 \<longrightarrow> no \<le> k \<longrightarrow> 1 < r * cmod (Ln (of_nat k))
[PROOF STEP]
using n \<open>0 < r\<close>
[PROOF STATE]
proof (prove)
using this:
1 < r * ln (real n)
0 < n
1 < real n * inverse (exp (inverse r))
0 < r

goal (1 subgoal):
 1. \<exists>no. \<forall>k. Ln (of_nat k) \<noteq> 0 \<longrightarrow> no \<le> k \<longrightarrow> 1 < r * cmod (Ln (of_nat k))
[PROOF STEP]
by (rule_tac x=n in exI) (force simp: field_split_simps intro: less_le_trans)
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>k. Ln (of_nat k) \<noteq> 0 \<longrightarrow> no \<le> k \<longrightarrow> 1 < r * cmod (Ln (of_nat k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma non_empty_col_01:
  assumes "j < dim_col M"
  shows "non_empty_col M j \<longleftrightarrow> 1 \<in>$ col M j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. non_empty_col M j = ((1::'b) \<in>$ col M j)
[PROOF STEP]
proof (intro iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. non_empty_col M j \<Longrightarrow> (1::'b) \<in>$ col M j
 2. (1::'b) \<in>$ col M j \<Longrightarrow> non_empty_col M j
[PROOF STEP]
assume "non_empty_col M j"
[PROOF STATE]
proof (state)
this:
non_empty_col M j

goal (2 subgoals):
 1. non_empty_col M j \<Longrightarrow> (1::'b) \<in>$ col M j
 2. (1::'b) \<in>$ col M j \<Longrightarrow> non_empty_col M j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
non_empty_col M j
[PROOF STEP]
obtain k where kn0: "k \<noteq> 0" and kin: "k \<in>$ col M j"
[PROOF STATE]
proof (prove)
using this:
non_empty_col M j

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k \<noteq> (0::'b); k \<in>$ col M j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using non_empty_col_def
[PROOF STATE]
proof (prove)
using this:
non_empty_col M j
non_empty_col ?M ?j \<equiv> \<exists>k. k \<noteq> (0::?'a) \<and> k \<in>$ col ?M ?j

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k \<noteq> (0::'b); k \<in>$ col M j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
k \<noteq> (0::'b)
k \<in>$ col M j

goal (2 subgoals):
 1. non_empty_col M j \<Longrightarrow> (1::'b) \<in>$ col M j
 2. (1::'b) \<in>$ col M j \<Longrightarrow> non_empty_col M j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> (0::'b)
k \<in>$ col M j
[PROOF STEP]
have "k \<in> elements_mat M"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> (0::'b)
k \<in>$ col M j

goal (1 subgoal):
 1. k \<in> elements_mat M
[PROOF STEP]
using vec_contains_col_elements_mat assms
[PROOF STATE]
proof (prove)
using this:
k \<noteq> (0::'b)
k \<in>$ col M j
\<lbrakk>?j < dim_col ?M; ?a \<in>$ col ?M ?j\<rbrakk> \<Longrightarrow> ?a \<in> elements_mat ?M
j < dim_col M

goal (1 subgoal):
 1. k \<in> elements_mat M
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
k \<in> elements_mat M

goal (2 subgoals):
 1. non_empty_col M j \<Longrightarrow> (1::'b) \<in>$ col M j
 2. (1::'b) \<in>$ col M j \<Longrightarrow> non_empty_col M j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<in> elements_mat M
[PROOF STEP]
have "k = 1"
[PROOF STATE]
proof (prove)
using this:
k \<in> elements_mat M

goal (1 subgoal):
 1. k = (1::'b)
[PROOF STEP]
using kn0
[PROOF STATE]
proof (prove)
using this:
k \<in> elements_mat M
k \<noteq> (0::'b)

goal (1 subgoal):
 1. k = (1::'b)
[PROOF STEP]
using elems01
[PROOF STATE]
proof (prove)
using this:
k \<in> elements_mat M
k \<noteq> (0::'b)
elements_mat M \<subseteq> {0::'b, 1::'b}

goal (1 subgoal):
 1. k = (1::'b)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
k = (1::'b)

goal (2 subgoals):
 1. non_empty_col M j \<Longrightarrow> (1::'b) \<in>$ col M j
 2. (1::'b) \<in>$ col M j \<Longrightarrow> non_empty_col M j
[PROOF STEP]
thus "1 \<in>$ col M j"
[PROOF STATE]
proof (prove)
using this:
k = (1::'b)

goal (1 subgoal):
 1. (1::'b) \<in>$ col M j
[PROOF STEP]
using kin
[PROOF STATE]
proof (prove)
using this:
k = (1::'b)
k \<in>$ col M j

goal (1 subgoal):
 1. (1::'b) \<in>$ col M j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1::'b) \<in>$ col M j

goal (1 subgoal):
 1. (1::'b) \<in>$ col M j \<Longrightarrow> non_empty_col M j
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1::'b) \<in>$ col M j \<Longrightarrow> non_empty_col M j
[PROOF STEP]
assume "1 \<in>$ col M j"
[PROOF STATE]
proof (state)
this:
(1::'b) \<in>$ col M j

goal (1 subgoal):
 1. (1::'b) \<in>$ col M j \<Longrightarrow> non_empty_col M j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1::'b) \<in>$ col M j
[PROOF STEP]
show "non_empty_col M j"
[PROOF STATE]
proof (prove)
using this:
(1::'b) \<in>$ col M j

goal (1 subgoal):
 1. non_empty_col M j
[PROOF STEP]
using non_empty_col_def
[PROOF STATE]
proof (prove)
using this:
(1::'b) \<in>$ col M j
non_empty_col ?M ?j \<equiv> \<exists>k. k \<noteq> (0::?'a) \<and> k \<in>$ col ?M ?j

goal (1 subgoal):
 1. non_empty_col M j
[PROOF STEP]
by (metis zero_neq_one)
[PROOF STATE]
proof (state)
this:
non_empty_col M j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pseudo_inverse_finite_set:
  fixes u::"nat \<Rightarrow> nat"
  assumes "LIM n sequentially. u n :> at_top"
  shows "finite {N. u N \<le> n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {N. u N \<le> n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {N. u N \<le> n}
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {N. u N \<le> n}
[PROOF STEP]
have "eventually (\<lambda>N. u N \<ge> n+1) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F N in sequentially. n + 1 \<le> u N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
filterlim u sequentially sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F N in sequentially. n + 1 \<le> u N
[PROOF STEP]
by (simp add: filterlim_at_top)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F N in sequentially. n + 1 \<le> u N

goal (1 subgoal):
 1. finite {N. u N \<le> n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F N in sequentially. n + 1 \<le> u N
[PROOF STEP]
obtain N1 where N1: "\<And>N. N \<ge> N1 \<Longrightarrow> u N \<ge> n + 1"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F N in sequentially. n + 1 \<le> u N

goal (1 subgoal):
 1. (\<And>N1. (\<And>N. N1 \<le> N \<Longrightarrow> n + 1 \<le> u N) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F N in sequentially. n + 1 \<le> u N
eventually ?P sequentially = (\<exists>N. \<forall>n\<ge>N. ?P n)

goal (1 subgoal):
 1. (\<And>N1. (\<And>N. N1 \<le> N \<Longrightarrow> n + 1 \<le> u N) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N1 \<le> ?N \<Longrightarrow> n + 1 \<le> u ?N

goal (1 subgoal):
 1. finite {N. u N \<le> n}
[PROOF STEP]
have "{N. u N \<le> n} \<subseteq> {..<N1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {N. u N \<le> n} \<subseteq> {..<N1}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. u x \<le> n \<Longrightarrow> x < N1
[PROOF STEP]
using N1
[PROOF STATE]
proof (prove)
using this:
N1 \<le> ?N \<Longrightarrow> n + 1 \<le> u ?N

goal (1 subgoal):
 1. \<And>x. u x \<le> n \<Longrightarrow> x < N1
[PROOF STEP]
by (metis Suc_eq_plus1 not_less not_less_eq_eq)
[PROOF STATE]
proof (state)
this:
{N. u N \<le> n} \<subseteq> {..<N1}

goal (1 subgoal):
 1. finite {N. u N \<le> n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{N. u N \<le> n} \<subseteq> {..<N1}
[PROOF STEP]
show "finite {N. u N \<le> n}"
[PROOF STATE]
proof (prove)
using this:
{N. u N \<le> n} \<subseteq> {..<N1}

goal (1 subgoal):
 1. finite {N. u N \<le> n}
[PROOF STEP]
by (simp add: finite_subset)
[PROOF STATE]
proof (state)
this:
finite {N. u N \<le> n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_sorted_wrt_exists:
  assumes "linorder_on A R" "finite B" "B \<subseteq> A"
  shows   "\<exists>xs. set xs = B \<and> distinct xs \<and> sorted_wrt R xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xs. set xs = B \<and> distinct xs \<and> Linorder_Relations.sorted_wrt R xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>xs. set xs = B \<and> distinct xs \<and> Linorder_Relations.sorted_wrt R xs
[PROOF STEP]
from \<open>finite B\<close>
[PROOF STATE]
proof (chain)
picking this:
finite B
[PROOF STEP]
obtain xs where "set xs = B" "distinct xs"
[PROOF STATE]
proof (prove)
using this:
finite B

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>set xs = B; distinct xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_distinct_list
[PROOF STATE]
proof (prove)
using this:
finite B
finite ?A \<Longrightarrow> \<exists>xs. set xs = ?A \<and> distinct xs

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>set xs = B; distinct xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set xs = B
distinct xs

goal (1 subgoal):
 1. \<exists>xs. set xs = B \<and> distinct xs \<and> Linorder_Relations.sorted_wrt R xs
[PROOF STEP]
hence "set (insort_wrt R xs) = B" "distinct (insort_wrt R xs)"
[PROOF STATE]
proof (prove)
using this:
set xs = B
distinct xs

goal (1 subgoal):
 1. set (insort_wrt R xs) = B &&& distinct (insort_wrt R xs)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
set (insort_wrt R xs) = B
distinct (insort_wrt R xs)

goal (1 subgoal):
 1. \<exists>xs. set xs = B \<and> distinct xs \<and> Linorder_Relations.sorted_wrt R xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (insort_wrt R xs) = B
distinct (insort_wrt R xs)

goal (1 subgoal):
 1. \<exists>xs. set xs = B \<and> distinct xs \<and> Linorder_Relations.sorted_wrt R xs
[PROOF STEP]
have "sorted_wrt R (insort_wrt R xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (insort_wrt R xs)
[PROOF STEP]
using assms \<open>set xs = B\<close>
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
finite B
B \<subseteq> A
set xs = B

goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (insort_wrt R xs)
[PROOF STEP]
by (intro sorted_wrt_insort[OF assms(1)]) auto
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R (insort_wrt R xs)

goal (1 subgoal):
 1. \<exists>xs. set xs = B \<and> distinct xs \<and> Linorder_Relations.sorted_wrt R xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (insort_wrt R xs) = B
distinct (insort_wrt R xs)
Linorder_Relations.sorted_wrt R (insort_wrt R xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (insort_wrt R xs) = B
distinct (insort_wrt R xs)
Linorder_Relations.sorted_wrt R (insort_wrt R xs)

goal (1 subgoal):
 1. \<exists>xs. set xs = B \<and> distinct xs \<and> Linorder_Relations.sorted_wrt R xs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>xs. set xs = B \<and> distinct xs \<and> Linorder_Relations.sorted_wrt R xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [simp]: "(n::nat) < N \<Longrightarrow> 0 \<le> 1 - 1 / N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < N \<Longrightarrow> 0 \<le> 1 - 1 / real N
[PROOF STEP]
by (simp add: divide_simps)


[STATEMENT]
lemma (in prob_space) integral_ge_const:
  fixes c :: real
  shows "integrable M f \<Longrightarrow> (AE x in M. c \<le> f x) \<Longrightarrow> c \<le> (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>integrable M f; AE x in M. c \<le> f x\<rbrakk> \<Longrightarrow> c \<le> expectation f
[PROOF STEP]
using integral_mono_AE[of M "\<lambda>x. c" f] prob_space
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable M (\<lambda>x. c); integrable M f; AE x in M. c \<le> f x\<rbrakk> \<Longrightarrow> expectation (\<lambda>x. c) \<le> expectation f
prob (space M) = 1

goal (1 subgoal):
 1. \<lbrakk>integrable M f; AE x in M. c \<le> f x\<rbrakk> \<Longrightarrow> c \<le> expectation f
[PROOF STEP]
by simp


[STATEMENT]
lemma berlekamp_resulting_mat_basis:
"kernel.basis (degree u) (berlekamp_resulting_mat u) (set (find_base_vectors (berlekamp_resulting_mat u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.basis class_ring (module_vec TYPE('b mod_ring) (degree u)\<lparr>carrier := mat_kernel (berlekamp_resulting_mat u)\<rparr>) (set (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
proof (rule find_base_vectors(3))
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. row_echelon_form (berlekamp_resulting_mat u)
 2. berlekamp_resulting_mat u \<in> carrier_mat ?nr (degree u)
[PROOF STEP]
show "berlekamp_resulting_mat u \<in> carrier_mat (degree u) (degree u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. berlekamp_resulting_mat u \<in> carrier_mat (degree u) (degree u)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
berlekamp_resulting_mat u \<in> carrier_mat (degree u) (degree u)

goal (1 subgoal):
 1. row_echelon_form (berlekamp_resulting_mat u)
[PROOF STEP]
let ?A="(transpose_mat (mat (degree u) (degree u)
          (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. row_echelon_form (berlekamp_resulting_mat u)
[PROOF STEP]
have "row_echelon_form (gauss_jordan_single ?A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_echelon_form (gauss_jordan_single (mat (degree u) (degree u) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T)
[PROOF STEP]
by (rule gauss_jordan_single(3)[of ?A], auto)
[PROOF STATE]
proof (state)
this:
row_echelon_form (gauss_jordan_single (mat (degree u) (degree u) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T)

goal (1 subgoal):
 1. row_echelon_form (berlekamp_resulting_mat u)
[PROOF STEP]
thus "row_echelon_form (berlekamp_resulting_mat u)"
[PROOF STATE]
proof (prove)
using this:
row_echelon_form (gauss_jordan_single (mat (degree u) (degree u) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T)

goal (1 subgoal):
 1. row_echelon_form (berlekamp_resulting_mat u)
[PROOF STEP]
unfolding berlekamp_resulting_mat_def Let_def
[PROOF STATE]
proof (prove)
using this:
row_echelon_form (gauss_jordan_single (mat (degree u) (degree u) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T)

goal (1 subgoal):
 1. row_echelon_form (gauss_jordan_single (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_echelon_form (berlekamp_resulting_mat u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma atLeast_subset_iff[iff]: "({x\<le>\<^sub>a..} \<subseteq> {y\<le>\<^sub>a..}) = (y \<le>\<^sub>a x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x\<le>\<^sub>a..} \<subseteq> {y\<le>\<^sub>a..}) = (y \<le>\<^sub>a x)
[PROOF STEP]
by (auto intro: order_trans)


[STATEMENT]
lemma exp_times_arg_commute: "exp A * A = A * exp A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp A * A = A * exp A
[PROOF STEP]
by (simp add: exp_def suminf_mult[symmetric] summable_exp_generic power_commutes suminf_mult2)


[STATEMENT]
lemma \<psi>\<^sub>1\<^sub>0_is_state:
  assumes "n \<ge> 1"
  shows "state n (\<psi>\<^sub>1\<^sub>0 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. state n (Matrix.mat (2 ^ n) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> 1 / sqrt 2 ^ n)))
[PROOF STEP]
using iter_tensor_of_H_is_gate \<psi>\<^sub>1\<^sub>0_tensor_is_state assms gate_on_state_is_state iter_tensor_of_H_on_zero_tensor assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> ?n \<Longrightarrow> gate ?n (H \<otimes>\<^bsup>?n\<^esup>)
1 \<le> ?n \<Longrightarrow> state ?n (|Deutsch.zero\<rangle> \<otimes>\<^bsup>?n\<^esup>)
1 \<le> n
\<lbrakk>gate ?n ?A; state ?n ?v\<rbrakk> \<Longrightarrow> state ?n (?A * ?v)
1 \<le> ?n \<Longrightarrow> H \<otimes>\<^bsup>?n\<^esup> * |Deutsch.zero\<rangle> \<otimes>\<^bsup>?n\<^esup> = Matrix.mat (2 ^ ?n) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> 1 / sqrt 2 ^ ?n))
1 \<le> n

goal (1 subgoal):
 1. state n (Matrix.mat (2 ^ n) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> 1 / sqrt 2 ^ n)))
[PROOF STEP]
by metis


[STATEMENT]
theorem exE': "(\<And>x. P x \<Longrightarrow> Q) \<Longrightarrow> \<exists>x. P x \<Longrightarrow> Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. P x \<Longrightarrow> Q; \<exists>x. P x\<rbrakk> \<Longrightarrow> Q
[PROOF STEP]
by auto


[STATEMENT]
lemma mods_with_vec:
  assumes "v <\<^sub>v w"
    and "0 \<notin> set b"
    and "length b = length w"
    and "(v \<bullet> b) mod a = (w \<bullet> b) mod a"
  shows "((w -\<^sub>v v) \<bullet> b) mod a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = 0
[PROOF STEP]
have *: "v \<bullet> b < w \<bullet> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet> b < w \<bullet> b
[PROOF STEP]
using dotprod_less_left and assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length ?b = length ?w; 0 \<notin> set ?b; ?v <\<^sub>v ?w\<rbrakk> \<Longrightarrow> ?v \<bullet> ?b < ?w \<bullet> ?b
v <\<^sub>v w
0 \<notin> set b
length b = length w
v \<bullet> b mod a = w \<bullet> b mod a

goal (1 subgoal):
 1. v \<bullet> b < w \<bullet> b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v \<bullet> b < w \<bullet> b

goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = 0
[PROOF STEP]
have "v \<le>\<^sub>v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<le>\<^sub>v w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v <\<^sub>v w
0 \<notin> set b
length b = length w
v \<bullet> b mod a = w \<bullet> b mod a

goal (1 subgoal):
 1. v \<le>\<^sub>v w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<le>\<^sub>v w

goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = 0
[PROOF STEP]
from vdiff_dotprod_distr [OF assms(3) this]
[PROOF STATE]
proof (chain)
picking this:
(w -\<^sub>v v) \<bullet> b = w \<bullet> b - v \<bullet> b
[PROOF STEP]
have "((w -\<^sub>v v) \<bullet> b) mod a = (w \<bullet> b - v \<bullet> b) mod a "
[PROOF STATE]
proof (prove)
using this:
(w -\<^sub>v v) \<bullet> b = w \<bullet> b - v \<bullet> b

goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = (w \<bullet> b - v \<bullet> b) mod a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(w -\<^sub>v v) \<bullet> b mod a = (w \<bullet> b - v \<bullet> b) mod a

goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(w -\<^sub>v v) \<bullet> b mod a = (w \<bullet> b - v \<bullet> b) mod a

goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = 0
[PROOF STEP]
have "... = 0 mod a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w \<bullet> b - v \<bullet> b) mod a = 0 mod a
[PROOF STEP]
using mods_with_nats [of "v \<bullet> b" "w \<bullet> b" "1" a, OF *] assms
[PROOF STATE]
proof (prove)
using this:
w \<bullet> b * 1 mod a = v \<bullet> b * 1 mod a \<Longrightarrow> (w \<bullet> b - v \<bullet> b) * 1 mod a = 0
v <\<^sub>v w
0 \<notin> set b
length b = length w
v \<bullet> b mod a = w \<bullet> b mod a

goal (1 subgoal):
 1. (w \<bullet> b - v \<bullet> b) mod a = 0 mod a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(w \<bullet> b - v \<bullet> b) mod a = 0 mod a

goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(w -\<^sub>v v) \<bullet> b mod a = 0 mod a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(w -\<^sub>v v) \<bullet> b mod a = 0 mod a

goal (1 subgoal):
 1. (w -\<^sub>v v) \<bullet> b mod a = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(w -\<^sub>v v) \<bullet> b mod a = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_of_image_mset:
  assumes "trans R" and "trans R'"
  and "\<And>x y. x \<in> set_mset N \<Longrightarrow> y \<in> set_mset M \<Longrightarrow> (x,y) \<in> R \<Longrightarrow> (f x, f y) \<in> R'"
  and "(N, M) \<in> mult R"
  shows "(image_mset f N, image_mset f M) \<in> mult R'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (image_mset f N, image_mset f M) \<in> mult R'
[PROOF STEP]
proof (insert assms(4), elim multE[OF assms(1)])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>I J K. \<lbrakk>N = I + K; M = I + J; J \<noteq> {#}; \<forall>k\<in>#K. \<exists>j\<in>#J. (k, j) \<in> R\<rbrakk> \<Longrightarrow> (image_mset f N, image_mset f M) \<in> mult R'
[PROOF STEP]
fix I J K
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>I J K. \<lbrakk>N = I + K; M = I + J; J \<noteq> {#}; \<forall>k\<in>#K. \<exists>j\<in>#J. (k, j) \<in> R\<rbrakk> \<Longrightarrow> (image_mset f N, image_mset f M) \<in> mult R'
[PROOF STEP]
assume "N = I + K" "M = I + J" "J \<noteq> {#}" "\<forall>k \<in> set_mset K. \<exists>j \<in> set_mset J. (k, j) \<in> R"
[PROOF STATE]
proof (state)
this:
N = I + K
M = I + J
J \<noteq> {#}
\<forall>k\<in>#K. \<exists>j\<in>#J. (k, j) \<in> R

goal (1 subgoal):
 1. \<And>I J K. \<lbrakk>N = I + K; M = I + J; J \<noteq> {#}; \<forall>k\<in>#K. \<exists>j\<in>#J. (k, j) \<in> R\<rbrakk> \<Longrightarrow> (image_mset f N, image_mset f M) \<in> mult R'
[PROOF STEP]
thus "(image_mset f N, image_mset f M) \<in> mult R'"
[PROOF STATE]
proof (prove)
using this:
N = I + K
M = I + J
J \<noteq> {#}
\<forall>k\<in>#K. \<exists>j\<in>#J. (k, j) \<in> R

goal (1 subgoal):
 1. (image_mset f N, image_mset f M) \<in> mult R'
[PROOF STEP]
using assms(2,3)
[PROOF STATE]
proof (prove)
using this:
N = I + K
M = I + J
J \<noteq> {#}
\<forall>k\<in>#K. \<exists>j\<in>#J. (k, j) \<in> R
trans R'
\<lbrakk>?x \<in># N; ?y \<in># M; (?x, ?y) \<in> R\<rbrakk> \<Longrightarrow> (f ?x, f ?y) \<in> R'

goal (1 subgoal):
 1. (image_mset f N, image_mset f M) \<in> mult R'
[PROOF STEP]
by (intro multI) (auto, blast)
[PROOF STATE]
proof (state)
this:
(image_mset f N, image_mset f M) \<in> mult R'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Inf_between_mono: "N \<subseteq> N' \<Longrightarrow> M \<subseteq> M' \<Longrightarrow> Inf_between N M \<subseteq> Inf_between N' M'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>N \<subseteq> N'; M \<subseteq> M'\<rbrakk> \<Longrightarrow> Inf_between N M \<subseteq> Inf_between N' M'
[PROOF STEP]
unfolding Inf_between_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>N \<subseteq> N'; M \<subseteq> M'\<rbrakk> \<Longrightarrow> {\<iota> \<in> Inf. \<iota> \<in> Inf_from (N \<union> M) \<and> set (prems_of \<iota>) \<inter> M \<noteq> {}} \<subseteq> {\<iota> \<in> Inf. \<iota> \<in> Inf_from (N' \<union> M') \<and> set (prems_of \<iota>) \<inter> M' \<noteq> {}}
[PROOF STEP]
using Inf_from_mono[of "N \<union> M" "N' \<union> M'"]
[PROOF STATE]
proof (prove)
using this:
N \<union> M \<subseteq> N' \<union> M' \<Longrightarrow> Inf_from (N \<union> M) \<subseteq> Inf_from (N' \<union> M')

goal (1 subgoal):
 1. \<lbrakk>N \<subseteq> N'; M \<subseteq> M'\<rbrakk> \<Longrightarrow> {\<iota> \<in> Inf. \<iota> \<in> Inf_from (N \<union> M) \<and> set (prems_of \<iota>) \<inter> M \<noteq> {}} \<subseteq> {\<iota> \<in> Inf. \<iota> \<in> Inf_from (N' \<union> M') \<and> set (prems_of \<iota>) \<inter> M' \<noteq> {}}
[PROOF STEP]
by auto


[STATEMENT]
lemma (in bounded_linear) uniformly_continuous_on[continuous_intros]:
  fixes g :: "_::metric_space \<Rightarrow> _"
  assumes "uniformly_continuous_on s g"
  shows "uniformly_continuous_on s (\<lambda>x. f (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. f (g x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
uniformly_continuous_on s g

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. f (g x))
[PROOF STEP]
unfolding uniformly_continuous_on_sequentially
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. dist (g (x n)) (g (y n))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. \<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. dist (f (g (x n))) (f (g (y n)))) \<longlonglongrightarrow> 0
[PROOF STEP]
unfolding dist_norm tendsto_norm_zero_iff diff[symmetric]
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. g (x n) - g (y n)) \<longlonglongrightarrow> (0::'a)

goal (1 subgoal):
 1. \<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. f (g (x n) - g (y n))) \<longlonglongrightarrow> (0::'b)
[PROOF STEP]
by (auto intro: tendsto_zero)


[STATEMENT]
lemma scene_inter_union_distrib:
  assumes "x \<in> scene_space" "y \<in> scene_space" "z \<in> scene_space"
  shows "x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = (x \<sqinter>\<^sub>S y) \<squnion>\<^sub>S (x \<sqinter>\<^sub>S z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
have "x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = (x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z)) \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z)
[PROOF STEP]
by (metis assms(1) assms(3) idem_scene_space local.scene_union_inter_distrib scene_indep_bot scene_inter_commute scene_inter_indep scene_space.simps scene_union_unit(1))
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z)

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z)

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
have "... = (y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = (y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z))
[PROOF STEP]
by (simp add: scene_union_inter_distrib assms scene_inter_commute scene_union_assoc union_scene_space scene_space_inter scene_union_commute)
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = (y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z))

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = (y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z))

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
have "\<dots> = x \<sqinter>\<^sub>S ((y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z)) = x \<sqinter>\<^sub>S ((y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z))
[PROOF STEP]
by (metis assms scene_inter_commute scene_space.union_scene_space scene_space_inter_assoc)
[PROOF STATE]
proof (state)
this:
(y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z)) = x \<sqinter>\<^sub>S ((y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z))

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z)) = x \<sqinter>\<^sub>S ((y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z))

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
have "\<dots> = x \<sqinter>\<^sub>S (z \<squnion>\<^sub>S (x \<sqinter>\<^sub>S y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter>\<^sub>S ((y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z)) = x \<sqinter>\<^sub>S (z \<squnion>\<^sub>S x \<sqinter>\<^sub>S y)
[PROOF STEP]
by (simp add: assms scene_union_inter_distrib scene_inter_commute scene_union_commute)
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S ((y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z)) = x \<sqinter>\<^sub>S (z \<squnion>\<^sub>S x \<sqinter>\<^sub>S y)

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S ((y \<squnion>\<^sub>S z) \<sqinter>\<^sub>S (x \<squnion>\<^sub>S z)) = x \<sqinter>\<^sub>S (z \<squnion>\<^sub>S x \<sqinter>\<^sub>S y)

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
have "\<dots> = ((x \<sqinter>\<^sub>S y) \<squnion>\<^sub>S x) \<sqinter>\<^sub>S ((x \<sqinter>\<^sub>S y) \<squnion>\<^sub>S z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (z \<squnion>\<^sub>S x \<sqinter>\<^sub>S y) = (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S z)
[PROOF STEP]
by (metis (no_types, opaque_lifting) assms(1) assms(2) idem_scene_space local.scene_union_inter_distrib scene_indep_bot scene_inter_commute scene_inter_indep scene_space.bot_scene_space scene_union_commute scene_union_idem scene_union_unit(1))
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S (z \<squnion>\<^sub>S x \<sqinter>\<^sub>S y) = (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S z)

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S (z \<squnion>\<^sub>S x \<sqinter>\<^sub>S y) = (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S z)

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
have "\<dots> = (x \<sqinter>\<^sub>S y) \<squnion>\<^sub>S (x \<sqinter>\<^sub>S z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
by (simp add: assms scene_union_inter_distrib scene_space_inter)
[PROOF STATE]
proof (state)
this:
(x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x) \<sqinter>\<^sub>S (x \<sqinter>\<^sub>S y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z

goal (1 subgoal):
 1. x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x \<sqinter>\<^sub>S (y \<squnion>\<^sub>S z) = x \<sqinter>\<^sub>S y \<squnion>\<^sub>S x \<sqinter>\<^sub>S z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma shortest_path_lb:
  assumes "u \<noteq> v"
  assumes "vert_connected u v"
  shows "shortest_path u v > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < shortest_path u v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < shortest_path u v
[PROOF STEP]
have "\<And> p. connecting_path u v p  \<Longrightarrow>  enat (walk_length p) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. connecting_path u v p \<Longrightarrow> 0 < enat (walk_length p)
[PROOF STEP]
using connecting_path_length_bound assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<noteq> ?v; connecting_path ?u ?v ?p\<rbrakk> \<Longrightarrow> 1 \<le> walk_length ?p
u \<noteq> v
vert_connected u v

goal (1 subgoal):
 1. \<And>p. connecting_path u v p \<Longrightarrow> 0 < enat (walk_length p)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
connecting_path u v ?p \<Longrightarrow> 0 < enat (walk_length ?p)

goal (1 subgoal):
 1. 0 < shortest_path u v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
connecting_path u v ?p \<Longrightarrow> 0 < enat (walk_length ?p)

goal (1 subgoal):
 1. 0 < shortest_path u v
[PROOF STEP]
unfolding shortest_path_def
[PROOF STATE]
proof (prove)
using this:
connecting_path u v ?p \<Longrightarrow> 0 < enat (walk_length ?p)

goal (1 subgoal):
 1. 0 < (INF p\<in>connecting_paths u v. enat (walk_length p))
[PROOF STEP]
by (metis elem_connecting_paths shortest_path_def shortest_path_obtains2 assms(2))
[PROOF STATE]
proof (state)
this:
0 < shortest_path u v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_of_pow_inc:
  "set_of (A^n) \<subseteq> set_of (A'^n)"
  if "set_of A \<subseteq> set_of A'"
  for A :: "'a::{linordered_idom, real_normed_algebra, linear_continuum_topology} interval"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (A ^ n) \<subseteq> set_of (A' ^ n)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
set_of A \<subseteq> set_of A'

goal (1 subgoal):
 1. set_of (A ^ n) \<subseteq> set_of (A' ^ n)
[PROOF STEP]
by (induction n, simp_all add: set_of_mul_inc)


[STATEMENT]
lemma higher_pderiv_smult: "(pderiv ^^ n) (smult c p) = smult c ((pderiv ^^ n) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pderiv ^^ n) (Polynomial.smult c p) = Polynomial.smult c ((pderiv ^^ n) p)
[PROOF STEP]
by (induction n arbitrary: p) (simp_all del: funpow.simps add: funpow_Suc_right pderiv_smult)


[STATEMENT]
lemma strict_partial_orderD[dest?]:
  assumes "strict_partial_order r"
  shows "trans r" "irrefl r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans r &&& irrefl r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_partial_order r

goal (1 subgoal):
 1. trans r &&& irrefl r
[PROOF STEP]
unfolding strict_partial_order_def
[PROOF STATE]
proof (prove)
using this:
trans r \<and> irrefl r

goal (1 subgoal):
 1. trans r &&& irrefl r
[PROOF STEP]
by blast+


[STATEMENT]
lemma right_ideal_generated_subset:
  assumes "S \<subseteq> T"
  shows "right_ideal_generated S \<subseteq> right_ideal_generated T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_ideal_generated S \<subseteq> right_ideal_generated T
[PROOF STEP]
unfolding right_ideal_generated_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> {I. right_ideal I \<and> S \<subseteq> I} \<subseteq> \<Inter> {I. right_ideal I \<and> T \<subseteq> I}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> T

goal (1 subgoal):
 1. \<Inter> {I. right_ideal I \<and> S \<subseteq> I} \<subseteq> \<Inter> {I. right_ideal I \<and> T \<subseteq> I}
[PROOF STEP]
by auto


[STATEMENT]
lemma fds_perzeta_one_half: "fds_perzeta (1 / 2) = fds (\<lambda>n. (-1) ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_perzeta (1 / 2) = fds ((^) (- 1))
[PROOF STEP]
using Complex.DeMoivre[of pi]
[PROOF STATE]
proof (prove)
using this:
cis pi ^ ?n = cis (real ?n * pi)

goal (1 subgoal):
 1. fds_perzeta (1 / 2) = fds ((^) (- 1))
[PROOF STEP]
by (intro fds_eqI) (auto simp: fds_perzeta_def exp_eq_polar mult_ac)


[STATEMENT]
lemma gcd_pos_nat [simp]: "gcd m n > 0 \<longleftrightarrow> m \<noteq> 0 \<or> n \<noteq> 0"
  for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < gcd m n) = (m \<noteq> 0 \<or> n \<noteq> 0)
[PROOF STEP]
using gcd_eq_0_iff [of m n]
[PROOF STATE]
proof (prove)
using this:
(gcd m n = 0) = (m = 0 \<and> n = 0)

goal (1 subgoal):
 1. (0 < gcd m n) = (m \<noteq> 0 \<or> n \<noteq> 0)
[PROOF STEP]
by arith


[STATEMENT]
lemma normal_of_no_zero_root:
  fixes f::"real poly"
  assumes hzero: "poly f 0 \<noteq> 0" and hdeg: "i \<le> degree f"
    and hnorm: "normal_poly f"
  shows "0 < coeff f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
have "coeff f 0 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < coeff f 0
[PROOF STEP]
using hzero normal_coeff_nonneg[OF hnorm]
[PROOF STATE]
proof (prove)
using this:
poly f 0 \<noteq> 0
0 \<le> coeff f ?i

goal (1 subgoal):
 1. 0 < coeff f 0
[PROOF STEP]
by (metis eq_iff not_le_imp_less poly_0_coeff_0)
[PROOF STATE]
proof (state)
this:
0 < coeff f 0

goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < coeff f 0

goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
have "coeff f (degree f) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < lead_coeff f
[PROOF STEP]
using normal_coeff_nonneg[OF hnorm] normal_non_zero[OF hnorm]
[PROOF STATE]
proof (prove)
using this:
0 \<le> coeff f ?i
f \<noteq> 0

goal (1 subgoal):
 1. 0 < lead_coeff f
[PROOF STEP]
by (meson dual_order.irrefl eq_iff eq_zero_or_degree_less not_le_imp_less)
[PROOF STATE]
proof (state)
this:
0 < lead_coeff f

goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < lead_coeff f

goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
have "0 \<le> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> i

goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < coeff f 0
0 < lead_coeff f
0 \<le> i
[PROOF STEP]
show "0 < coeff f i"
[PROOF STATE]
proof (prove)
using this:
0 < coeff f 0
0 < lead_coeff f
0 \<le> i

goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
using hdeg normal_poly_pos_interval[OF hnorm]
[PROOF STATE]
proof (prove)
using this:
0 < coeff f 0
0 < lead_coeff f
0 \<le> i
i \<le> degree f
\<lbrakk>?i \<le> ?j; ?j \<le> ?k; 0 < coeff f ?i; 0 < coeff f ?k\<rbrakk> \<Longrightarrow> 0 < coeff f ?j

goal (1 subgoal):
 1. 0 < coeff f i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < coeff f i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma column_Gram_Schmidt_matrix:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  shows "column k (Gram_Schmidt_matrix A)
  = (column k A) - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A)|i. i < k}. (x \<bullet> (column k A) / (x \<bullet> x)) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have k: "to_nat k < ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat k < ncols A
[PROOF STEP]
using to_nat_less_card[of k]
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat k < CARD('n)

goal (1 subgoal):
 1. mod_type_class.to_nat k < ncols A
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat k < CARD('n)

goal (1 subgoal):
 1. mod_type_class.to_nat k < CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat k < ncols A

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "column k (Gram_Schmidt_matrix A) = column k (Gram_Schmidt_upt_k A (ncols A - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k (Gram_Schmidt_upt_k A (ncols A - 1))
[PROOF STEP]
unfolding Gram_Schmidt_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column k (Gram_Schmidt_upt_k A (ncols A - 1)) = column k (Gram_Schmidt_upt_k A (ncols A - 1))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
column k (Gram_Schmidt_matrix A) = column k (Gram_Schmidt_upt_k A (ncols A - 1))

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column k (Gram_Schmidt_matrix A) = column k (Gram_Schmidt_upt_k A (ncols A - 1))

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = column k (Gram_Schmidt_upt_k A (to_nat k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column k (Gram_Schmidt_upt_k A (ncols A - 1)) = column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k))
[PROOF STEP]
proof (rule column_Gram_Schmidt_upt_k_preserves2[symmetric])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. k \<le> mod_type_class.from_nat (mod_type_class.to_nat k)
 2. mod_type_class.to_nat k \<le> ncols A - 1
 3. ncols A - 1 < ncols A
[PROOF STEP]
show "k \<le> from_nat (to_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> mod_type_class.from_nat (mod_type_class.to_nat k)
[PROOF STEP]
unfolding from_nat_to_nat_id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> k
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
k \<le> mod_type_class.from_nat (mod_type_class.to_nat k)

goal (2 subgoals):
 1. mod_type_class.to_nat k \<le> ncols A - 1
 2. ncols A - 1 < ncols A
[PROOF STEP]
show "to_nat k \<le> ncols A - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat k \<le> ncols A - 1
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat k \<le> CARD('n) - 1
[PROOF STEP]
using to_nat_less_card[where ?'a='n]
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat ?j < CARD('n)

goal (1 subgoal):
 1. mod_type_class.to_nat k \<le> CARD('n) - 1
[PROOF STEP]
by (metis le_diff_conv2 add_leE less_diff_conv less_imp_le_nat  less_le_not_le
        nat_le_linear suc_not_zero to_nat_plus_one_less_card')
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat k \<le> ncols A - 1

goal (1 subgoal):
 1. ncols A - 1 < ncols A
[PROOF STEP]
show "ncols A - 1 < ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols A - 1 < ncols A
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) - 1 < CARD('n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ncols A - 1 < ncols A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
column k (Gram_Schmidt_upt_k A (ncols A - 1)) = column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k))

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column k (Gram_Schmidt_upt_k A (ncols A - 1)) = column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k))

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
using column_Gram_Schmidt_upt_k[OF k]
[PROOF STATE]
proof (prove)
using this:
column (mod_type_class.from_nat (mod_type_class.to_nat k)) (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) = column (mod_type_class.from_nat (mod_type_class.to_nat k)) A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < mod_type_class.from_nat (mod_type_class.to_nat k)}. (x \<bullet> column (mod_type_class.from_nat (mod_type_class.to_nat k)) A / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
unfolding from_nat_to_nat_id
[PROOF STATE]
proof (prove)
using this:
column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column k (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
unfolding set_columns_Gram_Schmidt_matrix[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A (mod_type_class.to_nat k)) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
column k (Gram_Schmidt_matrix A) = column k A - (\<Sum>x\<in>{column i (Gram_Schmidt_matrix A) |i. i < k}. (x \<bullet> column k A / (x \<bullet> x)) *\<^sub>R x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hypreal_sqrt_approx_zero [simp]:
  assumes "0 < x"
  shows "(( *f* sqrt) x \<approx> 0) \<longleftrightarrow> (x \<approx> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((*f* sqrt) x \<approx> 0) = (x \<approx> 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((*f* sqrt) x \<approx> 0) = (x \<approx> 0)
[PROOF STEP]
have "( *f* sqrt) x \<in> Infinitesimal \<longleftrightarrow> ((*f* sqrt) x)\<^sup>2 \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((*f* sqrt) x \<in> Infinitesimal) = (((*f* sqrt) x)\<^sup>2 \<in> Infinitesimal)
[PROOF STEP]
by (metis Infinitesimal_hrealpow pos2 power2_eq_square Infinitesimal_square_iff)
[PROOF STATE]
proof (state)
this:
((*f* sqrt) x \<in> Infinitesimal) = (((*f* sqrt) x)\<^sup>2 \<in> Infinitesimal)

goal (1 subgoal):
 1. ((*f* sqrt) x \<approx> 0) = (x \<approx> 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((*f* sqrt) x \<in> Infinitesimal) = (((*f* sqrt) x)\<^sup>2 \<in> Infinitesimal)

goal (1 subgoal):
 1. ((*f* sqrt) x \<approx> 0) = (x \<approx> 0)
[PROOF STEP]
have "... \<longleftrightarrow> x \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((*f* sqrt) x)\<^sup>2 \<in> Infinitesimal) = (x \<in> Infinitesimal)
[PROOF STEP]
by (simp add: assms hypreal_sqrt_gt_zero_pow2)
[PROOF STATE]
proof (state)
this:
(((*f* sqrt) x)\<^sup>2 \<in> Infinitesimal) = (x \<in> Infinitesimal)

goal (1 subgoal):
 1. ((*f* sqrt) x \<approx> 0) = (x \<approx> 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((*f* sqrt) x \<in> Infinitesimal) = (x \<in> Infinitesimal)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((*f* sqrt) x \<in> Infinitesimal) = (x \<in> Infinitesimal)

goal (1 subgoal):
 1. ((*f* sqrt) x \<approx> 0) = (x \<approx> 0)
[PROOF STEP]
using mem_infmal_iff
[PROOF STATE]
proof (prove)
using this:
((*f* sqrt) x \<in> Infinitesimal) = (x \<in> Infinitesimal)
(?x \<in> Infinitesimal) = (?x \<approx> 0)

goal (1 subgoal):
 1. ((*f* sqrt) x \<approx> 0) = (x \<approx> 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((*f* sqrt) x \<approx> 0) = (x \<approx> 0)

goal:
No subgoals!
[PROOF STEP]
qed