[STATEMENT]
lemma dominates_trans:
  assumes "eventually (\<lambda>x. g x > 0) F"
  assumes "dominates F f g" "dominates F g h"
  shows   "dominates F f h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dominates F f h
[PROOF STEP]
unfolding dominates_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
fix p :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
from assms(3)
[PROOF STATE]
proof (chain)
picking this:
dominates F g h
[PROOF STEP]
have "(\<lambda>x. h x powr p) \<in> o[F](g)"
[PROOF STATE]
proof (prove)
using this:
dominates F g h

goal (1 subgoal):
 1. (\<lambda>x. h x powr p) \<in> o[F](g)
[PROOF STEP]
unfolding dominates_def
[PROOF STATE]
proof (prove)
using this:
\<forall>p. (\<lambda>x. h x powr p) \<in> o[F](g)

goal (1 subgoal):
 1. (\<lambda>x. h x powr p) \<in> o[F](g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. h x powr p) \<in> o[F](g)

goal (1 subgoal):
 1. \<And>p. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. h x powr p) \<in> o[F](g)

goal (1 subgoal):
 1. \<And>p. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. 0 < g x
[PROOF STEP]
have "g \<in> \<Theta>[F](\<lambda>x. g x powr 1)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. 0 < g x

goal (1 subgoal):
 1. g \<in> \<Theta>[F](\<lambda>x. g x powr 1)
