[STATEMENT]
lemma factor_gauss_int_prime_nat_correct:
  assumes "prime p"
  shows   "set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
using prime_mod_4_cases[OF assms]
[PROOF STATE]
proof (prove)
using this:
p = 2 \<or> [p = 1] (mod 4) \<or> [p = 3] (mod 4)

goal (1 subgoal):
 1. set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
proof (elim disjE)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. p = 2 \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
 2. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
 3. [p = 3] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
assume "p = 2"
[PROOF STATE]
proof (state)
this:
p = 2

goal (3 subgoals):
 1. p = 2 \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
 2. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
 3. [p = 3] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 2

goal (1 subgoal):
 1. set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
by (auto simp: prime_factorization_2_gauss_int factor_gauss_int_prime_nat_def)
[PROOF STATE]
proof (state)
this:
set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)

goal (2 subgoals):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
 2. [p = 3] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
 2. [p = 3] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
assume *: "[p = 3] (mod 4)"
[PROOF STATE]
proof (state)
this:
[p = 3] (mod 4)

goal (2 subgoals):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
 2. [p = 3] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime p
[p = 3] (mod 4)
[PROOF STEP]
have "prime (of_nat p :: gauss_int)"
[PROOF STATE]
proof (prove)
using this:
prime p
[p = 3] (mod 4)

goal (1 subgoal):
 1. prime (of_nat p)
[PROOF STEP]
by (intro prime_gauss_int_of_nat)
[PROOF STATE]
proof (state)
this:
prime (of_nat p)

goal (2 subgoals):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
 2. [p = 3] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
prime (of_nat p)

goal (1 subgoal):
 1. set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
using assms *
[PROOF STATE]
proof (prove)
using this:
prime (of_nat p)
prime p
[p = 3] (mod 4)

goal (1 subgoal):
 1. set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
by (auto simp: prime_factorization_prime factor_gauss_int_prime_nat_def cong_def)
[PROOF STATE]
proof (state)
this:
set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
assume *: "[p = 1] (mod 4)"
[PROOF STATE]
proof (state)
this:
[p = 1] (mod 4)

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[p = 1] (mod 4)
[PROOF STEP]
interpret noninert_gauss_int_prime p
[PROOF STATE]
proof (prove)
using this:
[p = 1] (mod 4)

goal (1 subgoal):
 1. noninert_gauss_int_prime p
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
[p = 1] (mod 4)
prime p

goal (1 subgoal):
 1. noninert_gauss_int_prime p
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
define z where "z = prime_square_sum_nat_decomp p"
[PROOF STATE]
proof (state)
this:
z = prime_square_sum_nat_decomp p

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
define x y where "x = fst z" and "y = snd z"
[PROOF STATE]
proof (state)
this:
x = fst z
y = snd z

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
have xy: "x ^ 2 + y ^ 2 = p" "x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 + y\<^sup>2 = p &&& x \<le> y
[PROOF STEP]
using prime_square_sum_nat_decomp_correct[of p] * assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime p; p = 2 \<or> [p = 1] (mod 4)\<rbrakk> \<Longrightarrow> (fst (prime_square_sum_nat_decomp p))\<^sup>2 + (snd (prime_square_sum_nat_decomp p))\<^sup>2 = p
\<lbrakk>prime p; p = 2 \<or> [p = 1] (mod 4)\<rbrakk> \<Longrightarrow> fst (prime_square_sum_nat_decomp p) \<le> snd (prime_square_sum_nat_decomp p)
[p = 1] (mod 4)
prime p

goal (1 subgoal):
 1. x\<^sup>2 + y\<^sup>2 = p &&& x \<le> y
[PROOF STEP]
by (auto simp: x_def y_def z_def)
[PROOF STATE]
proof (state)
this:
x\<^sup>2 + y\<^sup>2 = p
x \<le> y

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
from xy
[PROOF STATE]
proof (chain)
picking this:
x\<^sup>2 + y\<^sup>2 = p
x \<le> y
[PROOF STEP]
have xy_signs: "x > 0" "y > 0"
[PROOF STATE]
proof (prove)
using this:
x\<^sup>2 + y\<^sup>2 = p
x \<le> y

goal (1 subgoal):
 1. 0 < x &&& 0 < y
[PROOF STEP]
using prime_1_mod_4_sum_of_squares_unique_aux[of p x y] assms *
[PROOF STATE]
proof (prove)
using this:
x\<^sup>2 + y\<^sup>2 = p
x \<le> y
\<lbrakk>prime p; [p = 1] (mod 4); x\<^sup>2 + y\<^sup>2 = p\<rbrakk> \<Longrightarrow> 0 < x \<and> 0 < y \<and> x \<noteq> y
prime p
[p = 1] (mod 4)

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

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
have norms: "gauss_int_norm (of_nat x + \<i>\<^sub>\<int> * of_nat y) = p"
              "gauss_int_norm (of_nat y + \<i>\<^sub>\<int> * of_nat x) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_int_norm (of_nat x + \<i>\<^sub>\<int> * of_nat y) = p &&& gauss_int_norm (of_nat y + \<i>\<^sub>\<int> * of_nat x) = p
[PROOF STEP]
using xy
[PROOF STATE]
proof (prove)
using this:
x\<^sup>2 + y\<^sup>2 = p
x \<le> y

goal (1 subgoal):
 1. gauss_int_norm (of_nat x + \<i>\<^sub>\<int> * of_nat y) = p &&& gauss_int_norm (of_nat y + \<i>\<^sub>\<int> * of_nat x) = p
[PROOF STEP]
by (auto simp: gauss_int_norm_def nat_add_distrib nat_power_eq)
[PROOF STATE]
proof (state)
this:
gauss_int_norm (of_nat x + \<i>\<^sub>\<int> * of_nat y) = p
gauss_int_norm (of_nat y + \<i>\<^sub>\<int> * of_nat x) = p

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
have prime: "prime (of_nat x + \<i>\<^sub>\<int> * of_nat y)" "prime (of_nat y + \<i>\<^sub>\<int> * of_nat x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (of_nat x + \<i>\<^sub>\<int> * of_nat y) &&& prime (of_nat y + \<i>\<^sub>\<int> * of_nat x)
[PROOF STEP]
using norms xy_signs \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
gauss_int_norm (of_nat x + \<i>\<^sub>\<int> * of_nat y) = p
gauss_int_norm (of_nat y + \<i>\<^sub>\<int> * of_nat x) = p
0 < x
0 < y
prime p

goal (1 subgoal):
 1. prime (of_nat x + \<i>\<^sub>\<int> * of_nat y) &&& prime (of_nat y + \<i>\<^sub>\<int> * of_nat x)
[PROOF STEP]
unfolding prime_def normalized_gauss_int_iff
[PROOF STATE]
proof (prove)
using this:
gauss_int_norm (of_nat x + \<i>\<^sub>\<int> * of_nat y) = p
gauss_int_norm (of_nat y + \<i>\<^sub>\<int> * of_nat x) = p
0 < x
0 < y
prime_elem p \<and> normalize p = p

goal (1 subgoal):
 1. prime_elem (of_nat x + \<i>\<^sub>\<int> * of_nat y) \<and> (of_nat x + \<i>\<^sub>\<int> * of_nat y = 0 \<or> 0 < ReZ (of_nat x + \<i>\<^sub>\<int> * of_nat y) \<and> 0 \<le> ImZ (of_nat x + \<i>\<^sub>\<int> * of_nat y)) &&& prime_elem (of_nat y + \<i>\<^sub>\<int> * of_nat x) \<and> (of_nat y + \<i>\<^sub>\<int> * of_nat x = 0 \<or> 0 < ReZ (of_nat y + \<i>\<^sub>\<int> * of_nat x) \<and> 0 \<le> ImZ (of_nat y + \<i>\<^sub>\<int> * of_nat x))
[PROOF STEP]
by (auto intro!: prime_gauss_int_norm_imp_prime_elem)
[PROOF STATE]
proof (state)
this:
prime (of_nat x + \<i>\<^sub>\<int> * of_nat y)
prime (of_nat y + \<i>\<^sub>\<int> * of_nat x)

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
have "normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p
[PROOF STEP]
have "(of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x) = (\<i>\<^sub>\<int> * of_nat p :: gauss_int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x) = \<i>\<^sub>\<int> * of_nat p
[PROOF STEP]
by (subst xy(1) [symmetric]) (auto simp: gauss_int_eq_iff power2_eq_square)
[PROOF STATE]
proof (state)
this:
(of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x) = \<i>\<^sub>\<int> * of_nat p

goal (1 subgoal):
 1. normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x) = \<i>\<^sub>\<int> * of_nat p

goal (1 subgoal):
 1. normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p
[PROOF STEP]
have "normalize \<dots> = of_nat p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (\<i>\<^sub>\<int> * of_nat p) = of_nat p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normalize (\<i>\<^sub>\<int> * of_nat p) = of_nat p

goal (1 subgoal):
 1. normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p

goal (1 subgoal):
 1. normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
