[STATEMENT]
lemma ss_rewrite1:
  assumes "fst h \<in> carrier \<G>"
    and "a \<in> carrier \<G>"
    and e: "e < order \<G>"
    and "a \<otimes> fst h [^] e = \<^bold>g [^] z"
    and e': "e' < e"
    and "a \<otimes> fst h [^] e' = \<^bold>g [^] z'"
  shows "fst h = \<^bold>g [^] ((int z - int z') * inverse (e - e') (order \<G>) mod int (order \<G>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
have gcd: "gcd (e - e') (order \<G>) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (e - e') (order \<G>) = 1
[PROOF STEP]
using e e' prime_field prime_order
[PROOF STATE]
proof (prove)
using this:
e < order \<G>
e' < e
\<lbrakk>prime ?q; ?a < ?q; ?a \<noteq> 0\<rbrakk> \<Longrightarrow> coprime ?a ?q
prime (order \<G>)

goal (1 subgoal):
 1. gcd (e - e') (order \<G>) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd (e - e') (order \<G>) = 1

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
have "a = \<^bold>g [^] z \<otimes> inv (fst h [^] e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = \<^bold>g [^] z \<otimes> inv (fst h [^] e)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fst h \<in> carrier \<G>
a \<in> carrier \<G>
e < order \<G>
a \<otimes> fst h [^] e = \<^bold>g [^] z
e' < e
a \<otimes> fst h [^] e' = \<^bold>g [^] z'

goal (1 subgoal):
 1. a = \<^bold>g [^] z \<otimes> inv (fst h [^] e)
[PROOF STEP]
by (simp add: assms inv_solve_right)
[PROOF STATE]
proof (state)
this:
a = \<^bold>g [^] z \<otimes> inv (fst h [^] e)

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a = \<^bold>g [^] z \<otimes> inv (fst h [^] e)

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
have "a = \<^bold>g [^] z' \<otimes> inv (fst h [^] e')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = \<^bold>g [^] z' \<otimes> inv (fst h [^] e')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fst h \<in> carrier \<G>
a \<in> carrier \<G>
e < order \<G>
a \<otimes> fst h [^] e = \<^bold>g [^] z
e' < e
a \<otimes> fst h [^] e' = \<^bold>g [^] z'

goal (1 subgoal):
 1. a = \<^bold>g [^] z' \<otimes> inv (fst h [^] e')
[PROOF STEP]
by (simp add: assms inv_solve_right)
[PROOF STATE]
proof (state)
this:
a = \<^bold>g [^] z' \<otimes> inv (fst h [^] e')

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a = \<^bold>g [^] z \<otimes> inv (fst h [^] e)
a = \<^bold>g [^] z' \<otimes> inv (fst h [^] e')
[PROOF STEP]
have "\<^bold>g [^] z \<otimes> fst h [^] e' = \<^bold>g [^] z' \<otimes> fst h [^] e"
[PROOF STATE]
proof (prove)
using this:
a = \<^bold>g [^] z \<otimes> inv (fst h [^] e)
a = \<^bold>g [^] z' \<otimes> inv (fst h [^] e')

goal (1 subgoal):
 1. \<^bold>g [^] z \<otimes> fst h [^] e' = \<^bold>g [^] z' \<otimes> fst h [^] e
[PROOF STEP]
by (metis (no_types, lifting) assms cyclic_group_assoc cyclic_group_commute nat_pow_closed)
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] z \<otimes> fst h [^] e' = \<^bold>g [^] z' \<otimes> fst h [^] e

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] z \<otimes> fst h [^] e' = \<^bold>g [^] z' \<otimes> fst h [^] e

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
obtain t :: nat where t: "fst h = \<^bold>g [^] t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. fst h = \<^bold>g [^] t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms generatorE
[PROOF STATE]
proof (prove)
using this:
fst h \<in> carrier \<G>
a \<in> carrier \<G>
e < order \<G>
a \<otimes> fst h [^] e = \<^bold>g [^] z
e' < e
a \<otimes> fst h [^] e' = \<^bold>g [^] z'
\<lbrakk>?x \<in> carrier \<G>; \<And>n. ?x = \<^bold>g [^] n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>t. fst h = \<^bold>g [^] t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
fst h = \<^bold>g [^] t

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<^bold>g [^] z \<otimes> fst h [^] e' = \<^bold>g [^] z' \<otimes> fst h [^] e
fst h = \<^bold>g [^] t
[PROOF STEP]
have "\<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)"
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] z \<otimes> fst h [^] e' = \<^bold>g [^] z' \<otimes> fst h [^] e
fst h = \<^bold>g [^] t

goal (1 subgoal):
 1. \<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)
[PROOF STEP]
using nat_pow_pow
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] z \<otimes> fst h [^] e' = \<^bold>g [^] z' \<otimes> fst h [^] e
fst h = \<^bold>g [^] t
?x \<in> carrier \<G> \<Longrightarrow> (?x [^] ?n) [^] ?m = ?x [^] (?n * ?m)

goal (1 subgoal):
 1. \<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)
[PROOF STEP]
by (simp add: nat_pow_mult)
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[z + t * e' = z' + t * e] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)

goal (1 subgoal):
 1. [z + t * e' = z' + t * e] (mod order \<G>)
[PROOF STEP]
using group_eq_pow_eq_mod or_gt_0
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)
\<lbrakk>\<^bold>g [^] ?a = \<^bold>g [^] ?b; 0 < order \<G>\<rbrakk> \<Longrightarrow> [?a = ?b] (mod order \<G>)
0 < order \<G>

goal (1 subgoal):
 1. [z + t * e' = z' + t * e] (mod order \<G>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[z + t * e' = z' + t * e] (mod order \<G>)

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z + int t * int e' = int z' + int t * int e] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[z + t * e' = z' + t * e] (mod order \<G>)

goal (1 subgoal):
 1. [int z + int t * int e' = int z' + int t * int e] (mod int (order \<G>))
[PROOF STEP]
using cong_int_iff
[PROOF STATE]
proof (prove)
using this:
[z + t * e' = z' + t * e] (mod order \<G>)
[int ?m = int ?q] (mod int ?n) = [?m = ?q] (mod ?n)

goal (1 subgoal):
 1. [int z + int t * int e' = int z' + int t * int e] (mod int (order \<G>))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
[int z + int t * int e' = int z' + int t * int e] (mod int (order \<G>))

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z - int z' = int t * int e - int t * int e'] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z + int t * int e' = int z' + int t * int e] (mod int (order \<G>))

goal (1 subgoal):
 1. [int z - int z' = int t * int e - int t * int e'] (mod int (order \<G>))
[PROOF STEP]
by (smt cong_diff_iff_cong_0)
[PROOF STATE]
proof (state)
this:
[int z - int z' = int t * int e - int t * int e'] (mod int (order \<G>))

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z - int z' = int t * (int e - int e')] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * int e - int t * int e'] (mod int (order \<G>))

goal (1 subgoal):
 1. [int z - int z' = int t * (int e - int e')] (mod int (order \<G>))
[PROOF STEP]
by (simp add: right_diff_distrib)
[PROOF STATE]
proof (state)
this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z - int z' = int t * (e - e')] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))

goal (1 subgoal):
 1. [int z - int z' = int t * int (e - e')] (mod int (order \<G>))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))
fst h \<in> carrier \<G>
a \<in> carrier \<G>
e < order \<G>
a \<otimes> fst h [^] e = \<^bold>g [^] z
e' < e
a \<otimes> fst h [^] e' = \<^bold>g [^] z'

goal (1 subgoal):
 1. [int z - int z' = int t * int (e - e')] (mod int (order \<G>))
[PROOF STEP]
by (simp add: of_nat_diff)
[PROOF STATE]
proof (state)
this:
[int z - int z' = int t * int (e - e')] (mod int (order \<G>))

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[(int z - int z') * fst (bezw (e - e') (order \<G>))  = int t * (e - e') * fst (bezw (e - e') (order \<G>))] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * int (e - e')] (mod int (order \<G>))

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * int (e - e') * Number_Theory_Aux.inverse (e - e') (order \<G>)] (mod int (order \<G>))
[PROOF STEP]
using cong_scalar_right
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * int (e - e')] (mod int (order \<G>))
[?b = ?c] (mod ?a) \<Longrightarrow> [?b * ?d = ?c * ?d] (mod ?a)

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * int (e - e') * Number_Theory_Aux.inverse (e - e') (order \<G>)] (mod int (order \<G>))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * int (e - e') * Number_Theory_Aux.inverse (e - e') (order \<G>)] (mod int (order \<G>))

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[(int z - int z') * fst (bezw (e - e') (order \<G>))  = int t * ((e - e') * fst (bezw (e - e') (order \<G>)))] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * int (e - e') * Number_Theory_Aux.inverse (e - e') (order \<G>)] (mod int (order \<G>))

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * (int (e - e') * Number_Theory_Aux.inverse (e - e') (order \<G>))] (mod int (order \<G>))
[PROOF STEP]
by (simp add: more_arith_simps(11))
[PROOF STATE]
proof (state)
this:
[(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * (int (e - e') * Number_Theory_Aux.inverse (e - e') (order \<G>))] (mod int (order \<G>))

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[(int z - int z') * fst (bezw (e - e') (order \<G>))  = int t * 1] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * (int (e - e') * Number_Theory_Aux.inverse (e - e') (order \<G>))] (mod int (order \<G>))

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * 1] (mod int (order \<G>))
[PROOF STEP]
by (metis (no_types, opaque_lifting) cong_scalar_left cong_trans inverse gcd)
[PROOF STATE]
proof (state)
this:
[(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * 1] (mod int (order \<G>))

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[(int z - int z') * fst (bezw (e - e') (order \<G>)) mod order \<G>  = t] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) = int t * 1] (mod int (order \<G>))

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>) = int t] (mod int (order \<G>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>) = int t] (mod int (order \<G>))

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[nat ((int z - int z') * fst (bezw (e - e') (order \<G>)) mod order \<G>)  = t] (mod order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>) = int t] (mod int (order \<G>))

goal (1 subgoal):
 1. [nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = t] (mod order \<G>)
[PROOF STEP]
by (metis cong_def int_ops(9) mod_mod_trivial nat_int)
[PROOF STATE]
proof (state)
this:
[nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = t] (mod order \<G>)

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "\<^bold>g [^] (nat ((int z - int z') * fst (bezw (e - e') (order \<G>)) mod order \<G>))  = \<^bold>g [^] t"
[PROOF STATE]
proof (prove)
using this:
[nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = t] (mod order \<G>)

goal (1 subgoal):
 1. \<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t
[PROOF STEP]
using order_gt_0 order_gt_0_iff_finite pow_generator_eq_iff_cong
[PROOF STATE]
proof (prove)
using this:
[nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = t] (mod order \<G>)
0 < order \<G>
(0 < order \<G>) = finite (carrier \<G>)
finite (carrier \<G>) \<Longrightarrow> (\<^bold>g [^] ?x = \<^bold>g [^] ?y) = [?x = ?y] (mod order \<G>)

goal (1 subgoal):
 1. \<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
using t
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t
fst h = \<^bold>g [^] t