[PROOF STEP]
by (intro bigthetaI_cong) (auto elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
g \<in> \<Theta>[F](\<lambda>x. g x powr 1)

goal (1 subgoal):
 1. \<And>p. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g \<in> \<Theta>[F](\<lambda>x. g x powr 1)

goal (1 subgoal):
 1. \<And>p. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
dominates F f g
[PROOF STEP]
have "(\<lambda>x. g x powr 1) \<in> o[F](f)"
[PROOF STATE]
proof (prove)
using this:
dominates F f g

goal (1 subgoal):
 1. (\<lambda>x. g x powr 1) \<in> o[F](f)
[PROOF STEP]
unfolding dominates_def
[PROOF STATE]
proof (prove)
using this:
\<forall>p. (\<lambda>x. g x powr p) \<in> o[F](f)

goal (1 subgoal):
 1. (\<lambda>x. g x powr 1) \<in> o[F](f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. g x powr 1) \<in> o[F](f)

goal (1 subgoal):
 1. \<And>p. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
show "(\<lambda>x. h x powr p) \<in> o[F](f)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. h x powr p) \<in> o[F](f)

goal (1 subgoal):
 1. (\<lambda>x. h x powr p) \<in> o[F](f)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. h x powr p) \<in> o[F](f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_inorder_list_separators: "sorted_less (inorder_list ts) \<Longrightarrow> sorted_less (separators ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_less (inorder_list ts) \<Longrightarrow> sorted_less (separators ts)
[PROOF STEP]
apply(induction ts)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sorted_less (inorder_list []) \<Longrightarrow> sorted_less (separators [])
 2. \<And>a ts. \<lbrakk>sorted_less (inorder_list ts) \<Longrightarrow> sorted_less (separators ts); sorted_less (inorder_list (a # ts))\<rbrakk> \<Longrightarrow> sorted_less (separators (a # ts))
[PROOF STEP]
apply (auto simp add: sorted_lems)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gen_boolean_algebra_generated_by_atoms:
  assumes "finite Xs"
  assumes "S = \<Union> Xs"
  shows "gen_boolean_algebra S Xs = \<Union> ` (Pow (atoms_of Xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_boolean_algebra S Xs = \<Union> ` Pow (atoms_of Xs)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. gen_boolean_algebra S Xs \<subseteq> \<Union> ` Pow (atoms_of Xs)
 2. \<Union> ` Pow (atoms_of Xs) \<subseteq> gen_boolean_algebra S Xs
[PROOF STEP]
show "gen_boolean_algebra S Xs \<subseteq> \<Union> ` Pow (atoms_of Xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_boolean_algebra S Xs \<subseteq> \<Union> ` Pow (atoms_of Xs)
[PROOF STEP]
apply(rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> gen_boolean_algebra S Xs \<Longrightarrow> x \<in> \<Union> ` Pow (atoms_of Xs)
[PROOF STEP]
using gen_boolean_algebra_elem_uni_of_atoms[of Xs S] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite Xs; S = \<Union> Xs; ?X \<in> gen_boolean_algebra S Xs\<rbrakk> \<Longrightarrow> ?X = \<Union> {a \<in> atoms_of Xs. a \<subseteq> ?X}
finite Xs
S = \<Union> Xs

goal (1 subgoal):
 1. \<And>x. x \<in> gen_boolean_algebra S Xs \<Longrightarrow> x \<in> \<Union> ` Pow (atoms_of Xs)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
gen_boolean_algebra S Xs \<subseteq> \<Union> ` Pow (atoms_of Xs)

goal (1 subgoal):
 1. \<Union> ` Pow (atoms_of Xs) \<subseteq> gen_boolean_algebra S Xs
[PROOF STEP]
show "\<Union> ` Pow (atoms_of Xs) \<subseteq> gen_boolean_algebra S Xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> ` Pow (atoms_of Xs) \<subseteq> gen_boolean_algebra S Xs
[PROOF STEP]
apply(rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> ` Pow (atoms_of Xs) \<Longrightarrow> x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
using atoms_of_gen_boolean_algebra[of Xs S Xs]
          finite_subset[of _ "atoms_of Xs"] assms
          finite_set_imp_finite_atoms[of Xs]
          gen_boolean_algebra_finite_union[of _ S Xs]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Xs \<subseteq> gen_boolean_algebra S Xs; finite Xs\<rbrakk> \<Longrightarrow> atoms_of Xs \<subseteq> gen_boolean_algebra S Xs
\<lbrakk>?A \<subseteq> atoms_of Xs; finite (atoms_of Xs)\<rbrakk> \<Longrightarrow> finite ?A
finite Xs
S = \<Union> Xs
finite Xs \<Longrightarrow> finite (atoms_of Xs)
\<lbrakk>\<And>a. a \<in> ?A \<Longrightarrow> a \<in> gen_boolean_algebra S Xs; finite ?A\<rbrakk> \<Longrightarrow> \<Union> ?A \<in> gen_boolean_algebra S Xs

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> ` Pow (atoms_of Xs) \<Longrightarrow> x \<in> gen_boolean_algebra S Xs
[PROOF STEP]
by (smt Pow_iff Union_upper gen_boolean_algebra.intros(2) image_iff inf.absorb1 subsetD subsetI)
[PROOF STATE]
proof (state)
this:
\<Union> ` Pow (atoms_of Xs) \<subseteq> gen_boolean_algebra S Xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma circline_set_unit_circle_I [simp]:
  assumes "cmod z = 1"
  shows "of_complex z \<in> circline_set unit_circle"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_complex z \<in> circline_set unit_circle
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cmod z = 1

goal (1 subgoal):
 1. of_complex z \<in> circline_set unit_circle
[PROOF STEP]
unfolding circline_set_unit_circle
[PROOF STATE]
proof (prove)
using this:
cmod z = 1

goal (1 subgoal):
 1. of_complex z \<in> of_complex ` {z. cmod z = 1}
[PROOF STEP]
by simp


[STATEMENT]
lemma fsm_size_Suc :
  "size M > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < FSM.size M
[PROOF STEP]
unfolding FSM.size_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card (FSM.states M)
[PROOF STEP]
using fsm_states_finite[of M] fsm_initial[of M]
[PROOF STATE]
proof (prove)
using this:
finite (FSM.states M)
FSM.initial M \<in> FSM.states M

goal (1 subgoal):
 1. 0 < card (FSM.states M)
[PROOF STEP]
using card_gt_0_iff
[PROOF STATE]
proof (prove)
using this:
finite (FSM.states M)
FSM.initial M \<in> FSM.states M
(0 < card ?A) = (?A \<noteq> {} \<and> finite ?A)

goal (1 subgoal):
 1. 0 < card (FSM.states M)
[PROOF STEP]
by blast


[STATEMENT]
lemma fun_upd_FINFUNC: "\<lbrakk>f \<in> FINFUNC; x \<in> Field s; y \<in> Field r\<rbrakk> \<Longrightarrow> f(x := y) \<in> FINFUNC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> FINFUNC; x \<in> Field s; y \<in> Field r\<rbrakk> \<Longrightarrow> f(x := y) \<in> FINFUNC
[PROOF STEP]
unfolding FinFunc_def Func_def fin_support_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {f. (\<forall>a\<in>Field s. f a \<in> Field r) \<and> (\<forall>a. a \<notin> Field s \<longrightarrow> f a = undefined)} \<inter> {f. finite (SUPP f)}; x \<in> Field s; y \<in> Field r\<rbrakk> \<Longrightarrow> f(x := y) \<in> {f. (\<forall>a\<in>Field s. f a \<in> Field r) \<and> (\<forall>a. a \<notin> Field s \<longrightarrow> f a = undefined)} \<inter> {f. finite (SUPP f)}
[PROOF STEP]
by (auto intro: finite_subset[OF support_upd_subset])


[STATEMENT]
lemma convex_translation_subtract_eq [simp]:
  "convex ((\<lambda>b. b - a) ` s) \<longleftrightarrow> convex s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex ((\<lambda>b. b - a) ` s) = convex s
[PROOF STEP]
using convex_translation_eq [of "- a"]
[PROOF STATE]
proof (prove)
using this:
convex ((+) (- a) ` ?s) = convex ?s

goal (1 subgoal):
 1. convex ((\<lambda>b. b - a) ` s) = convex s
[PROOF STEP]
by (simp cong: image_cong_simp)


[STATEMENT]
lemma forests_bot_2:
  assumes "equivalence e"
      and "forest f"
    shows "(-e \<sqinter> f\<^sup>T) * x \<sqinter> (e \<sqinter> f\<^sup>T) * y = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- e \<sqinter> f\<^sup>T) * x \<sqinter> (e \<sqinter> f\<^sup>T) * y = bot
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (- e \<sqinter> f\<^sup>T) * x \<sqinter> (e \<sqinter> f\<^sup>T) * y = bot
[PROOF STEP]
have "(-e \<sqinter> f) * (e \<sqinter> f\<^sup>T) = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- e \<sqinter> f) * (e \<sqinter> f\<^sup>T) = bot
[PROOF STEP]
using assms forests_bot_1 conv_dist_inf
[PROOF STATE]
proof (prove)
using this:
equivalence e
forest f
\<lbrakk>equivalence ?e; forest ?f\<rbrakk> \<Longrightarrow> (- ?e \<sqinter> ?f) * (?e \<sqinter> ?f)\<^sup>T = bot
(?x \<sqinter> ?y)\<^sup>T = ?x\<^sup>T \<sqinter> ?y\<^sup>T

goal (1 subgoal):
 1. (- e \<sqinter> f) * (e \<sqinter> f\<^sup>T) = bot
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- e \<sqinter> f) * (e \<sqinter> f\<^sup>T) = bot

goal (1 subgoal):
 1. (- e \<sqinter> f\<^sup>T) * x \<sqinter> (e \<sqinter> f\<^sup>T) * y = bot
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(- e \<sqinter> f) * (e \<sqinter> f\<^sup>T) = bot

goal (1 subgoal):
 1. (- e \<sqinter> f\<^sup>T) * x \<sqinter> (e \<sqinter> f\<^sup>T) * y = bot
[PROOF STEP]
by (smt assms(1) comp_associative comp_inf.semiring.mult_not_zero conv_complement conv_dist_comp conv_dist_inf conv_involutive dedekind_1 inf.cobounded2 inf.sup_monoid.add_commute le_bot mult_right_zero p_antitone_iff pseudo_complement semiring.mult_not_zero symmetric_top_closed top.extremum)
[PROOF STATE]
proof (state)
this:
(- e \<sqinter> f\<^sup>T) * x \<sqinter> (e \<sqinter> f\<^sup>T) * y = bot

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aux:
    fixes a b q x y:: int
    assumes "a = old_y * b\<^sub>0 + old_x * a\<^sub>0" "b = y * b\<^sub>0 + x * a\<^sub>0" "q = a div b"
    shows
    "a mod b + (a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q)) = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod b + (a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q)) = a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a mod b + (a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q)) = a
[PROOF STEP]
have *: "a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q) = q * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q) = q * b
[PROOF STEP]
unfolding \<open>b = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q) = q * (y * b\<^sub>0 + x * a\<^sub>0)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q) = q * b

goal (1 subgoal):
 1. a mod b + (a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q)) = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod b + (a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q)) = a
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod b + q * b = a
[PROOF STEP]
unfolding \<open>q = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod b + a div b * b = a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a mod b + (a\<^sub>0 * (x * q) + b\<^sub>0 * (y * q)) = a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_span_representation_bounded:
  fixes B :: "'a::real_normed_vector set"
  assumes "finite B" and "independent B"
  shows "\<exists>D>0. \<forall>\<psi> b. abs (representation B \<psi> b) \<le> norm \<psi> * D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
text \<open>
  Assume $B$ is a finite linear independent set of vectors (in a real normed vector space).
  Let $\alpha^\psi_b$ be the coefficients of $\psi$ expressed as a linear combination over $B$.
  Then $\alpha$ is is uniformly cblinfun (i.e., $\lvert\alpha^\psi_b \leq D \lVert\psi\rVert\psi$
  for some $D$ independent of $\psi,b$).

  (This also holds when $b$ is not in the span of $B$ because of the way \<open>real_vector.representation\<close>
  is defined in this corner case.)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
proof (cases "B\<noteq>{}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
B \<noteq> {}

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
(* The following generalizes finite_span_complete_aux to hold without the assumption
     that 'basis has type class finite *)
[PROOF STATE]
proof (state)
this:
B \<noteq> {}

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
define repr  where "repr = real_vector.representation B"
[PROOF STATE]
proof (state)
this:
repr = representation B

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
repr = representation B

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
(* Step 1: Create a fake type definition by introducing a new type variable 'basis
               and then assuming the existence of the morphisms Rep/Abs to B
               This is then roughly equivalent to "typedef 'basis = B" *)
    (* The type variable 'basisT must not be the same as the one used in finite_span_complete_aux
       (I.e., we cannot call it 'basis) *)
[PROOF STATE]
proof (state)
this:
repr = representation B

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
assume "\<exists>(Rep :: 'basisT\<Rightarrow>'a) Abs. type_definition Rep Abs B"
[PROOF STATE]
proof (state)
this:
\<exists>Rep Abs. type_definition Rep Abs B

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>Rep Abs. type_definition Rep Abs B
[PROOF STEP]
obtain rep :: "'basisT \<Rightarrow> 'a" and abs :: "'a \<Rightarrow> 'basisT" where t: "type_definition rep abs B"
[PROOF STATE]
proof (prove)
using this:
\<exists>Rep Abs. type_definition Rep Abs B

goal (1 subgoal):
 1. (\<And>rep abs. type_definition rep abs B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
type_definition rep abs B

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
(* Step 2: We show that our fake typedef 'basisT could be instantiated as type class finite *)
[PROOF STATE]
proof (state)
this:
type_definition rep abs B

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
have basisT_finite: "class.finite TYPE('basisT)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.finite TYPE('basisT)
[PROOF STEP]
apply intro_classes
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
using \<open>finite B\<close> t
[PROOF STATE]
proof (prove)
using this:
finite B
type_definition rep abs B

goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) ex_new_if_finite finite_imageI image_eqI type_definition_def)
[PROOF STATE]
proof (state)
this:
class.finite TYPE('basisT)

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
(* Step 3: We take the finite_span_complete_aux and remove the requirement that 'basis::finite
               (instead, a precondition "class.finite TYPE('basisT)" is introduced) *)
[PROOF STATE]
proof (state)
this:
class.finite TYPE('basisT)

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
note finite_span_complete_aux(1)[internalize_sort "'basis::finite"]
[PROOF STATE]
proof (state)
this:
\<lbrakk>class.finite TYPE(?'a); type_definition ?rep ?abs ?B; finite ?B; ?b \<in> ?B; independent ?B\<rbrakk> \<Longrightarrow> \<exists>D>0. \<forall>\<psi>. norm (representation ?B \<psi> ?b) \<le> norm \<psi> * D

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
(* Step 4: We instantiate the premises *)
[PROOF STATE]
proof (state)
this:
\<lbrakk>class.finite TYPE(?'a); type_definition ?rep ?abs ?B; finite ?B; ?b \<in> ?B; independent ?B\<rbrakk> \<Longrightarrow> \<exists>D>0. \<forall>\<psi>. norm (representation ?B \<psi> ?b) \<le> norm \<psi> * D

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
note this[OF basisT_finite t]
[PROOF STATE]
proof (state)
this:
\<lbrakk>finite B; ?b \<in> B; independent B\<rbrakk> \<Longrightarrow> \<exists>D>0. \<forall>\<psi>. norm (representation B \<psi> ?b) \<le> norm \<psi> * D

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<exists>Rep Abs. type_definition Rep Abs B; finite B; ?b6 \<in> B; independent B\<rbrakk> \<Longrightarrow> \<exists>D>0. \<forall>\<psi>. norm (representation B \<psi> ?b6) \<le> norm \<psi> * D

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
(* Now we have the desired fact, except that it still assumes that B is isomorphic to some type 'basis
     together with the assumption that there are morphisms between 'basis and B. 'basis and that premise
     are removed using cancel_type_definition
  *)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<exists>Rep Abs. type_definition Rep Abs B; finite B; ?b6 \<in> B; independent B\<rbrakk> \<Longrightarrow> \<exists>D>0. \<forall>\<psi>. norm (representation B \<psi> ?b6) \<le> norm \<psi> * D

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
note this[cancel_type_definition, OF True \<open>finite B\<close> _ \<open>independent B\<close>]
[PROOF STATE]
proof (state)
this:
?b6 \<in> B \<Longrightarrow> \<exists>D>0. \<forall>\<psi>. norm (representation B \<psi> ?b6) \<le> norm \<psi> * D

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
hence d2:"\<exists>D. \<forall>\<psi>. D>0 \<and> norm (repr \<psi> b) \<le> norm \<psi> * D" if \<open>b\<in>B\<close> for b
[PROOF STATE]
proof (prove)
using this:
?b6 \<in> B \<Longrightarrow> \<exists>D>0. \<forall>\<psi>. norm (representation B \<psi> ?b6) \<le> norm \<psi> * D

goal (1 subgoal):
 1. \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D
[PROOF STEP]
by (simp add: repr_def that True)
[PROOF STATE]
proof (state)
this:
?b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> ?b) \<le> norm \<psi> * D

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
have d1: " (\<And>b. b \<in> B \<Longrightarrow>
          \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D) \<Longrightarrow>
    \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow>
               0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D) \<Longrightarrow> \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b
[PROOF STEP]
apply (rule choice)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D) \<Longrightarrow> \<forall>b. \<exists>y. \<forall>\<psi>. b \<in> B \<longrightarrow> 0 < y \<and> norm (repr \<psi> b) \<le> norm \<psi> * y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<And>b. b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D) \<Longrightarrow> \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<And>b. b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D) \<Longrightarrow> \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b
[PROOF STEP]
obtain D where D: "D b > 0 \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b" if "b\<in>B" for b \<psi>
[PROOF STATE]
proof (prove)
using this:
(\<And>b. b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D) \<Longrightarrow> \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b

goal (1 subgoal):
 1. (\<And>D. (\<And>b \<psi>. b \<in> B \<Longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
apply atomize_elim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<And>b. b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D) \<Longrightarrow> \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b) \<Longrightarrow> \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b
[PROOF STEP]
using d2
[PROOF STATE]
proof (prove)
using this:
?b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> ?b) \<le> norm \<psi> * D

goal (1 subgoal):
 1. ((\<And>b. b \<in> B \<Longrightarrow> \<exists>D. \<forall>\<psi>. 0 < D \<and> norm (repr \<psi> b) \<le> norm \<psi> * D) \<Longrightarrow> \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b) \<Longrightarrow> \<exists>D. \<forall>b \<psi>. b \<in> B \<longrightarrow> 0 < D b \<and> norm (repr \<psi> b) \<le> norm \<psi> * D b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?b \<in> B \<Longrightarrow> 0 < D ?b \<and> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * D ?b

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
hence Dpos: "D b > 0" and Dbound: "norm (repr \<psi> b) \<le> norm \<psi> * D b"
    if "b\<in>B" for b \<psi>
[PROOF STATE]
proof (prove)
using this:
?b \<in> B \<Longrightarrow> 0 < D ?b \<and> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * D ?b

goal (1 subgoal):
 1. 0 < D b &&& norm (repr \<psi> b) \<le> norm \<psi> * D b
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?b \<in> B \<Longrightarrow> 0 < D ?b \<and> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * D ?b
b \<in> B

goal (1 subgoal):
 1. 0 < D b &&& norm (repr \<psi> b) \<le> norm \<psi> * D b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?b \<in> B \<Longrightarrow> 0 < D ?b
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * D ?b

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
define Dall where "Dall = Max (D`B)"
[PROOF STATE]
proof (state)
this:
Dall = Max (D ` B)

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
have "Dall > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Dall
[PROOF STEP]
unfolding Dall_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Max (D ` B)
[PROOF STEP]
using \<open>finite B\<close> \<open>B\<noteq>{}\<close> Dpos
[PROOF STATE]
proof (prove)
using this:
finite B
B \<noteq> {}
?b \<in> B \<Longrightarrow> 0 < D ?b

goal (1 subgoal):
 1. 0 < Max (D ` B)
[PROOF STEP]
by (metis (mono_tags, lifting) Max_in finite_imageI image_iff image_is_empty)
[PROOF STATE]
proof (state)
this:
0 < Dall

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
have "Dall \<ge> D b" if "b\<in>B" for b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D b \<le> Dall
[PROOF STEP]
unfolding Dall_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D b \<le> Max (D ` B)
[PROOF STEP]
using \<open>finite B\<close> that
[PROOF STATE]
proof (prove)
using this:
finite B
b \<in> B

goal (1 subgoal):
 1. D b \<le> Max (D ` B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?b \<in> B \<Longrightarrow> D ?b \<le> Dall

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
with Dbound
[PROOF STATE]
proof (chain)
picking this:
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * D ?b
?b \<in> B \<Longrightarrow> D ?b \<le> Dall
[PROOF STEP]
have "norm (repr \<psi> b) \<le> norm \<psi> * Dall" if "b\<in>B" for b \<psi>
[PROOF STATE]
proof (prove)
using this:
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * D ?b
?b \<in> B \<Longrightarrow> D ?b \<le> Dall

goal (1 subgoal):
 1. norm (repr \<psi> b) \<le> norm \<psi> * Dall
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * D ?b
?b \<in> B \<Longrightarrow> D ?b \<le> Dall
b \<in> B

goal (1 subgoal):
 1. norm (repr \<psi> b) \<le> norm \<psi> * Dall
[PROOF STEP]
by (smt mult_left_mono norm_not_less_zero)
[PROOF STATE]
proof (state)
this:
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
have "norm (repr \<psi> b) \<le> norm \<psi> * Dall" if "b\<notin>B" for b \<psi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (repr \<psi> b) \<le> norm \<psi> * Dall
[PROOF STEP]
unfolding repr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (representation B \<psi> b) \<le> norm \<psi> * Dall
[PROOF STEP]
using real_vector.representation_ne_zero True
[PROOF STATE]
proof (prove)
using this:
representation ?basis ?v ?b \<noteq> 0 \<Longrightarrow> ?b \<in> ?basis
B \<noteq> {}

goal (1 subgoal):
 1. norm (representation B \<psi> b) \<le> norm \<psi> * Dall
[PROOF STEP]
by (metis calculation empty_subsetI less_le_trans local.repr_def norm_ge_zero norm_zero not_less
        subsetI subset_antisym)
[PROOF STATE]
proof (state)
this:
?b \<notin> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall

goal (2 subgoals):
 1. B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
 2. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall
?b \<notin> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall
[PROOF STEP]
show "\<exists>D>0. \<forall>\<psi> b. abs (repr \<psi> b) \<le> norm \<psi> * D"
[PROOF STATE]
proof (prove)
using this:
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall
?b \<notin> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall

goal (1 subgoal):
 1. \<exists>D>0. \<forall>\<psi> b. \<bar>repr \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
using \<open>Dall > 0\<close> real_norm_def
[PROOF STATE]
proof (prove)
using this:
?b \<in> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall
?b \<notin> B \<Longrightarrow> norm (repr ?\<psi> ?b) \<le> norm ?\<psi> * Dall
0 < Dall
norm ?r = \<bar>?r\<bar>

goal (1 subgoal):
 1. \<exists>D>0. \<forall>\<psi> b. \<bar>repr \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>D>0. \<forall>\<psi> b. \<bar>repr \<psi> b\<bar> \<le> norm \<psi> * D

goal (1 subgoal):
 1. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> B \<noteq> {}

goal (1 subgoal):
 1. \<not> B \<noteq> {} \<Longrightarrow> \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> B \<noteq> {}

goal (1 subgoal):
 1. \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
unfolding repr_def
[PROOF STATE]
proof (prove)
using this:
\<not> B \<noteq> {}

goal (1 subgoal):
 1. \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
using real_vector.representation_ne_zero[of B]
[PROOF STATE]
proof (prove)
using this:
\<not> B \<noteq> {}
representation B ?v ?b \<noteq> 0 \<Longrightarrow> ?b \<in> B

goal (1 subgoal):
 1. \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
using nice_ordered_field_class.linordered_field_no_ub
[PROOF STATE]
proof (prove)
using this:
\<not> B \<noteq> {}
representation B ?v ?b \<noteq> 0 \<Longrightarrow> ?b \<in> B
\<forall>x. \<exists>y. x < y

goal (1 subgoal):
 1. \<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>D>0. \<forall>\<psi> b. \<bar>representation B \<psi> b\<bar> \<le> norm \<psi> * D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_prod2: "\<lbrakk>1<a; 2^x=a*2\<rbrakk> \<Longrightarrow> (2::nat) dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 2 ^ x = a * 2\<rbrakk> \<Longrightarrow> even a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 2 ^ x = a * 2\<rbrakk> \<Longrightarrow> even a
[PROOF STEP]
assume "2^x=a*2"
[PROOF STATE]
proof (state)
this:
2 ^ x = a * 2

goal (1 subgoal):
 1. \<lbrakk>1 < a; 2 ^ x = a * 2\<rbrakk> \<Longrightarrow> even a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ x = a * 2
[PROOF STEP]
have "2^x=2*a"
[PROOF STATE]
proof (prove)
using this:
2 ^ x = a * 2

goal (1 subgoal):
 1. 2 ^ x = 2 * a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ x = 2 * a

goal (1 subgoal):
 1. \<lbrakk>1 < a; 2 ^ x = a * 2\<rbrakk> \<Longrightarrow> even a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 ^ x = 2 * a

goal (1 subgoal):
 1. \<lbrakk>1 < a; 2 ^ x = a * 2\<rbrakk> \<Longrightarrow> even a
[PROOF STEP]
assume "1<a"
[PROOF STATE]
proof (state)
this:
1 < a

goal (1 subgoal):
 1. \<lbrakk>1 < a; 2 ^ x = a * 2\<rbrakk> \<Longrightarrow> even a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
2 ^ x = 2 * a
1 < a
[PROOF STEP]
show "2 dvd a"
[PROOF STATE]
proof (prove)
using this:
2 ^ x = 2 * a
1 < a

goal (1 subgoal):
 1. even a
[PROOF STEP]
using exp_prod1
[PROOF STATE]
proof (prove)
using this:
2 ^ x = 2 * a
1 < a
\<lbrakk>1 < ?b; 2 ^ ?x = 2 * ?b\<rbrakk> \<Longrightarrow> even ?b

goal (1 subgoal):
 1. even a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
even a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma llbound_lbound:
  assumes "finite A" "A\<noteq>{}" "A\<subseteq>I"
  shows "lbound A = llbound"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lbound A = llbound
[PROOF STEP]
unfolding llbound_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lbound A = lbound {SOME a. a \<in> I}
[PROOF STEP]
apply (rule lbound_eq)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. finite A
 2. A \<noteq> {}
 3. A \<subseteq> I
 4. finite {SOME a. a \<in> I}
 5. {SOME a. a \<in> I} \<noteq> {}
 6. {SOME a. a \<in> I} \<subseteq> I
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
A \<subseteq> I

goal (6 subgoals):
 1. finite A
 2. A \<noteq> {}
 3. A \<subseteq> I
 4. finite {SOME a. a \<in> I}
 5. {SOME a. a \<in> I} \<noteq> {}
 6. {SOME a. a \<in> I} \<subseteq> I
[PROOF STEP]
by (auto simp add: some_in_eq)


[STATEMENT]
lemma circle_left_top_edges_neq [simp]: "circle_left_edge \<noteq> circle_top_edge"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circle_left_edge \<noteq> circle_top_edge
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. circle_left_edge \<noteq> circle_top_edge
[PROOF STEP]
have "\<exists>r. ((r - 1 / 2) * d, d * sqrt (1 / 4 - (r - 1 / 2) * (r - 1 / 2))) \<noteq> (- (d / 2), 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. ((r - 1 / 2) * d, d * sqrt (1 / 4 - (r - 1 / 2) * (r - 1 / 2))) \<noteq> (- (d / 2), 0)
[PROOF STEP]
by (metis circ_left_edge_neq_top)
[PROOF STATE]
proof (state)
this:
\<exists>r. ((r - 1 / 2) * d, d * sqrt (1 / 4 - (r - 1 / 2) * (r - 1 / 2))) \<noteq> (- (d / 2), 0)

goal (1 subgoal):
 1. circle_left_edge \<noteq> circle_top_edge
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>r. ((r - 1 / 2) * d, d * sqrt (1 / 4 - (r - 1 / 2) * (r - 1 / 2))) \<noteq> (- (d / 2), 0)
[PROOF STEP]
have "(\<exists>r. d * r \<noteq> - (d / 2)) \<or> (\<exists>r ra. (x_coord (x_coord_inv r) * d, d * circle_y (x_coord (x_coord_inv r))) = (x_coord ra * d, d * circle_y (x_coord ra)) \<and> d * circle_y r \<noteq> 0)"
[PROOF STATE]
proof (prove)
using this:
\<exists>r. ((r - 1 / 2) * d, d * sqrt (1 / 4 - (r - 1 / 2) * (r - 1 / 2))) \<noteq> (- (d / 2), 0)

goal (1 subgoal):
 1. (\<exists>r. d * r \<noteq> - (d / 2)) \<or> (\<exists>r ra. (x_coord (x_coord_inv r) * d, d * circle_y (x_coord (x_coord_inv r))) = (x_coord ra * d, d * circle_y (x_coord ra)) \<and> d * circle_y r \<noteq> 0)
[PROOF STEP]
by (metis mult.commute)
[PROOF STATE]
proof (state)
this:
(\<exists>r. d * r \<noteq> - (d / 2)) \<or> (\<exists>r ra. (x_coord (x_coord_inv r) * d, d * circle_y (x_coord (x_coord_inv r))) = (x_coord ra * d, d * circle_y (x_coord ra)) \<and> d * circle_y r \<noteq> 0)

goal (1 subgoal):
 1. circle_left_edge \<noteq> circle_top_edge
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<exists>r. d * r \<noteq> - (d / 2)) \<or> (\<exists>r ra. (x_coord (x_coord_inv r) * d, d * circle_y (x_coord (x_coord_inv r))) = (x_coord ra * d, d * circle_y (x_coord ra)) \<and> d * circle_y r \<noteq> 0)
[PROOF STEP]
have "(\<lambda>r. (x_coord r * d, d * circle_y (x_coord r))) \<noteq> (\<lambda>r. (- (d / 2), 0))"
[PROOF STATE]
proof (prove)
using this:
(\<exists>r. d * r \<noteq> - (d / 2)) \<or> (\<exists>r ra. (x_coord (x_coord_inv r) * d, d * circle_y (x_coord (x_coord_inv r))) = (x_coord ra * d, d * circle_y (x_coord ra)) \<and> d * circle_y r \<noteq> 0)

goal (1 subgoal):
 1. (\<lambda>r. (x_coord r * d, d * circle_y (x_coord r))) \<noteq> (\<lambda>r. (- (d / 2), 0))
[PROOF STEP]
by (metis mult.commute prod.simps(1) x_coord_inv_2)
[PROOF STATE]
proof (state)
this:
(\<lambda>r. (x_coord r * d, d * circle_y (x_coord r))) \<noteq> (\<lambda>r. (- (d / 2), 0))

goal (1 subgoal):
 1. circle_left_edge \<noteq> circle_top_edge
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>r. (x_coord r * d, d * circle_y (x_coord r))) \<noteq> (\<lambda>r. (- (d / 2), 0))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>r. (x_coord r * d, d * circle_y (x_coord r))) \<noteq> (\<lambda>r. (- (d / 2), 0))

goal (1 subgoal):
 1. circle_left_edge \<noteq> circle_top_edge
[PROOF STEP]
by (simp add: circle_left_edge_def circle_top_edge_def)
[PROOF STATE]
proof (state)
this:
circle_left_edge \<noteq> circle_top_edge

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rep_take_rows[simp]:
  "Rep_matrix (take_rows A r) j i =
  (if j < r then (Rep_matrix A j i) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (take_rows A r) j i = (if j < r then Rep_matrix A j i else (0::'a))
[PROOF STEP]
apply (simp add: take_rows_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j < r \<longrightarrow> Rep_matrix (Abs_matrix (\<lambda>j i. if j < r then Rep_matrix A j i else (0::'a))) j i = Rep_matrix A j i) \<and> (\<not> j < r \<longrightarrow> Rep_matrix (Abs_matrix (\<lambda>j i. if j < r then Rep_matrix A j i else (0::'a))) j i = (0::'a))
[PROOF STEP]
apply (simplesubst RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<exists>m. \<forall>j i. m \<le> j \<longrightarrow> (if j < r then Rep_matrix A j i else (0::'a)) = (0::'a)
 2. \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> (if j < r then Rep_matrix A j i else (0::'a)) = (0::'a)
 3. (j < r \<longrightarrow> (if j < r then Rep_matrix A j i else (0::'a)) = Rep_matrix A j i) \<and> (\<not> j < r \<longrightarrow> (if j < r then Rep_matrix A j i else (0::'a)) = (0::'a))
[PROOF STEP]
apply (rule exI[of _ "nrows A"], auto, simp add: nrows_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. \<forall>j<r. \<forall>i\<ge>n. Rep_matrix A j i = (0::'a)
[PROOF STEP]
apply (rule exI[of _ "ncols A"], auto, simp add: ncols_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma llam_cases:
  "(\<exists>a. t = lPar a) \<or> (\<exists>n. t = lVar n) \<or> (\<exists>t1 t2. t = lApp t1 t2) \<or>
   (\<exists>t1. t = lLam t1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>a. t = lPar a) \<or> (\<exists>n. t = lVar n) \<or> (\<exists>t1 t2. t = lApp t1 t2) \<or> (\<exists>t1. t = lLam t1)
[PROOF STEP]
by (induct t rule: llam.induct)
   (auto simp add: llam.inject)


[STATEMENT]
lemma expands_to_min_lt:
  assumes "(f expands_to F) basis" "eventually (\<lambda>x. f x < g x) at_top"
  shows   "((\<lambda>x. min (f x) (g x)) expands_to F) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. min (f x) (g x)) expands_to F) basis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
(f expands_to F) basis

goal (1 subgoal):
 1. ((\<lambda>x. min (f x) (g x)) expands_to F) basis
[PROOF STEP]
by (rule expands_to_cong) (insert assms(2), auto simp: min_def elim: eventually_mono)


[STATEMENT]
lemma Max_front_sums_geq_0: "Max (front_sums xs) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> Max (front_sums xs)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0::'a) \<le> Max (front_sums xs)
[PROOF STEP]
have "[] \<in> fronts xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<in> fronts xs
[PROOF STEP]
unfolding fronts_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<in> {as. \<exists>bs. xs = as @ bs}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[] \<in> fronts xs

goal (1 subgoal):
 1. (0::'a) \<le> Max (front_sums xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[] \<in> fronts xs
[PROOF STEP]
have "0 \<in> front_sums xs"
[PROOF STATE]
proof (prove)
using this:
[] \<in> fronts xs

goal (1 subgoal):
 1. (0::'a) \<in> front_sums xs
[PROOF STEP]
unfolding front_sums_def
[PROOF STATE]
proof (prove)
using this:
[] \<in> fronts xs

goal (1 subgoal):
 1. (0::'a) \<in> sum_list ` fronts xs
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(0::'a) \<in> front_sums xs

goal (1 subgoal):
 1. (0::'a) \<le> Max (front_sums xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<in> front_sums xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<in> front_sums xs

goal (1 subgoal):
 1. (0::'a) \<le> Max (front_sums xs)
[PROOF STEP]
using finite_front_sums Max_ge
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<in> front_sums xs
finite (front_sums ?xs)
\<lbrakk>finite ?A; ?x \<in> ?A\<rbrakk> \<Longrightarrow> ?x \<le> Max ?A

goal (1 subgoal):
 1. (0::'a) \<le> Max (front_sums xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> Max (front_sums xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in real_normed_vector) norm_minus_commute: "norm (a - b) = norm (b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a - b) = norm (b - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (a - b) = norm (b - a)
[PROOF STEP]
have "norm (- (b - a)) = norm (b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (- (b - a)) = norm (b - a)
[PROOF STEP]
by (rule norm_minus_cancel)
[PROOF STATE]
proof (state)
this:
norm (- (b - a)) = norm (b - a)

goal (1 subgoal):
 1. norm (a - b) = norm (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (- (b - a)) = norm (b - a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (- (b - a)) = norm (b - a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_graph_map_of: "finite (graph (map_of al))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (graph (map_of al))
[PROOF STEP]
unfolding graph_eq_to_snd_dom finite_dom_map_of
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>x. (x, the (map_of al x))) ` dom (map_of al))
[PROOF STEP]
using finite_dom_map_of
[PROOF STATE]
proof (prove)
using this:
finite (dom (map_of ?l))

goal (1 subgoal):
 1. finite ((\<lambda>x. (x, the (map_of al x))) ` dom (map_of al))
[PROOF STEP]
by blast


[STATEMENT]
lemma register_pair_apply:
  assumes \<open>compatible F G\<close>
  shows \<open>(F; G) (a \<otimes>\<^sub>u b) = (F a) *\<^sub>u (G b)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F;G) (a \<otimes>\<^sub>u b) = F a *\<^sub>u G b
[PROOF STEP]
apply (rule register_pair_apply)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. register F
 2. register G
 3. \<And>a b. F a *\<^sub>u G b = G b *\<^sub>u F a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
compatible F G

goal (3 subgoals):
 1. register F
 2. register G
 3. \<And>a b. F a *\<^sub>u G b = G b *\<^sub>u F a
[PROOF STEP]
unfolding compatible_def
[PROOF STATE]
proof (prove)
using this:
register F \<and> register G \<and> (\<forall>a b. F a *\<^sub>u G b = G b *\<^sub>u F a)

goal (3 subgoals):
 1. register F
 2. register G
 3. \<And>a b. F a *\<^sub>u G b = G b *\<^sub>u F a
[PROOF STEP]
by metis+


[STATEMENT]
lemma set_replicate [simp]: "n \<noteq> 0 \<Longrightarrow> set (replicate n x) = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> set (replicate n x) = {x}
[PROOF STEP]
by (fast dest!: not0_implies_Suc intro!: set_replicate_Suc)


[STATEMENT]
lemma compare_Integer_numeral_simps [simp]:
  "compare\<cdot>(0::Integer)\<cdot>0 = EQ"
  "compare\<cdot>(0::Integer)\<cdot>1 = LT"
  "compare\<cdot>(1::Integer)\<cdot>0 = GT"
  "compare\<cdot>(1::Integer)\<cdot>1 = EQ"
  "compare\<cdot>(0::Integer)\<cdot>(numeral k) = LT"
  "compare\<cdot>(numeral k)\<cdot>(0::Integer) = GT"
  "Num.One < k \<Longrightarrow> compare\<cdot>(1::Integer)\<cdot>(numeral k) = LT"
  "Num.One < k \<Longrightarrow> compare\<cdot>(numeral k)\<cdot>(1::Integer) = GT"
  "compare\<cdot>(numeral k::Integer)\<cdot>(numeral l) =
    (if k < l then LT else if k > l then GT else EQ)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((compare\<cdot>0\<cdot>0 = EQ &&& compare\<cdot>0\<cdot>1 = LT) &&& compare\<cdot>1\<cdot>0 = GT &&& compare\<cdot>1\<cdot>1 = EQ) &&& (compare\<cdot>0\<cdot>(numeral k) = LT &&& compare\<cdot>(numeral k)\<cdot>0 = GT) &&& (num.One < k \<Longrightarrow> compare\<cdot>1\<cdot>(numeral k) = LT) &&& (num.One < k \<Longrightarrow> compare\<cdot>(numeral k)\<cdot>1 = GT) &&& compare\<cdot>(numeral k)\<cdot>(numeral l) = (if k < l then LT else if l < k then GT else EQ)
[PROOF STEP]
unfolding zero_Integer_def one_Integer_def numeral_Integer_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((compare\<cdot>(MkI\<cdot>0)\<cdot>(MkI\<cdot>0) = EQ &&& compare\<cdot>(MkI\<cdot>0)\<cdot>(MkI\<cdot>1) = LT) &&& compare\<cdot>(MkI\<cdot>1)\<cdot>(MkI\<cdot>0) = GT &&& compare\<cdot>(MkI\<cdot>1)\<cdot>(MkI\<cdot>1) = EQ) &&& (compare\<cdot>(MkI\<cdot>0)\<cdot>(MkI\<cdot>(numeral k)) = LT &&& compare\<cdot>(MkI\<cdot>(numeral k))\<cdot>(MkI\<cdot>0) = GT) &&& (num.One < k \<Longrightarrow> compare\<cdot>(MkI\<cdot>1)\<cdot>(MkI\<cdot>(numeral k)) = LT) &&& (num.One < k \<Longrightarrow> compare\<cdot>(MkI\<cdot>(numeral k))\<cdot>(MkI\<cdot>1) = GT) &&& compare\<cdot>(MkI\<cdot>(numeral k))\<cdot>(MkI\<cdot>(numeral l)) = (if k < l then LT else if l < k then GT else EQ)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma normalize_lcm_right: "lcm a (normalize b) = lcm a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm a (normalize b) = lcm a b
[PROOF STEP]
by (fact lcm.normalize_right_idem)


[STATEMENT]
lemma merge_correct:
  assumes "sorted l1"
  assumes "sorted l2"
  shows "
    sorted (merge l1 l2)
  \<and> mset (merge l1 l2) = mset l1 + mset l2
  \<and> set (merge l1 l2) = set l1 \<union> set l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (merge l1 l2) \<and> mset (merge l1 l2) = mset l1 + mset l2 \<and> set (merge l1 l2) = set l1 \<union> set l2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sorted l1
sorted l2

goal (1 subgoal):
 1. sorted (merge l1 l2) \<and> mset (merge l1 l2) = mset l1 + mset l2 \<and> set (merge l1 l2) = set l1 \<union> set l2
[PROOF STEP]
proof (induction l1 arbitrary: l2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>l2. \<lbrakk>sorted []; sorted l2\<rbrakk> \<Longrightarrow> sorted (merge [] l2) \<and> mset (merge [] l2) = mset [] + mset l2 \<and> set (merge [] l2) = set [] \<union> set l2
 2. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>sorted l1; sorted l2\<rbrakk> \<Longrightarrow> sorted (merge l1 l2) \<and> mset (merge l1 l2) = mset l1 + mset l2 \<and> set (merge l1 l2) = set l1 \<union> set l2; sorted (a # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (a # l1) l2) \<and> mset (merge (a # l1) l2) = mset (a # l1) + mset l2 \<and> set (merge (a # l1) l2) = set (a # l1) \<union> set l2
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
sorted []
sorted l2

goal (2 subgoals):
 1. \<And>l2. \<lbrakk>sorted []; sorted l2\<rbrakk> \<Longrightarrow> sorted (merge [] l2) \<and> mset (merge [] l2) = mset [] + mset l2 \<and> set (merge [] l2) = set [] \<union> set l2
 2. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>sorted l1; sorted l2\<rbrakk> \<Longrightarrow> sorted (merge l1 l2) \<and> mset (merge l1 l2) = mset l1 + mset l2 \<and> set (merge l1 l2) = set l1 \<union> set l2; sorted (a # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (a # l1) l2) \<and> mset (merge (a # l1) l2) = mset (a # l1) + mset l2 \<and> set (merge (a # l1) l2) = set (a # l1) \<union> set l2
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
sorted []
sorted l2

goal (1 subgoal):
 1. sorted (merge [] l2) \<and> mset (merge [] l2) = mset [] + mset l2 \<and> set (merge [] l2) = set [] \<union> set l2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (merge [] l2) \<and> mset (merge [] l2) = mset [] + mset l2 \<and> set (merge [] l2) = set [] \<union> set l2

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>sorted l1; sorted l2\<rbrakk> \<Longrightarrow> sorted (merge l1 l2) \<and> mset (merge l1 l2) = mset l1 + mset l2 \<and> set (merge l1 l2) = set l1 \<union> set l2; sorted (a # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (a # l1) l2) \<and> mset (merge (a # l1) l2) = mset (a # l1) + mset l2 \<and> set (merge (a # l1) l2) = set (a # l1) \<union> set l2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>sorted l1; sorted l2\<rbrakk> \<Longrightarrow> sorted (merge l1 l2) \<and> mset (merge l1 l2) = mset l1 + mset l2 \<and> set (merge l1 l2) = set l1 \<union> set l2; sorted (a # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (a # l1) l2) \<and> mset (merge (a # l1) l2) = mset (a # l1) + mset l2 \<and> set (merge (a # l1) l2) = set (a # l1) \<union> set l2
[PROOF STEP]
case (Cons x1 l1 l2)
[PROOF STATE]
proof (state)
this:
\<lbrakk>sorted l1; sorted ?l2.0\<rbrakk> \<Longrightarrow> sorted (merge l1 ?l2.0) \<and> mset (merge l1 ?l2.0) = mset l1 + mset ?l2.0 \<and> set (merge l1 ?l2.0) = set l1 \<union> set ?l2.0
sorted (x1 # l1)
sorted l2

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>sorted l1; sorted l2\<rbrakk> \<Longrightarrow> sorted (merge l1 l2) \<and> mset (merge l1 l2) = mset l1 + mset l2 \<and> set (merge l1 l2) = set l1 \<union> set l2; sorted (a # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (a # l1) l2) \<and> mset (merge (a # l1) l2) = mset (a # l1) + mset l2 \<and> set (merge (a # l1) l2) = set (a # l1) \<union> set l2
[PROOF STEP]
note IH = Cons.IH
[PROOF STATE]
proof (state)
this:
\<lbrakk>sorted l1; sorted ?l2.0\<rbrakk> \<Longrightarrow> sorted (merge l1 ?l2.0) \<and> mset (merge l1 ?l2.0) = mset l1 + mset ?l2.0 \<and> set (merge l1 ?l2.0) = set l1 \<union> set ?l2.0

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>sorted l1; sorted l2\<rbrakk> \<Longrightarrow> sorted (merge l1 l2) \<and> mset (merge l1 l2) = mset l1 + mset l2 \<and> set (merge l1 l2) = set l1 \<union> set l2; sorted (a # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (a # l1) l2) \<and> mset (merge (a # l1) l2) = mset (a # l1) + mset l2 \<and> set (merge (a # l1) l2) = set (a # l1) \<union> set l2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
sorted (x1 # l1)
sorted l2

goal (1 subgoal):
 1. sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2
[PROOF STEP]
proof (induction l2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>sorted (x1 # l1); sorted []\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) []) \<and> mset (merge (x1 # l1) []) = mset (x1 # l1) + mset [] \<and> set (merge (x1 # l1) []) = set (x1 # l1) \<union> set []
 2. \<And>a l2. \<lbrakk>\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2; sorted (x1 # l1); sorted (a # l2)\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) (a # l2)) \<and> mset (merge (x1 # l1) (a # l2)) = mset (x1 # l1) + mset (a # l2) \<and> set (merge (x1 # l1) (a # l2)) = set (x1 # l1) \<union> set (a # l2)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
sorted (x1 # l1)
sorted []

goal (2 subgoals):
 1. \<lbrakk>sorted (x1 # l1); sorted []\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) []) \<and> mset (merge (x1 # l1) []) = mset (x1 # l1) + mset [] \<and> set (merge (x1 # l1) []) = set (x1 # l1) \<union> set []
 2. \<And>a l2. \<lbrakk>\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2; sorted (x1 # l1); sorted (a # l2)\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) (a # l2)) \<and> mset (merge (x1 # l1) (a # l2)) = mset (x1 # l1) + mset (a # l2) \<and> set (merge (x1 # l1) (a # l2)) = set (x1 # l1) \<union> set (a # l2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sorted (x1 # l1)
sorted []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sorted (x1 # l1)
sorted []

goal (1 subgoal):
 1. sorted (merge (x1 # l1) []) \<and> mset (merge (x1 # l1) []) = mset (x1 # l1) + mset [] \<and> set (merge (x1 # l1) []) = set (x1 # l1) \<union> set []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (merge (x1 # l1) []) \<and> mset (merge (x1 # l1) []) = mset (x1 # l1) + mset [] \<and> set (merge (x1 # l1) []) = set (x1 # l1) \<union> set []

goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2; sorted (x1 # l1); sorted (a # l2)\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) (a # l2)) \<and> mset (merge (x1 # l1) (a # l2)) = mset (x1 # l1) + mset (a # l2) \<and> set (merge (x1 # l1) (a # l2)) = set (x1 # l1) \<union> set (a # l2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2; sorted (x1 # l1); sorted (a # l2)\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) (a # l2)) \<and> mset (merge (x1 # l1) (a # l2)) = mset (x1 # l1) + mset (a # l2) \<and> set (merge (x1 # l1) (a # l2)) = set (x1 # l1) \<union> set (a # l2)
[PROOF STEP]
case (Cons x2 l2)
[PROOF STATE]
proof (state)
this:
\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2
sorted (x1 # l1)
sorted (x2 # l2)

goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2; sorted (x1 # l1); sorted (a # l2)\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) (a # l2)) \<and> mset (merge (x1 # l1) (a # l2)) = mset (x1 # l1) + mset (a # l2) \<and> set (merge (x1 # l1) (a # l2)) = set (x1 # l1) \<union> set (a # l2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2
sorted (x1 # l1)
sorted (x2 # l2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2
sorted (x1 # l1)
sorted (x2 # l2)

goal (1 subgoal):
 1. sorted (merge (x1 # l1) (x2 # l2)) \<and> mset (merge (x1 # l1) (x2 # l2)) = mset (x1 # l1) + mset (x2 # l2) \<and> set (merge (x1 # l1) (x2 # l2)) = set (x1 # l1) \<union> set (x2 # l2)
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sorted (x1 # l1); sorted l2\<rbrakk> \<Longrightarrow> sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2
sorted (x1 # l1)
sorted (x2 # l2)
\<lbrakk>sorted l1; sorted ?l2.0\<rbrakk> \<Longrightarrow> sorted (merge l1 ?l2.0) \<and> mset (merge l1 ?l2.0) = mset l1 + mset ?l2.0 \<and> set (merge l1 ?l2.0) = set l1 \<union> set ?l2.0

goal (1 subgoal):
 1. sorted (merge (x1 # l1) (x2 # l2)) \<and> mset (merge (x1 # l1) (x2 # l2)) = mset (x1 # l1) + mset (x2 # l2) \<and> set (merge (x1 # l1) (x2 # l2)) = set (x1 # l1) \<union> set (x2 # l2)
[PROOF STEP]
by (force split: if_split_asm)
[PROOF STATE]
proof (state)
this:
sorted (merge (x1 # l1) (x2 # l2)) \<and> mset (merge (x1 # l1) (x2 # l2)) = mset (x1 # l1) + mset (x2 # l2) \<and> set (merge (x1 # l1) (x2 # l2)) = set (x1 # l1) \<union> set (x2 # l2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted (merge (x1 # l1) l2) \<and> mset (merge (x1 # l1) l2) = mset (x1 # l1) + mset l2 \<and> set (merge (x1 # l1) l2) = set (x1 # l1) \<union> set l2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_nonpos_Reals_complex [simp]: "closed (\<real>\<^sub>\<le>\<^sub>0 :: complex set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have "\<real>\<^sub>\<le>\<^sub>0 = \<real> \<inter> {z. Re(z) \<le> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<real>\<^sub>\<le>\<^sub>0 = \<real> \<inter> {z. Re z \<le> 0}
[PROOF STEP]
using complex_nonpos_Reals_iff complex_is_Real_iff
[PROOF STATE]
proof (prove)
using this:
(?z \<in> \<real>\<^sub>\<le>\<^sub>0) = (Re ?z \<le> 0 \<and> Im ?z = 0)
(?z \<in> \<real>) = (Im ?z = 0)

goal (1 subgoal):
 1. \<real>\<^sub>\<le>\<^sub>0 = \<real> \<inter> {z. Re z \<le> 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<real>\<^sub>\<le>\<^sub>0 = \<real> \<inter> {z. Re z \<le> 0}

goal (1 subgoal):
 1. closed \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<real>\<^sub>\<le>\<^sub>0 = \<real> \<inter> {z. Re z \<le> 0}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<real>\<^sub>\<le>\<^sub>0 = \<real> \<inter> {z. Re z \<le> 0}

goal (1 subgoal):
 1. closed \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
by (metis closed_Real_halfspace_Re_le)
[PROOF STATE]
proof (state)
this:
closed \<real>\<^sub>\<le>\<^sub>0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_le_mono1_hmset: "i \<le> j \<Longrightarrow> i * k \<le> j * k" for i j k :: hmultiset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> i * k \<le> j * k
[PROOF STEP]
by (simp add: mult_right_mono)


[STATEMENT]
lemma (in cring) binomial_finite_char:
  fixes p :: nat
  assumes [simp]: "x \<in> carrier R" "y \<in> carrier R" and "add_pow R p \<one> = \<zero>" "prime p"
  shows   "(x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p
[PROOF STEP]
have *: "add_pow R (p choose i) (x [^] i \<otimes> y [^] (p - i)) = \<zero>" if "i \<in> {1..<p}" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>
[PROOF STEP]
have "p dvd (p choose i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd p choose i
[PROOF STEP]
by (rule prime_dvd_choose) (use that assms in auto)
[PROOF STATE]
proof (state)
this:
p dvd p choose i

goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd p choose i
[PROOF STEP]
obtain k where [simp]: "(p choose i) = p * k"
[PROOF STATE]
proof (prove)
using this:
p dvd p choose i

goal (1 subgoal):
 1. (\<And>k. p choose i = p * k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p choose i = p * k

goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>
[PROOF STEP]
have "add_pow R (p choose i) (x [^] i \<otimes> y [^] (p - i)) =
            add_pow R (p choose i) \<one> \<otimes> (x [^] i \<otimes> y [^] (p - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = [(p choose i)] \<cdot> \<one> \<otimes> (x [^] i \<otimes> y [^] (p - i))
[PROOF STEP]
by (simp add: add_pow_ldistr)
[PROOF STATE]
proof (state)
this:
[(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = [(p choose i)] \<cdot> \<one> \<otimes> (x [^] i \<otimes> y [^] (p - i))

goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = [(p choose i)] \<cdot> \<one> \<otimes> (x [^] i \<otimes> y [^] (p - i))

goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>
[PROOF STEP]
have "add_pow R (p choose i) \<one> = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(p choose i)] \<cdot> \<one> = \<zero>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
[p] \<cdot> \<one> = \<zero>
prime p

goal (1 subgoal):
 1. [(p choose i)] \<cdot> \<one> = \<zero>
[PROOF STEP]
by (simp flip: add.nat_pow_pow)
[PROOF STATE]
proof (state)
this:
[(p choose i)] \<cdot> \<one> = \<zero>

goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero> \<otimes> (x [^] i \<otimes> y [^] (p - i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero> \<otimes> (x [^] i \<otimes> y [^] (p - i))

goal (1 subgoal):
 1. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)) = \<zero>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i20 \<in> {1..<p} \<Longrightarrow> [(p choose ?i20)] \<cdot> (x [^] ?i20 \<otimes> y [^] (p - ?i20)) = \<zero>

goal (1 subgoal):
 1. (x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p
[PROOF STEP]
have "(x \<oplus> y) [^] p = (\<Oplus>i\<in>{..p}. add_pow R (p choose i) (x [^] i \<otimes> y [^] (p - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<oplus> y) [^] p = (\<Oplus>i\<in>{..p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)))
[PROOF STEP]
by (rule binomial) auto
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] p = (\<Oplus>i\<in>{..p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)))

goal (1 subgoal):
 1. (x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] p = (\<Oplus>i\<in>{..p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)))

goal (1 subgoal):
 1. (x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p
[PROOF STEP]
have "\<dots> = (\<Oplus>i\<in>{0, p}. add_pow R (p choose i) (x [^] i \<otimes> y [^] (p - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>i\<in>{..p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i))) = (\<Oplus>i\<in>{0, p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
?i20 \<in> {1..<p} \<Longrightarrow> [(p choose ?i20)] \<cdot> (x [^] ?i20 \<otimes> y [^] (p - ?i20)) = \<zero>

goal (1 subgoal):
 1. (\<Oplus>i\<in>{..p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i))) = (\<Oplus>i\<in>{0, p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)))
[PROOF STEP]
by (intro add.finprod_mono_neutral_cong_right) auto
[PROOF STATE]
proof (state)
this:
(\<Oplus>i\<in>{..p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i))) = (\<Oplus>i\<in>{0, p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)))

goal (1 subgoal):
 1. (x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>i\<in>{..p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i))) = (\<Oplus>i\<in>{0, p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i)))

goal (1 subgoal):
 1. (x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p
[PROOF STEP]
have "\<dots> = x [^] p \<oplus> y [^] p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>i\<in>{0, p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i))) = x [^] p \<oplus> y [^] p
[PROOF STEP]
using assms prime_gt_0_nat[of p]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
[p] \<cdot> \<one> = \<zero>
prime p
prime p \<Longrightarrow> 0 < p

goal (1 subgoal):
 1. (\<Oplus>i\<in>{0, p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i))) = x [^] p \<oplus> y [^] p
[PROOF STEP]
by (simp add: cring_simprules)
[PROOF STATE]
proof (state)
this:
(\<Oplus>i\<in>{0, p}. [(p choose i)] \<cdot> (x [^] i \<otimes> y [^] (p - i))) = x [^] p \<oplus> y [^] p

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

goal (1 subgoal):
 1. (x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] p = x [^] p \<oplus> y [^] p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in monoid) units_group: "group (units_of G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (units_of G)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Group.group (units_of G)
[PROOF STEP]
have "\<And>x y z. \<lbrakk>x \<in> Units G; y \<in> Units G; z \<in> Units G\<rbrakk> \<Longrightarrow> x \<otimes> y \<otimes> z = x \<otimes> (y \<otimes> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x \<in> Units G; y \<in> Units G; z \<in> Units G\<rbrakk> \<Longrightarrow> x \<otimes> y \<otimes> z = x \<otimes> (y \<otimes> z)
[PROOF STEP]
by (simp add: Units_closed m_assoc)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> Units G; ?y \<in> Units G; ?z \<in> Units G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<otimes> ?z = ?x \<otimes> (?y \<otimes> ?z)

goal (1 subgoal):
 1. Group.group (units_of G)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> Units G; ?y \<in> Units G; ?z \<in> Units G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<otimes> ?z = ?x \<otimes> (?y \<otimes> ?z)

goal (1 subgoal):
 1. Group.group (units_of G)
[PROOF STEP]
have "\<And>x. x \<in> Units G \<Longrightarrow> \<exists>y\<in>Units G. y \<otimes> x = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> Units G \<Longrightarrow> \<exists>y\<in>Units G. y \<otimes> x = \<one>
[PROOF STEP]
using Units_l_inv
[PROOF STATE]
proof (prove)
using this:
?x \<in> Units G \<Longrightarrow> inv ?x \<otimes> ?x = \<one>

goal (1 subgoal):
 1. \<And>x. x \<in> Units G \<Longrightarrow> \<exists>y\<in>Units G. y \<otimes> x = \<one>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> Units G \<Longrightarrow> \<exists>y\<in>Units G. y \<otimes> ?x = \<one>

goal (1 subgoal):
 1. Group.group (units_of G)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> Units G; ?y \<in> Units G; ?z \<in> Units G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<otimes> ?z = ?x \<otimes> (?y \<otimes> ?z)
?x \<in> Units G \<Longrightarrow> \<exists>y\<in>Units G. y \<otimes> ?x = \<one>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> Units G; ?y \<in> Units G; ?z \<in> Units G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<otimes> ?z = ?x \<otimes> (?y \<otimes> ?z)
?x \<in> Units G \<Longrightarrow> \<exists>y\<in>Units G. y \<otimes> ?x = \<one>

goal (1 subgoal):
 1. Group.group (units_of G)
[PROOF STEP]
unfolding units_of_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> Units G; ?y \<in> Units G; ?z \<in> Units G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<otimes> ?z = ?x \<otimes> (?y \<otimes> ?z)
?x \<in> Units G \<Longrightarrow> \<exists>y\<in>Units G. y \<otimes> ?x = \<one>

goal (1 subgoal):
 1. Group.group \<lparr>carrier = Units G, mult = (\<otimes>), one = \<one>\<rparr>
[PROOF STEP]
by (force intro!: groupI)
[PROOF STATE]
proof (state)
this:
Group.group (units_of G)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma valuate_code[code]:  "valuate lp val = (
  let lpm = linear_poly_map lp
  in sum_list (map (\<lambda> x. (the (fmlookup lpm x)) *R (val x)) (vars_list lp)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lp \<lbrace> val \<rbrace> = (let lpm = linear_poly_map lp in \<Sum>x\<leftarrow>vars_list lp. the (fmlookup lpm x) *R val x)
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lp \<lbrace> val \<rbrace> = (\<Sum>x\<leftarrow>vars_list lp. the (fmlookup (linear_poly_map lp) x) *R val x)
[PROOF STEP]
proof (subst sum_list_distinct_conv_sum_set)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distinct (vars_list lp)
 2. lp \<lbrace> val \<rbrace> = (\<Sum>x\<in>set (vars_list lp). the (fmlookup (linear_poly_map lp) x) *R val x)
[PROOF STEP]
show "distinct (vars_list lp)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (vars_list lp)
[PROOF STEP]
by (transfer, auto)
[PROOF STATE]
proof (state)
this:
distinct (vars_list lp)

goal (1 subgoal):
 1. lp \<lbrace> val \<rbrace> = (\<Sum>x\<in>set (vars_list lp). the (fmlookup (linear_poly_map lp) x) *R val x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lp \<lbrace> val \<rbrace> = (\<Sum>x\<in>set (vars_list lp). the (fmlookup (linear_poly_map lp) x) *R val x)
[PROOF STEP]
show "lp \<lbrace> val \<rbrace> =
        (\<Sum>x\<in>set (vars_list lp). the (fmlookup (linear_poly_map lp) x) *R val x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lp \<lbrace> val \<rbrace> = (\<Sum>x\<in>set (vars_list lp). the (fmlookup (linear_poly_map lp) x) *R val x)
[PROOF STEP]
unfolding set_vars_list
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lp \<lbrace> val \<rbrace> = (\<Sum>x\<in>vars lp. the (fmlookup (linear_poly_map lp) x) *R val x)
[PROOF STEP]
by (transfer, auto)
[PROOF STATE]
proof (state)
this:
lp \<lbrace> val \<rbrace> = (\<Sum>x\<in>set (vars_list lp). the (fmlookup (linear_poly_map lp) x) *R val x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma min_pmf_0[simp]: "min (pmf M p) 0 = 0" "min 0 (pmf M p) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (pmf M p) 0 = 0 &&& min 0 (pmf M p) = 0
[PROOF STEP]
using pmf_nonneg[of M p]
[PROOF STATE]
proof (prove)
using this:
0 \<le> pmf M p

goal (1 subgoal):
 1. min (pmf M p) 0 = 0 &&& min 0 (pmf M p) = 0
[PROOF STEP]
by arith+


[STATEMENT]
lemma continuous_complex_iff:
  "continuous F f \<longleftrightarrow> continuous F (\<lambda>x. Re (f x)) \<and> continuous F (\<lambda>x. Im (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F f = (continuous F (\<lambda>x. Re (f x)) \<and> continuous F (\<lambda>x. Im (f x)))
[PROOF STEP]
by (simp only: continuous_def tendsto_complex_iff)


[STATEMENT]
lemma aux3_digit_lt_linear:
  fixes a b c d t k :: nat
  shows "\<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2^t) \<exclamdown> k \<le> (c * 2^t) \<exclamdown> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
proof (cases "k < t")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
 2. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k < t

goal (2 subgoals):
 1. k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
 2. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
hence "(a * 2^t) \<exclamdown> k = 0"
[PROOF STATE]
proof (prove)
using this:
k < t

goal (1 subgoal):
 1. (a * 2 ^ t) \<exclamdown> k = 0
[PROOF STEP]
using aux2_digit_sum_repr[of "0"] nth_bit_def
[PROOF STATE]
proof (prove)
using this:
k < t
\<lbrakk>0 < 2 ^ ?c; ?r < ?c\<rbrakk> \<Longrightarrow> (?a * 2 ^ ?c + 0) \<exclamdown> ?r = 0 \<exclamdown> ?r
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2

goal (1 subgoal):
 1. (a * 2 ^ t) \<exclamdown> k = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a * 2 ^ t) \<exclamdown> k = 0

goal (2 subgoals):
 1. k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
 2. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a * 2 ^ t) \<exclamdown> k = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a * 2 ^ t) \<exclamdown> k = 0

goal (1 subgoal):
 1. \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k

goal (1 subgoal):
 1. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> k < t

goal (1 subgoal):
 1. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
define l where "l = k - t"
[PROOF STATE]
proof (state)
this:
l = k - t

goal (1 subgoal):
 1. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
hence k: "k = l + t"
[PROOF STATE]
proof (prove)
using this:
l = k - t

goal (1 subgoal):
 1. k = l + t
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
l = k - t
\<not> k < t

goal (1 subgoal):
 1. k = l + t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k = l + t

goal (1 subgoal):
 1. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
have "(a * 2^t) \<exclamdown> k = a \<exclamdown> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * 2 ^ t) \<exclamdown> k = a \<exclamdown> l
[PROOF STEP]
using nth_bit_def l_def
[PROOF STATE]
proof (prove)
using this:
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2
l = k - t

goal (1 subgoal):
 1. (a * 2 ^ t) \<exclamdown> k = a \<exclamdown> l
[PROOF STEP]
using aux_digit_shift k
[PROOF STATE]
proof (prove)
using this:
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2
l = k - t
(?a * 2 ^ ?t) \<exclamdown> (?l + ?t) = ?a \<exclamdown> ?l
k = l + t

goal (1 subgoal):
 1. (a * 2 ^ t) \<exclamdown> k = a \<exclamdown> l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a * 2 ^ t) \<exclamdown> k = a \<exclamdown> l

goal (1 subgoal):
 1. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(a * 2 ^ t) \<exclamdown> k = a \<exclamdown> l

goal (1 subgoal):
 1. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
have "(c * 2^t) \<exclamdown> k = c \<exclamdown> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c * 2 ^ t) \<exclamdown> k = c \<exclamdown> l
[PROOF STEP]
using nth_bit_def l_def
[PROOF STATE]
proof (prove)
using this:
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2
l = k - t

goal (1 subgoal):
 1. (c * 2 ^ t) \<exclamdown> k = c \<exclamdown> l
[PROOF STEP]
using aux_digit_shift k
[PROOF STATE]
proof (prove)
using this:
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2
l = k - t
(?a * 2 ^ ?t) \<exclamdown> (?l + ?t) = ?a \<exclamdown> ?l
k = l + t

goal (1 subgoal):
 1. (c * 2 ^ t) \<exclamdown> k = c \<exclamdown> l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(c * 2 ^ t) \<exclamdown> k = c \<exclamdown> l

goal (1 subgoal):
 1. \<not> k < t \<Longrightarrow> \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(a * 2 ^ t) \<exclamdown> k = a \<exclamdown> l
(c * 2 ^ t) \<exclamdown> k = c \<exclamdown> l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a * 2 ^ t) \<exclamdown> k = a \<exclamdown> l
(c * 2 ^ t) \<exclamdown> k = c \<exclamdown> l

goal (1 subgoal):
 1. \<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>l. a \<exclamdown> l \<le> c \<exclamdown> l \<longrightarrow> (a * 2 ^ t) \<exclamdown> k \<le> (c * 2 ^ t) \<exclamdown> k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_set_remove_mid:
  assumes "distinct (xs @ [x] @ ys)"
  shows "set (xs @ ys) = set (xs @ [x] @ ys) - {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (xs @ ys) = set (xs @ [x] @ ys) - {x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct (xs @ [x] @ ys)

goal (1 subgoal):
 1. set (xs @ ys) = set (xs @ [x] @ ys) - {x}
[PROOF STEP]
by force


[STATEMENT]
lemma length_nonempty:
assumes "x \<noteq> []"
shows    "Suc 0 \<le> length x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 \<le> length x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> []

goal (1 subgoal):
 1. Suc 0 \<le> length x
[PROOF STEP]
by (metis length_greater_0_conv less_eq_Suc_le)


[STATEMENT]
lemma lang_eq_ext_Nil_fold_Deriv:
  fixes r s
  defines "\<BB> \<equiv> {(fold Deriv w (lang r), fold Deriv w (lang s))| w. w\<in>lists (atoms r \<union> atoms s)}"
  shows "lang r = lang s \<longleftrightarrow> (\<forall>(K, L) \<in> \<BB>. [] \<in> K \<longleftrightarrow> [] \<in> L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lang r = lang s) = (\<forall>(K, L)\<in>\<BB>. ([] \<in> K) = ([] \<in> L))
[PROOF STEP]
unfolding lang_eq_ext \<BB>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>w\<in>lists (atoms r \<union> atoms s). (w \<in> lang r) = (w \<in> lang s)) = (\<forall>(K, L)\<in>{(fold Deriv w (lang r), fold Deriv w (lang s)) |w. w \<in> lists (atoms r \<union> atoms s)}. ([] \<in> K) = ([] \<in> L))
[PROOF STEP]
by (subst (1 2) in_fold_Deriv[of "[]", simplified, symmetric]) auto


[STATEMENT]
lemma c_drop_df: "\<forall> ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls))
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>ls. drop 0 ls = nat_to_list (c_drop 0 (list_to_nat ls))
 2. \<And>n. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
show "\<forall> ls. drop 0 ls = nat_to_list (c_drop 0 (list_to_nat ls))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ls. drop 0 ls = nat_to_list (c_drop 0 (list_to_nat ls))
[PROOF STEP]
by (simp add: c_drop_def)
[PROOF STATE]
proof (state)
this:
\<forall>ls. drop 0 ls = nat_to_list (c_drop 0 (list_to_nat ls))

goal (1 subgoal):
 1. \<And>n. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
assume A1: "\<forall> ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls))"
[PROOF STATE]
proof (state)
this:
\<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls))

goal (1 subgoal):
 1. \<And>n. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls))
[PROOF STEP]
show "\<forall> ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))"
[PROOF STATE]
proof (prove)
using this:
\<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls))

goal (1 subgoal):
 1. \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
fix ls::"nat list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
have S1: "drop (Suc n) ls = drop n (tl ls)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop (Suc n) ls = drop n (tl ls)
[PROOF STEP]
by (rule drop_Suc)
[PROOF STATE]
proof (state)
this:
drop (Suc n) ls = drop n (tl ls)

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
\<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls))
[PROOF STEP]
have S2: "drop n (tl ls) = nat_to_list (c_drop n (list_to_nat (tl ls)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls))

goal (1 subgoal):
 1. drop n (tl ls) = nat_to_list (c_drop n (list_to_nat (tl ls)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
drop n (tl ls) = nat_to_list (c_drop n (list_to_nat (tl ls)))

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
drop n (tl ls) = nat_to_list (c_drop n (list_to_nat (tl ls)))

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
have "\<dots> = nat_to_list (c_drop n (c_tl (list_to_nat ls)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_list (c_drop n (list_to_nat (tl ls))) = nat_to_list (c_drop n (c_tl (list_to_nat ls)))
[PROOF STEP]
by  (simp add: c_tl_eq_tl)
[PROOF STATE]
proof (state)
this:
nat_to_list (c_drop n (list_to_nat (tl ls))) = nat_to_list (c_drop n (c_tl (list_to_nat ls)))

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat_to_list (c_drop n (list_to_nat (tl ls))) = nat_to_list (c_drop n (c_tl (list_to_nat ls)))

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
have "\<dots> = nat_to_list (c_drop (Suc n) (list_to_nat ls))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_list (c_drop n (c_tl (list_to_nat ls))) = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
by  (simp add: c_drop_at_Suc1)
[PROOF STATE]
proof (state)
this:
nat_to_list (c_drop n (c_tl (list_to_nat ls))) = nat_to_list (c_drop (Suc n) (list_to_nat ls))

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
drop n (tl ls) = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
have "drop n (tl ls) = nat_to_list (c_drop (Suc n) (list_to_nat ls))"
[PROOF STATE]
proof (prove)
using this:
drop n (tl ls) = nat_to_list (c_drop (Suc n) (list_to_nat ls))

goal (1 subgoal):
 1. drop n (tl ls) = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
drop n (tl ls) = nat_to_list (c_drop (Suc n) (list_to_nat ls))

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
with S1
[PROOF STATE]
proof (chain)
picking this:
drop (Suc n) ls = drop n (tl ls)
drop n (tl ls) = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
have "drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))"
[PROOF STATE]
proof (prove)
using this:
drop (Suc n) ls = drop n (tl ls)
drop n (tl ls) = nat_to_list (c_drop (Suc n) (list_to_nat ls))

goal (1 subgoal):
 1. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
drop (Suc n) ?ls2 = nat_to_list (c_drop (Suc n) (list_to_nat ?ls2))

goal (1 subgoal):
 1. \<forall>ls. drop n ls = nat_to_list (c_drop n (list_to_nat ls)) \<Longrightarrow> \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
drop (Suc n) ?ls2 = nat_to_list (c_drop (Suc n) (list_to_nat ?ls2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
drop (Suc n) ?ls2 = nat_to_list (c_drop (Suc n) (list_to_nat ?ls2))

goal (1 subgoal):
 1. \<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>ls. drop (Suc n) ls = nat_to_list (c_drop (Suc n) (list_to_nat ls))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_map_closedness_eq:
    "homeomorphic_map X Y f \<Longrightarrow> closedin X U \<longleftrightarrow> U \<subseteq> topspace X \<and> closedin Y (f ` U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphic_map X Y f \<Longrightarrow> closedin X U = (U \<subseteq> topspace X \<and> closedin Y (f ` U))
[PROOF STEP]
by (meson closedin_subset homeomorphic_map_closedness)


[STATEMENT]
lemma int_shiftr_ge_0: fixes i :: int shows "drop_bit n i \<ge> 0 \<longleftrightarrow> i \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> drop_bit n i) = (0 \<le> i)
[PROOF STEP]
by (fact drop_bit_nonnegative_int_iff)


[STATEMENT]
lemma rdomp_hrcomp_conv: "rdomp (hr_comp A R) x \<longleftrightarrow> (\<exists>y. rdomp A y \<and> (y,x)\<in>R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rdomp (hr_comp A R) x = (\<exists>y. rdomp A y \<and> (y, x) \<in> R)
[PROOF STEP]
by (auto simp: rdomp_def hr_comp_def)


[STATEMENT]
lemma expands_to_hd':
  assumes "(f expands_to (MS (MSLCons (c :: real, e) xs) g)) (b # basis)"
  shows   "((\<lambda>_. c) expands_to c) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>_. c) expands_to c) basis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f expands_to MS (MSLCons (c, e) xs) g) (b # basis)

goal (1 subgoal):
 1. ((\<lambda>_. c) expands_to c) basis
[PROOF STEP]
by (auto simp: expands_to.simps elim: is_expansion_aux_MSLCons)


[STATEMENT]
lemma tendsto_esum_list: "(esum_list \<longlongrightarrow> esum_list xs) (at' xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (esum_list \<longlongrightarrow> esum_list xs) (at' xs)
[PROOF STEP]
apply (rule filterlim_cong[where g="sum_list \<circ> list_of", THEN iffD2, OF refl refl])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in at' xs. esum_list x = (sum_list \<circ> list_of) x
 2. ((sum_list \<circ> list_of) \<longlongrightarrow> esum_list xs) (at' xs)
[PROOF STEP]
apply (rule eventually_mono[OF eventually_lfinite])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. lfinite x \<Longrightarrow> esum_list x = (sum_list \<circ> list_of) x
 2. ((sum_list \<circ> list_of) \<longlongrightarrow> esum_list xs) (at' xs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((sum_list \<circ> list_of) \<longlongrightarrow> esum_list xs) (at' xs)
[PROOF STEP]
unfolding esum_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((sum_list \<circ> list_of) \<longlongrightarrow> Lim (at' xs) (sum_list \<circ> list_of)) (at' xs)
[PROOF STEP]
apply (rule tendsto_LimI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((sum_list \<circ> list_of) \<longlongrightarrow> ?y10) (at' xs)
[PROOF STEP]
apply (rule esum_list_tendsto_SUP)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma C: "set_pmf (Proj1_pmf (Sum_pmf 0.5 Da Db)) = set_pmf Da"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_pmf (Proj1_pmf (Sum_pmf (5 / 10) Da Db)) = set_pmf Da
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_pmf (Proj1_pmf (Sum_pmf (5 / 10) Da Db)) = set_pmf Da
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_pmf (Proj1_pmf (Sum_pmf (5 / 10) Da Db)) = set_pmf Da
[PROOF STEP]
unfolding Sum_pmf_def Proj1_pmf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_pmf (map_pmf (case_sum (\<lambda>e. e) (\<lambda>a. undefined)) (cond_pmf (bernoulli_pmf (5 / 10) \<bind> (\<lambda>b. if b then map_pmf Inl Da else map_pmf Inr Db)) {f. \<exists>e. Inl e = f})) = set_pmf Da
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. case x of Inl e \<Rightarrow> e) ` set_pmf (cond_pmf (bernoulli_pmf (1 / 2) \<bind> (\<lambda>b. if b then map_pmf Inl Da else map_pmf Inr Db)) {f. \<exists>e. Inl e = f}) = set_pmf Da
[PROOF STEP]
using none[of "0.5" Da Db]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 5 / 10; 5 / 10 < 1\<rbrakk> \<Longrightarrow> set_pmf (bernoulli_pmf (5 / 10) \<bind> (\<lambda>b. if b then map_pmf Inl Da else map_pmf Inr Db)) \<inter> {f. \<exists>e. Inl e = f} \<noteq> {}

goal (1 subgoal):
 1. (\<lambda>x. case x of Inl e \<Rightarrow> e) ` set_pmf (cond_pmf (bernoulli_pmf (1 / 2) \<bind> (\<lambda>b. if b then map_pmf Inl Da else map_pmf Inr Db)) {f. \<exists>e. Inl e = f}) = set_pmf Da
[PROOF STEP]
apply(simp add: set_cond_pmf UNIV_bool)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Inr ` set_pmf Db \<union> Inl ` set_pmf Da) \<inter> {f. \<exists>e. Inl e = f} \<noteq> {} \<Longrightarrow> (\<lambda>x. case x of Inl e \<Rightarrow> e) ` ((Inr ` set_pmf Db \<union> Inl ` set_pmf Da) \<inter> {f. \<exists>e. Inl e = f}) = set_pmf Da
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set_pmf (Proj1_pmf (Sum_pmf (5 / 10) Da Db)) = set_pmf Da

goal:
No subgoals!
[PROOF STEP]
qed