hence "prime_factorization (of_nat p) =
         prime_factorization (prod_mset {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#})"
[PROOF STATE]
proof (prove)
using this:
normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p

goal (1 subgoal):
 1. prime_factorization (of_nat p) = prime_factorization (\<Prod>\<^sub># {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#})
[PROOF STEP]
using assms xy
[PROOF STATE]
proof (prove)
using this:
normalize ((of_nat x + \<i>\<^sub>\<int> * of_nat y) * (of_nat y + \<i>\<^sub>\<int> * of_nat x)) = of_nat p
prime p
x\<^sup>2 + y\<^sup>2 = p
x \<le> y

goal (1 subgoal):
 1. prime_factorization (of_nat p) = prime_factorization (\<Prod>\<^sub># {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#})
[PROOF STEP]
by (subst prime_factorization_unique) (auto simp: gauss_int_eq_iff)
[PROOF STATE]
proof (state)
this:
prime_factorization (of_nat p) = prime_factorization (\<Prod>\<^sub># {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#})

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization (of_nat p) = prime_factorization (\<Prod>\<^sub># {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#})

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
have "\<dots> = {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (\<Prod>\<^sub># {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}) = {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}
[PROOF STEP]
using prime
[PROOF STATE]
proof (prove)
using this:
prime (of_nat x + \<i>\<^sub>\<int> * of_nat y)
prime (of_nat y + \<i>\<^sub>\<int> * of_nat x)

goal (1 subgoal):
 1. prime_factorization (\<Prod>\<^sub># {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}) = {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}
[PROOF STEP]
by (subst prime_factorization_prod_mset_primes) auto
[PROOF STATE]
proof (state)
this:
prime_factorization (\<Prod>\<^sub># {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}) = {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prime_factorization (of_nat p) = {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}
[PROOF STEP]
have "prime_factors (of_nat p) = {of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x}"
[PROOF STATE]
proof (prove)
using this:
prime_factorization (of_nat p) = {#of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x#}

goal (1 subgoal):
 1. prime_factors (of_nat p) = {of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime_factors (of_nat p) = {of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x}

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factors (of_nat p) = {of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x}

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
have "\<dots> = set (factor_gauss_int_prime_nat p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x} = set (factor_gauss_int_prime_nat p)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
[p = 1] (mod 4)

goal (1 subgoal):
 1. {of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x} = set (factor_gauss_int_prime_nat p)
[PROOF STEP]
unfolding factor_gauss_int_prime_nat_def case_prod_unfold
[PROOF STATE]
proof (prove)
using this:
[p = 1] (mod 4)

goal (1 subgoal):
 1. {of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x} = set (if p = 2 then [1 + \<i>\<^sub>\<int>] else if [p = 3] (mod 4) then [of_nat p] else [of_nat (fst (prime_square_sum_nat_decomp p)) + \<i>\<^sub>\<int> * of_nat (snd (prime_square_sum_nat_decomp p)), of_nat (snd (prime_square_sum_nat_decomp p)) + \<i>\<^sub>\<int> * of_nat (fst (prime_square_sum_nat_decomp p))])
[PROOF STEP]
by (auto simp: cong_def x_def y_def z_def)
[PROOF STATE]
proof (state)
this:
{of_nat x + \<i>\<^sub>\<int> * of_nat y, of_nat y + \<i>\<^sub>\<int> * of_nat x} = set (factor_gauss_int_prime_nat p)

goal (1 subgoal):
 1. [p = 1] (mod 4) \<Longrightarrow> set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prime_factors (of_nat p) = set (factor_gauss_int_prime_nat p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prime_factors (of_nat p) = set (factor_gauss_int_prime_nat p)

goal (1 subgoal):
 1. set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
set (factor_gauss_int_prime_nat p) = prime_factors (of_nat p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma keys_lowerPowers: "keys (lowerPowers b i m) = inc_above b i ` (keys m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (lowerPowers b i m) = inc_above b i ` keys m
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> keys (lowerPowers b i m) \<Longrightarrow> x \<in> inc_above b i ` keys m
 2. \<And>x xa. xa \<in> keys m \<Longrightarrow> inc_above b i xa \<in> keys (lowerPowers b i m)
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> keys (lowerPowers b i m) \<Longrightarrow> x \<in> inc_above b i ` keys m
[PROOF STEP]
apply (rule image_eqI[where x="dec_above b i x"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<in> keys (lowerPowers b i m) \<Longrightarrow> x = inc_above b i (dec_above b i x)
 2. x \<in> keys (lowerPowers b i m) \<Longrightarrow> dec_above b i x \<in> keys m
[PROOF STEP]
apply (auto simp: inc_above_dec_above in_keys_iff lowerPowers.rep_eq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (if b \<le> x \<and> x < b + i then 0::'a else lookup m (dec_above b i x)) \<noteq> (0::'a) \<Longrightarrow> x = inc_above b i (dec_above b i x)
 2. \<lbrakk>(if b \<le> x \<and> x < b + i then 0::'a else lookup m (dec_above b i x)) \<noteq> (0::'a); lookup m (dec_above b i x) = (0::'a)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (metis inc_above_dec_above not_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(if b \<le> x \<and> x < b + i then 0::'a else lookup m (dec_above b i x)) \<noteq> (0::'a); lookup m (dec_above b i x) = (0::'a)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by meson
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. xa \<in> keys m \<Longrightarrow> inc_above b i xa \<in> keys (lowerPowers b i m)
[PROOF STEP]
by (metis higherPowers.rep_eq higherPowers_lowerPowers in_keys_iff)


[STATEMENT]
lemma deficient284ex: "deficient_number 284"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deficient_number 284
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. deficient_number 284
[PROOF STEP]
have "220 Amic 284"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
using Amicable_Example_Pythagoras
[PROOF STATE]
proof (prove)
using this:
220 Amic 284

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

goal (1 subgoal):
 1. deficient_number 284
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
220 Amic 284

goal (1 subgoal):
 1. deficient_number 284
[PROOF STEP]
have "(220::nat) < 284"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 220 < 284
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
220 < 284

goal (1 subgoal):
 1. deficient_number 284
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
220 Amic 284
220 < 284
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
220 Amic 284
220 < 284

goal (1 subgoal):
 1. deficient_number 284
[PROOF STEP]
using Amicable_pair_deficient Amicable_pair_sym
[PROOF STATE]
proof (prove)
using this:
220 Amic 284
220 < 284
\<lbrakk>?n < ?m; ?m Amic ?n\<rbrakk> \<Longrightarrow> deficient_number ?m
?m Amic ?n \<Longrightarrow> ?n Amic ?m

goal (1 subgoal):
 1. deficient_number 284
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
deficient_number 284

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rref_right_mul:
  assumes "row_echelon_form A"
  assumes "dim_col A \<ge> dim_row A"
  shows
    "take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = A
[PROOF STEP]
from take_cols_pivot_eq[OF assms]
[PROOF STATE]
proof (chain)
picking this:
take_cols A (map snd (pivot_positions A)) = 1\<^sub>m (length (pivot_positions A)) @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (length (pivot_positions A))
[PROOF STEP]
have
    1: "take_cols A (map snd (pivot_positions A)) =
    1\<^sub>m (length (pivot_positions A)) @\<^sub>r
    0\<^sub>m (dim_row A - length (pivot_positions A)) (length (pivot_positions A))"
[PROOF STATE]
proof (prove)
using this:
take_cols A (map snd (pivot_positions A)) = 1\<^sub>m (length (pivot_positions A)) @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (length (pivot_positions A))

goal (1 subgoal):
 1. take_cols A (map snd (pivot_positions A)) = 1\<^sub>m (length (pivot_positions A)) @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (length (pivot_positions A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
take_cols A (map snd (pivot_positions A)) = 1\<^sub>m (length (pivot_positions A)) @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (length (pivot_positions A))

goal (1 subgoal):
 1. take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = A
[PROOF STEP]
have 2: "take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] =
    take_rows A [0..<length (pivot_positions A)]  @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A)
[PROOF STEP]
unfolding 1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1\<^sub>m (length (pivot_positions A)) @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (length (pivot_positions A))) * take_rows A [0..<length (pivot_positions A)] = take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A)
[PROOF STEP]
apply (auto simp add: append_rows_mat_mul)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m (length (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (length (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A)
[PROOF STEP]
by (smt add_diff_cancel_right' assms diff_diff_cancel dim_col_take_rows dim_row_append_rows index_zero_mat(2) left_mult_one_mat' left_mult_zero_mat' length_pivot_positions_dim_row row_echelon_form_zero_rows)
[PROOF STATE]
proof (state)
this:
take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A)

goal (1 subgoal):
 1. take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = A
[PROOF STEP]
from row_echelon_form_zero_rows[OF assms]
[PROOF STATE]
proof (chain)
picking this:
take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A) = A
[PROOF STEP]
have
    "... = A"
[PROOF STATE]
proof (prove)
using this:
take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A) = A

goal (1 subgoal):
 1. take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A) = A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A) = A

goal (1 subgoal):
 1. take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
take_rows A [0..<length (pivot_positions A)] @\<^sub>r 0\<^sub>m (dim_row A - length (pivot_positions A)) (dim_col A) = A

goal (1 subgoal):
 1. take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = A
[PROOF STEP]
by (simp add: "2")
[PROOF STATE]
proof (state)
this:
take_cols A (map snd (pivot_positions A)) * take_rows A [0..<length (pivot_positions A)] = A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_higher_pderiv_aux1':
  fixes c :: "'a :: idom"
  assumes "k < n" "[:-c, 1:] ^ n dvd p"
  shows   "poly ((pderiv ^^ k) p) c = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly ((pderiv ^^ k) p) c = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly ((pderiv ^^ k) p) c = (0::'a)
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
[:- c, 1::'a:] ^ n dvd p
[PROOF STEP]
obtain q where "p = [:-c, 1:] ^ n * q"
[PROOF STATE]
proof (prove)
using this:
[:- c, 1::'a:] ^ n dvd p

goal (1 subgoal):
 1. (\<And>q. p = [:- c, 1::'a:] ^ n * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim dvdE)
[PROOF STATE]
proof (state)
this:
p = [:- c, 1::'a:] ^ n * q

goal (1 subgoal):
 1. poly ((pderiv ^^ k) p) c = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p = [:- c, 1::'a:] ^ n * q

goal (1 subgoal):
 1. poly ((pderiv ^^ k) p) c = (0::'a)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
k < n
[PROOF STEP]
have "poly ((pderiv ^^ k) \<dots>) c = 0"
[PROOF STATE]
proof (prove)
using this:
k < n

goal (1 subgoal):
 1. poly ((pderiv ^^ k) ([:- c, 1::'a:] ^ n * q)) c = (0::'a)
[PROOF STEP]
by (rule poly_higher_pderiv_aux1)
[PROOF STATE]
proof (state)
this:
poly ((pderiv ^^ k) ([:- c, 1::'a:] ^ n * q)) c = (0::'a)

goal (1 subgoal):
 1. poly ((pderiv ^^ k) p) c = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly ((pderiv ^^ k) p) c = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly ((pderiv ^^ k) p) c = (0::'a)

goal (1 subgoal):
 1. poly ((pderiv ^^ k) p) c = (0::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly ((pderiv ^^ k) p) c = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cblinfun_bij1:
  fixes f::"'a \<Rightarrow>\<^sub>C\<^sub>L 'a::ceuclidean_space"
  assumes "f o\<^sub>C\<^sub>L g = id_cblinfun"
  shows "bij (cblinfun_apply f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij (cblinfun_apply f)
[PROOF STEP]
proof (rule bijI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj (cblinfun_apply f)
 2. surj (cblinfun_apply f)
[PROOF STEP]
show "surj (cblinfun_apply f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj (cblinfun_apply f)
[PROOF STEP]
by (metis assms cblinfun_apply_cblinfun_compose cblinfun_id_cblinfun_apply surjI)
[PROOF STATE]
proof (state)
this:
surj (cblinfun_apply f)

goal (1 subgoal):
 1. inj (cblinfun_apply f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
surj (cblinfun_apply f)
[PROOF STEP]
show "inj (cblinfun_apply f)"
[PROOF STATE]
proof (prove)
using this:
surj (cblinfun_apply f)

goal (1 subgoal):
 1. inj (cblinfun_apply f)
[PROOF STEP]
using bounded_clinear_def cblinfun.bounded_clinear_right ceucl.linear_surjective_imp_injective
[PROOF STATE]
proof (prove)
using this:
surj (cblinfun_apply f)
bounded_clinear ?f \<equiv> clinear ?f \<and> bounded_clinear_axioms ?f
bounded_clinear (cblinfun_apply ?a)
\<lbrakk>clinear ?f; surj ?f; cdim UNIV = cdim UNIV\<rbrakk> \<Longrightarrow> inj ?f

goal (1 subgoal):
 1. inj (cblinfun_apply f)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inj (cblinfun_apply f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trace_pdo_eq_imp_eq:
  assumes A: "A \<in> carrier_mat n n"
    and B: "B \<in> carrier_mat n n"
    and teq: "\<And>\<rho>. \<rho> \<in> carrier_mat n n \<Longrightarrow> partial_density_operator \<rho> \<Longrightarrow> trace (A * \<rho>) = trace (B * \<rho>)"
  shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
from teq
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?\<rho> \<in> carrier_mat n n; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> trace (A * ?\<rho>) = trace (B * ?\<rho>)
[PROOF STEP]
have "A \<le>\<^sub>L B"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<rho> \<in> carrier_mat n n; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> trace (A * ?\<rho>) = trace (B * ?\<rho>)

goal (1 subgoal):
 1. A \<le>\<^sub>L B
[PROOF STEP]
using lowner_le_trace[OF A B] teq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<rho> \<in> carrier_mat n n; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> trace (A * ?\<rho>) = trace (B * ?\<rho>)
(A \<le>\<^sub>L B) = (\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>))
\<lbrakk>?\<rho> \<in> carrier_mat n n; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> trace (A * ?\<rho>) = trace (B * ?\<rho>)

goal (1 subgoal):
 1. A \<le>\<^sub>L B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<le>\<^sub>L B

goal (1 subgoal):
 1. A = B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<le>\<^sub>L B

goal (1 subgoal):
 1. A = B
[PROOF STEP]
from teq
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?\<rho> \<in> carrier_mat n n; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> trace (A * ?\<rho>) = trace (B * ?\<rho>)
[PROOF STEP]
have "B \<le>\<^sub>L A"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<rho> \<in> carrier_mat n n; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> trace (A * ?\<rho>) = trace (B * ?\<rho>)

goal (1 subgoal):
 1. B \<le>\<^sub>L A
[PROOF STEP]
using lowner_le_trace[OF B A] teq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<rho> \<in> carrier_mat n n; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> trace (A * ?\<rho>) = trace (B * ?\<rho>)
(B \<le>\<^sub>L A) = (\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (B * \<rho>) \<le> trace (A * \<rho>))
\<lbrakk>?\<rho> \<in> carrier_mat n n; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> trace (A * ?\<rho>) = trace (B * ?\<rho>)

goal (1 subgoal):
 1. B \<le>\<^sub>L A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<le>\<^sub>L A

goal (1 subgoal):
 1. A = B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A \<le>\<^sub>L B
B \<le>\<^sub>L A
[PROOF STEP]
show "A = B"
[PROOF STATE]
proof (prove)
using this:
A \<le>\<^sub>L B
B \<le>\<^sub>L A

goal (1 subgoal):
 1. A = B
[PROOF STEP]
using lowner_le_antisym A B
[PROOF STATE]
proof (prove)
using this:
A \<le>\<^sub>L B
B \<le>\<^sub>L A
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n; ?A \<le>\<^sub>L ?B; ?B \<le>\<^sub>L ?A\<rbrakk> \<Longrightarrow> ?A = ?B
A \<in> carrier_mat n n
B \<in> carrier_mat n n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_eq_0_iff [simp]:
  fixes x y::V
  shows "x+y = 0 \<longleftrightarrow> x=0 \<and> y=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y = 0) = (x = 0 \<and> y = 0)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. x + y = 0 \<Longrightarrow> x = 0
 2. x + y = 0 \<Longrightarrow> y = 0
 3. \<lbrakk>y = 0; x = 0\<rbrakk> \<Longrightarrow> 0 + 0 = 0
[PROOF STEP]
show "x = 0" if "x + y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = 0
[PROOF STEP]
by (metis that le_imp_less_or_eq not_less_0 plus sup_ge1)
[PROOF STATE]
proof (state)
this:
x + y = 0 \<Longrightarrow> x = 0

goal (2 subgoals):
 1. x + y = 0 \<Longrightarrow> y = 0
 2. \<lbrakk>y = 0; x = 0\<rbrakk> \<Longrightarrow> 0 + 0 = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x + y = 0 \<Longrightarrow> x = 0
[PROOF STEP]
show "y = 0" if "x + y = 0"
[PROOF STATE]
proof (prove)
using this:
x + y = 0 \<Longrightarrow> x = 0

goal (1 subgoal):
 1. y = 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x + y = 0 \<Longrightarrow> x = 0
x + y = 0

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

goal (1 subgoal):
 1. \<lbrakk>y = 0; x = 0\<rbrakk> \<Longrightarrow> 0 + 0 = 0
[PROOF STEP]
qed auto


[STATEMENT]
lemma mult_vm_nonzero:
  assumes "v \<noteq> vec_zero" and "mat_det A \<noteq> 0"
  shows "v *\<^sub>v\<^sub>m A \<noteq> vec_zero"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v *\<^sub>v\<^sub>m A \<noteq> vec_zero
[PROOF STEP]
apply (rule ccontr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> v *\<^sub>v\<^sub>m A \<noteq> vec_zero \<Longrightarrow> False
[PROOF STEP]
using assms mult_vm_inv[of vec_zero v A] mat_inv_r vec_zero_r
[PROOF STATE]
proof (prove)
using this:
v \<noteq> vec_zero
mat_det A \<noteq> 0
\<lbrakk>vec_zero = v *\<^sub>v\<^sub>m A; mat_det A \<noteq> 0\<rbrakk> \<Longrightarrow> v = vec_zero *\<^sub>v\<^sub>m mat_inv A
mat_det ?A \<noteq> 0 \<Longrightarrow> ?A *\<^sub>m\<^sub>m mat_inv ?A = eye
vec_zero *\<^sub>v\<^sub>m ?A = vec_zero

goal (1 subgoal):
 1. \<not> v *\<^sub>v\<^sub>m A \<noteq> vec_zero \<Longrightarrow> False
[PROOF STEP]
by auto


[STATEMENT]
lemma bounded_linear_linepath':
  assumes "bounded_linear f"
  shows   "f \<circ> linepath a b = linepath (f a) (f b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> linepath a b = linepath (f a) (f b)
[PROOF STEP]
using bounded_linear_linepath[OF assms]
[PROOF STATE]
proof (prove)
using this:
f (linepath ?a ?b ?x) = linepath (f ?a) (f ?b) ?x

goal (1 subgoal):
 1. f \<circ> linepath a b = linepath (f a) (f b)
[PROOF STEP]
by (simp add: fun_eq_iff)


[STATEMENT]
theorem stabiliser_subgroup: "subgroup (stabiliser x) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (stabiliser x) G
[PROOF STEP]
proof(rule subgroupI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. stabiliser x \<subseteq> carrier G
 2. stabiliser x \<noteq> {}
 3. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 4. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
show "stabiliser x \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stabiliser x \<subseteq> carrier G
[PROOF STEP]
using stabiliser_def
[PROOF STATE]
proof (prove)
using this:
stabiliser ?x = {g \<in> carrier G. g \<odot> ?x = ?x}

goal (1 subgoal):
 1. stabiliser x \<subseteq> carrier G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
stabiliser x \<subseteq> carrier G

goal (3 subgoals):
 1. stabiliser x \<noteq> {}
 2. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 3. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. stabiliser x \<noteq> {}
 2. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 3. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. stabiliser x \<noteq> {}
 2. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 3. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
from id_act
[PROOF STATE]
proof (chain)
picking this:
\<one> \<odot> ?x = ?x
[PROOF STEP]
have "\<one> \<odot> x = x"
[PROOF STATE]
proof (prove)
using this:
\<one> \<odot> ?x = ?x

goal (1 subgoal):
 1. \<one> \<odot> x = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<one> \<odot> x = x

goal (3 subgoals):
 1. stabiliser x \<noteq> {}
 2. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 3. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<one> \<odot> x = x
[PROOF STEP]
have "\<one> \<in> stabiliser x"
[PROOF STATE]
proof (prove)
using this:
\<one> \<odot> x = x

goal (1 subgoal):
 1. \<one> \<in> stabiliser x
[PROOF STEP]
using stabiliser_def
[PROOF STATE]
proof (prove)
using this:
\<one> \<odot> x = x
stabiliser ?x = {g \<in> carrier G. g \<odot> ?x = ?x}

goal (1 subgoal):
 1. \<one> \<in> stabiliser x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<one> \<in> stabiliser x

goal (3 subgoals):
 1. stabiliser x \<noteq> {}
 2. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 3. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<one> \<in> stabiliser x
[PROOF STEP]
show "stabiliser x \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<one> \<in> stabiliser x

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

goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
fix g x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
assume gStab:"g \<in> stabiliser x"
[PROOF STATE]
proof (state)
this:
g \<in> stabiliser x

goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<in> stabiliser x
[PROOF STEP]
have g_car:"g \<in> carrier G"
[PROOF STATE]
proof (prove)
using this:
g \<in> stabiliser x

goal (1 subgoal):
 1. g \<in> carrier G
[PROOF STEP]
using stabiliser_def
[PROOF STATE]
proof (prove)
using this:
g \<in> stabiliser x
stabiliser ?x = {g \<in> carrier G. g \<odot> ?x = ?x}

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

goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<in> carrier G
[PROOF STEP]
have invg_car:"inv g \<in> carrier G"
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G

goal (1 subgoal):
 1. inv g \<in> carrier G
[PROOF STEP]
using inv_closed
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
?x \<in> carrier G \<Longrightarrow> inv ?x \<in> carrier G

goal (1 subgoal):
 1. inv g \<in> carrier G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inv g \<in> carrier G

goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
have "g \<odot> x = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<odot> x = x
[PROOF STEP]
using stabiliser_def gStab
[PROOF STATE]
proof (prove)
using this:
stabiliser ?x = {g \<in> carrier G. g \<odot> ?x = ?x}
g \<in> stabiliser x

goal (1 subgoal):
 1. g \<odot> x = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g \<odot> x = x

goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<odot> x = x
[PROOF STEP]
have "inv g \<odot> (g \<odot> x) = inv g \<odot> x"
[PROOF STATE]
proof (prove)
using this:
g \<odot> x = x

goal (1 subgoal):
 1. inv g \<odot> (g \<odot> x) = inv g \<odot> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inv g \<odot> (g \<odot> x) = inv g \<odot> x

goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inv g \<odot> (g \<odot> x) = inv g \<odot> x
[PROOF STEP]
have "(inv g \<otimes> g) \<odot> x = inv g \<odot> x"
[PROOF STATE]
proof (prove)
using this:
inv g \<odot> (g \<odot> x) = inv g \<odot> x

goal (1 subgoal):
 1. inv g \<otimes> g \<odot> x = inv g \<odot> x
[PROOF STEP]
using compat_act g_car invg_car
[PROOF STATE]
proof (prove)
using this:
inv g \<odot> (g \<odot> x) = inv g \<odot> x
?g \<in> carrier G \<and> ?h \<in> carrier G \<longrightarrow> ?g \<odot> (?h \<odot> ?x) = ?g \<otimes> ?h \<odot> ?x
g \<in> carrier G
inv g \<in> carrier G

goal (1 subgoal):
 1. inv g \<otimes> g \<odot> x = inv g \<odot> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inv g \<otimes> g \<odot> x = inv g \<odot> x

goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inv g \<otimes> g \<odot> x = inv g \<odot> x
[PROOF STEP]
have "x = (inv g) \<odot> x"
[PROOF STATE]
proof (prove)
using this:
inv g \<otimes> g \<odot> x = inv g \<odot> x

goal (1 subgoal):
 1. x = inv g \<odot> x
[PROOF STEP]
using g_car l_inv
[PROOF STATE]
proof (prove)
using this:
inv g \<otimes> g \<odot> x = inv g \<odot> x
g \<in> carrier G
?x \<in> carrier G \<Longrightarrow> inv ?x \<otimes> ?x = \<one>

goal (1 subgoal):
 1. x = inv g \<odot> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = inv g \<odot> x

goal (2 subgoals):
 1. \<And>a. a \<in> stabiliser x \<Longrightarrow> inv a \<in> stabiliser x
 2. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = inv g \<odot> x
[PROOF STEP]
show "inv g \<in> stabiliser x"
[PROOF STATE]
proof (prove)
using this:
x = inv g \<odot> x

goal (1 subgoal):
 1. inv g \<in> stabiliser x
[PROOF STEP]
using invg_car stabiliser_def
[PROOF STATE]
proof (prove)
using this:
x = inv g \<odot> x
inv g \<in> carrier G
stabiliser ?x = {g \<in> carrier G. g \<odot> ?x = ?x}

goal (1 subgoal):
 1. inv g \<in> stabiliser x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inv g \<in> stabiliser x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
fix g h x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
assume g_stab: "g \<in> stabiliser x" and h_stab: "h \<in> stabiliser x"
[PROOF STATE]
proof (state)
this:
g \<in> stabiliser x
h \<in> stabiliser x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<in> stabiliser x
h \<in> stabiliser x
[PROOF STEP]
have g_car: "g \<in> carrier G" and h_car: "h \<in> carrier G"
[PROOF STATE]
proof (prove)
using this:
g \<in> stabiliser x
h \<in> stabiliser x

goal (1 subgoal):
 1. g \<in> carrier G &&& h \<in> carrier G
[PROOF STEP]
using stabiliser_def
[PROOF STATE]
proof (prove)
using this:
g \<in> stabiliser x
h \<in> stabiliser x
stabiliser ?x = {g \<in> carrier G. g \<odot> ?x = ?x}

goal (1 subgoal):
 1. g \<in> carrier G &&& h \<in> carrier G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g \<in> carrier G
h \<in> carrier G

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<in> carrier G
h \<in> carrier G
[PROOF STEP]
have "g \<odot> x = x" "h \<odot> x = x"
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
h \<in> carrier G

goal (1 subgoal):
 1. g \<odot> x = x &&& h \<odot> x = x
[PROOF STEP]
using stabiliser_def g_stab h_stab
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
h \<in> carrier G
stabiliser ?x = {g \<in> carrier G. g \<odot> ?x = ?x}
g \<in> stabiliser x
h \<in> stabiliser x

goal (1 subgoal):
 1. g \<odot> x = x &&& h \<odot> x = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g \<odot> x = x
h \<odot> x = x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<odot> x = x
h \<odot> x = x
[PROOF STEP]
have "g \<odot> (h \<odot> x) = x"
[PROOF STATE]
proof (prove)
using this:
g \<odot> x = x
h \<odot> x = x

goal (1 subgoal):
 1. g \<odot> (h \<odot> x) = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g \<odot> (h \<odot> x) = x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<odot> (h \<odot> x) = x
[PROOF STEP]
have "(g \<otimes> h) \<odot> x = x"
[PROOF STATE]
proof (prove)
using this:
g \<odot> (h \<odot> x) = x

goal (1 subgoal):
 1. g \<otimes> h \<odot> x = x
[PROOF STEP]
using compat_act g_car h_car
[PROOF STATE]
proof (prove)
using this:
g \<odot> (h \<odot> x) = x
?g \<in> carrier G \<and> ?h \<in> carrier G \<longrightarrow> ?g \<odot> (?h \<odot> ?x) = ?g \<otimes> ?h \<odot> ?x
g \<in> carrier G
h \<in> carrier G

goal (1 subgoal):
 1. g \<otimes> h \<odot> x = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g \<otimes> h \<odot> x = x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> stabiliser x; b \<in> stabiliser x\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> stabiliser x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<otimes> h \<odot> x = x
[PROOF STEP]
show "(g \<otimes> h) \<in> stabiliser x"
[PROOF STATE]
proof (prove)
using this:
g \<otimes> h \<odot> x = x

goal (1 subgoal):
 1. g \<otimes> h \<in> stabiliser x
[PROOF STEP]
using g_stab h_stab stabiliser_def
[PROOF STATE]
proof (prove)
using this:
g \<otimes> h \<odot> x = x
g \<in> stabiliser x
h \<in> stabiliser x
stabiliser ?x = {g \<in> carrier G. g \<odot> ?x = ?x}

goal (1 subgoal):
 1. g \<otimes> h \<in> stabiliser x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g \<otimes> h \<in> stabiliser x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma similar_spectrum_eq:
  fixes A::"complex Matrix.mat"
  assumes "A\<in> carrier_mat n n"
  and "similar_mat A B"
  and "upper_triangular B"
  shows "spectrum A = set (diag_mat B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
have "(\<Prod>a\<leftarrow>(eigvals A). [:- a, 1:]) = char_poly A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = char_poly A
[PROOF STEP]
using eigvals_poly_length assms
[PROOF STATE]
proof (prove)
using this:
?M \<in> carrier_mat ?n ?n \<Longrightarrow> char_poly ?M = (\<Prod>a\<leftarrow>eigvals ?M. [:- a, 1:]) \<and> length (eigvals ?M) = dim_row ?M
A \<in> carrier_mat n n
similar_mat A B
upper_triangular B

goal (1 subgoal):
 1. (\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = char_poly A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = char_poly A

goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = char_poly A

goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
have "... = char_poly B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A = char_poly B
[PROOF STEP]
proof (rule char_poly_similar)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. similar_mat A B
[PROOF STEP]
show "similar_mat A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat A B
[PROOF STEP]
using assms real_diag_decompD(1)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
similar_mat A B
upper_triangular B
real_diag_decomp ?A ?B ?U \<Longrightarrow> unitary_diag ?A ?B ?U

goal (1 subgoal):
 1. similar_mat A B
[PROOF STEP]
using similar_mat_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
similar_mat A B
upper_triangular B
real_diag_decomp ?A ?B ?U \<Longrightarrow> unitary_diag ?A ?B ?U
similar_mat ?A ?B = (\<exists>P Q. similar_mat_wit ?A ?B P Q)

goal (1 subgoal):
 1. similar_mat A B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
similar_mat A B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
char_poly A = char_poly B

goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
char_poly A = char_poly B

goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
have "... = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly B = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])
[PROOF STEP]
proof (rule char_poly_upper_triangular)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B \<in> carrier_mat ?n ?n
 2. upper_triangular B
[PROOF STEP]
show "B\<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat n n
[PROOF STEP]
using assms similar_matD
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
similar_mat A B
upper_triangular B
similar_mat ?A ?B \<Longrightarrow> \<exists>n P Q. {?A, ?B, P, Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> ?A = P * ?B * Q

goal (1 subgoal):
 1. B \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat n n

goal (1 subgoal):
 1. upper_triangular B
[PROOF STEP]
thus "upper_triangular B"
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n

goal (1 subgoal):
 1. upper_triangular B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n
A \<in> carrier_mat n n
similar_mat A B
upper_triangular B

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
char_poly B = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])

goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])
[PROOF STEP]
have "(\<Prod>a\<leftarrow>(eigvals A). [:- a, 1:]) = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])

goal (1 subgoal):
 1. (\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])

goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])

goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
using poly_root_set_eq
[PROOF STATE]
proof (prove)
using this:
(\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])
(\<Prod>a\<leftarrow>?L. [:- a, 1::?'a:]) = (\<Prod>a\<leftarrow>?M. [:- a, 1::?'a:]) \<Longrightarrow> set ?L = set ?M

goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
unfolding spectrum_def
[PROOF STATE]
proof (prove)
using this:
(\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) = (\<Prod>a\<leftarrow>diag_mat B. [:- a, 1:])
(\<Prod>a\<leftarrow>?L. [:- a, 1::?'a:]) = (\<Prod>a\<leftarrow>?M. [:- a, 1::?'a:]) \<Longrightarrow> set ?L = set ?M

goal (1 subgoal):
 1. set (eigvals A) = set (diag_mat B)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
spectrum A = set (diag_mat B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Group) genby_set_lconjby_set_lconjby_closed:
  fixes   A :: "'g set"
  defines "S \<equiv> (\<Union>g\<in>G. lconjby g ` A)"
  assumes "g\<in>G"
  shows   "x \<in> \<langle>S\<rangle> \<Longrightarrow> lconjby g x \<in> \<langle>S\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> \<langle>S\<rangle> \<Longrightarrow> lconjby g x \<in> \<langle>S\<rangle>
[PROOF STEP]
proof (erule genby.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. lconjby g (0::'g) \<in> \<langle>S\<rangle>
 2. \<And>s. s \<in> S \<Longrightarrow> lconjby g s \<in> \<langle>S\<rangle>
 3. \<And>w w'. \<lbrakk>w \<in> \<langle>S\<rangle>; lconjby g w \<in> \<langle>S\<rangle>; w' \<in> \<langle>S\<rangle>; lconjby g w' \<in> \<langle>S\<rangle>\<rbrakk> \<Longrightarrow> lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
show "lconjby g 0 \<in> \<langle>S\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lconjby g (0::'g) \<in> \<langle>S\<rangle>
[PROOF STEP]
using genby_0_closed
[PROOF STATE]
proof (prove)
using this:
(0::?'a) \<in> \<langle>?S\<rangle>

goal (1 subgoal):
 1. lconjby g (0::'g) \<in> \<langle>S\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lconjby g (0::'g) \<in> \<langle>S\<rangle>

goal (2 subgoals):
 1. \<And>s. s \<in> S \<Longrightarrow> lconjby g s \<in> \<langle>S\<rangle>
 2. \<And>w w'. \<lbrakk>w \<in> \<langle>S\<rangle>; lconjby g w \<in> \<langle>S\<rangle>; w' \<in> \<langle>S\<rangle>; lconjby g w' \<in> \<langle>S\<rangle>\<rbrakk> \<Longrightarrow> lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
S \<equiv> \<Union>g\<in>G. lconjby g ` A
g \<in> G
[PROOF STEP]
show "\<And>s. s \<in> S \<Longrightarrow> lconjby g s \<in> \<langle>S\<rangle>"
[PROOF STATE]
proof (prove)
using this:
S \<equiv> \<Union>g\<in>G. lconjby g ` A
g \<in> G

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> lconjby g s \<in> \<langle>S\<rangle>
[PROOF STEP]
using add_closed genby_genset_closed[of _ S]
[PROOF STATE]
proof (prove)
using this:
S \<equiv> \<Union>g\<in>G. lconjby g ` A
g \<in> G
\<lbrakk>?g \<in> G; ?h \<in> G\<rbrakk> \<Longrightarrow> ?g + ?h \<in> G
?s \<in> S \<Longrightarrow> ?s \<in> \<langle>S\<rangle>

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> lconjby g s \<in> \<langle>S\<rangle>
[PROOF STEP]
by (force simp add: lconjby_add)
[PROOF STATE]
proof (state)
this:
?s \<in> S \<Longrightarrow> lconjby g ?s \<in> \<langle>S\<rangle>

goal (1 subgoal):
 1. \<And>w w'. \<lbrakk>w \<in> \<langle>S\<rangle>; lconjby g w \<in> \<langle>S\<rangle>; w' \<in> \<langle>S\<rangle>; lconjby g w' \<in> \<langle>S\<rangle>\<rbrakk> \<Longrightarrow> lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w w'. \<lbrakk>w \<in> \<langle>S\<rangle>; lconjby g w \<in> \<langle>S\<rangle>; w' \<in> \<langle>S\<rangle>; lconjby g w' \<in> \<langle>S\<rangle>\<rbrakk> \<Longrightarrow> lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
fix w w'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w w'. \<lbrakk>w \<in> \<langle>S\<rangle>; lconjby g w \<in> \<langle>S\<rangle>; w' \<in> \<langle>S\<rangle>; lconjby g w' \<in> \<langle>S\<rangle>\<rbrakk> \<Longrightarrow> lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
assume ww': "lconjby g w \<in> \<langle>S\<rangle>" "lconjby g w' \<in> \<langle>S\<rangle>"
[PROOF STATE]
proof (state)
this:
lconjby g w \<in> \<langle>S\<rangle>
lconjby g w' \<in> \<langle>S\<rangle>

goal (1 subgoal):
 1. \<And>w w'. \<lbrakk>w \<in> \<langle>S\<rangle>; lconjby g w \<in> \<langle>S\<rangle>; w' \<in> \<langle>S\<rangle>; lconjby g w' \<in> \<langle>S\<rangle>\<rbrakk> \<Longrightarrow> lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
have "lconjby g (w - w') = lconjby g w + lconjby g (-w')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lconjby g (w - w') = lconjby g w + lconjby g (- w')
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
lconjby g (w - w') = lconjby g w + lconjby g (- w')

goal (1 subgoal):
 1. \<And>w w'. \<lbrakk>w \<in> \<langle>S\<rangle>; lconjby g w \<in> \<langle>S\<rangle>; w' \<in> \<langle>S\<rangle>; lconjby g w' \<in> \<langle>S\<rangle>\<rbrakk> \<Longrightarrow> lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
with ww'
[PROOF STATE]
proof (chain)
picking this:
lconjby g w \<in> \<langle>S\<rangle>
lconjby g w' \<in> \<langle>S\<rangle>
lconjby g (w - w') = lconjby g w + lconjby g (- w')
[PROOF STEP]
show "lconjby g (w - w') \<in> \<langle>S\<rangle>"
[PROOF STATE]
proof (prove)
using this:
lconjby g w \<in> \<langle>S\<rangle>
lconjby g w' \<in> \<langle>S\<rangle>
lconjby g (w - w') = lconjby g w + lconjby g (- w')

goal (1 subgoal):
 1. lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
using lconjby_uminus[of g] diff_conv_add_uminus[of _ "lconjby g w'"]
          genby_diff_closed
[PROOF STATE]
proof (prove)
using this:
lconjby g w \<in> \<langle>S\<rangle>
lconjby g w' \<in> \<langle>S\<rangle>
lconjby g (w - w') = lconjby g w + lconjby g (- w')
lconjby g (- ?y) = - lconjby g ?y
?a - lconjby g w' = ?a + - lconjby g w'
\<lbrakk>?w \<in> \<langle>?S\<rangle>; ?w' \<in> \<langle>?S\<rangle>\<rbrakk> \<Longrightarrow> ?w - ?w' \<in> \<langle>?S\<rangle>

goal (1 subgoal):
 1. lconjby g (w - w') \<in> \<langle>S\<rangle>
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
lconjby g (w - w') \<in> \<langle>S\<rangle>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  cross_dot_cancel:
  fixes x::"real^3"
  assumes deq: "x \<bullet> y = x \<bullet> z" and veq: "x \<times> y = x \<times> z" and x: "x \<noteq> 0"
  shows "y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y = z
[PROOF STEP]
have "x \<bullet> x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> x \<noteq> 0
[PROOF STEP]
by (simp add: x)
[PROOF STATE]
proof (state)
this:
x \<bullet> x \<noteq> 0

goal (1 subgoal):
 1. y = z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<bullet> x \<noteq> 0
[PROOF STEP]
have "y - z = 0"
[PROOF STATE]
proof (prove)
using this:
x \<bullet> x \<noteq> 0

goal (1 subgoal):
 1. y - z = 0
[PROOF STEP]
using veq
[PROOF STATE]
proof (prove)
using this:
x \<bullet> x \<noteq> 0
x \<times> y = x \<times> z

goal (1 subgoal):
 1. y - z = 0
[PROOF STEP]
by (metis (no_types, lifting) Cross3.right_diff_distrib Lagrange deq eq_iff_diff_eq_0 inner_diff_right scale_eq_0_iff)
[PROOF STATE]
proof (state)
this:
y - z = 0

goal (1 subgoal):
 1. y = z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y - z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y - z = 0

goal (1 subgoal):
 1. y = z
[PROOF STEP]
using eq_iff_diff_eq_0
[PROOF STATE]
proof (prove)
using this:
y - z = 0
(?a = ?b) = (?a - ?b = (0::?'a))

goal (1 subgoal):
 1. y = z
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y = z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_product_open:
  assumes "open A"
  shows "\<exists>\<U>. \<U> \<subseteq> {S \<times> T |S T. open S \<and> open T} \<and> \<Union> \<U> = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<U>\<subseteq>{S \<times> T |S T. open S \<and> open T}. \<Union> \<U> = A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<U>\<subseteq>{S \<times> T |S T. open S \<and> open T}. \<Union> \<U> = A
[PROOF STEP]
obtain f g where *: "\<And>u. u \<in> A \<Longrightarrow> open (f u) \<and> open (g u) \<and> u \<in> (f u) \<times> (g u) \<and> (f u) \<times> (g u) \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g. (\<And>u. u \<in> A \<Longrightarrow> open (f u) \<and> open (g u) \<and> u \<in> f u \<times> g u \<and> f u \<times> g u \<subseteq> A) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using open_prod_def [of A] assms
[PROOF STATE]
proof (prove)
using this:
open A = (\<forall>x\<in>A. \<exists>Aa B. open Aa \<and> open B \<and> x \<in> Aa \<times> B \<and> Aa \<times> B \<subseteq> A)
open A

goal (1 subgoal):
 1. (\<And>f g. (\<And>u. u \<in> A \<Longrightarrow> open (f u) \<and> open (g u) \<and> u \<in> f u \<times> g u \<and> f u \<times> g u \<subseteq> A) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
?u \<in> A \<Longrightarrow> open (f ?u) \<and> open (g ?u) \<and> ?u \<in> f ?u \<times> g ?u \<and> f ?u \<times> g ?u \<subseteq> A

goal (1 subgoal):
 1. \<exists>\<U>\<subseteq>{S \<times> T |S T. open S \<and> open T}. \<Union> \<U> = A
[PROOF STEP]
let ?\<U> = "(\<lambda>u. f u \<times> g u) ` A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<U>\<subseteq>{S \<times> T |S T. open S \<and> open T}. \<Union> \<U> = A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<U>\<subseteq>{S \<times> T |S T. open S \<and> open T}. \<Union> \<U> = A
[PROOF STEP]
by (rule_tac x="?\<U>" in exI) (auto simp: dest: *)
[PROOF STATE]
proof (state)
this:
\<exists>\<U>\<subseteq>{S \<times> T |S T. open S \<and> open T}. \<Union> \<U> = A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<alpha>_le_card:
  assumes "finite (uverts G)"
  shows "\<alpha> G \<le> card(uverts G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> G \<le> enat (card (uverts G))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<alpha> G \<le> enat (card (uverts G))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<alpha> G \<le> enat (card (uverts G))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<alpha> G \<le> enat (card (uverts G))
[PROOF STEP]
assume "x \<in> independent_sets G"
[PROOF STATE]
proof (state)
this:
x \<in> independent_sets G

goal (1 subgoal):
 1. \<alpha> G \<le> enat (card (uverts G))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> independent_sets G
[PROOF STEP]
have "x \<subseteq> uverts G"
[PROOF STATE]
proof (prove)
using this:
x \<in> independent_sets G

goal (1 subgoal):
 1. x \<subseteq> uverts G
[PROOF STEP]
by (auto simp: independent_sets_def)
[PROOF STATE]
proof (state)
this:
x \<subseteq> uverts G

goal (1 subgoal):
 1. \<alpha> G \<le> enat (card (uverts G))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> independent_sets G \<Longrightarrow> ?x2 \<subseteq> uverts G

goal (1 subgoal):
 1. \<alpha> G \<le> enat (card (uverts G))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite (uverts G)
?x2 \<in> independent_sets G \<Longrightarrow> ?x2 \<subseteq> uverts G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (uverts G)
?x2 \<in> independent_sets G \<Longrightarrow> ?x2 \<subseteq> uverts G

goal (1 subgoal):
 1. \<alpha> G \<le> enat (card (uverts G))
[PROOF STEP]
unfolding \<alpha>_def
[PROOF STATE]
proof (prove)
using this:
finite (uverts G)
?x2 \<in> independent_sets G \<Longrightarrow> ?x2 \<subseteq> uverts G

goal (1 subgoal):
 1. (SUP vs\<in>independent_sets G. enat (card vs)) \<le> enat (card (uverts G))
[PROOF STEP]
by (intro SUP_least) (auto intro: card_mono)
[PROOF STATE]
proof (state)
this:
\<alpha> G \<le> enat (card (uverts G))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NNF_ternary_correct: "ternary_ternary_eval (NNF_ternary t) = ternary_ternary_eval t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ternary_ternary_eval (NNF_ternary t) = ternary_ternary_eval t
[PROOF STEP]
proof(induction t rule: NNF_ternary.induct)
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. \<And>v. ternary_ternary_eval (NNF_ternary (TernaryValue v)) = ternary_ternary_eval (TernaryValue v)
 2. \<And>t1 t2. \<lbrakk>ternary_ternary_eval (NNF_ternary t1) = ternary_ternary_eval t1; ternary_ternary_eval (NNF_ternary t2) = ternary_ternary_eval t2\<rbrakk> \<Longrightarrow> ternary_ternary_eval (NNF_ternary (TernaryAnd t1 t2)) = ternary_ternary_eval (TernaryAnd t1 t2)
 3. \<And>t1 t2. \<lbrakk>ternary_ternary_eval (NNF_ternary t1) = ternary_ternary_eval t1; ternary_ternary_eval (NNF_ternary t2) = ternary_ternary_eval t2\<rbrakk> \<Longrightarrow> ternary_ternary_eval (NNF_ternary (TernaryOr t1 t2)) = ternary_ternary_eval (TernaryOr t1 t2)
 4. \<And>t. ternary_ternary_eval (NNF_ternary t) = ternary_ternary_eval t \<Longrightarrow> ternary_ternary_eval (NNF_ternary (TernaryNot (TernaryNot t))) = ternary_ternary_eval (TernaryNot (TernaryNot t))
 5. \<And>v. ternary_ternary_eval (NNF_ternary (TernaryNot (TernaryValue v))) = ternary_ternary_eval (TernaryNot (TernaryValue v))
 6. \<And>t1 t2. \<lbrakk>ternary_ternary_eval (NNF_ternary (TernaryNot t1)) = ternary_ternary_eval (TernaryNot t1); ternary_ternary_eval (NNF_ternary (TernaryNot t2)) = ternary_ternary_eval (TernaryNot t2)\<rbrakk> \<Longrightarrow> ternary_ternary_eval (NNF_ternary (TernaryNot (TernaryAnd t1 t2))) = ternary_ternary_eval (TernaryNot (TernaryAnd t1 t2))
 7. \<And>t1 t2. \<lbrakk>ternary_ternary_eval (NNF_ternary (TernaryNot t1)) = ternary_ternary_eval (TernaryNot t1); ternary_ternary_eval (NNF_ternary (TernaryNot t2)) = ternary_ternary_eval (TernaryNot t2)\<rbrakk> \<Longrightarrow> ternary_ternary_eval (NNF_ternary (TernaryNot (TernaryOr t1 t2))) = ternary_ternary_eval (TernaryNot (TernaryOr t1 t2))
[PROOF STEP]
qed(simp_all add: eval_ternary_DeMorgan eval_ternary_idempotence_Not)


[STATEMENT]
lemma lt_row_to_poly_pivot_fun_less:
  assumes "card S = dim_col (A::'b::semiring_1 mat)" and "pivot_fun A f (dim_col A)"
    and "i1 < i2" and "i2 < dim_row A" and "f i1 < dim_col A" and "f i2 < dim_col A"
  shows "(pps_to_list S) ! (f i2) \<prec>\<^sub>t (pps_to_list S) ! (f i1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pps_to_list S ! f i2 \<prec>\<^sub>t pps_to_list S ! f i1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pps_to_list S ! f i2 \<prec>\<^sub>t pps_to_list S ! f i1
[PROOF STEP]
let ?ts = "pps_to_list S"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pps_to_list S ! f i2 \<prec>\<^sub>t pps_to_list S ! f i1
[PROOF STEP]
have len_ts: "length ?ts = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (pps_to_list S) = dim_col A
[PROOF STEP]
by (simp add: length_pps_to_list assms(1))
[PROOF STATE]
proof (state)
this:
length (pps_to_list S) = dim_col A

goal (1 subgoal):
 1. pps_to_list S ! f i2 \<prec>\<^sub>t pps_to_list S ! f i1
[PROOF STEP]
from assms(3) assms(4)
[PROOF STATE]
proof (chain)
picking this:
i1 < i2
i2 < dim_row A
[PROOF STEP]
have "i1 < dim_row A"
[PROOF STATE]
proof (prove)
using this:
i1 < i2
i2 < dim_row A

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

goal (1 subgoal):
 1. pps_to_list S ! f i2 \<prec>\<^sub>t pps_to_list S ! f i1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pps_to_list S ! f i2 \<prec>\<^sub>t pps_to_list S ! f i1
[PROOF STEP]
by (rule pps_to_list_nth_lessI, rule pivot_fun_mono_strict[where ?f=f], fact, fact, fact, fact,
        simp only: assms(1) assms(6))
[PROOF STATE]
proof (state)
this:
pps_to_list S ! f i2 \<prec>\<^sub>t pps_to_list S ! f i1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma if_SE_split : " (\<sigma> \<Turnstile> if\<^sub>S\<^sub>E P B\<^sub>1 B\<^sub>2) = ((P \<sigma> \<longrightarrow> (\<sigma> \<Turnstile> B\<^sub>1)) \<and> (\<not> P \<sigma> \<longrightarrow> (\<sigma> \<Turnstile> B\<^sub>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<sigma> \<Turnstile> if\<^sub>S\<^sub>E P B\<^sub>1 B\<^sub>2) = ((P \<sigma> \<longrightarrow> (\<sigma> \<Turnstile> B\<^sub>1)) \<and> (\<not> P \<sigma> \<longrightarrow> (\<sigma> \<Turnstile> B\<^sub>2)))
[PROOF STEP]
by(cases "P \<sigma>", auto simp: if_SE_D1 if_SE_D2)


[STATEMENT]
lemma ground_fmla_Fvars: "ground_fmla A \<longleftrightarrow> Fvars A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ground_fmla A = (Fvars A = {})
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ground_fmla A \<Longrightarrow> Fvars A = {}
 2. Fvars A = {} \<Longrightarrow> ground_fmla A
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ground_fmla A \<Longrightarrow> Fvars A = {}
[PROOF STEP]
by (auto simp only: Fvars_def ground_fresh)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fvars A = {} \<Longrightarrow> ground_fmla A
[PROOF STEP]
by (auto intro: Fvars_ground_fmla_aux[of A "{}", simplified])


[STATEMENT]
theorem perfect_number_theorem:
  assumes even: "even m" and perfect: "perfect m"
  shows "\<exists> n . m = 2^n*(2^(n+1) - 1) \<and> prime ((2::nat)^(n+1) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. m = 2 ^ n * (2 ^ (n + 1) - 1) \<and> prime (2 ^ (n + 1) - 1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
from perfect
[PROOF STATE]
proof (chain)
picking this:
perfect m
[PROOF STEP]
have m0: "m>0"
[PROOF STATE]
proof (prove)
using this:
perfect m

goal (1 subgoal):
 1. 0 < m
[PROOF STEP]
by (auto simp add: perfect_def)
[PROOF STATE]
proof (state)
this:
0 < m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
let ?n = "multiplicity 2 m"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
let ?A = "m div 2^?n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
let ?np = "(2::nat)^(?n+1) - 1"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
from even m0
[PROOF STATE]
proof (chain)
picking this:
even m
0 < m
[PROOF STEP]
have n1: "?n >= 1 "
[PROOF STATE]
proof (prove)
using this:
even m
0 < m

goal (1 subgoal):
 1. 1 \<le> multiplicity 2 m
[PROOF STEP]
by (simp add: multiplicity_geI)
[PROOF STATE]
proof (state)
this:
1 \<le> multiplicity 2 m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
have  "2^?n dvd m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ multiplicity 2 m dvd m
[PROOF STEP]
by (rule multiplicity_dvd)
[PROOF STATE]
proof (state)
this:
2 ^ multiplicity 2 m dvd m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
hence "m = 2^?n*?A"
[PROOF STATE]
proof (prove)
using this:
2 ^ multiplicity 2 m dvd m

goal (1 subgoal):
 1. m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by (simp only: dvd_mult_div_cancel)
[PROOF STATE]
proof (state)
this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with m0
[PROOF STATE]
proof (chain)
picking this:
0 < m
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have mdef: "m=2^?n*?A \<and> coprime 2 ?A"
[PROOF STATE]
proof (prove)
using this:
0 < m
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
using multiplicity_decompose [of m 2]
[PROOF STATE]
proof (prove)
using this:
0 < m
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m)
\<lbrakk>m \<noteq> 0; \<not> is_unit 2\<rbrakk> \<Longrightarrow> odd (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with m0
[PROOF STATE]
proof (chain)
picking this:
0 < m
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have a0: "?A>0"
[PROOF STATE]
proof (prove)
using this:
0 < m
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. 0 < m div 2 ^ multiplicity 2 m
[PROOF STEP]
by (metis nat_0_less_mult_iff)
[PROOF STATE]
proof (state)
this:
0 < m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
0 < m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
from perfect
[PROOF STATE]
proof (chain)
picking this:
perfect m
[PROOF STEP]
have "2*m=sigma(m)"
[PROOF STATE]
proof (prove)
using this:
perfect m

goal (1 subgoal):
 1. 2 * m = sigma m
[PROOF STEP]
by (simp add: perfect_def)
[PROOF STATE]
proof (state)
this:
2 * m = sigma m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with mdef
[PROOF STATE]
proof (chain)
picking this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
2 * m = sigma m
[PROOF STEP]
have "2^(?n+1)*?A=sigma(2^?n*?A)"
[PROOF STATE]
proof (prove)
using this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
2 * m = sigma m

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = sigma (2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = sigma (2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m))

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = sigma (2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m))

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
0 < m div 2 ^ multiplicity 2 m
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = sigma (2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m))
[PROOF STEP]
have "2^(?n+1)*?A=sigma(2^?n)*sigma(?A)"
[PROOF STATE]
proof (prove)
using this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
0 < m div 2 ^ multiplicity 2 m
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = sigma (2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m))

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = sigma (2 ^ multiplicity 2 m) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by (simp add: sigma_semimultiplicative)
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = sigma (2 ^ multiplicity 2 m) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
hence formula: "2^(?n+1)*?A=(?np)*sigma(?A)"
[PROOF STATE]
proof (prove)
using this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = sigma (2 ^ multiplicity 2 m) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by (simp only: sigma_prime_power_two)
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
from n1
[PROOF STATE]
proof (chain)
picking this:
1 \<le> multiplicity 2 m
[PROOF STEP]
have "(2::nat)^(?n+1) >= 2^2"
[PROOF STATE]
proof (prove)
using this:
1 \<le> multiplicity 2 m

goal (1 subgoal):
 1. 2\<^sup>2 \<le> 2 ^ (multiplicity 2 m + 1)
[PROOF STEP]
by (simp only: power_increasing)
[PROOF STATE]
proof (state)
this:
2\<^sup>2 \<le> 2 ^ (multiplicity 2 m + 1)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
hence nplarger: "?np>= 3"
[PROOF STATE]
proof (prove)
using this:
2\<^sup>2 \<le> 2 ^ (multiplicity 2 m + 1)

goal (1 subgoal):
 1. 3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
let ?B = "?A div ?np"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
from formula
[PROOF STATE]
proof (chain)
picking this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have "?np dvd ?A * 2^(?n+1)"
[PROOF STATE]
proof (prove)
using this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m * 2 ^ (multiplicity 2 m + 1)
[PROOF STEP]
by (auto simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m * 2 ^ (multiplicity 2 m + 1)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m * 2 ^ (multiplicity 2 m + 1)
[PROOF STEP]
have "?np dvd ?A"
[PROOF STATE]
proof (prove)
using this:
2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m * 2 ^ (multiplicity 2 m + 1)

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m
[PROOF STEP]
using coprime_diff_one_left_nat [of "2 ^ (multiplicity 2 m + 1)"]
[PROOF STATE]
proof (prove)
using this:
2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m * 2 ^ (multiplicity 2 m + 1)
0 < 2 ^ (multiplicity 2 m + 1) \<Longrightarrow> coprime (2 ^ (multiplicity 2 m + 1) - 1) (2 ^ (multiplicity 2 m + 1))

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m
[PROOF STEP]
by (auto simp add: coprime_dvd_mult_left_iff)
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m
[PROOF STEP]
have bdef: "?np*?B = ?A"
[PROOF STATE]
proof (prove)
using this:
2 ^ (multiplicity 2 m + 1) - 1 dvd m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. (2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with a0
[PROOF STATE]
proof (chain)
picking this:
0 < m div 2 ^ multiplicity 2 m
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m
[PROOF STEP]
have  b0: "?B>0"
[PROOF STATE]
proof (prove)
using this:
0 < m div 2 ^ multiplicity 2 m
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. 0 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)
[PROOF STEP]
by (metis gr0I mult_is_0)
[PROOF STATE]
proof (state)
this:
0 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
from nplarger a0
[PROOF STATE]
proof (chain)
picking this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
0 < m div 2 ^ multiplicity 2 m
[PROOF STEP]
have bsmallera: "?B < ?A"
[PROOF STATE]
proof (prove)
using this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
0 < m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
have "?B = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) = 1
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
assume "?B \<noteq> 1"
[PROOF STATE]
proof (state)
this:
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
with b0 bsmallera
[PROOF STATE]
proof (chain)
picking this:
0 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1
[PROOF STEP]
have "1<?B" "?B<?A"
[PROOF STATE]
proof (prove)
using this:
0 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1

goal (1 subgoal):
 1. 1 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) &&& m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
from bdef
[PROOF STATE]
proof (chain)
picking this:
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m
[PROOF STEP]
have "?B : divisors ?A"
[PROOF STATE]
proof (prove)
using this:
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<in> divisors (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by (metis divisors_eq_dvd dvd_triv_right)
[PROOF STATE]
proof (state)
this:
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<in> divisors (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<in> divisors (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have "1+?B+?A \<le> sigma ?A"
[PROOF STATE]
proof (prove)
using this:
1 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<in> divisors (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. 1 + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) + m div 2 ^ multiplicity 2 m \<le> sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
using sigma_third_divisor
[PROOF STATE]
proof (prove)
using this:
1 < m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) < m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<in> divisors (m div 2 ^ multiplicity 2 m)
\<lbrakk>1 < ?a; ?a < ?n; ?a dvd ?n\<rbrakk> \<Longrightarrow> 1 + ?a + ?n \<le> sigma ?n

goal (1 subgoal):
 1. 1 + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) + m div 2 ^ multiplicity 2 m \<le> sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
1 + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) + m div 2 ^ multiplicity 2 m \<le> sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
with nplarger
[PROOF STATE]
proof (chain)
picking this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
1 + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) + m div 2 ^ multiplicity 2 m \<le> sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have "?np*(1+?A+?B) \<le> ?np*(sigma ?A)"
[PROOF STATE]
proof (prove)
using this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
1 + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) + m div 2 ^ multiplicity 2 m \<le> sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. (2 ^ (multiplicity 2 m + 1) - 1) * (1 + m div 2 ^ multiplicity 2 m + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by (auto simp only: nat_mult_le_cancel1)
[PROOF STATE]
proof (state)
this:
(2 ^ (multiplicity 2 m + 1) - 1) * (1 + m div 2 ^ multiplicity 2 m + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
with bdef
[PROOF STATE]
proof (chain)
picking this:
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m
(2 ^ (multiplicity 2 m + 1) - 1) * (1 + m div 2 ^ multiplicity 2 m + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have "?np+?A*?np + ?A*1 \<le> ?np*(sigma ?A)"
[PROOF STATE]
proof (prove)
using this:
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m
(2 ^ (multiplicity 2 m + 1) - 1) * (1 + m div 2 ^ multiplicity 2 m + m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) - 1 + m div 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1) + m div 2 ^ multiplicity 2 m * 1 \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by (simp add: mult.commute distrib_left)
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) - 1 + m div 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1) + m div 2 ^ multiplicity 2 m * 1 \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
hence "?np+?A*(?np + 1) \<le> ?np*(sigma ?A)"
[PROOF STATE]
proof (prove)
using this:
2 ^ (multiplicity 2 m + 1) - 1 + m div 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1) + m div 2 ^ multiplicity 2 m * 1 \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) - 1 + m div 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1 + 1) \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by (simp only:add_mult_distrib2)
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) - 1 + m div 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1 + 1) \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
with nplarger
[PROOF STATE]
proof (chain)
picking this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
2 ^ (multiplicity 2 m + 1) - 1 + m div 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1 + 1) \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have "2^(?n+1)*?A < ?np*(sigma ?A)"
[PROOF STATE]
proof (prove)
using this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
2 ^ (multiplicity 2 m + 1) - 1 + m div 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1 + 1) \<le> (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. 2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) < (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by(simp add:mult.commute)
[PROOF STATE]
proof (state)
this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) < (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) \<noteq> 1 \<Longrightarrow> False
[PROOF STEP]
with formula
[PROOF STATE]
proof (chain)
picking this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) < (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) < (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) = 1

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with bdef
[PROOF STATE]
proof (chain)
picking this:
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) = 1
[PROOF STEP]
have adef: "?A=?np"
[PROOF STATE]
proof (prove)
using this:
(2 ^ (multiplicity 2 m + 1) - 1) * (m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1)) = m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m div (2 ^ (multiplicity 2 m + 1) - 1) = 1

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m = 2 ^ (multiplicity 2 m + 1) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m div 2 ^ multiplicity 2 m = 2 ^ (multiplicity 2 m + 1) - 1

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with formula
[PROOF STATE]
proof (chain)
picking this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
m div 2 ^ multiplicity 2 m = 2 ^ (multiplicity 2 m + 1) - 1
[PROOF STEP]
have "?np*2^(?n+1) = ?np * sigma(?A)"
[PROOF STATE]
proof (prove)
using this:
2 ^ (multiplicity 2 m + 1) * (m div 2 ^ multiplicity 2 m) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
m div 2 ^ multiplicity 2 m = 2 ^ (multiplicity 2 m + 1) - 1

goal (1 subgoal):
 1. (2 ^ (multiplicity 2 m + 1) - 1) * 2 ^ (multiplicity 2 m + 1) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(2 ^ (multiplicity 2 m + 1) - 1) * 2 ^ (multiplicity 2 m + 1) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with nplarger adef
[PROOF STATE]
proof (chain)
picking this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
m div 2 ^ multiplicity 2 m = 2 ^ (multiplicity 2 m + 1) - 1
(2 ^ (multiplicity 2 m + 1) - 1) * 2 ^ (multiplicity 2 m + 1) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have "?A + 1=sigma(?A)"
[PROOF STATE]
proof (prove)
using this:
3 \<le> 2 ^ (multiplicity 2 m + 1) - 1
m div 2 ^ multiplicity 2 m = 2 ^ (multiplicity 2 m + 1) - 1
(2 ^ (multiplicity 2 m + 1) - 1) * 2 ^ (multiplicity 2 m + 1) = (2 ^ (multiplicity 2 m + 1) - 1) * sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m div 2 ^ multiplicity 2 m + 1 = sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m div 2 ^ multiplicity 2 m + 1 = sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with a0
[PROOF STATE]
proof (chain)
picking this:
0 < m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m + 1 = sigma (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
have "prime ?A"
[PROOF STATE]
proof (prove)
using this:
0 < m div 2 ^ multiplicity 2 m
m div 2 ^ multiplicity 2 m + 1 = sigma (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. prime (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
by (simp add: prime_iff_sigma)
[PROOF STATE]
proof (state)
this:
prime (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ ?n * (2 ^ (?n + 1) - 1) \<and> prime (2 ^ (?n + 1) - 1)
[PROOF STEP]
with mdef adef
[PROOF STATE]
proof (chain)
picking this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
m div 2 ^ multiplicity 2 m = 2 ^ (multiplicity 2 m + 1) - 1
prime (m div 2 ^ multiplicity 2 m)
[PROOF STEP]
show "m = 2^?n * ?np \<and> prime ?np"
[PROOF STATE]
proof (prove)
using this:
m = 2 ^ multiplicity 2 m * (m div 2 ^ multiplicity 2 m) \<and> coprime 2 (m div 2 ^ multiplicity 2 m)
m div 2 ^ multiplicity 2 m = 2 ^ (multiplicity 2 m + 1) - 1
prime (m div 2 ^ multiplicity 2 m)

goal (1 subgoal):
 1. m = 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1) \<and> prime (2 ^ (multiplicity 2 m + 1) - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m = 2 ^ multiplicity 2 m * (2 ^ (multiplicity 2 m + 1) - 1) \<and> prime (2 ^ (multiplicity 2 m + 1) - 1)

goal:
No subgoals!
[PROOF STEP]
qed