[STATEMENT]
lemma rsa_inv:
  assumes d: "d = nat (fst (bezw e ((P-1)*(Q-1))) mod int ((P-1)*(Q-1)))"
    and coprime: "coprime e ((P-1)*(Q-1))"
    and prime_P: "prime (P::nat)"
    and prime_Q: "prime Q"
    and P_neq_Q: "P \<noteq> Q"
    and e_gt_1: "e > 1"
    and d_gt_1: "d > 1"
  shows "((((x) ^ e) mod (P*Q)) ^ d) mod (P*Q) = x mod (P*Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
proof(cases "x = 0 \<or> x = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<or> x = 1 \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
 2. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = 0 \<or> x = 1

goal (2 subgoals):
 1. x = 0 \<or> x = 1 \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
 2. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = 0 \<or> x = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = 0 \<or> x = 1

goal (1 subgoal):
 1. (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
by (metis assms(6) assms(7) le_simps(1) nat_power_eq_Suc_0_iff neq0_conv not_one_le_zero numeral_nat(7) power_eq_0_iff power_mod)
[PROOF STATE]
proof (state)
this:
(x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (x = 0 \<or> x = 1)

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
hence x_gt_1: "x > 1"
[PROOF STATE]
proof (prove)
using this:
\<not> (x = 0 \<or> x = 1)

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

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
define z where "z = (x ^ e) ^ d - x"
[PROOF STATE]
proof (state)
this:
z = (x ^ e) ^ d - x

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
hence z_gt_0: "z > 0"
[PROOF STATE]
proof (prove)
using this:
z = (x ^ e) ^ d - x

goal (1 subgoal):
 1. 0 < z
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z = (x ^ e) ^ d - x \<Longrightarrow> 0 < z
[PROOF STEP]
have "(x ^ e) ^ d - x = x ^ (e * d) - x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x ^ e) ^ d - x = x ^ (e * d) - x
[PROOF STEP]
by (simp add: power_mult)
[PROOF STATE]
proof (state)
this:
(x ^ e) ^ d - x = x ^ (e * d) - x

goal (1 subgoal):
 1. z = (x ^ e) ^ d - x \<Longrightarrow> 0 < z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x ^ e) ^ d - x = x ^ (e * d) - x

goal (1 subgoal):
 1. z = (x ^ e) ^ d - x \<Longrightarrow> 0 < z
[PROOF STEP]
have "... > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x ^ (e * d) - x
[PROOF STEP]
by (metis x_gt_1 e_gt_1 d_gt_1 le_neq_implies_less less_one linorder_not_less n_less_m_mult_n not_less_zero numeral_nat(7) power_increasing_iff power_one_right zero_less_diff)
[PROOF STATE]
proof (state)
this:
0 < x ^ (e * d) - x

goal (1 subgoal):
 1. z = (x ^ e) ^ d - x \<Longrightarrow> 0 < z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(x ^ e) ^ d - x = x ^ (e * d) - x
0 < x ^ (e * d) - x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x ^ e) ^ d - x = x ^ (e * d) - x
0 < x ^ (e * d) - x

goal (1 subgoal):
 1. 0 < z
[PROOF STEP]
using z_def
[PROOF STATE]
proof (prove)
using this:
(x ^ e) ^ d - x = x ^ (e * d) - x
0 < x ^ (e * d) - x
z = (x ^ e) ^ d - x

goal (1 subgoal):
 1. 0 < z
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
0 < z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < z

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
hence "[z = 0] (mod P)"
[PROOF STATE]
proof (prove)
using this:
0 < z

goal (1 subgoal):
 1. [z = 0] (mod P)
[PROOF STEP]
proof(cases "[x = 0] (mod P)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>0 < z; [x = 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
 2. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
[x = 0] (mod P)

goal (2 subgoals):
 1. \<lbrakk>0 < z; [x = 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
 2. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[x = 0] (mod P)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[x = 0] (mod P)

goal (1 subgoal):
 1. [z = 0] (mod P)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [x = 0] (mod P) \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
have "0 \<noteq> d * e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<noteq> d * e
[PROOF STEP]
by (metis (no_types) assms assms mult_is_0 not_one_less_zero)
[PROOF STATE]
proof (state)
this:
0 \<noteq> d * e

goal (1 subgoal):
 1. [x = 0] (mod P) \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> d * e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> d * e

goal (1 subgoal):
 1. [z = 0] (mod P)
[PROOF STEP]
by (metis (no_types) Groups.add_ac(2) True add_diff_inverse_nat cong_def cong_dvd_iff cong_mult_self_right dvd_0_right dvd_def dvd_trans mod_add_self2 more_arith_simps(5) nat_diff_split power_eq_if power_mult semiring_normalization_rules(7) z_def)
[PROOF STATE]
proof (state)
this:
[z = 0] (mod P)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[z = 0] (mod P)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
[x \<noteq> 0] (mod P)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
have "[e * d = 1] (mod ((P - 1) * (Q - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [e * d = 1] (mod (P - 1) * (Q - 1))
[PROOF STEP]
by (metis d bezw_inverse coprime coprime_imp_gcd_eq_1 nat_int)
[PROOF STATE]
proof (state)
this:
[e * d = 1] (mod (P - 1) * (Q - 1))

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
hence "[e * d = 1] (mod (P - 1))"
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod (P - 1) * (Q - 1))

goal (1 subgoal):
 1. [e * d = 1] (mod P - 1)
[PROOF STEP]
using assms cong_modulus_mult_nat
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod (P - 1) * (Q - 1))
d = nat (fst (bezw e ((P - 1) * (Q - 1))) mod int ((P - 1) * (Q - 1)))
coprime e ((P - 1) * (Q - 1))
prime P
prime Q
P \<noteq> Q
1 < e
1 < d
[?x = ?y] (mod ?m * ?n) \<Longrightarrow> [?x = ?y] (mod ?m)

goal (1 subgoal):
 1. [e * d = 1] (mod P - 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[e * d = 1] (mod P - 1)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[e * d = 1] (mod P - 1)
[PROOF STEP]
obtain k where k: "e*d = 1 + k*(P-1)"
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod P - 1)

goal (1 subgoal):
 1. (\<And>k. e * d = 1 + k * (P - 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_k_mod assms
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod P - 1)
\<lbrakk>coprime ?e ((?P - 1) * (?Q - 1)); ?P \<noteq> ?Q; prime ?P; prime ?Q; ?d \<noteq> 0; [?e * ?d = 1] (mod ?P - 1)\<rbrakk> \<Longrightarrow> \<exists>k. ?e * ?d = 1 + k * (?P - 1)
d = nat (fst (bezw e ((P - 1) * (Q - 1))) mod int ((P - 1) * (Q - 1)))
coprime e ((P - 1) * (Q - 1))
prime P
prime Q
P \<noteq> Q
1 < e
1 < d

goal (1 subgoal):
 1. (\<And>k. e * d = 1 + k * (P - 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
e * d = 1 + k * (P - 1)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
hence "x ^ (e * d) = x * ((x ^ (P - 1)) ^ k)"
[PROOF STATE]
proof (prove)
using this:
e * d = 1 + k * (P - 1)

goal (1 subgoal):
 1. x ^ (e * d) = x * (x ^ (P - 1)) ^ k
[PROOF STEP]
by (metis power_add power_one_right mult.commute power_mult)
[PROOF STATE]
proof (state)
this:
x ^ (e * d) = x * (x ^ (P - 1)) ^ k

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
hence "[x ^ (e * d) = x * ((x ^ (P - 1)) ^ k)] (mod P)"
[PROOF STATE]
proof (prove)
using this:
x ^ (e * d) = x * (x ^ (P - 1)) ^ k

goal (1 subgoal):
 1. [x ^ (e * d) = x * (x ^ (P - 1)) ^ k] (mod P)
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
x ^ (e * d) = x * (x ^ (P - 1)) ^ k
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. [x ^ (e * d) = x * (x ^ (P - 1)) ^ k] (mod P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[x ^ (e * d) = x * (x ^ (P - 1)) ^ k] (mod P)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[x ^ (e * d) = x * (x ^ (P - 1)) ^ k] (mod P)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
have "[x ^ (P - 1) = 1] (mod P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ (P - 1) = 1] (mod P)
[PROOF STEP]
using prime_P fermat_theorem False
[PROOF STATE]
proof (prove)
using this:
prime P
\<lbrakk>prime ?p; \<not> ?p dvd ?a\<rbrakk> \<Longrightarrow> [?a ^ (?p - 1) = 1] (mod ?p)
[x \<noteq> 0] (mod P)

goal (1 subgoal):
 1. [x ^ (P - 1) = 1] (mod P)
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
[x ^ (P - 1) = 1] (mod P)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[x ^ (P - 1) = 1] (mod P)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
have "[x ^ (e * d) = x * ((1) ^ k)] (mod P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ (e * d) = x * 1 ^ k] (mod P)
[PROOF STEP]
by (metis \<open>x ^ (e * d) = x * (x ^ (P - 1)) ^ k\<close> calculation(2) cong_pow cong_scalar_left)
[PROOF STATE]
proof (state)
this:
[x ^ (e * d) = x * 1 ^ k] (mod P)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
hence "[x ^ (e * d) = x] (mod P)"
[PROOF STATE]
proof (prove)
using this:
[x ^ (e * d) = x * 1 ^ k] (mod P)

goal (1 subgoal):
 1. [x ^ (e * d) = x] (mod P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[x ^ (e * d) = x] (mod P)

goal (1 subgoal):
 1. \<lbrakk>0 < z; [x \<noteq> 0] (mod P)\<rbrakk> \<Longrightarrow> [z = 0] (mod P)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
[x ^ (e * d) = x] (mod P)

goal (1 subgoal):
 1. [z = 0] (mod P)
[PROOF STEP]
using z_def z_gt_0
[PROOF STATE]
proof (prove)
using this:
[x ^ (e * d) = x] (mod P)
z = (x ^ e) ^ d - x
0 < z

goal (1 subgoal):
 1. [z = 0] (mod P)
[PROOF STEP]
by (simp add: cong_diff_iff_cong_0_nat power_mult)
[PROOF STATE]
proof (state)
this:
[z = 0] (mod P)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[z = 0] (mod P)

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[z = 0] (mod P)

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
have "[z = 0] (mod Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [z = 0] (mod Q)
[PROOF STEP]
proof(cases "[x = 0] (mod Q)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [x = 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
 2. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
[x = 0] (mod Q)

goal (2 subgoals):
 1. [x = 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
 2. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[x = 0] (mod Q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[x = 0] (mod Q)

goal (1 subgoal):
 1. [z = 0] (mod Q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [x = 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
have "0 \<noteq> d * e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<noteq> d * e
[PROOF STEP]
by (metis (no_types) assms mult_is_0 not_one_less_zero)
[PROOF STATE]
proof (state)
this:
0 \<noteq> d * e

goal (1 subgoal):
 1. [x = 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> d * e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> d * e

goal (1 subgoal):
 1. [z = 0] (mod Q)
[PROOF STEP]
by (metis (no_types) Groups.add_ac(2) True add_diff_inverse_nat cong_def cong_dvd_iff cong_mult_self_right dvd_0_right dvd_def dvd_trans mod_add_self2 more_arith_simps(5) nat_diff_split power_eq_if power_mult semiring_normalization_rules(7) z_def)
[PROOF STATE]
proof (state)
this:
[z = 0] (mod Q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[z = 0] (mod Q)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
[x \<noteq> 0] (mod Q)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
have "[e * d = 1] (mod ((P - 1) * (Q - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [e * d = 1] (mod (P - 1) * (Q - 1))
[PROOF STEP]
by (metis d bezw_inverse coprime coprime_imp_gcd_eq_1 nat_int)
[PROOF STATE]
proof (state)
this:
[e * d = 1] (mod (P - 1) * (Q - 1))

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
hence "[e * d = 1] (mod (Q - 1))"
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod (P - 1) * (Q - 1))

goal (1 subgoal):
 1. [e * d = 1] (mod Q - 1)
[PROOF STEP]
using assms cong_modulus_mult_nat mult.commute
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod (P - 1) * (Q - 1))
d = nat (fst (bezw e ((P - 1) * (Q - 1))) mod int ((P - 1) * (Q - 1)))
coprime e ((P - 1) * (Q - 1))
prime P
prime Q
P \<noteq> Q
1 < e
1 < d
[?x = ?y] (mod ?m * ?n) \<Longrightarrow> [?x = ?y] (mod ?m)
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. [e * d = 1] (mod Q - 1)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
[e * d = 1] (mod Q - 1)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[e * d = 1] (mod Q - 1)
[PROOF STEP]
obtain k where k: "e*d = 1 + k*(Q-1)"
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod Q - 1)

goal (1 subgoal):
 1. (\<And>k. e * d = 1 + k * (Q - 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_k_mod assms
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod Q - 1)
\<lbrakk>coprime ?e ((?P - 1) * (?Q - 1)); ?P \<noteq> ?Q; prime ?P; prime ?Q; ?d \<noteq> 0; [?e * ?d = 1] (mod ?P - 1)\<rbrakk> \<Longrightarrow> \<exists>k. ?e * ?d = 1 + k * (?P - 1)
d = nat (fst (bezw e ((P - 1) * (Q - 1))) mod int ((P - 1) * (Q - 1)))
coprime e ((P - 1) * (Q - 1))
prime P
prime Q
P \<noteq> Q
1 < e
1 < d

goal (1 subgoal):
 1. (\<And>k. e * d = 1 + k * (Q - 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
e * d = 1 + k * (Q - 1)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
hence "x ^ (e * d) = x * ((x ^ (Q - 1)) ^ k)"
[PROOF STATE]
proof (prove)
using this:
e * d = 1 + k * (Q - 1)

goal (1 subgoal):
 1. x ^ (e * d) = x * (x ^ (Q - 1)) ^ k
[PROOF STEP]
by (metis power_add power_one_right mult.commute power_mult)
[PROOF STATE]
proof (state)
this:
x ^ (e * d) = x * (x ^ (Q - 1)) ^ k

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
hence "[x ^ (e * d) = x * ((x ^ (Q - 1)) ^ k)] (mod P)"
[PROOF STATE]
proof (prove)
using this:
x ^ (e * d) = x * (x ^ (Q - 1)) ^ k

goal (1 subgoal):
 1. [x ^ (e * d) = x * (x ^ (Q - 1)) ^ k] (mod P)
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
x ^ (e * d) = x * (x ^ (Q - 1)) ^ k
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. [x ^ (e * d) = x * (x ^ (Q - 1)) ^ k] (mod P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[x ^ (e * d) = x * (x ^ (Q - 1)) ^ k] (mod P)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[x ^ (e * d) = x * (x ^ (Q - 1)) ^ k] (mod P)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
have "[x ^ (Q - 1) = 1] (mod Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ (Q - 1) = 1] (mod Q)
[PROOF STEP]
using prime_Q fermat_theorem False
[PROOF STATE]
proof (prove)
using this:
prime Q
\<lbrakk>prime ?p; \<not> ?p dvd ?a\<rbrakk> \<Longrightarrow> [?a ^ (?p - 1) = 1] (mod ?p)
[x \<noteq> 0] (mod Q)

goal (1 subgoal):
 1. [x ^ (Q - 1) = 1] (mod Q)
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
[x ^ (Q - 1) = 1] (mod Q)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[x ^ (Q - 1) = 1] (mod Q)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
have "[x ^ (e * d) = x * ((1) ^ k)] (mod Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ (e * d) = x * 1 ^ k] (mod Q)
[PROOF STEP]
by (metis \<open>x ^ (e * d) = x * (x ^ (Q - 1)) ^ k\<close> calculation(2) cong_pow cong_scalar_left)
[PROOF STATE]
proof (state)
this:
[x ^ (e * d) = x * 1 ^ k] (mod Q)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
hence "[x ^ (e * d) = x] (mod Q)"
[PROOF STATE]
proof (prove)
using this:
[x ^ (e * d) = x * 1 ^ k] (mod Q)

goal (1 subgoal):
 1. [x ^ (e * d) = x] (mod Q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[x ^ (e * d) = x] (mod Q)

goal (1 subgoal):
 1. [x \<noteq> 0] (mod Q) \<Longrightarrow> [z = 0] (mod Q)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
[x ^ (e * d) = x] (mod Q)

goal (1 subgoal):
 1. [z = 0] (mod Q)
[PROOF STEP]
using z_def z_gt_0
[PROOF STATE]
proof (prove)
using this:
[x ^ (e * d) = x] (mod Q)
z = (x ^ e) ^ d - x
0 < z

goal (1 subgoal):
 1. [z = 0] (mod Q)
[PROOF STEP]
by (simp add: cong_diff_iff_cong_0_nat power_mult)
[PROOF STATE]
proof (state)
this:
[z = 0] (mod Q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[z = 0] (mod Q)

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
[z = 0] (mod P)
[z = 0] (mod Q)
[PROOF STEP]
have "Q dvd (x ^ e) ^ d - x"
                  "P dvd (x ^ e) ^ d - x"
[PROOF STATE]
proof (prove)
using this:
[z = 0] (mod P)
[z = 0] (mod Q)

goal (1 subgoal):
 1. Q dvd (x ^ e) ^ d - x &&& P dvd (x ^ e) ^ d - x
[PROOF STEP]
using z_def assms cong_0_iff
[PROOF STATE]
proof (prove)
using this:
[z = 0] (mod P)
[z = 0] (mod Q)
z = (x ^ e) ^ d - x
d = nat (fst (bezw e ((P - 1) * (Q - 1))) mod int ((P - 1) * (Q - 1)))
coprime e ((P - 1) * (Q - 1))
prime P
prime Q
P \<noteq> Q
1 < e
1 < d
[?b = 0::?'a] (mod ?a) = (?a dvd ?b)

goal (1 subgoal):
 1. Q dvd (x ^ e) ^ d - x &&& P dvd (x ^ e) ^ d - x
[PROOF STEP]
by blast +
[PROOF STATE]
proof (state)
this:
Q dvd (x ^ e) ^ d - x
P dvd (x ^ e) ^ d - x

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
hence "P * Q dvd ((x ^ e) ^ d - x)"
[PROOF STATE]
proof (prove)
using this:
Q dvd (x ^ e) ^ d - x
P dvd (x ^ e) ^ d - x

goal (1 subgoal):
 1. P * Q dvd (x ^ e) ^ d - x
[PROOF STEP]
using assms divides_mult primes_coprime_nat
[PROOF STATE]
proof (prove)
using this:
Q dvd (x ^ e) ^ d - x
P dvd (x ^ e) ^ d - x
d = nat (fst (bezw e ((P - 1) * (Q - 1))) mod int ((P - 1) * (Q - 1)))
coprime e ((P - 1) * (Q - 1))
prime P
prime Q
P \<noteq> Q
1 < e
1 < d
\<lbrakk>?a dvd ?c; ?b dvd ?c; coprime ?a ?b\<rbrakk> \<Longrightarrow> ?a * ?b dvd ?c
\<lbrakk>prime ?p; prime ?q; ?p \<noteq> ?q\<rbrakk> \<Longrightarrow> coprime ?p ?q

goal (1 subgoal):
 1. P * Q dvd (x ^ e) ^ d - x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P * Q dvd (x ^ e) ^ d - x

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
hence "[(x ^ e) ^ d = x] (mod (P * Q))"
[PROOF STATE]
proof (prove)
using this:
P * Q dvd (x ^ e) ^ d - x

goal (1 subgoal):
 1. [(x ^ e) ^ d = x] (mod P * Q)
[PROOF STEP]
using z_gt_0 cong_altdef_nat z_def
[PROOF STATE]
proof (prove)
using this:
P * Q dvd (x ^ e) ^ d - x
0 < z
?b \<le> ?a \<Longrightarrow> [?a = ?b] (mod ?m) = (?m dvd ?a - ?b)
z = (x ^ e) ^ d - x

goal (1 subgoal):
 1. [(x ^ e) ^ d = x] (mod P * Q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[(x ^ e) ^ d = x] (mod P * Q)

goal (1 subgoal):
 1. \<not> (x = 0 \<or> x = 1) \<Longrightarrow> (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
[(x ^ e) ^ d = x] (mod P * Q)

goal (1 subgoal):
 1. (x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)
[PROOF STEP]
by (simp add: cong_def power_mod)
[PROOF STATE]
proof (state)
this:
(x ^ e mod (P * Q)) ^ d mod (P * Q) = x mod (P * Q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_to_conjugate_space: \<open>closure (to_conjugate_space ` X) = to_conjugate_space ` closure X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
have 1: \<open>to_conjugate_space ` closure X \<subseteq> closure (to_conjugate_space ` X)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_conjugate_space ` closure X \<subseteq> closure (to_conjugate_space ` X)
[PROOF STEP]
apply (rule closure_bounded_linear_image_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear to_conjugate_space
[PROOF STEP]
by (simp add: bounded_antilinear.bounded_linear)
[PROOF STATE]
proof (state)
this:
to_conjugate_space ` closure X \<subseteq> closure (to_conjugate_space ` X)

goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
have \<open>\<dots> = to_conjugate_space ` from_conjugate_space ` closure (to_conjugate_space ` X)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` from_conjugate_space ` closure (to_conjugate_space ` X)
[PROOF STEP]
by (simp add: from_conjugate_space_inverse image_image)
[PROOF STATE]
proof (state)
this:
closure (to_conjugate_space ` X) = to_conjugate_space ` from_conjugate_space ` closure (to_conjugate_space ` X)

goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
closure (to_conjugate_space ` X) = to_conjugate_space ` from_conjugate_space ` closure (to_conjugate_space ` X)

goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
have \<open>\<dots> \<subseteq> to_conjugate_space ` closure (from_conjugate_space ` to_conjugate_space ` X)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_conjugate_space ` from_conjugate_space ` closure (to_conjugate_space ` X) \<subseteq> to_conjugate_space ` closure (from_conjugate_space ` to_conjugate_space ` X)
[PROOF STEP]
apply (rule image_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_conjugate_space ` closure (to_conjugate_space ` X) \<subseteq> closure (from_conjugate_space ` to_conjugate_space ` X)
[PROOF STEP]
apply (rule closure_bounded_linear_image_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear from_conjugate_space
[PROOF STEP]
by (simp add: bounded_antilinear.bounded_linear)
[PROOF STATE]
proof (state)
this:
to_conjugate_space ` from_conjugate_space ` closure (to_conjugate_space ` X) \<subseteq> to_conjugate_space ` closure (from_conjugate_space ` to_conjugate_space ` X)

goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
to_conjugate_space ` from_conjugate_space ` closure (to_conjugate_space ` X) \<subseteq> to_conjugate_space ` closure (from_conjugate_space ` to_conjugate_space ` X)

goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
have \<open>\<dots> = to_conjugate_space ` closure X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_conjugate_space ` closure (from_conjugate_space ` to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
by (simp add: to_conjugate_space_inverse image_image)
[PROOF STATE]
proof (state)
this:
to_conjugate_space ` closure (from_conjugate_space ` to_conjugate_space ` X) = to_conjugate_space ` closure X

goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
closure (to_conjugate_space ` X) \<subseteq> to_conjugate_space ` closure X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closure (to_conjugate_space ` X) \<subseteq> to_conjugate_space ` closure X

goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
closure (to_conjugate_space ` X) \<subseteq> to_conjugate_space ` closure X
to_conjugate_space ` closure X \<subseteq> closure (to_conjugate_space ` X)

goal (1 subgoal):
 1. closure (to_conjugate_space ` X) = to_conjugate_space ` closure X
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closure (to_conjugate_space ` X) = to_conjugate_space ` closure X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_integrable_scaleR_left [simp, intro]:
  fixes a :: "_ :: {banach, second_countable_topology}"
  shows "(a \<noteq> 0 \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. f t *\<^sub>R a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<noteq> (0::'b) \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. f t *\<^sub>R a)
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<noteq> (0::'b) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x *\<^sub>R a)
[PROOF STEP]
using integrable_scaleR_left[of a M "\<lambda>x. indicator A x *\<^sub>R f x"]
[PROOF STATE]
proof (prove)
using this:
(a \<noteq> (0::'b) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)) \<Longrightarrow> integrable M (\<lambda>x. (indicat_real A x *\<^sub>R f x) *\<^sub>R a)

goal (1 subgoal):
 1. (a \<noteq> (0::'b) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x *\<^sub>R a)
[PROOF STEP]
by simp


[STATEMENT]
lemma symmetric_conv: "symmetric G \<longleftrightarrow> (\<forall>e1 \<in> arcs G. \<exists>e2 \<in> arcs G. tail G e1 = head G e2 \<and> head G e1 = tail G e2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symmetric G = (\<forall>e1\<in>arcs G. \<exists>e2\<in>arcs G. tail G e1 = head G e2 \<and> head G e1 = tail G e2)
[PROOF STEP]
unfolding symmetric_def arcs_ends_conv sym_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. (x, y) \<in> (\<lambda>e. (tail G e, head G e)) ` arcs G \<longrightarrow> (y, x) \<in> (\<lambda>e. (tail G e, head G e)) ` arcs G) = (\<forall>e1\<in>arcs G. \<exists>e2\<in>arcs G. tail G e1 = head G e2 \<and> head G e1 = tail G e2)
[PROOF STEP]
by auto


[STATEMENT]
lemma Gcd_Lcm: "Gcd A = Lcm {b. \<forall>a\<in>A. b dvd a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd A = Lcm {b. \<forall>a\<in>A. b dvd a}
[PROOF STEP]
by (rule associated_eqI) (auto intro: Gcd_dvd dvd_Lcm Gcd_greatest Lcm_least)


[STATEMENT]
lemma symm_relation_impl_preservation_equals_reflection_of_binary_predicates:
  fixes Rel  :: "('a \<times> 'a) set"
    and Pred :: "'a \<Rightarrow> 'b \<Rightarrow> bool"
  assumes symm: "sym Rel"
  shows "rel_preserves_binary_pred Rel Pred = rel_reflects_binary_pred Rel Pred"
    and "rel_preserves_binary_pred Rel Pred = rel_respects_binary_pred Rel Pred"
    and "rel_reflects_binary_pred Rel Pred = rel_respects_binary_pred Rel Pred"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_preserves_binary_pred Rel Pred = rel_reflects_binary_pred Rel Pred &&& rel_preserves_binary_pred Rel Pred = rel_respects_binary_pred Rel Pred &&& rel_reflects_binary_pred Rel Pred = rel_respects_binary_pred Rel Pred
[PROOF STEP]
using symm
[PROOF STATE]
proof (prove)
using this:
sym Rel

goal (1 subgoal):
 1. rel_preserves_binary_pred Rel Pred = rel_reflects_binary_pred Rel Pred &&& rel_preserves_binary_pred Rel Pred = rel_respects_binary_pred Rel Pred &&& rel_reflects_binary_pred Rel Pred = rel_respects_binary_pred Rel Pred
[PROOF STEP]
unfolding sym_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. (x, y) \<in> Rel \<longrightarrow> (y, x) \<in> Rel

goal (1 subgoal):
 1. rel_preserves_binary_pred Rel Pred = rel_reflects_binary_pred Rel Pred &&& rel_preserves_binary_pred Rel Pred = rel_respects_binary_pred Rel Pred &&& rel_reflects_binary_pred Rel Pred = rel_respects_binary_pred Rel Pred
[PROOF STEP]
by blast+


[STATEMENT]
lemma x_axis_intersection_equation:
  assumes
   "H = mk_circline A B C D" and
   "(A, B, C, D) \<in> hermitean_nonzero"
 shows "of_complex z \<in> circline_set x_axis \<inter> circline_set H \<longleftrightarrow>
        A*z\<^sup>2 + 2*Re B*z + D = 0 \<and> is_real z" (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (A * z\<^sup>2 + 2 * Re B * z + D = 0 \<and> is_real (cor z))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (A * z\<^sup>2 + 2 * Re B * z + D = 0 \<and> is_real (cor z))
[PROOF STEP]
have "?lhs \<longleftrightarrow> A*z\<^sup>2 + (B + cnj B)*z + D = 0 \<and> z = cnj z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
H = mk_circline (cor A) B C (cor D)
(cor A, B, C, cor D) \<in> hermitean_nonzero

goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))
[PROOF STEP]
using circline_equation_x_axis[of z]
[PROOF STATE]
proof (prove)
using this:
H = mk_circline (cor A) B C (cor D)
(cor A, B, C, cor D) \<in> hermitean_nonzero
(of_complex (cor z) \<in> circline_set x_axis) = (cor z = cnj (cor z))

goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))
[PROOF STEP]
using circline_equation[of H A B C D z]
[PROOF STATE]
proof (prove)
using this:
H = mk_circline (cor A) B C (cor D)
(cor A, B, C, cor D) \<in> hermitean_nonzero
(of_complex (cor z) \<in> circline_set x_axis) = (cor z = cnj (cor z))
\<lbrakk>H = mk_circline (cor A) B C (cor D); (cor A, B, C, cor D) \<in> hermitean_nonzero\<rbrakk> \<Longrightarrow> (of_complex (cor z) \<in> circline_set H) = circline_equation (cor A) B C (cor D) (cor z) 1

goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))
[PROOF STEP]
using hermitean_elems
[PROOF STATE]
proof (prove)
using this:
H = mk_circline (cor A) B C (cor D)
(cor A, B, C, cor D) \<in> hermitean_nonzero
(of_complex (cor z) \<in> circline_set x_axis) = (cor z = cnj (cor z))
\<lbrakk>H = mk_circline (cor A) B C (cor D); (cor A, B, C, cor D) \<in> hermitean_nonzero\<rbrakk> \<Longrightarrow> (of_complex (cor z) \<in> circline_set H) = circline_equation (cor A) B C (cor D) (cor z) 1
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> is_real ?A
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> is_real ?D
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> ?B = cnj ?C
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> cnj ?B = ?C

goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))
[PROOF STEP]
by (auto simp add: power2_eq_square field_simps)
[PROOF STATE]
proof (state)
this:
(of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))

goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (A * z\<^sup>2 + 2 * Re B * z + D = 0 \<and> is_real (cor z))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))

goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (A * z\<^sup>2 + 2 * Re B * z + D = 0 \<and> is_real (cor z))
[PROOF STEP]
using eq_cnj_iff_real[of z]
[PROOF STATE]
proof (prove)
using this:
(of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))
(cnj (cor z) = cor z) = is_real (cor z)

goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (A * z\<^sup>2 + 2 * Re B * z + D = 0 \<and> is_real (cor z))
[PROOF STEP]
using hermitean_elems[of A B C D]
[PROOF STATE]
proof (prove)
using this:
(of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (cor (A * z\<^sup>2) + (B + cnj B) * cor z + cor D = 0 \<and> cor z = cnj (cor z))
(cnj (cor z) = cor z) = is_real (cor z)
hermitean (cor A, B, C, cor D) \<Longrightarrow> is_real (cor A)
hermitean (cor A, B, C, cor D) \<Longrightarrow> is_real (cor D)
hermitean (cor A, B, C, cor D) \<Longrightarrow> B = cnj C
hermitean (cor A, B, C, cor D) \<Longrightarrow> cnj B = C

goal (1 subgoal):
 1. (of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (A * z\<^sup>2 + 2 * Re B * z + D = 0 \<and> is_real (cor z))
[PROOF STEP]
by (simp add: complex_add_cnj complex_eq_if_Re_eq)
[PROOF STATE]
proof (state)
this:
(of_complex (cor z) \<in> circline_set x_axis \<inter> circline_set H) = (A * z\<^sup>2 + 2 * Re B * z + D = 0 \<and> is_real (cor z))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cis_pi2_minus_x [simp]:
  shows "cis (pi/2 - x) = \<i> * cis(-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (pi / 2 - x) = \<i> * cis (- x)
[PROOF STEP]
using cis_divide[of "pi/2" x, symmetric]
[PROOF STATE]
proof (prove)
using this:
cis (pi / 2 - x) = cis (pi / 2) / cis x

goal (1 subgoal):
 1. cis (pi / 2 - x) = \<i> * cis (- x)
[PROOF STEP]
using cis_divide[of 0 x, symmetric]
[PROOF STATE]
proof (prove)
using this:
cis (pi / 2 - x) = cis (pi / 2) / cis x
cis (0 - x) = cis 0 / cis x

goal (1 subgoal):
 1. cis (pi / 2 - x) = \<i> * cis (- x)
[PROOF STEP]
by simp


[STATEMENT]
lemma iT_Div_card_ge: "
  card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
[PROOF STEP]
apply (case_tac "I = {}", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
[PROOF STEP]
apply (case_tac "finite I")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>I \<noteq> {}; finite I\<rbrakk> \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
 2. \<lbrakk>I \<noteq> {}; infinite I\<rbrakk> \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>I \<noteq> {}; infinite I\<rbrakk> \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
 2. \<lbrakk>I \<noteq> {}; finite I\<rbrakk> \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; finite I\<rbrakk> \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
[PROOF STEP]
apply (case_tac "d = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>I \<noteq> {}; finite I; d = 0\<rbrakk> \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
 2. \<lbrakk>I \<noteq> {}; finite I; d \<noteq> 0\<rbrakk> \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
[PROOF STEP]
apply (simp add: iT_Div_0 iTILL_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; finite I; d \<noteq> 0\<rbrakk> \<Longrightarrow> card I div d + (if card I mod d = 0 then 0 else Suc 0) \<le> card (I \<oslash> d)
[PROOF STEP]
apply (simp add: iT_Div_card_ge_aux[OF _ _ order_refl])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma interleave_ccFromList:
  "xs \<in> interleave ys zs \<Longrightarrow> ccFromList xs = ccFromList ys \<squnion> ccFromList zs \<squnion> ccProd (set ys) (set zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> ys \<otimes> zs \<Longrightarrow> ccFromList xs = ccFromList ys \<squnion> ccFromList zs \<squnion> set ys G\<times> set zs
[PROOF STEP]
by (induction rule: interleave_induct)
     (auto simp add: interleave_set ccProd_comm ccProd_insert2[where S' = "set xs" for xs]  ccProd_insert1[where S' = "set xs" for xs] )


[STATEMENT]
lemma (in UP_cring) taylor_term_add:
  assumes "p \<in> carrier P"
  assumes "q \<in> carrier P"
  assumes "a \<in> carrier R"
  shows "taylor_term a (p \<oplus>\<^bsub>UP R\<^esub>q) i = taylor_term a p i \<oplus>\<^bsub>UP R\<^esub> taylor_term a q i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. taylor_term a (p \<oplus>\<^bsub>UP R\<^esub> q) i = taylor_term a p i \<oplus>\<^bsub>UP R\<^esub> taylor_term a q i
[PROOF STEP]
using assms   taylor_expansion_add[of p q a]
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P
q \<in> carrier P
a \<in> carrier R
\<lbrakk>p \<in> carrier P; q \<in> carrier P; a \<in> carrier R\<rbrakk> \<Longrightarrow> taylor_expansion R a (p \<oplus>\<^bsub>UP R\<^esub> q) = taylor_expansion R a p \<oplus>\<^bsub>UP R\<^esub> taylor_expansion R a q

goal (1 subgoal):
 1. taylor_term a (p \<oplus>\<^bsub>UP R\<^esub> q) i = taylor_term a p i \<oplus>\<^bsub>UP R\<^esub> taylor_term a q i
[PROOF STEP]
unfolding taylor_term_def
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P
q \<in> carrier P
a \<in> carrier R
\<lbrakk>p \<in> carrier P; q \<in> carrier P; a \<in> carrier R\<rbrakk> \<Longrightarrow> taylor_expansion R a (p \<oplus>\<^bsub>UP R\<^esub> q) = taylor_expansion R a p \<oplus>\<^bsub>UP R\<^esub> taylor_expansion R a q

goal (1 subgoal):
 1. taylor_expansion R a (p \<oplus>\<^bsub>UP R\<^esub> q) i \<odot>\<^bsub>UP R\<^esub> X_poly_minus R a [^]\<^bsub>UP R\<^esub> i = taylor_expansion R a p i \<odot>\<^bsub>UP R\<^esub> X_poly_minus R a [^]\<^bsub>UP R\<^esub> i \<oplus>\<^bsub>UP R\<^esub> taylor_expansion R a q i \<odot>\<^bsub>UP R\<^esub> X_poly_minus R a [^]\<^bsub>UP R\<^esub> i
[PROOF STEP]
using P.nat_pow_closed P_def taylor_closed X_minus_closed cfs_add smult_l_distr
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P
q \<in> carrier P
a \<in> carrier R
\<lbrakk>p \<in> carrier P; q \<in> carrier P; a \<in> carrier R\<rbrakk> \<Longrightarrow> taylor_expansion R a (p \<oplus>\<^bsub>UP R\<^esub> q) = taylor_expansion R a p \<oplus>\<^bsub>UP R\<^esub> taylor_expansion R a q
?x \<in> carrier P \<Longrightarrow> ?x [^]\<^bsub>P\<^esub> ?n \<in> carrier P
P \<equiv> UP R
\<lbrakk>?f \<in> carrier P; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> T\<^bsub>?a\<^esub> ?f \<in> carrier P
?a \<in> carrier R \<Longrightarrow> X_poly_minus R ?a \<in> carrier P
\<lbrakk>?p \<in> carrier P; ?q \<in> carrier P\<rbrakk> \<Longrightarrow> (?p \<oplus>\<^bsub>P\<^esub> ?q) ?n = ?p ?n \<oplus> ?q ?n
\<lbrakk>?a \<in> carrier R; ?b \<in> carrier R; ?x \<in> carrier P\<rbrakk> \<Longrightarrow> (?a \<oplus> ?b) \<odot>\<^bsub>P\<^esub> ?x = ?a \<odot>\<^bsub>P\<^esub> ?x \<oplus>\<^bsub>P\<^esub> ?b \<odot>\<^bsub>P\<^esub> ?x

goal (1 subgoal):
 1. taylor_expansion R a (p \<oplus>\<^bsub>UP R\<^esub> q) i \<odot>\<^bsub>UP R\<^esub> X_poly_minus R a [^]\<^bsub>UP R\<^esub> i = taylor_expansion R a p i \<odot>\<^bsub>UP R\<^esub> X_poly_minus R a [^]\<^bsub>UP R\<^esub> i \<oplus>\<^bsub>UP R\<^esub> taylor_expansion R a q i \<odot>\<^bsub>UP R\<^esub> X_poly_minus R a [^]\<^bsub>UP R\<^esub> i
[PROOF STEP]
by (simp add: taylor_def cfs_closed)


[STATEMENT]
lemma ideal_points_on_unit_circle:
  shows "\<forall> z \<in> ideal_points H. z \<in> circline_set unit_circle"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>z\<in>ideal_points H. z \<in> circline_set unit_circle
[PROOF STEP]
unfolding ideal_points_def circline_intersection_def circline_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>z\<in>{z. on_circline H z \<and> on_circline unit_circle z}. z \<in> Collect (on_circline unit_circle)
[PROOF STEP]
by simp


[STATEMENT]
lemma totient_dvd_mono:
  assumes "m dvd n" "n > 0"
  shows   "totient m \<le> totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient m \<le> totient n
[PROOF STEP]
by (cases "m = 0") (insert assms, auto intro: dvd_imp_le totient_dvd)


[STATEMENT]
lemma inversions_altdef: "inversions xs = {(i, j). i < j \<and> j < length xs \<and> less (xs ! j) (xs ! i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversions xs = {(i, j). i < j \<and> j < length xs \<and> xs ! j < xs ! i}
[PROOF STEP]
by (auto simp: inversions.simps)


[STATEMENT]
lemma to_fun_monic_monom:
  assumes "b \<in> carrier R"
  shows "to_fun (monom P \<one> n) b = b[^]n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (monom P \<one> n) b = b [^] n
[PROOF STEP]
by (simp add: assms to_fun_monom)


[STATEMENT]
lemma prm_set_distributes_difference:
  shows "\<pi> {$} (S - T) = (\<pi> {$} S) - (\<pi> {$} T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> {$} (S - T) = \<pi> {$} S - \<pi> {$} T
[PROOF STEP]
unfolding prm_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) \<pi> ` (S - T) = ($) \<pi> ` S - ($) \<pi> ` T
[PROOF STEP]
using prm_apply_injective image_set_diff
[PROOF STATE]
proof (prove)
using this:
inj (($) ?\<pi>)
inj ?f \<Longrightarrow> ?f ` (?A - ?B) = ?f ` ?A - ?f ` ?B

goal (1 subgoal):
 1. ($) \<pi> ` (S - T) = ($) \<pi> ` S - ($) \<pi> ` T
[PROOF STEP]
by metis


[STATEMENT]
lemma binaryset_sums:
  assumes f: "f {} = 0"
  shows  "(\<lambda>n. f (binaryset A B n)) sums (f A + f B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (binaryset A B n)) sums (f A + f B)
[PROOF STEP]
by (simp add: sums_def LIMSEQ_binaryset [where f=f, OF f] atLeast0LessThan)


[STATEMENT]
lemma vec_to_iarray_morph:
  fixes A::"'a^'n::{mod_type}"
  shows "(A = B) = (vec_to_iarray A = vec_to_iarray B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = B) = (vec_to_iarray A = vec_to_iarray B)
[PROOF STEP]
by (metis vec_eq_iff vec_to_iarray_nth')


[STATEMENT]
lemma esqrt_continuous:
  "continuous_on UNIV esqrt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on UNIV esqrt
[PROOF STEP]
unfolding esqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on UNIV (\<lambda>x. enn2ereal (ennsqrt (e2ennreal x)))
[PROOF STEP]
apply (rule continuous_on_compose2[of UNIV enn2ereal], intro continuous_on_enn2ereal)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. continuous_on UNIV (\<lambda>x. ennsqrt (e2ennreal x))
 2. range (\<lambda>x. ennsqrt (e2ennreal x)) \<subseteq> UNIV
[PROOF STEP]
by (rule continuous_on_compose2[of UNIV ennsqrt], auto intro!: ennsqrt_continuous continuous_on_e2ennreal)


[STATEMENT]
lemma in_orthogonal_complement_basis:
  fixes B::"'a::{euclidean_space} set"
  assumes S: "subspace S"
  and ind_B: "independent B"
  and B: "B \<subseteq> S"
  and span_B: "S \<subseteq> span B"
  shows "(v \<in> orthogonal_complement S) = (\<forall>a\<in>B. orthogonal a v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<in> orthogonal_complement S) = (\<forall>a\<in>B. orthogonal a v)
[PROOF STEP]
proof (unfold orthogonal_complement_def, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>\<forall>x\<in>S. orthogonal v x; a \<in> B\<rbrakk> \<Longrightarrow> orthogonal a v
 2. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>\<forall>x\<in>S. orthogonal v x; a \<in> B\<rbrakk> \<Longrightarrow> orthogonal a v
 2. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
assume "\<forall>x\<in>S. orthogonal v x" and "a \<in> B"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. orthogonal v x
a \<in> B

goal (2 subgoals):
 1. \<And>a. \<lbrakk>\<forall>x\<in>S. orthogonal v x; a \<in> B\<rbrakk> \<Longrightarrow> orthogonal a v
 2. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
thus "orthogonal a v"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. orthogonal v x
a \<in> B

goal (1 subgoal):
 1. orthogonal a v
[PROOF STEP]
by (metis B orthogonal_commute rev_subsetD)
[PROOF STATE]
proof (state)
this:
orthogonal a v

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
assume o: "\<forall>a\<in>B. orthogonal a v" and x: "x \<in> S"
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>B. orthogonal a v
x \<in> S

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
have finite_B: "finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite B
[PROOF STEP]
using independent_bound_general[OF ind_B]
[PROOF STATE]
proof (prove)
using this:
finite B \<and> card B \<le> dim B

goal (1 subgoal):
 1. finite B
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
finite B

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
have span_B_eq: "S = span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = span B
[PROOF STEP]
using B S span_B span_subspace
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> S
subspace S
S \<subseteq> span B
\<lbrakk>?A \<subseteq> ?B; ?B \<subseteq> span ?A; subspace ?B\<rbrakk> \<Longrightarrow> span ?A = ?B

goal (1 subgoal):
 1. S = span B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S = span B

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
obtain f where f: "(\<Sum>a\<in>B. f a *\<^sub>R a) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. (\<Sum>a\<in>B. f a *\<^sub>R a) = x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using span_finite[OF finite_B]
[PROOF STATE]
proof (prove)
using this:
span B = range (\<lambda>u. \<Sum>v\<in>B. u v *\<^sub>R v)

goal (1 subgoal):
 1. (\<And>f. (\<Sum>a\<in>B. f a *\<^sub>R a) = x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
span B = range (\<lambda>u. \<Sum>v\<in>B. u v *\<^sub>R v)
x \<in> S

goal (1 subgoal):
 1. (\<And>f. (\<Sum>a\<in>B. f a *\<^sub>R a) = x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding span_B_eq
[PROOF STATE]
proof (prove)
using this:
span B = range (\<lambda>u. \<Sum>v\<in>B. u v *\<^sub>R v)
x \<in> span B

goal (1 subgoal):
 1. (\<And>f. (\<Sum>a\<in>B. f a *\<^sub>R a) = x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>B. f a *\<^sub>R a) = x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
have "v \<bullet> x = v \<bullet> (\<Sum>a\<in>B. f a *\<^sub>R a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet> x = v \<bullet> (\<Sum>a\<in>B. f a *\<^sub>R a)
[PROOF STEP]
unfolding f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet> x = v \<bullet> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
v \<bullet> x = v \<bullet> (\<Sum>a\<in>B. f a *\<^sub>R a)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v \<bullet> x = v \<bullet> (\<Sum>a\<in>B. f a *\<^sub>R a)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
have "... = (\<Sum>a\<in>B. v \<bullet> (f a *\<^sub>R a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet> (\<Sum>a\<in>B. f a *\<^sub>R a) = (\<Sum>a\<in>B. v \<bullet> f a *\<^sub>R a)
[PROOF STEP]
unfolding inner_sum_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>y\<in>B. v \<bullet> f y *\<^sub>R y) = (\<Sum>a\<in>B. v \<bullet> f a *\<^sub>R a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
v \<bullet> (\<Sum>a\<in>B. f a *\<^sub>R a) = (\<Sum>a\<in>B. v \<bullet> f a *\<^sub>R a)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v \<bullet> (\<Sum>a\<in>B. f a *\<^sub>R a) = (\<Sum>a\<in>B. v \<bullet> f a *\<^sub>R a)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
have "... = (\<Sum>a\<in>B. f a * (v \<bullet> a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>B. v \<bullet> f a *\<^sub>R a) = (\<Sum>a\<in>B. f a * (v \<bullet> a))
[PROOF STEP]
unfolding inner_scaleR_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>B. f a * (v \<bullet> a)) = (\<Sum>a\<in>B. f a * (v \<bullet> a))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>B. v \<bullet> f a *\<^sub>R a) = (\<Sum>a\<in>B. f a * (v \<bullet> a))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>B. v \<bullet> f a *\<^sub>R a) = (\<Sum>a\<in>B. f a * (v \<bullet> a))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>B. f a * (v \<bullet> a)) = 0
[PROOF STEP]
using sum.neutral o
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>?A. ?g x = (0::?'a) \<Longrightarrow> sum ?g ?A = (0::?'a)
\<forall>a\<in>B. orthogonal a v

goal (1 subgoal):
 1. (\<Sum>a\<in>B. f a * (v \<bullet> a)) = 0
[PROOF STEP]
by (simp add: orthogonal_def inner_commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>B. f a * (v \<bullet> a)) = 0

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>B. orthogonal a v; x \<in> S\<rbrakk> \<Longrightarrow> orthogonal v x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
v \<bullet> x = 0
[PROOF STEP]
show "orthogonal v x"
[PROOF STATE]
proof (prove)
using this:
v \<bullet> x = 0

goal (1 subgoal):
 1. orthogonal v x
[PROOF STEP]
unfolding orthogonal_def
[PROOF STATE]
proof (prove)
using this:
v \<bullet> x = 0

goal (1 subgoal):
 1. v \<bullet> x = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
orthogonal v x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma xy_le_uxx_vyy [mono_intros]:
  assumes "u > 0" "u * v = (1::real)"
  shows "x * y \<le> u * x^2/2 + v * y^2/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y \<le> u * x\<^sup>2 / 2 + v * y\<^sup>2 / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * y \<le> u * x\<^sup>2 / 2 + v * y\<^sup>2 / 2
[PROOF STEP]
have "v > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < u
u * v = 1

goal (1 subgoal):
 1. 0 < v
[PROOF STEP]
by (metis (full_types) dual_order.strict_implies_order le_less_linear mult_nonneg_nonpos not_one_le_zero)
[PROOF STATE]
proof (state)
this:
0 < v

goal (1 subgoal):
 1. x * y \<le> u * x\<^sup>2 / 2 + v * y\<^sup>2 / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < v
[PROOF STEP]
have *: "sqrt u * sqrt v = 1"
[PROOF STATE]
proof (prove)
using this:
0 < v

goal (1 subgoal):
 1. sqrt u * sqrt v = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < v
0 < u
u * v = 1

goal (1 subgoal):
 1. sqrt u * sqrt v = 1
[PROOF STEP]
by (metis real_sqrt_mult real_sqrt_one)
[PROOF STATE]
proof (state)
this:
sqrt u * sqrt v = 1

goal (1 subgoal):
 1. x * y \<le> u * x\<^sup>2 / 2 + v * y\<^sup>2 / 2
[PROOF STEP]
have "(sqrt u * x - sqrt v * y)^2 \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (sqrt u * x - sqrt v * y)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> (sqrt u * x - sqrt v * y)\<^sup>2

goal (1 subgoal):
 1. x * y \<le> u * x\<^sup>2 / 2 + v * y\<^sup>2 / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> (sqrt u * x - sqrt v * y)\<^sup>2
[PROOF STEP]
have "u * x^2 + v * y^2 - 2 * 1 * x * y \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (sqrt u * x - sqrt v * y)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> u * x\<^sup>2 + v * y\<^sup>2 - 2 * 1 * x * y
[PROOF STEP]
unfolding power2_eq_square *[symmetric]
[PROOF STATE]
proof (prove)
using this:
0 \<le> (sqrt u * x - sqrt v * y) * (sqrt u * x - sqrt v * y)

goal (1 subgoal):
 1. 0 \<le> u * (x * x) + v * (y * y) - 2 * (sqrt u * sqrt v) * x * y
[PROOF STEP]
using \<open>u > 0\<close> \<open>v > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> (sqrt u * x - sqrt v * y) * (sqrt u * x - sqrt v * y)
0 < u
0 < v

goal (1 subgoal):
 1. 0 \<le> u * (x * x) + v * (y * y) - 2 * (sqrt u * sqrt v) * x * y
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> u * x\<^sup>2 + v * y\<^sup>2 - 2 * 1 * x * y

goal (1 subgoal):
 1. x * y \<le> u * x\<^sup>2 / 2 + v * y\<^sup>2 / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> u * x\<^sup>2 + v * y\<^sup>2 - 2 * 1 * x * y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> u * x\<^sup>2 + v * y\<^sup>2 - 2 * 1 * x * y

goal (1 subgoal):
 1. x * y \<le> u * x\<^sup>2 / 2 + v * y\<^sup>2 / 2
[PROOF STEP]
by (auto simp add: algebra_simps divide_simps)
[PROOF STATE]
proof (state)
this:
x * y \<le> u * x\<^sup>2 / 2 + v * y\<^sup>2 / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lex_pp_alt: "lex_pp s t = (s = t \<or> (\<exists>x. lookup_pp s x < lookup_pp t x \<and> (\<forall>y<x. lookup_pp s y = lookup_pp t y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lex_pp s t = (s = t \<or> (\<exists>x. lookup_pp s x < lookup_pp t x \<and> (\<forall>y<x. lookup_pp s y = lookup_pp t y)))
[PROOF STEP]
by (transfer, fact lex_pm_alt)


[STATEMENT]
lemma desargues_config_3D_coplanar_4_ter :
  assumes "desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma>"
  shows "rk {A, B, C, \<gamma>} = 3" and "rk {A', B', C', \<gamma>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, \<gamma>} = 3 &&& rk {A', B', C', \<gamma>} = 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rk {A, B, C, \<gamma>} = 3
 2. rk {A', B', C', \<gamma>} = 3
[PROOF STEP]
show "rk {A, B, C, \<gamma>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, \<gamma>} = 3
[PROOF STEP]
using assms desargues_config_3D_def[of A B C A' B' C' P \<alpha> \<beta> \<gamma>] coplanar_4_ter
[PROOF STATE]
proof (prove)
using this:
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma>
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma> \<equiv> rk {A, B, C} = 3 \<and> rk {A', B', C'} = 3 \<and> rk {A, A', P} = 2 \<and> rk {B, B', P} = 2 \<and> rk {C, C', P} = 2 \<and> 4 \<le> rk {A, B, C, A', B', C'} \<and> rk {B, C, \<alpha>} = 2 \<and> rk {B', C', \<alpha>} = 2 \<and> rk {A, C, \<beta>} = 2 \<and> rk {A', C', \<beta>} = 2 \<and> rk {A, B, \<gamma>} = 2 \<and> rk {A', B', \<gamma>} = 2
\<lbrakk>rk {?A, ?B, ?C} = 3; rk {?A, ?B, ?\<gamma>} = 2\<rbrakk> \<Longrightarrow> rk {?A, ?B, ?C, ?\<gamma>} = 3

goal (1 subgoal):
 1. rk {A, B, C, \<gamma>} = 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rk {A, B, C, \<gamma>} = 3

goal (1 subgoal):
 1. rk {A', B', C', \<gamma>} = 3
[PROOF STEP]
show "rk {A', B', C', \<gamma>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A', B', C', \<gamma>} = 3
[PROOF STEP]
using assms desargues_config_3D_def[of A B C A' B' C' P \<alpha> \<beta> \<gamma>] coplanar_4_ter
[PROOF STATE]
proof (prove)
using this:
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma>
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma> \<equiv> rk {A, B, C} = 3 \<and> rk {A', B', C'} = 3 \<and> rk {A, A', P} = 2 \<and> rk {B, B', P} = 2 \<and> rk {C, C', P} = 2 \<and> 4 \<le> rk {A, B, C, A', B', C'} \<and> rk {B, C, \<alpha>} = 2 \<and> rk {B', C', \<alpha>} = 2 \<and> rk {A, C, \<beta>} = 2 \<and> rk {A', C', \<beta>} = 2 \<and> rk {A, B, \<gamma>} = 2 \<and> rk {A', B', \<gamma>} = 2
\<lbrakk>rk {?A, ?B, ?C} = 3; rk {?A, ?B, ?\<gamma>} = 2\<rbrakk> \<Longrightarrow> rk {?A, ?B, ?C, ?\<gamma>} = 3

goal (1 subgoal):
 1. rk {A', B', C', \<gamma>} = 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rk {A', B', C', \<gamma>} = 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccInf_mono:
  assumes [intro]: "countable B" "countable A"
  assumes "\<And>b. b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<le> b"
  shows "Inf A \<le> Inf B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf A \<le> Inf B
[PROOF STEP]
proof (rule ccInf_greatest)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. countable B
 2. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. countable B
 2. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
assume "b \<in> B"
[PROOF STATE]
proof (state)
this:
b \<in> B

goal (2 subgoals):
 1. countable B
 2. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
countable B
countable A
?b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<le> ?b
b \<in> B
[PROOF STEP]
obtain a where "a \<in> A" and "a \<le> b"
[PROOF STATE]
proof (prove)
using this:
countable B
countable A
?b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<le> ?b
b \<in> B

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> A; a \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> A
a \<le> b

goal (2 subgoals):
 1. countable B
 2. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
from \<open>a \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
[PROOF STEP]
have "Inf A \<le> a"
[PROOF STATE]
proof (prove)
using this:
a \<in> A

goal (1 subgoal):
 1. Inf A \<le> a
[PROOF STEP]
by (rule ccInf_lower[rotated]) auto
[PROOF STATE]
proof (state)
this:
Inf A \<le> a

goal (2 subgoals):
 1. countable B
 2. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
with \<open>a \<le> b\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
Inf A \<le> a
[PROOF STEP]
show "Inf A \<le> b"
[PROOF STATE]
proof (prove)
using this:
a \<le> b
Inf A \<le> a

goal (1 subgoal):
 1. Inf A \<le> b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf A \<le> b

goal (1 subgoal):
 1. countable B
[PROOF STEP]
qed auto


[STATEMENT]
lemma tendsto_add: "P \<longlonglongrightarrow> (L :: 'a :: real_normed_vector) \<Longrightarrow> (\<lambda>n. P n + c) \<longlonglongrightarrow> L + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<longlonglongrightarrow> L \<Longrightarrow> (\<lambda>n. P n + c) \<longlonglongrightarrow> L + c
[PROOF STEP]
by (intro tendsto_intros)


[STATEMENT]
lemma subset_iprev_closed: "\<lbrakk> n \<in> B; A \<subseteq> B \<rbrakk> \<Longrightarrow> iprev n A \<in> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<in> B; A \<subseteq> B\<rbrakk> \<Longrightarrow> iprev n A \<in> B
[PROOF STEP]
apply (case_tac "n \<in> A")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>n \<in> B; A \<subseteq> B; n \<in> A\<rbrakk> \<Longrightarrow> iprev n A \<in> B
 2. \<lbrakk>n \<in> B; A \<subseteq> B; n \<notin> A\<rbrakk> \<Longrightarrow> iprev n A \<in> B
[PROOF STEP]
apply (fastforce simp: iprev_closed)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<in> B; A \<subseteq> B; n \<notin> A\<rbrakk> \<Longrightarrow> iprev n A \<in> B
[PROOF STEP]
apply (simp add: not_in_iprev_fix)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Always_includes_reachable: "F \<in> Always A ==> reachable F \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<in> Always A \<Longrightarrow> reachable F \<subseteq> A
[PROOF STEP]
apply (simp add: Stable_def Constrains_def constrains_def Always_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Init F \<subseteq> A \<and> (\<forall>act\<in>Acts F. act `` (reachable F \<inter> A) \<subseteq> A) \<Longrightarrow> reachable F \<subseteq> A
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Init F \<subseteq> A \<and> (\<forall>act\<in>Acts F. act `` (reachable F \<inter> A) \<subseteq> A); x \<in> reachable F\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
apply (erule reachable.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x s. \<lbrakk>Init F \<subseteq> A \<and> (\<forall>act\<in>Acts F. act `` (reachable F \<inter> A) \<subseteq> A); s \<in> Init F\<rbrakk> \<Longrightarrow> s \<in> A
 2. \<And>x act s s'. \<lbrakk>Init F \<subseteq> A \<and> (\<forall>act\<in>Acts F. act `` (reachable F \<inter> A) \<subseteq> A); act \<in> Acts F; s \<in> reachable F; s \<in> A; (s, s') \<in> act\<rbrakk> \<Longrightarrow> s' \<in> A
[PROOF STEP]
apply (blast intro: reachable.intros)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mod_plus_minus_range_q:
  assumes "y \<in> {-\<lfloor>q/2\<rfloor>..\<lfloor>q/2\<rfloor>}"
  shows "y mod+- q = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y mod+- q = y
[PROOF STEP]
using mod_plus_minus_range[OF q_gt_zero, of y]
[PROOF STATE]
proof (prove)
using this:
y mod+- q \<in> {- \<lfloor>real_of_int q / 2\<rfloor>..\<lfloor>real_of_int q / 2\<rfloor>}

goal (1 subgoal):
 1. y mod+- q = y
[PROOF STEP]
unfolding mod_plus_minus_def
[PROOF STATE]
proof (prove)
using this:
(y + \<lfloor>real_of_int q / 2\<rfloor>) mod q - \<lfloor>real_of_int q / 2\<rfloor> \<in> {- \<lfloor>real_of_int q / 2\<rfloor>..\<lfloor>real_of_int q / 2\<rfloor>}

goal (1 subgoal):
 1. (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q - \<lfloor>real_of_int q / 2\<rfloor> = y
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q; (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q \<le> 2 * \<lfloor>real_of_int q / 2\<rfloor>\<rbrakk> \<Longrightarrow> (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q - \<lfloor>real_of_int q / 2\<rfloor> = y
[PROOF STEP]
have this': "y + \<lfloor>real_of_int q/2\<rfloor> \<in> {0..<q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y + \<lfloor>real_of_int q / 2\<rfloor> \<in> {0..<q}
[PROOF STEP]
using assms two_mid_lt_q
[PROOF STATE]
proof (prove)
using this:
y \<in> {- \<lfloor>real_of_int q / 2\<rfloor>..\<lfloor>real_of_int q / 2\<rfloor>}
2 * \<lfloor>real_of_int q / 2\<rfloor> < q

goal (1 subgoal):
 1. y + \<lfloor>real_of_int q / 2\<rfloor> \<in> {0..<q}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y + \<lfloor>real_of_int q / 2\<rfloor> \<in> {0..<q}

goal (1 subgoal):
 1. \<lbrakk>0 \<le> (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q; (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q \<le> 2 * \<lfloor>real_of_int q / 2\<rfloor>\<rbrakk> \<Longrightarrow> (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q - \<lfloor>real_of_int q / 2\<rfloor> = y
[PROOF STEP]
have "(y + \<lfloor>real_of_int q/2\<rfloor>) mod q = (y + \<lfloor>real_of_int q/2\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q = y + \<lfloor>real_of_int q / 2\<rfloor>
[PROOF STEP]
using mod_rangeE[OF this']
[PROOF STATE]
proof (prove)
using this:
y + \<lfloor>real_of_int q / 2\<rfloor> = (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q

goal (1 subgoal):
 1. (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q = y + \<lfloor>real_of_int q / 2\<rfloor>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(y + \<lfloor>real_of_int q / 2\<rfloor>) mod q = y + \<lfloor>real_of_int q / 2\<rfloor>

goal (1 subgoal):
 1. \<lbrakk>0 \<le> (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q; (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q \<le> 2 * \<lfloor>real_of_int q / 2\<rfloor>\<rbrakk> \<Longrightarrow> (y + \<lfloor>real_of_int q / 2\<rfloor>) mod q - \<lfloor>real_of_int q / 2\<rfloor> = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(y + \<lfloor>real_of_int q / 2\<rfloor>) mod q = y + \<lfloor>real_of_int q / 2\<rfloor>
[PROOF STEP]
show "(y + \<lfloor>real_of_int q/2\<rfloor>) mod q - \<lfloor>real_of_int q/2\<rfloor>
     = y"
[PROOF STATE]
proof (prove)
using this:
(y + \<lfloor>real_of_int q / 2\<rfloor>) mod q = y + \<lfloor>real_of_int q / 2\<rfloor>

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem gen_sqrt_upper: "0 \<le> x \<Longrightarrow> sqrt x \<le> sqrtu x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> sqrt x \<le> sqrtu x n
[PROOF STEP]
using real_sqrt_le_mono [OF sqrtu_upper [of x n]]
[PROOF STATE]
proof (prove)
using this:
sqrt x \<le> sqrt ((sqrtu x n)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> sqrt x \<le> sqrtu x n
[PROOF STEP]
by auto (metis abs_of_nonneg dual_order.strict_iff_order sqrtu_gt_0)


[STATEMENT]
lemma sset_subset_stream_pred: "sset w \<subseteq> A \<longleftrightarrow> pred_stream (\<lambda> a. a \<in> A) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sset w \<subseteq> A) = pred_stream (\<lambda>a. a \<in> A) w
[PROOF STEP]
unfolding stream.pred_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sset w \<subseteq> A) = (\<forall>a\<in>sset w. a \<in> A)
[PROOF STEP]
by auto


[STATEMENT]
lemma Y_pos: assumes y: "y \<in> Y"
  shows "y $ i > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y $h i
[PROOF STEP]
using Y_pos_main[of y i] y
[PROOF STATE]
proof (prove)
using this:
y \<in> pow_A_1 ` X \<Longrightarrow> 0 < y $h i
y \<in> Y

goal (1 subgoal):
 1. 0 < y $h i
[PROOF STEP]
unfolding Y_def X1_def
[PROOF STATE]
proof (prove)
using this:
y \<in> pow_A_1 ` X \<Longrightarrow> 0 < y $h i
y \<in> pow_A_1 ` (X \<inter> {x. norm x = 1})

goal (1 subgoal):
 1. 0 < y $h i
[PROOF STEP]
by auto


[STATEMENT]
lemma inj_on_right_lang_PR:
    assumes "dfa.states M = accessible"
      shows "inj_on (dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)))
                    (dfa.states (nfa.Power_dfa (Reverse_nfa M)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (dfa.right_lang (nfa.Power_dfa (Reverse_nfa M))) (dfa.states (nfa.Power_dfa (Reverse_nfa M)))
[PROOF STEP]
proof (rule inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M)); y \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M)); dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) x = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix q1 q2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M)); y \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M)); dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) x = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume *: "q1 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))"
              "q2 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))"
              "dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q1 =
               dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q2"
[PROOF STATE]
proof (state)
this:
q1 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
q2 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q1 = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q2

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M)); y \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M)); dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) x = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q1 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
q2 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q1 = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q2
[PROOF STEP]
have "hfset q1 \<subseteq> accessible \<and> hfset q2 \<subseteq> accessible"
[PROOF STATE]
proof (prove)
using this:
q1 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
q2 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q1 = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q2

goal (1 subgoal):
 1. hfset q1 \<subseteq> accessible \<and> hfset q2 \<subseteq> accessible
[PROOF STEP]
using assms rev_finite_subset [OF finite]
[PROOF STATE]
proof (prove)
using this:
q1 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
q2 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q1 = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q2
dfa.states M = accessible
?A \<subseteq> dfa.states M \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. hfset q1 \<subseteq> accessible \<and> hfset q2 \<subseteq> accessible
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
hfset q1 \<subseteq> accessible \<and> hfset q2 \<subseteq> accessible

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M)); y \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M)); dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) x = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
q1 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
q2 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q1 = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q2
hfset q1 \<subseteq> accessible \<and> hfset q2 \<subseteq> accessible
[PROOF STEP]
show "q1 = q2"
[PROOF STATE]
proof (prove)
using this:
q1 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
q2 \<in> dfa.states (nfa.Power_dfa (Reverse_nfa M))
dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q1 = dfa.right_lang (nfa.Power_dfa (Reverse_nfa M)) q2
hfset q1 \<subseteq> accessible \<and> hfset q2 \<subseteq> accessible

