[STATEMENT]
theorem multiplicity_2_diff_even_pow:
  fixes x y :: int
  assumes "odd x"  "odd y" and "even n" and "n > 0" and "\<bar>x\<bar> \<noteq> \<bar>y\<bar>"
  shows "multiplicity 2 (x^n - y^n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
obtain n' where "n = 2*n'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n'. n = 2 * n' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>even n\<close>
[PROOF STATE]
proof (prove)
using this:
even n

goal (1 subgoal):
 1. (\<And>n'. n = 2 * n' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n = 2 * n'

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
with \<open>n > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < n
n = 2 * n'
[PROOF STEP]
have "n' > 0"
[PROOF STATE]
proof (prove)
using this:
0 < n
n = 2 * n'

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

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < n'

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
have "4 dvd x^2 - y^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 dvd x\<^sup>2 - y\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 4 dvd x\<^sup>2 - y\<^sup>2
[PROOF STEP]
have "x^2 - y^2 = (x + y) * (x - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 - y\<^sup>2 = (x + y) * (x - y)
[PROOF STEP]
by (simp add: algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
x\<^sup>2 - y\<^sup>2 = (x + y) * (x - y)

goal (1 subgoal):
 1. 4 dvd x\<^sup>2 - y\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x\<^sup>2 - y\<^sup>2 = (x + y) * (x - y)

goal (1 subgoal):
 1. 4 dvd x\<^sup>2 - y\<^sup>2
[PROOF STEP]
have "2 dvd x + y" and "2 dvd x - y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (x + y) &&& even (x - y)
[PROOF STEP]
using \<open>odd x\<close> and \<open>odd y\<close>
[PROOF STATE]
proof (prove)
using this:
odd x
odd y

goal (1 subgoal):
 1. even (x + y) &&& even (x - y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
even (x + y)
even (x - y)

goal (1 subgoal):
 1. 4 dvd x\<^sup>2 - y\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x\<^sup>2 - y\<^sup>2 = (x + y) * (x - y)
even (x + y)
even (x - y)
[PROOF STEP]
show "4 dvd x^2 - y^2"
[PROOF STATE]
proof (prove)
using this:
x\<^sup>2 - y\<^sup>2 = (x + y) * (x - y)
even (x + y)
even (x - y)

goal (1 subgoal):
 1. 4 dvd x\<^sup>2 - y\<^sup>2
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
4 dvd x\<^sup>2 - y\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
4 dvd x\<^sup>2 - y\<^sup>2

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
4 dvd x\<^sup>2 - y\<^sup>2

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
have "odd (x^2)" and "odd (y^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (x\<^sup>2) &&& odd (y\<^sup>2)
[PROOF STEP]
using \<open>odd x\<close> \<open>odd y\<close>
[PROOF STATE]
proof (prove)
using this:
odd x
odd y

goal (1 subgoal):
 1. odd (x\<^sup>2) &&& odd (y\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
odd (x\<^sup>2)
odd (y\<^sup>2)

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
odd (x\<^sup>2)
odd (y\<^sup>2)

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
from \<open>\<bar>x\<bar> \<noteq> \<bar>y\<bar>\<close>
[PROOF STATE]
proof (chain)
picking this:
\<bar>x\<bar> \<noteq> \<bar>y\<bar>
[PROOF STEP]
have "x^2 \<noteq> y^2"
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> \<noteq> \<bar>y\<bar>

goal (1 subgoal):
 1. x\<^sup>2 \<noteq> y\<^sup>2
[PROOF STEP]
using diff_0 diff_0_right power2_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> \<noteq> \<bar>y\<bar>
(0::?'a) - ?a = - ?a
?a - (0::?'a) = ?a
(?x\<^sup>2 = ?y\<^sup>2) = (?x = ?y \<or> ?x = - ?y)

goal (1 subgoal):
 1. x\<^sup>2 \<noteq> y\<^sup>2
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x\<^sup>2 \<noteq> y\<^sup>2

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < n'
4 dvd x\<^sup>2 - y\<^sup>2
odd (x\<^sup>2)
odd (y\<^sup>2)
x\<^sup>2 \<noteq> y\<^sup>2
[PROOF STEP]
have "multiplicity 2 ((x^2)^n' - (y^2)^n') = multiplicity 2 (x^2 - y^2) + multiplicity 2 n'"
[PROOF STATE]
proof (prove)
using this:
0 < n'
4 dvd x\<^sup>2 - y\<^sup>2
odd (x\<^sup>2)
odd (y\<^sup>2)
x\<^sup>2 \<noteq> y\<^sup>2

goal (1 subgoal):
 1. multiplicity 2 (x\<^sup>2 ^ n' - y\<^sup>2 ^ n') = multiplicity 2 (x\<^sup>2 - y\<^sup>2) + multiplicity 2 n'
[PROOF STEP]
by (intro multiplicity_2_diff_pow_4div)
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x\<^sup>2 ^ n' - y\<^sup>2 ^ n') = multiplicity 2 (x\<^sup>2 - y\<^sup>2) + multiplicity 2 n'

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x\<^sup>2 ^ n' - y\<^sup>2 ^ n') = multiplicity 2 (x\<^sup>2 - y\<^sup>2) + multiplicity 2 n'

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
have "multiplicity 2 ((x^2)^n' - (y^2)^n') = multiplicity 2 (x^n - y^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x\<^sup>2 ^ n' - y\<^sup>2 ^ n') = multiplicity 2 (x ^ n - y ^ n)
[PROOF STEP]
unfolding \<open>n = 2*n'\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x\<^sup>2 ^ n' - y\<^sup>2 ^ n') = multiplicity 2 (x ^ (2 * n') - y ^ (2 * n'))
[PROOF STEP]
by (simp add: power_mult)
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x\<^sup>2 ^ n' - y\<^sup>2 ^ n') = multiplicity 2 (x ^ n - y ^ n)

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x\<^sup>2 ^ n' - y\<^sup>2 ^ n') = multiplicity 2 (x ^ n - y ^ n)

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
have "multiplicity 2 (x^2 - y^2) = multiplicity 2 ((x - y) * (x + y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x\<^sup>2 - y\<^sup>2) = multiplicity 2 ((x - y) * (x + y))
[PROOF STEP]
by (simp add: algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x\<^sup>2 - y\<^sup>2) = multiplicity 2 ((x - y) * (x + y))

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x\<^sup>2 - y\<^sup>2) = multiplicity 2 ((x - y) * (x + y))

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
have "... = multiplicity 2 (x - y) + multiplicity 2 (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 ((x - y) * (x + y)) = multiplicity 2 (x - y) + multiplicity 2 (x + y)
[PROOF STEP]
using \<open>\<bar>x\<bar> \<noteq> \<bar>y\<bar>\<close>
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> \<noteq> \<bar>y\<bar>

goal (1 subgoal):
 1. multiplicity 2 ((x - y) * (x + y)) = multiplicity 2 (x - y) + multiplicity 2 (x + y)
[PROOF STEP]
by (auto intro: prime_elem_multiplicity_mult_distrib)
[PROOF STATE]
proof (state)
this:
multiplicity 2 ((x - y) * (x + y)) = multiplicity 2 (x - y) + multiplicity 2 (x + y)

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity 2 ((x - y) * (x + y)) = multiplicity 2 (x - y) + multiplicity 2 (x + y)

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
have "multiplicity 2 n = Suc (multiplicity 2 n')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 n = Suc (multiplicity 2 n')
[PROOF STEP]
unfolding \<open>n = 2*n'\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (2 * n') = Suc (multiplicity 2 n')
[PROOF STEP]
using \<open>n' > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n'

goal (1 subgoal):
 1. multiplicity 2 (2 * n') = Suc (multiplicity 2 n')
[PROOF STEP]
by (simp add: multiplicity_times_same)
[PROOF STATE]
proof (state)
this:
multiplicity 2 n = Suc (multiplicity 2 n')

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n'
multiplicity 2 n = Suc (multiplicity 2 n')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n'
multiplicity 2 n = Suc (multiplicity 2 n')

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 (x + y) + multiplicity 2 n - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma T_vrestr_composed:
  assumes "A \<in> sets M"
  shows "(T^^n)--` (T^^m)--` A = (T^^(n+m))--` A"
        "T--` (T^^m)--` A = (T^^(m+1))--` A"
        "(T^^m)--` T--` A = (T^^(m+1))--` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (T ^^ n) --` (T ^^ m) --` A = (T ^^ (n + m)) --` A &&& T --` (T ^^ m) --` A = (T ^^ (m + 1)) --` A &&& (T ^^ m) --` T --` A = (T ^^ (m + 1)) --` A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (T ^^ n) --` (T ^^ m) --` A = (T ^^ (n + m)) --` A
 2. T --` (T ^^ m) --` A = (T ^^ (m + 1)) --` A
 3. (T ^^ m) --` T --` A = (T ^^ (m + 1)) --` A
[PROOF STEP]
show "(T^^n)--` (T^^m)--` A = (T^^(n+m))--` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (T ^^ n) --` (T ^^ m) --` A = (T ^^ (n + m)) --` A
[PROOF STEP]
by (simp add: Tn_meas funpow_add add.commute vrestr_comp)
[PROOF STATE]
proof (state)
this:
(T ^^ n) --` (T ^^ m) --` A = (T ^^ (n + m)) --` A

goal (2 subgoals):
 1. T --` (T ^^ m) --` A = (T ^^ (m + 1)) --` A
 2. (T ^^ m) --` T --` A = (T ^^ (m + 1)) --` A
[PROOF STEP]
show "T--` (T^^m)--` A = (T^^(m+1))--` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T --` (T ^^ m) --` A = (T ^^ (m + 1)) --` A
[PROOF STEP]
by (metis Suc_eq_plus1 T_meas funpow_Suc_right vrestr_comp)
[PROOF STATE]
proof (state)
this:
T --` (T ^^ m) --` A = (T ^^ (m + 1)) --` A

goal (1 subgoal):
 1. (T ^^ m) --` T --` A = (T ^^ (m + 1)) --` A
[PROOF STEP]
show "(T^^m)--` T--` A = (T^^(m+1))--` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (T ^^ m) --` T --` A = (T ^^ (m + 1)) --` A
[PROOF STEP]
by (simp add: Tn_meas vrestr_comp)
[PROOF STATE]
proof (state)
this:
(T ^^ m) --` T --` A = (T ^^ (m + 1)) --` A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma asymp_equiv_at_top_imp_at_bot:
  "(\<lambda>x. f (- x)) \<sim>[at_top] (\<lambda>x. g (-x)) \<Longrightarrow> f \<sim>[at_bot] g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (- x)) \<sim>[at_top] (\<lambda>x. g (- x)) \<Longrightarrow> f \<sim>[at_bot] g
[PROOF STEP]
by (simp add: asymp_equiv_def filterlim_at_bot_mirror)


[STATEMENT]
lemma lQuot_rQuot: "lQuot a (rQuot b A) = rQuot b (lQuot a A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lQuot a (rQuot b A) = rQuot b (lQuot a A)
[PROOF STEP]
unfolding lQuot_def rQuot_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. a # xs \<in> {xs. xs @ [b] \<in> A}} = {xs. xs @ [b] \<in> {xs. a # xs \<in> A}}
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_range_updI:
  assumes "finite (range f)" shows "finite (range (f(a\<mapsto>b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (range (f(a \<mapsto> b)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (range (f(a \<mapsto> b)))
[PROOF STEP]
have "range (f(a\<mapsto>b)) \<subseteq> insert (Some b) (range f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (f(a \<mapsto> b)) \<subseteq> insert (Some b) (range f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range (f(a \<mapsto> b)) \<subseteq> insert (Some b) (range f)

goal (1 subgoal):
 1. finite (range (f(a \<mapsto> b)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
range (f(a \<mapsto> b)) \<subseteq> insert (Some b) (range f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
range (f(a \<mapsto> b)) \<subseteq> insert (Some b) (range f)

goal (1 subgoal):
 1. finite (range (f(a \<mapsto> b)))
[PROOF STEP]
by (rule finite_subset) (use assms in auto)
[PROOF STATE]
proof (state)
this:
finite (range (f(a \<mapsto> b)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cons_le_Cons: "a # x \<le> b # y \<longleftrightarrow> length x < length y \<or> length x = length y \<and> (a < b \<or> a = b \<and> x \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a # x \<le> b # y) = (length x < length y \<or> length x = length y \<and> (a < b \<or> a = b \<and> x \<le> y))
[PROOF STEP]
by (auto simp: list_le_def Cons_less_Cons)


[STATEMENT]
lemma Suc_0_not_prime_nat [simp]: "\<not> prime (Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> prime (Suc 0)
[PROOF STEP]
using not_prime_1 [where ?'a = nat]
[PROOF STATE]
proof (prove)
using this:
\<not> prime 1

goal (1 subgoal):
 1. \<not> prime (Suc 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma face_of_imp_closed:
     fixes S :: "'a::euclidean_space set"
     assumes "convex S" "closed S" "T face_of S" shows "closed T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed T
[PROOF STEP]
by (metis affine_affine_hull affine_closed closed_Int face_of_imp_eq_affine_Int assms)


[STATEMENT]
lemma power_le_one_iff: "0 \<le> (a::real) \<Longrightarrow> a ^ n \<le> 1 \<longleftrightarrow> (n = 0 \<or> a \<le> 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> a \<Longrightarrow> (a ^ n \<le> 1) = (n = 0 \<or> a \<le> 1)
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) le_less neq0_conv not_le one_le_power power_0 power_eq_imp_eq_base power_le_one zero_le_one)


[STATEMENT]
lemma entt_star_mono: "\<lbrakk>entailst A B; entailst C D\<rbrakk> \<Longrightarrow> entailst (A*C) (B*D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<Longrightarrow>\<^sub>t B; C \<Longrightarrow>\<^sub>t D\<rbrakk> \<Longrightarrow> A * C \<Longrightarrow>\<^sub>t B * D
[PROOF STEP]
unfolding entailst_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<Longrightarrow>\<^sub>A B * true; C \<Longrightarrow>\<^sub>A D * true\<rbrakk> \<Longrightarrow> A * C \<Longrightarrow>\<^sub>A B * D * true
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>A \<Longrightarrow>\<^sub>A B * true; C \<Longrightarrow>\<^sub>A D * true\<rbrakk> \<Longrightarrow> A * C \<Longrightarrow>\<^sub>A B * D * true
[PROOF STEP]
assume a1: "A \<Longrightarrow>\<^sub>A B * true"
[PROOF STATE]
proof (state)
this:
A \<Longrightarrow>\<^sub>A B * true

goal (1 subgoal):
 1. \<lbrakk>A \<Longrightarrow>\<^sub>A B * true; C \<Longrightarrow>\<^sub>A D * true\<rbrakk> \<Longrightarrow> A * C \<Longrightarrow>\<^sub>A B * D * true
[PROOF STEP]
assume "C \<Longrightarrow>\<^sub>A D * true"
[PROOF STATE]
proof (state)
this:
C \<Longrightarrow>\<^sub>A D * true

goal (1 subgoal):
 1. \<lbrakk>A \<Longrightarrow>\<^sub>A B * true; C \<Longrightarrow>\<^sub>A D * true\<rbrakk> \<Longrightarrow> A * C \<Longrightarrow>\<^sub>A B * D * true
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C \<Longrightarrow>\<^sub>A D * true
[PROOF STEP]
have "A * C \<Longrightarrow>\<^sub>A true * B * (true * D)"
[PROOF STATE]
proof (prove)
using this:
C \<Longrightarrow>\<^sub>A D * true

goal (1 subgoal):
 1. A * C \<Longrightarrow>\<^sub>A true * B * (true * D)
[PROOF STEP]
using a1 assn_times_comm ent_star_mono
[PROOF STATE]
proof (prove)
using this:
C \<Longrightarrow>\<^sub>A D * true
A \<Longrightarrow>\<^sub>A B * true
?P * ?Q = ?Q * ?P
\<lbrakk>?P \<Longrightarrow>\<^sub>A ?P'; ?Q \<Longrightarrow>\<^sub>A ?Q'\<rbrakk> \<Longrightarrow> ?P * ?Q \<Longrightarrow>\<^sub>A ?P' * ?Q'

goal (1 subgoal):
 1. A * C \<Longrightarrow>\<^sub>A true * B * (true * D)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
A * C \<Longrightarrow>\<^sub>A true * B * (true * D)

goal (1 subgoal):
 1. \<lbrakk>A \<Longrightarrow>\<^sub>A B * true; C \<Longrightarrow>\<^sub>A D * true\<rbrakk> \<Longrightarrow> A * C \<Longrightarrow>\<^sub>A B * D * true
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A * C \<Longrightarrow>\<^sub>A true * B * (true * D)
[PROOF STEP]
show "A * C \<Longrightarrow>\<^sub>A B * D * true"
[PROOF STATE]
proof (prove)
using this:
A * C \<Longrightarrow>\<^sub>A true * B * (true * D)

goal (1 subgoal):
 1. A * C \<Longrightarrow>\<^sub>A B * D * true
[PROOF STEP]
by (simp add: ab_semigroup_mult_class.mult.left_commute assn_times_comm)
[PROOF STATE]
proof (state)
this:
A * C \<Longrightarrow>\<^sub>A B * D * true

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutations_of_multiset_singleton [simp]: "permutations_of_multiset {#x#} = {[x]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutations_of_multiset {#x#} = {[x]}
[PROOF STEP]
by (simp add: permutations_of_multiset_nonempty)


[STATEMENT]
lemma is_zeroth_power [simp]: "is_nth_power 0 x \<longleftrightarrow> x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_nth_power 0 x = (x = (1::'a))
[PROOF STEP]
by (simp add: is_nth_power_def)


[STATEMENT]
lemma leads_to_disj:
  assumes "(P \<^bold>\<leadsto> R) \<sigma>"
  assumes "(Q \<^bold>\<leadsto> R) \<sigma>"
  shows "((P \<^bold>\<or> Q) \<^bold>\<leadsto> R) \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<box>(\<lambda>s. P s \<or> Q s \<longrightarrow> (\<diamond>R) s)) \<sigma>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<box>(\<lambda>s. P s \<longrightarrow> (\<diamond>R) s)) \<sigma>
(\<box>(\<lambda>s. Q s \<longrightarrow> (\<diamond>R) s)) \<sigma>

goal (1 subgoal):
 1. (\<box>(\<lambda>s. P s \<or> Q s \<longrightarrow> (\<diamond>R) s)) \<sigma>
[PROOF STEP]
unfolding defs
[PROOF STATE]
proof (prove)
using this:
\<forall>i. P (\<sigma> |\<^sub>s i) \<longrightarrow> (\<exists>ia. R (\<sigma> |\<^sub>s i |\<^sub>s ia) \<and> (\<forall>k<ia. True))
\<forall>i. Q (\<sigma> |\<^sub>s i) \<longrightarrow> (\<exists>ia. R (\<sigma> |\<^sub>s i |\<^sub>s ia) \<and> (\<forall>k<ia. True))

goal (1 subgoal):
 1. \<forall>i. P (\<sigma> |\<^sub>s i) \<or> Q (\<sigma> |\<^sub>s i) \<longrightarrow> (\<exists>ia. R (\<sigma> |\<^sub>s i |\<^sub>s ia) \<and> (\<forall>k<ia. True))
[PROOF STEP]
by simp


[STATEMENT]
lemma set_eqI:
  fixes R (structure)
  assumes "\<And>a. a \<in> A \<Longrightarrow> a .\<in> B"
    and   "\<And>b. b \<in> B \<Longrightarrow> b .\<in> A"
  shows "A {.=} B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A {.=} B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?a \<in> A \<Longrightarrow> ?a .\<in> B
?b \<in> B \<Longrightarrow> ?b .\<in> A

goal (1 subgoal):
 1. A {.=} B
[PROOF STEP]
unfolding set_eq_def
[PROOF STATE]
proof (prove)
using this:
?a \<in> A \<Longrightarrow> ?a .\<in> B
?b \<in> B \<Longrightarrow> ?b .\<in> A

goal (1 subgoal):
 1. (\<forall>x\<in>A. x .\<in> B) \<and> (\<forall>x\<in>B. x .\<in> A)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in ordered_ab_semigroup_add_0) sum_mono:
  "(\<And>i. i\<in>K \<Longrightarrow> f i \<le> g i) \<Longrightarrow> (\<Sum>i\<in>K. f i) \<le> (\<Sum>i\<in>K. g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> K \<Longrightarrow> f i \<le> g i) \<Longrightarrow> sum_0 f K \<le> sum_0 g K
[PROOF STEP]
by (induct K rule: infinite_finite_induct) (use add_mono in auto)


[STATEMENT]
lemma map2_mat_conj_exp:
  assumes "length A = length B"
  shows "map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) =
    map2 mat_conj A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length A = length B

goal (1 subgoal):
 1. map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B
[PROOF STEP]
proof (induct A arbitrary: B)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B. length [] = length B \<Longrightarrow> map2 (*) (map2 (*) [] B) (map Complex_Matrix.adjoint []) = map2 mat_conj [] B
 2. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
length [] = length B

goal (2 subgoals):
 1. \<And>B. length [] = length B \<Longrightarrow> map2 (*) (map2 (*) [] B) (map Complex_Matrix.adjoint []) = map2 mat_conj [] B
 2. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length [] = length B
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length [] = length B

goal (1 subgoal):
 1. map2 (*) (map2 (*) [] B) (map Complex_Matrix.adjoint []) = map2 mat_conj [] B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map2 (*) (map2 (*) [] B) (map Complex_Matrix.adjoint []) = map2 mat_conj [] B

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
case (Cons a A)
[PROOF STATE]
proof (state)
this:
length A = length ?B \<Longrightarrow> map2 (*) (map2 (*) A ?B) (map Complex_Matrix.adjoint A) = map2 mat_conj A ?B
length (a # A) = length B

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
hence "0 < length B"
[PROOF STATE]
proof (prove)
using this:
length A = length ?B \<Longrightarrow> map2 (*) (map2 (*) A ?B) (map Complex_Matrix.adjoint A) = map2 mat_conj A ?B
length (a # A) = length B

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

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
hence "B = hd B # (tl B)"
[PROOF STATE]
proof (prove)
using this:
0 < length B

goal (1 subgoal):
 1. B = hd B # tl B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B = hd B # tl B

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
hence "length (tl B) = length A"
[PROOF STATE]
proof (prove)
using this:
B = hd B # tl B

goal (1 subgoal):
 1. length (tl B) = length A
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
B = hd B # tl B
length A = length ?B \<Longrightarrow> map2 (*) (map2 (*) A ?B) (map Complex_Matrix.adjoint A) = map2 mat_conj A ?B
length (a # A) = length B

goal (1 subgoal):
 1. length (tl B) = length A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (tl B) = length A

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
have "map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) =
    a * hd B * Complex_Matrix.adjoint a #
    map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = a * hd B * Complex_Matrix.adjoint a # map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A)
[PROOF STEP]
by (metis (no_types, lifting) \<open>B = hd B # tl B\<close> list.map(2)
        split_conv zip_Cons_Cons)
[PROOF STATE]
proof (state)
this:
map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = a * hd B * Complex_Matrix.adjoint a # map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A)

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = a * hd B * Complex_Matrix.adjoint a # map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A)

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
have "... = mat_conj a (hd B) # map2 mat_conj A (tl B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * hd B * Complex_Matrix.adjoint a # map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A) = mat_conj a (hd B) # map2 mat_conj A (tl B)
[PROOF STEP]
using Cons \<open>length (tl B) = length A\<close>
[PROOF STATE]
proof (prove)
using this:
length A = length ?B \<Longrightarrow> map2 (*) (map2 (*) A ?B) (map Complex_Matrix.adjoint A) = map2 mat_conj A ?B
length (a # A) = length B
length (tl B) = length A

goal (1 subgoal):
 1. a * hd B * Complex_Matrix.adjoint a # map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A) = mat_conj a (hd B) # map2 mat_conj A (tl B)
[PROOF STEP]
unfolding mat_conj_def
[PROOF STATE]
proof (prove)
using this:
length A = length ?B \<Longrightarrow> map2 (*) (map2 (*) A ?B) (map Complex_Matrix.adjoint A) = map2 (\<lambda>a b. a * b * Complex_Matrix.adjoint a) A ?B
length (a # A) = length B
length (tl B) = length A

goal (1 subgoal):
 1. a * hd B * Complex_Matrix.adjoint a # map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A) = a * hd B * Complex_Matrix.adjoint a # map2 (\<lambda>x y. x * y * Complex_Matrix.adjoint x) A (tl B)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
a * hd B * Complex_Matrix.adjoint a # map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A) = mat_conj a (hd B) # map2 mat_conj A (tl B)

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a * hd B * Complex_Matrix.adjoint a # map2 (*) (map2 (*) A (tl B)) (map Complex_Matrix.adjoint A) = mat_conj a (hd B) # map2 mat_conj A (tl B)

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
have "... = map2 mat_conj (a#A) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_conj a (hd B) # map2 mat_conj A (tl B) = map2 mat_conj (a # A) B
[PROOF STEP]
using \<open>B = hd B # (tl B)\<close>
[PROOF STATE]
proof (prove)
using this:
B = hd B # tl B

goal (1 subgoal):
 1. mat_conj a (hd B) # map2 mat_conj A (tl B) = map2 mat_conj (a # A) B
[PROOF STEP]
by (metis (no_types, opaque_lifting) list.map(2) prod.simps(2)
        zip_Cons_Cons)
[PROOF STATE]
proof (state)
this:
mat_conj a (hd B) # map2 mat_conj A (tl B) = map2 mat_conj (a # A) B

goal (1 subgoal):
 1. \<And>a A B. \<lbrakk>\<And>B. length A = length B \<Longrightarrow> map2 (*) (map2 (*) A B) (map Complex_Matrix.adjoint A) = map2 mat_conj A B; length (a # A) = length B\<rbrakk> \<Longrightarrow> map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B

goal (1 subgoal):
 1. map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map2 (*) (map2 (*) (a # A) B) (map Complex_Matrix.adjoint (a # A)) = map2 mat_conj (a # A) B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Poly_times_one_minus_x_eq_psums:
  fixes xs :: "'a :: linordered_idom list"
  assumes [simp]: "length xs = length ys"
  assumes "Poly xs = Poly ys * [:1, -1:]"
  shows   "ys = psums xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ys = psums xs
[PROOF STEP]
proof (rule nth_equalityI; safe?)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length ys = length (psums xs)
 2. \<And>i. i < length ys \<Longrightarrow> ys ! i = psums xs ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length ys = length (psums xs)
 2. \<And>i. i < length ys \<Longrightarrow> ys ! i = psums xs ! i
[PROOF STEP]
assume i: "i < length ys"
[PROOF STATE]
proof (state)
this:
i < length ys

goal (2 subgoals):
 1. length ys = length (psums xs)
 2. \<And>i. i < length ys \<Longrightarrow> ys ! i = psums xs ! i
[PROOF STEP]
hence "ys ! i = coeff (Poly ys) i"
[PROOF STATE]
proof (prove)
using this:
i < length ys

goal (1 subgoal):
 1. ys ! i = coeff (Poly ys) i
[PROOF STEP]
by (simp add: nth_default_def)
[PROOF STATE]
proof (state)
this:
ys ! i = coeff (Poly ys) i

goal (2 subgoals):
 1. length ys = length (psums xs)
 2. \<And>i. i < length ys \<Longrightarrow> ys ! i = psums xs ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ys ! i = coeff (Poly ys) i

goal (2 subgoals):
 1. length ys = length (psums xs)
 2. \<And>i. i < length ys \<Longrightarrow> ys ! i = psums xs ! i
[PROOF STEP]
from coeff_poly_times_one_minus_x[of "Poly ys" i] assms
[PROOF STATE]
proof (chain)
picking this:
coeff (Poly ys) i = sum (coeff (Poly ys * [:1::'a, - (1::'a):])) {..i}
length xs = length ys
Poly xs = Poly ys * [:1::'a, - (1::'a):]
[PROOF STEP]
have "\<dots> = (\<Sum>j\<le>i. coeff (Poly xs) j)"
[PROOF STATE]
proof (prove)
using this:
coeff (Poly ys) i = sum (coeff (Poly ys * [:1::'a, - (1::'a):])) {..i}
length xs = length ys
Poly xs = Poly ys * [:1::'a, - (1::'a):]

goal (1 subgoal):
 1. coeff (Poly ys) i = sum (coeff (Poly xs)) {..i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff (Poly ys) i = sum (coeff (Poly xs)) {..i}

goal (2 subgoals):
 1. length ys = length (psums xs)
 2. \<And>i. i < length ys \<Longrightarrow> ys ! i = psums xs ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (Poly ys) i = sum (coeff (Poly xs)) {..i}

goal (2 subgoals):
 1. length ys = length (psums xs)
 2. \<And>i. i < length ys \<Longrightarrow> ys ! i = psums xs ! i
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
i < length ys
[PROOF STEP]
have "\<dots> = psums xs ! i"
[PROOF STATE]
proof (prove)
using this:
i < length ys

goal (1 subgoal):
 1. sum (coeff (Poly xs)) {..i} = psums xs ! i
[PROOF STEP]
by (auto simp: nth_default_def psums_nth)
[PROOF STATE]
proof (state)
this:
sum (coeff (Poly xs)) {..i} = psums xs ! i

goal (2 subgoals):
 1. length ys = length (psums xs)
 2. \<And>i. i < length ys \<Longrightarrow> ys ! i = psums xs ! i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ys ! i = psums xs ! i
[PROOF STEP]
show "ys ! i = psums xs ! i"
[PROOF STATE]
proof (prove)
using this:
ys ! i = psums xs ! i

goal (1 subgoal):
 1. ys ! i = psums xs ! i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ys ! i = psums xs ! i

goal (1 subgoal):
 1. length ys = length (psums xs)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma tendsto_add [tendsto_intros]:
  fixes a b :: "'a::topological_monoid_add"
  shows "(f \<longlongrightarrow> a) F \<Longrightarrow> (g \<longlongrightarrow> b) F \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> a + b) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> a + b) F
[PROOF STEP]
using filterlim_compose[OF tendsto_add_Pair, of "\<lambda>x. (f x, g x)" a b F]
[PROOF STATE]
proof (prove)
using this:
LIM x F. (f x, g x) :> nhds a \<times>\<^sub>F nhds b \<Longrightarrow> ((\<lambda>x. fst (f x, g x) + snd (f x, g x)) \<longlongrightarrow> a + b) F

goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> a + b) F
[PROOF STEP]
by (simp add: nhds_prod[symmetric] tendsto_Pair)


[STATEMENT]
lemma pred_succ [simp]: "pred (succ x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pred (succ x) = x
[PROOF STEP]
by (simp add: pred_def)


[STATEMENT]
lemma content_primitive_part_fract [simp]:
  fixes p :: "'a :: {semiring_gcd_mult_normalize,
                     factorial_semiring, ring_gcd, semiring_Gcd,idom_divide} fract poly"
  shows "p \<noteq> 0 \<Longrightarrow> content (primitive_part_fract p) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> content (primitive_part_fract p) = (1::'a)
[PROOF STEP]
unfolding primitive_part_fract_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> content (primitive_part (map_poly (fst \<circ> quot_of_fract) (smult (to_fract (Lcm (snd ` quot_of_fract ` set (coeffs p)))) p))) = (1::'a)
[PROOF STEP]
by (rule content_primitive_part)
     (auto simp: primitive_part_fract_def map_poly_eq_0_iff Lcm_0_iff)


[STATEMENT]
lemma lc_mult_scalar: "lc (p \<odot> q) = punit.lc p * lc (q::'t \<Rightarrow>\<^sub>0 'b::semiring_no_zero_divisors)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
proof (cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
 2. p \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
 2. p \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
by (simp add: lc_def)
[PROOF STATE]
proof (state)
this:
lc (p \<odot> q) = punit.lc p * lc q

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
proof (cases "q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q = 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
 2. q \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
q = 0

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
 2. q \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
q = 0

goal (1 subgoal):
 1. lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
by (simp add: lc_def)
[PROOF STATE]
proof (state)
this:
lc (p \<odot> q) = punit.lc p * lc q

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
q \<noteq> 0

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
with \<open>p \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
q \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
q \<noteq> 0

goal (1 subgoal):
 1. lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
by (simp add: lc_def lt_mult_scalar lookup_mult_scalar_lt_lt)
[PROOF STATE]
proof (state)
this:
lc (p \<odot> q) = punit.lc p * lc q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lc (p \<odot> q) = punit.lc p * lc q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pairwise_orthogonal_imp_finite:
  fixes S :: "'a::euclidean_space set"
  assumes "pairwise orthogonal S"
    shows "finite S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite S
[PROOF STEP]
have "independent (S - {0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent (S - {0::'a})
[PROOF STEP]
apply (rule pairwise_orthogonal_independent)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. pairwise orthogonal (S - {0::'a})
 2. (0::'a) \<notin> S - {0::'a}
[PROOF STEP]
apply (metis Diff_iff assms pairwise_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<notin> S - {0::'a}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
independent (S - {0::'a})

goal (1 subgoal):
 1. finite S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
independent (S - {0::'a})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
independent (S - {0::'a})

goal (1 subgoal):
 1. finite S
[PROOF STEP]
by (meson independent_imp_finite infinite_remove)
[PROOF STATE]
proof (state)
this:
finite S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pvar_trans_eval:
  assumes "a \<in> carrier R"
  assumes "b \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "i < n"
  shows "eval_at_point R b (pvar_trans n i a) = (b!i) \<ominus> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point R b (pvar_trans n i a) = b ! i \<ominus> a
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_at_point R b (pvar_trans n i a) = b ! i \<ominus> a
[PROOF STEP]
have "eval_at_point R b (pvar_trans n i a) =
        (eval_at_point R b (pvar R i)) \<oplus> (eval_at_point R b (\<ominus>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> (coord_const a)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point R b (pvar_trans n i a) = eval_at_point R b (pvar R i) \<oplus> eval_at_point R b (\<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> R.indexed_const a)
[PROOF STEP]
unfolding pvar_trans_def a_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point R b (pvar R i \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> R.indexed_const a) = eval_at_point R b (pvar R i) \<oplus> eval_at_point R b (\<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> R.indexed_const a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
b \<in> carrier (R\<^bsup>n\<^esup>)
i < n

goal (1 subgoal):
 1. eval_at_point R b (pvar R i \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> R.indexed_const a) = eval_at_point R b (pvar R i) \<oplus> eval_at_point R b (\<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> R.indexed_const a)
[PROOF STEP]
by (metis MP.add.inv_closed coord_ring_def eval_at_point_add R.indexed_const_closed local.pvar_closed)
[PROOF STATE]
proof (state)
this:
eval_at_point R b (pvar_trans n i a) = eval_at_point R b (pvar R i) \<oplus> eval_at_point R b (\<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> R.indexed_const a)

goal (1 subgoal):
 1. eval_at_point R b (pvar_trans n i a) = b ! i \<ominus> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval_at_point R b (pvar_trans n i a) = eval_at_point R b (pvar R i) \<oplus> eval_at_point R b (\<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> R.indexed_const a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
eval_at_point R b (pvar_trans n i a) = eval_at_point R b (pvar R i) \<oplus> eval_at_point R b (\<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> R.indexed_const a)

goal (1 subgoal):
 1. eval_at_point R b (pvar_trans n i a) = b ! i \<ominus> a
[PROOF STEP]
by (metis a_minus_def assms(1) assms(2) assms(3) coord_ring_def eval_at_point_a_inv eval_at_point_const eval_pvar R.indexed_const_closed)
[PROOF STATE]
proof (state)
this:
eval_at_point R b (pvar_trans n i a) = b ! i \<ominus> a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma setdist_subset_right: "\<lbrakk>T \<noteq> {}; T \<subseteq> u\<rbrakk> \<Longrightarrow> setdist S u \<le> setdist S T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<noteq> {}; T \<subseteq> u\<rbrakk> \<Longrightarrow> setdist S u \<le> setdist S T
[PROOF STEP]
apply (cases "S = {} \<or> u = {}", force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<noteq> {}; T \<subseteq> u; \<not> (S = {} \<or> u = {})\<rbrakk> \<Longrightarrow> setdist S u \<le> setdist S T
[PROOF STEP]
apply (auto simp: setdist_def intro!: bdd_belowI [where m=0] cInf_superset_mono)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iprev_le_mono: "\<lbrakk> a \<le> b; a \<in> I; b \<in> I \<rbrakk> \<Longrightarrow> iprev a I \<le> iprev b I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; a \<in> I; b \<in> I\<rbrakk> \<Longrightarrow> iprev a I \<le> iprev b I
[PROOF STEP]
apply (drule order_le_less[THEN iffD1], erule disjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> I; b \<in> I; a < b\<rbrakk> \<Longrightarrow> iprev a I \<le> iprev b I
 2. \<lbrakk>a \<in> I; b \<in> I; a = b\<rbrakk> \<Longrightarrow> iprev a I \<le> iprev b I
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> I; b \<in> I; a = b\<rbrakk> \<Longrightarrow> iprev a I \<le> iprev b I
 2. \<lbrakk>a \<in> I; b \<in> I; a < b\<rbrakk> \<Longrightarrow> iprev a I \<le> iprev b I
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> I; b \<in> I; a < b\<rbrakk> \<Longrightarrow> iprev a I \<le> iprev b I
[PROOF STEP]
apply (rule order_trans[OF iprev_mono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> I; b \<in> I; a < b\<rbrakk> \<Longrightarrow> a \<le> iprev b I
[PROOF STEP]
apply (rule ccontr, simp add: linorder_not_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> I; b \<in> I; a < b; iprev b I < a\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (blast dest: iprev_min_step)


[STATEMENT]
lemma Transset_sup:
  assumes "Transset x" "Transset y" shows "Transset (x \<squnion> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Transset (x \<squnion> y)
[PROOF STEP]
using Transset_def assms
[PROOF STATE]
proof (prove)
using this:
Transset ?x \<equiv> \<forall>y\<in>elts ?x. y \<le> ?x
Transset x
Transset y

goal (1 subgoal):
 1. Transset (x \<squnion> y)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma sum_list_triv_ereal:
  fixes a :: ereal
  shows "sum_list (map (\<lambda>_. a) xs) = length xs * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>_\<leftarrow>xs. a) = ereal (real (length xs)) * a
[PROOF STEP]
apply (cases a, simp add:sum_list_triv)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a = \<infinity> \<Longrightarrow> (\<Sum>_\<leftarrow>xs. a) = ereal (real (length xs)) * a
 2. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<leftarrow>xs. a) = ereal (real (length xs)) * a
[PROOF STEP]
by (induction xs, simp, simp)+


[STATEMENT]
lemma Ints_matE: assumes "A \<in> \<int>\<^sub>m"
  shows "\<exists> B. A = map_mat of_int B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B. A = of_int_hom.mat_hom B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B. A = of_int_hom.mat_hom B
[PROOF STEP]
have "\<forall> ij. \<exists> x. fst ij < dim_row A \<longrightarrow> snd ij < dim_col A \<longrightarrow> A $$ ij = of_int x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ij. \<exists>x. fst ij < dim_row A \<longrightarrow> snd ij < dim_col A \<longrightarrow> A $$ ij = of_int x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> \<int>\<^sub>m

goal (1 subgoal):
 1. \<forall>ij. \<exists>x. fst ij < dim_row A \<longrightarrow> snd ij < dim_col A \<longrightarrow> A $$ ij = of_int x
[PROOF STEP]
unfolding Ints_mat_def Ints_def
[PROOF STATE]
proof (prove)
using this:
A \<in> {A. \<forall>i<dim_row A. \<forall>j<dim_col A. A $$ (i, j) \<in> range of_int}

goal (1 subgoal):
 1. \<forall>ij. \<exists>x. fst ij < dim_row A \<longrightarrow> snd ij < dim_col A \<longrightarrow> A $$ ij = of_int x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>ij. \<exists>x. fst ij < dim_row A \<longrightarrow> snd ij < dim_col A \<longrightarrow> A $$ ij = of_int x

goal (1 subgoal):
 1. \<exists>B. A = of_int_hom.mat_hom B
[PROOF STEP]
from choice[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>f. \<forall>x. fst x < dim_row A \<longrightarrow> snd x < dim_col A \<longrightarrow> A $$ x = of_int (f x)
[PROOF STEP]
obtain f where
    f: "\<forall> i j. i < dim_row A \<longrightarrow> j < dim_col A \<longrightarrow> A $$ (i,j) = of_int (f (i,j))"
[PROOF STATE]
proof (prove)
using this:
\<exists>f. \<forall>x. fst x < dim_row A \<longrightarrow> snd x < dim_col A \<longrightarrow> A $$ x = of_int (f x)

goal (1 subgoal):
 1. (\<And>f. \<forall>i j. i < dim_row A \<longrightarrow> j < dim_col A \<longrightarrow> A $$ (i, j) = of_int (f (i, j)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i j. i < dim_row A \<longrightarrow> j < dim_col A \<longrightarrow> A $$ (i, j) = of_int (f (i, j))

goal (1 subgoal):
 1. \<exists>B. A = of_int_hom.mat_hom B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B. A = of_int_hom.mat_hom B
[PROOF STEP]
by (intro exI[of _ "mat (dim_row A) (dim_col A) f"] eq_matI, insert f, auto)
[PROOF STATE]
proof (state)
this:
\<exists>B. A = of_int_hom.mat_hom B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scale_zero_left [simp]: "0 *s x = 0"
  and scale_minus_left [simp]: "(- a) *s x = - (a *s x)"
  and scale_left_diff_distrib [algebra_simps, algebra_split_simps]:
    "(a - b) *s x = a *s x - b *s x"
  and scale_sum_left: "(sum f A) *s x = (\<Sum>a\<in>A. (f a) *s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) *s x = (0::'b) &&& - a *s x = - (a *s x)) &&& (a - b) *s x = a *s x - b *s x &&& sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (0::'a) *s x = (0::'b)
 2. - a *s x = - (a *s x)
 3. (a - b) *s x = a *s x - b *s x
 4. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
interpret s: additive "\<lambda>a. a *s x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. additive (\<lambda>a. a *s x)
[PROOF STEP]
by standard (rule scale_left_distrib)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (0::'a) *s x = (0::'b)
 2. - a *s x = - (a *s x)
 3. (a - b) *s x = a *s x - b *s x
 4. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
show "0 *s x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) *s x = (0::'b)
[PROOF STEP]
by (rule s.zero)
[PROOF STATE]
proof (state)
this:
(0::'a) *s x = (0::'b)

goal (3 subgoals):
 1. - a *s x = - (a *s x)
 2. (a - b) *s x = a *s x - b *s x
 3. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
show "(- a) *s x = - (a *s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a *s x = - (a *s x)
[PROOF STEP]
by (rule s.minus)
[PROOF STATE]
proof (state)
this:
- a *s x = - (a *s x)

goal (2 subgoals):
 1. (a - b) *s x = a *s x - b *s x
 2. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
show "(a - b) *s x = a *s x - b *s x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b) *s x = a *s x - b *s x
[PROOF STEP]
by (rule s.diff)
[PROOF STATE]
proof (state)
this:
(a - b) *s x = a *s x - b *s x

goal (1 subgoal):
 1. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
show "(sum f A) *s x = (\<Sum>a\<in>A. (f a) *s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A *s x = (\<Sum>a\<in>A. f a *s x)
[PROOF STEP]
by (rule s.sum)
[PROOF STATE]
proof (state)
this:
sum f A *s x = (\<Sum>a\<in>A. f a *s x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_mapping_alt: "rel_mapping Q P P' = (dom P = dom P' \<and> (\<forall>p \<in> dom P. Q (the (P p)) (the (P' p))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_mapping Q P P' = (dom P = dom P' \<and> (\<forall>p\<in>dom P. Q (the (P p)) (the (P' p))))
[PROOF STEP]
unfolding rel_mapping_def rel_fun_def rel_option_iff dom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. x = y \<longrightarrow> (case (P x, P' y) of (None, None) \<Rightarrow> True | (None, Some a) \<Rightarrow> False | (Some x, None) \<Rightarrow> False | (Some x, Some xa) \<Rightarrow> Q x xa)) = ({a. P a \<noteq> None} = {a. P' a \<noteq> None} \<and> (\<forall>p\<in>{a. P a \<noteq> None}. Q (the (P p)) (the (P' p))))
[PROOF STEP]
by (force split: option.splits)


[STATEMENT]
lemma d2:
  assumes d2: "d2 = (((e2 + q - x) mod q)*b + (q - r)) mod q"
    and s1: "s1 = (x*((y + (q - b)) mod q) + (q - r)) mod q"
    and s2: "s2 = (x*y + (q - s1)) mod q"
    and x: "x < q"
    and y: "y < q"
    and r: "r < q"
    and b: "b < q"
    and e2: "e2 < q"
  shows "d2  = (e2*b + (q - s2)) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
have s1_le_q: "s1 < q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s1 < q
[PROOF STEP]
using s1 q_gt_0
[PROOF STATE]
proof (prove)
using this:
s1 = (x * ((y + (q - b)) mod q) + (q - r)) mod q
0 < q

goal (1 subgoal):
 1. s1 < q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s1 < q

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
have s2_le_q: "s2 < q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s2 < q
[PROOF STEP]
using s2 q_gt_0
[PROOF STATE]
proof (prove)
using this:
s2 = (x * y + (q - s1)) mod q
0 < q

goal (1 subgoal):
 1. s2 < q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s2 < q

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
have xb: "(x*b) mod q = (s2  + (q - r)) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
have "s1 = (x*(y + (q - b)) + (q - r)) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s1 = (x * (y + (q - b)) + (q - r)) mod q
[PROOF STEP]
using s1 b
[PROOF STATE]
proof (prove)
using this:
s1 = (x * ((y + (q - b)) mod q) + (q - r)) mod q
b < q

goal (1 subgoal):
 1. s1 = (x * (y + (q - b)) + (q - r)) mod q
[PROOF STEP]
by (metis mod_add_left_eq mod_mult_right_eq)
[PROOF STATE]
proof (state)
this:
s1 = (x * (y + (q - b)) + (q - r)) mod q

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s1 = (x * (y + (q - b)) + (q - r)) mod q
[PROOF STEP]
have s1_dist: "s1 = (x*y + x*(q - b) + (q - r)) mod q"
[PROOF STATE]
proof (prove)
using this:
s1 = (x * (y + (q - b)) + (q - r)) mod q

goal (1 subgoal):
 1. s1 = (x * y + x * (q - b) + (q - r)) mod q
[PROOF STEP]
by(metis distrib_left)
[PROOF STATE]
proof (state)
this:
s1 = (x * y + x * (q - b) + (q - r)) mod q

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s1 = (x * y + x * (q - b) + (q - r)) mod q
[PROOF STEP]
have "s1 = (x*y + x*q - x*b + (q - r)) mod q"
[PROOF STATE]
proof (prove)
using this:
s1 = (x * y + x * (q - b) + (q - r)) mod q

goal (1 subgoal):
 1. s1 = (x * y + x * q - x * b + (q - r)) mod q
[PROOF STEP]
using distrib_left b diff_mult_distrib2
[PROOF STATE]
proof (prove)
using this:
s1 = (x * y + x * (q - b) + (q - r)) mod q
?a * (?b + ?c) = ?a * ?b + ?a * ?c
b < q
?k * (?m - ?n) = ?k * ?m - ?k * ?n

goal (1 subgoal):
 1. s1 = (x * y + x * q - x * b + (q - r)) mod q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s1 = (x * y + x * q - x * b + (q - r)) mod q

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s1 = (x * y + x * q - x * b + (q - r)) mod q
[PROOF STEP]
have "[s1 = x*y + x*q - x*b + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
s1 = (x * y + x * q - x * b + (q - r)) mod q

goal (1 subgoal):
 1. [s1 = x * y + x * q - x * b + (q - r)] (mod q)
[PROOF STEP]
by(simp add: cong_def)
[PROOF STATE]
proof (state)
this:
[s1 = x * y + x * q - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[s1 = x * y + x * q - x * b + (q - r)] (mod q)
[PROOF STEP]
have "[s1 + x * b = x*y + x*q - x*b + x*b + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[s1 = x * y + x * q - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. [s1 + x * b = x * y + x * q - x * b + x * b + (q - r)] (mod q)
[PROOF STEP]
by (metis add.commute add.left_commute cong_add_lcancel_nat)
[PROOF STATE]
proof (state)
this:
[s1 + x * b = x * y + x * q - x * b + x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[s1 + x * b = x * y + x * q - x * b + x * b + (q - r)] (mod q)
[PROOF STEP]
have "[s1 + x*b = x*y + x*q + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[s1 + x * b = x * y + x * q - x * b + x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. [s1 + x * b = x * y + x * q + (q - r)] (mod q)
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
[s1 + x * b = x * y + x * q - x * b + x * b + (q - r)] (mod q)
b < q

goal (1 subgoal):
 1. [s1 + x * b = x * y + x * q + (q - r)] (mod q)
[PROOF STEP]
by (simp add: algebra_simps)
        (metis add_diff_inverse_nat diff_diff_left diff_mult_distrib2 less_imp_add_positive mult.commute not_add_less1 zero_less_diff)
[PROOF STATE]
proof (state)
this:
[s1 + x * b = x * y + x * q + (q - r)] (mod q)

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[s1 + x * b = x * y + x * q + (q - r)] (mod q)
[PROOF STEP]
have s1_xb: "[s1 + x*b = q + x*y + x*q + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[s1 + x * b = x * y + x * q + (q - r)] (mod q)

goal (1 subgoal):
 1. [s1 + x * b = q + x * y + x * q + (q - r)] (mod q)
[PROOF STEP]
by (smt mod_add_cong mod_add_self1 cong_def)
[PROOF STATE]
proof (state)
this:
[s1 + x * b = q + x * y + x * q + (q - r)] (mod q)

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[s1 + x * b = q + x * y + x * q + (q - r)] (mod q)
[PROOF STEP]
have "[x*b = q + x*y + x*q + (q - r) - s1] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[s1 + x * b = q + x * y + x * q + (q - r)] (mod q)

goal (1 subgoal):
 1. [x * b = q + x * y + x * q + (q - r) - s1] (mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [s1 + x * b = q + x * y + x * q + (q - r)] (mod q) \<Longrightarrow> [x * b = q + x * y + x * q + (q - r) - s1] (mod q)
[PROOF STEP]
have "q + x*y + x*q + (q - r) - s1 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < q + x * y + x * q + (q - r) - s1
[PROOF STEP]
using s1_le_q
[PROOF STATE]
proof (prove)
using this:
s1 < q

goal (1 subgoal):
 1. 0 < q + x * y + x * q + (q - r) - s1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < q + x * y + x * q + (q - r) - s1

goal (1 subgoal):
 1. [s1 + x * b = q + x * y + x * q + (q - r)] (mod q) \<Longrightarrow> [x * b = q + x * y + x * q + (q - r) - s1] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < q + x * y + x * q + (q - r) - s1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < q + x * y + x * q + (q - r) - s1

goal (1 subgoal):
 1. [x * b = q + x * y + x * q + (q - r) - s1] (mod q)
[PROOF STEP]
by (metis add_diff_inverse_nat less_numeral_extra(3) s1_xb cong_add_lcancel_nat nat_diff_split)
[PROOF STATE]
proof (state)
this:
[x * b = q + x * y + x * q + (q - r) - s1] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[x * b = q + x * y + x * q + (q - r) - s1] (mod q)

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[x * b = q + x * y + x * q + (q - r) - s1] (mod q)
[PROOF STEP]
have "[x*b = x*y + x*q + (q - r) + q - s1] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[x * b = q + x * y + x * q + (q - r) - s1] (mod q)

goal (1 subgoal):
 1. [x * b = x * y + x * q + (q - r) + q - s1] (mod q)
[PROOF STEP]
by (metis add.assoc add.commute)
[PROOF STATE]
proof (state)
this:
[x * b = x * y + x * q + (q - r) + q - s1] (mod q)

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[x * b = x * y + x * q + (q - r) + q - s1] (mod q)
[PROOF STEP]
have "[x*b = x*y + (q - r) + q - s1] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[x * b = x * y + x * q + (q - r) + q - s1] (mod q)

goal (1 subgoal):
 1. [x * b = x * y + (q - r) + q - s1] (mod q)
[PROOF STEP]
by (smt Nat.add_diff_assoc cong_def less_imp_le_nat mod_mult_self1 s1_le_q semiring_normalization_rules(23))
[PROOF STATE]
proof (state)
this:
[x * b = x * y + (q - r) + q - s1] (mod q)

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[x * b = x * y + (q - r) + q - s1] (mod q)
[PROOF STEP]
have "(x*b) mod q = (x*y  + (q - r) + q - s1) mod q"
[PROOF STATE]
proof (prove)
using this:
[x * b = x * y + (q - r) + q - s1] (mod q)

goal (1 subgoal):
 1. x * b mod q = (x * y + (q - r) + q - s1) mod q
[PROOF STEP]
by(simp add: cong_def)
[PROOF STATE]
proof (state)
this:
x * b mod q = (x * y + (q - r) + q - s1) mod q

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * b mod q = (x * y + (q - r) + q - s1) mod q
[PROOF STEP]
have "(x*b) mod q = (x*y  + (q - r) + (q - s1)) mod q"
[PROOF STATE]
proof (prove)
using this:
x * b mod q = (x * y + (q - r) + q - s1) mod q

goal (1 subgoal):
 1. x * b mod q = (x * y + (q - r) + (q - s1)) mod q
[PROOF STEP]
using add.assoc s1_le_q
[PROOF STATE]
proof (prove)
using this:
x * b mod q = (x * y + (q - r) + q - s1) mod q
?a + ?b + ?c = ?a + (?b + ?c)
s1 < q

goal (1 subgoal):
 1. x * b mod q = (x * y + (q - r) + (q - s1)) mod q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x * b mod q = (x * y + (q - r) + (q - s1)) mod q

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * b mod q = (x * y + (q - r) + (q - s1)) mod q
[PROOF STEP]
have "(x*b) mod q = (x*y  + (q - s1) + (q - r)) mod q"
[PROOF STATE]
proof (prove)
using this:
x * b mod q = (x * y + (q - r) + (q - s1)) mod q

goal (1 subgoal):
 1. x * b mod q = (x * y + (q - s1) + (q - r)) mod q
[PROOF STEP]
using add.commute
[PROOF STATE]
proof (prove)
using this:
x * b mod q = (x * y + (q - r) + (q - s1)) mod q
?a + ?b = ?b + ?a

goal (1 subgoal):
 1. x * b mod q = (x * y + (q - s1) + (q - r)) mod q
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
x * b mod q = (x * y + (q - s1) + (q - r)) mod q

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * b mod q = (x * y + (q - s1) + (q - r)) mod q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * b mod q = (x * y + (q - s1) + (q - r)) mod q

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
using s2
[PROOF STATE]
proof (prove)
using this:
x * b mod q = (x * y + (q - s1) + (q - r)) mod q
s2 = (x * y + (q - s1)) mod q

goal (1 subgoal):
 1. x * b mod q = (s2 + (q - r)) mod q
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
x * b mod q = (s2 + (q - r)) mod q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x * b mod q = (s2 + (q - r)) mod q

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
have "d2 = (((e2 + q - x) mod q)*b + (q - r)) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d2 = ((e2 + q - x) mod q * b + (q - r)) mod q
[PROOF STEP]
using d2
[PROOF STATE]
proof (prove)
using this:
d2 = ((e2 + q - x) mod q * b + (q - r)) mod q

goal (1 subgoal):
 1. d2 = ((e2 + q - x) mod q * b + (q - r)) mod q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
d2 = ((e2 + q - x) mod q * b + (q - r)) mod q

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d2 = ((e2 + q - x) mod q * b + (q - r)) mod q
[PROOF STEP]
have "d2 = (((e2 + q - x))*b + (q - r)) mod q"
[PROOF STATE]
proof (prove)
using this:
d2 = ((e2 + q - x) mod q * b + (q - r)) mod q

goal (1 subgoal):
 1. d2 = ((e2 + q - x) * b + (q - r)) mod q
[PROOF STEP]
using mod_add_cong mod_mult_left_eq
[PROOF STATE]
proof (prove)
using this:
d2 = ((e2 + q - x) mod q * b + (q - r)) mod q
\<lbrakk>?a mod ?c = ?a' mod ?c; ?b mod ?c = ?b' mod ?c\<rbrakk> \<Longrightarrow> (?a + ?b) mod ?c = (?a' + ?b') mod ?c
?a mod ?c * ?b mod ?c = ?a * ?b mod ?c

goal (1 subgoal):
 1. d2 = ((e2 + q - x) * b + (q - r)) mod q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
d2 = ((e2 + q - x) * b + (q - r)) mod q

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d2 = ((e2 + q - x) * b + (q - r)) mod q
[PROOF STEP]
have "d2 = (e2*b + q*b - x*b + (q - r)) mod q"
[PROOF STATE]
proof (prove)
using this:
d2 = ((e2 + q - x) * b + (q - r)) mod q

goal (1 subgoal):
 1. d2 = (e2 * b + q * b - x * b + (q - r)) mod q
[PROOF STEP]
by (simp add: distrib_right diff_mult_distrib)
[PROOF STATE]
proof (state)
this:
d2 = (e2 * b + q * b - x * b + (q - r)) mod q

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d2 = (e2 * b + q * b - x * b + (q - r)) mod q
[PROOF STEP]
have a: "[d2 = e2*b + q*b - x*b + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
d2 = (e2 * b + q * b - x * b + (q - r)) mod q

goal (1 subgoal):
 1. [d2 = e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
by(simp add: cong_def)
[PROOF STATE]
proof (state)
this:
[d2 = e2 * b + q * b - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
have b:"[d2 = q + q + e2*b + q*b - x*b + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = e2 * b + q * b - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [d2 = e2 * b + q * b - x * b + (q - r)] (mod q) \<Longrightarrow> [d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
have "[e2*b + q*b - x*b + (q - r) = q + q + e2*b + q*b - x*b + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
by (smt assms Nat.add_diff_assoc add.commute cong_def less_imp_le_nat mod_add_self2
          mult.commute nat_mult_le_cancel_disj semiring_normalization_rules(23))
[PROOF STATE]
proof (state)
this:
[e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = e2 * b + q * b - x * b + (q - r)] (mod q) \<Longrightarrow> [d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
using cong_trans a
[PROOF STATE]
proof (prove)
using this:
[e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
\<lbrakk>[?b = ?c] (mod ?a); [?c = ?d] (mod ?a)\<rbrakk> \<Longrightarrow> [?b = ?d] (mod ?a)
[d2 = e2 * b + q * b - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)
[PROOF STEP]
have "[d2 = q + q + e2*b + q*b - (x*b) mod q + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q) \<Longrightarrow> [d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
have "[q + q + e2*b + q*b - (x*b)  + (q - r) = q + q + e2*b + q*b - (x*b) mod q + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
proof(cases "b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
 2. b \<noteq> 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = 0

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
 2. b \<noteq> 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b = 0

goal (1 subgoal):
 1. [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> 0

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
have "q*b - (x*b) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < q * b - x * b
[PROOF STEP]
using False x
[PROOF STATE]
proof (prove)
using this:
b \<noteq> 0
x < q

goal (1 subgoal):
 1. 0 < q * b - x * b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < q * b - x * b

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < q * b - x * b
[PROOF STEP]
have 1: "q + q + e2*b + q*b - (x*b) > 0"
[PROOF STATE]
proof (prove)
using this:
0 < q * b - x * b

goal (1 subgoal):
 1. 0 < q + q + e2 * b + q * b - x * b
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < q + q + e2 * b + q * b - x * b

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < q + q + e2 * b + q * b - x * b
[PROOF STEP]
have 2:"q + q + e2*b + q*b - (x*b) mod q > 0"
[PROOF STATE]
proof (prove)
using this:
0 < q + q + e2 * b + q * b - x * b

goal (1 subgoal):
 1. 0 < q + q + e2 * b + q * b - x * b mod q
[PROOF STEP]
by (simp add: q_gt_0 trans_less_add1)
[PROOF STATE]
proof (state)
this:
0 < q + q + e2 * b + q * b - x * b mod q

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < q + q + e2 * b + q * b - x * b mod q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < q + q + e2 * b + q * b - x * b mod q

goal (1 subgoal):
 1. [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
using 1 2 minus_mod_cancel
[PROOF STATE]
proof (prove)
using this:
0 < q + q + e2 * b + q * b - x * b mod q
0 < q + q + e2 * b + q * b - x * b
0 < q + q + e2 * b + q * b - x * b mod q
\<lbrakk>0 < ?a - ?b; 0 < ?a - ?b mod q\<rbrakk> \<Longrightarrow> [?a - ?b + ?c = ?a - ?b mod q + ?c] (mod q)

goal (1 subgoal):
 1. [q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q) \<Longrightarrow> [d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
using cong_trans b
[PROOF STATE]
proof (prove)
using this:
[q + q + e2 * b + q * b - x * b + (q - r) = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
\<lbrakk>[?b = ?c] (mod ?a); [?c = ?d] (mod ?a)\<rbrakk> \<Longrightarrow> [?b = ?d] (mod ?a)
[d2 = q + q + e2 * b + q * b - x * b + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
[PROOF STEP]
have c: "[d2 = q + q + e2*b + q*b - (s2  + (q - r)) mod q + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r)] (mod q)
[PROOF STEP]
using xb
[PROOF STATE]
proof (prove)
using this:
[d2 = q + q + e2 * b + q * b - x * b mod q + (q - r)] (mod q)
x * b mod q = (s2 + (q - r)) mod q

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r)] (mod q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r)] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r)] (mod q)
[PROOF STEP]
have "[d2 = q + q + e2*b + q*b - (s2  + (q - r)) + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r)] (mod q) \<Longrightarrow> [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
have "[q + q + e2*b + q*b - (s2  + (q - r)) mod q + (q - r) = q + q + e2*b + q*b - (s2  + (q - r)) + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
have "q + q + e2*b + q*b - (s2  + (q - r)) mod q > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < q + q + e2 * b + q * b - (s2 + (q - r)) mod q
[PROOF STEP]
by (metis diff_is_0_eq gr0I le_less_trans mod_less_divisor not_add_less1 q_gt_0 semiring_normalization_rules(23) trans_less_add2)
[PROOF STATE]
proof (state)
this:
0 < q + q + e2 * b + q * b - (s2 + (q - r)) mod q

goal (1 subgoal):
 1. [q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < q + q + e2 * b + q * b - (s2 + (q - r)) mod q

goal (1 subgoal):
 1. [q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
have"q + q + e2*b + q*b - (s2  + (q - r)) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < q + q + e2 * b + q * b - (s2 + (q - r))
[PROOF STEP]
using s2_le_q
[PROOF STATE]
proof (prove)
using this:
s2 < q

goal (1 subgoal):
 1. 0 < q + q + e2 * b + q * b - (s2 + (q - r))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < q + q + e2 * b + q * b - (s2 + (q - r))

goal (1 subgoal):
 1. [q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < q + q + e2 * b + q * b - (s2 + (q - r)) mod q
0 < q + q + e2 * b + q * b - (s2 + (q - r))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < q + q + e2 * b + q * b - (s2 + (q - r)) mod q
0 < q + q + e2 * b + q * b - (s2 + (q - r))

goal (1 subgoal):
 1. [q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
using minus_mod_cancel cong_sym
[PROOF STATE]
proof (prove)
using this:
0 < q + q + e2 * b + q * b - (s2 + (q - r)) mod q
0 < q + q + e2 * b + q * b - (s2 + (q - r))
\<lbrakk>0 < ?a - ?b; 0 < ?a - ?b mod q\<rbrakk> \<Longrightarrow> [?a - ?b + ?c = ?a - ?b mod q + ?c] (mod q)
[?b = ?c] (mod ?a) \<Longrightarrow> [?c = ?b] (mod ?a)

goal (1 subgoal):
 1. [q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r)] (mod q) \<Longrightarrow> [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
using cong_trans c
[PROOF STATE]
proof (prove)
using this:
[q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r) = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
\<lbrakk>[?b = ?c] (mod ?a); [?c = ?d] (mod ?a)\<rbrakk> \<Longrightarrow> [?b = ?d] (mod ?a)
[d2 = q + q + e2 * b + q * b - (s2 + (q - r)) mod q + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)
[PROOF STEP]
have d: "[d2 = q + q + e2*b + q*b - s2 - (q - r) + (q - r)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = q + q + e2 * b + q * b - (s2 + (q - r)) + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - s2 - (q - r) + (q - r)] (mod q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - s2 - (q - r) + (q - r)] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = q + q + e2 * b + q * b - s2 - (q - r) + (q - r)] (mod q)
[PROOF STEP]
have "[d2 = q + q + e2*b + q*b - s2 ] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = q + q + e2 * b + q * b - s2 - (q - r) + (q - r)] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - s2] (mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - s2 - (q - r) + (q - r)] (mod q) \<Longrightarrow> [d2 = q + q + e2 * b + q * b - s2] (mod q)
[PROOF STEP]
have "q + q + e2*b + q*b - s2 - (q - r) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < q + q + e2 * b + q * b - s2 - (q - r)
[PROOF STEP]
using s2_le_q
[PROOF STATE]
proof (prove)
using this:
s2 < q

goal (1 subgoal):
 1. 0 < q + q + e2 * b + q * b - s2 - (q - r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < q + q + e2 * b + q * b - s2 - (q - r)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - s2 - (q - r) + (q - r)] (mod q) \<Longrightarrow> [d2 = q + q + e2 * b + q * b - s2] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < q + q + e2 * b + q * b - s2 - (q - r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < q + q + e2 * b + q * b - s2 - (q - r)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - s2] (mod q)
[PROOF STEP]
using d cong_trans
[PROOF STATE]
proof (prove)
using this:
0 < q + q + e2 * b + q * b - s2 - (q - r)
[d2 = q + q + e2 * b + q * b - s2 - (q - r) + (q - r)] (mod q)
\<lbrakk>[?b = ?c] (mod ?a); [?c = ?d] (mod ?a)\<rbrakk> \<Longrightarrow> [?b = ?d] (mod ?a)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b + q * b - s2] (mod q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - s2] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b + q * b - s2] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = q + q + e2 * b + q * b - s2] (mod q)
[PROOF STEP]
have "[d2 = q + q + e2*b - s2] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = q + q + e2 * b + q * b - s2] (mod q)

goal (1 subgoal):
 1. [d2 = q + q + e2 * b - s2] (mod q)
[PROOF STEP]
by (smt Nat.add_diff_assoc2 cong_def less_imp_le_nat mod_mult_self1 mult.commute s2_le_q semiring_normalization_rules(23) trans_less_add2)
[PROOF STATE]
proof (state)
this:
[d2 = q + q + e2 * b - s2] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = q + q + e2 * b - s2] (mod q)
[PROOF STEP]
have "[d2 = q + e2*b + q - s2] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = q + q + e2 * b - s2] (mod q)

goal (1 subgoal):
 1. [d2 = q + e2 * b + q - s2] (mod q)
[PROOF STEP]
by(simp add: add.commute add.assoc)
[PROOF STATE]
proof (state)
this:
[d2 = q + e2 * b + q - s2] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = q + e2 * b + q - s2] (mod q)
[PROOF STEP]
have "[d2 = e2*b + q - s2] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = q + e2 * b + q - s2] (mod q)

goal (1 subgoal):
 1. [d2 = e2 * b + q - s2] (mod q)
[PROOF STEP]
by (smt Nat.add_diff_assoc2 add.commute cong_def less_imp_le_nat mod_add_self2 s2_le_q trans_less_add2)
[PROOF STATE]
proof (state)
this:
[d2 = e2 * b + q - s2] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = e2 * b + q - s2] (mod q)
[PROOF STEP]
have "[d2 = e2*b + (q - s2)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[d2 = e2 * b + q - s2] (mod q)

goal (1 subgoal):
 1. [d2 = e2 * b + (q - s2)] (mod q)
[PROOF STEP]
by (simp add: less_imp_le_nat s2_le_q)
[PROOF STATE]
proof (state)
this:
[d2 = e2 * b + (q - s2)] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[d2 = e2 * b + (q - s2)] (mod q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[d2 = e2 * b + (q - s2)] (mod q)

goal (1 subgoal):
 1. d2 = (e2 * b + (q - s2)) mod q
[PROOF STEP]
by(simp add: cong_def d2)
[PROOF STATE]
proof (state)
this:
d2 = (e2 * b + (q - s2)) mod q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_last :
  assumes "length r1 > 0"
  and     "length r1 = length r2"
shows "last (r1 || r2) = (last r1, last r2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (r1 || r2) = (last r1, last r2)
[PROOF STEP]
by (metis (no_types) assms(1) assms(2) less_nat_zero_code list.size(3)
      map_fst_zip zip_Nil zip_last)


[STATEMENT]
lemma dvd_imp_degree_le: "p dvd q \<Longrightarrow> q \<noteq> 0 \<Longrightarrow> degree p \<le> degree q"
  for p q :: "'a::{comm_semiring_1,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p dvd q; q \<noteq> 0\<rbrakk> \<Longrightarrow> degree p \<le> degree q
[PROOF STEP]
by (erule dvdE, hypsubst, subst degree_mult_eq) auto


[STATEMENT]
lemma inext_eq_fin: "
  \<lbrakk> inext a I = inext b I; finite I; a \<noteq> Max I; b \<noteq> Max I \<rbrakk> \<Longrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inext a I = inext b I; finite I; a \<noteq> Max I; b \<noteq> Max I\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
apply (drule arg_cong[where f="\<lambda>x. iprev x I"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; a \<noteq> Max I; b \<noteq> Max I; iprev (inext a I) I = iprev (inext b I) I\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
apply (simp add: iprev_inext_fin)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem exec_iff_execn: "(\<Gamma>\<turnstile>\<langle>c,s\<rangle> \<Rightarrow> t) = (\<exists>n. \<Gamma>\<turnstile>\<langle>c,s\<rangle> =n\<Rightarrow> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<langle>c,s\<rangle> \<Rightarrow> t = (\<exists>n. \<Gamma>\<turnstile> \<langle>c,s\<rangle> =n\<Rightarrow> t)
[PROOF STEP]
by (iprover intro: exec_to_execn execn_to_exec)


[STATEMENT]
lemma real_of_nat_Sup:
  assumes "A \<noteq> {}" "bdd_above A"
  shows "of_nat (Sup A) = (SUP a\<in>A. of_nat a :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (Sup A) = Sup (real ` A)
[PROOF STEP]
proof (intro antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. real (Sup A) \<le> Sup (real ` A)
 2. Sup (real ` A) \<le> real (Sup A)
[PROOF STEP]
show "(SUP a\<in>A. of_nat a::real) \<le> of_nat (Sup A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (real ` A) \<le> real (Sup A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
bdd_above A

goal (1 subgoal):
 1. Sup (real ` A) \<le> real (Sup A)
[PROOF STEP]
by (intro cSUP_least of_nat_mono) (auto intro: cSup_upper)
[PROOF STATE]
proof (state)
this:
Sup (real ` A) \<le> real (Sup A)

goal (1 subgoal):
 1. real (Sup A) \<le> Sup (real ` A)
[PROOF STEP]
have "Sup A \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup A \<in> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
bdd_above A

goal (1 subgoal):
 1. Sup A \<in> A
[PROOF STEP]
by (auto simp: Sup_nat_def bdd_above_nat)
[PROOF STATE]
proof (state)
this:
Sup A \<in> A

goal (1 subgoal):
 1. real (Sup A) \<le> Sup (real ` A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup A \<in> A
[PROOF STEP]
show "of_nat (Sup A) \<le> (SUP a\<in>A. of_nat a::real)"
[PROOF STATE]
proof (prove)
using this:
Sup A \<in> A

goal (1 subgoal):
 1. real (Sup A) \<le> Sup (real ` A)
[PROOF STEP]
by (intro cSUP_upper bdd_above_image_mono assms) (auto simp: mono_def)
[PROOF STATE]
proof (state)
this:
real (Sup A) \<le> Sup (real ` A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_filter_le2:
    assumes "\<And>x. P x \<Longrightarrow> Q x"
    shows "length (filter P xs) \<le> length (filter Q xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
have "\<And>x. (Q x \<and> P x) = P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (Q x \<and> P x) = P x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P ?x1 \<Longrightarrow> Q ?x1

goal (1 subgoal):
 1. \<And>x. (Q x \<and> P x) = P x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Q ?x1 \<and> P ?x1) = P ?x1

goal (1 subgoal):
 1. length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
hence "filter P xs = filter P (filter Q xs)"
[PROOF STATE]
proof (prove)
using this:
(Q ?x1 \<and> P ?x1) = P ?x1

goal (1 subgoal):
 1. filter P xs = filter P (filter Q xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter P xs = filter P (filter Q xs)

goal (1 subgoal):
 1. length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
filter P xs = filter P (filter Q xs)

goal (1 subgoal):
 1. length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
have "length (...) \<le> length (filter Q xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter P (filter Q xs)) \<le> length (filter Q xs)
[PROOF STEP]
by - (rule length_filter_le)
[PROOF STATE]
proof (state)
this:
length (filter P (filter Q xs)) \<le> length (filter Q xs)

goal (1 subgoal):
 1. length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (filter P xs) \<le> length (filter Q xs)

goal (1 subgoal):
 1. length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length (filter P xs) \<le> length (filter Q xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in comm_group) IDirProd_eq_subgroup_mult:
  assumes "subgroup H G" "subgroup J G"
  shows "IDirProd G H J = H <#> J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IDirProd G H J = H <#> J
[PROOF STEP]
unfolding IDirProd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generate G (H \<union> J) = H <#> J
[PROOF STEP]
by (rule set_mult_eq_generate_subgroup[OF assms])


[STATEMENT]
lemma filter_upt: assumes "l \<le> m" "m < n" shows "filter ((\<le>) m) [l..<n] = [m..<n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter ((\<le>) m) [l..<n] = [m..<n]
[PROOF STEP]
proof(insert assms, induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>l \<le> m; m < 0\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<0] = [m..<0]
 2. \<And>n. \<lbrakk>\<lbrakk>l \<le> m; m < n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<n] = [m..<n]; l \<le> m; m < Suc n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<Suc n] = [m..<Suc n]
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
l \<le> m
m < 0

goal (2 subgoals):
 1. \<lbrakk>l \<le> m; m < 0\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<0] = [m..<0]
 2. \<And>n. \<lbrakk>\<lbrakk>l \<le> m; m < n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<n] = [m..<n]; l \<le> m; m < Suc n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<Suc n] = [m..<Suc n]
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l \<le> m
m < 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
l \<le> m
m < 0

goal (1 subgoal):
 1. filter ((\<le>) m) [l..<0] = [m..<0]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter ((\<le>) m) [l..<0] = [m..<0]

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>l \<le> m; m < n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<n] = [m..<n]; l \<le> m; m < Suc n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<Suc n] = [m..<Suc n]
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>l \<le> m; m < n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<n] = [m..<n]; l \<le> m; m < Suc n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<Suc n] = [m..<Suc n]
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>l \<le> m; m < n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<n] = [m..<n]
l \<le> m
m < Suc n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>l \<le> m; m < n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<n] = [m..<n]; l \<le> m; m < Suc n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<Suc n] = [m..<Suc n]
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>l \<le> m; m < n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<n] = [m..<n]
l \<le> m
m < Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>l \<le> m; m < n\<rbrakk> \<Longrightarrow> filter ((\<le>) m) [l..<n] = [m..<n]
l \<le> m
m < Suc n

goal (1 subgoal):
 1. filter ((\<le>) m) [l..<Suc n] = [m..<Suc n]
[PROOF STEP]
by (cases "m = n", auto)
[PROOF STATE]
proof (state)
this:
filter ((\<le>) m) [l..<Suc n] = [m..<Suc n]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma assumes sigma: "sigma_algebra A" and less: "\<forall>a. {w. f w < a} \<in> A"
  shows less_ge: "\<forall>a. {w. (a::real) \<le> f w} \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. {w. a \<le> f w} \<in> A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. {w. a \<le> f w} \<in> A
[PROOF STEP]
fix a::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. {w. a \<le> f w} \<in> A
[PROOF STEP]
from less sigma
[PROOF STATE]
proof (chain)
picking this:
\<forall>a. {w. f w < a} \<in> A
sigma_algebra A
[PROOF STEP]
have "-{w. f w < a} \<in> A"
[PROOF STATE]
proof (prove)
using this:
\<forall>a. {w. f w < a} \<in> A
sigma_algebra A

goal (1 subgoal):
 1. - {w. f w < a} \<in> A
[PROOF STEP]
by (simp add: sigma_algebra_def)
[PROOF STATE]
proof (state)
this:
- {w. f w < a} \<in> A

goal (1 subgoal):
 1. \<And>a. {w. a \<le> f w} \<in> A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- {w. f w < a} \<in> A

goal (1 subgoal):
 1. \<And>a. {w. a \<le> f w} \<in> A
[PROOF STEP]
have "-{w. f w < a} = {w. a \<le> f w}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - {w. f w < a} = {w. a \<le> f w}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- {w. f w < a} = {w. a \<le> f w}

goal (1 subgoal):
 1. \<And>a. {w. a \<le> f w} \<in> A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{w. a \<le> f w} \<in> A
[PROOF STEP]
show "{w. a \<le> f w} \<in> A"
[PROOF STATE]
proof (prove)
using this:
{w. a \<le> f w} \<in> A

goal (1 subgoal):
 1. {w. a \<le> f w} \<in> A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
{w. a \<le> f w} \<in> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_std_normal_moment_odd:
  "integral\<^sup>L lborel (\<lambda>x. std_normal_density x * x^(2 * k + 1)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x. std_normal_density x * x ^ (2 * k + 1) = 0
[PROOF STEP]
using std_normal_moment_odd
[PROOF STATE]
proof (prove)
using this:
has_bochner_integral lborel (\<lambda>x. std_normal_density x * x ^ (2 * k + 1)) 0

goal (1 subgoal):
 1. LBINT x. std_normal_density x * x ^ (2 * k + 1) = 0
[PROOF STEP]
by (rule has_bochner_integral_integral_eq)


[STATEMENT]
lemma ran_m_mapsto_upd:
  assumes
    NC: \<open>C \<in># dom_m N\<close>
  shows \<open>ran_m (fmupd C C' N) = add_mset C' (remove1_mset (the (fmlookup N C)) (ran_m N))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ran_m (fmupd C C' N) = add_mset C' (remove1_mset (the (fmlookup N C)) (ran_m N))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ran_m (fmupd C C' N) = add_mset C' (remove1_mset (the (fmlookup N C)) (ran_m N))
[PROOF STEP]
define N' where
    \<open>N' = fmdrop C N\<close>
[PROOF STATE]
proof (state)
this:
N' = fmdrop C N

goal (1 subgoal):
 1. ran_m (fmupd C C' N) = add_mset C' (remove1_mset (the (fmlookup N C)) (ran_m N))
[PROOF STEP]
have N_N': \<open>dom_m N = add_mset C (dom_m N')\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dom_m N = add_mset C (dom_m N')
[PROOF STEP]
using NC
[PROOF STATE]
proof (prove)
using this:
C \<in># dom_m N

goal (1 subgoal):
 1. dom_m N = add_mset C (dom_m N')
[PROOF STEP]
unfolding N'_def
[PROOF STATE]
proof (prove)
using this:
C \<in># dom_m N

goal (1 subgoal):
 1. dom_m N = add_mset C (dom_m (fmdrop C N))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dom_m N = add_mset C (dom_m N')

goal (1 subgoal):
 1. ran_m (fmupd C C' N) = add_mset C' (remove1_mset (the (fmlookup N C)) (ran_m N))
[PROOF STEP]
have \<open>C \<notin># dom_m N'\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<notin># dom_m N'
[PROOF STEP]
using NC distinct_mset_dom[of N]
[PROOF STATE]
proof (prove)
using this:
C \<in># dom_m N
distinct_mset (dom_m N)

goal (1 subgoal):
 1. C \<notin># dom_m N'
[PROOF STEP]
unfolding N_N'
[PROOF STATE]
proof (prove)
using this:
C \<in># add_mset C (dom_m N')
distinct_mset (add_mset C (dom_m N'))

goal (1 subgoal):
 1. C \<notin># dom_m N'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<notin># dom_m N'

goal (1 subgoal):
 1. ran_m (fmupd C C' N) = add_mset C' (remove1_mset (the (fmlookup N C)) (ran_m N))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C \<notin># dom_m N'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
C \<notin># dom_m N'

goal (1 subgoal):
 1. ran_m (fmupd C C' N) = add_mset C' (remove1_mset (the (fmlookup N C)) (ran_m N))
[PROOF STEP]
by (auto simp: N_N' ran_m_def mset_set.insert_remove image_mset_remove1_mset_if
      intro!: image_mset_cong)
[PROOF STATE]
proof (state)
this:
ran_m (fmupd C C' N) = add_mset C' (remove1_mset (the (fmlookup N C)) (ran_m N))

goal:
No subgoals!
[PROOF STEP]
qed