goal (1 subgoal):
 1. fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fst h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem linear :
  assumes lLength : "length L > var"
  assumes "C \<noteq> 0"
  assumes "var \<notin> vars b"
  assumes "var \<notin> vars c"
  assumes "insertion (nth_default 0 (list_update L var (B/C))) b = (B::real)"
  assumes "insertion (nth_default 0 (list_update L var (B/C))) c = (C::real)"
  shows "aEval A (list_update L var (B/C))  = (aEval (linear_substitution var b c A) (list_update L var v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
[PROOF STEP]
apply(cases A)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x1. A = Less x1 \<Longrightarrow> aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
 2. \<And>x2. A = Eq x2 \<Longrightarrow> aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
 3. \<And>x3. A = Leq x3 \<Longrightarrow> aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
 4. \<And>x4. A = Neq x4 \<Longrightarrow> aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
[PROOF STEP]
using linear_less[OF assms(1-6)] linear_eq[OF assms(1-6)] linear_leq[OF assms(1-6)] linear_neq[OF assms(1-6)]
[PROOF STATE]
proof (prove)
using this:
aEval (Less ?p) (L[var := B / C]) = aEval (linear_substitution var b c (Less ?p)) (L[var := ?v])
aEval (Eq ?p) (L[var := B / C]) = aEval (linear_substitution var b c (Eq ?p)) (L[var := ?v])
aEval (Leq ?p) (L[var := B / C]) = aEval (linear_substitution var b c (Leq ?p)) (L[var := ?v])
aEval (Neq ?p) (L[var := B / C]) = aEval (linear_substitution var b c (Neq ?p)) (L[var := ?v])

goal (4 subgoals):
 1. \<And>x1. A = Less x1 \<Longrightarrow> aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
 2. \<And>x2. A = Eq x2 \<Longrightarrow> aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
 3. \<And>x3. A = Leq x3 \<Longrightarrow> aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
 4. \<And>x4. A = Neq x4 \<Longrightarrow> aEval A (L[var := B / C]) = aEval (linear_substitution var b c A) (L[var := v])
[PROOF STEP]
by auto


[STATEMENT]
lemma le_log_iff:
  fixes b x y :: real
  assumes "1 < b" "x > 0"
  shows "y \<le> log b x \<longleftrightarrow> b powr y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<le> log b x) = (b powr y \<le> x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < b
0 < x

goal (1 subgoal):
 1. (y \<le> log b x) = (b powr y \<le> x)
[PROOF STEP]
by (metis less_irrefl less_trans powr_le_cancel_iff powr_log_cancel zero_less_one)


[STATEMENT]
lemma odiff_succ: "y \<unlhd> x \<Longrightarrow> odiff (succ x) y = succ (odiff x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<unlhd> x \<Longrightarrow> odiff (ZFC_in_HOL.succ x) y = ZFC_in_HOL.succ (odiff x y)
[PROOF STEP]
unfolding odiff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<unlhd> x \<Longrightarrow> (THE z. y + z = ZFC_in_HOL.succ x \<or> z = 0 \<and> \<not> y \<unlhd> ZFC_in_HOL.succ x) = ZFC_in_HOL.succ (THE z. y + z = x \<or> z = 0 \<and> \<not> y \<unlhd> x)
[PROOF STEP]
by (metis add_right_cancel odiff_def plus_V_succ_right vle_def vle_imp_odiff_eq)


[STATEMENT]
lemma translate_inj_on:
  fixes A :: "'a::ab_group_add set"
  shows "inj_on (\<lambda>x. a + x) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((+) a) A
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>A. a + x = a + y \<longrightarrow> x = y
[PROOF STEP]
by auto


[STATEMENT]
lemma lbE:
  assumes "lb T A j"
  shows "\<forall>x \<in> {1..m}. \<forall>y \<in> {1..m}. x \<noteq> y \<longrightarrow> A x \<inter> A y = {}"
        "(\<Union>x \<in> {1..m}. A x) = {1..j}"
        "\<forall>x \<in> {1..m}. (\<Sum>y \<in> A x. t y) = T x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{1..m}. \<forall>y\<in>{1..m}. x \<noteq> y \<longrightarrow> A x \<inter> A y = {} &&& \<Union> (A ` {1..m}) = {1..j} &&& \<forall>x\<in>{1..m}. sum t (A x) = T x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lb T A j

goal (1 subgoal):
 1. \<forall>x\<in>{1..m}. \<forall>y\<in>{1..m}. x \<noteq> y \<longrightarrow> A x \<inter> A y = {} &&& \<Union> (A ` {1..m}) = {1..j} &&& \<forall>x\<in>{1..m}. sum t (A x) = T x
[PROOF STEP]
unfolding lb_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>x\<in>{1..m}. \<forall>y\<in>{1..m}. x \<noteq> y \<longrightarrow> A x \<inter> A y = {}) \<and> \<Union> (A ` {1..m}) = {1..j} \<and> (\<forall>x\<in>{1..m}. sum t (A x) = T x)

