[STATEMENT]
lemma samp_uni_break':
  assumes fst_cond: "m \<noteq> m' \<and> valid_msg m \<and> valid_msg m'"
    and c: "c = (m + a) mod q \<and> y1 = (a * x1 + b) mod q"
    and  c': "c = (m' + a') mod q \<and> y1 = (a' * x1 + b') mod q"
    and x1: "x1 < q"
  shows "x1 = (if (a mod q > a' mod q) then nat ((int b'- int b) * (inverse (nat ((int a mod q - int a' mod q) mod q)) q) mod q)  else
          nat ((int b- int b') * (inverse (nat ((int a' mod q - int a mod q) mod q)) q) mod q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
have m: "m < q \<and> m' < q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < q \<and> m' < q
[PROOF STEP]
using fst_cond valid_msg_def
[PROOF STATE]
proof (prove)
using this:
m \<noteq> m' \<and> valid_msg m \<and> valid_msg m'
valid_msg ?msg \<equiv> ?msg \<in> {..<q}

goal (1 subgoal):
 1. m < q \<and> m' < q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m < q \<and> m' < q

goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
have a_a': "\<not> [a = a'] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a \<noteq> a'] (mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [a \<noteq> a'] (mod q)
[PROOF STEP]
have "[m + a = m' + a'] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [m + a = m' + a'] (mod q)
[PROOF STEP]
using assms cong_def
[PROOF STATE]
proof (prove)
using this:
m \<noteq> m' \<and> valid_msg m \<and> valid_msg m'
c = (m + a) mod q \<and> y1 = (a * x1 + b) mod q
c = (m' + a') mod q \<and> y1 = (a' * x1 + b') mod q
x1 < q
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. [m + a = m' + a'] (mod q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[m + a = m' + a'] (mod q)

goal (1 subgoal):
 1. [a \<noteq> a'] (mod q)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
[m + a = m' + a'] (mod q)

goal (1 subgoal):
 1. [a \<noteq> a'] (mod q)
[PROOF STEP]
by (metis m fst_cond c c' add.commute cong_less_modulus_unique_nat cong_add_rcancel_nat cong_mod_right)
[PROOF STATE]
proof (state)
this:
[a \<noteq> a'] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[a \<noteq> a'] (mod q)

goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
have cong_y1: "[int a * int x1 + int b = int a' * int x1 + int b'] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [int a * int x1 + int b = int a' * int x1 + int b'] (mod int q)
[PROOF STEP]
by (metis c c' cong_def Num.of_nat_simps(4) Num.of_nat_simps(5) cong_int_iff)
[PROOF STATE]
proof (state)
this:
[int a * int x1 + int b = int a' * int x1 + int b'] (mod int q)

goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
proof(cases "a mod q > a' mod q")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a' mod q < a mod q

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence gcd: "gcd (nat ((int a mod q - int a' mod q) mod q)) q = 1"
[PROOF STATE]
proof (prove)
using this:
a' mod q < a mod q

goal (1 subgoal):
 1. gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a' mod q < a mod q \<Longrightarrow> gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1
[PROOF STEP]
have "((int a mod q - int a' mod q) mod q) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int a mod int q - int a' mod int q) mod int q \<noteq> 0
[PROOF STEP]
by (metis True comm_monoid_add_class.add_0 diff_add_cancel mod_add_left_eq mod_diff_eq nat_mod_as_int order_less_irrefl)
[PROOF STATE]
proof (state)
this:
(int a mod int q - int a' mod int q) mod int q \<noteq> 0

goal (1 subgoal):
 1. a' mod q < a mod q \<Longrightarrow> gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(int a mod int q - int a' mod int q) mod int q \<noteq> 0

goal (1 subgoal):
 1. a' mod q < a mod q \<Longrightarrow> gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1
[PROOF STEP]
have "((int a mod q - int a' mod q) mod q) < q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int a mod int q - int a' mod int q) mod int q < int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(int a mod int q - int a' mod int q) mod int q < int q

goal (1 subgoal):
 1. a' mod q < a mod q \<Longrightarrow> gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(int a mod int q - int a' mod int q) mod int q \<noteq> 0
(int a mod int q - int a' mod int q) mod int q < int q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(int a mod int q - int a' mod int q) mod int q \<noteq> 0
(int a mod int q - int a' mod int q) mod int q < int q

goal (1 subgoal):
 1. gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1
[PROOF STEP]
using prime_field[of q "nat ((int a mod int q - int a' mod int q) mod int q)"] prime_q
[PROOF STATE]
proof (prove)
using this:
(int a mod int q - int a' mod int q) mod int q \<noteq> 0
(int a mod int q - int a' mod int q) mod int q < int q
\<lbrakk>prime q; nat ((int a mod int q - int a' mod int q) mod int q) < q; nat ((int a mod int q - int a' mod int q) mod int q) \<noteq> 0\<rbrakk> \<Longrightarrow> coprime (nat ((int a mod int q - int a' mod int q) mod int q)) q
prime q

goal (1 subgoal):
 1. gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1
[PROOF STEP]
by (smt Euclidean_Division.pos_mod_sign coprime_imp_gcd_eq_1 int_nat_eq nat_less_iff of_nat_0_less_iff q_gt_0)
[PROOF STATE]
proof (state)
this:
gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int a * int x1 - int a' * int x1 = int b'- int b] (mod q)"
[PROOF STATE]
proof (prove)
using this:
gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1

goal (1 subgoal):
 1. [int a * int x1 - int a' * int x1 = int b' - int b] (mod int q)
[PROOF STEP]
by (smt cong_diff_iff_cong_0 cong_y1 cong_diff cong_diff)
[PROOF STATE]
proof (state)
this:
[int a * int x1 - int a' * int x1 = int b' - int b] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int a mod q * int x1 - int a' mod q * int x1 = int b'- int b] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int a * int x1 - int a' * int x1 = int b' - int b] (mod int q)

goal (1 subgoal):
 1. [int a mod int q * int x1 - int a' mod int q * int x1 = int b' - int b] (mod int q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [int a * int x1 - int a' * int x1 = int b' - int b] (mod int q) \<Longrightarrow> [int a mod int q * int x1 - int a' mod int q * int x1 = int b' - int b] (mod int q)
[PROOF STEP]
have "[int x1 * (int a mod int q - int a' mod int q) = int x1 * (int a - int a')] (mod int q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [int x1 * (int a mod int q - int a' mod int q) = int x1 * (int a - int a')] (mod int q)
[PROOF STEP]
by (meson cong_def cong_mult cong_refl mod_diff_eq)
[PROOF STATE]
proof (state)
this:
[int x1 * (int a mod int q - int a' mod int q) = int x1 * (int a - int a')] (mod int q)

goal (1 subgoal):
 1. [int a * int x1 - int a' * int x1 = int b' - int b] (mod int q) \<Longrightarrow> [int a mod int q * int x1 - int a' mod int q * int x1 = int b' - int b] (mod int q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[int x1 * (int a mod int q - int a' mod int q) = int x1 * (int a - int a')] (mod int q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[int x1 * (int a mod int q - int a' mod int q) = int x1 * (int a - int a')] (mod int q)

goal (1 subgoal):
 1. [int a mod int q * int x1 - int a' mod int q * int x1 = int b' - int b] (mod int q)
[PROOF STEP]
by (metis (no_types, opaque_lifting) Groups.mult_ac(2) \<open>[int a * int x1 - int a' * int x1 = int b' - int b] (mod int q)\<close> cong_def mod_diff_left_eq mod_diff_right_eq mod_mult_right_eq)
[PROOF STATE]
proof (state)
this:
[int a mod int q * int x1 - int a' mod int q * int x1 = int b' - int b] (mod int q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[int a mod int q * int x1 - int a' mod int q * int x1 = int b' - int b] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 * (int a mod q - int a' mod q) = int b'- int b] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int a mod int q * int x1 - int a' mod int q * int x1 = int b' - int b] (mod int q)

goal (1 subgoal):
 1. [int x1 * (int a mod int q - int a' mod int q) = int b' - int b] (mod int q)
[PROOF STEP]
by(metis int_distrib(3) mult.commute)
[PROOF STATE]
proof (state)
this:
[int x1 * (int a mod int q - int a' mod int q) = int b' - int b] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 * (int a mod q - int a' mod q) mod q = int b'- int b] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int x1 * (int a mod int q - int a' mod int q) = int b' - int b] (mod int q)

goal (1 subgoal):
 1. [int x1 * (int a mod int q - int a' mod int q) mod int q = int b' - int b] (mod int q)
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
[int x1 * (int a mod int q - int a' mod int q) = int b' - int b] (mod int q)
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. [int x1 * (int a mod int q - int a' mod int q) mod int q = int b' - int b] (mod int q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[int x1 * (int a mod int q - int a' mod int q) mod int q = int b' - int b] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 * nat ((int a mod q - int a' mod q) mod q) = int b'- int b] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int x1 * (int a mod int q - int a' mod int q) mod int q = int b' - int b] (mod int q)

goal (1 subgoal):
 1. [int x1 * int (nat ((int a mod int q - int a' mod int q) mod int q)) = int b' - int b] (mod int q)
[PROOF STEP]
by (simp add: True cong_def mod_mult_right_eq)
[PROOF STATE]
proof (state)
this:
[int x1 * int (nat ((int a mod int q - int a' mod int q) mod int q)) = int b' - int b] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 * nat ((int a mod q - int a' mod q) mod q) * inverse (nat ((int a mod q - int a' mod q) mod q)) q
              = (int b'- int b) * inverse (nat ((int a mod q - int a' mod q) mod q)) q] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int x1 * int (nat ((int a mod int q - int a' mod int q) mod int q)) = int b' - int b] (mod int q)

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

goal (1 subgoal):
 1. [int x1 * int (nat ((int a mod int q - int a' mod int q) mod int q)) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[int x1 * int (nat ((int a mod int q - int a' mod int q) mod int q)) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 * (nat ((int a mod q - int a' mod q) mod q) * inverse (nat ((int a mod q - int a' mod q) mod q)) q)
              = (int b'- int b) * inverse (nat ((int a mod q - int a' mod q) mod q)) q] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int x1 * int (nat ((int a mod int q - int a' mod int q) mod int q)) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. [int x1 * (int (nat ((int a mod int q - int a' mod int q) mod int q)) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q) = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
by (simp add: more_arith_simps(11))
[PROOF STATE]
proof (state)
this:
[int x1 * (int (nat ((int a mod int q - int a' mod int q) mod int q)) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q) = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 * 1 = (int b'- int b) * inverse (nat ((int a mod q - int a' mod q) mod q)) q] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int x1 * (int (nat ((int a mod int q - int a' mod int q) mod int q)) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q) = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. [int x1 * 1 = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
using inverse gcd
[PROOF STATE]
proof (prove)
using this:
[int x1 * (int (nat ((int a mod int q - int a' mod int q) mod int q)) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q) = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)
gcd ?x ?q = 1 \<Longrightarrow> [int ?x * Number_Theory_Aux.inverse ?x ?q = 1] (mod int ?q)
gcd (nat ((int a mod int q - int a' mod int q) mod int q)) q = 1

goal (1 subgoal):
 1. [int x1 * 1 = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
by (meson cong_scalar_left cong_sym_eq cong_trans)
[PROOF STATE]
proof (state)
this:
[int x1 * 1 = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 = (int b'- int b) * inverse (nat ((int a mod q - int a' mod q) mod q)) q] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int x1 * 1 = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. [int x1 = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[int x1 = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "int x1 mod q = ((int b'- int b) * inverse (nat ((int a mod q - int a' mod q) mod q)) q) mod q"
[PROOF STATE]
proof (prove)
using this:
[int x1 = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. int x1 mod int q = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
[int x1 = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q] (mod int q)
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. int x1 mod int q = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
int x1 mod int q = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q

goal (2 subgoals):
 1. a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
 2. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
int x1 mod int q = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q

goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
using x1 True
[PROOF STATE]
proof (prove)
using this:
int x1 mod int q = (int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q
x1 < q
a' mod q < a mod q

goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> a' mod q < a mod q

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence aa': "a mod q < a' mod q"
[PROOF STATE]
proof (prove)
using this:
\<not> a' mod q < a mod q

goal (1 subgoal):
 1. a mod q < a' mod q
[PROOF STEP]
using a_a' cong_refl nat_neq_iff
[PROOF STATE]
proof (prove)
using this:
\<not> a' mod q < a mod q
[a \<noteq> a'] (mod q)
[?b = ?b] (mod ?a)
(?m \<noteq> ?n) = (?m < ?n \<or> ?n < ?m)

goal (1 subgoal):
 1. a mod q < a' mod q
[PROOF STEP]
by (simp add: cong_def)
[PROOF STATE]
proof (state)
this:
a mod q < a' mod q

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence gcd: "gcd (nat ((int a' mod q - int a mod q) mod q)) q = 1"
[PROOF STATE]
proof (prove)
using this:
a mod q < a' mod q

goal (1 subgoal):
 1. gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a mod q < a' mod q \<Longrightarrow> gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1
[PROOF STEP]
have "((int a' mod q - int a mod q) mod q) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int a' mod int q - int a mod int q) mod int q \<noteq> 0
[PROOF STEP]
by (metis aa' comm_monoid_add_class.add_0 diff_add_cancel mod_add_left_eq mod_diff_eq nat_mod_as_int order_less_irrefl)
[PROOF STATE]
proof (state)
this:
(int a' mod int q - int a mod int q) mod int q \<noteq> 0

goal (1 subgoal):
 1. a mod q < a' mod q \<Longrightarrow> gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(int a' mod int q - int a mod int q) mod int q \<noteq> 0

goal (1 subgoal):
 1. a mod q < a' mod q \<Longrightarrow> gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1
[PROOF STEP]
have "((int a' mod q - int a mod q) mod q) < q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int a' mod int q - int a mod int q) mod int q < int q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(int a' mod int q - int a mod int q) mod int q < int q

goal (1 subgoal):
 1. a mod q < a' mod q \<Longrightarrow> gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(int a' mod int q - int a mod int q) mod int q \<noteq> 0
(int a' mod int q - int a mod int q) mod int q < int q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(int a' mod int q - int a mod int q) mod int q \<noteq> 0
(int a' mod int q - int a mod int q) mod int q < int q

goal (1 subgoal):
 1. gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1
[PROOF STEP]
using prime_field[of q "nat ((int a' mod int q - int a mod int q) mod int q)"] prime_q
[PROOF STATE]
proof (prove)
using this:
(int a' mod int q - int a mod int q) mod int q \<noteq> 0
(int a' mod int q - int a mod int q) mod int q < int q
\<lbrakk>prime q; nat ((int a' mod int q - int a mod int q) mod int q) < q; nat ((int a' mod int q - int a mod int q) mod int q) \<noteq> 0\<rbrakk> \<Longrightarrow> coprime (nat ((int a' mod int q - int a mod int q) mod int q)) q
prime q

goal (1 subgoal):
 1. gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1
[PROOF STEP]
by (smt Euclidean_Division.pos_mod_sign coprime_imp_gcd_eq_1 int_nat_eq nat_less_iff of_nat_0_less_iff q_gt_0)
[PROOF STATE]
proof (state)
this:
gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
gcd (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
have "[int b - int b' = int a' * int x1 - int a * int x1] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [int b - int b' = int a' * int x1 - int a * int x1] (mod int q)
[PROOF STEP]
by (smt cong_diff_iff_cong_0 cong_y1 cong_diff cong_diff)
[PROOF STATE]
proof (state)
this:
[int b - int b' = int a' * int x1 - int a * int x1] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int b - int b' = int x1 * (int a' - int a)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int b - int b' = int a' * int x1 - int a * int x1] (mod int q)

goal (1 subgoal):
 1. [int b - int b' = int x1 * (int a' - int a)] (mod int q)
[PROOF STEP]
using int_distrib mult.commute
[PROOF STATE]
proof (prove)
using this:
[int b - int b' = int a' * int x1 - int a * int x1] (mod int q)
(?z1.0 + ?z2.0) * ?w = ?z1.0 * ?w + ?z2.0 * ?w
?w * (?z1.0 + ?z2.0) = ?w * ?z1.0 + ?w * ?z2.0
(?z1.0 - ?z2.0) * ?w = ?z1.0 * ?w - ?z2.0 * ?w
?w * (?z1.0 - ?z2.0) = ?w * ?z1.0 - ?w * ?z2.0
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. [int b - int b' = int x1 * (int a' - int a)] (mod int q)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
[int b - int b' = int x1 * (int a' - int a)] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int b - int b' = int x1 * (int a' mod q - int a mod q)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int b - int b' = int x1 * (int a' - int a)] (mod int q)

goal (1 subgoal):
 1. [int b - int b' = int x1 * (int a' mod int q - int a mod int q)] (mod int q)
[PROOF STEP]
by (metis (no_types, lifting) cong_def mod_diff_eq mod_mult_right_eq)
[PROOF STATE]
proof (state)
this:
[int b - int b' = int x1 * (int a' mod int q - int a mod int q)] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int b - int b' = int x1 * (int a' mod q - int a mod q) mod q] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int b - int b' = int x1 * (int a' mod int q - int a mod int q)] (mod int q)

goal (1 subgoal):
 1. [int b - int b' = int x1 * (int a' mod int q - int a mod int q) mod int q] (mod int q)
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
[int b - int b' = int x1 * (int a' mod int q - int a mod int q)] (mod int q)
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. [int b - int b' = int x1 * (int a' mod int q - int a mod int q) mod int q] (mod int q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[int b - int b' = int x1 * (int a' mod int q - int a mod int q) mod int q] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[(int b - int b') * inverse (nat ((int a' mod q - int a mod q) mod q)) q
               = int x1 * (int a' mod q - int a mod q) mod q *  inverse (nat ((int a' mod q - int a mod q) mod q)) q ] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int b - int b' = int x1 * (int a' mod int q - int a mod int q) mod int q] (mod int q)

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

goal (1 subgoal):
 1. [(int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = int x1 * (int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[(int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = int x1 * (int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[(int b - int b') * inverse (nat ((int a' mod q - int a mod q) mod q)) q
               = int x1 * ((int a' mod q - int a mod q) mod q *  inverse (nat ((int a' mod q - int a mod q) mod q)) q)] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[(int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = int x1 * (int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. [(int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q)] (mod int q)
[PROOF STEP]
by (metis (mono_tags, lifting) cong_def mod_mult_left_eq mod_mult_right_eq more_arith_simps(11))
[PROOF STATE]
proof (state)
this:
[(int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q)] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence *: "[int x1 * ((int a' mod q - int a mod q) mod q * inverse (nat ((int a' mod q - int a mod q) mod q)) q)
              = (int b - int b') * inverse (nat ((int a' mod q - int a mod q) mod q)) q] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[(int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q)] (mod int q)

goal (1 subgoal):
 1. [int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q) = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
using cong_sym_eq
[PROOF STATE]
proof (prove)
using this:
[(int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q)] (mod int q)
[?b = ?c] (mod ?a) = [?c = ?b] (mod ?a)

goal (1 subgoal):
 1. [int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q) = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q) = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 * 1 = (int b - int b') * inverse (nat ((int a' mod q - int a mod q) mod q)) q] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q) = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. [int x1 * 1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q) = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q) \<Longrightarrow> [int x1 * 1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
have "[(int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1] (mod int q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1] (mod int q)
[PROOF STEP]
by (metis (no_types) Euclidean_Division.pos_mod_sign inverse gcd int_nat_eq of_nat_0_less_iff q_gt_0)
[PROOF STATE]
proof (state)
this:
[(int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1] (mod int q)

goal (1 subgoal):
 1. [int x1 * ((int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q) = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q) \<Longrightarrow> [int x1 * 1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[(int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1] (mod int q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[(int a' mod int q - int a mod int q) mod int q * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q = 1] (mod int q)

goal (1 subgoal):
 1. [int x1 * 1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
by (meson * cong_scalar_left cong_sym_eq cong_trans)
[PROOF STATE]
proof (state)
this:
[int x1 * 1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[int x1 * 1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "[int x1 = (int b - int b') * inverse (nat ((int a' mod q - int a mod q) mod q)) q] (mod q)"
[PROOF STATE]
proof (prove)
using this:
[int x1 * 1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. [int x1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[int x1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
hence "int x1 mod q = (int b - int b') * (inverse (nat ((int a' mod q - int a mod q) mod q)) q) mod q"
[PROOF STATE]
proof (prove)
using this:
[int x1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)

goal (1 subgoal):
 1. int x1 mod int q = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
[int x1 = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q] (mod int q)
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. int x1 mod int q = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int x1 mod int q = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q

goal (1 subgoal):
 1. \<not> a' mod q < a mod q \<Longrightarrow> x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
int x1 mod int q = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q

goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
using x1 aa'
[PROOF STATE]
proof (prove)
using this:
int x1 mod int q = (int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q
x1 < q
a mod q < a' mod q

goal (1 subgoal):
 1. x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x1 = (if a' mod q < a mod q then nat ((int b' - int b) * Number_Theory_Aux.inverse (nat ((int a mod int q - int a' mod int q) mod int q)) q mod int q) else nat ((int b - int b') * Number_Theory_Aux.inverse (nat ((int a' mod int q - int a mod int q) mod int q)) q mod int q))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "(x::real) \<ge> 1 \<and> y \<ge> 1 \<longrightarrow> x * y \<ge> x + y - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> x \<and> 1 \<le> y \<longrightarrow> x + y - 1 \<le> x * y
[PROOF STEP]
by (sos "(((A<0 * R<1) + ((A<=0 * (A<=1 * R<1)) * (R<1 * [1]^2))))")


[STATEMENT]
lemma simply_connected_punctured_universe_eq:
  fixes a :: "'a::euclidean_space"
  shows "simply_connected(- {a}) \<longleftrightarrow> 3 \<le> DIM('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
have [simp]: "a \<in> rel_interior (cball a 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> rel_interior (cball a 1)
[PROOF STEP]
by (simp add: rel_interior_nonempty_interior)
[PROOF STATE]
proof (state)
this:
a \<in> rel_interior (cball a 1)

goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
have [simp]: "affine hull cball a 1 - {a} = -{a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull cball a 1 - {a} = - {a}
[PROOF STEP]
by (metis Compl_eq_Diff_UNIV aff_dim_cball aff_dim_lt_full not_less_iff_gr_or_eq zero_less_one)
[PROOF STATE]
proof (state)
this:
affine hull cball a 1 - {a} = - {a}

goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
have "sphere a 1 homotopy_eqv - {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sphere a 1 homotopy_eqv - {a}
[PROOF STEP]
using homotopy_eqv_rel_frontier_punctured_affine_hull [of "cball a 1" a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>convex (cball a 1); bounded (cball a 1); a \<in> rel_interior (cball a 1)\<rbrakk> \<Longrightarrow> rel_frontier (cball a 1) homotopy_eqv affine hull cball a 1 - {a}

goal (1 subgoal):
 1. sphere a 1 homotopy_eqv - {a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sphere a 1 homotopy_eqv - {a}

goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sphere a 1 homotopy_eqv - {a}
[PROOF STEP]
have "simply_connected(- {a}) \<longleftrightarrow> simply_connected(sphere a 1)"
[PROOF STATE]
proof (prove)
using this:
sphere a 1 homotopy_eqv - {a}

goal (1 subgoal):
 1. simply_connected (- {a}) = simply_connected (sphere a 1)
[PROOF STEP]
using homotopy_eqv_simple_connectedness
[PROOF STATE]
proof (prove)
using this:
sphere a 1 homotopy_eqv - {a}
?S homotopy_eqv ?T \<Longrightarrow> simply_connected ?S = simply_connected ?T

goal (1 subgoal):
 1. simply_connected (- {a}) = simply_connected (sphere a 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
simply_connected (- {a}) = simply_connected (sphere a 1)

goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
simply_connected (- {a}) = simply_connected (sphere a 1)

goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
have "...  \<longleftrightarrow> 3 \<le> DIM('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simply_connected (sphere a 1) = (3 \<le> DIM('a))
[PROOF STEP]
by (simp add: simply_connected_sphere_eq)
[PROOF STATE]
proof (state)
this:
simply_connected (sphere a 1) = (3 \<le> DIM('a))

goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
simply_connected (- {a}) = (3 \<le> DIM('a))

goal (1 subgoal):
 1. simply_connected (- {a}) = (3 \<le> DIM('a))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
simply_connected (- {a}) = (3 \<le> DIM('a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_cancel_less_iff [simp]:
  "\<lbrakk>Ord \<alpha>; Ord \<beta>; Ord \<gamma>\<rbrakk> \<Longrightarrow> \<alpha>*\<beta> < \<alpha>*\<gamma> \<longleftrightarrow> \<beta> < \<gamma> \<and> 0 < \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ord \<alpha>; Ord \<beta>; Ord \<gamma>\<rbrakk> \<Longrightarrow> (\<alpha> * \<beta> < \<alpha> * \<gamma>) = (\<beta> < \<gamma> \<and> 0 < \<alpha>)
[PROOF STEP]
using mult_add_mem_0 [of \<alpha> \<beta> \<gamma>]
[PROOF STATE]
proof (prove)
using this:
(\<alpha> * \<beta> \<in> elts (\<alpha> * \<gamma>)) = (\<beta> \<in> elts \<gamma> \<and> 0 \<in> elts \<alpha>)

goal (1 subgoal):
 1. \<lbrakk>Ord \<alpha>; Ord \<beta>; Ord \<gamma>\<rbrakk> \<Longrightarrow> (\<alpha> * \<beta> < \<alpha> * \<gamma>) = (\<beta> < \<gamma> \<and> 0 < \<alpha>)
[PROOF STEP]
by (meson Ord_0 Ord_mem_iff_lt Ord_mult)


[STATEMENT]
lemma "b > 0 \<Longrightarrow> (\<lambda>x::real. x / ln (2*b*x) * 2) \<in> o(\<lambda>x. x * ln (b*x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < b \<Longrightarrow> (\<lambda>x. x / ln (2 * b * x) * 2) \<in> o(\<lambda>x. x * ln (b * x))
[PROOF STEP]
by simp


[STATEMENT]
lemma cos_periodic [simp]: "cos (x + 2 * pi) = cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + 2 * pi) = cos x
[PROOF STEP]
by (simp add: cos_add sin_double cos_double)


[STATEMENT]
lemma prime_1_mod_4_sum_of_squares_unique:
  fixes p :: nat
  assumes "prime p" "[p = 1] (mod 4)"
  shows   "\<exists>!(x,y). x \<le> y \<and> x ^ 2 + y ^ 2 = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!(x, y). x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
proof (rule ex_ex1I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>x. case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
 2. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
obtain z where z: "gauss_int_norm z = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. gauss_int_norm z = p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prime_cong_1_mod_4_gauss_int_norm_exists[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>z. gauss_int_norm z = p \<and> 0 < ReZ z \<and> 0 < ImZ z

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

goal (2 subgoals):
 1. \<exists>x. case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
 2. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
show "\<exists>z. case z of (x,y) \<Rightarrow> x \<le> y \<and> x ^ 2 + y ^ 2 = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
proof (cases "\<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar>")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar> \<Longrightarrow> \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
 2. \<not> \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar> \<Longrightarrow> \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar>

goal (2 subgoals):
 1. \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar> \<Longrightarrow> \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
 2. \<not> \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar> \<Longrightarrow> \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
with z
[PROOF STATE]
proof (chain)
picking this:
gauss_int_norm z = p
\<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gauss_int_norm z = p
\<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar>

goal (1 subgoal):
 1. \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
by
      (intro exI[of _ "(nat \<bar>ReZ z\<bar>, nat \<bar>ImZ z\<bar>)"])
      (auto simp: gauss_int_norm_def nat_add_distrib simp flip: nat_power_eq)
[PROOF STATE]
proof (state)
this:
\<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. \<not> \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar> \<Longrightarrow> \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar> \<Longrightarrow> \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar>

goal (1 subgoal):
 1. \<not> \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar> \<Longrightarrow> \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
with z
[PROOF STATE]
proof (chain)
picking this:
gauss_int_norm z = p
\<not> \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gauss_int_norm z = p
\<not> \<bar>ReZ z\<bar> \<le> \<bar>ImZ z\<bar>

goal (1 subgoal):
 1. \<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
by
      (intro exI[of _ "(nat \<bar>ImZ z\<bar>, nat \<bar>ReZ z\<bar>)"])
      (auto simp: gauss_int_norm_def nat_add_distrib simp flip: nat_power_eq)
[PROOF STATE]
proof (state)
this:
\<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>z. case z of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix z1 z2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume z1: "case z1 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p"
[PROOF STATE]
proof (state)
this:
case z1 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume z2: "case z2 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p"
[PROOF STATE]
proof (state)
this:
case z2 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
define z1' :: gauss_int where "z1' = of_nat (fst z1) + \<i>\<^sub>\<int> * of_nat (snd z1)"
[PROOF STATE]
proof (state)
this:
z1' = of_nat (fst z1) + \<i>\<^sub>\<int> * of_nat (snd z1)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
define z2' :: gauss_int where "z2' = of_nat (fst z2) + \<i>\<^sub>\<int> * of_nat (snd z2)"
[PROOF STATE]
proof (state)
this:
z2' = of_nat (fst z2) + \<i>\<^sub>\<int> * of_nat (snd z2)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
[p = 1] (mod 4)
[PROOF STEP]
interpret noninert_gauss_int_prime p
[PROOF STATE]
proof (prove)
using this:
prime p
[p = 1] (mod 4)

goal (1 subgoal):
 1. noninert_gauss_int_prime p
[PROOF STEP]
by unfold_locales auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have norm_z1': "gauss_int_norm z1' = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_int_norm z1' = p
[PROOF STEP]
using z1
[PROOF STATE]
proof (prove)
using this:
case z1 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. gauss_int_norm z1' = p
[PROOF STEP]
by (simp add: z1'_def gauss_int_norm_def case_prod_unfold nat_add_distrib nat_power_eq)
[PROOF STATE]
proof (state)
this:
gauss_int_norm z1' = p

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have norm_z2': "gauss_int_norm z2' = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_int_norm z2' = p
[PROOF STEP]
using z2
[PROOF STATE]
proof (prove)
using this:
case z2 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. gauss_int_norm z2' = p
[PROOF STEP]
by (simp add: z2'_def gauss_int_norm_def case_prod_unfold nat_add_distrib nat_power_eq)
[PROOF STATE]
proof (state)
this:
gauss_int_norm z2' = p

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have sgns: "fst z1 > 0" "snd z1 > 0" "fst z2 > 0" "snd z2 > 0" "fst z1 \<noteq> snd z1" "fst z2 \<noteq> snd z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < fst z1 &&& 0 < snd z1 &&& 0 < fst z2) &&& 0 < snd z2 &&& fst z1 \<noteq> snd z1 &&& fst z2 \<noteq> snd z2
[PROOF STEP]
using prime_1_mod_4_sum_of_squares_unique_aux[OF assms, of "fst z1" "snd z1"] z1
          prime_1_mod_4_sum_of_squares_unique_aux[OF assms, of "fst z2" "snd z2"] z2
[PROOF STATE]
proof (prove)
using this:
(fst z1)\<^sup>2 + (snd z1)\<^sup>2 = p \<Longrightarrow> 0 < fst z1 \<and> 0 < snd z1 \<and> fst z1 \<noteq> snd z1
case z1 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
(fst z2)\<^sup>2 + (snd z2)\<^sup>2 = p \<Longrightarrow> 0 < fst z2 \<and> 0 < snd z2 \<and> fst z2 \<noteq> snd z2
case z2 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. (0 < fst z1 &&& 0 < snd z1 &&& 0 < fst z2) &&& 0 < snd z2 &&& fst z1 \<noteq> snd z1 &&& fst z2 \<noteq> snd z2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < fst z1
0 < snd z1
0 < fst z2
0 < snd z2
fst z1 \<noteq> snd z1
fst z2 \<noteq> snd z2

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have [simp]: "normalize z1' = z1'" "normalize z2' = z2'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize z1' = z1' &&& normalize z2' = z2'
[PROOF STEP]
using sgns
[PROOF STATE]
proof (prove)
using this:
0 < fst z1
0 < snd z1
0 < fst z2
0 < snd z2
fst z1 \<noteq> snd z1
fst z2 \<noteq> snd z2

goal (1 subgoal):
 1. normalize z1' = z1' &&& normalize z2' = z2'
[PROOF STEP]
by (subst normalized_gauss_int_iff; simp add: z1'_def z2'_def)+
[PROOF STATE]
proof (state)
this:
normalize z1' = z1'
normalize z2' = z2'

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "prime z1'" "prime z2'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime z1' &&& prime z2'
[PROOF STEP]
using norm_z1' norm_z2' assms
[PROOF STATE]
proof (prove)
using this:
gauss_int_norm z1' = p
gauss_int_norm z2' = p
prime p
[p = 1] (mod 4)

goal (1 subgoal):
 1. prime z1' &&& prime z2'
[PROOF STEP]
unfolding prime_def
[PROOF STATE]
proof (prove)
using this:
gauss_int_norm z1' = p
gauss_int_norm z2' = p
prime_elem p \<and> normalize p = p
[p = 1] (mod 4)

goal (1 subgoal):
 1. prime_elem z1' \<and> normalize z1' = z1' &&& prime_elem z2' \<and> normalize z2' = z2'
[PROOF STEP]
by (auto simp: prime_gauss_int_norm_imp_prime_elem)
[PROOF STATE]
proof (state)
this:
prime z1'
prime z2'

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "of_nat p = z1' * gauss_cnj z1'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat p = z1' * gauss_cnj z1'
[PROOF STEP]
by (simp add: self_mult_gauss_cnj norm_z1')
[PROOF STATE]
proof (state)
this:
of_nat p = z1' * gauss_cnj z1'

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "z1' dvd of_nat p"
[PROOF STATE]
proof (prove)
using this:
of_nat p = z1' * gauss_cnj z1'

goal (1 subgoal):
 1. z1' dvd of_nat p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z1' dvd of_nat p

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
z1' dvd of_nat p

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "of_nat p = z2' * gauss_cnj z2'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat p = z2' * gauss_cnj z2'
[PROOF STEP]
by (simp add: self_mult_gauss_cnj norm_z2')
[PROOF STATE]
proof (state)
this:
of_nat p = z2' * gauss_cnj z2'

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
z1' dvd z2' * gauss_cnj z2'
[PROOF STEP]
have "z1' dvd z2' \<or> z1' dvd gauss_cnj z2'"
[PROOF STATE]
proof (prove)
using this:
z1' dvd z2' * gauss_cnj z2'

goal (1 subgoal):
 1. z1' dvd z2' \<or> z1' dvd gauss_cnj z2'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z1' dvd z2' * gauss_cnj z2'
prime p
[p = 1] (mod 4)

goal (1 subgoal):
 1. z1' dvd z2' \<or> z1' dvd gauss_cnj z2'
[PROOF STEP]
by (subst (asm) prime_elem_dvd_mult_iff)
       (simp add: norm_z1' prime_gauss_int_norm_imp_prime_elem)
[PROOF STATE]
proof (state)
this:
z1' dvd z2' \<or> z1' dvd gauss_cnj z2'

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>case x of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p; case y of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus "z1 = z2"
[PROOF STATE]
proof (prove)
using this:
z1' dvd z2' \<or> z1' dvd gauss_cnj z2'

goal (1 subgoal):
 1. z1 = z2
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z1' dvd z2' \<Longrightarrow> z1 = z2
 2. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
assume "z1' dvd z2'"
[PROOF STATE]
proof (state)
this:
z1' dvd z2'

goal (2 subgoals):
 1. z1' dvd z2' \<Longrightarrow> z1 = z2
 2. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
with \<open>prime z1'\<close> \<open>prime z2'\<close>
[PROOF STATE]
proof (chain)
picking this:
prime z1'
prime z2'
z1' dvd z2'
[PROOF STEP]
have "z1' = z2'"
[PROOF STATE]
proof (prove)
using this:
prime z1'
prime z2'
z1' dvd z2'

goal (1 subgoal):
 1. z1' = z2'
[PROOF STEP]
by (simp add: primes_dvd_imp_eq)
[PROOF STATE]
proof (state)
this:
z1' = z2'

goal (2 subgoals):
 1. z1' dvd z2' \<Longrightarrow> z1 = z2
 2. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
z1' = z2'

goal (1 subgoal):
 1. z1 = z2
[PROOF STEP]
by (simp add: z1'_def z2'_def gauss_int_eq_iff prod_eq_iff)
[PROOF STATE]
proof (state)
this:
z1 = z2

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
assume dvd: "z1' dvd gauss_cnj z2'"
[PROOF STATE]
proof (state)
this:
z1' dvd gauss_cnj z2'

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
have "normalize (\<i>\<^sub>\<int> * gauss_cnj z2') = \<i>\<^sub>\<int> * gauss_cnj z2'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (\<i>\<^sub>\<int> * gauss_cnj z2') = \<i>\<^sub>\<int> * gauss_cnj z2'
[PROOF STEP]
using sgns
[PROOF STATE]
proof (prove)
using this:
0 < fst z1
0 < snd z1
0 < fst z2
0 < snd z2
fst z1 \<noteq> snd z1
fst z2 \<noteq> snd z2

goal (1 subgoal):
 1. normalize (\<i>\<^sub>\<int> * gauss_cnj z2') = \<i>\<^sub>\<int> * gauss_cnj z2'
[PROOF STEP]
by (subst normalized_gauss_int_iff) (auto simp: z2'_def)
[PROOF STATE]
proof (state)
this:
normalize (\<i>\<^sub>\<int> * gauss_cnj z2') = \<i>\<^sub>\<int> * gauss_cnj z2'

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
normalize (\<i>\<^sub>\<int> * gauss_cnj z2') = \<i>\<^sub>\<int> * gauss_cnj z2'

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
have "prime_elem (\<i>\<^sub>\<int> * gauss_cnj z2')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_elem (\<i>\<^sub>\<int> * gauss_cnj z2')
[PROOF STEP]
by (rule prime_gauss_int_norm_imp_prime_elem)
         (simp add: gauss_int_norm_mult norm_z2' \<open>prime p\<close>)
[PROOF STATE]
proof (state)
this:
prime_elem (\<i>\<^sub>\<int> * gauss_cnj z2')

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
normalize (\<i>\<^sub>\<int> * gauss_cnj z2') = \<i>\<^sub>\<int> * gauss_cnj z2'
prime_elem (\<i>\<^sub>\<int> * gauss_cnj z2')
[PROOF STEP]
have "prime (\<i>\<^sub>\<int> * gauss_cnj z2')"
[PROOF STATE]
proof (prove)
using this:
normalize (\<i>\<^sub>\<int> * gauss_cnj z2') = \<i>\<^sub>\<int> * gauss_cnj z2'
prime_elem (\<i>\<^sub>\<int> * gauss_cnj z2')

goal (1 subgoal):
 1. prime (\<i>\<^sub>\<int> * gauss_cnj z2')
[PROOF STEP]
by (simp add: prime_def)
[PROOF STATE]
proof (state)
this:
prime (\<i>\<^sub>\<int> * gauss_cnj z2')

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prime (\<i>\<^sub>\<int> * gauss_cnj z2')

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
from dvd
[PROOF STATE]
proof (chain)
picking this:
z1' dvd gauss_cnj z2'
[PROOF STEP]
have "z1' dvd \<i>\<^sub>\<int> * gauss_cnj z2'"
[PROOF STATE]
proof (prove)
using this:
z1' dvd gauss_cnj z2'

goal (1 subgoal):
 1. z1' dvd \<i>\<^sub>\<int> * gauss_cnj z2'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z1' dvd \<i>\<^sub>\<int> * gauss_cnj z2'

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prime (\<i>\<^sub>\<int> * gauss_cnj z2')
z1' dvd \<i>\<^sub>\<int> * gauss_cnj z2'
[PROOF STEP]
have "z1' = \<i>\<^sub>\<int> * gauss_cnj z2'"
[PROOF STATE]
proof (prove)
using this:
prime (\<i>\<^sub>\<int> * gauss_cnj z2')
z1' dvd \<i>\<^sub>\<int> * gauss_cnj z2'

goal (1 subgoal):
 1. z1' = \<i>\<^sub>\<int> * gauss_cnj z2'
[PROOF STEP]
using \<open>prime z1'\<close>
[PROOF STATE]
proof (prove)
using this:
prime (\<i>\<^sub>\<int> * gauss_cnj z2')
z1' dvd \<i>\<^sub>\<int> * gauss_cnj z2'
prime z1'

goal (1 subgoal):
 1. z1' = \<i>\<^sub>\<int> * gauss_cnj z2'
[PROOF STEP]
by (simp add: primes_dvd_imp_eq)
[PROOF STATE]
proof (state)
this:
z1' = \<i>\<^sub>\<int> * gauss_cnj z2'

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
hence False
[PROOF STATE]
proof (prove)
using this:
z1' = \<i>\<^sub>\<int> * gauss_cnj z2'

goal (1 subgoal):
 1. False
[PROOF STEP]
using z1 z2 sgns
[PROOF STATE]
proof (prove)
using this:
z1' = \<i>\<^sub>\<int> * gauss_cnj z2'
case z1 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
case z2 of (x, y) \<Rightarrow> x \<le> y \<and> x\<^sup>2 + y\<^sup>2 = p
0 < fst z1
0 < snd z1
0 < fst z2
0 < snd z2
fst z1 \<noteq> snd z1
fst z2 \<noteq> snd z2

goal (1 subgoal):
 1. False
[PROOF STEP]
by (auto simp: gauss_int_eq_iff z1'_def z2'_def)
[PROOF STATE]
proof (state)
this:
False

goal (1 subgoal):
 1. z1' dvd gauss_cnj z2' \<Longrightarrow> z1 = z2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
False

goal (1 subgoal):
 1. z1 = z2
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
z1 = z2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
z1 = z2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma
    fi_f: "x\<in>V \<Longrightarrow> fi (f x) = x" and
    f_fi: "y\<in>f`V \<Longrightarrow> f (fi y) = y" and
    fi_f_eq: "\<lbrakk>f x = y; x\<in>V\<rbrakk> \<Longrightarrow> fi y = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> V \<Longrightarrow> fi (f x) = x) &&& (y \<in> f ` V \<Longrightarrow> f (fi y) = y) &&& (\<lbrakk>f x = y; x \<in> V\<rbrakk> \<Longrightarrow> fi y = x)
[PROOF STEP]
unfolding fi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> V \<Longrightarrow> the_inv_into V f (f x) = x) &&& (y \<in> f ` V \<Longrightarrow> f (the_inv_into V f y) = y) &&& (\<lbrakk>f x = y; x \<in> V\<rbrakk> \<Longrightarrow> the_inv_into V f y = x)
[PROOF STEP]
by (auto
      simp: the_inv_into_f_f f_the_inv_into_f the_inv_into_f_eq INJ)


[STATEMENT]
lemma "rec_exec plus_2 [2] = 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_exec plus_2 [2] = 4
[PROOF STEP]
unfolding plus_2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_exec (Cn 1 s [s]) [2] = 4
[PROOF STEP]
by auto


[STATEMENT]
lemma divide_less_floor1: "n / y < of_int (floor (n / y)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n / y < of_int \<lfloor>n / y\<rfloor> + (1::'a)
[PROOF STEP]
by (metis floor_less_iff less_add_one of_int_1 of_int_add)


[STATEMENT]
lemma ordinal_exp_oSuc [simp]: "x ** oSuc y = (x ** y) * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ** oSuc y = x ** y * x
[PROOF STEP]
by (simp add: exp_ordinal_def)


[STATEMENT]
lemma single_non_qFresh_ordLess_var:
assumes "qGood X"
shows "|{x. \<not> qFresh xs x X}| <o |UNIV :: 'var set|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |{x. \<not> qFresh xs x X}| <o |UNIV|
[PROOF STEP]
using qAFresh_imp_qFresh card_of_mono1 single_non_qAFresh_ordLess_var
ordLeq_ordLess_trans
[PROOF STATE]
proof (prove)
using this:
qAFresh ?xs ?x ?X \<Longrightarrow> qFresh ?xs ?x ?X
?A \<subseteq> ?B \<Longrightarrow> |?A| \<le>o |?B|
qGood ?X \<Longrightarrow> |{x. \<not> qAFresh ?xs x ?X}| <o |UNIV|
\<lbrakk>?r \<le>o ?r'; ?r' <o ?r''\<rbrakk> \<Longrightarrow> ?r <o ?r''

goal (1 subgoal):
 1. |{x. \<not> qFresh xs x X}| <o |UNIV|
[PROOF STEP]
by (metis Collect_mono assms)


[STATEMENT]
lemma Arccos_unique:
    "\<lbrakk>cos z = w;
      0 < Re z \<and> Re z < pi \<or>
      Re z = 0 \<and> 0 \<le> Im z \<or>
      Re z = pi \<and> Im z \<le> 0\<rbrakk> \<Longrightarrow> Arccos w = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cos z = w; 0 < Re z \<and> Re z < pi \<or> Re z = 0 \<and> 0 \<le> Im z \<or> Re z = pi \<and> Im z \<le> 0\<rbrakk> \<Longrightarrow> Arccos w = z
[PROOF STEP]
using Arccos_cos
[PROOF STATE]
proof (prove)
using this:
0 < Re ?z \<and> Re ?z < pi \<or> Re ?z = 0 \<and> 0 \<le> Im ?z \<or> Re ?z = pi \<and> Im ?z \<le> 0 \<Longrightarrow> Arccos (cos ?z) = ?z

goal (1 subgoal):
 1. \<lbrakk>cos z = w; 0 < Re z \<and> Re z < pi \<or> Re z = 0 \<and> 0 \<le> Im z \<or> Re z = pi \<and> Im z \<le> 0\<rbrakk> \<Longrightarrow> Arccos w = z
[PROOF STEP]
by blast


[STATEMENT]
lemma sots1: assumes "is_sum2sq_nat n"
  shows "\<And> k. prime (4*k+3) \<longrightarrow> even (multiplicity (4*k+3) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. prime (4 * k + 3) \<longrightarrow> even (multiplicity (4 * k + 3) n)
[PROOF STEP]
using sots1_aux assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime (4 * ?k + 3); odd (multiplicity (4 * ?k + 3) ?n)\<rbrakk> \<Longrightarrow> \<not> is_sum2sq_nat ?n
is_sum2sq_nat n

goal (1 subgoal):
 1. \<And>k. prime (4 * k + 3) \<longrightarrow> even (multiplicity (4 * k + 3) n)
[PROOF STEP]
by blast


[STATEMENT]
lemma eval_fds_logderiv_zeta:
  assumes "Re s > 1"
  shows  "(\<lambda>p. of_real (ln (real p)) / (p powr s - 1))
            abs_summable_on {p. prime p}" (is ?th1)
    and  "deriv zeta s / zeta s =
            -(\<Sum>\<^sub>ap | prime p. of_real (ln (real p)) / (p powr s - 1))" (is ?th2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p} &&& deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
 2. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
have *: "completely_multiplicative_function (fds_nth fds_zeta :: _ \<Rightarrow> complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (fds_nth fds_zeta)
[PROOF STEP]
by standard auto
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (fds_nth fds_zeta)

goal (2 subgoals):
 1. (\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
 2. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
note abscissa = le_less_trans[OF abs_conv_abscissa_completely_multiplicative_log_deriv[OF *]]
[PROOF STATE]
proof (state)
this:
\<lbrakk>fds_nth fds_zeta 1 \<noteq> 0; abs_conv_abscissa fds_zeta < ?z\<rbrakk> \<Longrightarrow> abs_conv_abscissa (fds_deriv fds_zeta / fds_zeta) < ?z

goal (2 subgoals):
 1. (\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
 2. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
have "(\<lambda>p. ln (real p) * (1 / (1 - fds_nth fds_zeta p / p powr s) - 1))
           abs_summable_on {p. prime p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) abs_summable_on {p. prime p}
[PROOF STEP]
using eval_fds_logderiv_completely_multiplicative[OF *, of s] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>fds_nth fds_zeta 1 \<noteq> 0; abs_conv_abscissa fds_zeta < ereal (s \<bullet> 1)\<rbrakk> \<Longrightarrow> (\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / nat_power p s) - 1)) abs_summable_on {p. prime p}
\<lbrakk>fds_nth fds_zeta 1 \<noteq> 0; abs_conv_abscissa fds_zeta < ereal (s \<bullet> 1)\<rbrakk> \<Longrightarrow> eval_fds (fds_deriv fds_zeta / fds_zeta) s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / nat_power p s) - 1))
1 < Re s

goal (1 subgoal):
 1. (\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) abs_summable_on {p. prime p}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) abs_summable_on {p. prime p}

goal (2 subgoals):
 1. (\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
 2. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) abs_summable_on {p. prime p}

goal (2 subgoals):
 1. (\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
 2. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
have "?this \<longleftrightarrow> (\<lambda>p. ln (real p) / (p powr s - 1)) abs_summable_on {p. prime p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) abs_summable_on {p. prime p}) = ((\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < Re s

goal (1 subgoal):
 1. ((\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) abs_summable_on {p. prime p}) = ((\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p})
[PROOF STEP]
by (intro abs_summable_on_cong) (auto simp: fds_nth_zeta divide_simps dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
((\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) abs_summable_on {p. prime p}) = ((\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p})

goal (2 subgoals):
 1. (\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
 2. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
[PROOF STEP]
show ?th1
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}

goal (1 subgoal):
 1. (\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 < Re s
[PROOF STEP]
have ev: "eventually (\<lambda>z. z \<in> {z. Re z > 1}) (nhds s)"
[PROOF STATE]
proof (prove)
using this:
1 < Re s

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

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
have "deriv zeta s = deriv (eval_fds fds_zeta) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv zeta s = deriv (eval_fds fds_zeta) s
[PROOF STEP]
by (intro deriv_cong_ev[OF eventually_mono[OF ev]]) (auto simp: eval_fds_zeta)
[PROOF STATE]
proof (state)
this:
deriv zeta s = deriv (eval_fds fds_zeta) s

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deriv zeta s = deriv (eval_fds fds_zeta) s

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
have "deriv (eval_fds fds_zeta) s / zeta s = eval_fds (fds_deriv fds_zeta / fds_zeta) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (eval_fds fds_zeta) s / zeta s = eval_fds (fds_deriv fds_zeta / fds_zeta) s
[PROOF STEP]
using assms zeta_Re_gt_1_nonzero[of s]
[PROOF STATE]
proof (prove)
using this:
1 < Re s
1 < Re s \<Longrightarrow> zeta s \<noteq> 0

goal (1 subgoal):
 1. deriv (eval_fds fds_zeta) s / zeta s = eval_fds (fds_deriv fds_zeta / fds_zeta) s
[PROOF STEP]
by (subst eval_fds_log_deriv) (auto simp: eval_fds_zeta eval_fds_deriv intro!: abscissa)
[PROOF STATE]
proof (state)
this:
deriv (eval_fds fds_zeta) s / zeta s = eval_fds (fds_deriv fds_zeta / fds_zeta) s

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deriv (eval_fds fds_zeta) s / zeta s = eval_fds (fds_deriv fds_zeta / fds_zeta) s

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
have "eval_fds (fds_deriv fds_zeta / fds_zeta) s =
               -(\<Sum>\<^sub>ap | prime p. ln (real p) * (1 / (1 - fds_nth fds_zeta p / p powr s) - 1))"
    (is "_ = -?S")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (fds_deriv fds_zeta / fds_zeta) s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1))
[PROOF STEP]
using eval_fds_logderiv_completely_multiplicative[OF *, of s] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>fds_nth fds_zeta 1 \<noteq> 0; abs_conv_abscissa fds_zeta < ereal (s \<bullet> 1)\<rbrakk> \<Longrightarrow> (\<lambda>p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / nat_power p s) - 1)) abs_summable_on {p. prime p}
\<lbrakk>fds_nth fds_zeta 1 \<noteq> 0; abs_conv_abscissa fds_zeta < ereal (s \<bullet> 1)\<rbrakk> \<Longrightarrow> eval_fds (fds_deriv fds_zeta / fds_zeta) s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / nat_power p s) - 1))
1 < Re s

goal (1 subgoal):
 1. eval_fds (fds_deriv fds_zeta / fds_zeta) s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eval_fds (fds_deriv fds_zeta / fds_zeta) s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1))

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_fds (fds_deriv fds_zeta / fds_zeta) s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1))

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
have "?S = (\<Sum>\<^sub>ap | prime p. ln (real p) / (p powr s - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) = (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < Re s

goal (1 subgoal):
 1. (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) = (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
by (intro infsetsum_cong) (auto simp: fds_nth_zeta divide_simps dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) * (1 / (1 - fds_nth fds_zeta p / of_nat p powr s) - 1)) = (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
show ?th2
[PROOF STATE]
proof (prove)
using this:
deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))

goal (1 subgoal):
 1. deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ball_inj_conv: assumes "inj f" shows "(\<forall>y\<in>f ` A. P (inv f y)) \<longleftrightarrow> (\<forall>x\<in>A. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>y\<in>f ` A. P (inv f y)) = (\<forall>x\<in>A. P x)
[PROOF STEP]
using ball_simps(9)[of f A "\<lambda>y. P (inv f y)"]
[PROOF STATE]
proof (prove)
using this:
(\<forall>x\<in>f ` A. P (inv f x)) = (\<forall>x\<in>A. P (inv f (f x)))

goal (1 subgoal):
 1. (\<forall>y\<in>f ` A. P (inv f y)) = (\<forall>x\<in>A. P x)
[PROOF STEP]
unfolding inv_f_f[OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<forall>x\<in>f ` A. P (inv f x)) = (\<forall>x\<in>A. P x)

goal (1 subgoal):
 1. (\<forall>y\<in>f ` A. P (inv f y)) = (\<forall>x\<in>A. P x)
[PROOF STEP]
.


[STATEMENT]
lemma prefix_Inter: "((a \<rightarrow> P) ||| (b \<rightarrow> Q)) = ((a \<rightarrow> (P ||| (b \<rightarrow> Q))) \<box> (b \<rightarrow> ((a \<rightarrow> P) ||| Q)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<rightarrow> P|||b \<rightarrow> Q) = (a \<rightarrow> (P|||b \<rightarrow> Q) [+] b \<rightarrow> (a \<rightarrow> P|||Q))
[PROOF STEP]
using mprefix_Par_Int[of "{b}" "{}" "{a}" "\<lambda>x. P" "\<lambda>x. Q", simplified]
[PROOF STATE]
proof (prove)
using this:
(Mprefix {a} (\<lambda>x. P)|||Mprefix {b} (\<lambda>x. Q)) = (Mprefix {a} (\<lambda>x. P|||Mprefix {b} (\<lambda>x. Q)) [+] Mprefix {b} (\<lambda>y. Mprefix {a} (\<lambda>x. P)|||Q))

goal (1 subgoal):
 1. (a \<rightarrow> P|||b \<rightarrow> Q) = (a \<rightarrow> (P|||b \<rightarrow> Q) [+] b \<rightarrow> (a \<rightarrow> P|||Q))
[PROOF STEP]
unfolding write0_def
[PROOF STATE]
proof (prove)
using this:
(Mprefix {a} (\<lambda>x. P)|||Mprefix {b} (\<lambda>x. Q)) = (Mprefix {a} (\<lambda>x. P|||Mprefix {b} (\<lambda>x. Q)) [+] Mprefix {b} (\<lambda>y. Mprefix {a} (\<lambda>x. P)|||Q))

goal (1 subgoal):
 1. (Mprefix {a} (\<lambda>x. P)|||Mprefix {b} (\<lambda>x. Q)) = (Mprefix {a} (\<lambda>x. P|||Mprefix {b} (\<lambda>x. Q)) [+] Mprefix {b} (\<lambda>x. Mprefix {a} (\<lambda>x. P)|||Q))
[PROOF STEP]
by assumption


[STATEMENT]
lemma times_of_nat_minus_left:
  "(of_nat m - of_nat n) * l = of_nat m * l - of_nat n * l" for l :: hmultiset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat m - of_nat n) * l = of_nat m * l - of_nat n * l
[PROOF STEP]
by (induct n m rule: diff_induct) (auto simp: ring_distribs)


[STATEMENT]
lemma MOST_conjI: "MOST x. P x \<Longrightarrow> MOST x. Q x \<Longrightarrow> MOST x. P x \<and> Q x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>\<infinity>x. P x; \<forall>\<^sub>\<infinity>x. Q x\<rbrakk> \<Longrightarrow> \<forall>\<^sub>\<infinity>x. P x \<and> Q x
[PROOF STEP]
by (fact eventually_conj)


[STATEMENT]
lemma twice_tm_len_plus_14[simp]: "twice_tm_len + 14 =  14 + length (shift twice_tm 12) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. twice_tm_len + 14 = 14 + length (shift twice_tm 12) div 2
[PROOF STEP]
apply(simp add: twice_tm_def twice_tm_len_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done