[STATEMENT]
lemma one_time_pad:
  assumes inj_on: "inj_on f {..<q}"
    and sur: "f ` {..<q} = {..<q}"
  shows "map_spmf f (sample_uniform q) = (sample_uniform q)"
(is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
have rhs: "?rhs = spmf_of_set ({..< q})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sample_uniform q = spmf_of_set {..<q}
[PROOF STEP]
by(auto simp add: sample_uniform_def)
[PROOF STATE]
proof (state)
this:
sample_uniform q = spmf_of_set {..<q}

goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sample_uniform q = spmf_of_set {..<q}

goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
have "map_spmf(\<lambda>s. f s) (spmf_of_set {..<q}) = spmf_of_set ((\<lambda>s. f s) ` {..<q})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf f (spmf_of_set {..<q}) = spmf_of_set (f ` {..<q})
[PROOF STEP]
by(simp add: inj_on)
[PROOF STATE]
proof (state)
this:
map_spmf f (spmf_of_set {..<q}) = spmf_of_set (f ` {..<q})

goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_spmf f (spmf_of_set {..<q}) = spmf_of_set (f ` {..<q})

goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
have "f ` {..<q} = {..<q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {..<q} = {..<q}
[PROOF STEP]
apply(rule endo_inj_surj)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {..<q}
 2. f ` {..<q} \<subseteq> {..<q}
 3. inj_on f {..<q}
[PROOF STEP]
by(simp, simp add: sur, simp add: inj_on)
[PROOF STATE]
proof (state)
this:
f ` {..<q} = {..<q}

goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
map_spmf f (sample_uniform q) = spmf_of_set (f ` {..<q})
f ` {..<q} = {..<q}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
map_spmf f (sample_uniform q) = spmf_of_set (f ` {..<q})
f ` {..<q} = {..<q}

goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
using rhs
[PROOF STATE]
proof (prove)
using this:
map_spmf f (sample_uniform q) = spmf_of_set (f ` {..<q})
f ` {..<q} = {..<q}
sample_uniform q = spmf_of_set {..<q}

goal (1 subgoal):
 1. map_spmf f (sample_uniform q) = sample_uniform q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map_spmf f (sample_uniform q) = sample_uniform q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem hoare_step:
  "(\<forall> i j . \<Turnstile> (P i) {| D(i,j) |} (Q j) ) = (\<Turnstile> P {| step D |} Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i j. \<Turnstile> P i{| D (i, j) |}Q j) = \<Turnstile> P{| step D |}Q
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i j. \<Turnstile> P i{| D (i, j) |}Q j \<Longrightarrow> \<Turnstile> P{| step D |}Q
 2. \<And>i j. \<Turnstile> P{| step D |}Q \<Longrightarrow> \<Turnstile> P i{| D (i, j) |}Q j
[PROOF STEP]
apply (simp add: le_fun_def Hoare_def step_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i j. P i \<sqsubseteq> D (i, j) (Q j) \<Longrightarrow> \<forall>x. P x \<sqsubseteq> (INF j. D (x, j) (Q j))
 2. \<And>i j. \<Turnstile> P{| step D |}Q \<Longrightarrow> \<Turnstile> P i{| D (i, j) |}Q j
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<forall>i j. P i \<sqsubseteq> D (i, j) (Q j) \<Longrightarrow> P x \<sqsubseteq> (INF j. D (x, j) (Q j))
 2. \<And>i j. \<Turnstile> P{| step D |}Q \<Longrightarrow> \<Turnstile> P i{| D (i, j) |}Q j
[PROOF STEP]
apply (rule INF_greatest)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x j. \<lbrakk>\<forall>i j. P i \<sqsubseteq> D (i, j) (Q j); j \<in> UNIV\<rbrakk> \<Longrightarrow> P x \<sqsubseteq> D (x, j) (Q j)
 2. \<And>i j. \<Turnstile> P{| step D |}Q \<Longrightarrow> \<Turnstile> P i{| D (i, j) |}Q j
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<Turnstile> P{| step D |}Q \<Longrightarrow> \<Turnstile> P i{| D (i, j) |}Q j
[PROOF STEP]
apply (simp add: le_fun_def Hoare_def step_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<forall>x. P x \<sqsubseteq> (INF j. D (x, j) (Q j)) \<Longrightarrow> P i \<sqsubseteq> D (i, j) (Q j)
[PROOF STEP]
apply (erule_tac x = i in allE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. P i \<sqsubseteq> (INF j. D (i, j) (Q j)) \<Longrightarrow> P i \<sqsubseteq> D (i, j) (Q j)
[PROOF STEP]
apply (rule_tac y = "INF j. D(i, j) (Q j)" in order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i j. P i \<sqsubseteq> (INF j. D (i, j) (Q j)) \<Longrightarrow> P i \<sqsubseteq> (INF j. D (i, j) (Q j))
 2. \<And>i j. P i \<sqsubseteq> (INF j. D (i, j) (Q j)) \<Longrightarrow> (INF j. D (i, j) (Q j)) \<sqsubseteq> D (i, j) (Q j)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. P i \<sqsubseteq> (INF j. D (i, j) (Q j)) \<Longrightarrow> (INF j. D (i, j) (Q j)) \<sqsubseteq> D (i, j) (Q j)
[PROOF STEP]
apply (rule INF_lower)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. P i \<sqsubseteq> (INF j. D (i, j) (Q j)) \<Longrightarrow> j \<in> UNIV
[PROOF STEP]
by auto


[STATEMENT]
lemma d_delta_arctan_upper_13:
    "((\<lambda>x. arctan_upper_13 x - arctan x) has_field_derivative diff_delta_arctan_upper_13 x) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. arctan_upper_13 x - arctan x) has_real_derivative diff_delta_arctan_upper_13 x) (at x)
[PROOF STEP]
unfolding arctan_upper_13_def diff_delta_arctan_upper_13_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x - arctan x) has_real_derivative x\<^sup>2 / (1 + x\<^sup>2)) (at x)
[PROOF STEP]
apply (intro derivative_eq_intros, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - inverse (1 + x\<^sup>2) * 1 = x\<^sup>2 / (1 + x\<^sup>2)
[PROOF STEP]
apply (simp add: divide_simps add_nonneg_eq_0_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma [simp]:
  assumes "\<sigma> \<in> simplices"
  shows "ceros_of_boolean_input (bool_vec_from_simplice \<sigma>) = \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input (bool_vec_from_simplice \<sigma>) = \<sigma>
[PROOF STEP]
unfolding bool_vec_from_simplice_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input (vec n (\<lambda>i. i \<notin> \<sigma>)) = \<sigma>
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x < dim_vec (vec n (\<lambda>i. i \<notin> \<sigma>)) \<and> vec n (\<lambda>i. i \<notin> \<sigma>) $ x = False} = \<sigma>
[PROOF STEP]
unfolding dim_vec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x < n \<and> vec n (\<lambda>i. i \<notin> \<sigma>) $ x = False} = \<sigma>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<in> simplices

goal (1 subgoal):
 1. {x. x < n \<and> vec n (\<lambda>i. i \<notin> \<sigma>) $ x = False} = \<sigma>
[PROOF STEP]
unfolding simplices_def
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<in> Pow {0..<n}

goal (1 subgoal):
 1. {x. x < n \<and> vec n (\<lambda>i. i \<notin> \<sigma>) $ x = False} = \<sigma>
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_to_iarray_interchange_columns[code_unfold]:
  fixes A::"'a::{semiring_1}^'columns::{mod_type}^'rows::{mod_type}"
  shows "matrix_to_iarray (interchange_columns A i j) = interchange_columns_iarray (matrix_to_iarray A) (to_nat i) (to_nat j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (interchange_columns A i j) = interchange_columns_iarray (matrix_to_iarray A) (mod_type_class.to_nat i) (mod_type_class.to_nat j)
[PROOF STEP]
unfolding interchange_columns_def interchange_columns_iarray_def o_def tabulate2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (\<chi>ia ja. if ja = i then A $ ia $ j else if ja = j then A $ ia $ i else A $ ia $ ja) = IArray.of_fun (\<lambda>ia. IArray.of_fun (\<lambda>ja. if ja = mod_type_class.to_nat i then matrix_to_iarray A !! ia !! mod_type_class.to_nat j else if ja = mod_type_class.to_nat j then matrix_to_iarray A !! ia !! mod_type_class.to_nat i else matrix_to_iarray A !! ia !! ja) (ncols_iarray (matrix_to_iarray A))) (nrows_iarray (matrix_to_iarray A))
[PROOF STEP]
unfolding nrows_eq_card_rows ncols_eq_card_columns
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (\<chi>ia ja. if ja = i then A $ ia $ j else if ja = j then A $ ia $ i else A $ ia $ ja) = IArray.of_fun (\<lambda>ia. IArray.of_fun (\<lambda>ja. if ja = mod_type_class.to_nat i then matrix_to_iarray A !! ia !! mod_type_class.to_nat j else if ja = mod_type_class.to_nat j then matrix_to_iarray A !! ia !! mod_type_class.to_nat i else matrix_to_iarray A !! ia !! ja) CARD('columns)) CARD('rows)
[PROOF STEP]
unfolding  matrix_to_iarray_def o_def vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray (map (\<lambda>x. IArray.of_fun (\<lambda>ia. (\<chi>ia ja. if ja = i then A $ ia $ j else if ja = j then A $ ia $ i else A $ ia $ ja) $ mod_type_class.from_nat x $ mod_type_class.from_nat ia) CARD('columns)) [0..<CARD('rows)]) = IArray.of_fun (\<lambda>ia. IArray.of_fun (\<lambda>ja. if ja = mod_type_class.to_nat i then IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('columns)) [0..<CARD('rows)]) !! ia !! mod_type_class.to_nat j else if ja = mod_type_class.to_nat j then IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('columns)) [0..<CARD('rows)]) !! ia !! mod_type_class.to_nat i else IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('columns)) [0..<CARD('rows)]) !! ia !! ja) CARD('columns)) CARD('rows)
[PROOF STEP]
by (auto simp add: to_nat_from_nat_id to_nat_less_card[of i] to_nat_less_card[of j])


[STATEMENT]
lemma sums_mult2: "f sums a \<Longrightarrow> (\<lambda>n. f n * c) sums (a * c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f sums a \<Longrightarrow> (\<lambda>n. f n * c) sums (a * c)
[PROOF STEP]
by (rule bounded_linear.sums [OF bounded_linear_mult_left])


[STATEMENT]
lemma pcompose_sum: "pcompose (sum f A) p = sum (\<lambda>i. pcompose (f i) p) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A \<circ>\<^sub>p p = (\<Sum>i\<in>A. f i \<circ>\<^sub>p p)
[PROOF STEP]
by (induct A rule: infinite_finite_induct) (simp_all add: pcompose_1 pcompose_add)


[STATEMENT]
lemma list_decode_inverse [simp]: "list_encode (list_decode n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_encode (list_decode n) = n
[PROOF STEP]
proof (induct n rule: list_decode.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. list_encode (list_decode 0) = 0
 2. \<And>n. (\<And>x y. (x, y) = prod_decode n \<Longrightarrow> list_encode (list_decode y) = y) \<Longrightarrow> list_encode (list_decode (Suc n)) = Suc n
[PROOF STEP]
case (2 n)
[PROOF STATE]
proof (state)
this:
(?x, ?y) = prod_decode n \<Longrightarrow> list_encode (list_decode ?y) = ?y

goal (2 subgoals):
 1. list_encode (list_decode 0) = 0
 2. \<And>n. (\<And>x y. (x, y) = prod_decode n \<Longrightarrow> list_encode (list_decode y) = y) \<Longrightarrow> list_encode (list_decode (Suc n)) = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?x, ?y) = prod_decode n \<Longrightarrow> list_encode (list_decode ?y) = ?y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(?x, ?y) = prod_decode n \<Longrightarrow> list_encode (list_decode ?y) = ?y

goal (1 subgoal):
 1. list_encode (list_decode (Suc n)) = Suc n
[PROOF STEP]
by (metis list_encode.simps(2) list_encode_inverse prod_decode_inverse surj_pair)
[PROOF STATE]
proof (state)
this:
list_encode (list_decode (Suc n)) = Suc n

goal (1 subgoal):
 1. list_encode (list_decode 0) = 0
[PROOF STEP]
qed auto


[STATEMENT]
lemma i1_ne_infinity [simp]: "1 \<noteq> (\<infinity>::enat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<noteq> \<infinity>
[PROOF STEP]
by (simp add: one_enat_def)


[STATEMENT]
lemma Map_comp [simp]:
    assumes "arr f" and "arr g" and "Dom g = Cod f"
    shows "Map (COMP g f) = Comp (Cod g) (Dom g) (Dom f) (Map g) (Map f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Map (COMP g f) = Comp (Cod g) (Dom g) (Dom f) (Map g) (Map f)
[PROOF STEP]
unfolding COMP_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Map (if (f \<noteq> Null \<and> Dom f \<in> Obj \<and> Cod f \<in> Obj \<and> Map f \<in> Hom (Dom f) (Cod f)) \<and> (g \<noteq> Null \<and> Dom g \<in> Obj \<and> Cod g \<in> Obj \<and> Map g \<in> Hom (Dom g) (Cod g)) \<and> Dom g = Cod f then MkArr (Dom f) (Cod g) (Comp (Cod g) (Dom g) (Dom f) (Map g) (Map f)) else Null) = Comp (Cod g) (Dom g) (Dom f) (Map g) (Map f)
[PROOF STEP]
using assms arr_char
[PROOF STATE]
proof (prove)
using this:
arr f
arr g
Dom g = Cod f
arr ?f = (?f \<noteq> Null \<and> Dom ?f \<in> Obj \<and> Cod ?f \<in> Obj \<and> Map ?f \<in> Hom (Dom ?f) (Cod ?f))

goal (1 subgoal):
 1. Map (if (f \<noteq> Null \<and> Dom f \<in> Obj \<and> Cod f \<in> Obj \<and> Map f \<in> Hom (Dom f) (Cod f)) \<and> (g \<noteq> Null \<and> Dom g \<in> Obj \<and> Cod g \<in> Obj \<and> Map g \<in> Hom (Dom g) (Cod g)) \<and> Dom g = Cod f then MkArr (Dom f) (Cod g) (Comp (Cod g) (Dom g) (Dom f) (Map g) (Map f)) else Null) = Comp (Cod g) (Dom g) (Dom f) (Map g) (Map f)
[PROOF STEP]
by simp


[STATEMENT]
lemma finite_divisors [simp]:
   assumes "n>0" shows "finite (divisors n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (divisors n)
[PROOF STEP]
by (simp add: assms divisors_def)


[STATEMENT]
lemma LIM_offset_zero: "f \<midarrow>a\<rightarrow> L \<Longrightarrow> (\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow> L"
  for a :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> L \<Longrightarrow> (\<lambda>h. f (a + h)) \<midarrow>0::'a\<rightarrow> L
[PROOF STEP]
by (drule LIM_offset [where k = a]) (simp add: add.commute)


[STATEMENT]
lemma nfa_startnode_is_node: "wf_nfa A n \<Longrightarrow> nfa_is_node A (nfa_startnode A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_nfa A n \<Longrightarrow> nfa_is_node A (nfa_startnode A)
[PROOF STEP]
by (simp add: nfa_is_node_def wf_nfa_def nfa_startnode_def)


[STATEMENT]
lemma interchange_rows_code_nth [code abstract]: "vec_nth (interchange_rows A a b) = interchange_rows_row A a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (interchange_rows A a b) = interchange_rows_row A a b
[PROOF STEP]
unfolding interchange_rows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i j. if i = a then A $ b $ j else if i = b then A $ a $ j else A $ i $ j) = interchange_rows_row A a b
[PROOF STEP]
unfolding interchange_rows_row_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i j. if i = a then A $ b $ j else if i = b then A $ a $ j else A $ i $ j) = (\<lambda>i. \<chi>j. if i = a then A $ b $ j else if i = b then A $ a $ j else A $ i $ j)
[PROOF STEP]
by auto