goal (1 subgoal):
 1. q1 = q2
[PROOF STEP]
apply (simp add: nfa_Reverse_nfa nfa.Power_right_lang right_lang_Reverse
                       image_UN [symmetric] inj_image_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>q1 \<in> HF ` Pow (dfa.states M); q2 \<in> HF ` Pow (dfa.states M); \<Union> (left_lang ` hfset q1) = \<Union> (left_lang ` hfset q2); hfset q1 \<subseteq> accessible \<and> hfset q2 \<subseteq> accessible\<rbrakk> \<Longrightarrow> q1 = q2
[PROOF STEP]
apply (metis HF_hfset le_sup_iff left_lang_UN)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
q1 = q2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nrows_le: "(nrows A <= n) = (\<forall>j i. n <= j \<longrightarrow> (Rep_matrix A j i) = 0)" (is ?s)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))
[PROOF STEP]
have "(nrows A <= n) = (ncols (transpose_matrix A) <= n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (nrows A \<le> n) = (ncols (transpose_matrix A) \<le> n)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
(nrows A \<le> n) = (ncols (transpose_matrix A) \<le> n)

goal (1 subgoal):
 1. (nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(nrows A \<le> n) = (ncols (transpose_matrix A) \<le> n)

goal (1 subgoal):
 1. (nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))