goal (1 subgoal):
 1. \<forall>x\<in>{1..m}. \<forall>y\<in>{1..m}. x \<noteq> y \<longrightarrow> A x \<inter> A y = {} &&& \<Union> (A ` {1..m}) = {1..j} &&& \<forall>x\<in>{1..m}. sum t (A x) = T x
[PROOF STEP]
by blast+


[STATEMENT]
lemma prod_zero_iff': "finite A \<Longrightarrow> prod f A = 0 \<longleftrightarrow> (\<exists>x\<in>A. f x = 0)"
  for f :: "'a \<Rightarrow> 'b :: {comm_semiring_1, semiring_no_zero_divisors}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> (prod f A = (0::'b)) = (\<exists>x\<in>A. f x = (0::'b))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) auto


[STATEMENT]
lemma (in cof_vec_space) gram_schmidt0_result:
  fixes ws
  defines "us' \<equiv> gram_schmidt0 n ws"
  assumes ws: "set ws \<subseteq> carrier_vec n"
  shows "set us' \<subseteq> carrier_vec n"        (is ?thesis1)
    and "distinct us'"                    (is ?thesis2)
    and "corthogonal us'"                 (is ?thesis3)
    and "span (set ws) = span (set us')"  (is ?thesis4)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set us' \<subseteq> carrier_vec n &&& distinct us') &&& corthogonal us' &&& local.span (set ws) = local.span (set us')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. set us' \<subseteq> carrier_vec n
 2. distinct us'
 3. corthogonal us'
 4. local.span (set ws) = local.span (set us')
[PROOF STEP]
have carrier_empty: "set [] \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [] \<subseteq> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set [] \<subseteq> carrier_vec n

goal (4 subgoals):
 1. set us' \<subseteq> carrier_vec n
 2. distinct us'
 3. corthogonal us'
 4. local.span (set ws) = local.span (set us')
[PROOF STEP]
have distinct_empty: "distinct []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct []

goal (4 subgoals):
 1. set us' \<subseteq> carrier_vec n
 2. distinct us'
 3. corthogonal us'
 4. local.span (set ws) = local.span (set us')
[PROOF STEP]
have indep_empty: "lin_indpt (set [])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (set [])
[PROOF STEP]
using basis_def subset_li_is_li unit_vecs_basis
[PROOF STATE]
proof (prove)
using this:
basis ?A = (lin_indpt ?A \<and> local.span ?A = carrier_vec n \<and> ?A \<subseteq> carrier_vec n)
\<lbrakk>lin_indpt ?A; ?B \<subseteq> ?A\<rbrakk> \<Longrightarrow> lin_indpt ?B
basis (set (unit_vecs n))

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

goal (4 subgoals):
 1. set us' \<subseteq> carrier_vec n
 2. distinct us'
 3. corthogonal us'
 4. local.span (set ws) = local.span (set us')
[PROOF STEP]
have ortho_empty: "corthogonal []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
corthogonal []

goal (4 subgoals):
 1. set us' \<subseteq> carrier_vec n
 2. distinct us'
 3. corthogonal us'
 4. local.span (set ws) = local.span (set us')
[PROOF STEP]
note gram_schmidt_sub0_result' = gram_schmidt_sub0_result
    [OF us'_def[symmetric, THEN meta_eq_to_obj_eq, unfolded gram_schmidt0_def] ws
      carrier_empty distinct_empty indep_empty ortho_empty]
[PROOF STATE]
proof (state)
this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set ([] @ ws)) = local.span (set us')

goal (4 subgoals):
 1. set us' \<subseteq> carrier_vec n
 2. distinct us'
 3. corthogonal us'
 4. local.span (set ws) = local.span (set us')
[PROOF STEP]
thus ?thesis1 ?thesis2 ?thesis3 ?thesis4
[PROOF STATE]
proof (prove)
using this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set ([] @ ws)) = local.span (set us')

goal (1 subgoal):
 1. (set us' \<subseteq> carrier_vec n &&& distinct us') &&& corthogonal us' &&& local.span (set ws) = local.span (set us')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set us' \<subseteq> carrier_vec n
distinct us'
corthogonal us'
local.span (set ws) = local.span (set us')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filterlim_at_infinity_imp_not_convergent:
  assumes "filterlim f at_infinity sequentially"
  shows "\<not> convergent f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> convergent f
[PROOF STEP]
by (rule notI, rule not_tendsto_and_filterlim_at_infinity[OF _ _ assms])
     (simp_all add: convergent_LIMSEQ_iff)


[STATEMENT]
lemma square_part_ge_Suc_0 [simp]: "n > 0 \<Longrightarrow> square_part n \<ge> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> Suc 0 \<le> square_part n
[PROOF STEP]
using square_part_pos[of n]
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> 0 < square_part n

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> Suc 0 \<le> square_part n
[PROOF STEP]
by presburger


[STATEMENT]
lemma zero_less_of_rat_iff [simp]: "0 < (of_rat r :: 'a::linordered_field) \<longleftrightarrow> 0 < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) < of_rat r) = (0 < r)
[PROOF STEP]
using of_rat_less [of 0 r, where 'a = 'a]
[PROOF STATE]
proof (prove)
using this:
(of_rat 0 < of_rat r) = (0 < r)

goal (1 subgoal):
 1. ((0::'a) < of_rat r) = (0 < r)
[PROOF STEP]
by simp


[STATEMENT]
lemma prodinf_zero[simp]: "prodinf (\<lambda>n. 1::'a::real_normed_field) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>n. (1::'a)) = (1::'a)
[PROOF STEP]
using has_prod_unique
[PROOF STATE]
proof (prove)
using this:
?f has_prod ?s \<Longrightarrow> ?s = prodinf ?f

goal (1 subgoal):
 1. (\<Prod>n. (1::'a)) = (1::'a)
[PROOF STEP]
by force


[STATEMENT]
theorem deriv_zeta_sums:
  assumes s: "Re s > 1"
  shows "(\<lambda>n. -of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
from s
[PROOF STATE]
proof (chain)
picking this:
1 < Re s
[PROOF STEP]
have "fds_converges (fds_deriv fds_zeta) s"
[PROOF STATE]
proof (prove)
using this:
1 < Re s

goal (1 subgoal):
 1. fds_converges (fds_deriv fds_zeta) s
[PROOF STEP]
by (intro fds_converges_deriv) simp_all
[PROOF STATE]
proof (state)
this:
fds_converges (fds_deriv fds_zeta) s

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
with s
[PROOF STATE]
proof (chain)
picking this:
1 < Re s
fds_converges (fds_deriv fds_zeta) s
[PROOF STEP]
have "(\<lambda>n. -of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums
                  deriv (eval_fds fds_zeta) s"
[PROOF STATE]
proof (prove)
using this:
1 < Re s
fds_converges (fds_deriv fds_zeta) s

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv (eval_fds fds_zeta) s
[PROOF STEP]
unfolding fds_converges_altdef
[PROOF STATE]
proof (prove)
using this:
1 < Re s
(\<lambda>n. fds_nth (fds_deriv fds_zeta) (Suc n) / nat_power (Suc n) s) sums eval_fds (fds_deriv fds_zeta) s

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv (eval_fds fds_zeta) s
[PROOF STEP]
by (simp add: fds_nth_deriv scaleR_conv_of_real eval_fds_deriv eval_fds_zeta)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv (eval_fds fds_zeta) s

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv (eval_fds fds_zeta) s

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
from s
[PROOF STATE]
proof (chain)
picking this:
1 < Re s
[PROOF STEP]
have "eventually (\<lambda>s. s \<in> {s. Re s > 1}) (nhds s)"
[PROOF STATE]
proof (prove)
using this:
1 < Re s

goal (1 subgoal):
 1. \<forall>\<^sub>F s in nhds s. s \<in> {s. 1 < Re s}
[PROOF STEP]
by (intro eventually_nhds_in_open) (auto simp: open_halfspace_Re_gt)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F s in nhds s. s \<in> {s. 1 < Re s}

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
hence "eventually (\<lambda>s. eval_fds fds_zeta s = zeta s) (nhds s)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F s in nhds s. s \<in> {s. 1 < Re s}

goal (1 subgoal):
 1. \<forall>\<^sub>F s in nhds s. eval_fds fds_zeta s = zeta s
[PROOF STEP]
by eventually_elim (auto simp: eval_fds_zeta)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F s in nhds s. eval_fds fds_zeta s = zeta s

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
hence "deriv (eval_fds fds_zeta) s = deriv zeta s"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F s in nhds s. eval_fds fds_zeta s = zeta s

goal (1 subgoal):
 1. deriv (eval_fds fds_zeta) s = deriv zeta s
[PROOF STEP]
by (intro deriv_cong_ev refl)
[PROOF STATE]
proof (state)
this:
deriv (eval_fds fds_zeta) s = deriv zeta s

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s

goal (1 subgoal):
 1. (\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - complex_of_real (ln (real (Suc n))) / of_nat (Suc n) powr s) sums deriv zeta s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Center_Selection:
"VARS (C :: ('a :: metric_space) set) (s :: ('a :: metric_space))
  {k \<le> card S}
  C := {some S};
  WHILE card C < k INV {invar C} DO
    C := C \<union> {furthest_from C}
  OD
  {card C = k \<and> (\<forall>C'. card C' > 0 \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {k \<le> card S}
C := {SOME s. s \<in> S}; WHILE card C < k INV {invar C}  VAR {0}
DO C := C \<union> {furthest_from C} OD
{card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')}
[PROOF STEP]
proof (vcg, goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>C s. k \<le> card S \<Longrightarrow> invar {SOME s. s \<in> S}
 2. \<And>C s. invar C \<and> card C < k \<Longrightarrow> invar (C \<union> {furthest_from C})
 3. \<And>C s. invar C \<and> \<not> card C < k \<Longrightarrow> card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
case (1 C s)
[PROOF STATE]
proof (state)
this:
k \<le> card S

goal (3 subgoals):
 1. \<And>C s. k \<le> card S \<Longrightarrow> invar {SOME s. s \<in> S}
 2. \<And>C s. invar C \<and> card C < k \<Longrightarrow> invar (C \<union> {furthest_from C})
 3. \<And>C s. invar C \<and> \<not> card C < k \<Longrightarrow> card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar {SOME s. s \<in> S}
[PROOF STEP]
using invar_init
[PROOF STATE]
proof (prove)
using this:
invar {SOME s. s \<in> S}

goal (1 subgoal):
 1. invar {SOME s. s \<in> S}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
invar {SOME s. s \<in> S}

goal (2 subgoals):
 1. \<And>C s. invar C \<and> card C < k \<Longrightarrow> invar (C \<union> {furthest_from C})
 2. \<And>C s. invar C \<and> \<not> card C < k \<Longrightarrow> card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C s. invar C \<and> card C < k \<Longrightarrow> invar (C \<union> {furthest_from C})
 2. \<And>C s. invar C \<and> \<not> card C < k \<Longrightarrow> card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
case (2 C s)
[PROOF STATE]
proof (state)
this:
invar C \<and> card C < k

goal (2 subgoals):
 1. \<And>C s. invar C \<and> card C < k \<Longrightarrow> invar (C \<union> {furthest_from C})
 2. \<And>C s. invar C \<and> \<not> card C < k \<Longrightarrow> card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
invar C \<and> card C < k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
invar C \<and> card C < k

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
using invar_step
[PROOF STATE]
proof (prove)
using this:
invar C \<and> card C < k
\<lbrakk>invar ?C; card ?C < k\<rbrakk> \<Longrightarrow> invar (?C \<union> {furthest_from ?C})

goal (1 subgoal):
 1. invar (C \<union> {furthest_from C})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
invar (C \<union> {furthest_from C})

goal (1 subgoal):
 1. \<And>C s. invar C \<and> \<not> card C < k \<Longrightarrow> card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C s. invar C \<and> \<not> card C < k \<Longrightarrow> card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
case (3 C s)
[PROOF STATE]
proof (state)
this:
invar C \<and> \<not> card C < k

goal (1 subgoal):
 1. \<And>C s. invar C \<and> \<not> card C < k \<Longrightarrow> card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
invar C \<and> \<not> card C < k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
invar C \<and> \<not> card C < k

goal (1 subgoal):
 1. card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
using invar_last
[PROOF STATE]
proof (prove)
using this:
invar C \<and> \<not> card C < k
\<lbrakk>invar ?C; \<not> card ?C < k\<rbrakk> \<Longrightarrow> card ?C = k
\<lbrakk>invar ?C; \<not> card ?C < k\<rbrakk> \<Longrightarrow> 0 < card ?C' \<and> card ?C' \<le> k \<longrightarrow> radius ?C \<le> 2 * radius ?C'

goal (1 subgoal):
 1. card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card C = k \<and> (\<forall>C'. 0 < card C' \<and> card C' \<le> k \<longrightarrow> radius C \<le> 2 * radius C')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_vars_imp_finite_adapt_a :
  assumes "finite (Aexp.vars e)"
  shows   "finite (Aexp.vars (adapt_aexp e s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Aexp.vars (adapt_aexp e s))
[PROOF STEP]
unfolding adapt_aexp_vars
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>v. symvar v s) ` Aexp.vars e)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (Aexp.vars e)