[STATEMENT]
lemma map_poly_Re_power: assumes p: "set (coeffs p) \<subseteq> \<real>"
 shows "map_poly Re (p^n) = (map_poly Re p)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly Re (p ^ n) = map_poly Re p ^ n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
 2. \<And>n. map_poly Re (p ^ n) = map_poly Re p ^ n \<Longrightarrow> map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
map_poly Re (p ^ n) = map_poly Re p ^ n

goal (2 subgoals):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
 2. \<And>n. map_poly Re (p ^ n) = map_poly Re p ^ n \<Longrightarrow> map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
let ?r = "map_poly Re"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
 2. \<And>n. map_poly Re (p ^ n) = map_poly Re p ^ n \<Longrightarrow> map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
have "?r (p^Suc n) = ?r (p * p^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly Re (p ^ Suc n) = map_poly Re (p * p ^ n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map_poly Re (p ^ Suc n) = map_poly Re (p * p ^ n)

goal (2 subgoals):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
 2. \<And>n. map_poly Re (p ^ n) = map_poly Re p ^ n \<Longrightarrow> map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_poly Re (p ^ Suc n) = map_poly Re (p * p ^ n)

goal (2 subgoals):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
 2. \<And>n. map_poly Re (p ^ n) = map_poly Re p ^ n \<Longrightarrow> map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
have "\<dots> = ?r p * ?r (p^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly Re (p * p ^ n) = map_poly Re p * map_poly Re (p ^ n)
[PROOF STEP]
by (rule map_poly_Re_mult[OF p real_poly_power[OF p]])
[PROOF STATE]
proof (state)
this:
map_poly Re (p * p ^ n) = map_poly Re p * map_poly Re (p ^ n)

goal (2 subgoals):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
 2. \<And>n. map_poly Re (p ^ n) = map_poly Re p ^ n \<Longrightarrow> map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_poly Re (p * p ^ n) = map_poly Re p * map_poly Re (p ^ n)

goal (2 subgoals):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
 2. \<And>n. map_poly Re (p ^ n) = map_poly Re p ^ n \<Longrightarrow> map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
have "?r (p^n) = (?r p)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly Re (p ^ n) = map_poly Re p ^ n
[PROOF STEP]
by (rule Suc)
[PROOF STATE]
proof (state)
this:
map_poly Re (p ^ n) = map_poly Re p ^ n

goal (2 subgoals):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
 2. \<And>n. map_poly Re (p ^ n) = map_poly Re p ^ n \<Longrightarrow> map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map_poly Re (p ^ Suc n) = map_poly Re p * map_poly Re p ^ n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
map_poly Re (p ^ Suc n) = map_poly Re p * map_poly Re p ^ n

goal (1 subgoal):
 1. map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map_poly Re (p ^ Suc n) = map_poly Re p ^ Suc n

goal (1 subgoal):
 1. map_poly Re (p ^ 0) = map_poly Re p ^ 0
[PROOF STEP]
qed simp


[STATEMENT]
lemma kernel_of_equiv: "equiv {..<length xs} (kernel_of xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equiv {..<length xs} (kernel_of xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. equiv {..<length xs} (kernel_of xs)
[PROOF STEP]
have "kernel_of xs \<subseteq> {..<length xs} \<times> {..<length xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel_of xs \<subseteq> {..<length xs} \<times> {..<length xs}
[PROOF STEP]
by (rule subsetI, simp add:kernel_of_def mem_Times_iff case_prod_beta)
[PROOF STATE]
proof (state)
this:
kernel_of xs \<subseteq> {..<length xs} \<times> {..<length xs}

goal (1 subgoal):
 1. equiv {..<length xs} (kernel_of xs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
kernel_of xs \<subseteq> {..<length xs} \<times> {..<length xs}

goal (1 subgoal):
 1. equiv {..<length xs} (kernel_of xs)
[PROOF STEP]
by (simp add:equiv_def refl_on_def sym_def trans_def kernel_of_def)
[PROOF STATE]
proof (state)
this:
equiv {..<length xs} (kernel_of xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nFAND_Cons: "nFAND (x # xs) = (if xs = [] then x else FAnd x (nFAND xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nFAND (x # xs) = (if xs = [] then x else FAnd x (nFAND xs))
[PROOF STEP]
by (cases xs) simp_all


[STATEMENT]
lemma \<phi>_pos [simp]: "\<phi> > 0" and \<phi>_nonneg [simp]: "\<phi> \<ge> 0" and \<phi>_nonzero [simp]: "\<phi> \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<phi> &&& 0 \<le> \<phi> &&& \<phi> \<noteq> 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < \<phi>
 2. 0 \<le> \<phi>
 3. \<phi> \<noteq> 0
[PROOF STEP]
show "\<phi> > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<phi>
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (1 + sqrt 5) / 2
[PROOF STEP]
by (simp add: add_pos_nonneg)
[PROOF STATE]
proof (state)
this:
0 < \<phi>

goal (2 subgoals):
 1. 0 \<le> \<phi>
 2. \<phi> \<noteq> 0
[PROOF STEP]
thus "\<phi> \<ge> 0" "\<phi> \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < \<phi>

goal (1 subgoal):
 1. 0 \<le> \<phi> &&& \<phi> \<noteq> 0
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 \<le> \<phi>
\<phi> \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_lists_length_le1: "finite {xs. length xs \<le> i \<and> set xs \<subseteq> {0..(n::nat)}}" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. length xs \<le> i \<and> set xs \<subseteq> {0..n}}
[PROOF STEP]
by (auto intro: finite_subset[OF _ finite_lists_length_le[OF finite_atLeastAtMost]])


[STATEMENT]
lemma ant_1 [simp]: "ant 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ant 1 = 1
[PROOF STEP]
by (simp add: One_ant_def)


[STATEMENT]
lemma count_lift_profile:
  assumes "\<forall>Y\<in>#A. y \<notin> Y"
  shows   "count (lift_profile A) X = (if x \<in> X \<longleftrightarrow> y \<in> X then count A (X - {y}) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (lift_profile A) X = (if (x \<in> X) = (y \<in> X) then count A (X - {y}) else 0)
[PROOF STEP]
using assms xy
[PROOF STATE]
proof (prove)
using this:
\<forall>Y\<in>#A. y \<notin> Y
x \<in> parties
y \<in> parties
x \<noteq> y

goal (1 subgoal):
 1. count (lift_profile A) X = (if (x \<in> X) = (y \<in> X) then count A (X - {y}) else 0)
[PROOF STEP]
by (induction A) (auto simp: lift_applist_def)


[STATEMENT]
lemma degree_eq_length_coeffs [code]: "degree p = length (coeffs p) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p = length (coeffs p) - 1
[PROOF STEP]
by (simp add: coeffs_def)


[STATEMENT]
lemma poly_subst_power: "poly_subst f (p ^ n) = (poly_subst f p) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_subst f (p ^ n) = poly_subst f p ^ n
[PROOF STEP]
by (induct n, simp_all add: poly_subst_times)


[STATEMENT]
lemma interchange_columns_code_nth [code abstract]: "vec_nth (interchange_columns A a b) = interchange_columns_row A a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (interchange_columns A a b) = interchange_columns_row A a b
[PROOF STEP]
unfolding interchange_columns_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i j. if j = a then A $ i $ b else if j = b then A $ i $ a else A $ i $ j) = interchange_columns_row A a b
[PROOF STEP]
unfolding interchange_columns_row_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i j. if j = a then A $ i $ b else if j = b then A $ i $ a else A $ i $ j) = (\<lambda>i. \<chi>j. if j = a then A $ i $ b else if j = b then A $ i $ a else A $ i $ j)
[PROOF STEP]
by auto