[PROOF STEP]
have "\<dots> = (\<forall>j i. n <= i \<longrightarrow> (Rep_matrix (transpose_matrix A) j i = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ncols (transpose_matrix A) \<le> n) = (\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix (transpose_matrix A) j i = (0::'a))
[PROOF STEP]
by (rule ncols_le)
[PROOF STATE]
proof (state)
this:
(ncols (transpose_matrix A) \<le> n) = (\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix (transpose_matrix A) j i = (0::'a))

goal (1 subgoal):
 1. (nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(ncols (transpose_matrix A) \<le> n) = (\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix (transpose_matrix A) j i = (0::'a))

goal (1 subgoal):
 1. (nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))
[PROOF STEP]
have "\<dots> = (\<forall>j i. n <= i \<longrightarrow> (Rep_matrix A i j) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix (transpose_matrix A) j i = (0::'a)) = (\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix A i j = (0::'a))
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
(\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix (transpose_matrix A) j i = (0::'a)) = (\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix A i j = (0::'a))

goal (1 subgoal):
 1. (nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(nrows A \<le> n) = (\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix A i j = (0::'a))
[PROOF STEP]
show "(nrows A <= n) = (\<forall>j i. n <= j \<longrightarrow> (Rep_matrix A j i) = 0)"
[PROOF STATE]
proof (prove)
using this:
(nrows A \<le> n) = (\<forall>j i. n \<le> i \<longrightarrow> Rep_matrix A i j = (0::'a))

goal (1 subgoal):
 1. (nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
(nrows A \<le> n) = (\<forall>j i. n \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma clinear_equal_ket:
  fixes f g :: \<open>'a::finite ell2 \<Rightarrow> _\<close>
  assumes \<open>clinear f\<close>
  assumes \<open>clinear g\<close>
  assumes \<open>\<And>i. f (ket i) = g (ket i)\<close>
  shows \<open>f = g\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = g
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. f x = g x
[PROOF STEP]
apply (rule complex_vector.linear_eq_on_span[where f=f and g=g and B=\<open>range ket\<close>])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x. clinear f
 2. \<And>x. clinear g
 3. \<And>x xa. xa \<in> range ket \<Longrightarrow> f xa = g xa
 4. \<And>x. x \<in> cspan (range ket)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
clinear f
clinear g
f (ket ?i) = g (ket ?i)

goal (4 subgoals):
 1. \<And>x. clinear f
 2. \<And>x. clinear g
 3. \<And>x xa. xa \<in> range ket \<Longrightarrow> f xa = g xa
 4. \<And>x. x \<in> cspan (range ket)
[PROOF STEP]
by auto


[STATEMENT]
lemma varE[simp]:
  assumes "i < n"
  assumes "x \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "var R n i x = x ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ring_Powers.var R n i x = x ! i
[PROOF STEP]
unfolding var_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x\<in>carrier (R\<^bsup>n\<^esup>). x ! i) x = x ! i
[PROOF STEP]
using  assms(2)
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. (\<lambda>x\<in>carrier (R\<^bsup>n\<^esup>). x ! i) x = x ! i
[PROOF STEP]
by (meson restrict_apply')


[STATEMENT]
theorem DivergenceOfHarmonicSeries:
  shows "\<not>summable (\<lambda>n. 1/real (Suc n))"
  (is "\<not>summable ?f")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> summable (\<lambda>n. 1 / real (Suc n))
[PROOF STEP]
proof \<comment> \<open>by contradiction\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
let ?s = "suminf ?f" \<comment> \<open>let ?s equal the sum of the harmonic series\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
assume sf: "summable ?f"
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. 1 / real (Suc n))

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. 1 / real (Suc n))
[PROOF STEP]
obtain n::nat where ndef: "n = nat \<lceil>2 * ?s\<rceil>"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. 1 / real (Suc n))

goal (1 subgoal):
 1. (\<And>n. n = nat \<lceil>2 * (\<Sum>n. 1 / real (Suc n))\<rceil> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = nat \<lceil>2 * (\<Sum>n. 1 / real (Suc n))\<rceil>

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = nat \<lceil>2 * (\<Sum>n. 1 / real (Suc n))\<rceil>
[PROOF STEP]
have ngt: "1 + real n/2 > ?s"
[PROOF STATE]
proof (prove)
using this:
n = nat \<lceil>2 * (\<Sum>n. 1 / real (Suc n))\<rceil>

goal (1 subgoal):
 1. (\<Sum>n. 1 / real (Suc n)) < 1 + real n / 2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(\<Sum>n. 1 / real (Suc n)) < 1 + real n / 2

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
define j where "j = (2::nat)^n"
[PROOF STATE]
proof (state)
this:
j = 2 ^ n

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
have "(\<Sum>i<j. ?f i) < ?s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<j. 1 / real (Suc i)) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
using sf
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. 1 / real (Suc n))

goal (1 subgoal):
 1. (\<Sum>i<j. 1 / real (Suc i)) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
by (simp add: sum_less_suminf)
[PROOF STATE]
proof (state)
this:
(\<Sum>i<j. 1 / real (Suc i)) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i<j. 1 / real (Suc i)) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
have "(\<Sum>i\<in>{Suc 0..<Suc j}. 1/(real i)) < ?s"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i<j. 1 / real (Suc i)) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. (\<Sum>i = Suc 0..<Suc j. 1 / real i) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
unfolding sum.shift_bounds_Suc_ivl
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i<j. 1 / real (Suc i)) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. (\<Sum>i = 0..<j. 1 / real (Suc i)) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
by (simp add: atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = Suc 0..<Suc j. 1 / real i) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
with j_def
[PROOF STATE]
proof (chain)
picking this:
j = 2 ^ n
(\<Sum>i = Suc 0..<Suc j. 1 / real i) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
have
    "(\<Sum>i\<in>{1..< Suc ((2::nat)^n)}. 1 / (real i)) < ?s"
[PROOF STATE]
proof (prove)
using this:
j = 2 ^ n
(\<Sum>i = Suc 0..<Suc j. 1 / real i) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. (\<Sum>i = 1..<Suc (2 ^ n). 1 / real i) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..<Suc (2 ^ n). 1 / real i) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 1..<Suc (2 ^ n). 1 / real i) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
have
    "(\<Sum>i\<in>{1..(2::nat)^n}. 1 / (real i)) < ?s"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 1..<Suc (2 ^ n). 1 / real i) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. (\<Sum>i = 1..2 ^ n. 1 / real i) < (\<Sum>n. 1 / real (Suc n))
[PROOF STEP]
by (simp only: atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..2 ^ n. 1 / real i) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..2 ^ n. 1 / real i) < (\<Sum>n. 1 / real (Suc n))

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
from harmonic_aux3
[PROOF STATE]
proof (chain)
picking this:
1 + real ?M / 2 \<le> (\<Sum>n = 1..2 ^ ?M. 1 / real n)
[PROOF STEP]
have
    "(\<Sum>i\<in>{1..(2::nat)^n}. 1 / (real i)) \<ge> 1 + real n/2"
[PROOF STATE]
proof (prove)
using this:
1 + real ?M / 2 \<le> (\<Sum>n = 1..2 ^ ?M. 1 / real n)

goal (1 subgoal):
 1. 1 + real n / 2 \<le> (\<Sum>i = 1..2 ^ n. 1 / real i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 + real n / 2 \<le> (\<Sum>i = 1..2 ^ n. 1 / real i)

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 + real n / 2 \<le> (\<Sum>i = 1..2 ^ n. 1 / real i)

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
from ngt
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n. 1 / real (Suc n)) < 1 + real n / 2
[PROOF STEP]
have "1 + real n/2 > ?s"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. 1 / real (Suc n)) < 1 + real n / 2

