[STATEMENT]
lemma all_prefered_are_more_expensive:
  assumes i_agt: "i \<in> agents"
  assumes equil: "competitive_equilibrium P \<X> \<Y>"
  assumes "z \<in> consumption_set"
  assumes "(U i) z > (U i) (\<X> i)"
  shows "z \<bullet> P > P \<bullet> (\<X> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<bullet> \<X> i < z \<bullet> P
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> P \<bullet> \<X> i < z \<bullet> P \<Longrightarrow> False
[PROOF STEP]
assume neg_as :  "\<not>(z \<bullet> P > P \<bullet> (\<X> i))"
[PROOF STATE]
proof (state)
this:
\<not> P \<bullet> \<X> i < z \<bullet> P

goal (1 subgoal):
 1. \<not> P \<bullet> \<X> i < z \<bullet> P \<Longrightarrow> False
[PROOF STEP]
have xp_leq : "z \<bullet> P \<le> P \<bullet>  (\<X> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<bullet> P \<le> P \<bullet> \<X> i
[PROOF STEP]
using \<open>\<not>z \<bullet> P > P \<bullet> (\<X> i)\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> P \<bullet> \<X> i < z \<bullet> P

goal (1 subgoal):
 1. z \<bullet> P \<le> P \<bullet> \<X> i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<bullet> P \<le> P \<bullet> \<X> i

goal (1 subgoal):
 1. \<not> P \<bullet> \<X> i < z \<bullet> P \<Longrightarrow> False
[PROOF STEP]
have x_in_argmax: "(\<X> i) \<in> arg_max_set U[i] (budget_constraint (calculate_value P) consumption_set (poe_wealth P i \<Y>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<X> i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>))
[PROOF STEP]
using equil i_agt
[PROOF STATE]
proof (prove)
using this:
competitive_equilibrium P \<X> \<Y>
i \<in> agents

goal (1 subgoal):
 1. \<X> i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<X> i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>))

goal (1 subgoal):
 1. \<not> P \<bullet> \<X> i < z \<bullet> P \<Longrightarrow> False
[PROOF STEP]
hence x_in: "\<X> i \<in> (budget_constraint (calculate_value P) consumption_set (poe_wealth P i \<Y>))"
[PROOF STATE]
proof (prove)
using this:
\<X> i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>))

goal (1 subgoal):
 1. \<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
using argmax_sol_in_s [of "(\<X> i)" "U[i]" "budget_constraint (calculate_value P) consumption_set (poe_wealth P i \<Y>)"]
[PROOF STATE]
proof (prove)
using this:
\<X> i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>))
\<X> i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)) \<Longrightarrow> \<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)

goal (1 subgoal):
 1. \<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)

goal (1 subgoal):
 1. \<not> P \<bullet> \<X> i < z \<bullet> P \<Longrightarrow> False
[PROOF STEP]
hence z_in_budget: "z \<in> (budget_constraint (calculate_value P) consumption_set (poe_wealth P i \<Y>))"
[PROOF STATE]
proof (prove)
using this:
\<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)

goal (1 subgoal):
 1. z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<Longrightarrow> z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
have z_leq_endow: "P \<bullet> z \<le> P \<bullet> (\<X> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<bullet> z \<le> P \<bullet> \<X> i
[PROOF STEP]
by (metis xp_leq inner_commute)
[PROOF STATE]
proof (state)
this:
P \<bullet> z \<le> P \<bullet> \<X> i

goal (1 subgoal):
 1. \<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<Longrightarrow> z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
have z_in_cons: "z \<in> consumption_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> consumption_set
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> agents
competitive_equilibrium P \<X> \<Y>
z \<in> consumption_set
U[i] (\<X> i) < U[i] z

goal (1 subgoal):
 1. z \<in> consumption_set
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> consumption_set

goal (1 subgoal):
 1. \<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<Longrightarrow> z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> consumption_set
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> consumption_set

goal (1 subgoal):
 1. z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
using x_in budget_constraint_def z_leq_endow
[PROOF STATE]
proof (prove)
using this:
z \<in> consumption_set
\<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
budget_constraint ?f ?S ?W = {x \<in> ?S. ?f x \<le> ?W}
P \<bullet> z \<le> P \<bullet> \<X> i

goal (1 subgoal):
 1. z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>z \<in> consumption_set; \<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>); \<And>f S W. budget_constraint f S W = {x \<in> S. f x \<le> W}; P \<bullet> z \<le> P \<bullet> \<X> i\<rbrakk> \<Longrightarrow> z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
have "\<forall>r.  P \<bullet> \<X> i \<le> r \<longrightarrow> P \<bullet> z \<le> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>r\<ge>P \<bullet> \<X> i. P \<bullet> z \<le> r
[PROOF STEP]
using z_leq_endow
[PROOF STATE]
proof (prove)
using this:
P \<bullet> z \<le> P \<bullet> \<X> i

goal (1 subgoal):
 1. \<forall>r\<ge>P \<bullet> \<X> i. P \<bullet> z \<le> r
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<forall>r\<ge>P \<bullet> \<X> i. P \<bullet> z \<le> r

goal (1 subgoal):
 1. \<lbrakk>z \<in> consumption_set; \<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>); \<And>f S W. budget_constraint f S W = {x \<in> S. f x \<le> W}; P \<bullet> z \<le> P \<bullet> \<X> i\<rbrakk> \<Longrightarrow> z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>r\<ge>P \<bullet> \<X> i. P \<bullet> z \<le> r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>r\<ge>P \<bullet> \<X> i. P \<bullet> z \<le> r

goal (1 subgoal):
 1. z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
using budget_constraint_def x_in z_in_cons
[PROOF STATE]
proof (prove)
using this:
\<forall>r\<ge>P \<bullet> \<X> i. P \<bullet> z \<le> r
budget_constraint ?f ?S ?W = {x \<in> ?S. ?f x \<le> ?W}
\<X> i \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
z \<in> consumption_set

goal (1 subgoal):
 1. z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)
[PROOF STEP]
by (simp add: budget_constraint_def)
[PROOF STATE]
proof (state)
this:
z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)

goal (1 subgoal):
 1. \<not> P \<bullet> \<X> i < z \<bullet> P \<Longrightarrow> False
[PROOF STEP]
have nex_prop: "\<nexists>e. e \<in>  (budget_constraint (calculate_value P) consumption_set (poe_wealth P i \<Y>)) \<and>
        U[i] e > U[i] (\<X> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>e. e \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] e
[PROOF STEP]
using no_better_in_s[of "\<X> i" "U[i]"
        "budget_constraint (calculate_value P) consumption_set (poe_wealth P i \<Y>)"] x_in_argmax
[PROOF STATE]
proof (prove)
using this:
\<X> i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)) \<Longrightarrow> \<nexists>y. y \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] y
\<X> i \<in> arg_max_set U[i] (budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>))

goal (1 subgoal):
 1. \<nexists>e. e \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<nexists>e. e \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] e

goal (1 subgoal):
 1. \<not> P \<bullet> \<X> i < z \<bullet> P \<Longrightarrow> False
[PROOF STEP]
have "z \<in> budget_constraint (calculate_value P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] z > U[i] (\<X> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] z
[PROOF STEP]
using assms z_in_budget
[PROOF STATE]
proof (prove)
using this:
i \<in> agents
competitive_equilibrium P \<X> \<Y>
z \<in> consumption_set
U[i] (\<X> i) < U[i] z
z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>)

goal (1 subgoal):
 1. z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] z
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] z

goal (1 subgoal):
 1. \<not> P \<bullet> \<X> i < z \<bullet> P \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] z

goal (1 subgoal):
 1. False
[PROOF STEP]
using nex_prop
[PROOF STATE]
proof (prove)
using this:
z \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] z
\<nexists>e. e \<in> budget_constraint ((\<bullet>) P) consumption_set (poe_wealth P i \<Y>) \<and> U[i] (\<X> i) < U[i] e

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma affine_closed:
  fixes S :: "'n::euclidean_space set"
  assumes "affine S"
  shows "closed S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed S