goal (1 subgoal):
 1. finite ((\<lambda>v. symvar v s) ` Aexp.vars e)
[PROOF STEP]
by auto


[STATEMENT]
lemma eval_subst_trm: "eval_trm e (subst i t u) =
   eval_trm (finfun_update e i (eval_trm e t)) u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_trm e (subst i t u) = eval_trm (finfun_update e i (eval_trm e t)) u
[PROOF STEP]
by (induct u rule: trm.induct) (auto)


[STATEMENT]
lemma fdisjnt_union_right: "fdisjnt M A \<Longrightarrow> fdisjnt M B \<Longrightarrow> fdisjnt M (A |\<union>| B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fdisjnt M A; fdisjnt M B\<rbrakk> \<Longrightarrow> fdisjnt M (A |\<union>| B)
[PROOF STEP]
unfolding fdisjnt_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M |\<inter>| A = {||}; M |\<inter>| B = {||}\<rbrakk> \<Longrightarrow> M |\<inter>| (A |\<union>| B) = {||}
[PROOF STEP]
by auto


[STATEMENT]
lemma DERIV_cmult_right:
  "(f has_field_derivative D) (at x within s) \<Longrightarrow>
    ((\<lambda>x. f x * c) has_field_derivative D * c) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative D) (at x within s) \<Longrightarrow> ((\<lambda>x. f x * c) has_field_derivative D * c) (at x within s)
[PROOF STEP]
using DERIV_cmult
[PROOF STATE]
proof (prove)
using this:
(?f has_field_derivative ?D) (at ?x within ?s) \<Longrightarrow> ((\<lambda>x. ?c * ?f x) has_field_derivative ?c * ?D) (at ?x within ?s)

goal (1 subgoal):
 1. (f has_field_derivative D) (at x within s) \<Longrightarrow> ((\<lambda>x. f x * c) has_field_derivative D * c) (at x within s)
[PROOF STEP]
by (auto simp add: ac_simps)


[STATEMENT]
lemma affine_hull_Diff:
  fixes S:: "'a::real_normed_vector set"
  assumes ope: "openin (top_of_set (affine hull S)) S" and "finite F" "F \<subset> S"
  shows "affine hull (S - F) = affine hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull (S - F) = affine hull S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine hull (S - F) = affine hull S
[PROOF STEP]
have clo: "closedin (top_of_set S) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set S) F
[PROOF STEP]
using assms finite_imp_closedin
[PROOF STATE]
proof (prove)
using this:
openin (top_of_set (affine hull S)) S
finite F
F \<subset> S
\<lbrakk>finite ?S; ?S \<subseteq> ?T\<rbrakk> \<Longrightarrow> closedin (top_of_set ?T) ?S

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

goal (1 subgoal):
 1. affine hull (S - F) = affine hull S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
closedin (top_of_set S) F

goal (1 subgoal):
 1. affine hull (S - F) = affine hull S
[PROOF STEP]
have "S - F \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - F \<noteq> {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
openin (top_of_set (affine hull S)) S
finite F
F \<subset> S

goal (1 subgoal):
 1. S - F \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S - F \<noteq> {}

goal (1 subgoal):
 1. affine hull (S - F) = affine hull S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
closedin (top_of_set S) F
S - F \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closedin (top_of_set S) F
S - F \<noteq> {}

goal (1 subgoal):
 1. affine hull (S - F) = affine hull S
[PROOF STEP]
by (metis ope closedin_def topspace_euclidean_subtopology affine_hull_openin openin_trans)
[PROOF STATE]
proof (state)
this:
affine hull (S - F) = affine hull S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inext_nth_Max_fix: "
  \<lbrakk> finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> b \<rbrakk> \<Longrightarrow> I \<rightarrow> b = Max I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> b\<rbrakk> \<Longrightarrow> I \<rightarrow> b = Max I
[PROOF STEP]
apply (induct b)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> 0\<rbrakk> \<Longrightarrow> I \<rightarrow> 0 = Max I
 2. \<And>b. \<lbrakk>\<lbrakk>finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> b\<rbrakk> \<Longrightarrow> I \<rightarrow> b = Max I; finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> Suc b\<rbrakk> \<Longrightarrow> I \<rightarrow> Suc b = Max I
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>\<lbrakk>finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> b\<rbrakk> \<Longrightarrow> I \<rightarrow> b = Max I; finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> Suc b\<rbrakk> \<Longrightarrow> I \<rightarrow> Suc b = Max I
[PROOF STEP]
apply (drule le_Suc_eq[THEN iffD1], erule disjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. \<lbrakk>\<lbrakk>finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> b\<rbrakk> \<Longrightarrow> I \<rightarrow> b = Max I; finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> b\<rbrakk> \<Longrightarrow> I \<rightarrow> Suc b = Max I
 2. \<And>b. \<lbrakk>\<lbrakk>finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> b\<rbrakk> \<Longrightarrow> I \<rightarrow> b = Max I; finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a = Suc b\<rbrakk> \<Longrightarrow> I \<rightarrow> Suc b = Max I
[PROOF STEP]
apply (simp add: inext_Max)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>\<lbrakk>finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a \<le> b\<rbrakk> \<Longrightarrow> I \<rightarrow> b = Max I; finite I; I \<noteq> {}; I \<rightarrow> a = Max I; a = Suc b\<rbrakk> \<Longrightarrow> I \<rightarrow> Suc b = Max I
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_integral_cmul_iff':
  assumes "c \<noteq> 0"
  shows   "((\<lambda>x. c *\<^sub>R f x) has_integral I) A \<longleftrightarrow> (f has_integral I /\<^sub>R c) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c *\<^sub>R f x) has_integral I) A = (f has_integral I /\<^sub>R c) A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>x. c *\<^sub>R f x) has_integral I) A = (f has_integral I /\<^sub>R c) A
[PROOF STEP]
by (metis divideR_right has_integral_cmul_iff)


[STATEMENT]
lemma winding_number_lt_half:
  assumes "valid_path \<gamma>" "a \<bullet> z \<le> b" "path_image \<gamma> \<subseteq> {w. a \<bullet> w > b}"
    shows "\<bar>Re (winding_number \<gamma> z)\<bar> < 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Re (winding_number \<gamma> z)\<bar> < 1 / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>Re (winding_number \<gamma> z)\<bar> < 1 / 2
[PROOF STEP]
have "z \<notin> path_image \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> path_image \<gamma>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
a \<bullet> z \<le> b
path_image \<gamma> \<subseteq> {w. b < a \<bullet> w}

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

goal (1 subgoal):
 1. \<bar>Re (winding_number \<gamma> z)\<bar> < 1 / 2
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
valid_path \<gamma>
a \<bullet> z \<le> b
path_image \<gamma> \<subseteq> {w. b < a \<bullet> w}
z \<notin> path_image \<gamma>
[PROOF STEP]
have "Re (winding_number \<gamma> z) < 0 \<Longrightarrow> - Re (winding_number \<gamma> z) < 1/2"
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
a \<bullet> z \<le> b
path_image \<gamma> \<subseteq> {w. b < a \<bullet> w}
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) < 0 \<Longrightarrow> - Re (winding_number \<gamma> z) < 1 / 2
[PROOF STEP]
by (metis complex_inner_1_right winding_number_lt_half_lemma [OF valid_path_imp_reverse, of \<gamma> z a b]
        winding_number_reversepath valid_path_imp_path inner_minus_left path_image_reversepath)
[PROOF STATE]
proof (state)
this:
Re (winding_number \<gamma> z) < 0 \<Longrightarrow> - Re (winding_number \<gamma> z) < 1 / 2

goal (1 subgoal):
 1. \<bar>Re (winding_number \<gamma> z)\<bar> < 1 / 2
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
valid_path \<gamma>
a \<bullet> z \<le> b
path_image \<gamma> \<subseteq> {w. b < a \<bullet> w}
Re (winding_number \<gamma> z) < 0 \<Longrightarrow> - Re (winding_number \<gamma> z) < 1 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
a \<bullet> z \<le> b
path_image \<gamma> \<subseteq> {w. b < a \<bullet> w}
Re (winding_number \<gamma> z) < 0 \<Longrightarrow> - Re (winding_number \<gamma> z) < 1 / 2

goal (1 subgoal):
 1. \<bar>Re (winding_number \<gamma> z)\<bar> < 1 / 2
[PROOF STEP]
using \<open>z \<notin> path_image \<gamma>\<close> winding_number_lt_half_lemma
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
a \<bullet> z \<le> b
path_image \<gamma> \<subseteq> {w. b < a \<bullet> w}
Re (winding_number \<gamma> z) < 0 \<Longrightarrow> - Re (winding_number \<gamma> z) < 1 / 2
z \<notin> path_image \<gamma>
\<lbrakk>valid_path ?\<gamma>; ?z \<notin> path_image ?\<gamma>; ?a \<bullet> ?z \<le> ?b; path_image ?\<gamma> \<subseteq> {w. ?b < ?a \<bullet> w}\<rbrakk> \<Longrightarrow> Re (winding_number ?\<gamma> ?z) < 1 / 2

goal (1 subgoal):
 1. \<bar>Re (winding_number \<gamma> z)\<bar> < 1 / 2
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<bar>Re (winding_number \<gamma> z)\<bar> < 1 / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccpo_lfp_simp: "\<And>f. mono f \<Longrightarrow> ccpo.fixp Sup (\<le>) f = lfp f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. mono f \<Longrightarrow> ccpo.fixp Sup (\<le>) f = lfp f
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f. mono f \<Longrightarrow> ccpo.fixp Sup (\<le>) f \<le> lfp f
 2. \<And>f. mono f \<Longrightarrow> lfp f \<le> ccpo.fixp Sup (\<le>) f
[PROOF STEP]
defer
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f. mono f \<Longrightarrow> lfp f \<le> ccpo.fixp Sup (\<le>) f
 2. \<And>f. mono f \<Longrightarrow> ccpo.fixp Sup (\<le>) f \<le> lfp f
[PROOF STEP]
apply (rule lfp_lowerbound)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f. mono f \<Longrightarrow> f (ccpo.fixp Sup (\<le>) f) \<le> ccpo.fixp Sup (\<le>) f
 2. \<And>f. mono f \<Longrightarrow> ccpo.fixp Sup (\<le>) f \<le> lfp f
[PROOF STEP]
apply (drule ccpo.fixp_unfold[OF is_ccpo , symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f. f (ccpo.fixp Sup (\<le>) f) = ccpo.fixp Sup (\<le>) f \<Longrightarrow> f (ccpo.fixp Sup (\<le>) f) \<le> ccpo.fixp Sup (\<le>) f
 2. \<And>f. mono f \<Longrightarrow> ccpo.fixp Sup (\<le>) f \<le> lfp f
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. mono f \<Longrightarrow> ccpo.fixp Sup (\<le>) f \<le> lfp f
[PROOF STEP]
apply (rule ccpo.fixp_lowerbound[OF is_ccpo], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. mono f \<Longrightarrow> f (lfp f) \<le> lfp f
[PROOF STEP]
apply (simp add: lfp_unfold[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem insert_corr:
  assumes "invar_vebt t n " and "x < 2^n "
  shows " set_vebt' t \<union> {x} = set_vebt' (vebt_insert t x) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_vebt' t \<union> {x} = set_vebt' (vebt_insert t x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set_vebt' t \<union> {x} \<subseteq> set_vebt' (vebt_insert t x)
 2. set_vebt' (vebt_insert t x) \<subseteq> set_vebt' t \<union> {x}
[PROOF STEP]
show "set_vebt' t \<union> {x} \<subseteq> set_vebt' (vebt_insert t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_vebt' t \<union> {x} \<subseteq> set_vebt' (vebt_insert t x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set_vebt' t \<union> {x} \<Longrightarrow> xa \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set_vebt' t \<union> {x} \<Longrightarrow> xa \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
assume "y \<in> set_vebt' t \<union> {x}"
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' t \<union> {x}

goal (1 subgoal):
 1. \<And>xa. xa \<in> set_vebt' t \<union> {x} \<Longrightarrow> xa \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
show "y \<in>set_vebt' (vebt_insert t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
proof(cases "x=y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
 2. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = y

goal (2 subgoals):
 1. x = y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
 2. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = y

goal (1 subgoal):
 1. y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
by (metis (full_types) assms(1) assms(2) both_member_options_equiv_member mem_Collect_eq set_vebt'_def valid_insert_both_member_options_add valid_pres_insert)
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' (vebt_insert t x)

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
have "vebt_member t y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vebt_member t y
[PROOF STEP]
using False \<open>y \<in> set_vebt' t \<union> {x}\<close> set_vebt'_def
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
y \<in> set_vebt' t \<union> {x}
set_vebt' ?t = {x. vebt_member ?t x}

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

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
hence "vebt_member (vebt_insert t x) y"
[PROOF STATE]
proof (prove)
using this:
vebt_member t y

goal (1 subgoal):
 1. vebt_member (vebt_insert t x) y
[PROOF STEP]
by (meson assms(1) assms(2) both_member_options_equiv_member member_bound valid_insert_both_member_options_pres valid_pres_insert)
[PROOF STATE]
proof (state)
this:
vebt_member (vebt_insert t x) y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vebt_member (vebt_insert t x) y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vebt_member (vebt_insert t x) y

goal (1 subgoal):
 1. y \<in> set_vebt' (vebt_insert t x)
[PROOF STEP]
by (simp add: set_vebt'_def)
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' (vebt_insert t x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' (vebt_insert t x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_vebt' t \<union> {x} \<subseteq> set_vebt' (vebt_insert t x)

goal (1 subgoal):
 1. set_vebt' (vebt_insert t x) \<subseteq> set_vebt' t \<union> {x}
[PROOF STEP]
show " set_vebt' (vebt_insert t x) \<subseteq> set_vebt' t \<union> {x} "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_vebt' (vebt_insert t x) \<subseteq> set_vebt' t \<union> {x}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set_vebt' (vebt_insert t x) \<Longrightarrow> xa \<in> set_vebt' t \<union> {x}
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set_vebt' (vebt_insert t x) \<Longrightarrow> xa \<in> set_vebt' t \<union> {x}
[PROOF STEP]
assume "y \<in> set_vebt' (vebt_insert t x)"
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' (vebt_insert t x)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set_vebt' (vebt_insert t x) \<Longrightarrow> xa \<in> set_vebt' t \<union> {x}
[PROOF STEP]
show "y \<in>set_vebt' t \<union> {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
proof(cases "x=y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
 2. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = y

goal (2 subgoals):
 1. x = y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
 2. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = y

goal (1 subgoal):
 1. y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' t \<union> {x}

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
hence "vebt_member t y \<or> x=y"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y

goal (1 subgoal):
 1. vebt_member t y \<or> x = y
[PROOF STEP]
using post_member_pre_member
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
\<lbrakk>invar_vebt ?t ?n; ?x < 2 ^ ?n; ?y < 2 ^ ?n; vebt_member (vebt_insert ?t ?x) ?y\<rbrakk> \<Longrightarrow> vebt_member ?t ?y \<or> ?x = ?y

goal (1 subgoal):
 1. vebt_member t y \<or> x = y
[PROOF STEP]
using \<open>y \<in> set_vebt' (vebt_insert t x)\<close> assms(1) assms(2) set_vebt'_def member_bound valid_pres_insert
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
\<lbrakk>invar_vebt ?t ?n; ?x < 2 ^ ?n; ?y < 2 ^ ?n; vebt_member (vebt_insert ?t ?x) ?y\<rbrakk> \<Longrightarrow> vebt_member ?t ?y \<or> ?x = ?y
y \<in> set_vebt' (vebt_insert t x)
invar_vebt t n
x < 2 ^ n
set_vebt' ?t = {x. vebt_member ?t x}
\<lbrakk>vebt_member ?tree ?x; invar_vebt ?tree ?n\<rbrakk> \<Longrightarrow> ?x < 2 ^ ?n
\<lbrakk>invar_vebt ?t ?n; ?x < 2 ^ ?n\<rbrakk> \<Longrightarrow> invar_vebt (vebt_insert ?t ?x) ?n

goal (1 subgoal):
 1. vebt_member t y \<or> x = y
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
vebt_member t y \<or> x = y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
hence "vebt_member t y"
[PROOF STATE]
proof (prove)
using this:
vebt_member t y \<or> x = y

goal (1 subgoal):
 1. vebt_member t y
[PROOF STEP]
by (simp add: False)
[PROOF STATE]
proof (state)
this:
vebt_member t y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
hence "y \<in> set_vebt' t"
[PROOF STATE]
proof (prove)
using this:
vebt_member t y

goal (1 subgoal):
 1. y \<in> set_vebt' t
[PROOF STEP]
by (simp add: set_vebt'_def)
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' t

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> set_vebt' t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<in> set_vebt' t

goal (1 subgoal):
 1. y \<in> set_vebt' t \<union> {x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' t \<union> {x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> set_vebt' t \<union> {x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_vebt' (vebt_insert t x) \<subseteq> set_vebt' t \<union> {x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ceuclidean_space) ceuclidean_representation_sum_fun:
  "(\<lambda>x. \<Sum>b\<in>CBasis. cinner b (f x) *\<^sub>C b) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<Sum>b\<in>CBasis. (b \<bullet>\<^sub>C f x) *\<^sub>C b) = f
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<Sum>b\<in>CBasis. (b \<bullet>\<^sub>C f x) *\<^sub>C b) = f x
[PROOF STEP]
apply (simp add: ceuclidean_representation_sum)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<forall>b\<in>CBasis. b \<bullet>\<^sub>C f x = cnj (f x \<bullet>\<^sub>C b)
[PROOF STEP]
by (meson local.cinner_commute)


[STATEMENT]
lemma set_nodes_nodes: "set (inorder t) = set_nodes t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (inorder t) = set_nodes t
[PROOF STEP]
apply(induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. set (inorder (Leaf x)) = set_nodes (Leaf x)
 2. \<And>x1a t. \<lbrakk>\<And>x1aa x1aaa. \<lbrakk>x1aa \<in> set x1a; x1aaa \<in> Basic_BNFs.fsts x1aa\<rbrakk> \<Longrightarrow> set (inorder x1aaa) = set_nodes x1aaa; set (inorder t) = set_nodes t\<rbrakk> \<Longrightarrow> set (inorder (Node x1a t)) = set_nodes (Node x1a t)
[PROOF STEP]
apply(auto simp add: rev_image_eqI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tfft_4: assumes dx: "dim_vec x = 4"
  and be: "x $ 0 = True \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = True"
  shows "ceros_of_boolean_input x = {1,2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input x = {1, 2}
[PROOF STEP]
using dx be
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = True

goal (1 subgoal):
 1. ceros_of_boolean_input x = {1, 2}
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = True

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {1, 2}
[PROOF STEP]
using less_4_cases
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = True
?n < 4 \<Longrightarrow> ?n = 0 \<or> ?n = 1 \<or> ?n = 2 \<or> ?n = 3

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {1, 2}
[PROOF STEP]
by auto


[STATEMENT]
lemma one_mod_four_round:
assumes "x mod 4 = 1"
shows "round (real_of_int x / 4) = (x-1) div 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round (real_of_int x / 4) = (x - 1) div 4
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. round (real_of_int x / 4) = (x - 1) div 4
[PROOF STEP]
have leq: "(x-1) div 4 \<le> real_of_int x / 4  + 1 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int ((x - 1) div 4) \<le> real_of_int x / 4 + 1 / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x mod 4 = 1

goal (1 subgoal):
 1. real_of_int ((x - 1) div 4) \<le> real_of_int x / 4 + 1 / 2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real_of_int ((x - 1) div 4) \<le> real_of_int x / 4 + 1 / 2

goal (1 subgoal):
 1. round (real_of_int x / 4) = (x - 1) div 4
[PROOF STEP]
have gr: "real_of_int x / 4  + 1 / 2 < (x-1) div 4 + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int x / 4 + 1 / 2 < real_of_int ((x - 1) div 4 + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_int x / 4 + 1 / 2 < real_of_int ((x - 1) div 4 + 1)
[PROOF STEP]
have "x+2 < 4 * ((x-1) div 4 + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + 2 < 4 * ((x - 1) div 4 + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x + 2 < 4 * ((x - 1) div 4 + 1)
[PROOF STEP]
have *:  "(x-1) div 4 + 1 = (x+3) div 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - 1) div 4 + 1 = (x + 3) div 4
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x - 1) div 4 + 1 = (x + 3) div 4

goal (1 subgoal):
 1. x + 2 < 4 * ((x - 1) div 4 + 1)
[PROOF STEP]
have "4 dvd x + 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 dvd x + 3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x mod 4 = 1

goal (1 subgoal):
 1. 4 dvd x + 3
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
4 dvd x + 3

goal (1 subgoal):
 1. x + 2 < 4 * ((x - 1) div 4 + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
4 dvd x + 3
[PROOF STEP]
have "4 * ((x+3) div 4) = x+3"
[PROOF STATE]
proof (prove)
using this:
4 dvd x + 3

goal (1 subgoal):
 1. 4 * ((x + 3) div 4) = x + 3
[PROOF STEP]
by (subst dvd_imp_mult_div_cancel_left, auto)
[PROOF STATE]
proof (state)
this:
4 * ((x + 3) div 4) = x + 3

goal (1 subgoal):
 1. x + 2 < 4 * ((x - 1) div 4 + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
4 * ((x + 3) div 4) = x + 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
4 * ((x + 3) div 4) = x + 3

goal (1 subgoal):
 1. x + 2 < 4 * ((x - 1) div 4 + 1)
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
4 * ((x + 3) div 4) = x + 3

goal (1 subgoal):
 1. x + 2 < 4 * ((x + 3) div 4)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x + 2 < 4 * ((x - 1) div 4 + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x + 2 < 4 * ((x - 1) div 4 + 1)

goal (1 subgoal):
 1. real_of_int x / 4 + 1 / 2 < real_of_int ((x - 1) div 4 + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x + 2 < 4 * ((x - 1) div 4 + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x + 2 < 4 * ((x - 1) div 4 + 1)

goal (1 subgoal):
 1. real_of_int x / 4 + 1 / 2 < real_of_int ((x - 1) div 4 + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_int x / 4 + 1 / 2 < real_of_int ((x - 1) div 4 + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real_of_int x / 4 + 1 / 2 < real_of_int ((x - 1) div 4 + 1)

goal (1 subgoal):
 1. round (real_of_int x / 4) = (x - 1) div 4
[PROOF STEP]
show "round (real_of_int x / 4) = (x-1) div 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round (real_of_int x / 4) = (x - 1) div 4
[PROOF STEP]
using floor_unique[OF leq gr]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>real_of_int x / 4 + 1 / 2\<rfloor> = (x - 1) div 4

goal (1 subgoal):
 1. round (real_of_int x / 4) = (x - 1) div 4
[PROOF STEP]
unfolding round_def
[PROOF STATE]
proof (prove)
using this:
\<lfloor>real_of_int x / 4 + 1 / 2\<rfloor> = (x - 1) div 4

goal (1 subgoal):
 1. \<lfloor>real_of_int x / 4 + 1 / 2\<rfloor> = (x - 1) div 4
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
round (real_of_int x / 4) = (x - 1) div 4

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gfp_in_Fix:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  shows "mono f \<Longrightarrow> gfp f \<in> Fix f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> gfp f \<in> Fix f
[PROOF STEP]
using Fix_def gfp_unfold
[PROOF STATE]
proof (prove)
using this:
Fix ?f = {x. ?f x = x}
mono ?f \<Longrightarrow> gfp ?f = ?f (gfp ?f)

goal (1 subgoal):
 1. mono f \<Longrightarrow> gfp f \<in> Fix f
[PROOF STEP]
by fastforce


[STATEMENT]
lemma D2_UNION:
  shows "(\<Union>d. P d) = (\<Union>d\<in>{D1, D2}. P d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (range P) = \<Union> (P ` {D1, D2})