goal (1 subgoal):
 1. (\<Sum>n. 1 / real (Suc n)) < 1 + real n / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. 1 / real (Suc n)) < 1 + real n / 2

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n)) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 1..2 ^ n. 1 / real i) < (\<Sum>n. 1 / real (Suc n))
1 + real n / 2 \<le> (\<Sum>i = 1..2 ^ n. 1 / real i)
(\<Sum>n. 1 / real (Suc n)) < 1 + real n / 2
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 1..2 ^ n. 1 / real i) < (\<Sum>n. 1 / real (Suc n))
1 + real n / 2 \<le> (\<Sum>i = 1..2 ^ n. 1 / real i)
(\<Sum>n. 1 / real (Suc n)) < 1 + real n / 2

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem c_sum_is_pr: "c_sum \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
let ?f = "\<lambda> u z. (sgn1 (sf(z+1) - u))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
have S1: "(\<lambda> u z. sgn1 ((sf(z+1) - u))) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>u z. sgn1 (sf (z + 1) - u)) \<in> PrimRec2
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>u z. sgn1 (sf (z + 1) - u)) \<in> PrimRec2

goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
define g where "g = b_least2 ?f"
[PROOF STATE]
proof (state)
this:
g = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u))

goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
from g_def S1
[PROOF STATE]
proof (chain)
picking this:
g = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u))
(\<lambda>u z. sgn1 (sf (z + 1) - u)) \<in> PrimRec2
[PROOF STEP]
have "g \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
g = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u))
(\<lambda>u z. sgn1 (sf (z + 1) - u)) \<in> PrimRec2

