[STATEMENT]
lemma foldr_same: "(\<And> x y. x \<in> set (xs::real list) \<Longrightarrow> y \<in> set xs \<Longrightarrow> x = y) \<Longrightarrow>
                   (\<And> x . (x::real) \<in> set xs \<Longrightarrow> x = (y::real)) \<Longrightarrow>
                   foldr (\<lambda> (a::real) (b::real). a+b) xs 0 = real (length xs) * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y
[PROOF STEP]
apply(induction xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<And>x y. \<lbrakk>x \<in> set []; y \<in> set []\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set [] \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) [] 0 = real (length []) * y
 2. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) 0 = real (length (a # xs)) * y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) 0 = real (length (a # xs)) * y
[PROOF STEP]
apply(subst foldr.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> ((+) a \<circ> foldr (+) xs) 0 = real (length (a # xs)) * y
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> a + foldr (+) xs 0 = real (length (a # xs)) * y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> a + foldr (+) xs 0 = real (length (a # xs)) * y
[PROOF STEP]
fix a :: real and xsa :: "real list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> a + foldr (+) xs 0 = real (length (a # xs)) * y
[PROOF STEP]
assume a1: "\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xsa; y \<in> set xsa\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xsa \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xsa 0 = real (length xsa) * y"
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xsa; y \<in> set xsa\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xsa \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xsa 0 = real (length xsa) * y

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> a + foldr (+) xs 0 = real (length (a # xs)) * y
[PROOF STEP]
assume "\<And>x y. \<lbrakk>x \<in> set (a # xsa); y \<in> set (a # xsa)\<rbrakk> \<Longrightarrow> x = y"
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> set (a # xsa); ?y \<in> set (a # xsa)\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> a + foldr (+) xs 0 = real (length (a # xs)) * y
[PROOF STEP]
assume a2: "\<And>x. x \<in> set (a # xsa) \<Longrightarrow> x = y"
[PROOF STATE]
proof (state)
this:
?x \<in> set (a # xsa) \<Longrightarrow> ?x = y

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> a + foldr (+) xs 0 = real (length (a # xs)) * y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> set (a # xsa) \<Longrightarrow> ?x = y
[PROOF STEP]
have f3: "a = y"
[PROOF STATE]
proof (prove)
using this:
?x \<in> set (a # xsa) \<Longrightarrow> ?x = y

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

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> a + foldr (+) xs 0 = real (length (a # xs)) * y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = y
[PROOF STEP]
have "a * real (length xsa) = foldr (+) xsa 0"
[PROOF STATE]
proof (prove)
using this:
a = y

goal (1 subgoal):
 1. a * real (length xsa) = foldr (+) xsa 0
[PROOF STEP]
using a2 a1
[PROOF STATE]
proof (prove)
using this:
a = y
?x \<in> set (a # xsa) \<Longrightarrow> ?x = y
\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xsa; y \<in> set xsa\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xsa \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xsa 0 = real (length xsa) * y

goal (1 subgoal):
 1. a * real (length xsa) = foldr (+) xsa 0
[PROOF STEP]
by (metis (no_types) list.set_intros(2) mult.commute)
[PROOF STATE]
proof (state)
this:
a * real (length xsa) = foldr (+) xsa 0

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set xs \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> foldr (+) xs 0 = real (length xs) * y; \<And>x y. \<lbrakk>x \<in> set (a # xs); y \<in> set (a # xs)\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> a + foldr (+) xs 0 = real (length (a # xs)) * y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a * real (length xsa) = foldr (+) xsa 0
[PROOF STEP]
show "a + foldr (+) xsa 0 = real (length (a # xsa)) * y"
[PROOF STATE]
proof (prove)
using this:
a * real (length xsa) = foldr (+) xsa 0

goal (1 subgoal):
 1. a + foldr (+) xsa 0 = real (length (a # xsa)) * y
[PROOF STEP]
using f3
[PROOF STATE]
proof (prove)
using this:
a * real (length xsa) = foldr (+) xsa 0
a = y

goal (1 subgoal):
 1. a + foldr (+) xsa 0 = real (length (a # xsa)) * y
[PROOF STEP]
by (simp add: distrib_left mult.commute)
[PROOF STATE]
proof (state)
this:
a + foldr (+) xsa 0 = real (length (a # xsa)) * y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Class_commutes_with_composition:
  "\<lbrakk> a \<in> M; b \<in> M \<rbrakk> \<Longrightarrow> Class a [\<cdot>] Class b = Class (a \<cdot> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> M; b \<in> M\<rbrakk> \<Longrightarrow> Class a [\<cdot>] Class b = Class (a \<cdot> b)
[PROOF STEP]
by (auto simp: quotient_composition_def intro: Class_cong [OF Class_eq Class_eq] del: equalityI)


[STATEMENT]
lemma max_norm_ge_0: "0 \<le> \<parallel>A\<parallel>\<^sub>m\<^sub>a\<^sub>x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<parallel>A\<parallel>\<^sub>m\<^sub>a\<^sub>x
[PROOF STEP]
unfolding max_norm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Max {\<bar>A $ i $ j\<bar> |i j. i \<in> UNIV \<and> j \<in> UNIV}
[PROOF STEP]
apply(rule order.trans[OF abs_ge_zero[of "A $ _ $ _"] Max_ge])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {\<bar>A $ i $ j\<bar> |i j. i \<in> UNIV \<and> j \<in> UNIV}
 2. \<bar>A $ ?uu5 $ ?uua5\<bar> \<in> {\<bar>A $ i $ j\<bar> |i j. i \<in> UNIV \<and> j \<in> UNIV}
[PROOF STEP]
using max_norm_set_proptys
[PROOF STATE]
proof (prove)
using this:
finite {\<bar>?A $ i $ j\<bar> |i j. i \<in> UNIV \<and> j \<in> UNIV}

goal (2 subgoals):
 1. finite {\<bar>A $ i $ j\<bar> |i j. i \<in> UNIV \<and> j \<in> UNIV}
 2. \<bar>A $ ?uu5 $ ?uua5\<bar> \<in> {\<bar>A $ i $ j\<bar> |i j. i \<in> UNIV \<and> j \<in> UNIV}
[PROOF STEP]
by auto


[STATEMENT]
lemma mset_le_single_iff[iff]: "{#x#} \<le> {#y#} \<longleftrightarrow> x \<le> y" for x y :: "'a::order"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({#x#} \<le> {#y#}) = (x \<le> y)
[PROOF STEP]
unfolding less_eq_multiset\<^sub>H\<^sub>O
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>ya. count {#y#} ya < count {#x#} ya \<longrightarrow> (\<exists>xa>ya. count {#x#} xa < count {#y#} xa)) = (x \<le> y)
[PROOF STEP]
by force


[STATEMENT]
lemma floor_le_iff: "\<lfloor>x\<rfloor> \<le> z \<longleftrightarrow> x < of_int z + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> \<le> z) = (x < of_int z + (1::'a))
[PROOF STEP]
by (simp add: not_less [symmetric] less_floor_iff)


[STATEMENT]
lemma moebius_rotation_inv [simp]:
  shows "moebius_inv (moebius_rotation \<phi>) = moebius_rotation (- \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_inv (moebius_rotation \<phi>) = moebius_rotation (- \<phi>)
[PROOF STEP]
using moebius_rotation_comp[of \<phi> "-\<phi>"] moebius_rotation_zero
[PROOF STATE]
proof (prove)
using this:
moebius_comp (moebius_rotation \<phi>) (moebius_rotation (- \<phi>)) = moebius_rotation (\<phi> + - \<phi>)
moebius_rotation 0 = id_moebius

goal (1 subgoal):
 1. moebius_inv (moebius_rotation \<phi>) = moebius_rotation (- \<phi>)
[PROOF STEP]
using minus_unique[of "moebius_rotation \<phi>" "moebius_rotation (-\<phi>)"]
[PROOF STATE]
proof (prove)
using this:
moebius_comp (moebius_rotation \<phi>) (moebius_rotation (- \<phi>)) = moebius_rotation (\<phi> + - \<phi>)
moebius_rotation 0 = id_moebius
moebius_rotation \<phi> + moebius_rotation (- \<phi>) = 0 \<Longrightarrow> - moebius_rotation \<phi> = moebius_rotation (- \<phi>)

goal (1 subgoal):
 1. moebius_inv (moebius_rotation \<phi>) = moebius_rotation (- \<phi>)
[PROOF STEP]
by simp


[STATEMENT]
lemma RL_simp:
  "RL c p b (Suc t) l = (snd (steps c p (Suc t)) ! l) * b ^ (Suc t) + (RL c p b t l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RL c p b (Suc t) l = snd (steps c p (Suc t)) ! l * b ^ Suc t + RL c p b t l
[PROOF STEP]
proof (induction t arbitrary: p c b)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p c b. RL c p b (Suc 0) l = snd (steps c p (Suc 0)) ! l * b ^ Suc 0 + RL c p b 0 l
 2. \<And>t p c b. (\<And>p c b. RL c p b (Suc t) l = snd (steps c p (Suc t)) ! l * b ^ Suc t + RL c p b t l) \<Longrightarrow> RL c p b (Suc (Suc t)) l = snd (steps c p (Suc (Suc t))) ! l * b ^ Suc (Suc t) + RL c p b (Suc t) l
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>p c b. RL c p b (Suc 0) l = snd (steps c p (Suc 0)) ! l * b ^ Suc 0 + RL c p b 0 l
 2. \<And>t p c b. (\<And>p c b. RL c p b (Suc t) l = snd (steps c p (Suc t)) ! l * b ^ Suc t + RL c p b t l) \<Longrightarrow> RL c p b (Suc (Suc t)) l = snd (steps c p (Suc (Suc t))) ! l * b ^ Suc (Suc t) + RL c p b (Suc t) l
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RL c p b (Suc 0) l = snd (steps c p (Suc 0)) ! l * b ^ Suc 0 + RL c p b 0 l
[PROOF STEP]
by (auto simp: RL.simps)
[PROOF STATE]
proof (state)
this:
RL c p b (Suc 0) l = snd (steps c p (Suc 0)) ! l * b ^ Suc 0 + RL c p b 0 l

goal (1 subgoal):
 1. \<And>t p c b. (\<And>p c b. RL c p b (Suc t) l = snd (steps c p (Suc t)) ! l * b ^ Suc t + RL c p b t l) \<Longrightarrow> RL c p b (Suc (Suc t)) l = snd (steps c p (Suc (Suc t))) ! l * b ^ Suc (Suc t) + RL c p b (Suc t) l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t p c b. (\<And>p c b. RL c p b (Suc t) l = snd (steps c p (Suc t)) ! l * b ^ Suc t + RL c p b t l) \<Longrightarrow> RL c p b (Suc (Suc t)) l = snd (steps c p (Suc (Suc t))) ! l * b ^ Suc (Suc t) + RL c p b (Suc t) l
[PROOF STEP]
case (Suc t p c b)
[PROOF STATE]
proof (state)
this:
RL ?c ?p ?b (Suc t) l = snd (steps ?c ?p (Suc t)) ! l * ?b ^ Suc t + RL ?c ?p ?b t l

goal (1 subgoal):
 1. \<And>t p c b. (\<And>p c b. RL c p b (Suc t) l = snd (steps c p (Suc t)) ! l * b ^ Suc t + RL c p b t l) \<Longrightarrow> RL c p b (Suc (Suc t)) l = snd (steps c p (Suc (Suc t))) ! l * b ^ Suc (Suc t) + RL c p b (Suc t) l
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RL c p b (Suc (Suc t)) l = snd (steps c p (Suc (Suc t))) ! l * b ^ Suc (Suc t) + RL c p b (Suc t) l
[PROOF STEP]
by (subst RL.simps) (*  \<open>unfold one level\<close> *)
      (auto simp: Suc step_commutative algebra_simps RL_simp_aux)
[PROOF STATE]
proof (state)
this:
RL c p b (Suc (Suc t)) l = snd (steps c p (Suc (Suc t))) ! l * b ^ Suc (Suc t) + RL c p b (Suc t) l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma part_witness_card:
  shows "card {f. CK_nf_pos (f::part_witness set \<Rightarrow> part_witness set)} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f. CK_nf_pos f} = 3
[PROOF STEP]
by (rule part_not_discrete_card[OF part_witness_part part_witness_not_discrete])


[STATEMENT]
lemma exp_upper_bound_case_5:
  fixes x::real
  assumes "x \<le> 6.36"
  shows "exp x \<le> 21743271936 / (-(x^3) + 12*x^2 - 96*x + 384)^4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
have "(1/384)*(-(x^3) + 12*x^2 - 96*x + 384) = (1 + (-x/4) + (1/2)*(-x/4)^2 + (1/6)*(-x/4)^3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) = 1 + - x / 4 + 1 / 2 * (- x / 4)\<^sup>2 + 1 / 6 * (- x / 4) ^ 3
[PROOF STEP]
by (simp add: field_simps power2_eq_square power3_eq_cube)
[PROOF STATE]
proof (state)
this:
1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) = 1 + - x / 4 + 1 / 2 * (- x / 4)\<^sup>2 + 1 / 6 * (- x / 4) ^ 3

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) = 1 + - x / 4 + 1 / 2 * (- x / 4)\<^sup>2 + 1 / 6 * (- x / 4) ^ 3

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
have "... \<le> exp (-x/4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + - x / 4 + 1 / 2 * (- x / 4)\<^sup>2 + 1 / 6 * (- x / 4) ^ 3 \<le> exp (- x / 4)
[PROOF STEP]
by (rule exp_lower_taylor_2)
[PROOF STATE]
proof (state)
this:
1 + - x / 4 + 1 / 2 * (- x / 4)\<^sup>2 + 1 / 6 * (- x / 4) ^ 3 \<le> exp (- x / 4)

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) \<le> exp (- x / 4)
[PROOF STEP]
have 1: "(1/384)*(-(x^3) + 12*x^2 - 96*x + 384) \<le> exp (-x/4)"
[PROOF STATE]
proof (prove)
using this:
1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) \<le> exp (- x / 4)

goal (1 subgoal):
 1. 1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) \<le> exp (- x / 4)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) \<le> exp (- x / 4)

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
have "(-(x^3) + 12*x^2 - 96*x + 384)^4 / 21743271936 = ((1/384)*(-(x^3) + 12*x^2 - 96*x + 384))^4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936 = (1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384)) ^ 4
[PROOF STEP]
by (simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
(- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936 = (1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384)) ^ 4

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936 = (1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384)) ^ 4

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
have "... \<le> (exp (-x/4))^4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384)) ^ 4 \<le> exp (- x / 4) ^ 4
[PROOF STEP]
apply (rule power_mono [OF 1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384)
[PROOF STEP]
apply (simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x / 4 + x ^ 3 / 384 \<le> 1 + x\<^sup>2 / 32
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<le> 636 / 10\<^sup>2

goal (1 subgoal):
 1. x / 4 + x ^ 3 / 384 \<le> 1 + x\<^sup>2 / 32
[PROOF STEP]
apply (sos "((R<1 + ((R<1 * ((R<1777/32 * [~539/3554*x + 1]^2) + (R<907/227456 * [x]^2))) + (((A<0 * R<1) * (R<25/1024 * [1]^2)) + ((A<=0 * R<1) * ((R<49/32 * [~2/49*x + 1]^2) + (R<45/1568 * [x]^2)))))))")
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384)) ^ 4 \<le> exp (- x / 4) ^ 4

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 / 384 * (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384)) ^ 4 \<le> exp (- x / 4) ^ 4

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
have "... = inverse (exp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (- x / 4) ^ 4 = inverse (exp x)
[PROOF STEP]
by (simp add: exp_of_nat_mult [symmetric] exp_minus [symmetric])
[PROOF STATE]
proof (state)
this:
exp (- x / 4) ^ 4 = inverse (exp x)

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936 \<le> inverse (exp x)
[PROOF STEP]
have 2: "(-(x^3) + 12*x^2 - 96*x + 384)^4 / 21743271936 \<le> inverse (exp x)"
[PROOF STATE]
proof (prove)
using this:
(- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936 \<le> inverse (exp x)

goal (1 subgoal):
 1. (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936 \<le> inverse (exp x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936 \<le> inverse (exp x)

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
have "12 * x\<^sup>2 - x ^ 3 - 96 * x + 384 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 12 * x\<^sup>2 - x ^ 3 - 96 * x + 384 \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<le> 636 / 10\<^sup>2

goal (1 subgoal):
 1. 12 * x\<^sup>2 - x ^ 3 - 96 * x + 384 \<noteq> 0
[PROOF STEP]
by (sos "((R<1 + (([~25/32] * A=0) + ((R<1 * ((R<1777/32 * [~539/3554*x + 1]^2) + (R<907/227456 * [x]^2))) + ((A<=0 * R<1) * ((R<49/32 * [~2/49*x + 1]^2) + (R<45/1568 * [x]^2)))))))")
[PROOF STATE]
proof (state)
this:
12 * x\<^sup>2 - x ^ 3 - 96 * x + 384 \<noteq> 0

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
12 * x\<^sup>2 - x ^ 3 - 96 * x + 384 \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
12 * x\<^sup>2 - x ^ 3 - 96 * x + 384 \<noteq> 0

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
using Fields.linordered_field_class.le_imp_inverse_le [OF 2]
[PROOF STATE]
proof (prove)
using this:
12 * x\<^sup>2 - x ^ 3 - 96 * x + 384 \<noteq> 0
0 < (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936 \<Longrightarrow> inverse (inverse (exp x)) \<le> inverse ((- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4 / 21743271936)

goal (1 subgoal):
 1. exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp x \<le> 21743271936 / (- (x ^ 3) + 12 * x\<^sup>2 - 96 * x + 384) ^ 4

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma identify_blocks_iff: assumes "k < n"
  shows "set (identify_blocks A k) =
  {(i,j) | i j. i \<le> j \<and> j < k \<and> (\<forall> l. i \<le> l \<longrightarrow> l < j \<longrightarrow> A $$ (l, Suc l) = 1)
  \<and> (Suc j \<noteq> k \<longrightarrow> A $$ (j, Suc j) \<noteq> 1) \<and> (i > 0 \<longrightarrow> A $$ (i - 1, i) \<noteq> 1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (identify_blocks A k) = {(i, j) |i j. i \<le> j \<and> j < k \<and> (\<forall>l\<ge>i. l < j \<longrightarrow> A $$ (l, Suc l) = (1::'b)) \<and> (Suc j \<noteq> k \<longrightarrow> A $$ (j, Suc j) \<noteq> (1::'b)) \<and> (0 < i \<longrightarrow> A $$ (i - 1, i) \<noteq> (1::'b))}
[PROOF STEP]
unfolding identify_blocks_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (identify_blocks_main A k []) = {(i, j) |i j. i \<le> j \<and> j < k \<and> (\<forall>l\<ge>i. l < j \<longrightarrow> A $$ (l, Suc l) = (1::'b)) \<and> (Suc j \<noteq> k \<longrightarrow> A $$ (j, Suc j) \<noteq> (1::'b)) \<and> (0 < i \<longrightarrow> A $$ (i - 1, i) \<noteq> (1::'b))}
[PROOF STEP]
using identify_blocks_main_iff[OF le_refl _ \<open>k < n\<close>]
[PROOF STATE]
proof (prove)
using this:
k \<noteq> k \<longrightarrow> 0 < k \<longrightarrow> ?A $$ (k - 1, k) \<noteq> (1::?'b) \<Longrightarrow> set (identify_blocks_main ?A k ?list) = set ?list \<union> {(i, j) |i j. i \<le> j \<and> j < k \<and> (\<forall>l\<ge>i. l < j \<longrightarrow> ?A $$ (l, Suc l) = (1::?'b)) \<and> (Suc j \<noteq> k \<longrightarrow> ?A $$ (j, Suc j) \<noteq> (1::?'b)) \<and> (0 < i \<longrightarrow> ?A $$ (i - 1, i) \<noteq> (1::?'b))}

goal (1 subgoal):
 1. set (identify_blocks_main A k []) = {(i, j) |i j. i \<le> j \<and> j < k \<and> (\<forall>l\<ge>i. l < j \<longrightarrow> A $$ (l, Suc l) = (1::'b)) \<and> (Suc j \<noteq> k \<longrightarrow> A $$ (j, Suc j) \<noteq> (1::'b)) \<and> (0 < i \<longrightarrow> A $$ (i - 1, i) \<noteq> (1::'b))}
[PROOF STEP]
by auto


[STATEMENT]
lemma convex_box_cart:
  assumes "\<And>i. convex {x. P i x}"
  shows "convex {x. \<forall>i. P i (x$i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. \<forall>i. P i (x $ i)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convex {x. P ?i x}

goal (1 subgoal):
 1. convex {x. \<forall>i. P i (x $ i)}
[PROOF STEP]
unfolding convex_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>Collect (P ?i). \<forall>y\<in>Collect (P ?i). \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> Collect (P ?i)

goal (1 subgoal):
 1. \<forall>x\<in>{x. \<forall>i. P i (x $ i)}. \<forall>y\<in>{x. \<forall>i. P i (x $ i)}. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> {x. \<forall>i. P i (x $ i)}
[PROOF STEP]
by auto


[STATEMENT]
lemma locally_path_connected_space_open_subset:
   "\<lbrakk>locally_path_connected_space X; openin X s\<rbrakk>
        \<Longrightarrow> locally_path_connected_space (subtopology X s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>locally_path_connected_space X; openin X s\<rbrakk> \<Longrightarrow> locally_path_connected_space (subtopology X s)
[PROOF STEP]
apply (simp add: locally_path_connected_space_def neighbourhood_base_of openin_open_subtopology path_connectedin_subtopology)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>W x. openin X W \<and> x \<in> W \<longrightarrow> (\<exists>U. openin X U \<and> (\<exists>V. path_connectedin X V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)); openin X s\<rbrakk> \<Longrightarrow> \<forall>W x. openin X W \<and> W \<subseteq> s \<and> x \<in> W \<longrightarrow> (\<exists>U. openin X U \<and> U \<subseteq> s \<and> (\<exists>V. path_connectedin X V \<and> V \<subseteq> s \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W))
[PROOF STEP]
by (meson order_trans)


[STATEMENT]
lemma space_eq_univ [simp]: "space M = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space M = UNIV
[PROOF STEP]
using events_eq_borel[THEN sets_eq_imp_space_eq]
[PROOF STATE]
proof (prove)
using this:
space M = space borel

goal (1 subgoal):
 1. space M = UNIV
[PROOF STEP]
by simp


[STATEMENT]
lemma bitAND_rec: "m && n = 2 * ((m div 2) && (n div 2)) + (m mod 2) * (n mod 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m && n = 2 * (m div 2 && n div 2) + m mod 2 * (n mod 2)
[PROOF STEP]
by (cases m; simp_all)


[STATEMENT]
lemma connected_space_imp_connected_component_of:
   "\<lbrakk>connected_space X; a \<in> topspace X; b \<in> topspace X\<rbrakk>
    \<Longrightarrow> connected_component_of X a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connected_space X; a \<in> topspace X; b \<in> topspace X\<rbrakk> \<Longrightarrow> connected_component_of X a b
[PROOF STEP]
by (simp add: connected_space_iff_connected_component)


[STATEMENT]
lemma reduction: "0 < reduction" "reduction \<le> 1"
  "\<alpha> > 4/3 \<Longrightarrow> reduction < 1"
  "\<alpha> = 4/3 \<Longrightarrow> reduction = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < reduction &&& reduction \<le> 1) &&& (4 / 3 < \<alpha> \<Longrightarrow> reduction < 1) &&& (\<alpha> = 4 / 3 \<Longrightarrow> reduction = 1)
[PROOF STEP]
using \<alpha>
[PROOF STATE]
proof (prove)
using this:
4 / 3 \<le> \<alpha>

goal (1 subgoal):
 1. (0 < reduction &&& reduction \<le> 1) &&& (4 / 3 < \<alpha> \<Longrightarrow> reduction < 1) &&& (\<alpha> = 4 / 3 \<Longrightarrow> reduction = 1)
[PROOF STEP]
unfolding reduction_def
[PROOF STATE]
proof (prove)
using this:
4 / 3 \<le> \<alpha>

goal (1 subgoal):
 1. (0 < (4 + \<alpha>) / (4 * \<alpha>) &&& (4 + \<alpha>) / (4 * \<alpha>) \<le> 1) &&& (4 / 3 < \<alpha> \<Longrightarrow> (4 + \<alpha>) / (4 * \<alpha>) < 1) &&& (\<alpha> = 4 / 3 \<Longrightarrow> (4 + \<alpha>) / (4 * \<alpha>) = 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma res_units_eq: "Units R = {x. 0 < x \<and> x < m \<and> coprime x m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Units R = {x. 0 < x \<and> x < m \<and> coprime x m}
[PROOF STEP]
using m_gt_one
[PROOF STATE]
proof (prove)
using this:
1 < m

goal (1 subgoal):
 1. Units R = {x. 0 < x \<and> x < m \<and> coprime x m}
[PROOF STEP]
apply (auto simp add: Units_def R_m_def residue_ring_def ac_simps invertible_coprime intro: ccontr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x < m; 0 < x; coprime x m\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..m - 1}. x * xa mod m = 1
[PROOF STEP]
apply (subst (asm) coprime_iff_invertible'_int)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x < m; 0 < x\<rbrakk> \<Longrightarrow> 0 < m
 2. \<And>x. \<lbrakk>x < m; 0 < x; \<exists>xa\<ge>0. xa < m \<and> [x * xa = 1] (mod m)\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..m - 1}. x * xa mod m = 1
[PROOF STEP]
apply (auto simp add: cong_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma inorder_node44: "height n > 0 \<Longrightarrow>
  inorder (tree\<^sub>d (node44 l a m b n c r)) = inorder l @ a # inorder m @ b # inorder n @ c # inorder (tree\<^sub>d r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height n \<Longrightarrow> inorder (tree\<^sub>d (node44 l a m b n c r)) = inorder l @ a # inorder m @ b # inorder n @ c # inorder (tree\<^sub>d r)
[PROOF STEP]
by(induct l a m b n c r rule: node44.induct) auto


[STATEMENT]
lemma map_graph_minus: "map_graph (f -- g) = map_graph f - map_graph g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_graph (f -- g) = map_graph f - map_graph g
[PROOF STEP]
by (auto simp add: map_minus_def map_graph_def, (meson option.distinct(1))+)


[STATEMENT]
lemma aux_bitAND_distrib: "2 * (a && b) = (2 * a) && (2 * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (a && b) = 2 * a && 2 * b
[PROOF STEP]
by (induct a b rule: bitAND_nat.induct; auto)


[STATEMENT]
lemma gkernTr6:"\<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> (\<one>\<^bsub>F\<^esub>) \<in> gker\<^bsub>F,G\<^esub> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<one>\<^bsub>F\<^esub> \<in> gker\<^bsub>F,G\<^esub> f
[PROOF STEP]
apply (simp add:gkernel_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<one>\<^bsub>F\<^esub> \<in> carrier F \<and> f \<one>\<^bsub>F\<^esub> = \<one>\<^bsub>G\<^esub>
[PROOF STEP]
apply (simp add:Group.unit_closed ghom_unit_unit [of "F" "G" "f" ])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nat_mirror_inj_on: "inj_on (\<lambda>x. nat_mirror x l r) {..l + r}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>x. nat_mirror x l r) {..l + r}
[PROOF STEP]
unfolding inj_on_def nat_mirror_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{..l + r}. \<forall>y\<in>{..l + r}. l + r - x = l + r - y \<longrightarrow> x = y
[PROOF STEP]
by fastforce


[STATEMENT]
lemma reversepath_subpath: "reversepath(subpath u v g) = subpath v u g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reversepath (subpath u v g) = subpath v u g
[PROOF STEP]
by (simp add: reversepath_def subpath_def algebra_simps)


[STATEMENT]
lemma length_word_enum: "length (enum :: 'a :: len word list) = 2 ^ LENGTH('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length enum = 2 ^ LENGTH('a)
[PROOF STEP]
by (simp add: enum_word_def)


[STATEMENT]
lemma expands_to_sin_ms_zero_exp:
  assumes e: "e = 0" and basis: "basis_wf (b # basis)"
  assumes F: "(f expands_to MS (MSLCons (C, e) xs) g) (b # basis)"
  assumes Sin: "((\<lambda>x. sin (c x)) expands_to Sin) basis"
  assumes Cos: "((\<lambda>x. cos (c x)) expands_to Cos) basis"
  assumes C: "eval C = c"
  shows   "((\<lambda>x. sin (f x)) expands_to
             MS (plus_ms_aux (scale_shift_ms_aux (Sin, 0) (cos_ms_aux' xs))
                              (scale_shift_ms_aux (Cos, 0) (sin_ms_aux' xs)))
                (\<lambda>x. sin (g x))) (b # basis)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. sin (f x)) expands_to MS (plus_ms_aux (scale_shift_ms_aux (Sin, 0) (cos_ms_aux' xs)) (scale_shift_ms_aux (Cos, 0) (sin_ms_aux' xs))) (\<lambda>x. sin (g x))) (b # basis)
[PROOF STEP]
using is_expansion_sin_ms_zero_exp[of b basis C xs g Sin Cos] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>basis_wf (b # basis); is_expansion (MS (MSLCons (C, 0) xs) g) (b # basis); ((\<lambda>x. sin (eval C x)) expands_to Sin) basis; ((\<lambda>x. cos (eval C x)) expands_to Cos) basis\<rbrakk> \<Longrightarrow> is_expansion (MS (plus_ms_aux (scale_shift_ms_aux (Sin, 0) (cos_ms_aux' xs)) (scale_shift_ms_aux (Cos, 0) (sin_ms_aux' xs))) (\<lambda>x. sin (g x))) (b # basis)
e = 0
basis_wf (b # basis)
(f expands_to MS (MSLCons (C, e) xs) g) (b # basis)
((\<lambda>x. sin (c x)) expands_to Sin) basis
((\<lambda>x. cos (c x)) expands_to Cos) basis
eval C = c

goal (1 subgoal):
 1. ((\<lambda>x. sin (f x)) expands_to MS (plus_ms_aux (scale_shift_ms_aux (Sin, 0) (cos_ms_aux' xs)) (scale_shift_ms_aux (Cos, 0) (sin_ms_aux' xs))) (\<lambda>x. sin (g x))) (b # basis)
[PROOF STEP]
by (auto simp: expands_to.simps elim: eventually_mono)


[STATEMENT]
lemma prod_algebraI_finite:
  "finite I \<Longrightarrow> (\<forall>i\<in>I. E i \<in> sets (M i)) \<Longrightarrow> (Pi\<^sub>E I E) \<in> prod_algebra I M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<forall>i\<in>I. E i \<in> sets (M i)\<rbrakk> \<Longrightarrow> Pi\<^sub>E I E \<in> prod_algebra I M
[PROOF STEP]
using prod_algebraI[of I I E M] prod_emb_PiE_same_index[of I E M, OF sets.sets_into_space]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite I; I \<noteq> {} \<or> I = {}; I \<subseteq> I; \<And>i. i \<in> I \<Longrightarrow> E i \<in> sets (M i)\<rbrakk> \<Longrightarrow> prod_emb I M I (Pi\<^sub>E I E) \<in> prod_algebra I M
(\<And>i. i \<in> I \<Longrightarrow> E i \<in> sets (M i)) \<Longrightarrow> prod_emb I M I (Pi\<^sub>E I E) = Pi\<^sub>E I E

goal (1 subgoal):
 1. \<lbrakk>finite I; \<forall>i\<in>I. E i \<in> sets (M i)\<rbrakk> \<Longrightarrow> Pi\<^sub>E I E \<in> prod_algebra I M
[PROOF STEP]
by simp


[STATEMENT]
lemma card_all_edges_between_commute:
  "card (all_edges_between X Y G) = card (all_edges_between Y X G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges_between X Y G) = card (all_edges_between Y X G)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (all_edges_between X Y G) = card (all_edges_between Y X G)
[PROOF STEP]
have "inj_on (\<lambda>(x, y). (y, x)) A" for A :: "(nat*nat)set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>(x, y). (y, x)) A
[PROOF STEP]
by (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>(x, y). (y, x)) ?A

goal (1 subgoal):
 1. card (all_edges_between X Y G) = card (all_edges_between Y X G)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>(x, y). (y, x)) ?A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>(x, y). (y, x)) ?A

goal (1 subgoal):
 1. card (all_edges_between X Y G) = card (all_edges_between Y X G)
[PROOF STEP]
by (simp add: all_edges_between_swap [of X Y] card_image)
[PROOF STATE]
proof (state)
this:
card (all_edges_between X Y G) = card (all_edges_between Y X G)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_sin [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. sin (f x)) \<longlongrightarrow> sin a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. sin (f x)) \<longlongrightarrow> sin a) F
[PROOF STEP]
by (rule isCont_tendsto_compose [OF isCont_sin])


[STATEMENT]
lemma floor_le_iff: "\<lfloor>x\<rfloor> \<le> z \<longleftrightarrow> x < of_int z + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> \<le> z) = (x < of_int z + (1::'a))
[PROOF STEP]
by (simp add: not_less [symmetric] less_floor_iff)


[STATEMENT]
lemma floor_divide_eq_div_numeral [simp]:
  "\<lfloor>numeral a / numeral b::real\<rfloor> = numeral a div numeral b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>numeral a / numeral b\<rfloor> = numeral a div numeral b
[PROOF STEP]
by (metis floor_divide_of_int_eq of_int_numeral)


[STATEMENT]
lemma isolate_dist_Ex_iff:
  fixes x::"'a::metric_space"
  shows "x isolate S \<longleftrightarrow> (x\<in>S \<and> (\<exists>e>0. \<forall>y\<in>S. dist x y < e \<longrightarrow> y=x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x isolate S = (x \<in> S \<and> (\<exists>e>0. \<forall>y\<in>S. dist x y < e \<longrightarrow> y = x))
[PROOF STEP]
unfolding isolate_islimpt_iff islimpt_approachable
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e) \<and> x \<in> S) = (x \<in> S \<and> (\<exists>e>0. \<forall>y\<in>S. dist x y < e \<longrightarrow> y = x))
[PROOF STEP]
by (metis dist_commute)


[STATEMENT]
lemma frac_eq_0_iff [simp]: "frac x = 0 \<longleftrightarrow> x \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (frac x = (0::'a)) = (x \<in> \<int>)
[PROOF STEP]
by (simp add: frac_def) (metis Ints_cases Ints_of_int floor_of_int )


[STATEMENT]
lemma construct_NofI_R_prop_helper:
  fixes p:: "real poly"
  fixes I1:: "real poly list"
  fixes I2:: "real poly list"
  assumes nonzero: "p\<noteq>0"
  shows "construct_NofI_R p I1 I2 =
    rat_of_int (int (card {x. poly (sum_list (map (\<lambda>x. x^2) (p # I1))) x = 0 \<and> poly (prod_list I2) x > 0}) -
    int (card {x. poly (sum_list (map (\<lambda>x. x^2) (p # I1))) x = 0  \<and> poly (prod_list I2) x < 0}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. construct_NofI_R p I1 I2 = rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. construct_NofI_R p I1 I2 = rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. construct_NofI_R p I1 I2 = rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0}))
[PROOF STEP]
unfolding construct_NofI_R_relation[of p I1 I2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. construct_NofI (sum_list (map power2 (p # I1))) I2 = rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0}))
[PROOF STEP]
apply (subst construct_NofI_prop[of _ I2])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sum_list (map power2 (p # I1)) \<noteq> 0
 2. rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0})) = rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0}))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p\<^sup>2 + sum_list (map power2 I1) = 0 \<Longrightarrow> False
[PROOF STEP]
using assms sum_list_map_power2
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
0 \<le> sum_list (map power2 ?ls)

goal (1 subgoal):
 1. p\<^sup>2 + sum_list (map power2 I1) = 0 \<Longrightarrow> False
[PROOF STEP]
by (metis le_add_same_cancel1 power2_less_eq_zero_iff)
[PROOF STATE]
proof (state)
this:
construct_NofI_R p I1 I2 = rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma choose_one: "n choose 1 = n" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose 1 = n
[PROOF STEP]
by simp


[STATEMENT]
lemma "(- 5) ^ 11 = (-48828125::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 5) ^ 11 = - 48828125
[PROOF STEP]
by simp


[STATEMENT]
lemma int_nat_add:"\<lbrakk>0 < (n::int); 0 < (m::int)\<rbrakk> \<Longrightarrow> (nat (n - 1)) + (nat (m - 1)) + (Suc 0) = nat (n + m - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < m\<rbrakk> \<Longrightarrow> nat (n - 1) + nat (m - 1) + Suc 0 = nat (n + m - 1)
[PROOF STEP]
by arith


[STATEMENT]
lemma "(1 + \<i>) * (1 - \<i>) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + \<i>) * (1 - \<i>) = 2
[PROOF STEP]
by (simp add: ring_distribs)


[STATEMENT]
lemma fin_stut_after_last: assumes H: "fin s" shows "\<forall>j \<ge> last s. s j = s (last s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j\<ge>Sequence.last s. s j = s (Sequence.last s)
[PROOF STEP]
proof (clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. Sequence.last s \<le> j \<Longrightarrow> s j = s (Sequence.last s)
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. Sequence.last s \<le> j \<Longrightarrow> s j = s (Sequence.last s)
[PROOF STEP]
assume j: "j \<ge> last s"
[PROOF STATE]
proof (state)
this:
Sequence.last s \<le> j

goal (1 subgoal):
 1. \<And>j. Sequence.last s \<le> j \<Longrightarrow> s j = s (Sequence.last s)
[PROOF STEP]
from H
[PROOF STATE]
proof (chain)
picking this:
fin s
[PROOF STEP]
obtain i where "\<forall>j \<ge> i. s j = s i" (is "?P i")
[PROOF STATE]
proof (prove)
using this:
fin s

goal (1 subgoal):
 1. (\<And>i. \<forall>j\<ge>i. s j = s i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: fin_def)
[PROOF STATE]
proof (state)
this:
\<forall>j\<ge>i. s j = s i

goal (1 subgoal):
 1. \<And>j. Sequence.last s \<le> j \<Longrightarrow> s j = s (Sequence.last s)
[PROOF STEP]
hence "?P (last s)"
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<ge>i. s j = s i

goal (1 subgoal):
 1. \<forall>j\<ge>Sequence.last s. s j = s (Sequence.last s)
[PROOF STEP]
unfolding last_def
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<ge>i. s j = s i

goal (1 subgoal):
 1. \<forall>j\<ge>LEAST i. \<forall>j\<ge>i. s j = s i. s j = s (LEAST i. \<forall>j\<ge>i. s j = s i)
[PROOF STEP]
by (rule LeastI)
[PROOF STATE]
proof (state)
this:
\<forall>j\<ge>Sequence.last s. s j = s (Sequence.last s)

goal (1 subgoal):
 1. \<And>j. Sequence.last s \<le> j \<Longrightarrow> s j = s (Sequence.last s)
[PROOF STEP]
with j
[PROOF STATE]
proof (chain)
picking this:
Sequence.last s \<le> j
\<forall>j\<ge>Sequence.last s. s j = s (Sequence.last s)
[PROOF STEP]
show "s j = s (last s)"
[PROOF STATE]
proof (prove)
using this:
Sequence.last s \<le> j
\<forall>j\<ge>Sequence.last s. s j = s (Sequence.last s)

goal (1 subgoal):
 1. s j = s (Sequence.last s)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
s j = s (Sequence.last s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ran_sorted_alt: "ran_sorted a l h = ( \<forall>i j. l\<le>i \<and> i<j \<and> j<h \<longrightarrow> a i \<le> a j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ran_sorted a l h = (\<forall>i j. l \<le> i \<and> i < j \<and> j < h \<longrightarrow> a i \<le> a j)
[PROOF STEP]
unfolding ran_sorted_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>{l..<h}. \<forall>j\<in>{l..<h}. i \<le> j \<longrightarrow> a i \<le> a j) = (\<forall>i j. l \<le> i \<and> i < j \<and> j < h \<longrightarrow> a i \<le> a j)
[PROOF STEP]
by auto (metis dual_order.order_iff_strict)


[STATEMENT]
lemma dot2_rearrange_2:
  fixes u x :: "real^2"
  assumes "u \<bullet> x = 0" and "x$2 \<noteq> 0"
  shows "u = -(u$1 / x$2) *\<^sub>R (rotate2 x)" (is "u = ?u'")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u = - (u $ 1 / x $ 2) *\<^sub>R rotate2 x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u = - (u $ 1 / x $ 2) *\<^sub>R rotate2 x
[PROOF STEP]
from assms and dot2_rearrange_1 [of "rotate2 u" "rotate2 x"]
[PROOF STATE]
proof (chain)
picking this:
u \<bullet> x = 0
x $ 2 \<noteq> 0
\<lbrakk>rotate2 u \<bullet> rotate2 x = 0; rotate2 x $ 1 \<noteq> 0\<rbrakk> \<Longrightarrow> rotate2 u = (rotate2 u $ 2 / rotate2 x $ 1) *\<^sub>R rotate2 (rotate2 x)
[PROOF STEP]
have
    "rotate2 u = rotate2 ?u'"
[PROOF STATE]
proof (prove)
using this:
u \<bullet> x = 0
x $ 2 \<noteq> 0
\<lbrakk>rotate2 u \<bullet> rotate2 x = 0; rotate2 x $ 1 \<noteq> 0\<rbrakk> \<Longrightarrow> rotate2 u = (rotate2 u $ 2 / rotate2 x $ 1) *\<^sub>R rotate2 (rotate2 x)

goal (1 subgoal):
 1. rotate2 u = rotate2 (- (u $ 1 / x $ 2) *\<^sub>R rotate2 x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rotate2 u = rotate2 (- (u $ 1 / x $ 2) *\<^sub>R rotate2 x)

goal (1 subgoal):
 1. u = - (u $ 1 / x $ 2) *\<^sub>R rotate2 x
[PROOF STEP]
thus "u = ?u'"
[PROOF STATE]
proof (prove)
using this:
rotate2 u = rotate2 (- (u $ 1 / x $ 2) *\<^sub>R rotate2 x)

goal (1 subgoal):
 1. u = - (u $ 1 / x $ 2) *\<^sub>R rotate2 x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u = - (u $ 1 / x $ 2) *\<^sub>R rotate2 x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma while_option_finite_subset_Some: fixes C :: "'a set"
  assumes "mono f" and "!!X. X \<subseteq> C \<Longrightarrow> f X \<subseteq> C" and "finite C"
  shows "\<exists>P. while_option (\<lambda>A. f A \<noteq> A) f {} = Some P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. while_option (\<lambda>A. f A \<noteq> A) f {} = Some P
[PROOF STEP]
proof(rule measure_while_option_Some[where
    f= "%A::'a set. card C - card A" and P= "%A. A \<subseteq> C \<and> A \<subseteq> f A" and s= "{}"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s. \<lbrakk>s \<subseteq> C \<and> s \<subseteq> f s; f s \<noteq> s\<rbrakk> \<Longrightarrow> (f s \<subseteq> C \<and> f s \<subseteq> f (f s)) \<and> card C - card (f s) < card C - card s
 2. {} \<subseteq> C \<and> {} \<subseteq> f {}
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s. \<lbrakk>s \<subseteq> C \<and> s \<subseteq> f s; f s \<noteq> s\<rbrakk> \<Longrightarrow> (f s \<subseteq> C \<and> f s \<subseteq> f (f s)) \<and> card C - card (f s) < card C - card s
 2. {} \<subseteq> C \<and> {} \<subseteq> f {}
[PROOF STEP]
assume A: "A \<subseteq> C \<and> A \<subseteq> f A" "f A \<noteq> A"
[PROOF STATE]
proof (state)
this:
A \<subseteq> C \<and> A \<subseteq> f A
f A \<noteq> A

goal (2 subgoals):
 1. \<And>s. \<lbrakk>s \<subseteq> C \<and> s \<subseteq> f s; f s \<noteq> s\<rbrakk> \<Longrightarrow> (f s \<subseteq> C \<and> f s \<subseteq> f (f s)) \<and> card C - card (f s) < card C - card s
 2. {} \<subseteq> C \<and> {} \<subseteq> f {}
[PROOF STEP]
show "(f A \<subseteq> C \<and> f A \<subseteq> f (f A)) \<and> card C - card (f A) < card C - card A"
    (is "?L \<and> ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f A \<subseteq> C \<and> f A \<subseteq> f (f A)) \<and> card C - card (f A) < card C - card A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f A \<subseteq> C \<and> f A \<subseteq> f (f A)
 2. card C - card (f A) < card C - card A
[PROOF STEP]
show ?L
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f A \<subseteq> C \<and> f A \<subseteq> f (f A)
[PROOF STEP]
by(metis A(1) assms(2) monoD[OF \<open>mono f\<close>])
[PROOF STATE]
proof (state)
this:
f A \<subseteq> C \<and> f A \<subseteq> f (f A)

goal (1 subgoal):
 1. card C - card (f A) < card C - card A
[PROOF STEP]
show ?R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card C - card (f A) < card C - card A
[PROOF STEP]
by (metis A assms(2,3) card_seteq diff_less_mono2 equalityI linorder_le_less_linear rev_finite_subset)
[PROOF STATE]
proof (state)
this:
card C - card (f A) < card C - card A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f A \<subseteq> C \<and> f A \<subseteq> f (f A)) \<and> card C - card (f A) < card C - card A

goal (1 subgoal):
 1. {} \<subseteq> C \<and> {} \<subseteq> f {}
[PROOF STEP]
qed simp


[STATEMENT]
lemma wf_dia_inv:
  assumes "wf_dia (Graph V \<Lambda> E)"
  shows "\<forall>v \<in> fset V. wf_ass (\<Lambda> v)"
    and "\<forall>e \<in> set E. wf_com (snd3 e)"
    and "acyclicity E"
    and "linearity E"
    and "\<forall>e \<in> set E. fst3 e |\<union>| thd3 e |\<subseteq>| V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>v\<in>fset V. wf_ass (\<Lambda> v) &&& \<forall>e\<in>set E. wf_com (snd3 e)) &&& acyclicity E &&& linearity E &&& \<forall>e\<in>set E. fst3 e |\<union>| thd3 e |\<subseteq>| V
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_dia (Graph V \<Lambda> E)

goal (1 subgoal):
 1. (\<forall>v\<in>fset V. wf_ass (\<Lambda> v) &&& \<forall>e\<in>set E. wf_com (snd3 e)) &&& acyclicity E &&& linearity E &&& \<forall>e\<in>set E. fst3 e |\<union>| thd3 e |\<subseteq>| V
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> \<forall>v\<in>fset V. wf_ass (\<Lambda> v)
 2. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> \<forall>e\<in>set E. wf_com (snd3 e)
 3. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> acyclicity E
 4. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> linearity E
 5. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> \<forall>e\<in>set E. fst3 e |\<union>| thd3 e |\<subseteq>| V
[PROOF STEP]
(* This acts as an intro rule for &&& *)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> \<forall>v\<in>fset V. wf_ass (\<Lambda> v)
 2. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> \<forall>e\<in>set E. wf_com (snd3 e)
 3. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> acyclicity E
 4. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> linearity E
 5. wf_dia (Graph V \<Lambda> E) \<Longrightarrow> \<forall>e\<in>set E. fst3 e |\<union>| thd3 e |\<subseteq>| V
[PROOF STEP]
apply (elim wf_dia_inv', simp)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma T_size_tree_Node:
  "T_size_tree \<langle>l, x, r\<rangle> = T_size_tree l + T_size_tree r + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_size_tree \<langle>l, x, r\<rangle> = T_size_tree l + T_size_tree r + 1
[PROOF STEP]
by(simp add: T_size_tree_def size_tree_def tm_simps split: tm.split)


[STATEMENT]
lemma set_rewrite1:
  "{p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
    = (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}" (is "?S = ?T")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} = (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
assume assms: "p partitions Suc m" "sum p {..Suc m} = Suc k" "0 < p 1"
[PROOF STATE]
proof (state)
this:
p partitions Suc m
sum p {..Suc m} = Suc k
0 < p 1

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
have "p(1 := p 1 - 1) partitions m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p(1 := p 1 - 1) partitions m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p partitions Suc m
sum p {..Suc m} = Suc k
0 < p 1

goal (1 subgoal):
 1. p(1 := p 1 - 1) partitions m
[PROOF STEP]
by (metis partitions_remove1 diff_Suc_1)
[PROOF STATE]
proof (state)
this:
p(1 := p 1 - 1) partitions m

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p(1 := p 1 - 1) partitions m

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
have "(\<Sum>i\<le>m. (p(1 := p 1 - 1)) i) = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (p(1 := p 1 - 1)) {..m} = k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p partitions Suc m
sum p {..Suc m} = Suc k
0 < p 1

goal (1 subgoal):
 1. sum (p(1 := p 1 - 1)) {..m} = k
[PROOF STEP]
by (metis count_remove1 diff_Suc_1)
[PROOF STATE]
proof (state)
this:
sum (p(1 := p 1 - 1)) {..m} = k

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p(1 := p 1 - 1) partitions m
sum (p(1 := p 1 - 1)) {..m} = k
[PROOF STEP]
have "p(1 := p 1 - 1) \<in> {p. p partitions m \<and> sum p {..m} = k}"
[PROOF STATE]
proof (prove)
using this:
p(1 := p 1 - 1) partitions m
sum (p(1 := p 1 - 1)) {..m} = k

goal (1 subgoal):
 1. p(1 := p 1 - 1) \<in> {p. p partitions m \<and> sum p {..m} = k}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p(1 := p 1 - 1) \<in> {p. p partitions m \<and> sum p {..m} = k}

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p(1 := p 1 - 1) \<in> {p. p partitions m \<and> sum p {..m} = k}

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
have "p = p(1 := p 1 - 1, 1 := (p(1 := p 1 - 1)) 1 + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = p(1 := p 1 - 1, 1 := (p(1 := p 1 - 1)) 1 + 1)
[PROOF STEP]
using \<open>0 < p 1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < p 1

goal (1 subgoal):
 1. p = p(1 := p 1 - 1, 1 := (p(1 := p 1 - 1)) 1 + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = p(1 := p 1 - 1, 1 := (p(1 := p 1 - 1)) 1 + 1)

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p(1 := p 1 - 1) \<in> {p. p partitions m \<and> sum p {..m} = k}
p = p(1 := p 1 - 1, 1 := (p(1 := p 1 - 1)) 1 + 1)
[PROOF STEP]
have "p \<in> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}"
[PROOF STATE]
proof (prove)
using this:
p(1 := p 1 - 1) \<in> {p. p partitions m \<and> sum p {..m} = k}
p = p(1 := p 1 - 1, 1 := (p(1 := p 1 - 1)) 1 + 1)

goal (1 subgoal):
 1. p \<in> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p \<in> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?p2 partitions Suc m; sum ?p2 {..Suc m} = Suc k; 0 < ?p2 1\<rbrakk> \<Longrightarrow> ?p2 \<in> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}

goal (2 subgoals):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
 2. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?p2 partitions Suc m; sum ?p2 {..Suc m} = Suc k; 0 < ?p2 1\<rbrakk> \<Longrightarrow> ?p2 \<in> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
[PROOF STEP]
show "?S \<subseteq> ?T"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p2 partitions Suc m; sum ?p2 {..Suc m} = Suc k; 0 < ?p2 1\<rbrakk> \<Longrightarrow> ?p2 \<in> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}

goal (1 subgoal):
 1. {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0} \<subseteq> (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k}

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
assume assms: "p partitions m" "sum p {..m} = k"
[PROOF STATE]
proof (state)
this:
p partitions m
sum p {..m} = k

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
have "(p(1 := p 1 + 1)) partitions Suc m" (is ?g1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p(1 := p 1 + 1) partitions Suc m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p partitions m
sum p {..m} = k

goal (1 subgoal):
 1. p(1 := p 1 + 1) partitions Suc m
[PROOF STEP]
by (metis partitions_insert1 Suc_eq_plus1 zero_less_one)
[PROOF STATE]
proof (state)
this:
p(1 := p 1 + 1) partitions Suc m

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p(1 := p 1 + 1) partitions Suc m

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
have "sum (p(1 := p 1 + 1)) {..Suc m} = Suc k" (is ?g2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (p(1 := p 1 + 1)) {..Suc m} = Suc k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p partitions m
sum p {..m} = k

goal (1 subgoal):
 1. sum (p(1 := p 1 + 1)) {..Suc m} = Suc k
[PROOF STEP]
by (metis count_insert1 Suc_eq_plus1)
[PROOF STATE]
proof (state)
this:
sum (p(1 := p 1 + 1)) {..Suc m} = Suc k

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum (p(1 := p 1 + 1)) {..Suc m} = Suc k

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
have "(p(1 := p 1 + 1)) 1 \<noteq> 0" (is ?g3)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p(1 := p 1 + 1)) 1 \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p(1 := p 1 + 1)) 1 \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p(1 := p 1 + 1) partitions Suc m
sum (p(1 := p 1 + 1)) {..Suc m} = Suc k
(p(1 := p 1 + 1)) 1 \<noteq> 0
[PROOF STEP]
have "?g1 \<and> ?g2 \<and> ?g3"
[PROOF STATE]
proof (prove)
using this:
p(1 := p 1 + 1) partitions Suc m
sum (p(1 := p 1 + 1)) {..Suc m} = Suc k
(p(1 := p 1 + 1)) 1 \<noteq> 0

goal (1 subgoal):
 1. p(1 := p 1 + 1) partitions Suc m \<and> sum (p(1 := p 1 + 1)) {..Suc m} = Suc k \<and> (p(1 := p 1 + 1)) 1 \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p(1 := p 1 + 1) partitions Suc m \<and> sum (p(1 := p 1 + 1)) {..Suc m} = Suc k \<and> (p(1 := p 1 + 1)) 1 \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?p2 partitions m; sum ?p2 {..m} = k\<rbrakk> \<Longrightarrow> ?p2(1 := ?p2 1 + 1) partitions Suc m \<and> sum (?p2(1 := ?p2 1 + 1)) {..Suc m} = Suc k \<and> (?p2(1 := ?p2 1 + 1)) 1 \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?p2 partitions m; sum ?p2 {..m} = k\<rbrakk> \<Longrightarrow> ?p2(1 := ?p2 1 + 1) partitions Suc m \<and> sum (?p2(1 := ?p2 1 + 1)) {..Suc m} = Suc k \<and> (?p2(1 := ?p2 1 + 1)) 1 \<noteq> 0
[PROOF STEP]
show "?T \<subseteq> ?S"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p2 partitions m; sum ?p2 {..m} = k\<rbrakk> \<Longrightarrow> ?p2(1 := ?p2 1 + 1) partitions Suc m \<and> sum (?p2(1 := ?p2 1 + 1)) {..Suc m} = Suc k \<and> (?p2(1 := ?p2 1 + 1)) 1 \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>p. p(1 := p 1 + 1)) ` {p. p partitions m \<and> sum p {..m} = k} \<subseteq> {p. p partitions Suc m \<and> sum p {..Suc m} = Suc k \<and> p 1 \<noteq> 0}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma weak_strict_trans: "a \<preceq>[le] b \<Longrightarrow> b \<prec>[le] c \<Longrightarrow> a \<prec>[le] c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>le a b; b \<prec>[le] c\<rbrakk> \<Longrightarrow> a \<prec>[le] c
[PROOF STEP]
unfolding strongly_preferred_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>le a b; le b c \<and> \<not> le c b\<rbrakk> \<Longrightarrow> le a c \<and> \<not> le c a
[PROOF STEP]
by (blast intro: trans)


[STATEMENT]
lemma upper_triangular_upt_k_def':
  assumes "\<forall>i j. to_nat j \<le> k \<and> A $ i $ j \<noteq> 0 \<longrightarrow> j\<ge>i"
  shows "upper_triangular_upt_k A k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular_upt_k A k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. mod_type_class.to_nat j \<le> k \<and> A $ i $ j \<noteq> (0::'b) \<longrightarrow> i \<le> j

goal (1 subgoal):
 1. upper_triangular_upt_k A k
[PROOF STEP]
unfolding upper_triangular_upt_k_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. mod_type_class.to_nat j \<le> k \<and> A $ i $ j \<noteq> (0::'b) \<longrightarrow> i \<le> j

goal (1 subgoal):
 1. \<forall>i j. j < i \<and> mod_type_class.to_nat j < k \<longrightarrow> A $ i $ j = (0::'b)
[PROOF STEP]
by (metis leD linear)


[STATEMENT]
lemma indic_ident:
  "\<And> (f::'a \<Rightarrow> real) s. (\<lambda>x. (f x) * indicator s x) = (\<lambda>x. if x \<in> s then f x else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f s. (\<lambda>x. f x * indicat_real s x) = (\<lambda>x. if x \<in> s then f x else 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f s x. f x * indicat_real s x = (if x \<in> s then f x else 0)
[PROOF STEP]
fix f::"'a \<Rightarrow> real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f s x. f x * indicat_real s x = (if x \<in> s then f x else 0)
[PROOF STEP]
fix s::"'a set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f s x. f x * indicat_real s x = (if x \<in> s then f x else 0)
[PROOF STEP]
fix x:: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f s x. f x * indicat_real s x = (if x \<in> s then f x else 0)
[PROOF STEP]
show " f x * indicator s x = (if x \<in> s then f x else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x * indicat_real s x = (if x \<in> s then f x else 0)
[PROOF STEP]
by (simp add: indicator_def)
[PROOF STATE]
proof (state)
this:
f x * indicat_real s x = (if x \<in> s then f x else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_eq_sum_append: "\<lbrakk>0 < i; i \<le> j; j \<le> length as\<rbrakk> \<Longrightarrow> sum as i j = sum (as @ as') i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; j \<le> length as\<rbrakk> \<Longrightarrow> SWA.sum as i j = SWA.sum (as @ as') i j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; j \<le> length as\<rbrakk> \<Longrightarrow> SWA.sum as i j = SWA.sum (as @ as') i j
[PROOF STEP]
assume assms: "0 < i" "i \<le> j" "j \<le> length as"
[PROOF STATE]
proof (state)
this:
0 < i
i \<le> j
j \<le> length as

goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; j \<le> length as\<rbrakk> \<Longrightarrow> SWA.sum as i j = SWA.sum (as @ as') i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < i
i \<le> j
j \<le> length as
[PROOF STEP]
have *: "rev (map ((!) as) [i - Suc 0..<j - Suc 0]) = rev (map ((!) (as@as')) [i - Suc 0..<j - Suc 0])"
[PROOF STATE]
proof (prove)
using this:
0 < i
i \<le> j
j \<le> length as

goal (1 subgoal):
 1. rev (map ((!) as) [i - Suc 0..<j - Suc 0]) = rev (map ((!) (as @ as')) [i - Suc 0..<j - Suc 0])
[PROOF STEP]
by (auto simp: nth_append)
[PROOF STATE]
proof (state)
this:
rev (map ((!) as) [i - Suc 0..<j - Suc 0]) = rev (map ((!) (as @ as')) [i - Suc 0..<j - Suc 0])

goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; j \<le> length as\<rbrakk> \<Longrightarrow> SWA.sum as i j = SWA.sum (as @ as') i j
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < i
i \<le> j
j \<le> length as
[PROOF STEP]
have "as ! (j - Suc 0) = (as @ as') ! (j - Suc 0)"
[PROOF STATE]
proof (prove)
using this:
0 < i
i \<le> j
j \<le> length as

goal (1 subgoal):
 1. as ! (j - Suc 0) = (as @ as') ! (j - Suc 0)
[PROOF STEP]
by (auto simp: nth_append)
[PROOF STATE]
proof (state)
this:
as ! (j - Suc 0) = (as @ as') ! (j - Suc 0)

goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; j \<le> length as\<rbrakk> \<Longrightarrow> SWA.sum as i j = SWA.sum (as @ as') i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
as ! (j - Suc 0) = (as @ as') ! (j - Suc 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
as ! (j - Suc 0) = (as @ as') ! (j - Suc 0)

goal (1 subgoal):
 1. SWA.sum as i j = SWA.sum (as @ as') i j
[PROOF STEP]
by (simp add: *)
[PROOF STATE]
proof (state)
this:
SWA.sum as i j = SWA.sum (as @ as') i j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dist_fun_lt_imp_dist_val_lt:
  fixes f g :: "'a \<Rightarrow>\<^sub>b 'b"
  assumes "dist f g < e"
  shows "dist (f x) (g x) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (apply_bfun f x) (apply_bfun g x) < e
[PROOF STEP]
using dist_bounded assms
[PROOF STATE]
proof (prove)
using this:
dist (apply_bfun ?f ?x) (apply_bfun ?g ?x) \<le> dist ?f ?g
dist f g < e

goal (1 subgoal):
 1. dist (apply_bfun f x) (apply_bfun g x) < e
[PROOF STEP]
by (rule le_less_trans)


[STATEMENT]
lemma nat_asc_chain_imp_unbounded: "
  \<lbrakk> S \<noteq> {}; (\<forall>m\<in>S. \<exists>n\<in>S. m < (n::nat)) \<rbrakk> \<Longrightarrow> \<forall>m. \<exists>n\<in>S. m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<noteq> {}; \<forall>m\<in>S. \<exists>n\<in>S. m < n\<rbrakk> \<Longrightarrow> \<forall>m. \<exists>n\<in>S. m \<le> n
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>S \<noteq> {}; \<forall>m\<in>S. \<exists>n\<in>S. m < n\<rbrakk> \<Longrightarrow> \<exists>n\<in>S. m \<le> n
[PROOF STEP]
apply (induct_tac m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. \<lbrakk>S \<noteq> {}; \<forall>m\<in>S. \<exists>n\<in>S. m < n\<rbrakk> \<Longrightarrow> \<exists>n\<in>S. 0 \<le> n
 2. \<And>m n. \<lbrakk>S \<noteq> {}; \<forall>m\<in>S. \<exists>n\<in>S. m < n; \<exists>na\<in>S. n \<le> na\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. \<lbrakk>S \<noteq> {}; \<forall>m\<in>S. \<exists>n\<in>S. m < n; \<exists>na\<in>S. n \<le> na\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
[PROOF STEP]
apply (erule bexE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n na. \<lbrakk>S \<noteq> {}; \<forall>m\<in>S. \<exists>n\<in>S. m < n; na \<in> S; n \<le> na\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
[PROOF STEP]
apply (rename_tac n1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n n1. \<lbrakk>S \<noteq> {}; \<forall>m\<in>S. \<exists>n\<in>S. m < n; n1 \<in> S; n \<le> n1\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
[PROOF STEP]
apply (erule_tac x=n1 in ballE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m n n1. \<lbrakk>S \<noteq> {}; n1 \<in> S; n \<le> n1; \<exists>n\<in>S. n1 < n\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
 2. \<And>m n n1. \<lbrakk>S \<noteq> {}; n1 \<in> S; n \<le> n1; n1 \<notin> S\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m n n1. \<lbrakk>S \<noteq> {}; n1 \<in> S; n \<le> n1; n1 \<notin> S\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
 2. \<And>m n n1. \<lbrakk>S \<noteq> {}; n1 \<in> S; n \<le> n1; \<exists>n\<in>S. n1 < n\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n n1. \<lbrakk>S \<noteq> {}; n1 \<in> S; n \<le> n1; \<exists>n\<in>S. n1 < n\<rbrakk> \<Longrightarrow> \<exists>na\<in>S. Suc n \<le> na
[PROOF STEP]
apply (clarify, rename_tac x, rule_tac x=x in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m n n1 x. \<lbrakk>S \<noteq> {}; n1 \<in> S; n \<le> n1; x \<in> S; n1 < x\<rbrakk> \<Longrightarrow> Suc n \<le> x
 2. \<And>m n n1 x. \<lbrakk>S \<noteq> {}; n1 \<in> S; n \<le> n1; x \<in> S; n1 < x\<rbrakk> \<Longrightarrow> x \<in> S
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma plus_of_nat_eq_0_imp: "z + of_nat n = 0 \<Longrightarrow> z \<in> \<int>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z + of_nat n = (0::'a) \<Longrightarrow> z \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z + of_nat n = (0::'a) \<Longrightarrow> z \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
assume "z + of_nat n = 0"
[PROOF STATE]
proof (state)
this:
z + of_nat n = (0::'a)

goal (1 subgoal):
 1. z + of_nat n = (0::'a) \<Longrightarrow> z \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
hence A: "z = - of_nat n"
[PROOF STATE]
proof (prove)
using this:
z + of_nat n = (0::'a)

goal (1 subgoal):
 1. z = - of_nat n
[PROOF STEP]
by (simp add: eq_neg_iff_add_eq_0)
[PROOF STATE]
proof (state)
this:
z = - of_nat n

goal (1 subgoal):
 1. z + of_nat n = (0::'a) \<Longrightarrow> z \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
show "z \<in> \<int>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
by (subst A) simp
[PROOF STATE]
proof (state)
this:
z \<in> \<int>\<^sub>\<le>\<^sub>0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_increasing_imp_geq_id[simp]:
  assumes  "is_increasing f"
  shows "f n \<ge>n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> f n
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> f 0
 2. \<And>n. n \<le> f n \<Longrightarrow> Suc n \<le> f (Suc n)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. n \<le> f n \<Longrightarrow> Suc n \<le> f (Suc n)
[PROOF STEP]
by (metis (mono_tags, lifting) assms is_increasing_def
      leD lessI not_less_eq_eq order_less_le_subst2)


[STATEMENT]
lemma ce_rel_lm_37: "ce_set_to_rel (A \<inter> B) = (ce_set_to_rel A) \<inter> (ce_set_to_rel B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ce_set_to_rel (A \<inter> B) = ce_set_to_rel A \<inter> ce_set_to_rel B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ce_set_to_rel (A \<inter> B) = ce_set_to_rel A \<inter> ce_set_to_rel B
[PROOF STEP]
define f where "f x = (c_fst x, c_snd x)" for x
[PROOF STATE]
proof (state)
this:
f ?x = (c_fst ?x, c_snd ?x)

goal (1 subgoal):
 1. ce_set_to_rel (A \<inter> B) = ce_set_to_rel A \<inter> ce_set_to_rel B
[PROOF STEP]
have f_inj: "inj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj f
[PROOF STEP]
proof (unfold f_def, rule inj_on_inverseI [where ?g="\<lambda> (u,v). c_pair u v"])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> (case (c_fst x, c_snd x) of (u, v) \<Rightarrow> c_pair u v) = x
[PROOF STEP]
fix x :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> (case (c_fst x, c_snd x) of (u, v) \<Rightarrow> c_pair u v) = x
[PROOF STEP]
assume "x \<in> UNIV"
[PROOF STATE]
proof (state)
this:
x \<in> UNIV

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> (case (c_fst x, c_snd x) of (u, v) \<Rightarrow> c_pair u v) = x
[PROOF STEP]
show "case_prod c_pair (c_fst x, c_snd x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case (c_fst x, c_snd x) of (x, xa) \<Rightarrow> c_pair x xa) = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(case (c_fst x, c_snd x) of (x, xa) \<Rightarrow> c_pair x xa) = x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. ce_set_to_rel (A \<inter> B) = ce_set_to_rel A \<inter> ce_set_to_rel B
[PROOF STEP]
from f_inj
[PROOF STATE]
proof (chain)
picking this:
inj f
[PROOF STEP]
have "f ` (A \<inter> B) = f ` A \<inter> f ` B"
[PROOF STATE]
proof (prove)
using this:
inj f

goal (1 subgoal):
 1. f ` (A \<inter> B) = f ` A \<inter> f ` B
[PROOF STEP]
by (rule image_Int)
[PROOF STATE]
proof (state)
this:
f ` (A \<inter> B) = f ` A \<inter> f ` B

goal (1 subgoal):
 1. ce_set_to_rel (A \<inter> B) = ce_set_to_rel A \<inter> ce_set_to_rel B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ` (A \<inter> B) = f ` A \<inter> f ` B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` (A \<inter> B) = f ` A \<inter> f ` B

goal (1 subgoal):
 1. ce_set_to_rel (A \<inter> B) = ce_set_to_rel A \<inter> ce_set_to_rel B
[PROOF STEP]
by (unfold f_def, unfold ce_set_to_rel_def, auto)
[PROOF STATE]
proof (state)
this:
ce_set_to_rel (A \<inter> B) = ce_set_to_rel A \<inter> ce_set_to_rel B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_prime_eqI:
  assumes "prime p" "card {q. prime q \<and> q < p} = n"
  shows   "nth_prime n = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_prime n = p
[PROOF STEP]
unfolding nth_prime_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE p. prime p \<and> card {q. prime q \<and> q < p} = n) = p
[PROOF STEP]
by (rule the1_equality[OF nth_prime_exists1]) (use assms in auto)


[STATEMENT]
lemma divides_degree:
  fixes p q :: "'a ::{comm_semiring_1,semiring_no_zero_divisors} poly"
  assumes "p dvd q"
  shows "degree p \<le> degree q \<or> q = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p \<le> degree q \<or> q = 0
[PROOF STEP]
by (metis dvd_imp_degree_le assms)


[STATEMENT]
lemma integrable_mono_on:
  fixes f :: "real \<Rightarrow> real"
  assumes "mono_on {a..b} f"
  shows "integrable (lebesgue_on {a..b}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
define f' where "f' \<equiv> \<lambda>x. if x \<in> {a..b} then f x - f a else 0"
[PROOF STATE]
proof (state)
this:
f' \<equiv> \<lambda>x. if x \<in> {a..b} then f x - f a else 0

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have "mono_on {a..b} f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono_on {a..b} f'
[PROOF STEP]
by (smt (verit, best) assms f'_def mono_on_def)
[PROOF STATE]
proof (state)
this:
mono_on {a..b} f'

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mono_on {a..b} f'

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have 0: "\<And>x. 0 \<le> f' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 \<le> f' x
[PROOF STEP]
by (smt (verit, best) assms atLeastAtMost_iff f'_def mono_on_def)
[PROOF STATE]
proof (state)
this:
0 \<le> f' ?x

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mono_on {a..b} f'
0 \<le> f' ?x
[PROOF STEP]
have "integrable (lebesgue_on {a..b}) f'"
[PROOF STATE]
proof (prove)
using this:
mono_on {a..b} f'
0 \<le> f' ?x

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f'
[PROOF STEP]
using integrable_mono_on_nonneg
[PROOF STATE]
proof (prove)
using this:
mono_on {a..b} f'
0 \<le> f' ?x
\<lbrakk>mono_on {?a..?b} ?f; \<And>x. 0 \<le> ?f x\<rbrakk> \<Longrightarrow> integrable (lebesgue_on {?a..?b}) ?f

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f'
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {a..b}) f'

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable (lebesgue_on {a..b}) f'
[PROOF STEP]
have "integrable (lebesgue_on {a..b}) (\<lambda>x. f' x + f a)"
[PROOF STATE]
proof (prove)
using this:
integrable (lebesgue_on {a..b}) f'

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) (\<lambda>x. f' x + f a)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {a..b}) (\<lambda>x. f' x + f a)

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {a..b}) (\<lambda>x. f' x + f a)

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have "space lborel = space lebesgue" "sets borel \<subseteq> sets lebesgue"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space lborel = space lebesgue &&& sets borel \<subseteq> sets lebesgue
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue
[PROOF STEP]
have fborel: "f \<in> borel_measurable (lebesgue_on {a..b})"
[PROOF STATE]
proof (prove)
using this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
using borel_measurable_mono_on_fnc [OF assms]
[PROOF STATE]
proof (prove)
using this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue
f \<in> borel_measurable (restrict_space borel {a..b})

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
by (metis borel_measurable_subalgebra mono_restrict_space space_lborel space_restrict_space)
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
integrable (lebesgue_on {a..b}) (\<lambda>x. f' x + f a)
f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable (lebesgue_on {a..b}) (\<lambda>x. f' x + f a)
f \<in> borel_measurable (lebesgue_on {a..b})

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
by (rule integrable_cong_AE_imp) (auto simp: f'_def)
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {a..b}) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lcm_unique_nat:
  "a dvd d \<and> b dvd d \<and> (\<forall>e. a dvd e \<and> b dvd e \<longrightarrow> d dvd e) \<longleftrightarrow> d = lcm a b"
  for a b d :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a dvd d \<and> b dvd d \<and> (\<forall>e. a dvd e \<and> b dvd e \<longrightarrow> d dvd e)) = (d = lcm a b)
[PROOF STEP]
by (auto intro: dvd_antisym lcm_least)


[STATEMENT]
lemma lcounts_init: "lcount 0 = 1" "lcount 1 = 1" "lcount 2 = 1" "lcount 3 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lcount 0 = 1 &&& lcount 1 = 1) &&& lcount 2 = 1 &&& lcount 3 = 2
[PROOF STEP]
using lc0 lc1aux lc2aux lc3_aux
[PROOF STATE]
proof (prove)
using this:
lcount 0 = 1
{l. length l = 1 \<and> valid l} = {[B]}
{l. length l = 2 \<and> valid l} = {[B, B]}
{l. length l = 3 \<and> valid l} = {[B, B, B], [R, R, R]}

goal (1 subgoal):
 1. (lcount 0 = 1 &&& lcount 1 = 1) &&& lcount 2 = 1 &&& lcount 3 = 2
[PROOF STEP]
unfolding lcount_def
[PROOF STATE]
proof (prove)
using this:
card {l. length l = 0 \<and> valid l} = 1
{l. length l = 1 \<and> valid l} = {[B]}
{l. length l = 2 \<and> valid l} = {[B, B]}
{l. length l = 3 \<and> valid l} = {[B, B, B], [R, R, R]}

goal (1 subgoal):
 1. (card {l. length l = 0 \<and> valid l} = 1 &&& card {l. length l = 1 \<and> valid l} = 1) &&& card {l. length l = 2 \<and> valid l} = 1 &&& card {l. length l = 3 \<and> valid l} = 2
[PROOF STEP]
by simp_all


[STATEMENT]
lemma locally_path_connected_space_euclideanreal: "locally_path_connected_space euclideanreal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally_path_connected_space euclideanreal
[PROOF STEP]
unfolding locally_path_connected_space_def neighbourhood_base_of
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>W x. openin euclideanreal W \<and> x \<in> W \<longrightarrow> (\<exists>U V. openin euclideanreal U \<and> path_connectedin euclideanreal V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)
[PROOF STEP]
proof clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>W x. \<lbrakk>open W; x \<in> W\<rbrakk> \<Longrightarrow> \<exists>U. open U \<and> (\<exists>V. path_connected V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)
[PROOF STEP]
fix W and x :: "real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>W x. \<lbrakk>open W; x \<in> W\<rbrakk> \<Longrightarrow> \<exists>U. open U \<and> (\<exists>V. path_connected V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)
[PROOF STEP]
assume "open W" "x \<in> W"
[PROOF STATE]
proof (state)
this:
open W
x \<in> W

goal (1 subgoal):
 1. \<And>W x. \<lbrakk>open W; x \<in> W\<rbrakk> \<Longrightarrow> \<exists>U. open U \<and> (\<exists>V. path_connected V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open W
x \<in> W
[PROOF STEP]
obtain e where "e > 0" and e: "\<And>x'. \<bar>x' - x\<bar> < e \<longrightarrow> x' \<in> W"
[PROOF STATE]
proof (prove)
using this:
open W
x \<in> W

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; \<And>x'. \<bar>x' - x\<bar> < e \<longrightarrow> x' \<in> W\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: open_real)
[PROOF STATE]
proof (state)
this:
0 < e
\<bar>?x' - x\<bar> < e \<longrightarrow> ?x' \<in> W

goal (1 subgoal):
 1. \<And>W x. \<lbrakk>open W; x \<in> W\<rbrakk> \<Longrightarrow> \<exists>U. open U \<and> (\<exists>V. path_connected V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
\<bar>?x' - x\<bar> < e \<longrightarrow> ?x' \<in> W
[PROOF STEP]
show "\<exists>U. open U \<and> (\<exists>V. path_connected V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)"
[PROOF STATE]
proof (prove)
using this:
0 < e
\<bar>?x' - x\<bar> < e \<longrightarrow> ?x' \<in> W

goal (1 subgoal):
 1. \<exists>U. open U \<and> (\<exists>V. path_connected V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)
[PROOF STEP]
by (force intro!: convex_imp_path_connected exI [where x = "{x-e<..<x+e}"])
[PROOF STATE]
proof (state)
this:
\<exists>U. open U \<and> (\<exists>V. path_connected V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_diff: "sin (x - y) = sin x * cos y - cos x * sin y"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (x - y) = sin x * cos y - cos x * sin y
[PROOF STEP]
using sin_add [of x "- y"]
[PROOF STATE]
proof (prove)
using this:
sin (x + - y) = sin x * cos (- y) + cos x * sin (- y)

goal (1 subgoal):
 1. sin (x - y) = sin x * cos y - cos x * sin y
[PROOF STEP]
by simp


[STATEMENT]
lemma Int_Union_pairwise_disjoint:
  assumes "pairwise disjnt (\<A> \<union> \<B>)"
  shows "\<Union>\<A> \<inter> \<Union>\<B> = \<Union>(\<A> \<inter> \<B>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> \<A> \<inter> \<Union> \<B> = \<Union> (\<A> \<inter> \<B>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> \<A> \<inter> \<Union> \<B> = \<Union> (\<A> \<inter> \<B>)
[PROOF STEP]
have "False"
    if x: "x \<in> A" "x \<in> B" and AB: "A \<in> \<A>" "A \<notin> \<B>" "B \<in> \<B>" for x A B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
using assms disjointD AB
[PROOF STATE]
proof (prove)
using this:
disjoint (\<A> \<union> \<B>)
\<lbrakk>disjoint ?A; ?a \<in> ?A; ?b \<in> ?A; ?a \<noteq> ?b\<rbrakk> \<Longrightarrow> ?a \<inter> ?b = {}
A \<in> \<A>
A \<notin> \<B>
B \<in> \<B>

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<inter> B = {}

goal (1 subgoal):
 1. False
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
x \<in> B
A \<inter> B = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> A
x \<in> B
A \<inter> B = {}

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> ?A; ?x \<in> ?B; ?A \<in> \<A>; ?A \<notin> \<B>; ?B \<in> \<B>\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. \<Union> \<A> \<inter> \<Union> \<B> = \<Union> (\<A> \<inter> \<B>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> ?A; ?x \<in> ?B; ?A \<in> \<A>; ?A \<notin> \<B>; ?B \<in> \<B>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> ?A; ?x \<in> ?B; ?A \<in> \<A>; ?A \<notin> \<B>; ?B \<in> \<B>\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. \<Union> \<A> \<inter> \<Union> \<B> = \<Union> (\<A> \<inter> \<B>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> \<A> \<inter> \<Union> \<B> = \<Union> (\<A> \<inter> \<B>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_open_interval_UNIV:
  fixes a b:: real
  assumes "a < b"
  shows "{a<..<b} homeomorphic (UNIV::real set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a<..<b} homeomorphic UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {a<..<b} homeomorphic UNIV
[PROOF STEP]
have "{a<..<b} = ball ((b+a) / 2) ((b-a) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a<..<b} = ball ((b + a) / 2) ((b - a) / 2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. {a<..<b} = ball ((b + a) / 2) ((b - a) / 2)
[PROOF STEP]
by (auto simp: dist_real_def abs_if field_split_simps split: if_split_asm)
[PROOF STATE]
proof (state)
this:
{a<..<b} = ball ((b + a) / 2) ((b - a) / 2)

goal (1 subgoal):
 1. {a<..<b} homeomorphic UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{a<..<b} = ball ((b + a) / 2) ((b - a) / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{a<..<b} = ball ((b + a) / 2) ((b - a) / 2)

goal (1 subgoal):
 1. {a<..<b} homeomorphic UNIV
[PROOF STEP]
by (simp add: homeomorphic_ball_UNIV assms)
[PROOF STATE]
proof (state)
this:
{a<..<b} homeomorphic UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma octonion_conjugate_property:
  "cnj x = -(1/6) *\<^sub>R (x + (e1 * x) *  e1  +  (e2 * x) * e2 +  (e3 * x) * e3 +
     (e4 * x) * e4 + (e5 * x) * e5 +  ( e6 * x) * e6 + (e7 * x) * e7)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Octonions.cnj x = - (1 / 6) *\<^sub>R (x + e1 * x * e1 + e2 * x * e2 + e3 * x * e3 + e4 * x * e4 + e5 * x * e5 + e6 * x * e6 + e7 * x * e7)
[PROOF STEP]
by (simp add: octo_eq_iff octo_mult_components)


[STATEMENT]
lemma finite_cspan_closed_csubspace:
  assumes "finite (S::'a::complex_normed_vector set)"
  shows "closed_csubspace (cspan S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace (cspan S)
[PROOF STEP]
by (simp add: assms closed_csubspace.intro)


[STATEMENT]
lemma pure_forall_M_I: "(\<And>x. x \<in> set xs \<Longrightarrow> pure (P x) h) \<Longrightarrow> pure (forall_M P xs) h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> pure (P x) h) \<Longrightarrow> pure (forall_M P xs) h
[PROOF STEP]
apply(induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> pure (P x) h) \<Longrightarrow> pure (forall_M P []) h
 2. \<And>a xs. \<lbrakk>(\<And>x. x \<in> set xs \<Longrightarrow> pure (P x) h) \<Longrightarrow> pure (forall_M P xs) h; \<And>x. x \<in> set (a # xs) \<Longrightarrow> pure (P x) h\<rbrakk> \<Longrightarrow> pure (forall_M P (a # xs)) h
[PROOF STEP]
by(auto intro!: bind_pure_I)


[STATEMENT]
lemma InfCard_cdouble_eq:
  assumes "InfCard \<kappa>" shows "\<kappa> \<oplus> \<kappa> = \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> \<oplus> \<kappa> = \<kappa>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<kappa> \<oplus> \<kappa> = \<kappa>
[PROOF STEP]
have "\<kappa> \<oplus> \<kappa> = \<kappa> \<otimes> ord_of_nat 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> \<oplus> \<kappa> = \<kappa> \<otimes> ord_of_nat 2
[PROOF STEP]
using InfCard_def assms cmult_2 cmult_commute
[PROOF STATE]
proof (prove)
using this:
InfCard ?\<kappa> \<equiv> Card ?\<kappa> \<and> \<omega> \<le> ?\<kappa>
InfCard \<kappa>
Card ?n \<Longrightarrow> ord_of_nat 2 \<otimes> ?n = ?n \<oplus> ?n
?i \<otimes> ?j = ?j \<otimes> ?i

goal (1 subgoal):
 1. \<kappa> \<oplus> \<kappa> = \<kappa> \<otimes> ord_of_nat 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<kappa> \<oplus> \<kappa> = \<kappa> \<otimes> ord_of_nat 2

goal (1 subgoal):
 1. \<kappa> \<oplus> \<kappa> = \<kappa>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<kappa> \<oplus> \<kappa> = \<kappa> \<otimes> ord_of_nat 2

goal (1 subgoal):
 1. \<kappa> \<oplus> \<kappa> = \<kappa>
[PROOF STEP]
have "\<dots> = \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> \<otimes> ord_of_nat 2 = \<kappa>
[PROOF STEP]
by (simp add: InfCard_le_cmult_eq InfCard_ge_ord_of_nat assms)
[PROOF STATE]
proof (state)
this:
\<kappa> \<otimes> ord_of_nat 2 = \<kappa>

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nfa_accepting_set_of_bv: "nfa_accepting A q = (set_of_bv (snd A) \<inter> set_of_bv q \<noteq> {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfa_accepting A q = (set_of_bv (snd A) \<inter> set_of_bv q \<noteq> {})
[PROOF STEP]
by (simp add: nfa_accepting'_set_of_bv nfa_accepting_def)


[STATEMENT]
lemma ccspan_leq_ortho_ccspan:
  assumes "\<And>s t. s\<in>S \<Longrightarrow> t\<in>T \<Longrightarrow> is_orthogonal s t"
  shows "ccspan S \<le> - (ccspan T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan S \<le> - ccspan T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?s \<in> S; ?t \<in> T\<rbrakk> \<Longrightarrow> is_orthogonal ?s ?t

goal (1 subgoal):
 1. ccspan S \<le> - ccspan T
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S T. (\<And>s t. \<lbrakk>s \<in> S; t \<in> T\<rbrakk> \<Longrightarrow> is_orthogonal s t) \<Longrightarrow> closure (cspan S) \<subseteq> orthogonal_complement (closure (cspan T))
[PROOF STEP]
by (smt (verit, ccfv_threshold) is_orthogonal_closure is_orthogonal_cspan is_orthogonal_sym orthogonal_complementI subsetI)


[STATEMENT]
lemma nth_splice: "\<lbrakk> n < size xs + size ys;  size ys \<le> size xs;  size xs \<le> size ys + 1 \<rbrakk>
  \<Longrightarrow> splice xs ys ! n = (if even n then xs else ys) ! (n div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length xs + length ys; length ys \<le> length xs; length xs \<le> length ys + 1\<rbrakk> \<Longrightarrow> splice xs ys ! n = (if even n then xs else ys) ! (n div 2)
[PROOF STEP]
apply(induction xs ys arbitrary: n rule: splice.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys n. \<lbrakk>n < length [] + length ys; length ys \<le> length []; length [] \<le> length ys + 1\<rbrakk> \<Longrightarrow> splice [] ys ! n = (if even n then [] else ys) ! (n div 2)
 2. \<And>x xs ys n. \<lbrakk>\<And>n. \<lbrakk>n < length ys + length xs; length xs \<le> length ys; length ys \<le> length xs + 1\<rbrakk> \<Longrightarrow> splice ys xs ! n = (if even n then ys else xs) ! (n div 2); n < length (x # xs) + length ys; length ys \<le> length (x # xs); length (x # xs) \<le> length ys + 1\<rbrakk> \<Longrightarrow> splice (x # xs) ys ! n = (if even n then x # xs else ys) ! (n div 2)
[PROOF STEP]
apply (auto simp: nth_Cons' minus1_div2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma expands_to_cos_MSLNil:
  "(f expands_to MS (MSLNil:: ('a :: multiseries \<times> real) msllist) g) basis \<Longrightarrow> basis_wf basis \<Longrightarrow>
     ((\<lambda>x. cos (f x)) expands_to (const_expansion 1 :: 'a ms)) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f expands_to MS MSLNil g) basis; basis_wf basis\<rbrakk> \<Longrightarrow> ((\<lambda>x. cos (f x)) expands_to const_expansion 1) basis
[PROOF STEP]
by (auto simp: expands_to.simps dominant_term_ms_aux_def const_expansion_ms_def
           intro!: const_ms_aux elim: is_expansion_aux.cases eventually_elim2)