[PROOF STEP]
using D2_UNIV
[PROOF STATE]
proof (prove)
using this:
UNIV = set [D1, D2]

goal (1 subgoal):
 1. \<Union> (range P) = \<Union> (P ` {D1, D2})
[PROOF STEP]
by auto


[STATEMENT]
lemma rtranclp_add_poly_p_polynomial_of_mset_full:
  \<open>add_poly_p\<^sup>*\<^sup>* (p, q, {#}) ({#}, {#}, r') \<Longrightarrow>
    polynomial_of_mset r' = (polynomial_of_mset p + polynomial_of_mset q)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_poly_p\<^sup>*\<^sup>* (p, q, {#}) ({#}, {#}, r') \<Longrightarrow> polynomial_of_mset r' = polynomial_of_mset p + polynomial_of_mset q
[PROOF STEP]
by (drule rtranclp_add_poly_p_polynomial_of_mset)
    (auto simp: ac_simps add_eq_0_iff)


[STATEMENT]
lemma transpose_carrier_mat[simp]: "(transpose_mat A \<in> carrier_mat nc nr) = (A \<in> carrier_mat nr nc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (transpose_mat A \<in> carrier_mat nc nr) = (A \<in> carrier_mat nr nc)
[PROOF STEP]
unfolding carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (transpose_mat A \<in> {m. dim_row m = nc \<and> dim_col m = nr}) = (A \<in> {m. dim_row m = nr \<and> dim_col m = nc})
[PROOF STEP]
by auto


[STATEMENT]
lemma eucl_of_list_eq_takeI:
  assumes "(eucl_of_list (take DIM('a::executable_euclidean_space) xs)::'a) = x"
  shows "eucl_of_list xs = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list xs = x
[PROOF STEP]
using eucl_of_list_take_DIM[OF refl, of xs, where 'b='a] assms
[PROOF STATE]
proof (prove)
using this:
eucl_of_list (take DIM('a) xs) = eucl_of_list xs
eucl_of_list (take DIM('a) xs) = x

goal (1 subgoal):
 1. eucl_of_list xs = x
[PROOF STEP]
by auto


[STATEMENT]
lemma W_All:
  shows "(\<forall>w. P w) \<longleftrightarrow> (\<forall>w\<in>set [W1, W2, W3]. P w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>w. P w) = (\<forall>w\<in>set [W1, W2, W3]. P w)
[PROOF STEP]
by (metis W_UNIV UNIV_I)


[STATEMENT]
lemma Collect_minI: "\<lbrakk> k \<in> I; P (k::('a::wellorder)) \<rbrakk> \<Longrightarrow> \<exists>x\<in>I. P x \<and> (\<forall>y\<in>I. y < x \<longrightarrow> \<not> P y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> \<exists>x\<in>I. P x \<and> (\<forall>y\<in>I. y < x \<longrightarrow> \<not> P y)
[PROOF STEP]
apply (rule_tac x="iMin {y \<in> I. P y}" in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> P (iMin {y \<in> I. P y}) \<and> (\<forall>y\<in>I. y < iMin {y \<in> I. P y} \<longrightarrow> \<not> P y)
 2. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> iMin {y \<in> I. P y} \<in> I
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> iMin {y \<in> I. P y} \<in> I
 2. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> P (iMin {y \<in> I. P y}) \<and> (\<forall>y\<in>I. y < iMin {y \<in> I. P y} \<longrightarrow> \<not> P y)
[PROOF STEP]
apply (rule subsetD[OF _ iMinI, OF Collect_is_subset], blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> P (iMin {y \<in> I. P y}) \<and> (\<forall>y\<in>I. y < iMin {y \<in> I. P y} \<longrightarrow> \<not> P y)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> P (iMin {y \<in> I. P y})
 2. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> \<forall>y\<in>I. y < iMin {y \<in> I. P y} \<longrightarrow> \<not> P y
[PROOF STEP]
apply (blast intro: iMinI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<in> I; P k\<rbrakk> \<Longrightarrow> \<forall>y\<in>I. y < iMin {y \<in> I. P y} \<longrightarrow> \<not> P y
[PROOF STEP]
apply (blast dest: not_less_iMin)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bin_rest_AND [simp]: "(\<lambda>k::int. k div 2) (x AND y) = (\<lambda>k::int. k div 2) x AND (\<lambda>k::int. k div 2) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x AND y) div 2 = x div 2 AND y div 2
[PROOF STEP]
by (subst and_int_rec) auto


[STATEMENT]
lemma Four_in_N: "s(s(s(s(e)))) \<in> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s (s (s (s e))) \<in> N
[PROOF STEP]
using induct_def N_is_inductive
[PROOF STATE]
proof (prove)
using this:
induct ?X \<equiv> e \<in> ?X \<and> (\<forall>x. x \<in> ?X \<longrightarrow> s x \<in> ?X)
induct N

goal (1 subgoal):
 1. s (s (s (s e))) \<in> N
[PROOF STEP]
by auto


[STATEMENT]
lemma replicate_elem: "i < n ==>  (replicate n x !i) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < n \<Longrightarrow> replicate n x ! i = x
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. i < 0 \<Longrightarrow> replicate 0 x ! i = x
 2. \<And>n. \<lbrakk>i < n \<Longrightarrow> replicate n x ! i = x; i < Suc n\<rbrakk> \<Longrightarrow> replicate (Suc n) x ! i = x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>i < n \<Longrightarrow> replicate n x ! i = x; i < Suc n\<rbrakk> \<Longrightarrow> replicate (Suc n) x ! i = x
[PROOF STEP]
apply (cases i)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>i < n \<Longrightarrow> replicate n x ! i = x; i < Suc n; i = 0\<rbrakk> \<Longrightarrow> replicate (Suc n) x ! i = x
 2. \<And>n nat. \<lbrakk>i < n \<Longrightarrow> replicate n x ! i = x; i < Suc n; i = Suc nat\<rbrakk> \<Longrightarrow> replicate (Suc n) x ! i = x
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Compl_set_less_eq_aux_Compl:
  "finite (UNIV :: 'a set) \<Longrightarrow> - A \<sqsubseteq>' - B \<longleftrightarrow> B \<sqsubseteq>' A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> (- A \<sqsubseteq>' - B) = (B \<sqsubseteq>' A)
[PROOF STEP]
by(auto simp add: set_less_eq_aux_def Compl_set_less_aux_Compl)


[STATEMENT]
lemma dist_of_nat:
  "dist (of_nat m) (of_nat n :: 'a :: real_normed_algebra_1) = of_int \<bar>int m - int n\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (of_nat m) (of_nat n) = real_of_int \<bar>int m - int n\<bar>
[PROOF STEP]
by (subst (1 2) of_int_of_nat_eq [symmetric]) (rule dist_of_int)


[STATEMENT]
lemma equiv_Eps_preserves:
  assumes ECH: "equiv A r" and X: "X \<in> A//r"
  shows "Eps (\<lambda>x. x \<in> X) \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SOME x. x \<in> X) \<in> A
[PROOF STEP]
apply (rule in_mono[rule_format])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ?A \<subseteq> A
 2. (SOME x. x \<in> X) \<in> ?A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
equiv A r
X \<in> A // r

goal (2 subgoals):
 1. ?A \<subseteq> A
 2. (SOME x. x \<in> X) \<in> ?A
[PROOF STEP]
apply (rule in_quotient_imp_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SOME x. x \<in> X) \<in> X
[PROOF STEP]
by (rule equiv_Eps_in) (rule assms)+


[STATEMENT]
lemma vec_to_iarray_vector_matrix_mult[code_unfold]:
  fixes A::"'a::{semiring_1}^'m::{mod_type}^'n::{mod_type}" and x::"'a^'n::{mod_type}"
  shows "vec_to_iarray (x v* A) = (vec_to_iarray x) v*i (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (x v* A) = vec_to_iarray x v*i matrix_to_iarray A
[PROOF STEP]
unfolding vector_matrix_mult_def vector_matrix_mult_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (\<chi>j. \<Sum>i\<in>UNIV. A $ i $ j * x $ i) = IArray.of_fun (\<lambda>j. \<Sum>i = 0..<IArray.length (vec_to_iarray x). matrix_to_iarray A !! i !! j * vec_to_iarray x !! i) (ncols_iarray (matrix_to_iarray A))
[PROOF STEP]
unfolding o_def tabulate2_def nrows_iarray_def ncols_iarray_def matrix_to_iarray_def vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>i. (\<chi>j. \<Sum>i\<in>UNIV. A $ i $ j * x $ i) $ mod_type_class.from_nat i) CARD('m) = IArray.of_fun (\<lambda>j. \<Sum>i = 0..<IArray.length (IArray.of_fun (\<lambda>i. x $ mod_type_class.from_nat i) CARD('n)). IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('m)) [0..<CARD('n)]) !! i !! j * IArray.of_fun (\<lambda>i. x $ mod_type_class.from_nat i) CARD('n) !! i) (IArray.length (IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('m)) [0..<CARD('n)]) !! 0))
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa < CARD('m) \<Longrightarrow> (\<Sum>i\<in>UNIV. A $ i $ mod_type_class.from_nat xa * x $ i) = (\<Sum>i = 0..<CARD('n). A $ mod_type_class.from_nat i $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat i)
[PROOF STEP]
fix xa
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa < CARD('m) \<Longrightarrow> (\<Sum>i\<in>UNIV. A $ i $ mod_type_class.from_nat xa * x $ i) = (\<Sum>i = 0..<CARD('n). A $ mod_type_class.from_nat i $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat i)
[PROOF STEP]
show "(\<Sum>i\<in>UNIV. A $ i $ from_nat xa * x $ i) = (\<Sum>i = 0..<CARD('n). A $ from_nat i $ from_nat xa * x $ from_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. A $ i $ mod_type_class.from_nat xa * x $ i) = (\<Sum>i = 0..<CARD('n). A $ mod_type_class.from_nat i $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat i)
[PROOF STEP]
apply (rule sum.reindex_cong[of "from_nat::nat=>'n"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. inj_on mod_type_class.from_nat {0..<CARD('n)}
 2. UNIV = mod_type_class.from_nat ` {0..<CARD('n)}
 3. \<And>xb. xb \<in> {0..<CARD('n)} \<Longrightarrow> A $ mod_type_class.from_nat xb $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat xb = A $ mod_type_class.from_nat xb $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat xb
[PROOF STEP]
using bij_from_nat[where ?'a='n]
[PROOF STATE]
proof (prove)
using this:
bij_betw mod_type_class.from_nat {0..<CARD('n)} UNIV

goal (3 subgoals):
 1. inj_on mod_type_class.from_nat {0..<CARD('n)}
 2. UNIV = mod_type_class.from_nat ` {0..<CARD('n)}
 3. \<And>xb. xb \<in> {0..<CARD('n)} \<Longrightarrow> A $ mod_type_class.from_nat xb $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat xb = A $ mod_type_class.from_nat xb $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat xb
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on mod_type_class.from_nat {0..<CARD('n)} \<and> mod_type_class.from_nat ` {0..<CARD('n)} = UNIV

goal (3 subgoals):
 1. inj_on mod_type_class.from_nat {0..<CARD('n)}
 2. UNIV = mod_type_class.from_nat ` {0..<CARD('n)}
 3. \<And>xb. xb \<in> {0..<CARD('n)} \<Longrightarrow> A $ mod_type_class.from_nat xb $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat xb = A $ mod_type_class.from_nat xb $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat xb
[PROOF STEP]
by fast+
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. A $ i $ mod_type_class.from_nat xa * x $ i) = (\<Sum>i = 0..<CARD('n). A $ mod_type_class.from_nat i $ mod_type_class.from_nat xa * x $ mod_type_class.from_nat i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aligned_small_is_0:
  "\<lbrakk> is_aligned x n; x < 2 ^ n \<rbrakk> \<Longrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_aligned x n; x < 2 ^ n\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
by (simp add: is_aligned_mask less_mask_eq)


[STATEMENT]
lemma fps_divide_subdegree_ge:
  fixes   f g :: "'a::{comm_monoid_add,uminus,mult_zero,inverse} fps"
  assumes "f / g \<noteq> 0"
  shows   "subdegree (f / g) \<ge> subdegree f - subdegree g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subdegree f - subdegree g \<le> subdegree (f / g)
[PROOF STEP]
by      (intro subdegree_geI) (simp_all add: assms fps_divide_nth_below)


[STATEMENT]
lemma Least_ex1:
  assumes "\<exists>!x. P x \<and> (\<forall>y. P y \<longrightarrow> x \<le>\<^sub>a y)"
  obtains x where "Least P = Some x" and "P x" and "P z \<Longrightarrow> x \<le>\<^sub>a z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>local.Least P = Some x; P x; P z \<Longrightarrow> x \<le>\<^sub>a z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>!x. P x \<and> (\<forall>y. P y \<longrightarrow> x \<le>\<^sub>a y)

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>local.Least P = Some x; P x; P z \<Longrightarrow> x \<le>\<^sub>a z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Least_def
[PROOF STATE]
proof (prove)
using this:
\<exists>!x. P x \<and> (\<forall>y. P y \<longrightarrow> x \<le>\<^sub>a y)

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>(THE x on UNIV. P x \<and> (\<forall>y\<in>UNIV. P y \<longrightarrow> x \<le>\<^sub>a y)) = Some x; P x; P z \<Longrightarrow> x \<le>\<^sub>a z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (clarsimp simp: that Least_equality)


[STATEMENT]
lemma csqrt_1_diff_eq: "csqrt (1 - (of_real x)\<^sup>2) = (if x^2 \<le> 1 then sqrt (1 - x^2) else \<i> * sqrt (x^2 - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csqrt (1 - (complex_of_real x)\<^sup>2) = (if x\<^sup>2 \<le> 1 then complex_of_real (sqrt (1 - x\<^sup>2)) else \<i> * complex_of_real (sqrt (x\<^sup>2 - 1)))
[PROOF STEP]
by ( simp add: of_real_sqrt del: csqrt_of_real_nonneg)


[STATEMENT]
lemma mul_mat_of_cols:
  assumes "A \<in> carrier_mat nr n"
  assumes "\<And>j. j < length cs \<Longrightarrow> cs ! j \<in> carrier_vec n"
  shows "A * (mat_of_cols n cs) = mat_of_cols nr (map ((*\<^sub>v) A) cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * mat_of_cols n cs = mat_of_cols nr (map ((*\<^sub>v) A) cs)
[PROOF STEP]
unfolding mat_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (A * mat_of_cols n cs) = dim_row (mat_of_cols nr (map ((*\<^sub>v) A) cs)) \<and> dim_col (A * mat_of_cols n cs) = dim_col (mat_of_cols nr (map ((*\<^sub>v) A) cs)) \<and> (\<forall>i j. i < dim_row (mat_of_cols nr (map ((*\<^sub>v) A) cs)) \<longrightarrow> j < dim_col (mat_of_cols nr (map ((*\<^sub>v) A) cs)) \<longrightarrow> (A * mat_of_cols n cs) $$ (i, j) = mat_of_cols nr (map ((*\<^sub>v) A) cs) $$ (i, j))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr n
?j < length cs \<Longrightarrow> cs ! ?j \<in> carrier_vec n

goal (1 subgoal):
 1. dim_row (A * mat_of_cols n cs) = dim_row (mat_of_cols nr (map ((*\<^sub>v) A) cs)) \<and> dim_col (A * mat_of_cols n cs) = dim_col (mat_of_cols nr (map ((*\<^sub>v) A) cs)) \<and> (\<forall>i j. i < dim_row (mat_of_cols nr (map ((*\<^sub>v) A) cs)) \<longrightarrow> j < dim_col (mat_of_cols nr (map ((*\<^sub>v) A) cs)) \<longrightarrow> (A * mat_of_cols n cs) $$ (i, j) = mat_of_cols nr (map ((*\<^sub>v) A) cs) $$ (i, j))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>A \<in> carrier_mat nr n; \<And>j. j < length cs \<Longrightarrow> cs ! j \<in> carrier_vec n; i < nr; j < length cs\<rbrakk> \<Longrightarrow> row A i \<bullet> cs ! j = mat_of_cols nr (map ((*\<^sub>v) A) cs) $$ (i, j)
[PROOF STEP]
apply (subst mat_of_cols_index)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>A \<in> carrier_mat nr n; \<And>j. j < length cs \<Longrightarrow> cs ! j \<in> carrier_vec n; i < nr; j < length cs\<rbrakk> \<Longrightarrow> i < nr
 2. \<And>i j. \<lbrakk>A \<in> carrier_mat nr n; \<And>j. j < length cs \<Longrightarrow> cs ! j \<in> carrier_vec n; i < nr; j < length cs\<rbrakk> \<Longrightarrow> j < length (map ((*\<^sub>v) A) cs)
 3. \<And>i j. \<lbrakk>A \<in> carrier_mat nr n; \<And>j. j < length cs \<Longrightarrow> cs ! j \<in> carrier_vec n; i < nr; j < length cs\<rbrakk> \<Longrightarrow> row A i \<bullet> cs ! j = map ((*\<^sub>v) A) cs ! j $ i
[PROOF STEP]
by auto


[STATEMENT]
lemma arctan_unique:
  assumes "-(pi/2) < x"
    and "x < pi/2"
    and "tan x = y"
  shows "arctan y = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan y = x
[PROOF STEP]
using assms arctan [of y] tan_total [of y]
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < x
x < pi / 2
tan x = y
- (pi / 2) < arctan y \<and> arctan y < pi / 2 \<and> tan (arctan y) = y
\<exists>!x. - (pi / 2) < x \<and> x < pi / 2 \<and> tan x = y

goal (1 subgoal):
 1. arctan y = x
[PROOF STEP]
by (fast elim: ex1E)


[STATEMENT]
lemma take_bit_diff:
  \<open>take_bit n (take_bit n k - take_bit n l) = take_bit n (k - l)\<close>
    for k l :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit n (take_bit n k - take_bit n l) = take_bit n (k - l)
[PROOF STEP]
by (simp add: take_bit_eq_mod mod_diff_eq)


[STATEMENT]
lemma sum_mat_0[simp]: "sum_mat (0\<^sub>m nr nc) = (0 :: 'a :: comm_monoid_add)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_mat (0\<^sub>m nr nc) = (0::'a)
[PROOF STEP]
unfolding sum_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (($$) (0\<^sub>m nr nc)) ({0..<dim_row (0\<^sub>m nr nc)} \<times> {0..<dim_col (0\<^sub>m nr nc)}) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, auto)


[STATEMENT]
lemma smult_vec_zero:
  fixes v ::"'a::ring vec"
  shows "0 \<cdot>\<^sub>v v = 0\<^sub>v (dim_vec v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<cdot>\<^sub>v v = 0\<^sub>v (dim_vec v)
[PROOF STEP]
unfolding smult_vec_def vec_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec (dim_vec v) (\<lambda>i. (0::'a) * v $ i)) = dim_vec (0\<^sub>v (dim_vec v)) \<and> (\<forall>i<dim_vec (0\<^sub>v (dim_vec v)). vec (dim_vec v) (\<lambda>i. (0::'a) * v $ i) $ i = 0\<^sub>v (dim_vec v) $ i)
[PROOF STEP]
by (auto)


[STATEMENT]
lemma is_heap_Min_children_larger:
  "is_heap t \<Longrightarrow> children t \<noteq> [] \<Longrightarrow>
   priority t \<le> Min (priority ` set (children t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_heap_list (priority t) (children t); children t \<noteq> []\<rbrakk> \<Longrightarrow> priority t \<le> Min (priority ` set (children t))
[PROOF STEP]
by (simp add: is_heap_children_larger)


[STATEMENT]
lemma inorder_reflect: "inorder (reflect t) = rev (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inorder (reflect t) = rev (inorder t)
[PROOF STEP]
apply (induct t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inorder (reflect Lf) = rev (inorder Lf)
 2. \<And>x1 t1 t2. \<lbrakk>inorder (reflect t1) = rev (inorder t1); inorder (reflect t2) = rev (inorder t2)\<rbrakk> \<Longrightarrow> inorder (reflect (Br x1 t1 t2)) = rev (inorder (Br x1 t1 t2))
[PROOF STEP]
apply (metis Nil_is_rev_conv inorder.simps(1) reflect.simps(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 t1 t2. \<lbrakk>inorder (reflect t1) = rev (inorder t1); inorder (reflect t2) = rev (inorder t2)\<rbrakk> \<Longrightarrow> inorder (reflect (Br x1 t1 t2)) = rev (inorder (Br x1 t1 t2))
[PROOF STEP]
by simp


[STATEMENT]
lemma make_first_column_positive_nz_conv:
  assumes "i<dim_row A" and "j<dim_col A"
  shows "(make_first_column_positive A $$ (i, j) \<noteq> 0) = (A $$ (i, j) \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (make_first_column_positive A $$ (i, j) \<noteq> 0) = (A $$ (i, j) \<noteq> 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. (make_first_column_positive A $$ (i, j) \<noteq> 0) = (A $$ (i, j) \<noteq> 0)
[PROOF STEP]
unfolding make_first_column_positive.simps
[PROOF STATE]
proof (prove)
using this:
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. (Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, j). if A $$ (i, 0) < 0 then - A $$ (i, j) else A $$ (i, j)) $$ (i, j) \<noteq> 0) = (A $$ (i, j) \<noteq> 0)
[PROOF STEP]
by auto


[STATEMENT]
theorem gt_proper_sub: "wary t \<Longrightarrow> proper_sub s t \<Longrightarrow> t >\<^sub>t s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wary t; proper_sub s t\<rbrakk> \<Longrightarrow> t >\<^sub>t s
[PROOF STEP]
by (induct t) (auto intro: gt_sub_fun gt_sub_arg gt_trans sub.intros wary_sub)


[STATEMENT]
lemma eval_pvar:
  assumes "i < (n::nat)"
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "eval_at_point R a (pvar R i) = a!i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point R a (pvar R i) = a ! i
[PROOF STEP]
unfolding eval_at_point_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. total_eval R (\<lambda>i. if i < length a then a ! i else \<zero>) (pvar R i) = a ! i
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. total_eval R (\<lambda>i. if i < length a then a ! i else \<zero>) (pvar R i) = a ! i
[PROOF STEP]
have "pvar R i = \<one>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> \<Otimes> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pvar R i = \<one>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<Otimes> i
[PROOF STEP]
unfolding var_to_IP_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset_to_IP R {#i#} = \<one>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<Otimes> i
[PROOF STEP]
by (metis R.Pring_one coord_ring_def R.monom_add_mset R.one_mset_to_IP)
[PROOF STATE]
proof (state)
this:
pvar R i = \<one>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<Otimes> i

goal (1 subgoal):
 1. total_eval R (\<lambda>i. if i < length a then a ! i else \<zero>) (pvar R i) = a ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pvar R i = \<one>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<Otimes> i
[PROOF STEP]
show "total_eval R (\<lambda>i. if i < length a then a ! i else \<zero>) (pvar R i) = a ! i"
[PROOF STATE]
proof (prove)
using this:
pvar R i = \<one>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<Otimes> i

goal (1 subgoal):
 1. total_eval R (\<lambda>i. if i < length a then a ! i else \<zero>) (pvar R i) = a ! i
[PROOF STEP]
using assms R.total_eval_var[of "(\<lambda>i. (if i< length a then a ! i else \<zero>\<^bsub>R\<^esub>))" i ]
[PROOF STATE]
proof (prove)
using this:
pvar R i = \<one>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<Otimes> i
i < n
a \<in> carrier (R\<^bsup>n\<^esup>)
(\<lambda>i. if i < length a then a ! i else \<zero>) \<in> UNIV \<rightarrow> carrier R \<Longrightarrow> total_eval R (\<lambda>i. if i < length a then a ! i else \<zero>) (mset_to_IP R {#i#}) = (if i < length a then a ! i else \<zero>)

goal (1 subgoal):
 1. total_eval R (\<lambda>i. if i < length a then a ! i else \<zero>) (pvar R i) = a ! i
[PROOF STEP]
by (smt cartesian_power_car_memE cartesian_power_car_memE' R.closed_funI var_to_IP_def R.zero_closed)
[PROOF STATE]
proof (state)
this:
total_eval R (\<lambda>i. if i < length a then a ! i else \<zero>) (pvar R i) = a ! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem bin_code_code: assumes "u \<cdot> v \<noteq> v \<cdot> u" shows "code {u, v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. code {u, v}
[PROOF STEP]
unfolding code_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs ys. xs \<in> lists {u, v} \<longrightarrow> ys \<in> lists {u, v} \<longrightarrow> concat xs = concat ys \<longrightarrow> xs = ys
[PROOF STEP]
using no_comm_bin_code[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?us \<in> lists {u, v}; ?vs \<in> lists {u, v}; concat ?us = concat ?vs\<rbrakk> \<Longrightarrow> ?us = ?vs

goal (1 subgoal):
 1. \<forall>xs ys. xs \<in> lists {u, v} \<longrightarrow> ys \<in> lists {u, v} \<longrightarrow> concat xs = concat ys \<longrightarrow> xs = ys
[PROOF STEP]
by blast


[STATEMENT]
lemma nu_add_precong: "\<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x + z) \<le> \<nu> (y + z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x + z) \<le> \<nu> (y + z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x + z) \<le> \<nu> (y + z)
[PROOF STEP]
assume "\<nu> x \<le> \<nu> y"
[PROOF STATE]
proof (state)
this:
\<nu> x \<le> \<nu> y

goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x + z) \<le> \<nu> (y + z)
[PROOF STEP]
hence "\<nu> x = \<nu> x \<sqinter> \<nu> y"
[PROOF STATE]
proof (prove)
using this:
\<nu> x \<le> \<nu> y

goal (1 subgoal):
 1. \<nu> x = \<nu> x \<sqinter> \<nu> y
[PROOF STEP]
using local.inf.absorb_iff1
[PROOF STATE]
proof (prove)
using this:
\<nu> x \<le> \<nu> y
(?a \<le> ?b) = (?a \<sqinter> ?b = ?a)

goal (1 subgoal):
 1. \<nu> x = \<nu> x \<sqinter> \<nu> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<nu> x = \<nu> x \<sqinter> \<nu> y

goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x + z) \<le> \<nu> (y + z)
[PROOF STEP]
hence "\<forall>a. \<nu> (x + a) = \<nu> (x + a) \<sqinter> \<nu> (y + a)"
[PROOF STATE]
proof (prove)
using this:
\<nu> x = \<nu> x \<sqinter> \<nu> y

goal (1 subgoal):
 1. \<forall>a. \<nu> (x + a) = \<nu> (x + a) \<sqinter> \<nu> (y + a)
[PROOF STEP]
by (metis (no_types) local.lat_dist2 nu_add)
[PROOF STATE]
proof (state)
this:
\<forall>a. \<nu> (x + a) = \<nu> (x + a) \<sqinter> \<nu> (y + a)

goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x + z) \<le> \<nu> (y + z)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>a. \<nu> (x + a) = \<nu> (x + a) \<sqinter> \<nu> (y + a)

goal (1 subgoal):
 1. \<nu> (x + z) \<le> \<nu> (y + z)
[PROOF STEP]
using local.inf.absorb_iff1
[PROOF STATE]
proof (prove)
using this:
\<forall>a. \<nu> (x + a) = \<nu> (x + a) \<sqinter> \<nu> (y + a)
(?a \<le> ?b) = (?a \<sqinter> ?b = ?a)

goal (1 subgoal):
 1. \<nu> (x + z) \<le> \<nu> (y + z)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<nu> (x + z) \<le> \<nu> (y + z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma oexp_gt_0_iff [simp]:
  assumes "Ord \<beta>" shows "\<alpha>\<up>\<beta> > 0 \<longleftrightarrow> \<alpha>>0 \<or> \<beta>=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < \<alpha> \<up> \<beta>) = (0 < \<alpha> \<or> \<beta> = 0)
[PROOF STEP]
by (simp add: assms less_V_def)


[STATEMENT]
lemma Rats_abs_iff[simp]:
  "\<bar>(x::real)\<bar> \<in> \<rat> \<longleftrightarrow> x \<in> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>x\<bar> \<in> \<rat>) = (x \<in> \<rat>)
[PROOF STEP]
by(simp add: abs_real_def split: if_splits)


[STATEMENT]
lemma empty_interior_lowdim_gen:
  fixes S :: "'N::euclidean_space set" and T :: "'M::euclidean_space set"
  assumes dim: "DIM('M) < DIM('N)" and ST: "S homeomorphic T"
  shows "interior S = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
obtain h :: "'M \<Rightarrow> 'N" where "linear h" "\<And>x. norm(h x) = norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. \<lbrakk>linear h; \<And>x. norm (h x) = norm x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule isometry_subset_subspace [OF subspace_UNIV subspace_UNIV, where ?'a = 'M and ?'b = 'N])
       (use dim in auto)
[PROOF STATE]
proof (state)
this:
linear h
norm (h ?x) = norm ?x

goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linear h
norm (h ?x) = norm ?x
[PROOF STEP]
have "inj h"
[PROOF STATE]
proof (prove)
using this:
linear h
norm (h ?x) = norm ?x

goal (1 subgoal):
 1. inj h
[PROOF STEP]
by (metis linear_inj_iff_eq_0 norm_eq_zero)
[PROOF STATE]
proof (state)
this:
inj h

goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj h
[PROOF STEP]
have "h ` T homeomorphic T"
[PROOF STATE]
proof (prove)
using this:
inj h

goal (1 subgoal):
 1. h ` T homeomorphic T
[PROOF STEP]
using \<open>linear h\<close> homeomorphic_sym linear_homeomorphic_image
[PROOF STATE]
proof (prove)
using this:
inj h
linear h
?s homeomorphic ?t = ?t homeomorphic ?s
\<lbrakk>linear ?f; inj ?f\<rbrakk> \<Longrightarrow> ?S homeomorphic ?f ` ?S

goal (1 subgoal):
 1. h ` T homeomorphic T
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
h ` T homeomorphic T

goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h ` T homeomorphic T
[PROOF STEP]
have "interior (h ` T) homeomorphic interior S"
[PROOF STATE]
proof (prove)
using this:
h ` T homeomorphic T

goal (1 subgoal):
 1. interior (h ` T) homeomorphic interior S
[PROOF STEP]
using homeomorphic_interiors_same_dimension
[PROOF STATE]
proof (prove)
using this:
h ` T homeomorphic T
\<lbrakk>?S homeomorphic ?T; DIM(?'a) = DIM(?'b)\<rbrakk> \<Longrightarrow> interior ?S homeomorphic interior ?T

goal (1 subgoal):
 1. interior (h ` T) homeomorphic interior S
[PROOF STEP]
by (metis ST homeomorphic_sym homeomorphic_trans)
[PROOF STATE]
proof (state)
this:
interior (h ` T) homeomorphic interior S

goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
interior (h ` T) homeomorphic interior S

goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
have "interior (range h) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior (range h) = {}
[PROOF STEP]
by (simp add: \<open>inj h\<close> \<open>linear h\<close> dim dim_image_eq empty_interior_lowdim)
[PROOF STATE]
proof (state)
this:
interior (range h) = {}

goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
interior (range h) = {}
[PROOF STEP]
have "interior (h ` T) = {}"
[PROOF STATE]
proof (prove)
using this:
interior (range h) = {}

goal (1 subgoal):
 1. interior (h ` T) = {}
[PROOF STEP]
by (metis image_mono interior_mono subset_empty top_greatest)
[PROOF STATE]
proof (state)
this:
interior (h ` T) = {}

goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
interior (h ` T) homeomorphic interior S
interior (h ` T) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
interior (h ` T) homeomorphic interior S
interior (h ` T) = {}

goal (1 subgoal):
 1. interior S = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
interior S = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enc_atom_lang_Arbitrary_Except_False: "\<lbrakk>r < length I;
  case I ! r of Inl p' \<Rightarrow> p \<noteq> p' | Inr P \<Rightarrow> p \<notin> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow>
  [enc_atom I p a] \<in> lang n (Atom (Arbitrary_Except r False))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r < length I; case I ! r of Inl p' \<Rightarrow> p \<noteq> p' | Inr P \<Rightarrow> p \<notin> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> [enc_atom I p a] \<in> lang n (Atom (Arbitrary_Except r False))
[PROOF STEP]
unfolding lang.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r < length I; case I ! r of Inl p' \<Rightarrow> p \<noteq> p' | Inr P \<Rightarrow> p \<notin> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> [enc_atom I p a] \<in> {[x] |x. lookup (Arbitrary_Except r False) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}
[PROOF STEP]
by (force intro!: enc_atom_bool_take_drop_False
    image_eqI[of _ _ "(\<lambda>J. take r J @ drop (r + 1) J) (enc_atom_bool I p)"]
    simp: set_n_lists \<sigma>_def split: sum.splits)


[STATEMENT]
lemma seq_suble:
  assumes sf: "strict_mono (f :: nat \<Rightarrow> nat)"
  shows "n \<le> f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> f n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> f 0
 2. \<And>n. n \<le> f n \<Longrightarrow> Suc n \<le> f (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. 0 \<le> f 0
 2. \<And>n. n \<le> f n \<Longrightarrow> Suc n \<le> f (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> f 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> f 0

goal (1 subgoal):
 1. \<And>n. n \<le> f n \<Longrightarrow> Suc n \<le> f (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. n \<le> f n \<Longrightarrow> Suc n \<le> f (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
n \<le> f n

goal (1 subgoal):
 1. \<And>n. n \<le> f n \<Longrightarrow> Suc n \<le> f (Suc n)
[PROOF STEP]
with sf [unfolded strict_mono_Suc_iff, rule_format, of n]
[PROOF STATE]
proof (chain)
picking this:
f n < f (Suc n)
n \<le> f n
[PROOF STEP]
have "n < f (Suc n)"
[PROOF STATE]
proof (prove)
using this:
f n < f (Suc n)
n \<le> f n

goal (1 subgoal):
 1. n < f (Suc n)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
n < f (Suc n)

goal (1 subgoal):
 1. \<And>n. n \<le> f n \<Longrightarrow> Suc n \<le> f (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n < f (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
n < f (Suc n)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zmset_of_le: "zmset_of M \<le> zmset_of N \<longleftrightarrow> M \<le> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (zmset_of M \<le> zmset_of N) = (M \<le> N)
[PROOF STEP]
by (simp_all add: less_eq_zmultiset_def zmset_of_def; transfer; auto simp: equiv_zmset_def)


[STATEMENT]
lemma closed_contains_Sup:
  fixes S :: "real set"
  shows "S \<noteq> {} \<Longrightarrow> bdd_above S \<Longrightarrow> closed S \<Longrightarrow> Sup S \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<noteq> {}; bdd_above S; closed S\<rbrakk> \<Longrightarrow> Sup S \<in> S
[PROOF STEP]
by (subst closure_closed[symmetric], assumption, rule closure_contains_Sup)


[STATEMENT]
lemma apply_state_iso_compose: "apply_state_iso si1 (apply_state_iso si2 oracle) =
    apply_state_iso (map_prod (\<lambda>f. f o (fst si2)) ((o) (snd si2)) si1) oracle"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_state_iso si1 (apply_state_iso si2 oracle) = apply_state_iso (map_prod (\<lambda>f. f \<circ> fst si2) ((\<circ>) (snd si2)) si1) oracle
[PROOF STEP]
unfolding apply_state_iso_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case si1 of (f, g) \<Rightarrow> map_fun g (map_fun id (map_spmf (map_prod id f)))) ((case si2 of (f, g) \<Rightarrow> map_fun g (map_fun id (map_spmf (map_prod id f)))) oracle) = (case map_prod (\<lambda>f. f \<circ> fst si2) ((\<circ>) (snd si2)) si1 of (f, g) \<Rightarrow> map_fun g (map_fun id (map_spmf (map_prod id f)))) oracle
[PROOF STEP]
by (auto simp add: split_def id_def o_def map_prod_def map_fun_def map_spmf_conv_bind_spmf)