goal (1 subgoal):
 1. g \<in> PrimRec2
[PROOF STEP]
by (simp add: pr_b_least2)
[PROOF STATE]
proof (state)
this:
g \<in> PrimRec2

goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<in> PrimRec2
[PROOF STEP]
have S2: "(\<lambda> u. g u (Suc u)) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
g \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>u. g u (Suc u)) \<in> PrimRec1
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>u. g u (Suc u)) \<in> PrimRec1

goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
from g_def
[PROOF STATE]
proof (chain)
picking this:
g = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u))
[PROOF STEP]
have "c_sum = (\<lambda> u. g u (Suc u))"
[PROOF STATE]
proof (prove)
using this:
g = b_least2 (\<lambda>u z. sgn1 (sf (z + 1) - u))

goal (1 subgoal):
 1. c_sum = (\<lambda>u. g u (Suc u))
[PROOF STEP]
by (simp add: c_sum_as_b_least ext)
[PROOF STATE]
proof (state)
this:
c_sum = (\<lambda>u. g u (Suc u))

goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
with S2
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>u. g u (Suc u)) \<in> PrimRec1
c_sum = (\<lambda>u. g u (Suc u))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>u. g u (Suc u)) \<in> PrimRec1
c_sum = (\<lambda>u. g u (Suc u))