[STATEMENT]
lemma row_length_Null:
 "row_length [[]] =0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length null_matrix = 0
[PROOF STEP]
using row_length_def
[PROOF STATE]
proof (prove)
using this:
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. row_length null_matrix = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma targets_char:
    assumes "weak_unit a"
    shows "targets a = {x. x \<cong> a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. targets a = {x. x \<cong> a}
[PROOF STEP]
using assms targets_iso_closed weak_unit_iff_self_target targets_are_isomorphic
            isomorphic_symmetric
[PROOF STATE]
proof (prove)
using this:
weak_unit a
\<lbrakk>?a \<in> targets ?\<mu>; ?a \<cong> ?a'\<rbrakk> \<Longrightarrow> ?a' \<in> targets ?\<mu>
weak_unit ?b = (?b \<in> targets ?b)
\<lbrakk>?b \<in> targets ?\<mu>; ?b' \<in> targets ?\<mu>\<rbrakk> \<Longrightarrow> ?b \<cong> ?b'
?f \<cong> ?g \<Longrightarrow> ?g \<cong> ?f

goal (1 subgoal):
 1. targets a = {x. x \<cong> a}
[PROOF STEP]
by blast


[STATEMENT]
lemma filterlim_powr_at_top:
  "(b::real) > 1 \<Longrightarrow> filterlim (\<lambda>x. b powr x) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < b \<Longrightarrow> filterlim ((powr) b) at_top at_top
[PROOF STEP]
unfolding powr_def mult.commute[of _ "ln b"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < b \<Longrightarrow> LIM x at_top. if b = 0 then 0 else exp (ln b * x) :> at_top
[PROOF STEP]
by (auto intro!: filterlim_compose[OF exp_at_top]
        filterlim_tendsto_pos_mult_at_top filterlim_ident)


[STATEMENT]
lemma Length0_inj[Presb_simps]: "Length \<AA> = 0 \<Longrightarrow> Length \<BB> = 0 \<Longrightarrow> #\<^sub>V \<AA> = #\<^sub>V \<BB> \<Longrightarrow> \<AA> = \<BB>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Length \<AA> = 0; Length \<BB> = 0; #\<^sub>V \<AA> = #\<^sub>V \<BB>\<rbrakk> \<Longrightarrow> \<AA> = \<BB>
[PROOF STEP]
by transfer (auto intro: nth_equalityI simp: all_set_conv_all_nth len_eq0_iff)


[STATEMENT]
lemma Liminf_eq:
  assumes "eventually (\<lambda>x. f x = g x) F"
  shows "Liminf F f = Liminf F g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Liminf F f = Liminf F g
[PROOF STEP]
by (intro antisym Liminf_mono eventually_mono[OF assms]) auto


[STATEMENT]
lemma subset_UnderS_AboveS: "B \<le> Field r \<Longrightarrow> B \<le> UnderS r (AboveS r B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> Field r \<Longrightarrow> B \<subseteq> UnderS r (AboveS r B)
[PROOF STEP]
by(auto simp add: UnderS_def AboveS_def)


[STATEMENT]
lemma separation_openin_Un_gen:
     "separatedin X S T \<longleftrightarrow>
        S \<subseteq> topspace X \<and> T \<subseteq> topspace X \<and> disjnt S T \<and>
        openin (subtopology X (S \<union> T)) S \<and>
        openin (subtopology X (S \<union> T)) T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. separatedin X S T = (S \<subseteq> topspace X \<and> T \<subseteq> topspace X \<and> disjnt S T \<and> openin (subtopology X (S \<union> T)) S \<and> openin (subtopology X (S \<union> T)) T)
[PROOF STEP]
unfolding openin_closedin_eq topspace_subtopology separation_closedin_Un_gen disjnt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<subseteq> topspace X \<and> T \<subseteq> topspace X \<and> S \<inter> T = {} \<and> closedin (subtopology X (S \<union> T)) S \<and> closedin (subtopology X (S \<union> T)) T) = (S \<subseteq> topspace X \<and> T \<subseteq> topspace X \<and> S \<inter> T = {} \<and> (S \<subseteq> topspace X \<inter> (S \<union> T) \<and> closedin (subtopology X (S \<union> T)) (topspace X \<inter> (S \<union> T) - S)) \<and> T \<subseteq> topspace X \<inter> (S \<union> T) \<and> closedin (subtopology X (S \<union> T)) (topspace X \<inter> (S \<union> T) - T))
[PROOF STEP]
by (auto simp: Diff_triv Int_commute Un_Diff inf_absorb1 topspace_def)


[STATEMENT]
lemma swapidseq_endswap: "swapidseq n p \<Longrightarrow> a \<noteq> b \<Longrightarrow> swapidseq (Suc n) (p \<circ> transpose a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>swapidseq n p; a \<noteq> b\<rbrakk> \<Longrightarrow> swapidseq (Suc n) (p \<circ> Transposition.transpose a b)
[PROOF STEP]
by (induct n p rule: swapidseq.induct)
    (use swapidseq_swap[of a b] in \<open>auto simp add: comp_assoc intro: swapidseq.comp_Suc\<close>)


[STATEMENT]
lemma add_inf_distrib_right: "inf a b + c = inf (a + c) (b + c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf a b + c = inf (a + c) (b + c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inf a b + c = inf (a + c) (b + c)
[PROOF STEP]
have "c + inf a b = inf (c + a) (c + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c + inf a b = inf (c + a) (c + b)
[PROOF STEP]
by (simp add: add_inf_distrib_left)
[PROOF STATE]
proof (state)
this:
c + inf a b = inf (c + a) (c + b)

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