[PROOF STEP]
assume "S \<noteq> {}"
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. closed S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
obtain L where L: "subspace L" "affine_parallel S L"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. (\<And>L. \<lbrakk>subspace L; affine_parallel S L\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms affine_parallel_subspace[of S]
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
affine S
\<lbrakk>affine S; S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>!L. subspace L \<and> affine_parallel S L

goal (1 subgoal):
 1. (\<And>L. \<lbrakk>subspace L; affine_parallel S L\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subspace L
affine_parallel S L

goal (1 subgoal):
 1. closed S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subspace L
affine_parallel S L
[PROOF STEP]
obtain a where a: "S = ((+) a ` L)"
[PROOF STATE]
proof (prove)
using this:
subspace L
affine_parallel S L

goal (1 subgoal):
 1. (\<And>a. S = (+) a ` L \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using affine_parallel_def[of L S] affine_parallel_commut
[PROOF STATE]
proof (prove)
using this:
subspace L
affine_parallel S L
affine_parallel L S = (\<exists>a. S = (+) a ` L)
affine_parallel ?A ?B \<Longrightarrow> affine_parallel ?B ?A

goal (1 subgoal):
 1. (\<And>a. S = (+) a ` L \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S = (+) a ` L

goal (1 subgoal):
 1. closed S
[PROOF STEP]
from L
[PROOF STATE]
proof (chain)
picking this:
subspace L
affine_parallel S L
[PROOF STEP]
have "closed L"
[PROOF STATE]
proof (prove)
using this:
subspace L
affine_parallel S L

goal (1 subgoal):
 1. closed L
[PROOF STEP]
using closed_subspace
[PROOF STATE]
proof (prove)
using this:
subspace L
affine_parallel S L
subspace ?s \<Longrightarrow> closed ?s

goal (1 subgoal):
 1. closed L
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed L

goal (1 subgoal):
 1. closed S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
closed L
[PROOF STEP]
have "closed S"
[PROOF STATE]
proof (prove)
using this:
closed L

goal (1 subgoal):
 1. closed S
[PROOF STEP]
using closed_translation a
[PROOF STATE]
proof (prove)
using this:
closed L
closed ?S \<Longrightarrow> closed ((+) ?a ` ?S)
S = (+) a ` L

goal (1 subgoal):
 1. closed S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed S

goal (1 subgoal):
 1. closed S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
S \<noteq> {} \<Longrightarrow> closed S

goal (1 subgoal):
 1. closed S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {} \<Longrightarrow> closed S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {} \<Longrightarrow> closed S

goal (1 subgoal):
 1. closed S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prefix_trans: "!!xs::'a list. [| xs <= ys; ys <= zs |] ==> xs <= zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<le> ys; ys \<le> zs\<rbrakk> \<Longrightarrow> xs \<le> zs
[PROOF STEP]
apply (unfold prefix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>(xs, ys) \<in> genPrefix Id; (ys, zs) \<in> genPrefix Id\<rbrakk> \<Longrightarrow> (xs, zs) \<in> genPrefix Id
[PROOF STEP]
apply (blast intro: genPrefix_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem subject_reduction': "t \<rightarrow>\<^sub>\<beta>\<^sup>* t' \<Longrightarrow> e \<turnstile> t : T \<Longrightarrow> e \<turnstile> t' : T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t ->> t'; e \<turnstile> t : T\<rbrakk> \<Longrightarrow> e \<turnstile> t' : T
[PROOF STEP]
by (induct set: rtranclp) (iprover intro: subject_reduction)+


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

goal (1 subgoal):
 1. A \<lesssim>\<^sub>\<circ> B
[PROOF STEP]
by (simp add: less_eq_V_def subset_imp_lepoll)


[STATEMENT]
lemma adds_minus_splus:
  assumes "pp_of_term u adds t"
  shows "(t - pp_of_term u) \<oplus> u = term_of_pair (t, component_of_term u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t - pp_of_term u) \<oplus> u = term_of_pair (t, component_of_term u)
[PROOF STEP]
by (simp add: splus_def adds_minus[OF assms])


[STATEMENT]
lemma cf_cn_comp_ObjMap_vrange:
  assumes "\<GG> : \<BB> \<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret L: is_functor \<alpha> \<open>op_cat \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_cat \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret R: is_functor \<alpha> \<open>op_cat \<AA>\<close> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : op_cat \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
by
      (
        rule smcf_cn_comp_ObjMap_vrange
          [
            OF
              L.cf_is_semifunctor[unfolded slicing_commute[symmetric]]
              R.cf_is_semifunctor[unfolded slicing_commute[symmetric]],
            unfolded slicing_commute slicing_simps
          ]
      )
[PROOF STATE]
proof (state)
this:
\<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in cpx_sq_mat) lhv_posr:
  assumes "lhv M A B R XA XB"
  shows "AE w in M. (\<forall> b \<in> spectrum B. 0 \<le> XB b w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE w in M. \<forall>b\<in>spectrum B. 0 \<le> XB b w
[PROOF STEP]
proof (rule AE_ball_countable[THEN iffD2])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. countable (spectrum B)
 2. \<forall>b\<in>spectrum B. AE w in M. 0 \<le> XB b w
[PROOF STEP]
show "countable (spectrum B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (spectrum B)
[PROOF STEP]
using spectrum_finite[of B]
[PROOF STATE]
proof (prove)
using this:
finite (spectrum B)

goal (1 subgoal):
 1. countable (spectrum B)
[PROOF STEP]
by (simp add: countable_finite)
[PROOF STATE]
proof (state)
this:
countable (spectrum B)

goal (1 subgoal):
 1. \<forall>b\<in>spectrum B. AE w in M. 0 \<le> XB b w
[PROOF STEP]
show "\<forall>b\<in>spectrum B. AE w in M. 0 \<le> XB b w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b\<in>spectrum B. AE w in M. 0 \<le> XB b w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lhv M A B R XA XB

goal (1 subgoal):
 1. \<forall>b\<in>spectrum B. AE w in M. 0 \<le> XB b w
[PROOF STEP]
unfolding lhv_def pos_rv_def
[PROOF STATE]
proof (prove)
using this:
prob_space M \<and> (\<forall>a\<in>spectrum A. XA a \<in> borel_measurable M \<and> (AE w in M. 0 \<le> XA a w)) \<and> prv_sum M A XA \<and> (\<forall>b\<in>spectrum B. XB b \<in> borel_measurable M \<and> (AE w in M. 0 \<le> XB b w)) \<and> prv_sum M B XB \<and> (\<forall>a\<in>spectrum A. \<forall>b\<in>spectrum B. integrable M (\<lambda>w. XA a w * XB b w) \<and> LINT w|M. XA a w * XB b w = Re (Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)))

goal (1 subgoal):
 1. \<forall>b\<in>spectrum B. AE w in M. 0 \<le> XB b w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>spectrum B. AE w in M. 0 \<le> XB b w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list22_induct[case_names NilNil ConsNil NilCons ConsCons]:
assumes NN: "P [] []"
and CN: "\<And>x xs. P xs [] \<Longrightarrow> P (x # xs) []"
and NC: "\<And>y ys. P [] ys \<Longrightarrow> P [] (y # ys)"
and CC: "\<And>x xs y ys.
   P xs ys \<Longrightarrow>
   (\<And> ys'. length ys' \<le> Suc (length ys) \<Longrightarrow> P xs ys') \<Longrightarrow>
   (\<And> xs'. length xs' \<le> Suc (length xs) \<Longrightarrow> P xs' ys) \<Longrightarrow>
   P (x # xs) (y # ys)"
shows "P xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P xs ys
[PROOF STEP]
proof (induction rule: measure_induct2[of "\<lambda>xs ys. length xs + length ys", case_names IH])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2. (\<And>y1 y2. length y1 + length y2 < length x1 + length x2 \<Longrightarrow> P y1 y2) \<Longrightarrow> P x1 x2
[PROOF STEP]
case (IH xs ys)
[PROOF STATE]
proof (state)
this:
length ?y1.0 + length ?y2.0 < length xs + length ys \<Longrightarrow> P ?y1.0 ?y2.0

goal (1 subgoal):
 1. \<And>x1 x2. (\<And>y1 y2. length y1 + length y2 < length x1 + length x2 \<Longrightarrow> P y1 y2) \<Longrightarrow> P x1 x2
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
P [] []
P ?xs [] \<Longrightarrow> P (?x # ?xs) []
P [] ?ys \<Longrightarrow> P [] (?y # ?ys)
\<lbrakk>P ?xs ?ys; \<And>ys'. length ys' \<le> Suc (length ?ys) \<Longrightarrow> P ?xs ys'; \<And>xs'. length xs' \<le> Suc (length ?xs) \<Longrightarrow> P xs' ?ys\<rbrakk> \<Longrightarrow> P (?x # ?xs) (?y # ?ys)
length ?y1.0 + length ?y2.0 < length xs + length ys \<Longrightarrow> P ?y1.0 ?y2.0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
P [] []
P ?xs [] \<Longrightarrow> P (?x # ?xs) []
P [] ?ys \<Longrightarrow> P [] (?y # ?ys)
\<lbrakk>P ?xs ?ys; \<And>ys'. length ys' \<le> Suc (length ?ys) \<Longrightarrow> P ?xs ys'; \<And>xs'. length xs' \<le> Suc (length ?xs) \<Longrightarrow> P xs' ?ys\<rbrakk> \<Longrightarrow> P (?x # ?xs) (?y # ?ys)
length ?y1.0 + length ?y2.0 < length xs + length ys \<Longrightarrow> P ?y1.0 ?y2.0

goal (1 subgoal):
 1. P xs ys
[PROOF STEP]
by (cases xs; cases ys) auto
[PROOF STATE]
proof (state)
this:
P xs ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_minimal_antichain: "x \<in> minimal_antichain A \<longleftrightarrow> x \<in> A \<and> \<not>(\<exists>y \<in> A. y < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> minimal_antichain A) = (x \<in> A \<and> \<not> (\<exists>y\<in>A. y < x))
[PROOF STEP]
unfolding minimal_antichain_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> {x \<in> A. \<not> (\<exists>y\<in>A. y < x)}) = (x \<in> A \<and> \<not> (\<exists>y\<in>A. y < x))
[PROOF STEP]
by auto


[STATEMENT]
lemma vec_to_lin_poly_coeff_access:
  assumes "x < dim_vec y"
  shows "y $ x = coeff (vec_to_lpoly y) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y $ x = Abstract_Linear_Poly.coeff (vec_to_lpoly y) x
[PROOF STEP]
by (simp add: assms list_to_lpoly_coeff_nth)


[STATEMENT]
lemma ENR_imp_locally_path_connected:
  fixes S :: "'a::euclidean_space set"
  assumes "ENR S"
    shows "locally path_connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally path_connected S
[PROOF STEP]
by (simp add: ANR_imp_locally_path_connected ENR_imp_ANR assms)


[STATEMENT]
lemma vec_times_mat_eqD[dest]:
  assumes "[y \<^sub>v* A]=c"
  shows "(\<forall>i < dim_vec c. (A\<^sup>T *\<^sub>v y)$i = c$i)" "(dim_col A\<^sup>T = dim_vec y)" "(dim_row A\<^sup>T = dim_vec c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<dim_vec c. (A\<^sup>T *\<^sub>v y) $ i = c $ i &&& dim_col A\<^sup>T = dim_vec y &&& dim_row A\<^sup>T = dim_vec c
[PROOF STEP]
using assms vec_times_mat_eq_def
[PROOF STATE]
proof (prove)
using this:
[y\<^sub>v*A]=c
[?y\<^sub>v*?A]=?c = ((\<forall>i<dim_vec ?c. (?A\<^sup>T *\<^sub>v ?y) $ i = ?c $ i) \<and> dim_col ?A\<^sup>T = dim_vec ?y \<and> dim_row ?A\<^sup>T = dim_vec ?c)

goal (1 subgoal):
 1. \<forall>i<dim_vec c. (A\<^sup>T *\<^sub>v y) $ i = c $ i &&& dim_col A\<^sup>T = dim_vec y &&& dim_row A\<^sup>T = dim_vec c
[PROOF STEP]
by blast+


[STATEMENT]
lemma bdd_all_is_node_subsetbdd:
  assumes "list_all (bdd_all (nfa_is_node A)) (fst A)"
  and "nfa_is_node A q"
  shows "bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
fix bdds :: "bool list bdd list" and q :: "bool list" and bd :: "bool list bdd" and n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
assume "list_all (bdd_all (\<lambda>l. length l = n)) bdds" and "bdd_all (\<lambda>l. length l = n) bd" and "length bdds = length q"
[PROOF STATE]
proof (state)
this:
list_all (bdd_all (\<lambda>l. length l = n)) bdds
bdd_all (\<lambda>l. length l = n) bd
length bdds = length q

goal (1 subgoal):
 1. bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
hence "bdd_all (\<lambda>l. length l = n) (subsetbdd bdds q bd)"
[PROOF STATE]
proof (prove)
using this:
list_all (bdd_all (\<lambda>l. length l = n)) bdds
bdd_all (\<lambda>l. length l = n) bd
length bdds = length q

goal (1 subgoal):
 1. bdd_all (\<lambda>l. length l = n) (subsetbdd bdds q bd)
[PROOF STEP]
by (induct bdds q bd rule: subsetbdd.induct) (simp add: bdd_all_bdd_binop[of "\<lambda>l. length l =n" _ "\<lambda>l. length l = n"] bv_or_length)+
[PROOF STATE]
proof (state)
this:
bdd_all (\<lambda>l. length l = n) (subsetbdd bdds q bd)

goal (1 subgoal):
 1. bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>list_all (bdd_all (\<lambda>l. length l = ?n2)) ?bdds2; bdd_all (\<lambda>l. length l = ?n2) ?bd2; length ?bdds2 = length ?qa2\<rbrakk> \<Longrightarrow> bdd_all (\<lambda>l. length l = ?n2) (subsetbdd ?bdds2 ?qa2 ?bd2)

goal (1 subgoal):
 1. bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
list_all (bdd_all (nfa_is_node A)) (fst A)
nfa_is_node A q
\<lbrakk>list_all (bdd_all (\<lambda>l. length l = ?n2)) ?bdds2; bdd_all (\<lambda>l. length l = ?n2) ?bd2; length ?bdds2 = length ?qa2\<rbrakk> \<Longrightarrow> bdd_all (\<lambda>l. length l = ?n2) (subsetbdd ?bdds2 ?qa2 ?bd2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_all (bdd_all (nfa_is_node A)) (fst A)
nfa_is_node A q
\<lbrakk>list_all (bdd_all (\<lambda>l. length l = ?n2)) ?bdds2; bdd_all (\<lambda>l. length l = ?n2) ?bd2; length ?bdds2 = length ?qa2\<rbrakk> \<Longrightarrow> bdd_all (\<lambda>l. length l = ?n2) (subsetbdd ?bdds2 ?qa2 ?bd2)

goal (1 subgoal):
 1. bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
by (simp add: nfa_is_node_def nfa_emptybdd_def)
[PROOF STATE]
proof (state)
this:
bdd_all (nfa_is_node A) (subsetbdd (fst A) q (nfa_emptybdd (length q)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iMODb_trans': "
  \<lbrakk> y \<in> [x, mod m, c]; z \<in> [y, mod m, c']; c' \<le> x div m + c - y div m \<rbrakk> \<Longrightarrow>
  z \<in> [x, mod m, c]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> [ x, mod m, c ]; z \<in> [ y, mod m, c' ]; c' \<le> x div m + c - y div m\<rbrakk> \<Longrightarrow> z \<in> [ x, mod m, c ]
[PROOF STEP]
apply (rule iMODb_trans[where c'=c'], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> [ x, mod m, c ]; z \<in> [ y, mod m, c' ]; c' \<le> x div m + c - y div m\<rbrakk> \<Longrightarrow> m * c' \<le> x + m * c - y
[PROOF STEP]
apply (frule iMODb_geD, frule div_le_mono[of x y m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> [ x, mod m, c ]; z \<in> [ y, mod m, c' ]; c' \<le> x div m + c - y div m; x \<le> y; x div m \<le> y div m\<rbrakk> \<Longrightarrow> m * c' \<le> x + m * c - y
[PROOF STEP]
apply (simp add: add.commute[of _ c] add.commute[of _ "m*c"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> [ x, mod m, c ]; z \<in> [ y, mod m, c' ]; c' \<le> c + x div m - y div m; x \<le> y; x div m \<le> y div m\<rbrakk> \<Longrightarrow> m * c' \<le> m * c + x - y
[PROOF STEP]
apply (drule mult_le_mono[OF le_refl, of _ _ m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> [ x, mod m, c ]; z \<in> [ y, mod m, c' ]; x \<le> y; x div m \<le> y div m; m * c' \<le> m * (c + x div m - y div m)\<rbrakk> \<Longrightarrow> m * c' \<le> m * c + x - y
[PROOF STEP]
apply (simp add: add_mult_distrib2 diff_mult_distrib2 minus_mod_eq_mult_div [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> [ x, mod m, c ]; z \<in> [ y, mod m, c' ]; x \<le> y; x div m \<le> y div m; m * c' \<le> m * c + x - (x mod m + y - y mod m)\<rbrakk> \<Longrightarrow> m * c' \<le> m * c + x - y
[PROOF STEP]
apply (simp add: iMODb_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in group) inv_inv [simp]:
  "x \<in> carrier G ==> inv (inv x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> inv (inv x) = x
[PROOF STEP]
using Units_inv_inv
[PROOF STATE]
proof (prove)
using this:
?x \<in> Units G \<Longrightarrow> inv (inv ?x) = ?x

goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> inv (inv x) = x
[PROOF STEP]
by simp


[STATEMENT]
lemma [code abstract]:
    "Rep_BinomialHeap (insert e a q)
    = BinomialHeapStruc.insert e a (Rep_BinomialHeap q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_BinomialHeap (local.insert e a q) = BinomialHeapStruc.insert e a (Rep_BinomialHeap q)
[PROOF STEP]
by (simp add: insert_def BinomialHeapStruc.insert_correct)


[STATEMENT]
lemma one_time_pad: "map_spmf ((\<oplus>) x) (spmf_of_set (carrier L)) = spmf_of_set (carrier L)"
  if "x \<in> carrier L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf ((\<oplus>) x) (spmf_of_set (carrier L)) = spmf_of_set (carrier L)
[PROOF STEP]
apply(subst map_spmf_of_set_inj_on)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on ((\<oplus>) x) (carrier L)
 2. spmf_of_set ((\<oplus>) x ` carrier L) = spmf_of_set (carrier L)
[PROOF STEP]
apply(rule inj_on_xor[OF that])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spmf_of_set ((\<oplus>) x ` carrier L) = spmf_of_set (carrier L)
[PROOF STEP]
by(simp add: surj_xor that)


[STATEMENT]
theorem M6: "\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v \<and> \<box>[G]_v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v \<and> \<box>[G]_v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v \<and> \<box>[G]_v
[PROOF STEP]
have "\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v
[PROOF STEP]
by (rule M2) auto
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v \<and> \<box>[G]_v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v \<and> \<box>[G]_v
[PROOF STEP]
have "\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[G]_v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[G]_v
[PROOF STEP]
by (rule M2) auto
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[G]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v \<and> \<box>[G]_v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v
\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[G]_v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v
\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[G]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v \<and> \<box>[G]_v
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[F \<and> G]_v \<longrightarrow> \<box>[F]_v \<and> \<box>[G]_v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_is_has_loop_eq: "card {e \<in> E . is_loop e} = card {v \<in> V . has_loop v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
have "\<And> e . e \<in> E \<Longrightarrow> is_loop e \<longleftrightarrow> (\<exists> v. e = {v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. e \<in> E \<Longrightarrow> is_loop e = (\<exists>v. e = {v})
[PROOF STEP]
using is_loop_def
[PROOF STATE]
proof (prove)
using this:
is_loop ?e \<equiv> card ?e = 1

goal (1 subgoal):
 1. \<And>e. e \<in> E \<Longrightarrow> is_loop e = (\<exists>v. e = {v})
[PROOF STEP]
using is_singleton_altdef is_singleton_def
[PROOF STATE]
proof (prove)
using this:
is_loop ?e \<equiv> card ?e = 1
is_singleton ?A = (card ?A = 1)
is_singleton ?A = (\<exists>x. ?A = {x})

goal (1 subgoal):
 1. \<And>e. e \<in> E \<Longrightarrow> is_loop e = (\<exists>v. e = {v})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?e \<in> E \<Longrightarrow> is_loop ?e = (\<exists>v. ?e = {v})

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
define f :: "'a \<Rightarrow> 'a set"  where "f = (\<lambda> v . {v})"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>v. {v})

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
have feq: "f ` {v \<in> V . has_loop v} = {{v} | v . has_loop v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {v \<in> V. has_loop v} = {{v} |v. has_loop v}
[PROOF STEP]
using has_loop_in_verts f_def
[PROOF STATE]
proof (prove)
using this:
has_loop ?v \<Longrightarrow> ?v \<in> V
f = (\<lambda>v. {v})

goal (1 subgoal):
 1. f ` {v \<in> V. has_loop v} = {{v} |v. has_loop v}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` {v \<in> V. has_loop v} = {{v} |v. has_loop v}

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
have "inj_on f {v \<in> V . has_loop v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f {v \<in> V. has_loop v}
[PROOF STEP]
by (simp add: f_def)
[PROOF STATE]
proof (state)
this:
inj_on f {v \<in> V. has_loop v}

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on f {v \<in> V. has_loop v}
[PROOF STEP]
have "card {v \<in> V . has_loop v} = card (f ` {v \<in> V . has_loop v})"
[PROOF STATE]
proof (prove)
using this:
inj_on f {v \<in> V. has_loop v}

goal (1 subgoal):
 1. card {v \<in> V. has_loop v} = card (f ` {v \<in> V. has_loop v})
[PROOF STEP]
using card_image
[PROOF STATE]
proof (prove)
using this:
inj_on f {v \<in> V. has_loop v}
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A

goal (1 subgoal):
 1. card {v \<in> V. has_loop v} = card (f ` {v \<in> V. has_loop v})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card {v \<in> V. has_loop v} = card (f ` {v \<in> V. has_loop v})

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {v \<in> V. has_loop v} = card (f ` {v \<in> V. has_loop v})

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
have "... = card {{v} | v . has_loop v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (f ` {v \<in> V. has_loop v}) = card {{v} |v. has_loop v}
[PROOF STEP]
using feq
[PROOF STATE]
proof (prove)
using this:
f ` {v \<in> V. has_loop v} = {{v} |v. has_loop v}

goal (1 subgoal):
 1. card (f ` {v \<in> V. has_loop v}) = card {{v} |v. has_loop v}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (f ` {v \<in> V. has_loop v}) = card {{v} |v. has_loop v}

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {v \<in> V. has_loop v} = card {{v} |v. has_loop v}
[PROOF STEP]
have "card {v \<in> V . has_loop v} = card {e \<in> E . is_loop e}"
[PROOF STATE]
proof (prove)
using this:
card {v \<in> V. has_loop v} = card {{v} |v. has_loop v}

goal (1 subgoal):
 1. card {v \<in> V. has_loop v} = card {e \<in> E. is_loop e}
[PROOF STEP]
using is_loop_set_alt
[PROOF STATE]
proof (prove)
using this:
card {v \<in> V. has_loop v} = card {{v} |v. has_loop v}
{{v} |v. has_loop v} = {e \<in> E. is_loop e}

goal (1 subgoal):
 1. card {v \<in> V. has_loop v} = card {e \<in> E. is_loop e}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {v \<in> V. has_loop v} = card {e \<in> E. is_loop e}

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
thus "card {e \<in> E . is_loop e} = card {v \<in> V . has_loop v}"
[PROOF STATE]
proof (prove)
using this:
card {v \<in> V. has_loop v} = card {e \<in> E. is_loop e}

goal (1 subgoal):
 1. card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {e \<in> E. is_loop e} = card {v \<in> V. has_loop v}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gf_U'_nonneg[simp]: "0 < z \<Longrightarrow> z < 1 \<Longrightarrow> 0 \<le> gf_U' x y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < z; z < 1\<rbrakk> \<Longrightarrow> 0 \<le> gf_U' x y z
[PROOF STEP]
unfolding gf_U'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < z; z < 1\<rbrakk> \<Longrightarrow> 0 \<le> (\<Sum>n. u x y n * real (Suc n) * z ^ n)
[PROOF STEP]
by (intro suminf_nonneg summable_gf_U') (auto simp: u_nonneg)


[STATEMENT]
lemma central_binomial_odd:
  "odd n \<Longrightarrow> n choose (Suc (n div 2)) = n choose (n div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd n \<Longrightarrow> n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. odd n \<Longrightarrow> n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
assume "odd n"
[PROOF STATE]
proof (state)
this:
odd n

goal (1 subgoal):
 1. odd n \<Longrightarrow> n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
hence "Suc (n div 2) \<le> n"
[PROOF STATE]
proof (prove)
using this:
odd n

goal (1 subgoal):
 1. Suc (n div 2) \<le> n
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
Suc (n div 2) \<le> n

goal (1 subgoal):
 1. odd n \<Longrightarrow> n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
hence "n choose (Suc (n div 2)) = n choose (n - Suc (n div 2))"
[PROOF STATE]
proof (prove)
using this:
Suc (n div 2) \<le> n

goal (1 subgoal):
 1. n choose Suc (n div 2) = n choose (n - Suc (n div 2))
[PROOF STEP]
by (rule binomial_symmetric)
[PROOF STATE]
proof (state)
this:
n choose Suc (n div 2) = n choose (n - Suc (n div 2))

goal (1 subgoal):
 1. odd n \<Longrightarrow> n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n choose Suc (n div 2) = n choose (n - Suc (n div 2))

goal (1 subgoal):
 1. odd n \<Longrightarrow> n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
from \<open>odd n\<close>
[PROOF STATE]
proof (chain)
picking this:
odd n
[PROOF STEP]
have "n - Suc (n div 2) = n div 2"
[PROOF STATE]
proof (prove)
using this:
odd n

goal (1 subgoal):
 1. n - Suc (n div 2) = n div 2
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
n - Suc (n div 2) = n div 2

goal (1 subgoal):
 1. odd n \<Longrightarrow> n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n choose Suc (n div 2) = n choose n div 2

goal (1 subgoal):
 1. n choose Suc (n div 2) = n choose n div 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
n choose Suc (n div 2) = n choose n div 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_buffon_set' [simp, intro, measurable]: "closed Buffon_set'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed Buffon_set'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed Buffon_set'
[PROOF STEP]
have "Buffon_set' = ({0..d/2} \<times> {0..pi}) \<inter>
          (\<lambda>z. fst z + sin (snd z) * l / 2 - d / 2) -` {0..}"
    (is "_ = ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Buffon_set' = {0..d / 2} \<times> {0..pi} \<inter> (\<lambda>z. fst z + sin (snd z) * l / 2 - d / 2) -` {0..}
[PROOF STEP]
unfolding Buffon_set'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, \<phi>). (x, \<phi>) \<in> {0..d / 2} \<times> {0..pi} \<and> d / 2 - sin \<phi> * l / 2 \<le> x} = {0..d / 2} \<times> {0..pi} \<inter> (\<lambda>z. fst z + sin (snd z) * l / 2 - d / 2) -` {0..}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Buffon_set' = {0..d / 2} \<times> {0..pi} \<inter> (\<lambda>z. fst z + sin (snd z) * l / 2 - d / 2) -` {0..}

goal (1 subgoal):
 1. closed Buffon_set'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Buffon_set' = {0..d / 2} \<times> {0..pi} \<inter> (\<lambda>z. fst z + sin (snd z) * l / 2 - d / 2) -` {0..}

goal (1 subgoal):
 1. closed Buffon_set'
[PROOF STEP]
have "closed \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed ({0..d / 2} \<times> {0..pi} \<inter> (\<lambda>z. fst z + sin (snd z) * l / 2 - d / 2) -` {0..})
[PROOF STEP]
by (intro closed_Int closed_vimage closed_Times) (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
closed ({0..d / 2} \<times> {0..pi} \<inter> (\<lambda>z. fst z + sin (snd z) * l / 2 - d / 2) -` {0..})

goal (1 subgoal):
 1. closed Buffon_set'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
closed Buffon_set'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closed Buffon_set'

goal (1 subgoal):
 1. closed Buffon_set'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closed Buffon_set'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_inv:
  assumes "invertible M"
  shows matrix_inv_left: "matrix_inv M ** M = mat 1"
    and matrix_inv_right: "M ** matrix_inv M = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_inv M ** M = mat (1::'a) &&& M ** matrix_inv M = mat (1::'a)
[PROOF STEP]
using \<open>invertible M\<close> and someI_ex [of "\<lambda> N. M ** N = mat 1 \<and> N ** M = mat 1"]
[PROOF STATE]
proof (prove)
using this:
invertible M
\<exists>x. M ** x = mat (1::'a) \<and> x ** M = mat (1::'a) \<Longrightarrow> M ** (SOME x. M ** x = mat (1::'a) \<and> x ** M = mat (1::'a)) = mat (1::'a) \<and> (SOME x. M ** x = mat (1::'a) \<and> x ** M = mat (1::'a)) ** M = mat (1::'a)

goal (1 subgoal):
 1. matrix_inv M ** M = mat (1::'a) &&& M ** matrix_inv M = mat (1::'a)
[PROOF STEP]
unfolding invertible_def and matrix_inv_def
[PROOF STATE]
proof (prove)
using this:
\<exists>A'. M ** A' = mat (1::'a) \<and> A' ** M = mat (1::'a)
\<exists>x. M ** x = mat (1::'a) \<and> x ** M = mat (1::'a) \<Longrightarrow> M ** (SOME x. M ** x = mat (1::'a) \<and> x ** M = mat (1::'a)) = mat (1::'a) \<and> (SOME x. M ** x = mat (1::'a) \<and> x ** M = mat (1::'a)) ** M = mat (1::'a)

goal (1 subgoal):
 1. (SOME A'. M ** A' = mat (1::'a) \<and> A' ** M = mat (1::'a)) ** M = mat (1::'a) &&& M ** (SOME A'. M ** A' = mat (1::'a) \<and> A' ** M = mat (1::'a)) = mat (1::'a)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma matrix_to_iarray_Gram_Schmidt_upt_k_efficient:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes k: "k<ncols A"
  shows "matrix_to_iarray (Gram_Schmidt_upt_k A k)
  = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A 0) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc 0]
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < ncols A

goal (2 subgoals):
 1. 0 < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A 0) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc 0]
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
have zero_le: "0<ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < ncols A
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < ncols A

goal (2 subgoals):
 1. 0 < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A 0) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc 0]
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A 0) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc 0]
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_efficient[OF zero_le]
[PROOF STATE]
proof (prove)
using this:
0 < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k_efficient A [0..<Suc 0]) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc 0]
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_efficient
[PROOF STATE]
proof (prove)
using this:
0 < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k_efficient A [0..<Suc 0]) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc 0]
[PROOF STEP]
by (simp add: matrix_to_iarray_Gram_Schmidt_column_k_efficient[OF "0.prems"])
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gram_Schmidt_upt_k A 0) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc 0]

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]
Suc k < ncols A

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
let ?G="foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
have k: "k<ncols (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < ncols (Gram_Schmidt_upt_k A k)
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc k < ncols A

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

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

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
have k2: "Suc k < ncols (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k < ncols (Gram_Schmidt_upt_k A k)
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc k < ncols A

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

goal (1 subgoal):
 1. Suc k < CARD('n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Suc k < ncols (Gram_Schmidt_upt_k A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
have list_rw: "[0..<Suc (Suc k)] = [0..<Suc k] @ [(Suc k)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
have hyp: "matrix_to_iarray (Gram_Schmidt_upt_k A k) = ?G [0..<Suc k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]
[PROOF STEP]
by (metis Suc.hyps Suc.prems Suc_lessD)
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
show "matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = ?G [0..<Suc (Suc k)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k A [0..<Suc (Suc k)]) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
unfolding list_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k A ([0..<Suc k] @ [Suc k])) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) ([0..<Suc k] @ [Suc k])
[PROOF STEP]
unfolding foldl_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) [Suc k]) = foldl Gram_Schmidt_column_k_iarrays_efficient (foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]) [Suc k]
[PROOF STEP]
unfolding foldl.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) (Suc k)) = Gram_Schmidt_column_k_iarrays_efficient (foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]) (Suc k)
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = Gram_Schmidt_column_k_iarrays_efficient (foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc k]) (Suc k)
[PROOF STEP]
unfolding hyp[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray (Gram_Schmidt_upt_k A k)) (Suc k)
[PROOF STEP]
using matrix_to_iarray_Gram_Schmidt_column_k_efficient
[PROOF STATE]
proof (prove)
using this:
?k < ncols ?A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_column_k_efficient ?A ?k) = Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray ?A) ?k

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray (Gram_Schmidt_upt_k A k)) (Suc k)
[PROOF STEP]
by (metis (no_types) Gram_Schmidt_upt_k_efficient Gram_Schmidt_upt_k_efficient_induction
      Suc.prems k matrix_to_iarray_Gram_Schmidt_column_k_efficient ncols_def)
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (Suc k)]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma root_0 [simp]: "root 0 x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root 0 x = 0
[PROOF STEP]
by (simp add: root_def)


[STATEMENT]
lemma coset_map: assumes "bij f" shows "List.coset (map f xs) =  f ` List.coset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.coset (map f xs) = f ` List.coset xs
[PROOF STEP]
using bij_image_Compl_eq[OF \<open>bij f\<close>, symmetric]
[PROOF STATE]
proof (prove)
using this:
- f ` ?A = f ` (- ?A)

goal (1 subgoal):
 1. List.coset (map f xs) = f ` List.coset xs
[PROOF STEP]
unfolding coset_def set_map
[PROOF STATE]
proof (prove)
using this:
- f ` ?A = f ` (- ?A)

goal (1 subgoal):
 1. - f ` set xs = f ` (- set xs)
[PROOF STEP]
.


[STATEMENT]
theorem locked_unique:
assumes
  "s \<in> Vinv2"
  "v \<in> locked s" "w \<in> locked s"
shows
  "v = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v = w
[PROOF STEP]
from assms(2-3)
[PROOF STATE]
proof (chain)
picking this:
v \<in> locked s
w \<in> locked s
[PROOF STEP]
obtain r1 r2 where quoIn: "locked_in s r1 v" "locked_in s r2 w"
[PROOF STATE]
proof (prove)
using this:
v \<in> locked s
w \<in> locked s

goal (1 subgoal):
 1. (\<And>r1 r2. \<lbrakk>locked_in s r1 v; locked_in s r2 w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: locked_def)
[PROOF STATE]
proof (state)
this:
locked_in s r1 v
locked_in s r2 w

goal (1 subgoal):
 1. v = w
[PROOF STEP]
have "r1 < r2 \<or> r1 = r2 \<or> r2 < r1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r1 < r2 \<or> r1 = r2 \<or> r2 < r1
[PROOF STEP]
by (rule linorder_less_linear)
[PROOF STATE]
proof (state)
this:
r1 < r2 \<or> r1 = r2 \<or> r2 < r1

goal (1 subgoal):
 1. v = w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r1 < r2 \<or> r1 = r2 \<or> r2 < r1

goal (1 subgoal):
 1. v = w
[PROOF STEP]
proof (elim disjE)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. r1 < r2 \<Longrightarrow> v = w
 2. r1 = r2 \<Longrightarrow> v = w
 3. r2 < r1 \<Longrightarrow> v = w
[PROOF STEP]
assume "r1 = r2"
[PROOF STATE]
proof (state)
this:
r1 = r2

goal (3 subgoals):
 1. r1 < r2 \<Longrightarrow> v = w
 2. r1 = r2 \<Longrightarrow> v = w
 3. r2 < r1 \<Longrightarrow> v = w
[PROOF STEP]
with quoIn
[PROOF STATE]
proof (chain)
picking this:
locked_in s r1 v
locked_in s r2 w
r1 = r2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
locked_in s r1 v
locked_in s r2 w
r1 = r2

goal (1 subgoal):
 1. v = w
[PROOF STEP]
by(simp add: locked_in_def locked_in_vf_same)
[PROOF STATE]
proof (state)
this:
v = w

goal (2 subgoals):
 1. r1 < r2 \<Longrightarrow> v = w
 2. r2 < r1 \<Longrightarrow> v = w
[PROOF STEP]
qed(auto intro: locked_in_different[OF \<open>s \<in> Vinv2\<close>] quoIn sym)
[PROOF STATE]
proof (state)
this:
v = w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in comm_group) power_order_eq_one:
  assumes fin [simp]: "finite (carrier G)"
    and a [simp]: "a \<in> carrier G"
  shows "a [^] card(carrier G) = one G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] card (carrier G) = \<one>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a [^] card (carrier G) = \<one>
[PROOF STEP]
have "(\<Otimes>x\<in>carrier G. x) = (\<Otimes>x\<in>carrier G. a \<otimes> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Otimes>x\<in>carrier G. x) = finprod G ((\<otimes>) a) (carrier G)
[PROOF STEP]
by (subst (2) finprod_reindex [symmetric],
      auto simp add: Pi_def inj_on_cmult surj_const_mult)
[PROOF STATE]
proof (state)
this:
(\<Otimes>x\<in>carrier G. x) = finprod G ((\<otimes>) a) (carrier G)

goal (1 subgoal):
 1. a [^] card (carrier G) = \<one>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Otimes>x\<in>carrier G. x) = finprod G ((\<otimes>) a) (carrier G)

goal (1 subgoal):
 1. a [^] card (carrier G) = \<one>
[PROOF STEP]
have "\<dots> = (\<Otimes>x\<in>carrier G. a) \<otimes> (\<Otimes>x\<in>carrier G. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G ((\<otimes>) a) (carrier G) = (\<Otimes>x\<in>carrier G. a) \<otimes> (\<Otimes>x\<in>carrier G. x)
[PROOF STEP]
by (auto simp add: finprod_multf Pi_def)
[PROOF STATE]
proof (state)
this:
finprod G ((\<otimes>) a) (carrier G) = (\<Otimes>x\<in>carrier G. a) \<otimes> (\<Otimes>x\<in>carrier G. x)

goal (1 subgoal):
 1. a [^] card (carrier G) = \<one>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finprod G ((\<otimes>) a) (carrier G) = (\<Otimes>x\<in>carrier G. a) \<otimes> (\<Otimes>x\<in>carrier G. x)

goal (1 subgoal):
 1. a [^] card (carrier G) = \<one>
[PROOF STEP]
have "(\<Otimes>x\<in>carrier G. a) = a [^] card(carrier G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Otimes>x\<in>carrier G. a) = a [^] card (carrier G)
[PROOF STEP]
by (auto simp add: finprod_const)
[PROOF STATE]
proof (state)
this:
(\<Otimes>x\<in>carrier G. a) = a [^] card (carrier G)

goal (1 subgoal):
 1. a [^] card (carrier G) = \<one>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Otimes>x\<in>carrier G. x) = a [^] card (carrier G) \<otimes> (\<Otimes>x\<in>carrier G. x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Otimes>x\<in>carrier G. x) = a [^] card (carrier G) \<otimes> (\<Otimes>x\<in>carrier G. x)

goal (1 subgoal):
 1. a [^] card (carrier G) = \<one>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a [^] card (carrier G) = \<one>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem list_to_nat_th [simp]: "list_to_nat (nat_to_list u) = u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_to_nat (nat_to_list u) = u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. list_to_nat (nat_to_list u) = u
[PROOF STEP]
have S1: "u=0 \<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u = 0 \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
by (simp add: list_to_nat_def nat_to_list_def)
[PROOF STATE]
proof (state)
this:
u = 0 \<Longrightarrow> list_to_nat (nat_to_list u) = u

goal (1 subgoal):
 1. list_to_nat (nat_to_list u) = u
[PROOF STEP]
have S2: "u>0 \<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
assume A1: "u>0"
[PROOF STATE]
proof (state)
this:
0 < u

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
define ls where "ls = nat_to_list u"
[PROOF STATE]
proof (state)
this:
ls = nat_to_list u

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from ls_def A1
[PROOF STATE]
proof (chain)
picking this:
ls = nat_to_list u
0 < u
[PROOF STEP]
have S2_1: "ls = c_unfold (c_len u) (c_snd (u-(1::nat)))"
[PROOF STATE]
proof (prove)
using this:
ls = nat_to_list u
0 < u

goal (1 subgoal):
 1. ls = c_unfold (c_len u) (c_snd (u - 1))
[PROOF STEP]
by (simp add: nat_to_list_def)
[PROOF STATE]
proof (state)
this:
ls = c_unfold (c_len u) (c_snd (u - 1))

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
let ?k = "c_len u"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
0 < u
[PROOF STEP]
have S2_2: "?k > 0"
[PROOF STATE]
proof (prove)
using this:
0 < u

goal (1 subgoal):
 1. 0 < c_len u
[PROOF STEP]
by (rule c_len_3)
[PROOF STATE]
proof (state)
this:
0 < c_len u

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from S2_1
[PROOF STATE]
proof (chain)
picking this:
ls = c_unfold (c_len u) (c_snd (u - 1))
[PROOF STEP]
have S2_3: "length ls = ?k"
[PROOF STATE]
proof (prove)
using this:
ls = c_unfold (c_len u) (c_snd (u - 1))

goal (1 subgoal):
 1. length ls = c_len u
[PROOF STEP]
by (simp add: c_unfold_len)
[PROOF STATE]
proof (state)
this:
length ls = c_len u

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from S2_2 S2_3
[PROOF STATE]
proof (chain)
picking this:
0 < c_len u
length ls = c_len u
[PROOF STEP]
have S2_4: "length ls > 0"
[PROOF STATE]
proof (prove)
using this:
0 < c_len u
length ls = c_len u

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

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from S2_4
[PROOF STATE]
proof (chain)
picking this:
0 < length ls
[PROOF STEP]
have S2_5: "ls \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
0 < length ls

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

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from S2_5
[PROOF STATE]
proof (chain)
picking this:
ls \<noteq> []
[PROOF STEP]
have S2_6: "list_to_nat ls = c_pair ((length ls)-(1::nat)) (c_fold ls)+1"
[PROOF STATE]
proof (prove)
using this:
ls \<noteq> []

goal (1 subgoal):
 1. list_to_nat ls = c_pair (length ls - 1) (c_fold ls) + 1
[PROOF STEP]
by (simp add: list_to_nat_def)
[PROOF STATE]
proof (state)
this:
list_to_nat ls = c_pair (length ls - 1) (c_fold ls) + 1

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
have S2_7: "c_fold ls = c_snd(u-(1::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_fold ls = c_snd (u - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_fold ls = c_snd (u - 1)
[PROOF STEP]
from S2_1
[PROOF STATE]
proof (chain)
picking this:
ls = c_unfold (c_len u) (c_snd (u - 1))
[PROOF STEP]
have S2_7_1: "c_fold ls = c_fold (c_unfold (c_len u) (c_snd (u-(1::nat))))"
[PROOF STATE]
proof (prove)
using this:
ls = c_unfold (c_len u) (c_snd (u - 1))

goal (1 subgoal):
 1. c_fold ls = c_fold (c_unfold (c_len u) (c_snd (u - 1)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_fold ls = c_fold (c_unfold (c_len u) (c_snd (u - 1)))

goal (1 subgoal):
 1. c_fold ls = c_snd (u - 1)
[PROOF STEP]
from S2_2 S2_7_1
[PROOF STATE]
proof (chain)
picking this:
0 < c_len u
c_fold ls = c_fold (c_unfold (c_len u) (c_snd (u - 1)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < c_len u
c_fold ls = c_fold (c_unfold (c_len u) (c_snd (u - 1)))

goal (1 subgoal):
 1. c_fold ls = c_snd (u - 1)
[PROOF STEP]
by (simp add: th_2)
[PROOF STATE]
proof (state)
this:
c_fold ls = c_snd (u - 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c_fold ls = c_snd (u - 1)

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
have S2_8: "(length ls)-(1::nat) = c_fst (u-(1::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ls - 1 = c_fst (u - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length ls - 1 = c_fst (u - 1)
[PROOF STEP]
from S2_3
[PROOF STATE]
proof (chain)
picking this:
length ls = c_len u
[PROOF STEP]
have S2_8_1: "length ls = c_len u"
[PROOF STATE]
proof (prove)
using this:
length ls = c_len u

goal (1 subgoal):
 1. length ls = c_len u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length ls = c_len u

goal (1 subgoal):
 1. length ls - 1 = c_fst (u - 1)
[PROOF STEP]
from A1 S2_8_1
[PROOF STATE]
proof (chain)
picking this:
0 < u
length ls = c_len u
[PROOF STEP]
have S2_8_2: "length ls = c_fst(u-(1::nat)) + 1"
[PROOF STATE]
proof (prove)
using this:
0 < u
length ls = c_len u

goal (1 subgoal):
 1. length ls = c_fst (u - 1) + 1
[PROOF STEP]
by (simp add: c_len_2)
[PROOF STATE]
proof (state)
this:
length ls = c_fst (u - 1) + 1

goal (1 subgoal):
 1. length ls - 1 = c_fst (u - 1)
[PROOF STEP]
from S2_8_2
[PROOF STATE]
proof (chain)
picking this:
length ls = c_fst (u - 1) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length ls = c_fst (u - 1) + 1

goal (1 subgoal):
 1. length ls - 1 = c_fst (u - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length ls - 1 = c_fst (u - 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length ls - 1 = c_fst (u - 1)

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from S2_7 S2_8
[PROOF STATE]
proof (chain)
picking this:
c_fold ls = c_snd (u - 1)
length ls - 1 = c_fst (u - 1)
[PROOF STEP]
have S2_9: "c_pair ((length ls)-(1::nat)) (c_fold ls) = c_pair (c_fst (u-(1::nat))) (c_snd (u-(1::nat)))"
[PROOF STATE]
proof (prove)
using this:
c_fold ls = c_snd (u - 1)
length ls - 1 = c_fst (u - 1)

goal (1 subgoal):
 1. c_pair (length ls - 1) (c_fold ls) = c_pair (c_fst (u - 1)) (c_snd (u - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_pair (length ls - 1) (c_fold ls) = c_pair (c_fst (u - 1)) (c_snd (u - 1))

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from S2_9
[PROOF STATE]
proof (chain)
picking this:
c_pair (length ls - 1) (c_fold ls) = c_pair (c_fst (u - 1)) (c_snd (u - 1))
[PROOF STEP]
have S2_10: "c_pair ((length ls)-(1::nat)) (c_fold ls) = u - (1::nat)"
[PROOF STATE]
proof (prove)
using this:
c_pair (length ls - 1) (c_fold ls) = c_pair (c_fst (u - 1)) (c_snd (u - 1))

goal (1 subgoal):
 1. c_pair (length ls - 1) (c_fold ls) = u - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_pair (length ls - 1) (c_fold ls) = u - 1

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from S2_6 S2_10
[PROOF STATE]
proof (chain)
picking this:
list_to_nat ls = c_pair (length ls - 1) (c_fold ls) + 1
c_pair (length ls - 1) (c_fold ls) = u - 1
[PROOF STEP]
have S2_11: "list_to_nat ls = (u - (1::nat))+1"
[PROOF STATE]
proof (prove)
using this:
list_to_nat ls = c_pair (length ls - 1) (c_fold ls) + 1
c_pair (length ls - 1) (c_fold ls) = u - 1

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

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
0 < u
[PROOF STEP]
have S2_12: "(u - (1::nat))+1 = u"
[PROOF STATE]
proof (prove)
using this:
0 < u

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

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
from ls_def S2_11 S2_12
[PROOF STATE]
proof (chain)
picking this:
ls = nat_to_list u
list_to_nat ls = u - 1 + 1
u - 1 + 1 = u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ls = nat_to_list u
list_to_nat ls = u - 1 + 1
u - 1 + 1 = u

goal (1 subgoal):
 1. list_to_nat (nat_to_list u) = u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_to_nat (nat_to_list u) = u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u

goal (1 subgoal):
 1. list_to_nat (nat_to_list u) = u
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
u = 0 \<Longrightarrow> list_to_nat (nat_to_list u) = u
0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u = 0 \<Longrightarrow> list_to_nat (nat_to_list u) = u
0 < u \<Longrightarrow> list_to_nat (nat_to_list u) = u

goal (1 subgoal):
 1. list_to_nat (nat_to_list u) = u
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
list_to_nat (nat_to_list u) = u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma height'_node33:
  "height m > 0 \<Longrightarrow> hD(node33 l a m b r) =
   max (height l) (max (height m) (hD r)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height m \<Longrightarrow> hD (node33 l a m b r) = max (height l) (max (height m) (hD r)) + 1
[PROOF STEP]
by(induct l a m b r rule: node33.induct)(simp_all add: max_def)


[STATEMENT]
lemma map_key_compose:
  assumes [transfer_rule]: "inj f" "inj g"
  shows "map_key f (map_key g p) = map_key (g \<circ> f) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_key f (map_key g p) = map_key (g \<circ> f) p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map_key f (map_key g p) = map_key (g \<circ> f) p
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
inj f
inj g
[PROOF STEP]
have [transfer_rule]: "inj (g \<circ> f)"
[PROOF STATE]
proof (prove)
using this:
inj f
inj g

goal (1 subgoal):
 1. inj (g \<circ> f)
[PROOF STEP]
by(simp add: inj_compose)
[PROOF STATE]
proof (state)
this:
inj (g \<circ> f)

goal (1 subgoal):
 1. map_key f (map_key g p) = map_key (g \<circ> f) p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_key f (map_key g p) = map_key (g \<circ> f) p
[PROOF STEP]
by transfer(simp add: o_assoc)
[PROOF STATE]
proof (state)
this:
map_key f (map_key g p) = map_key (g \<circ> f) p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma int_rdvd_iff: "(real_of_int (i::int) rdvd real_of_int t) = (i dvd t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_int i rdvd real_of_int t) = (i dvd t)
[PROOF STEP]
by (auto simp add: rdvd_def dvd_def) (rule_tac x="k" in exI, simp only: of_int_mult[symmetric])


[STATEMENT]
lemma fds_scale_add [simp]:
  fixes f g :: "'a :: monoid_add fds"
  shows "fds_scale c (f + g) = fds_scale c f + fds_scale c g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_scale c (f + g) = fds_scale c f + fds_scale c g
[PROOF STEP]
by (rule fds_eqI) (auto simp: fds_nth_scale)


[STATEMENT]
lemma bounded_by_add:
  fixes P::"'s \<Rightarrow> real" and Q
  assumes bP: "bounded_by a P"
      and bQ: "bounded_by b Q"
  shows "bounded_by (a + b) (\<lambda>s. P s + Q s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_by (a + b) (\<lambda>s. P s + Q s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded_by a P
bounded_by b Q

goal (1 subgoal):
 1. bounded_by (a + b) (\<lambda>s. P s + Q s)
[PROOF STEP]
by(intro bounded_byI, auto intro:add_mono)


[STATEMENT]
lemma poly_different_sign_imp_root':
  assumes "sgn (poly p a) \<noteq> sgn (poly p (b::real))"
  shows "\<exists>x. poly p x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. poly p x = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sgn (poly p a) \<noteq> sgn (poly p b)

goal (1 subgoal):
 1. \<exists>x. poly p x = 0
[PROOF STEP]
by (cases "a < b", auto dest!: poly_different_sign_imp_root
                                    simp: less_eq_real_def not_less)


[STATEMENT]
lemma forall_union: "\<lbrakk>\<forall>a \<in> dom A. P (A a); \<forall>b \<in> dom B. P (B b)\<rbrakk> \<Longrightarrow> \<forall>x \<in> dom A \<union> dom B. P ((B ++ A) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>dom A. P (A a); \<forall>b\<in>dom B. P (B b)\<rbrakk> \<Longrightarrow> \<forall>x\<in>dom A \<union> dom B. P ((B ++ A) x)
[PROOF STEP]
apply(safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>\<forall>a\<in>dom A. P (A a); \<forall>b\<in>dom B. P (B b); A x = Some y\<rbrakk> \<Longrightarrow> P ((B ++ A) x)
 2. \<And>x y. \<lbrakk>\<forall>a\<in>dom A. P (A a); \<forall>b\<in>dom B. P (B b); B x = Some y\<rbrakk> \<Longrightarrow> P ((B ++ A) x)
[PROOF STEP]
apply(force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<forall>a\<in>dom A. P (A a); \<forall>b\<in>dom B. P (B b); B x = Some y\<rbrakk> \<Longrightarrow> P ((B ++ A) x)
[PROOF STEP]
apply(drule_tac x = x in bspec, simp add: domI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<forall>a\<in>dom A. P (A a); B x = Some y; P (B x)\<rbrakk> \<Longrightarrow> P ((B ++ A) x)
[PROOF STEP]
apply(case_tac "A x = None")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>\<forall>a\<in>dom A. P (A a); B x = Some y; P (B x); A x = None\<rbrakk> \<Longrightarrow> P ((B ++ A) x)
 2. \<And>x y. \<lbrakk>\<forall>a\<in>dom A. P (A a); B x = Some y; P (B x); A x \<noteq> None\<rbrakk> \<Longrightarrow> P ((B ++ A) x)
[PROOF STEP]
apply(force simp add: map_add_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<forall>a\<in>dom A. P (A a); B x = Some y; P (B x); A x \<noteq> None\<rbrakk> \<Longrightarrow> P ((B ++ A) x)
[PROOF STEP]
by (force)


[STATEMENT]
lemma a_translate_eq:
  assumes "c \<in> carrier R"
  assumes "a \<in> carrier R"
  shows "a_translate c a = c \<oplus> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a_translate c a = c \<oplus> a
[PROOF STEP]
by (simp add: a_translate_def assms(1) assms(2))


[STATEMENT]
lemma "(\<forall>x. P x) \<and> (\<forall>x. Q x) \<Longrightarrow> (\<forall>x. P x \<and> Q x)"
  and  "\<exists>x. P x \<longrightarrow> (\<forall>x. P x)"
  and "(\<exists>x. \<forall>y. R x y) \<longrightarrow> (\<forall>y. \<exists>x. R x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>x. P x) \<and> (\<forall>x. Q x) \<Longrightarrow> \<forall>x. P x \<and> Q x) &&& \<exists>x. P x \<longrightarrow> (\<forall>x. P x) &&& (\<exists>x. \<forall>y. R x y) \<longrightarrow> (\<forall>y. \<exists>x. R x y)
[PROOF STEP]
by fol_solver+


[STATEMENT]
lemma TC': "TC x = x \<squnion> TC (\<Squnion> (elts x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TC x = x \<squnion> TC (\<Squnion> elts x)
[PROOF STEP]
by (simp add: TC [of x] TC_Sup_distrib)


[STATEMENT]
lemma "dist a d \<le> dist a b + dist b c + dist c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist a d \<le> dist a b + dist b c + dist c d
[PROOF STEP]
by metric_eisbach


[STATEMENT]
lemma all1_less_lemma [simp]:
  "rec_eval (rec_all1_less f) [x, y] = (if (\<forall>z < x. 0 < rec_eval f [z, y]) then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_eval (rec_all1_less f) [x, y] = (if \<forall>z<x. 0 < rec_eval f [z, y] then 1 else 0)
[PROOF STEP]
apply(auto simp add: Let_def rec_all1_less_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>z. \<lbrakk>\<forall>z\<le>x. z = x \<or> 0 < rec_eval f [z, y]; z < x; rec_eval f [z, y] = 0\<rbrakk> \<Longrightarrow> \<exists>z\<le>x. z \<noteq> x \<and> rec_eval f [z, y] = 0
 2. \<And>z. \<lbrakk>z \<le> x; z \<noteq> x; rec_eval f [z, y] = 0\<rbrakk> \<Longrightarrow> \<exists>z<x. rec_eval f [z, y] = 0
[PROOF STEP]
apply (metis nat_less_le)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem "\<not> (\<exists>(x::int). False)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>x. False
[PROOF STEP]
by cooper


[STATEMENT]
lemma tensor_prod_unit_vec:
"unit_vec M j \<otimes> unit_vec M j = tensor_from_lookup [M,M] (\<lambda>is. if is=[j,j] then 1 else 0)" (is "?A=?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_vec M j \<otimes> unit_vec M j = tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))
[PROOF STEP]
proof (rule tensor_lookup_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dims (unit_vec M j \<otimes> unit_vec M j) = dims (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a)))
 2. \<And>is. is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j) \<Longrightarrow> lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
show "Tensor.dims ?A = Tensor.dims ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dims (unit_vec M j \<otimes> unit_vec M j) = dims (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a)))
[PROOF STEP]
by (metis append_Cons self_append_conv2 dims_unit_vec dims_tensor_prod dims_tensor_from_lookup)
[PROOF STATE]
proof (state)
this:
dims (unit_vec M j \<otimes> unit_vec M j) = dims (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a)))

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j) \<Longrightarrow> lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
fix "is"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j) \<Longrightarrow> lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
assume is_valid:"is \<lhd> Tensor.dims (unit_vec M j \<otimes> unit_vec M j)"
[PROOF STATE]
proof (state)
this:
is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j)

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j) \<Longrightarrow> lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j)
[PROOF STEP]
have "is \<lhd> [M,M]"
[PROOF STATE]
proof (prove)
using this:
is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j)

goal (1 subgoal):
 1. is \<lhd> [M, M]
[PROOF STEP]
by (metis append_Cons self_append_conv2 dims_unit_vec dims_tensor_prod)
[PROOF STATE]
proof (state)
this:
is \<lhd> [M, M]

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j) \<Longrightarrow> lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is \<lhd> [M, M]
[PROOF STEP]
obtain i1 i2 where is_split: "is = [i1, i2]" "i1 < M" "i2 < M"
[PROOF STATE]
proof (prove)
using this:
is \<lhd> [M, M]

goal (1 subgoal):
 1. (\<And>i1 i2. \<lbrakk>is = [i1, i2]; i1 < M; i2 < M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using list.distinct(1)
[PROOF STATE]
proof (prove)
using this:
is \<lhd> [M, M]
[] \<noteq> ?x21.0 # ?x22.0

goal (1 subgoal):
 1. (\<And>i1 i2. \<lbrakk>is = [i1, i2]; i1 < M; i2 < M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is = [i1, i2]
i1 < M
i2 < M

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j) \<Longrightarrow> lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is = [i1, i2]
i1 < M
i2 < M
[PROOF STEP]
have "[i1] \<lhd> Tensor.dims (unit_vec M j)" "[i2] \<lhd> Tensor.dims (unit_vec M j)"
[PROOF STATE]
proof (prove)
using this:
is = [i1, i2]
i1 < M
i2 < M

goal (1 subgoal):
 1. [i1] \<lhd> dims (unit_vec M j) &&& [i2] \<lhd> dims (unit_vec M j)
[PROOF STEP]
by (simp_all add: valid_index.Cons valid_index.Nil dims_unit_vec)
[PROOF STATE]
proof (state)
this:
[i1] \<lhd> dims (unit_vec M j)
[i2] \<lhd> dims (unit_vec M j)

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j) \<Longrightarrow> lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
have "is = [i1] @ [i2]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is = [i1] @ [i2]
[PROOF STEP]
by (simp add: is_split(1))
[PROOF STATE]
proof (state)
this:
is = [i1] @ [i2]

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (unit_vec M j \<otimes> unit_vec M j) \<Longrightarrow> lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
show "Tensor.lookup ?A is = Tensor.lookup ?B is"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is
[PROOF STEP]
unfolding \<open>is = [i1] @ [i2]\<close>
     lookup_tensor_prod[OF \<open>[i1] \<lhd> Tensor.dims (unit_vec M j)\<close> \<open>[i2] \<lhd> Tensor.dims (unit_vec M j)\<close>]
     lookup_tensor_from_lookup[OF \<open>is \<lhd> [M, M]\<close>, unfolded  \<open>is = [i1] @ [i2]\<close>]
     lookup_unit_vec[OF \<open>i1 < M\<close>] lookup_unit_vec[OF \<open>i2 < M\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if j = i1 then 1::'a else (0::'a)) * (if j = i2 then 1::'a else (0::'a)) = (if [i1] @ [i2] = [j, j] then 1::'a else (0::'a))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
lookup (unit_vec M j \<otimes> unit_vec M j) is = lookup (tensor_from_lookup [M, M] (\<lambda>is. if is = [j, j] then 1::'a else (0::'a))) is

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem or_cancel1: "\<not>Q \<Longrightarrow> (P \<or> Q) = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> Q \<Longrightarrow> (P \<or> Q) = P
[PROOF STEP]
by auto


[STATEMENT]
lemma "\<exists>(y::'a::linordered_field) < 2. x + 3* y < 0 \<and> x - y > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y<2::'a. x + (3::'a) * y < (0::'a) \<and> (0::'a) < x - y
[PROOF STEP]
by ferrack


[STATEMENT]
lemma circ_mult_below_circ_circ:
  "(x * y)\<^sup>\<circ> \<le> (x\<^sup>\<circ> * y)\<^sup>\<circ> * x\<^sup>\<circ>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * y)\<^sup>\<circ> \<le> (x\<^sup>\<circ> * y)\<^sup>\<circ> * x\<^sup>\<circ>
[PROOF STEP]
by (metis circ_increasing circ_isotone circ_reflexive dual_order.trans mult_left_isotone mult_right_isotone mult_1_right)


[STATEMENT]
lemma Equiv_Exec_le1: "
  \<lbrakk> k1 \<le> Suc 0; k2 \<le> Suc 0;
    equiv_states (localState1 c1) (localState2 c2);
    Equiv_Exec m
      equiv_states localState1 localState2 input_fun1 input_fun2 output_fun1 output_fun2
      trans_fun1 trans_fun2 k1 k2 c1 c2 \<rbrakk> \<Longrightarrow>
  output_fun1 (trans_fun1 (input_fun1 m) c1) =
  output_fun2 (trans_fun2 (input_fun2 m) c2) \<and>
  equiv_states
    (localState1 (trans_fun1 (input_fun1 m) c1))
    (localState2 (trans_fun2 (input_fun2 m) c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k1 \<le> Suc 0; k2 \<le> Suc 0; equiv_states (localState1 c1) (localState2 c2); Equiv_Exec m equiv_states localState1 localState2 input_fun1 input_fun2 output_fun1 output_fun2 trans_fun1 trans_fun2 k1 k2 c1 c2\<rbrakk> \<Longrightarrow> output_fun1 (trans_fun1 (input_fun1 m) c1) = output_fun2 (trans_fun2 (input_fun2 m) c2) \<and> equiv_states (localState1 (trans_fun1 (input_fun1 m) c1)) (localState2 (trans_fun2 (input_fun2 m) c2))
[PROOF STEP]
by (simp add: Equiv_Exec_def)


[STATEMENT]
lemma (in ring) indexed_eval_monomial_degree_le:
  assumes "list_all carrier_coeff Ps" and "list_all (\<lambda>P. index_free P i) Ps"
    and "(indexed_eval Ps i) m \<noteq> \<zero>" shows "count m i \<le> length Ps - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count m i \<le> degree Ps
[PROOF STEP]
using indexed_eval_aux_monomial_degree_le[of "rev Ps"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>list_all carrier_coeff (rev Ps); list_all (\<lambda>P. index_free P ?i) (rev Ps); indexed_eval_aux (rev Ps) ?i ?m \<noteq> \<zero>\<rbrakk> \<Longrightarrow> count ?m ?i \<le> degree (rev Ps)
list_all carrier_coeff Ps
list_all (\<lambda>P. index_free P i) Ps
indexed_eval Ps i m \<noteq> \<zero>

goal (1 subgoal):
 1. count m i \<le> degree Ps
[PROOF STEP]
by auto


[STATEMENT]
lemma HFinite_not_Infinitesimal_inverse:
  "x \<in> HFinite - Infinitesimal \<Longrightarrow> inverse x \<in> HFinite - Infinitesimal"
  for x :: "'a::real_normed_div_algebra star"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> HFinite - Infinitesimal \<Longrightarrow> inverse x \<in> HFinite - Infinitesimal
[PROOF STEP]
using HFinite_Infinitesimal_not_zero HFinite_inverse2 Infinitesimal_HFinite_mult2
[PROOF STATE]
proof (prove)
using this:
?x \<in> HFinite - Infinitesimal \<Longrightarrow> ?x \<noteq> 0
?x \<in> HFinite - Infinitesimal \<Longrightarrow> inverse ?x \<in> HFinite
\<lbrakk>?x \<in> Infinitesimal; ?y \<in> HFinite\<rbrakk> \<Longrightarrow> ?y * ?x \<in> Infinitesimal

goal (1 subgoal):
 1. x \<in> HFinite - Infinitesimal \<Longrightarrow> inverse x \<in> HFinite - Infinitesimal
[PROOF STEP]
by fastforce


[STATEMENT]
lemma upset_anti: "antimono (\<up>::'a::order \<Rightarrow> 'a set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (\<le>) (\<lambda>x y. y \<subseteq> x) \<up>
[PROOF STEP]
by (simp add: antimono_def upset_anti_iff)


[STATEMENT]
lemma "x = y \<longleftrightarrow> dist x x = dist y x \<and> dist x y = dist y y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = y) = (dist x x = dist y x \<and> dist x y = dist y y)
[PROOF STEP]
by metric


[STATEMENT]
theorem p22: "\<forall>x::'a. p \<longleftrightarrow> F(x) \<Longrightarrow> p \<longleftrightarrow> (\<forall>x. F(x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. p = F x \<Longrightarrow> p = (\<forall>x. F x)
[PROOF STEP]
@proof
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. p = F x \<Longrightarrow> p = (\<forall>x. F x)
[PROOF STEP]
@case "p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. p = F x \<Longrightarrow> p = (\<forall>x. F x)
[PROOF STEP]
@obtain "x::'a" where "x = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. p = F x \<Longrightarrow> p = (\<forall>x. F x)
[PROOF STEP]
@qed


[STATEMENT]
lemma ucast_down_minus:
    "is_down (ucast:: 'a word \<Rightarrow> 'b word) \<Longrightarrow>  ucast ((a :: 'a::len word) - b) = (ucast a - ucast b :: 'b::len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_down UCAST('a \<rightarrow> 'b) \<Longrightarrow> UCAST('a \<rightarrow> 'b) (a - b) = UCAST('a \<rightarrow> 'b) a - UCAST('a \<rightarrow> 'b) b
[PROOF STEP]
apply (rule ucast_distrib [where L="(-)"], (clarsimp simp: uint_word_ariths)+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. is_down UCAST('a \<rightarrow> 'b) \<Longrightarrow> (x mod 2 ^ LENGTH('b) - y mod 2 ^ LENGTH('b)) mod 2 ^ LENGTH('b) = (x - y) mod 2 ^ LENGTH('b)
 2. is_down UCAST('a \<rightarrow> 'b) \<Longrightarrow> is_down UCAST('a \<rightarrow> 'b)
[PROOF STEP]
apply (metis mod_diff_left_eq mod_diff_right_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_down UCAST('a \<rightarrow> 'b) \<Longrightarrow> is_down UCAST('a \<rightarrow> 'b)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma less_sets_Un2: "less_sets A (B \<union> B') \<longleftrightarrow> A \<lless> B \<and> A \<lless> B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<lless> B \<union> B') = (A \<lless> B \<and> A \<lless> B')
[PROOF STEP]
by (auto simp: less_sets_def)


[STATEMENT]
lemma in_segment:
    "x \<in> closed_segment a b \<longleftrightarrow> (\<exists>u. 0 \<le> u \<and> u \<le> 1 \<and> x = (1 - u) *\<^sub>R a + u *\<^sub>R b)"
    "x \<in> open_segment a b \<longleftrightarrow> a \<noteq> b \<and> (\<exists>u. 0 < u \<and> u < 1 \<and> x = (1 - u) *\<^sub>R a + u *\<^sub>R b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> closed_segment a b) = (\<exists>u\<ge>0. u \<le> 1 \<and> x = (1 - u) *\<^sub>R a + u *\<^sub>R b) &&& (x \<in> open_segment a b) = (a \<noteq> b \<and> (\<exists>u>0. u < 1 \<and> x = (1 - u) *\<^sub>R a + u *\<^sub>R b))
[PROOF STEP]
using less_eq_real_def
[PROOF STATE]
proof (prove)
using this:
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

goal (1 subgoal):
 1. (x \<in> closed_segment a b) = (\<exists>u\<ge>0. u \<le> 1 \<and> x = (1 - u) *\<^sub>R a + u *\<^sub>R b) &&& (x \<in> open_segment a b) = (a \<noteq> b \<and> (\<exists>u>0. u < 1 \<and> x = (1 - u) *\<^sub>R a + u *\<^sub>R b))
[PROOF STEP]
by (auto simp: segment algebra_simps)


[STATEMENT]
lemma Subgroup_imp_Subring :
  fixes   H  :: "'g set"
  and     FH :: "('r::ring_1,'g) aezfun set"
  and     FG :: "('r,'g) aezfun set"
  defines "FH \<equiv> Group.group_ring H"
  and     "FG \<equiv> group_ring"
  shows   "Subgroup H \<Longrightarrow> Ring1.Subring1 FG FH"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Subgroup H \<Longrightarrow> Ring1 FH \<and> FH \<subseteq> FG
[PROOF STEP]
using   assms Group.Ring1_RG Group.RG_el_decomp_aezdeltafun RG_sum_list_rddg_closed
[PROOF STATE]
proof (prove)
using this:
FH \<equiv> aezfun_setspan H
FG \<equiv> group_ring
Group ?G \<Longrightarrow> Ring1 (aezfun_setspan ?G)
\<lbrakk>Group ?G; ?c \<in> aezfun_setspan ?G\<rbrakk> \<Longrightarrow> \<exists>ras. set (map snd ras) \<subseteq> ?G \<and> ?c = (\<Sum>(r, a)\<leftarrow>ras. r \<delta>\<delta> a)
set (map snd ?rgs) \<subseteq> G \<Longrightarrow> (\<Sum>(r, g)\<leftarrow>?rgs. r \<delta>\<delta> g) \<in> group_ring

goal (1 subgoal):
 1. Subgroup H \<Longrightarrow> Ring1 FH \<and> FH \<subseteq> FG
[PROOF STEP]
by      fast


[STATEMENT]
lemma "filterlim (\<lambda>x::real. exp (exp (exp (x + exp (-x)))) / exp (exp (exp x))) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. exp (exp (exp (x + exp (- x)))) / exp (exp (exp x)) :> at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
theorem mono_imp_qfp_UNIV_complete:
  assumes comp: "UNIV-complete A (\<sqsubseteq>)" and f: "f ` A \<subseteq> A" and mono: "monotone_on A (\<sqsubseteq>) (\<sqsubseteq>) f"
  shows "UNIV-complete {p \<in> A. f p \<sim> p} (\<sqsubseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV-complete {p \<in> A. f p \<sim> p} (\<sqsubseteq>)
[PROOF STEP]
apply (intro fixed_point_proof.attract_mono_imp_qfp_complete comp mono)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. fixed_point_proof A f
 2. attractive A (\<sqsubseteq>)
 3. \<forall>C\<subseteq>A. well_related_set C (\<sqsubseteq>) \<longrightarrow> C \<in> UNIV
 4. \<forall>X\<in>UNIV. \<forall>Y\<in>UNIV. setwise (\<sqsubseteq>) X Y \<longrightarrow> X \<union> Y \<in> UNIV
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. f ` A \<subseteq> A
 2. \<forall>C\<subseteq>A. well_related_set C (\<sqsubseteq>) \<longrightarrow> C \<in> UNIV
 3. \<forall>X\<in>UNIV. \<forall>Y\<in>UNIV. setwise (\<sqsubseteq>) X Y \<longrightarrow> X \<union> Y \<in> UNIV
[PROOF STEP]
by (auto simp: f)


[STATEMENT]
lemma closure_of_singleton:
   "t1_space X \<Longrightarrow> X closure_of {a} = (if a \<in> topspace X then {a} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t1_space X \<Longrightarrow> X closure_of {a} = (if a \<in> topspace X then {a} else {})
[PROOF STEP]
by (simp add: closure_of_eq t1_space_closedin_singleton closure_of_eq_empty_gen)


[STATEMENT]
lemma FDOM_eff_subset_prob_dom:
  fixes p e
  assumes "(p, e) \<in> PROB"
  shows "fmdom' e \<subseteq> prob_dom PROB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmdom' e \<subseteq> prob_dom PROB
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(p, e) \<in> PROB

goal (1 subgoal):
 1. fmdom' e \<subseteq> prob_dom PROB
[PROOF STEP]
by (metis Sup_upper Un_subset_iff action_dom_def pair_imageI prob_dom_def)


[STATEMENT]
lemma irfb_inf_dual:
  assumes "Inf_pres \<phi>"
  and "Inf_pres \<psi>"
  shows "fb\<^sup>-\<^sub>\<R> (\<phi> \<sqinter> \<psi>) = fb\<^sup>-\<^sub>\<R> \<phi> \<squnion> fb\<^sup>-\<^sub>\<R> \<psi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fb\<^sup>-\<^sub>\<R> (\<phi> \<sqinter> \<psi>) = fb\<^sup>-\<^sub>\<R> \<phi> \<union> fb\<^sup>-\<^sub>\<R> \<psi>
[PROOF STEP]
by (metis assms rfb_Inf_pres rfb_irfb_galois rfb_sup_dual)


[STATEMENT]
lemma gap_between_aligned:
  "\<lbrakk>a < (b :: 'a ::len word); is_aligned a n; is_aligned b n; n < LENGTH('a) \<rbrakk>
  \<Longrightarrow> a + (2^n - 1) < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; is_aligned a n; is_aligned b n; n < LENGTH('a)\<rbrakk> \<Longrightarrow> a + (2 ^ n - 1) < b
[PROOF STEP]
by (simp add: aligned_add_offset_less)


[STATEMENT]
lemma ball_divide_subset: "d \<ge> 1 \<Longrightarrow> ball x (e/d) \<subseteq> ball x e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> d \<Longrightarrow> ball x (e / d) \<subseteq> ball x e
[PROOF STEP]
by (metis ball_eq_empty div_by_1 frac_le linear subset_ball zero_less_one)


[STATEMENT]
lemma Collect_le_Int_equals:
     "(\<Inter>i \<in> atMost n. A(Suc i) \<inter> A i) = (\<Inter>i \<in> atMost (Suc n). A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>i\<le>n. A (Suc i) \<inter> A i) = \<Inter> (A ` {..Suc n})
[PROOF STEP]
by (induct n) (auto simp add: atMost_Suc)


[STATEMENT]
lemma long_power: assumes "r \<noteq> \<epsilon>" shows "\<^bold>|x\<^bold>| \<le> \<^bold>|r\<^sup>@\<^bold>|x\<^bold>|\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>|x\<^bold>| \<le> \<^bold>|r \<^sup>@ \<^bold>|x\<^bold>|\<^bold>|
[PROOF STEP]
unfolding pow_len
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>|x\<^bold>| \<le> \<^bold>|x\<^bold>| * \<^bold>|r\<^bold>|
[PROOF STEP]
using  mult_le_mono2[OF nemp_le_len[OF assms], unfolded mult.right_neutral]
[PROOF STATE]
proof (prove)
using this:
?k \<le> ?k * \<^bold>|r\<^bold>|

goal (1 subgoal):
 1. \<^bold>|x\<^bold>| \<le> \<^bold>|x\<^bold>| * \<^bold>|r\<^bold>|
[PROOF STEP]
.


[STATEMENT]
lemma Arg_ii [simp]: "Arg \<i> = pi/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg \<i> = pi / 2
[PROOF STEP]
by (rule cis_Arg_unique; simp add: sgn_eq)


[STATEMENT]
lemma list2FWpolicyconc[rule_format]: "a \<noteq> [] \<longrightarrow>
                               (list2FWpolicy (xa # a)) = (xa) \<oplus> (list2FWpolicy a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> [] \<longrightarrow> list2FWpolicy (xa # a) = xa \<oplus> list2FWpolicy a
[PROOF STEP]
by (induct a,simp_all)