goal (1 subgoal):
 1. c_sum \<in> PrimRec1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_sum \<in> PrimRec1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aff_dim_affine:
  fixes S L :: "'n::euclidean_space set"
  assumes "S \<noteq> {}"
    and "affine S"
    and "subspace L"
    and "affine_parallel S L"
  shows "aff_dim S = int (dim L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S = int (dim L)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim S = int (dim L)
[PROOF STEP]
have *: "affine hull S = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull S = S
[PROOF STEP]
using assms affine_hull_eq[of S]
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
affine S
subspace L
affine_parallel S L
(affine hull S = S) = affine S

goal (1 subgoal):
 1. affine hull S = S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull S = S

goal (1 subgoal):
 1. aff_dim S = int (dim L)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
affine hull S = S
[PROOF STEP]
have "affine_parallel (affine hull S) L"
[PROOF STATE]
proof (prove)
using this:
affine hull S = S

goal (1 subgoal):
 1. affine_parallel (affine hull S) L
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
affine hull S = S
S \<noteq> {}
affine S
subspace L
affine_parallel S L

goal (1 subgoal):
 1. affine_parallel (affine hull S) L
[PROOF STEP]
by (simp add: *)
[PROOF STATE]
proof (state)
this:
affine_parallel (affine hull S) L