goal (1 subgoal):
 1. inf a b + c = inf (a + c) (b + c)
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
inf a b + c = inf (a + c) (b + c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_all_zip_map1: "list_all_zip P (List.map f as) bs \<longleftrightarrow> list_all_zip (\<lambda>a b. P (f a) b) as bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all_zip P (map f as) bs = list_all_zip (\<lambda>a. P (f a)) as bs
[PROOF STEP]
apply (induct as arbitrary: bs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>bs. list_all_zip P (map f []) bs = list_all_zip (\<lambda>a. P (f a)) [] bs
 2. \<And>a as bs. (\<And>bs. list_all_zip P (map f as) bs = list_all_zip (\<lambda>a. P (f a)) as bs) \<Longrightarrow> list_all_zip P (map f (a # as)) bs = list_all_zip (\<lambda>a. P (f a)) (a # as) bs
[PROOF STEP]
apply (case_tac bs)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>bs. bs = [] \<Longrightarrow> list_all_zip P (map f []) bs = list_all_zip (\<lambda>a. P (f a)) [] bs
 2. \<And>bs a list. bs = a # list \<Longrightarrow> list_all_zip P (map f []) bs = list_all_zip (\<lambda>a. P (f a)) [] bs
 3. \<And>a as bs. (\<And>bs. list_all_zip P (map f as) bs = list_all_zip (\<lambda>a. P (f a)) as bs) \<Longrightarrow> list_all_zip P (map f (a # as)) bs = list_all_zip (\<lambda>a. P (f a)) (a # as) bs
[PROOF STEP]
apply auto [2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a as bs. (\<And>bs. list_all_zip P (map f as) bs = list_all_zip (\<lambda>a. P (f a)) as bs) \<Longrightarrow> list_all_zip P (map f (a # as)) bs = list_all_zip (\<lambda>a. P (f a)) (a # as) bs
[PROOF STEP]
apply (case_tac bs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a as bs. \<lbrakk>\<And>bs. list_all_zip P (map f as) bs = list_all_zip (\<lambda>a. P (f a)) as bs; bs = []\<rbrakk> \<Longrightarrow> list_all_zip P (map f (a # as)) bs = list_all_zip (\<lambda>a. P (f a)) (a # as) bs
 2. \<And>a as bs aa list. \<lbrakk>\<And>bs. list_all_zip P (map f as) bs = list_all_zip (\<lambda>a. P (f a)) as bs; bs = aa # list\<rbrakk> \<Longrightarrow> list_all_zip P (map f (a # as)) bs = list_all_zip (\<lambda>a. P (f a)) (a # as) bs
[PROOF STEP]
apply auto [2]
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_field_derivative_at_within_union:
  assumes "(f has_field_derivative D) (at x within A)"
          "(f has_field_derivative D) (at x within B)"
  shows   "(f has_field_derivative D) (at x within (A \<union> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative D) (at x within A \<union> B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_field_derivative D) (at x within A \<union> B)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
(f has_field_derivative D) (at x within A)
(f has_field_derivative D) (at x within B)
[PROOF STEP]
have "((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (sup (at x within A) (at x within B))"
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative D) (at x within A)
(f has_field_derivative D) (at x within B)

goal (1 subgoal):
 1. ((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (sup (at x within A) (at x within B))
[PROOF STEP]
unfolding has_field_derivative_iff
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (at x within A)
((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (at x within B)

goal (1 subgoal):
 1. ((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (sup (at x within A) (at x within B))
[PROOF STEP]
by (rule filterlim_sup)
[PROOF STATE]
proof (state)
this:
((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (sup (at x within A) (at x within B))

goal (1 subgoal):
 1. (f has_field_derivative D) (at x within A \<union> B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (sup (at x within A) (at x within B))

goal (1 subgoal):
 1. (f has_field_derivative D) (at x within A \<union> B)
[PROOF STEP]
have "sup (at x within A) (at x within B) = at x within (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup (at x within A) (at x within B) = at x within A \<union> B
[PROOF STEP]
using at_within_union
[PROOF STATE]
proof (prove)
using this:
at ?x within ?S \<union> ?T = sup (at ?x within ?S) (at ?x within ?T)

goal (1 subgoal):
 1. sup (at x within A) (at x within B) = at x within A \<union> B
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
sup (at x within A) (at x within B) = at x within A \<union> B

goal (1 subgoal):
 1. (f has_field_derivative D) (at x within A \<union> B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (at x within A \<union> B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (at x within A \<union> B)

goal (1 subgoal):
 1. (f has_field_derivative D) (at x within A \<union> B)
[PROOF STEP]
unfolding has_field_derivative_iff
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (at x within A \<union> B)

goal (1 subgoal):
 1. ((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> D) (at x within A \<union> B)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f has_field_derivative D) (at x within A \<union> B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma kparts_set: "\<exists>l'. kparts (set l) = set l' \<and> cnb l' = cnb l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l'. kparts (set l) = set l' \<and> cnb l' = cnb l
[PROOF STEP]
apply (induct l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>l'. kparts (set []) = set l' \<and> cnb l' = cnb []
 2. \<And>a l. \<exists>l'. kparts (set l) = set l' \<and> cnb l' = cnb l \<Longrightarrow> \<exists>l'. kparts (set (a # l)) = set l' \<and> cnb l' = cnb (a # l)
[PROOF STEP]
apply (rule_tac x="[]" in exI, simp, clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l l'. \<lbrakk>kparts (set l) = set l'; cnb l' = cnb l\<rbrakk> \<Longrightarrow> \<exists>l'. kparts (insert a (set l)) = set l' \<and> cnb l' = crypt_nb a + cnb l
[PROOF STEP]
apply (rename_tac a b l')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b l'. \<lbrakk>kparts (set b) = set l'; cnb l' = cnb b\<rbrakk> \<Longrightarrow> \<exists>l'. kparts (insert a (set b)) = set l' \<and> cnb l' = crypt_nb a + cnb b
[PROOF STEP]
apply (subgoal_tac "\<exists>l''.  kparts {a} = set l'' \<and> cnb l'' = crypt_nb a", clarify)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b l' l''. \<lbrakk>kparts (set b) = set l'; cnb l' = cnb b; kparts {a} = set l''; cnb l'' = crypt_nb a\<rbrakk> \<Longrightarrow> \<exists>l'. kparts (insert a (set b)) = set l' \<and> cnb l' = crypt_nb a + cnb b
 2. \<And>a b l'. \<lbrakk>kparts (set b) = set l'; cnb l' = cnb b\<rbrakk> \<Longrightarrow> \<exists>l''. kparts {a} = set l'' \<and> cnb l'' = crypt_nb a
[PROOF STEP]
apply (rule_tac x="l''@l'" in exI, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b l' l''. \<lbrakk>kparts (set b) = set l'; cnb l' = cnb b; kparts {a} = set l''; cnb l'' = crypt_nb a\<rbrakk> \<Longrightarrow> kparts (insert a (set b)) = set l'' \<union> set l'
 2. \<And>a b l'. \<lbrakk>kparts (set b) = set l'; cnb l' = cnb b\<rbrakk> \<Longrightarrow> \<exists>l''. kparts {a} = set l'' \<and> cnb l'' = crypt_nb a
[PROOF STEP]
apply (rule kparts_insert_substI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b l'. \<lbrakk>kparts (set b) = set l'; cnb l' = cnb b\<rbrakk> \<Longrightarrow> \<exists>l''. kparts {a} = set l'' \<and> cnb l'' = crypt_nb a
[PROOF STEP]
by (rule kparts_msg_set)


[STATEMENT]
lemma ordLeq_omax:
assumes "finite R" and "\<forall> r \<in> R. Well_order r"
and "r \<in> R" and "p \<le>o r"
shows "p \<le>o omax R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<le>o omax R
[PROOF STEP]
using assms omax_maxim[of R r]
[PROOF STATE]
proof (prove)
using this:
finite R
\<forall>r\<in>R. Well_order r
r \<in> R
p \<le>o r
\<lbrakk>finite R; \<forall>r\<in>R. Well_order r; r \<in> R\<rbrakk> \<Longrightarrow> r \<le>o omax R

goal (1 subgoal):
 1. p \<le>o omax R
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite R; \<forall>r\<in>R. Well_order r; r \<in> R; p \<le>o r; r \<le>o omax R\<rbrakk> \<Longrightarrow> p \<le>o omax R
[PROOF STEP]
using ordLeq_transitive
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?r \<le>o ?r'; ?r' \<le>o ?r''\<rbrakk> \<Longrightarrow> ?r \<le>o ?r''

goal (1 subgoal):
 1. \<lbrakk>finite R; \<forall>r\<in>R. Well_order r; r \<in> R; p \<le>o r; r \<le>o omax R\<rbrakk> \<Longrightarrow> p \<le>o omax R
[PROOF STEP]
by blast


[STATEMENT]
lemma (in valid_unMultigraph) longest_path:
  assumes "finite E" "n \<in> V"
  shows "\<exists>v. \<exists>max_path. is_trail v max_path n \<and>
        (\<forall>v'. \<forall>e\<in>E. \<not>is_trail v' (e#max_path) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
assume  contro:"\<not> (\<exists>v max_path. is_trail v max_path n
           \<and> (\<forall>v'. \<forall>e\<in>E. \<not>is_trail v' (e#max_path) n))"
[PROOF STATE]
proof (state)
this:
\<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n)

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
hence  induct:"(\<forall>v max_path.  is_trail v max_path n
           \<longrightarrow> (\<exists>v'. \<exists>e\<in>E. is_trail v' (e#max_path) n))"
[PROOF STATE]
proof (prove)
using this:
\<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n)

goal (1 subgoal):
 1. \<forall>v max_path. is_trail v max_path n \<longrightarrow> (\<exists>v'. \<exists>e\<in>E. is_trail v' (e # max_path) n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>v max_path. is_trail v max_path n \<longrightarrow> (\<exists>v'. \<exists>e\<in>E. is_trail v' (e # max_path) n)

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
have "is_trail n [] n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_trail n [] n
[PROOF STEP]
using \<open>n \<in> V\<close>
[PROOF STATE]
proof (prove)
using this:
n \<in> V

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

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
hence "exist_path_length n 0"
[PROOF STATE]
proof (prove)
using this:
is_trail n [] n

goal (1 subgoal):
 1. exist_path_length n 0
[PROOF STEP]
unfolding exist_path_length_def
[PROOF STATE]
proof (prove)
using this:
is_trail n [] n

goal (1 subgoal):
 1. \<exists>v' ps. is_trail v' ps n \<and> length ps = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
exist_path_length n 0

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
exist_path_length n 0

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
have "\<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E
[PROOF STEP]
using trail_bound[OF \<open>finite E\<close>]
[PROOF STATE]
proof (prove)
using this:
is_trail ?v ?ps ?v' \<Longrightarrow> length ?ps \<le> card E

goal (1 subgoal):
 1. \<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E
[PROOF STEP]
unfolding exist_path_length_def
[PROOF STATE]
proof (prove)
using this:
is_trail ?v ?ps ?v' \<Longrightarrow> length ?ps \<le> card E

goal (1 subgoal):
 1. \<forall>y. (\<exists>v' ps. is_trail v' ps n \<and> length ps = y) \<longrightarrow> y \<le> card E
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
hence bound:"\<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E"
[PROOF STATE]
proof (prove)
using this:
\<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E

goal (1 subgoal):
 1. \<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
exist_path_length n 0
\<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E
[PROOF STEP]
have "exist_path_length n (GREATEST x. exist_path_length n x)"
[PROOF STATE]
proof (prove)
using this:
exist_path_length n 0
\<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E

goal (1 subgoal):
 1. exist_path_length n (GREATEST x. exist_path_length n x)
[PROOF STEP]
using GreatestI_nat
[PROOF STATE]
proof (prove)
using this:
exist_path_length n 0
\<forall>y. exist_path_length n y \<longrightarrow> y \<le> card E
\<lbrakk>?P ?k; \<And>y. ?P y \<Longrightarrow> y \<le> ?b\<rbrakk> \<Longrightarrow> ?P (Greatest ?P)

goal (1 subgoal):
 1. exist_path_length n (GREATEST x. exist_path_length n x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
exist_path_length n (GREATEST x. exist_path_length n x)

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exist_path_length n (GREATEST x. exist_path_length n x)
[PROOF STEP]
obtain v max_path where
    max_path:"is_trail v max_path n" "length max_path=(GREATEST x. exist_path_length n x)"
[PROOF STATE]
proof (prove)
using this:
exist_path_length n (GREATEST x. exist_path_length n x)

goal (1 subgoal):
 1. (\<And>v max_path. \<lbrakk>is_trail v max_path n; length max_path = (GREATEST x. exist_path_length n x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis exist_path_length_def)
[PROOF STATE]
proof (state)
this:
is_trail v max_path n
length max_path = (GREATEST x. exist_path_length n x)

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
hence "\<exists> v' e. is_trail v' (e#max_path) n"
[PROOF STATE]
proof (prove)
using this:
is_trail v max_path n
length max_path = (GREATEST x. exist_path_length n x)

goal (1 subgoal):
 1. \<exists>v' e. is_trail v' (e # max_path) n
[PROOF STEP]
using induct
[PROOF STATE]
proof (prove)
using this:
is_trail v max_path n
length max_path = (GREATEST x. exist_path_length n x)
\<forall>v max_path. is_trail v max_path n \<longrightarrow> (\<exists>v'. \<exists>e\<in>E. is_trail v' (e # max_path) n)

goal (1 subgoal):
 1. \<exists>v' e. is_trail v' (e # max_path) n
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>v' e. is_trail v' (e # max_path) n

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
hence "exist_path_length n (length max_path +1)"
[PROOF STATE]
proof (prove)
using this:
\<exists>v' e. is_trail v' (e # max_path) n

goal (1 subgoal):
 1. exist_path_length n (length max_path + 1)
[PROOF STEP]
by (metis One_nat_def exist_path_length_def list.size(4))
[PROOF STATE]
proof (state)
this:
exist_path_length n (length max_path + 1)

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
hence "length max_path + 1 \<le> (GREATEST x. exist_path_length n x)"
[PROOF STATE]
proof (prove)
using this:
exist_path_length n (length max_path + 1)

goal (1 subgoal):
 1. length max_path + 1 \<le> (GREATEST x. exist_path_length n x)
[PROOF STEP]
by (metis Greatest_le_nat bound)
[PROOF STATE]
proof (state)
this:
length max_path + 1 \<le> (GREATEST x. exist_path_length n x)

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
hence "length max_path + 1 \<le> length max_path"
[PROOF STATE]
proof (prove)
using this:
length max_path + 1 \<le> (GREATEST x. exist_path_length n x)

goal (1 subgoal):
 1. length max_path + 1 \<le> length max_path
[PROOF STEP]
using max_path
[PROOF STATE]
proof (prove)
using this:
length max_path + 1 \<le> (GREATEST x. exist_path_length n x)
is_trail v max_path n
length max_path = (GREATEST x. exist_path_length n x)

goal (1 subgoal):
 1. length max_path + 1 \<le> length max_path
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length max_path + 1 \<le> length max_path

goal (1 subgoal):
 1. \<nexists>v max_path. is_trail v max_path n \<and> (\<forall>v'. \<forall>e\<in>E. \<not> is_trail v' (e # max_path) n) \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
length max_path + 1 \<le> length max_path

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem multiset_induct [case_names empty add, induct type: multiset]:
  assumes empty: "P {#}"
  assumes add: "\<And>x M. P M \<Longrightarrow> P (add_mset x M)"
  shows "P M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P M
[PROOF STEP]
proof (induct "size M" arbitrary: M)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = size M

goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
thus "P M"
[PROOF STATE]
proof (prove)
using this:
0 = size M

goal (1 subgoal):
 1. P M
[PROOF STEP]
by (simp add: empty)
[PROOF STATE]
proof (state)
this:
P M

goal (1 subgoal):
 1. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k = size ?M \<Longrightarrow> P ?M
Suc k = size M

goal (1 subgoal):
 1. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
obtain N x where "M = add_mset x N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x N. M = add_mset x N \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>Suc k = size M\<close> [symmetric]
[PROOF STATE]
proof (prove)
using this:
size M = Suc k

goal (1 subgoal):
 1. (\<And>x N. M = add_mset x N \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using size_eq_Suc_imp_eq_union
[PROOF STATE]
proof (prove)
using this:
size M = Suc k
size ?M = Suc ?n \<Longrightarrow> \<exists>a N. ?M = add_mset a N

goal (1 subgoal):
 1. (\<And>x N. M = add_mset x N \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
M = add_mset x N

goal (1 subgoal):
 1. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
with Suc add
[PROOF STATE]
proof (chain)
picking this:
k = size ?M \<Longrightarrow> P ?M
Suc k = size M
P ?M \<Longrightarrow> P (add_mset ?x ?M)
M = add_mset x N
[PROOF STEP]
show "P M"
[PROOF STATE]
proof (prove)
using this:
k = size ?M \<Longrightarrow> P ?M
Suc k = size M
P ?M \<Longrightarrow> P (add_mset ?x ?M)
M = add_mset x N

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fpxs_compose_power_eq_iff [simp]:
  assumes "r > 0"
  shows   "fpxs_compose_power f r = fpxs_compose_power g r \<longleftrightarrow> f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fpxs_compose_power f r = fpxs_compose_power g r) = (f = g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < r

goal (1 subgoal):
 1. (fpxs_compose_power f r = fpxs_compose_power g r) = (f = g)
[PROOF STEP]
proof (transfer, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r f g. \<lbrakk>0 < r; is_fpxs f; is_fpxs g\<rbrakk> \<Longrightarrow> ((\<lambda>x. if 0 < r then f (x / r) else (0::'a)) = (\<lambda>x. if 0 < r then g (x / r) else (0::'a))) = (f = g)
[PROOF STEP]
case (1 r f g)
[PROOF STATE]
proof (state)
this:
0 < r
is_fpxs f
is_fpxs g

goal (1 subgoal):
 1. \<And>r f g. \<lbrakk>0 < r; is_fpxs f; is_fpxs g\<rbrakk> \<Longrightarrow> ((\<lambda>x. if 0 < r then f (x / r) else (0::'a)) = (\<lambda>x. if 0 < r then g (x / r) else (0::'a))) = (f = g)
[PROOF STEP]
have "f x = g x" if "\<And>x. f (x / r) = g (x / r)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
using that[of "x * r"] \<open>r > 0\<close>
[PROOF STATE]
proof (prove)
using this:
f (x * r / r) = g (x * r / r)
0 < r

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<And>x. f (x / r) = g (x / r)) \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. \<And>r f g. \<lbrakk>0 < r; is_fpxs f; is_fpxs g\<rbrakk> \<Longrightarrow> ((\<lambda>x. if 0 < r then f (x / r) else (0::'a)) = (\<lambda>x. if 0 < r then g (x / r) else (0::'a))) = (f = g)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(\<And>x. f (x / r) = g (x / r)) \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. ((\<lambda>x. if 0 < r then f (x / r) else (0::'a)) = (\<lambda>x. if 0 < r then g (x / r) else (0::'a))) = (f = g)
[PROOF STEP]
using \<open>r > 0\<close>
[PROOF STATE]
proof (prove)
using this:
(\<And>x. f (x / r) = g (x / r)) \<Longrightarrow> f ?x = g ?x
0 < r

goal (1 subgoal):
 1. ((\<lambda>x. if 0 < r then f (x / r) else (0::'a)) = (\<lambda>x. if 0 < r then g (x / r) else (0::'a))) = (f = g)
[PROOF STEP]
by (auto simp: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if 0 < r then f (x / r) else (0::'a)) = (\<lambda>x. if 0 < r then g (x / r) else (0::'a))) = (f = g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_le_one [simp]: "sin x \<le> 1"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin x \<le> 1
[PROOF STEP]
using abs_sin_le_one [of x]
[PROOF STATE]
proof (prove)
using this:
\<bar>sin x\<bar> \<le> 1

goal (1 subgoal):
 1. sin x \<le> 1
[PROOF STEP]
by (simp add: abs_le_iff)


[STATEMENT]
lemma formulaEntailsFormulaThatEntailsClause:
  fixes formula1 :: Formula and formula2 :: Formula and clause :: Clause
  assumes "formulaEntailsFormula formula1 formula2" and "formulaEntailsClause formula2 clause"
  shows "formulaEntailsClause formula1 clause"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. formulaEntailsClause formula1 clause
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
formulaEntailsFormula formula1 formula2
formulaEntailsClause formula2 clause

goal (1 subgoal):
 1. formulaEntailsClause formula1 clause
[PROOF STEP]
by (simp add: formulaEntailsClause_def formulaEntailsFormula_def)


[STATEMENT]
lemma suminf_bound:
  fixes f :: "nat \<Rightarrow> ereal"
  assumes "\<forall>N. (\<Sum>n<N. f n) \<le> x"
    and pos: "\<And>n. 0 \<le> f n"
  shows "suminf f \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. suminf f \<le> x
[PROOF STEP]
proof (rule Lim_bounded)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> suminf f
 2. \<forall>n\<ge>?M. ?f n \<le> x
[PROOF STEP]
have "summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f
[PROOF STEP]
using pos[THEN summable_ereal_pos]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>i. f (?n1 i))

goal (1 subgoal):
 1. summable f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
summable f

goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> suminf f
 2. \<forall>n\<ge>?M. ?f n \<le> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
summable f
[PROOF STEP]
show "(\<lambda>N. \<Sum>n<N. f n) \<longlonglongrightarrow> suminf f"
[PROOF STATE]
proof (prove)
using this:
summable f

goal (1 subgoal):
 1. (\<lambda>N. sum f {..<N}) \<longlonglongrightarrow> suminf f
[PROOF STEP]
by (auto dest!: summable_sums simp: sums_def atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
(\<lambda>N. sum f {..<N}) \<longlonglongrightarrow> suminf f

goal (1 subgoal):
 1. \<forall>n\<ge>?M. sum f {..<n} \<le> x
[PROOF STEP]
show "\<forall>n\<ge>0. sum f {..<n} \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<ge>0. sum f {..<n} \<le> x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>N. sum f {..<N} \<le> x
0 \<le> f ?n

goal (1 subgoal):
 1. \<forall>n\<ge>0. sum f {..<n} \<le> x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>0. sum f {..<n} \<le> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transP_R2P[simp]: "transP (R2P r) \<longleftrightarrow> trans r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transP (R2P r) = trans r
[PROOF STEP]
unfolding transP_def trans_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y z. R2P r x y \<and> R2P r y z \<longrightarrow> R2P r x z) = (\<forall>x y z. (x, y) \<in> r \<longrightarrow> (y, z) \<in> r \<longrightarrow> (x, z) \<in> r)
[PROOF STEP]
by auto


[STATEMENT]
lemma prim_per_div: assumes "primitive v" and "n \<noteq> 0" and "n \<le> \<^bold>|v\<^bold>|" and "period v (gcd \<^bold>|v\<^bold>| n)"
  shows "n = \<^bold>|v\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = \<^bold>|v\<^bold>|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n = \<^bold>|v\<^bold>|
[PROOF STEP]
have "gcd \<^bold>|v\<^bold>| n dvd \<^bold>|v\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd \<^bold>|v\<^bold>| n dvd \<^bold>|v\<^bold>|
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd \<^bold>|v\<^bold>| n dvd \<^bold>|v\<^bold>|

goal (1 subgoal):
 1. n = \<^bold>|v\<^bold>|
[PROOF STEP]
from  prim_exp_eq[OF \<open>primitive v\<close> per_div[OF this \<open>period v (gcd \<^bold>|v\<^bold>| n)\<close>]]
[PROOF STATE]
proof (chain)
picking this:
v = take (gcd \<^bold>|v\<^bold>| n) v
[PROOF STEP]
have "gcd \<^bold>|v\<^bold>| n = \<^bold>|v\<^bold>|"
[PROOF STATE]
proof (prove)
using this:
v = take (gcd \<^bold>|v\<^bold>| n) v

goal (1 subgoal):
 1. gcd \<^bold>|v\<^bold>| n = \<^bold>|v\<^bold>|
[PROOF STEP]
using take_len[OF le_trans[OF gcd_le2_nat[OF \<open>n \<noteq> 0\<close>] \<open>n \<le> \<^bold>|v\<^bold>|\<close>], of "\<^bold>|v\<^bold>|"]
[PROOF STATE]
proof (prove)
using this:
v = take (gcd \<^bold>|v\<^bold>| n) v
\<^bold>|take (gcd \<^bold>|v\<^bold>| n) v\<^bold>| = gcd \<^bold>|v\<^bold>| n

goal (1 subgoal):
 1. gcd \<^bold>|v\<^bold>| n = \<^bold>|v\<^bold>|
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
gcd \<^bold>|v\<^bold>| n = \<^bold>|v\<^bold>|

goal (1 subgoal):
 1. n = \<^bold>|v\<^bold>|
[PROOF STEP]
from gcd_le2_nat[OF \<open>n \<noteq> 0\<close>, of "\<^bold>|v\<^bold>|", unfolded this] \<open>n \<le> \<^bold>|v\<^bold>|\<close>
[PROOF STATE]
proof (chain)
picking this:
\<^bold>|v\<^bold>| \<le> n
n \<le> \<^bold>|v\<^bold>|
[PROOF STEP]
show "n = \<^bold>|v\<^bold>|"
[PROOF STATE]
proof (prove)
using this:
\<^bold>|v\<^bold>| \<le> n
n \<le> \<^bold>|v\<^bold>|

goal (1 subgoal):
 1. n = \<^bold>|v\<^bold>|
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
n = \<^bold>|v\<^bold>|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reflect_poly_mult: "reflect_poly (p * q) = reflect_poly p * reflect_poly q"
  for p q :: "'a::{comm_semiring_0,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflect_poly (p * q) = reflect_poly p * reflect_poly q
[PROOF STEP]
proof (cases "p = 0 \<or> q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> reflect_poly (p * q) = reflect_poly p * reflect_poly q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> reflect_poly (p * q) = reflect_poly p * reflect_poly q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (p = 0 \<or> q = 0)

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> reflect_poly (p * q) = reflect_poly p * reflect_poly q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> reflect_poly (p * q) = reflect_poly p * reflect_poly q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (p = 0 \<or> q = 0)
[PROOF STEP]
have [simp]: "p \<noteq> 0" "q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (p = 0 \<or> q = 0)

goal (1 subgoal):
 1. p \<noteq> 0 &&& q \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0
q \<noteq> 0

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> reflect_poly (p * q) = reflect_poly p * reflect_poly q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> reflect_poly (p * q) = reflect_poly p * reflect_poly q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflect_poly (p * q) = reflect_poly p * reflect_poly q
[PROOF STEP]
proof (rule poly_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. coeff (reflect_poly (p * q)) n = coeff (reflect_poly p * reflect_poly q) n
[PROOF STEP]
show "coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
proof (cases "i \<le> degree (p * q)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i \<le> degree (p * q)

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
define A where "A = {..i} \<inter> {i - degree q..degree p}"
[PROOF STATE]
proof (state)
this:
A = {..i} \<inter> {i - degree q..degree p}

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
define B where "B = {..degree p} \<inter> {degree p - i..degree (p*q) - i}"
[PROOF STATE]
proof (state)
this:
B = {..degree p} \<inter> {degree p - i..degree (p * q) - i}

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
let ?f = "\<lambda>j. degree p - j"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
i \<le> degree (p * q)
[PROOF STEP]
have "coeff (reflect_poly (p * q)) i = coeff (p * q) (degree (p * q) - i)"
[PROOF STATE]
proof (prove)
using this:
i \<le> degree (p * q)

goal (1 subgoal):
 1. coeff (reflect_poly (p * q)) i = coeff (p * q) (degree (p * q) - i)
[PROOF STEP]
by (simp add: coeff_reflect_poly)
[PROOF STATE]
proof (state)
this:
coeff (reflect_poly (p * q)) i = coeff (p * q) (degree (p * q) - i)

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (reflect_poly (p * q)) i = coeff (p * q) (degree (p * q) - i)

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
have "\<dots> = (\<Sum>j\<le>degree (p * q) - i. coeff p j * coeff q (degree (p * q) - i - j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * q) (degree (p * q) - i) = (\<Sum>j\<le>degree (p * q) - i. coeff p j * coeff q (degree (p * q) - i - j))
[PROOF STEP]
by (simp add: coeff_mult)
[PROOF STATE]
proof (state)
this:
coeff (p * q) (degree (p * q) - i) = (\<Sum>j\<le>degree (p * q) - i. coeff p j * coeff q (degree (p * q) - i - j))

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (p * q) (degree (p * q) - i) = (\<Sum>j\<le>degree (p * q) - i. coeff p j * coeff q (degree (p * q) - i - j))

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
have "\<dots> = (\<Sum>j\<in>B. coeff p j * coeff q (degree (p * q) - i - j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<le>degree (p * q) - i. coeff p j * coeff q (degree (p * q) - i - j)) = (\<Sum>j\<in>B. coeff p j * coeff q (degree (p * q) - i - j))
[PROOF STEP]
by (intro sum.mono_neutral_right) (auto simp: B_def degree_mult_eq not_le coeff_eq_0)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>degree (p * q) - i. coeff p j * coeff q (degree (p * q) - i - j)) = (\<Sum>j\<in>B. coeff p j * coeff q (degree (p * q) - i - j))

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>degree (p * q) - i. coeff p j * coeff q (degree (p * q) - i - j)) = (\<Sum>j\<in>B. coeff p j * coeff q (degree (p * q) - i - j))

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
i \<le> degree (p * q)
[PROOF STEP]
have "\<dots> = (\<Sum>j\<in>A. coeff p (degree p - j) * coeff q (degree q - (i - j)))"
[PROOF STATE]
proof (prove)
using this:
i \<le> degree (p * q)

goal (1 subgoal):
 1. (\<Sum>j\<in>B. coeff p j * coeff q (degree (p * q) - i - j)) = (\<Sum>j\<in>A. coeff p (degree p - j) * coeff q (degree q - (i - j)))
[PROOF STEP]
by (intro sum.reindex_bij_witness[of _ ?f ?f])
          (auto simp: A_def B_def degree_mult_eq add_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>B. coeff p j * coeff q (degree (p * q) - i - j)) = (\<Sum>j\<in>A. coeff p (degree p - j) * coeff q (degree q - (i - j)))

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>B. coeff p j * coeff q (degree (p * q) - i - j)) = (\<Sum>j\<in>A. coeff p (degree p - j) * coeff q (degree q - (i - j)))

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
have "\<dots> =
        (\<Sum>j\<le>i.
          if j \<in> {i - degree q..degree p}
          then coeff p (degree p - j) * coeff q (degree q - (i - j))
          else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>A. coeff p (degree p - j) * coeff q (degree q - (i - j))) = (\<Sum>j\<le>i. if j \<in> {i - degree q..degree p} then coeff p (degree p - j) * coeff q (degree q - (i - j)) else (0::'a))
[PROOF STEP]
by (subst sum.inter_restrict [symmetric]) (simp_all add: A_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>A. coeff p (degree p - j) * coeff q (degree q - (i - j))) = (\<Sum>j\<le>i. if j \<in> {i - degree q..degree p} then coeff p (degree p - j) * coeff q (degree q - (i - j)) else (0::'a))

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>A. coeff p (degree p - j) * coeff q (degree q - (i - j))) = (\<Sum>j\<le>i. if j \<in> {i - degree q..degree p} then coeff p (degree p - j) * coeff q (degree q - (i - j)) else (0::'a))

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
have "\<dots> = coeff (reflect_poly p * reflect_poly q) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<le>i. if j \<in> {i - degree q..degree p} then coeff p (degree p - j) * coeff q (degree q - (i - j)) else (0::'a)) = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
by (fastforce simp: coeff_mult coeff_reflect_poly intro!: sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>i. if j \<in> {i - degree q..degree p} then coeff p (degree p - j) * coeff q (degree q - (i - j)) else (0::'a)) = coeff (reflect_poly p * reflect_poly q) i

goal (2 subgoals):
 1. i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
 2. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i

goal (1 subgoal):
 1. coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i

goal (1 subgoal):
 1. \<not> i \<le> degree (p * q) \<Longrightarrow> coeff (reflect_poly (p * q)) i = coeff (reflect_poly p * reflect_poly q) i
[PROOF STEP]
qed (auto simp: coeff_mult coeff_reflect_poly coeff_eq_0 degree_mult_eq intro!: sum.neutral)
[PROOF STATE]
proof (state)
this:
coeff (reflect_poly (p * q)) ?i = coeff (reflect_poly p * reflect_poly q) ?i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
reflect_poly (p * q) = reflect_poly p * reflect_poly q

goal (1 subgoal):
 1. p = 0 \<or> q = 0 \<Longrightarrow> reflect_poly (p * q) = reflect_poly p * reflect_poly q
[PROOF STEP]
qed auto


[STATEMENT]
lemma segment_degen_1:
  fixes a :: "'a :: real_vector"
  shows "(1 - u) *\<^sub>R a + u *\<^sub>R b = b \<longleftrightarrow> a=b \<or> u=1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)
[PROOF STEP]
assume "(1 - u) *\<^sub>R a + u *\<^sub>R b = b"
[PROOF STATE]
proof (state)
this:
(1 - u) *\<^sub>R a + u *\<^sub>R b = b

goal (1 subgoal):
 1. ((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 - u) *\<^sub>R a + u *\<^sub>R b = b
[PROOF STEP]
have "(1 - u) *\<^sub>R a = (1 - u) *\<^sub>R b"
[PROOF STATE]
proof (prove)
using this:
(1 - u) *\<^sub>R a + u *\<^sub>R b = b

goal (1 subgoal):
 1. (1 - u) *\<^sub>R a = (1 - u) *\<^sub>R b
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(1 - u) *\<^sub>R a = (1 - u) *\<^sub>R b

goal (1 subgoal):
 1. ((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 - u) *\<^sub>R a = (1 - u) *\<^sub>R b
[PROOF STEP]
have "a=b \<or> u=1"
[PROOF STATE]
proof (prove)
using this:
(1 - u) *\<^sub>R a = (1 - u) *\<^sub>R b

goal (1 subgoal):
 1. a = b \<or> u = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a = b \<or> u = 1

goal (1 subgoal):
 1. ((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(1 - u) *\<^sub>R a + u *\<^sub>R b = b \<Longrightarrow> a = b \<or> u = 1

goal (1 subgoal):
 1. ((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 - u) *\<^sub>R a + u *\<^sub>R b = b \<Longrightarrow> a = b \<or> u = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(1 - u) *\<^sub>R a + u *\<^sub>R b = b \<Longrightarrow> a = b \<or> u = 1

goal (1 subgoal):
 1. ((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
((1 - u) *\<^sub>R a + u *\<^sub>R b = b) = (a = b \<or> u = 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma octo_of_real_eq_minus_of_real_iff [simp]: "octo_of_real x = -octo_of_real y \<longleftrightarrow> x = -y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (octo_of_real x = - octo_of_real y) = (x = - y)
[PROOF STEP]
using octo_of_real_eq_iff[of x "-y"]
[PROOF STATE]
proof (prove)
using this:
(octo_of_real x = octo_of_real (- y)) = (x = - y)

goal (1 subgoal):
 1. (octo_of_real x = - octo_of_real y) = (x = - y)
[PROOF STEP]
by (simp only: octo_of_real_minus)


[STATEMENT]
lemma integral_neg [simp]: "integral S (\<lambda>x. - f x) = - integral S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
proof (cases "f integrable_on S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f integrable_on S \<Longrightarrow> integral S (\<lambda>x. - f x) = - integral S f
 2. \<not> f integrable_on S \<Longrightarrow> integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f integrable_on S

goal (2 subgoals):
 1. f integrable_on S \<Longrightarrow> integral S (\<lambda>x. - f x) = - integral S f
 2. \<not> f integrable_on S \<Longrightarrow> integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f integrable_on S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f integrable_on S

goal (1 subgoal):
 1. integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
by (simp add: has_integral_neg integrable_integral integral_unique)
[PROOF STATE]
proof (state)
this:
integral S (\<lambda>x. - f x) = - integral S f

goal (1 subgoal):
 1. \<not> f integrable_on S \<Longrightarrow> integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> f integrable_on S \<Longrightarrow> integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> f integrable_on S

goal (1 subgoal):
 1. \<not> f integrable_on S \<Longrightarrow> integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> f integrable_on S
[PROOF STEP]
have "\<not> (\<lambda>x. - f x) integrable_on S"
[PROOF STATE]
proof (prove)
using this:
\<not> f integrable_on S

goal (1 subgoal):
 1. \<not> (\<lambda>x. - f x) integrable_on S
[PROOF STEP]
using has_integral_neg [of "(\<lambda>x. - f x)" _ S ]
[PROOF STATE]
proof (prove)
using this:
\<not> f integrable_on S
((\<lambda>x. - f x) has_integral ?k) S \<Longrightarrow> ((\<lambda>x. - (- f x)) has_integral - ?k) S

goal (1 subgoal):
 1. \<not> (\<lambda>x. - f x) integrable_on S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> (\<lambda>x. - f x) integrable_on S

goal (1 subgoal):
 1. \<not> f integrable_on S \<Longrightarrow> integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> f integrable_on S
\<not> (\<lambda>x. - f x) integrable_on S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> f integrable_on S
\<not> (\<lambda>x. - f x) integrable_on S

goal (1 subgoal):
 1. integral S (\<lambda>x. - f x) = - integral S f
[PROOF STEP]
by (simp add: not_integrable_integral)
[PROOF STATE]
proof (state)
this:
integral S (\<lambda>x. - f x) = - integral S f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma merge_stable_segments:
  "merge (stable_segment cmp l xs) (stable_segment cmp l ys) =
     stable_segment cmp l xs @ stable_segment cmp l ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. merge (filter (\<lambda>y. compare cmp l y = Equiv) xs) (filter (\<lambda>y. compare cmp l y = Equiv) ys) = filter (\<lambda>y. compare cmp l y = Equiv) xs @ filter (\<lambda>y. compare cmp l y = Equiv) ys
[PROOF STEP]
by (rule merge_eq_appendI) (auto dest: compare.trans_equiv_greater)


[STATEMENT]
theorem correct_position_insert:
  assumes "list_ops (ops @ [(oid, ins)])"
    and "ins = make_insert (fst (interp_ops ops)) val k"
    and "list = fst (interp_ops (ops @ [(oid, ins)]))"
  shows "list ! (min k (length list - 1)) = oid"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list ! min k (length list - 1) = oid
[PROOF STEP]
proof(cases "k = 0 \<or> fst (interp_ops ops) = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<or> fst (interp_ops ops) = [] \<Longrightarrow> list ! min k (length list - 1) = oid
 2. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k = 0 \<or> fst (interp_ops ops) = []

goal (2 subgoals):
 1. k = 0 \<or> fst (interp_ops ops) = [] \<Longrightarrow> list ! min k (length list - 1) = oid
 2. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
k = 0 \<or> fst (interp_ops ops) = []

goal (2 subgoals):
 1. k = 0 \<or> fst (interp_ops ops) = [] \<Longrightarrow> list ! min k (length list - 1) = oid
 2. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
k = 0 \<or> fst (interp_ops ops) = []
[PROOF STEP]
have "make_insert (fst (interp_ops ops)) val k = Insert None val"
    and min_k: "min k (length (fst (interp_ops ops))) = 0"
[PROOF STATE]
proof (prove)
using this:
k = 0 \<or> fst (interp_ops ops) = []

goal (1 subgoal):
 1. make_insert (fst (interp_ops ops)) val k = Insert None val &&& min k (length (fst (interp_ops ops))) = 0
[PROOF STEP]
by (cases k, auto)
[PROOF STATE]
proof (state)
this:
make_insert (fst (interp_ops ops)) val k = Insert None val
min k (length (fst (interp_ops ops))) = 0

goal (2 subgoals):
 1. k = 0 \<or> fst (interp_ops ops) = [] \<Longrightarrow> list ! min k (length list - 1) = oid
 2. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
hence "fst (interp_ops (ops @ [(oid, ins)])) = oid # fst (interp_ops ops)"
[PROOF STATE]
proof (prove)
using this:
make_insert (fst (interp_ops ops)) val k = Insert None val
min k (length (fst (interp_ops ops))) = 0

goal (1 subgoal):
 1. fst (interp_ops (ops @ [(oid, ins)])) = oid # fst (interp_ops ops)
[PROOF STEP]
using assms(2) interp_ops_unfold_last
[PROOF STATE]
proof (prove)
using this:
make_insert (fst (interp_ops ops)) val k = Insert None val
min k (length (fst (interp_ops ops))) = 0
ins = make_insert (fst (interp_ops ops)) val k
interp_ops (?xs @ [?x]) = interp_op (interp_ops ?xs) ?x

goal (1 subgoal):
 1. fst (interp_ops (ops @ [(oid, ins)])) = oid # fst (interp_ops ops)
[PROOF STEP]
by (metis fst_conv insert_spec.simps(1) interp_op.simps(1) prod.collapse)
[PROOF STATE]
proof (state)
this:
fst (interp_ops (ops @ [(oid, ins)])) = oid # fst (interp_ops ops)

goal (2 subgoals):
 1. k = 0 \<or> fst (interp_ops ops) = [] \<Longrightarrow> list ! min k (length list - 1) = oid
 2. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
k = 0 \<or> fst (interp_ops ops) = []
fst (interp_ops (ops @ [(oid, ins)])) = oid # fst (interp_ops ops)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = 0 \<or> fst (interp_ops ops) = []
fst (interp_ops (ops @ [(oid, ins)])) = oid # fst (interp_ops ops)

goal (1 subgoal):
 1. list ! min k (length list - 1) = oid
[PROOF STEP]
by (simp add: min_k assms(3))
[PROOF STATE]
proof (state)
this:
list ! min k (length list - 1) = oid

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (k = 0 \<or> fst (interp_ops ops) = [])

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> (k = 0 \<or> fst (interp_ops ops) = [])

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<not> (k = 0 \<or> fst (interp_ops ops) = [])
[PROOF STEP]
have "k > 0" and "fst (interp_ops ops) \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
\<not> (k = 0 \<or> fst (interp_ops ops) = [])

goal (1 subgoal):
 1. 0 < k &&& fst (interp_ops ops) \<noteq> []
[PROOF STEP]
using neq0_conv
[PROOF STATE]
proof (prove)
using this:
\<not> (k = 0 \<or> fst (interp_ops ops) = [])
(?n \<noteq> 0) = (0 < ?n)

goal (1 subgoal):
 1. 0 < k &&& fst (interp_ops ops) \<noteq> []
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
0 < k
fst (interp_ops ops) \<noteq> []

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
0 < k
fst (interp_ops ops) \<noteq> []
[PROOF STEP]
obtain nat where "k = Suc nat"
[PROOF STATE]
proof (prove)
using this:
0 < k
fst (interp_ops ops) \<noteq> []

goal (1 subgoal):
 1. (\<And>nat. k = Suc nat \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using gr0_implies_Suc
[PROOF STATE]
proof (prove)
using this:
0 < k
fst (interp_ops ops) \<noteq> []
0 < ?n \<Longrightarrow> \<exists>m. ?n = Suc m

goal (1 subgoal):
 1. (\<And>nat. k = Suc nat \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
k = Suc nat

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
hence "make_insert (fst (interp_ops ops)) val k =
      Insert (Some ((fst (interp_ops ops)) ! (min nat (length (fst (interp_ops ops)) - 1)))) val"
[PROOF STATE]
proof (prove)
using this:
k = Suc nat

goal (1 subgoal):
 1. make_insert (fst (interp_ops ops)) val k = Insert (Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1))) val
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
k = Suc nat
\<not> (k = 0 \<or> fst (interp_ops ops) = [])

goal (1 subgoal):
 1. make_insert (fst (interp_ops ops)) val k = Insert (Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1))) val
[PROOF STEP]
by (cases "fst (interp_ops ops)", auto)
[PROOF STATE]
proof (state)
this:
make_insert (fst (interp_ops ops)) val k = Insert (Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1))) val

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
hence "fst (interp_ops (ops @ [(oid, ins)])) =
         insert_spec (fst (interp_ops ops)) (oid, Some ((fst (interp_ops ops)) ! (min nat (length (fst (interp_ops ops)) - 1))))"
[PROOF STATE]
proof (prove)
using this:
make_insert (fst (interp_ops ops)) val k = Insert (Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1))) val

goal (1 subgoal):
 1. fst (interp_ops (ops @ [(oid, ins)])) = insert_spec (fst (interp_ops ops)) (oid, Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1)))
[PROOF STEP]
by (metis assms(2) fst_conv interp_op.simps(1) interp_ops_unfold_last prod.collapse)
[PROOF STATE]
proof (state)
this:
fst (interp_ops (ops @ [(oid, ins)])) = insert_spec (fst (interp_ops ops)) (oid, Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1)))

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fst (interp_ops (ops @ [(oid, ins)])) = insert_spec (fst (interp_ops ops)) (oid, Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1)))

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
have "min nat (length (fst (interp_ops ops)) - 1) < length (fst (interp_ops ops))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min nat (length (fst (interp_ops ops)) - 1) < length (fst (interp_ops ops))
[PROOF STEP]
by (simp add: \<open>fst (interp_ops ops) \<noteq> []\<close> min.strict_coboundedI2)
[PROOF STATE]
proof (state)
this:
min nat (length (fst (interp_ops ops)) - 1) < length (fst (interp_ops ops))

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
min nat (length (fst (interp_ops ops)) - 1) < length (fst (interp_ops ops))

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
have "distinct (fst (interp_ops ops))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (fst (interp_ops ops))
[PROOF STEP]
using interp_ops_distinct list_ops_def spec_ops_rem_last assms(1)
[PROOF STATE]
proof (prove)
using this:
list_ops ?ops \<Longrightarrow> distinct (fst (interp_ops ?ops))
list_ops ?ops \<equiv> spec_ops ?ops list_op_deps
spec_ops (?xs @ [?x]) ?deps \<Longrightarrow> spec_ops ?xs ?deps
list_ops (ops @ [(oid, ins)])

goal (1 subgoal):
 1. distinct (fst (interp_ops ops))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
distinct (fst (interp_ops ops))

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
distinct (fst (interp_ops ops))

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
have "length list = Suc (length (fst (interp_ops ops)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length list = Suc (length (fst (interp_ops ops)))
[PROOF STEP]
using assms(3) calculation
[PROOF STATE]
proof (prove)
using this:
list = fst (interp_ops (ops @ [(oid, ins)]))
\<not> (k = 0 \<or> fst (interp_ops ops) = [])
fst (interp_ops (ops @ [(oid, ins)])) = insert_spec (fst (interp_ops ops)) (oid, Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1)))
min nat (length (fst (interp_ops ops)) - 1) < length (fst (interp_ops ops))
distinct (fst (interp_ops ops))

goal (1 subgoal):
 1. length list = Suc (length (fst (interp_ops ops)))
[PROOF STEP]
by (simp add: insert_spec_inc_length)
[PROOF STATE]
proof (state)
this:
length list = Suc (length (fst (interp_ops ops)))

goal (1 subgoal):
 1. \<not> (k = 0 \<or> fst (interp_ops ops) = []) \<Longrightarrow> list ! min k (length list - 1) = oid
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> (k = 0 \<or> fst (interp_ops ops) = [])
fst (interp_ops (ops @ [(oid, ins)])) = insert_spec (fst (interp_ops ops)) (oid, Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1)))
min nat (length (fst (interp_ops ops)) - 1) < length (fst (interp_ops ops))
distinct (fst (interp_ops ops))
length list = Suc (length (fst (interp_ops ops)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (k = 0 \<or> fst (interp_ops ops) = [])
fst (interp_ops (ops @ [(oid, ins)])) = insert_spec (fst (interp_ops ops)) (oid, Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1)))
min nat (length (fst (interp_ops ops)) - 1) < length (fst (interp_ops ops))
distinct (fst (interp_ops ops))
length list = Suc (length (fst (interp_ops ops)))

goal (1 subgoal):
 1. list ! min k (length list - 1) = oid
[PROOF STEP]
using assms insert_spec_nth_oid
[PROOF STATE]
proof (prove)
using this:
\<not> (k = 0 \<or> fst (interp_ops ops) = [])
fst (interp_ops (ops @ [(oid, ins)])) = insert_spec (fst (interp_ops ops)) (oid, Some (fst (interp_ops ops) ! min nat (length (fst (interp_ops ops)) - 1)))
min nat (length (fst (interp_ops ops)) - 1) < length (fst (interp_ops ops))
distinct (fst (interp_ops ops))
length list = Suc (length (fst (interp_ops ops)))
list_ops (ops @ [(oid, ins)])
ins = make_insert (fst (interp_ops ops)) val k
list = fst (interp_ops (ops @ [(oid, ins)]))
\<lbrakk>distinct ?xs; ?n < length ?xs\<rbrakk> \<Longrightarrow> insert_spec ?xs (?oid, Some (?xs ! ?n)) ! Suc ?n = ?oid

goal (1 subgoal):
 1. list ! min k (length list - 1) = oid
[PROOF STEP]
by (metis Suc_diff_1 \<open>k = Suc nat\<close> diff_Suc_1 length_greater_0_conv min_Suc_Suc)
[PROOF STATE]
proof (state)
this:
list ! min k (length list - 1) = oid

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma KL_div_mul:
  assumes "0 < d" "d \<le> 1"
  assumes "\<And>i. i\<in>S \<Longrightarrow> 0 \<le> a i"
  assumes "\<And>i. i\<in>S \<Longrightarrow> 0 < e i"
shows "KL_div S a e \<ge> KL_div S a (\<lambda>i. e i / d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KL_div S a (\<lambda>i. e i / d) \<le> KL_div S a e
[PROOF STEP]
unfolding KL_div_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
assume "i\<in>S"
[PROOF STATE]
proof (state)
this:
i \<in> S

goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
hence "a i / (e i / d) \<le> a i / e i"
[PROOF STATE]
proof (prove)
using this:
i \<in> S

goal (1 subgoal):
 1. a i / (e i / d) \<le> a i / e i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> S
0 < d
d \<le> 1
?i14 \<in> S \<Longrightarrow> 0 \<le> a ?i14
?i14 \<in> S \<Longrightarrow> 0 < e ?i14

goal (1 subgoal):
 1. a i / (e i / d) \<le> a i / e i
[PROOF STEP]
by (metis (no_types) div_by_1 frac_le less_imp_triv not_less)
[PROOF STATE]
proof (state)
this:
a i / (e i / d) \<le> a i / e i

goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
hence "log b (a i / (e i / d)) \<le> log b (a i / e i)"
[PROOF STATE]
proof (prove)
using this:
a i / (e i / d) \<le> a i / e i

goal (1 subgoal):
 1. log b (a i / (e i / d)) \<le> log b (a i / e i)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
a i / (e i / d) \<le> a i / e i
0 < d

goal (1 subgoal):
 1. log b (a i / (e i / d)) \<le> log b (a i / e i)
[PROOF STEP]
by (metis (full_types) b_gt_1 divide_divide_eq_left inverse_divide le_less_linear log_le
    log_neg_const order_refl times_divide_eq_right zero_less_mult_iff)
[PROOF STATE]
proof (state)
this:
log b (a i / (e i / d)) \<le> log b (a i / e i)

goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i16 \<in> S \<Longrightarrow> log b (a ?i16 / (e ?i16 / d)) \<le> log b (a ?i16 / e ?i16)

goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
thus "(\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))"
[PROOF STATE]
proof (prove)
using this:
?i16 \<in> S \<Longrightarrow> log b (a ?i16 / (e ?i16 / d)) \<le> log b (a ?i16 / e ?i16)

goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
by (meson mult_left_mono assms sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>S. a i * log b (a i / (e i / d))) \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma empty_rep: "q=empty \<longleftrightarrow> Rep_BinomialHeap q = Nil"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (q = local.empty) = (Rep_BinomialHeap q = [])
[PROOF STEP]
apply (auto simp add: empty_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_BinomialHeap q = [] \<Longrightarrow> q = Abs_BinomialHeap []
[PROOF STEP]
apply (metis Rep_BinomialHeap_inverse)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in ideal) helper_I_closed:
  assumes carr: "a \<in> carrier R" "x \<in> carrier R" "y \<in> carrier R"
    and axI: "a \<otimes> x \<in> I"
  shows "a \<otimes> (x \<otimes> y) \<in> I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes> (x \<otimes> y) \<in> I
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<otimes> (x \<otimes> y) \<in> I
[PROOF STEP]
from axI and carr
[PROOF STATE]
proof (chain)
picking this:
a \<otimes> x \<in> I
a \<in> carrier R
x \<in> carrier R
y \<in> carrier R
[PROOF STEP]
have "(a \<otimes> x) \<otimes> y \<in> I"
[PROOF STATE]
proof (prove)
using this:
a \<otimes> x \<in> I
a \<in> carrier R
x \<in> carrier R
y \<in> carrier R

goal (1 subgoal):
 1. a \<otimes> x \<otimes> y \<in> I
[PROOF STEP]
by (simp add: I_r_closed)
[PROOF STATE]
proof (state)
this:
a \<otimes> x \<otimes> y \<in> I

goal (1 subgoal):
 1. a \<otimes> (x \<otimes> y) \<in> I
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a \<otimes> x \<otimes> y \<in> I

goal (1 subgoal):
 1. a \<otimes> (x \<otimes> y) \<in> I
[PROOF STEP]
from carr
[PROOF STATE]
proof (chain)
picking this:
a \<in> carrier R
x \<in> carrier R
y \<in> carrier R
[PROOF STEP]
have "(a \<otimes> x) \<otimes> y = a \<otimes> (x \<otimes> y)"
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
x \<in> carrier R
y \<in> carrier R

goal (1 subgoal):
 1. a \<otimes> x \<otimes> y = a \<otimes> (x \<otimes> y)
[PROOF STEP]
by (simp add: m_assoc)
[PROOF STATE]
proof (state)
this:
a \<otimes> x \<otimes> y = a \<otimes> (x \<otimes> y)

goal (1 subgoal):
 1. a \<otimes> (x \<otimes> y) \<in> I
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a \<otimes> (x \<otimes> y) \<in> I
[PROOF STEP]
show "a \<otimes> (x \<otimes> y) \<in> I"
[PROOF STATE]
proof (prove)
using this:
a \<otimes> (x \<otimes> y) \<in> I

goal (1 subgoal):
 1. a \<otimes> (x \<otimes> y) \<in> I
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
a \<otimes> (x \<otimes> y) \<in> I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma entail_set_all_formulas: "N1 \<Turnstile> N2 \<longleftrightarrow> (\<forall>C \<in> N2. N1 \<Turnstile> {C})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (N1 \<Turnstile> N2) = (\<forall>C\<in>N2. N1 \<Turnstile> {C})
[PROOF STEP]
by (meson all_formulas_entailed empty_subsetI insert_subset subset_entailed entails_trans)


[STATEMENT]
lemma tendsto_enn2ereal_iff[simp]: "((\<lambda>i. enn2ereal (f i)) \<longlongrightarrow> enn2ereal x) F \<longleftrightarrow> (f \<longlongrightarrow> x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>i. enn2ereal (f i)) \<longlongrightarrow> enn2ereal x) F = (f \<longlongrightarrow> x) F
[PROOF STEP]
using continuous_on_enn2ereal[THEN continuous_on_tendsto_compose, of f x F]
    continuous_on_e2ennreal[THEN continuous_on_tendsto_compose, of "\<lambda>x. enn2ereal (f x)" "enn2ereal x" F UNIV]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(f \<longlongrightarrow> x) F; x \<in> UNIV; \<forall>\<^sub>F x in F. f x \<in> UNIV\<rbrakk> \<Longrightarrow> ((\<lambda>x. enn2ereal (f x)) \<longlongrightarrow> enn2ereal x) F
\<lbrakk>((\<lambda>x. enn2ereal (f x)) \<longlongrightarrow> enn2ereal x) F; enn2ereal x \<in> UNIV; \<forall>\<^sub>F x in F. enn2ereal (f x) \<in> UNIV\<rbrakk> \<Longrightarrow> ((\<lambda>x. e2ennreal (enn2ereal (f x))) \<longlongrightarrow> e2ennreal (enn2ereal x)) F

goal (1 subgoal):
 1. ((\<lambda>i. enn2ereal (f i)) \<longlongrightarrow> enn2ereal x) F = (f \<longlongrightarrow> x) F
[PROOF STEP]
by auto


[STATEMENT]
lemma sym_group_mult: "mult (sym_group n) = (\<circ>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<otimes>\<^bsub>sym_group n\<^esub>) = (\<circ>)
[PROOF STEP]
unfolding sym_group_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<otimes>\<^bsub>\<lparr>carrier = {p. p permutes {1..n}}, monoid.mult = (\<circ>), one = id\<rparr>\<^esub>) = (\<circ>)
[PROOF STEP]
by simp


[STATEMENT]
lemma vec_to_lpoly_from_lpoly_coeff_dual1:
  "coeff (vec_to_lpoly (lpoly_to_vec p)) i = coeff p i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abstract_Linear_Poly.coeff (vec_to_lpoly (lpoly_to_vec p)) i = Abstract_Linear_Poly.coeff p i
[PROOF STEP]
by (metis all_greater_dim_poly_zero dim_poly_dim_vec_equiv lin_poly_to_vec_coeff_access
      not_less outside_list_coeff0 vec_to_lin_poly_coeff_access)


[STATEMENT]
lemma iT_Plus_mono: "A \<subseteq> B \<Longrightarrow> A \<oplus> k \<subseteq> B \<oplus> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> A \<oplus> k \<subseteq> B \<oplus> k
[PROOF STEP]
by (simp add: iT_Plus_def image_mono)


[STATEMENT]
lemma to_bool_eq_0:
  "(\<not> to_bool x) = (x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> to_bool x) = (x = 0)
[PROOF STEP]
by (simp add: to_bool_def)


[STATEMENT]
lemma separate_othogonal: assumes
    "\<And>ps n. P (ps,n) \<Longrightarrow> n = 0"
    "\<And>ps n. Q (ps,n) \<Longrightarrow> ps = 0"
  shows "(P ** Q) (ps,n) \<longleftrightarrow> P (ps,0) \<and> Q (0,n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<and>* Q) (ps, n) = (P (ps, 0::'b) \<and> Q (0::'a, n))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P (?ps, ?n) \<Longrightarrow> ?n = (0::'b)
Q (?ps, ?n) \<Longrightarrow> ?ps = (0::'a)

goal (1 subgoal):
 1. (P \<and>* Q) (ps, n) = (P (ps, 0::'b) \<and> Q (0::'a, n))
[PROOF STEP]
unfolding sep_conj_def
[PROOF STATE]
proof (prove)
using this:
P (?ps, ?n) \<Longrightarrow> ?n = (0::'b)
Q (?ps, ?n) \<Longrightarrow> ?ps = (0::'a)

goal (1 subgoal):
 1. (\<exists>x y. x ## y \<and> (ps, n) = x + y \<and> P x \<and> Q y) = (P (ps, 0::'b) \<and> Q (0::'a, n))
[PROOF STEP]
by force


[STATEMENT]
lemma from_bool_0:
  "(from_bool x = 0) = (\<not> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (from_bool x = 0) = (\<not> x)
[PROOF STEP]
by (simp add: from_bool_def split: bool.split)