goal (1 subgoal):
 1. aff_dim S = int (dim L)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
affine_parallel (affine hull S) L
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
affine_parallel (affine hull S) L

goal (1 subgoal):
 1. aff_dim S = int (dim L)
[PROOF STEP]
using assms aff_dim_parallel_subspace[of S L]
[PROOF STATE]
proof (prove)
using this:
affine_parallel (affine hull S) L
S \<noteq> {}
affine S
subspace L
affine_parallel S L
\<lbrakk>S \<noteq> {}; subspace L; affine_parallel (affine hull S) L\<rbrakk> \<Longrightarrow> aff_dim S = int (dim L)

goal (1 subgoal):
 1. aff_dim S = int (dim L)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
aff_dim S = int (dim L)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floorlog_power [simp]:
  "floorlog b (a * b ^ c) = floorlog b a + c" if "a > 0" "b > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. floorlog b (a * b ^ c) = floorlog b a + c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. floorlog b (a * b ^ c) = floorlog b a + c
[PROOF STEP]
have "\<lfloor>log b a + real c\<rfloor> = \<lfloor>log b a\<rfloor> + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real a) + real c\<rfloor> = \<lfloor>log (real b) (real a)\<rfloor> + int c
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real a) + real c\<rfloor> = \<lfloor>log (real b) (real a)\<rfloor> + int c

goal (1 subgoal):
 1. floorlog b (a * b ^ c) = floorlog b a + c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lfloor>log (real b) (real a) + real c\<rfloor> = \<lfloor>log (real b) (real a)\<rfloor> + int c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lfloor>log (real b) (real a) + real c\<rfloor> = \<lfloor>log (real b) (real a)\<rfloor> + int c

goal (1 subgoal):
 1. floorlog b (a * b ^ c) = floorlog b a + c
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<lfloor>log (real b) (real a) + real c\<rfloor> = \<lfloor>log (real b) (real a)\<rfloor> + int c
0 < a
1 < b

goal (1 subgoal):
 1. floorlog b (a * b ^ c) = floorlog b a + c
[PROOF STEP]
by (auto simp: floorlog_def log_mult powr_realpow[symmetric] nat_add_distrib)
[PROOF STATE]
proof (state)
this:
floorlog b (a * b ^ c) = floorlog b a + c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma expands_to_minus:
  "basis_wf basis \<Longrightarrow> (f expands_to F) basis \<Longrightarrow> (g expands_to G) basis \<Longrightarrow>
     ((\<lambda>x. f x - g x) expands_to F - G) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>basis_wf basis; (f expands_to F) basis; (g expands_to G) basis\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) expands_to F - G) basis
[PROOF STEP]
by (auto simp: expands_to.simps is_expansion_minus elim: eventually_elim2)


[STATEMENT]
lemma max_zero_streak_def2: "max_zero_streak xs = fold max (map length (goup_by_zeros xs)) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_zero_streak xs = fold max (map length (goup_by_zeros xs)) 0
[PROOF STEP]
unfolding max_zero_streak_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>xs. max (length xs)) (goup_by_zeros xs) 0 = fold max (map length (goup_by_zeros xs)) 0
[PROOF STEP]
by(simp add: foldr_max_length)


[STATEMENT]
lemma mult_copy_first_matrix:
assumes "i < nr" and "dim_vec v > 0"
shows "(copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0" (is "?a $ i = v $ 0")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
have "?a $ i = row (copy_first_matrix nr (dim_vec v)) i \<bullet> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = row (copy_first_matrix nr (dim_vec v)) i \<bullet> v
[PROOF STEP]
using index_mult_mat_vec assms copy_first_matrix_dim
[PROOF STATE]
proof (prove)
using this:
?i < dim_row ?A \<Longrightarrow> (?A *\<^sub>v ?v) $ ?i = row ?A ?i \<bullet> ?v
i < nr
0 < dim_vec v
dim_row (copy_first_matrix ?nr ?nc) = ?nr
dim_col (copy_first_matrix ?nr ?nc) = ?nc

goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = row (copy_first_matrix nr (dim_vec v)) i \<bullet> v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = row (copy_first_matrix nr (dim_vec v)) i \<bullet> v

goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = row (copy_first_matrix nr (dim_vec v)) i \<bullet> v

goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
have "... = unit_vec (dim_vec v) 0 \<bullet> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (copy_first_matrix nr (dim_vec v)) i \<bullet> v = unit_vec (dim_vec v) 0 \<bullet> v
[PROOF STEP]
using row_copy_first_matrix assms
[PROOF STATE]
proof (prove)
using this:
?i < ?nr \<Longrightarrow> row (copy_first_matrix ?nr ?nc) ?i = unit_vec ?nc 0
i < nr
0 < dim_vec v

goal (1 subgoal):
 1. row (copy_first_matrix nr (dim_vec v)) i \<bullet> v = unit_vec (dim_vec v) 0 \<bullet> v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (copy_first_matrix nr (dim_vec v)) i \<bullet> v = unit_vec (dim_vec v) 0 \<bullet> v

goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row (copy_first_matrix nr (dim_vec v)) i \<bullet> v = unit_vec (dim_vec v) 0 \<bullet> v

goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
have "... = v $ 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_vec (dim_vec v) 0 \<bullet> v = v $ 0
[PROOF STEP]
using assms(2) scalar_prod_left_unit carrier_dim_vec
[PROOF STATE]
proof (prove)
using this:
0 < dim_vec v
\<lbrakk>?v \<in> carrier_vec ?n; ?i < ?n\<rbrakk> \<Longrightarrow> unit_vec ?n ?i \<bullet> ?v = ?v $ ?i
(?v \<in> carrier_vec ?n) = (dim_vec ?v = ?n)

goal (1 subgoal):
 1. unit_vec (dim_vec v) 0 \<bullet> v = v $ 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
unit_vec (dim_vec v) 0 \<bullet> v = v $ 0

goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0

goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(copy_first_matrix nr (dim_vec v) *\<^sub>v v) $ i = v $ 0

goal:
No subgoals!
[PROOF STEP]
qed