[STATEMENT]
lemma Riemann_lebesgue_sin:
  assumes "f absolutely_integrable_on {-pi..pi}"
  shows "(\<lambda>n. integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. sin(real n * x) * f x)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) \<longlonglongrightarrow> 0
[PROOF STEP]
unfolding lim_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) 0 < r
[PROOF STEP]
proof (intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) 0 < r
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) 0 < r
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) 0 < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
obtain N where N: "\<And>n. n \<ge> N \<Longrightarrow> \<bar>Fourier_coefficient f n\<bar> < e/4"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> \<bar>Fourier_coefficient f n\<bar> < e / 4) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Riemann_lebesgue [OF assms]
[PROOF STATE]
proof (prove)
using this:
0 < e
Fourier_coefficient f \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> \<bar>Fourier_coefficient f n\<bar> < e / 4) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lim_sequentially
[PROOF STATE]
proof (prove)
using this:
0 < e
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (Fourier_coefficient f n) 0 < r

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> \<bar>Fourier_coefficient f n\<bar> < e / 4) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis norm_conv_dist real_norm_def zero_less_divide_iff zero_less_numeral)
[PROOF STATE]
proof (state)
this:
N \<le> ?n \<Longrightarrow> \<bar>Fourier_coefficient f ?n\<bar> < e / 4

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) 0 < r
[PROOF STEP]
have "\<bar>LINT x|lebesgue_on {-pi..pi}. sin (real n * x) * f x\<bar> < e" if "n > N" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
N < n

goal (1 subgoal):
 1. \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. N < 0 \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real 0 * x) * f x\<bar> < e
 2. \<And>n. \<lbrakk>N < n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e; N < Suc n\<rbrakk> \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real (Suc n) * x) * f x\<bar> < e
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
N < n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e
N < Suc n

goal (2 subgoals):
 1. N < 0 \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real 0 * x) * f x\<bar> < e
 2. \<And>n. \<lbrakk>N < n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e; N < Suc n\<rbrakk> \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real (Suc n) * x) * f x\<bar> < e
[PROOF STEP]
have "\<bar>Fourier_coefficient f(Suc (2 * n))\<bar> < e/4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Fourier_coefficient f (Suc (2 * n))\<bar> < e / 4
[PROOF STEP]
using N Suc.prems
[PROOF STATE]
proof (prove)
using this:
N \<le> ?n \<Longrightarrow> \<bar>Fourier_coefficient f ?n\<bar> < e / 4
N < Suc n

goal (1 subgoal):
 1. \<bar>Fourier_coefficient f (Suc (2 * n))\<bar> < e / 4
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>Fourier_coefficient f (Suc (2 * n))\<bar> < e / 4

goal (2 subgoals):
 1. N < 0 \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real 0 * x) * f x\<bar> < e
 2. \<And>n. \<lbrakk>N < n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e; N < Suc n\<rbrakk> \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real (Suc n) * x) * f x\<bar> < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>Fourier_coefficient f (Suc (2 * n))\<bar> < e / 4
[PROOF STEP]
have "\<bar>LINT x|lebesgue_on {-pi..pi}. sin ((1 + real n) * x) * f x\<bar> < sqrt pi * e / 4"
[PROOF STATE]
proof (prove)
using this:
\<bar>Fourier_coefficient f (Suc (2 * n))\<bar> < e / 4

goal (1 subgoal):
 1. \<bar>LINT x|lebesgue_on {- pi..pi}. sin ((1 + real n) * x) * f x\<bar> < sqrt pi * e / 4
[PROOF STEP]
by (simp add: Fourier_coefficient_def orthonormal_coeff_def
          trigonometric_set_def l2product_def field_simps)
[PROOF STATE]
proof (state)
this:
\<bar>LINT x|lebesgue_on {- pi..pi}. sin ((1 + real n) * x) * f x\<bar> < sqrt pi * e / 4

goal (2 subgoals):
 1. N < 0 \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real 0 * x) * f x\<bar> < e
 2. \<And>n. \<lbrakk>N < n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e; N < Suc n\<rbrakk> \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real (Suc n) * x) * f x\<bar> < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>LINT x|lebesgue_on {- pi..pi}. sin ((1 + real n) * x) * f x\<bar> < sqrt pi * e / 4

goal (2 subgoals):
 1. N < 0 \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real 0 * x) * f x\<bar> < e
 2. \<And>n. \<lbrakk>N < n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e; N < Suc n\<rbrakk> \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real (Suc n) * x) * f x\<bar> < e
[PROOF STEP]
have "\<dots> \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt pi * e / 4 \<le> e
[PROOF STEP]
using \<open>0 < e\<close> pi_less_4 real_sqrt_less_mono
[PROOF STATE]
proof (prove)
using this:
0 < e
pi < 4
?x < ?y \<Longrightarrow> sqrt ?x < sqrt ?y

goal (1 subgoal):
 1. sqrt pi * e / 4 \<le> e
[PROOF STEP]
by (fastforce simp add: field_simps)
[PROOF STATE]
proof (state)
this:
sqrt pi * e / 4 \<le> e

goal (2 subgoals):
 1. N < 0 \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real 0 * x) * f x\<bar> < e
 2. \<And>n. \<lbrakk>N < n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x\<bar> < e; N < Suc n\<rbrakk> \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real (Suc n) * x) * f x\<bar> < e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>LINT x|lebesgue_on {- pi..pi}. sin ((1 + real n) * x) * f x\<bar> < e
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<bar>LINT x|lebesgue_on {- pi..pi}. sin ((1 + real n) * x) * f x\<bar> < e

goal (1 subgoal):
 1. \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real (Suc n) * x) * f x\<bar> < e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>LINT x|lebesgue_on {- pi..pi}. sin (real (Suc n) * x) * f x\<bar> < e

goal (1 subgoal):
 1. N < 0 \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real 0 * x) * f x\<bar> < e
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
N < ?n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real ?n * x) * f x\<bar> < e

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) 0 < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N < ?n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real ?n * x) * f x\<bar> < e
[PROOF STEP]
show "\<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {-pi..pi}. sin (real n * x) * f x) 0 < e"
[PROOF STATE]
proof (prove)
using this:
N < ?n \<Longrightarrow> \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real ?n * x) * f x\<bar> < e

goal (1 subgoal):
 1. \<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) 0 < e
[PROOF STEP]
by (metis (full_types) le_neq_implies_less less_add_same_cancel2 less_trans norm_conv_dist real_norm_def zero_less_one)
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>n\<ge>no. dist (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * f x) 0 < e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennreal_lessI: "0 < q \<Longrightarrow> r < q \<Longrightarrow> ennreal r < ennreal q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < q; r < q\<rbrakk> \<Longrightarrow> ennreal r < ennreal q
[PROOF STEP]
by (cases "0 \<le> r") (auto simp: ennreal_less_iff ennreal_neg)


[STATEMENT]
lemma finite_real_of_nat_segment: "finite {n::nat. real n < real (m::nat)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {n. real n < real m}
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_Sup_prod:
  "Sup (A :: ('a::finite_lattice_complete \<times> 'b::finite_lattice_complete) set) =
    Finite_Set.fold sup bot A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup A = Finite_Set.fold sup bot A
[PROOF STEP]
by (metis Sup_fold_sup finite)


[STATEMENT]
lemma register_tensor_is_register:
  fixes F :: "'a::type update \<Rightarrow> 'b::type update" and G :: "'c::type update \<Rightarrow> 'd::type update"
  shows "register F \<Longrightarrow> register G \<Longrightarrow> register (F \<otimes>\<^sub>r G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (F \<otimes>\<^sub>r G)
[PROOF STEP]
unfolding register_tensor_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>a. F a \<otimes>\<^sub>u Some;\<lambda>b. Some \<otimes>\<^sub>u G b)
[PROOF STEP]
apply (rule register_pair_is_register)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>a. F a \<otimes>\<^sub>u Some)
 2. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>b. Some \<otimes>\<^sub>u G b)
 3. \<And>a b. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> F a \<otimes>\<^sub>u Some *\<^sub>u Some \<otimes>\<^sub>u G b = Some \<otimes>\<^sub>u G b *\<^sub>u F a \<otimes>\<^sub>u Some
[PROOF STEP]
by (simp_all add: tensor_update_mult)


[STATEMENT]
lemma len_mult2[simp]: "len (2 * x) = (if x = 0 then 0 else Suc (len x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. len (2 * x) = (if x = 0 then 0 else Suc (len x))
[PROOF STEP]
proof (induct x rule: len.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. len (2 * 0) = (if 0 = 0 then 0 else Suc (len 0))
 2. len (2 * Suc 0) = (if Suc 0 = 0 then 0 else Suc (len (Suc 0)))
 3. \<And>va. len (2 * (Suc (Suc va) div 2)) = (if Suc (Suc va) div 2 = 0 then 0 else Suc (len (Suc (Suc va) div 2))) \<Longrightarrow> len (2 * Suc (Suc va)) = (if Suc (Suc va) = 0 then 0 else Suc (len (Suc (Suc va))))
[PROOF STEP]
show "len (2 * Suc 0) = (if Suc 0 = 0 then 0 else Suc (len (Suc 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. len (2 * Suc 0) = (if Suc 0 = 0 then 0 else Suc (len (Suc 0)))
[PROOF STEP]
by (simp add: numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
len (2 * Suc 0) = (if Suc 0 = 0 then 0 else Suc (len (Suc 0)))

goal (2 subgoals):
 1. len (2 * 0) = (if 0 = 0 then 0 else Suc (len 0))
 2. \<And>va. len (2 * (Suc (Suc va) div 2)) = (if Suc (Suc va) div 2 = 0 then 0 else Suc (len (Suc (Suc va) div 2))) \<Longrightarrow> len (2 * Suc (Suc va)) = (if Suc (Suc va) = 0 then 0 else Suc (len (Suc (Suc va))))
[PROOF STEP]
qed auto


[STATEMENT]
lemma tendsto_diff_smallo_iff:
  shows "f2 \<in> o[F](f1) \<Longrightarrow> (f1 \<longlongrightarrow> a) F \<longleftrightarrow> ((\<lambda>x. f1 x - f2 x) \<longlongrightarrow> a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f2 \<in> o[F](f1) \<Longrightarrow> (f1 \<longlongrightarrow> a) F = ((\<lambda>x. f1 x - f2 x) \<longlongrightarrow> a) F
[PROOF STEP]
using tendsto_add_smallo_iff[of "\<lambda>x. -f2 x" F f1 a]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. - f2 x) \<in> o[F](f1) \<Longrightarrow> (f1 \<longlongrightarrow> a) F = ((\<lambda>x. f1 x + - f2 x) \<longlongrightarrow> a) F

goal (1 subgoal):
 1. f2 \<in> o[F](f1) \<Longrightarrow> (f1 \<longlongrightarrow> a) F = ((\<lambda>x. f1 x - f2 x) \<longlongrightarrow> a) F
[PROOF STEP]
by simp


[STATEMENT]
lemma %invisible mwc_sarpI:
  assumes "\<And>Xs. \<lbrakk>length Xs > 1; distinct (map f Xs); \<forall>i. f (Xs!%i) \<subset> Xs!%i \<inter> Xs!%(i+1)\<rbrakk> \<Longrightarrow> False"
  shows "mwc_sarp f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mwc_sarp f
[PROOF STEP]
unfolding mwc_sarp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>Xs. 1 < length Xs \<and> distinct (map f Xs) \<and> (\<forall>i. f (Xs !% i) \<subset> Xs !% i \<inter> Xs !% (i + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < length ?Xs; distinct (map f ?Xs); \<forall>i. f (?Xs !% i) \<subset> ?Xs !% i \<inter> ?Xs !% (i + 1)\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. \<nexists>Xs. 1 < length Xs \<and> distinct (map f Xs) \<and> (\<forall>i. f (Xs !% i) \<subset> Xs !% i \<inter> Xs !% (i + 1))
[PROOF STEP]
by blast


[STATEMENT]
theorem converse_lehmer:
 assumes prime_p:"prime(p)"
 shows "\<exists> a . [a^(p - 1) = 1] (mod p) \<and>
              (\<forall> q. q \<in> prime_factors (p - 1) \<longrightarrow> [a^((p - 1) div q) \<noteq> 1] (mod p))
              \<and> a > 0 \<and> a < p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
have "p \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> p
[PROOF STEP]
by (rule prime_ge_2_nat[OF prime_p])
[PROOF STATE]
proof (state)
this:
2 \<le> p

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
obtain a where a:"[a^(p - 1) = 1] (mod p) \<and> (\<forall> x . 0 < x \<longrightarrow> x \<le> p - 2 \<longrightarrow> [a^x \<noteq> 1] (mod p))
                    \<and> a > 0 \<and> a < p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>x>0. x \<le> p - 2 \<longrightarrow> [a ^ x \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using converse_lehmer_weak[OF prime_p]
[PROOF STATE]
proof (prove)
using this:
\<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>x>0. x \<le> p - 2 \<longrightarrow> [a ^ x \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p

goal (1 subgoal):
 1. (\<And>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>x>0. x \<le> p - 2 \<longrightarrow> [a ^ x \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[a ^ (p - 1) = 1] (mod p) \<and> (\<forall>x>0. x \<le> p - 2 \<longrightarrow> [a ^ x \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
[a ^ (p - 1) = 1] (mod p) \<and> (\<forall>x>0. x \<le> p - 2 \<longrightarrow> [a ^ x \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
fix q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
assume q:"q \<in> prime_factors (p - 1)"
[PROOF STATE]
proof (state)
this:
q \<in># prime_factorization (p - 1)

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
hence "0 < q \<and> q \<le> p - 1"
[PROOF STATE]
proof (prove)
using this:
q \<in># prime_factorization (p - 1)

goal (1 subgoal):
 1. 0 < q \<and> q \<le> p - 1
[PROOF STEP]
using \<open>p\<ge>2\<close>
[PROOF STATE]
proof (prove)
using this:
q \<in># prime_factorization (p - 1)
2 \<le> p

goal (1 subgoal):
 1. 0 < q \<and> q \<le> p - 1
[PROOF STEP]
by (auto simp add: dvd_nat_bounds prime_factors_gt_0_nat)
[PROOF STATE]
proof (state)
this:
0 < q \<and> q \<le> p - 1

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
hence "(p - 1) div q \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
0 < q \<and> q \<le> p - 1

goal (1 subgoal):
 1. 1 \<le> (p - 1) div q
[PROOF STEP]
using div_le_mono[of "q" "p - 1" q] div_self[of q]
[PROOF STATE]
proof (prove)
using this:
0 < q \<and> q \<le> p - 1
q \<le> p - 1 \<Longrightarrow> q div q \<le> (p - 1) div q
q \<noteq> 0 \<Longrightarrow> q div q = 1

goal (1 subgoal):
 1. 1 \<le> (p - 1) div q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> (p - 1) div q

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
have "q \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> q
[PROOF STEP]
using q
[PROOF STATE]
proof (prove)
using this:
q \<in># prime_factorization (p - 1)

goal (1 subgoal):
 1. 2 \<le> q
[PROOF STEP]
by (auto intro: prime_ge_2_nat)
[PROOF STATE]
proof (state)
this:
2 \<le> q

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
hence "(p - 1) div q < p - 1"
[PROOF STATE]
proof (prove)
using this:
2 \<le> q

goal (1 subgoal):
 1. (p - 1) div q < p - 1
[PROOF STEP]
using \<open>p \<ge> 2\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> q
2 \<le> p

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

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
hence "[a^((p - 1) div q) \<noteq> 1] (mod p)"
[PROOF STATE]
proof (prove)
using this:
(p - 1) div q < p - 1

goal (1 subgoal):
 1. [a ^ ((p - 1) div q) \<noteq> 1] (mod p)
[PROOF STEP]
using a \<open>(p - 1) div q \<ge> 1\<close>
[PROOF STATE]
proof (prove)
using this:
(p - 1) div q < p - 1
[a ^ (p - 1) = 1] (mod p) \<and> (\<forall>x>0. x \<le> p - 2 \<longrightarrow> [a ^ x \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
1 \<le> (p - 1) div q

goal (1 subgoal):
 1. [a ^ ((p - 1) div q) \<noteq> 1] (mod p)
[PROOF STEP]
by (auto simp add: Suc_diff_Suc less_eq_Suc_le)
[PROOF STATE]
proof (state)
this:
[a ^ ((p - 1) div q) \<noteq> 1] (mod p)

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?q2 \<in># prime_factorization (p - 1) \<Longrightarrow> [a ^ ((p - 1) div ?q2) \<noteq> 1] (mod p)

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?q2 \<in># prime_factorization (p - 1) \<Longrightarrow> [a ^ ((p - 1) div ?q2) \<noteq> 1] (mod p)

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
?q2 \<in># prime_factorization (p - 1) \<Longrightarrow> [a ^ ((p - 1) div ?q2) \<noteq> 1] (mod p)
[a ^ (p - 1) = 1] (mod p) \<and> (\<forall>x>0. x \<le> p - 2 \<longrightarrow> [a ^ x \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p

goal (1 subgoal):
 1. \<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>a. [a ^ (p - 1) = 1] (mod p) \<and> (\<forall>q. q \<in># prime_factorization (p - 1) \<longrightarrow> [a ^ ((p - 1) div q) \<noteq> 1] (mod p)) \<and> 0 < a \<and> a < p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Arg_of_real [simp]: "Arg (of_real r) = (if r<0 then pi else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (complex_of_real r) = (if r < 0 then pi else 0)
[PROOF STEP]
by (simp add: Im_Ln_eq_pi Arg_def)


[STATEMENT]
lemma an_mult_n:
  "an(x * n(y)) = an(x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. an (x * n y) = an x
[PROOF STEP]
by (metis an_n_def n_an_def n_mult_n)


[STATEMENT]
lemma ham_sandwich_cost_pos [simp]: "ham_sandwich_cost n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < ham_sandwich_cost n
[PROOF STEP]
by (induction n rule: ham_sandwich_cost.induct) simp_all


[STATEMENT]
lemma 21: \<open>\<turnstile> (p \<rightarrow> q \<rightarrow> r) \<rightarrow> q \<rightarrow> p \<rightarrow> r\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> (p \<rightarrow> q \<rightarrow> r) \<rightarrow> q \<rightarrow> p \<rightarrow> r
[PROOF STEP]
using MP 05 20
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<turnstile> ?p \<rightarrow> ?q; \<turnstile> ?p\<rbrakk> \<Longrightarrow> \<turnstile> ?q
\<turnstile> (?p \<rightarrow> ?q \<rightarrow> ?r) \<rightarrow> (?s \<rightarrow> ?q) \<rightarrow> ?p \<rightarrow> ?s \<rightarrow> ?r
\<turnstile> ?p \<rightarrow> (?p \<rightarrow> ?q) \<rightarrow> ?q

goal (1 subgoal):
 1. \<turnstile> (p \<rightarrow> q \<rightarrow> r) \<rightarrow> q \<rightarrow> p \<rightarrow> r
[PROOF STEP]
.


[STATEMENT]
lemma (in Ring) exact3_comp_0:"\<lbrakk>R module L; R module M; R module N;
       f \<in> mHom R L M; g \<in> mHom R M N; exact3 R L f M g N\<rbrakk> \<Longrightarrow>
      compos L g f = mzeromap L N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; exact3 R L f M g N\<rbrakk> \<Longrightarrow> compos L g f = mzeromap L N
[PROOF STEP]
apply (frule Module.mHom_compos [of M R L N f g], assumption+,
       frule mzeromap_mHom [of L N], assumption,
       rule Module.mHom_eq [of L R N], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; exact3 R L f M g N; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N\<rbrakk> \<Longrightarrow> \<forall>m\<in>carrier L. compos L g f m = mzeromap L N m
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; exact3 R L f M g N; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L\<rbrakk> \<Longrightarrow> compos L g f m = mzeromap L N m
[PROOF STEP]
apply (subst compos_def)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; exact3 R L f M g N; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L\<rbrakk> \<Longrightarrow> compose (carrier L) g f m = mzeromap L N m
[PROOF STEP]
apply (simp add:exact3_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; f ` carrier L = ker\<^bsub>M,N\<^esub> g; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L\<rbrakk> \<Longrightarrow> compose (carrier L) g f m = mzeromap L N m
[PROOF STEP]
apply (cut_tac mHom_func[of f L M])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; f ` carrier L = ker\<^bsub>M,N\<^esub> g; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L; f \<in> carrier L \<rightarrow> carrier M\<rbrakk> \<Longrightarrow> compose (carrier L) g f m = mzeromap L N m
 2. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; f ` carrier L = ker\<^bsub>M,N\<^esub> g; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L\<rbrakk> \<Longrightarrow> f \<in> mHom R L M
[PROOF STEP]
apply (frule_tac a = m in mem_in_image [of f "carrier L" "carrier M"],
          assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; f ` carrier L = ker\<^bsub>M,N\<^esub> g; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L; f \<in> carrier L \<rightarrow> carrier M; f m \<in> f ` carrier L\<rbrakk> \<Longrightarrow> compose (carrier L) g f m = mzeromap L N m
 2. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; f ` carrier L = ker\<^bsub>M,N\<^esub> g; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L\<rbrakk> \<Longrightarrow> f \<in> mHom R L M
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; f ` carrier L = ker\<^bsub>M,N\<^esub> g; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L; f \<in> carrier L \<rightarrow> carrier M; f m \<in> ker\<^bsub>M,N\<^esub> g\<rbrakk> \<Longrightarrow> compose (carrier L) g f m = mzeromap L N m
 2. \<And>m. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; f ` carrier L = ker\<^bsub>M,N\<^esub> g; compos L g f \<in> mHom R L N; mzeromap L N \<in> mHom R L N; m \<in> carrier L\<rbrakk> \<Longrightarrow> f \<in> mHom R L M
[PROOF STEP]
apply (simp add:ker_def mzeromap_def compose_def, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma E_eq_one: "E = {1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E = {1::'a}
[PROOF STEP]
by (metis oneDr oner unitl_ex units_eq singleton_iff subsetI subset_antisym)


[STATEMENT]
lemma qfN_prime_unique:
  "\<lbrakk> prime (a^2+N*b^2::int); N > 1; a^2+N*b^2 = c^2+N*d^2 \<rbrakk>
  \<Longrightarrow> (\<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
let ?P = "a^2+N*b^2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
assume P: "prime ?P" and N: "N > 1" and abcdN: "?P = c^2 + N*d^2"
[PROOF STATE]
proof (state)
this:
prime (a\<^sup>2 + N * b\<^sup>2)
1 < N
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
have mult: "(a*d+b*c)*(a*d-b*c) = ?P*(d^2-b^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
[PROOF STEP]
have "(a*d+b*c)*(a*d-b*c) = (a^2 + N*b^2)*d^2 - b^2*(c^2 + N*d^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * d\<^sup>2 - b\<^sup>2 * (c\<^sup>2 + N * d\<^sup>2)
[PROOF STEP]
by (simp add: eval_nat_numeral field_simps)
[PROOF STATE]
proof (state)
this:
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * d\<^sup>2 - b\<^sup>2 * (c\<^sup>2 + N * d\<^sup>2)

goal (1 subgoal):
 1. (a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
[PROOF STEP]
with abcdN
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * d\<^sup>2 - b\<^sup>2 * (c\<^sup>2 + N * d\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * d\<^sup>2 - b\<^sup>2 * (c\<^sup>2 + N * d\<^sup>2)

goal (1 subgoal):
 1. (a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
have "?P dvd a*d+b*c \<or> ?P dvd a*d-b*c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c
[PROOF STEP]
from mult
[PROOF STATE]
proof (chain)
picking this:
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
[PROOF STEP]
have "?P dvd (a*d+b*c)*(a*d-b*c)"
[PROOF STATE]
proof (prove)
using this:
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)

goal (1 subgoal):
 1. a\<^sup>2 + N * b\<^sup>2 dvd (a * d + b * c) * (a * d - b * c)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd (a * d + b * c) * (a * d - b * c)

goal (1 subgoal):
 1. a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c
[PROOF STEP]
with P
[PROOF STATE]
proof (chain)
picking this:
prime (a\<^sup>2 + N * b\<^sup>2)
a\<^sup>2 + N * b\<^sup>2 dvd (a * d + b * c) * (a * d - b * c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prime (a\<^sup>2 + N * b\<^sup>2)
a\<^sup>2 + N * b\<^sup>2 dvd (a * d + b * c) * (a * d - b * c)

goal (1 subgoal):
 1. a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c
[PROOF STEP]
by (auto dest: prime_dvd_multD)
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
assume "?P dvd a*d+b*c"
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c
[PROOF STEP]
obtain Q where Q: "a*d+b*c = ?P*Q"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c

goal (1 subgoal):
 1. (\<And>Q. a * d + b * c = (a\<^sup>2 + N * b\<^sup>2) * Q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: dvd_def)
[PROOF STATE]
proof (state)
this:
a * d + b * c = (a\<^sup>2 + N * b\<^sup>2) * Q

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
from abcdN
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2
[PROOF STEP]
have "?P^2 = (a^2 + N*b^2) * (c^2 + N*d^2)"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2

goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 = (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 = (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2)

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 = (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2)

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
have "\<dots> = (a*c-N*b*d)^2 + N*(a*d+b*c)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2
[PROOF STEP]
by (rule qfN_mult2)
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
with Q
[PROOF STATE]
proof (chain)
picking this:
a * d + b * c = (a\<^sup>2 + N * b\<^sup>2) * Q
(a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2
[PROOF STEP]
have "\<dots> = (a*c-N*b*d)^2 + N*Q^2*?P^2"
[PROOF STATE]
proof (prove)
using this:
a * d + b * c = (a\<^sup>2 + N * b\<^sup>2) * Q
(a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2

goal (1 subgoal):
 1. (a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2 = (a * c - N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
by (simp add: ac_simps power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2 = (a * c - N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2 = (a * c - N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
have "\<dots> \<ge> N*Q^2*?P^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 \<le> (a * c - N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 \<le> (a * c - N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
have pos: "?P^2 \<ge> ?P^2*(Q^2*N)"
[PROOF STATE]
proof (prove)
using this:
N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N) \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N) \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
have "b^2 = d^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b\<^sup>2 = d\<^sup>2
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
assume "b^2 \<noteq> d^2"
[PROOF STATE]
proof (state)
this:
b\<^sup>2 \<noteq> d\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
with P mult Q
[PROOF STATE]
proof (chain)
picking this:
prime (a\<^sup>2 + N * b\<^sup>2)
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
a * d + b * c = (a\<^sup>2 + N * b\<^sup>2) * Q
b\<^sup>2 \<noteq> d\<^sup>2
[PROOF STEP]
have "Q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
prime (a\<^sup>2 + N * b\<^sup>2)
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
a * d + b * c = (a\<^sup>2 + N * b\<^sup>2) * Q
b\<^sup>2 \<noteq> d\<^sup>2

goal (1 subgoal):
 1. Q \<noteq> 0
[PROOF STEP]
by (unfold prime_int_iff, auto)
[PROOF STATE]
proof (state)
this:
Q \<noteq> 0

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
hence "Q^2 > 0"
[PROOF STATE]
proof (prove)
using this:
Q \<noteq> 0

goal (1 subgoal):
 1. 0 < Q\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Q\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < Q\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
with N
[PROOF STATE]
proof (chain)
picking this:
1 < N
0 < Q\<^sup>2
[PROOF STEP]
have "Q^2*N > Q^2*1"
[PROOF STATE]
proof (prove)
using this:
1 < N
0 < Q\<^sup>2

goal (1 subgoal):
 1. Q\<^sup>2 * 1 < Q\<^sup>2 * N
[PROOF STEP]
by (simp only: zmult_zless_mono2)
[PROOF STATE]
proof (state)
this:
Q\<^sup>2 * 1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < Q\<^sup>2
Q\<^sup>2 * 1 < Q\<^sup>2 * N
[PROOF STEP]
have "Q^2*N > 1"
[PROOF STATE]
proof (prove)
using this:
0 < Q\<^sup>2
Q\<^sup>2 * 1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. 1 < Q\<^sup>2 * N
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
with P
[PROOF STATE]
proof (chain)
picking this:
prime (a\<^sup>2 + N * b\<^sup>2)
1 < Q\<^sup>2 * N
[PROOF STEP]
have "?P^2 > 0"
[PROOF STATE]
proof (prove)
using this:
prime (a\<^sup>2 + N * b\<^sup>2)
1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. 0 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
by (simp add: prime_int_iff)
[PROOF STATE]
proof (state)
this:
0 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 < Q\<^sup>2 * N
0 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
have "?P^2*1 < ?P^2*(Q^2*N)"
[PROOF STATE]
proof (prove)
using this:
1 < Q\<^sup>2 * N
0 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * 1 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N)
[PROOF STEP]
by (simp only: zmult_zless_mono2)
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * 1 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N)

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
with pos
[PROOF STATE]
proof (chain)
picking this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N) \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * 1 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N) \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * 1 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<Longrightarrow> b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<Longrightarrow> b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<Longrightarrow> b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
assume "?P dvd a*d-b*c"
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c
[PROOF STEP]
obtain Q where Q: "a*d-b*c = ?P*Q"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c

goal (1 subgoal):
 1. (\<And>Q. a * d - b * c = (a\<^sup>2 + N * b\<^sup>2) * Q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: dvd_def)
[PROOF STATE]
proof (state)
this:
a * d - b * c = (a\<^sup>2 + N * b\<^sup>2) * Q

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
from abcdN
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2
[PROOF STEP]
have "?P^2 = (a^2 + N*b^2) * (c^2 + N*d^2)"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2

goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 = (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 = (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2)

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 = (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2)

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
have "\<dots> = (a*c+N*b*d)^2 + N*(a*d-b*c)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c + N * b * d)\<^sup>2 + N * (a * d - b * c)\<^sup>2
[PROOF STEP]
by (rule qfN_mult1)
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c + N * b * d)\<^sup>2 + N * (a * d - b * c)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c + N * b * d)\<^sup>2 + N * (a * d - b * c)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
with Q
[PROOF STATE]
proof (chain)
picking this:
a * d - b * c = (a\<^sup>2 + N * b\<^sup>2) * Q
(a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c + N * b * d)\<^sup>2 + N * (a * d - b * c)\<^sup>2
[PROOF STEP]
have "\<dots> = (a*c+N*b*d)^2 + N*Q^2*?P^2"
[PROOF STATE]
proof (prove)
using this:
a * d - b * c = (a\<^sup>2 + N * b\<^sup>2) * Q
(a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c + N * b * d)\<^sup>2 + N * (a * d - b * c)\<^sup>2

goal (1 subgoal):
 1. (a * c + N * b * d)\<^sup>2 + N * (a * d - b * c)\<^sup>2 = (a * c + N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
by (simp add: ac_simps power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(a * c + N * b * d)\<^sup>2 + N * (a * d - b * c)\<^sup>2 = (a * c + N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a * c + N * b * d)\<^sup>2 + N * (a * d - b * c)\<^sup>2 = (a * c + N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
have "\<dots> \<ge> N*Q^2*?P^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 \<le> (a * c + N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 \<le> (a * c + N * b * d)\<^sup>2 + N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
have pos: "?P^2 \<ge> ?P^2*(Q^2*N)"
[PROOF STATE]
proof (prove)
using this:
N * Q\<^sup>2 * (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N) \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N) \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
have "b^2 = d^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b\<^sup>2 = d\<^sup>2
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
assume "b^2 \<noteq> d^2"
[PROOF STATE]
proof (state)
this:
b\<^sup>2 \<noteq> d\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
with P mult Q
[PROOF STATE]
proof (chain)
picking this:
prime (a\<^sup>2 + N * b\<^sup>2)
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
a * d - b * c = (a\<^sup>2 + N * b\<^sup>2) * Q
b\<^sup>2 \<noteq> d\<^sup>2
[PROOF STEP]
have "Q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
prime (a\<^sup>2 + N * b\<^sup>2)
(a * d + b * c) * (a * d - b * c) = (a\<^sup>2 + N * b\<^sup>2) * (d\<^sup>2 - b\<^sup>2)
a * d - b * c = (a\<^sup>2 + N * b\<^sup>2) * Q
b\<^sup>2 \<noteq> d\<^sup>2

goal (1 subgoal):
 1. Q \<noteq> 0
[PROOF STEP]
by (unfold prime_int_iff, auto)
[PROOF STATE]
proof (state)
this:
Q \<noteq> 0

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
hence "Q^2 > 0"
[PROOF STATE]
proof (prove)
using this:
Q \<noteq> 0

goal (1 subgoal):
 1. 0 < Q\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Q\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < Q\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
with N
[PROOF STATE]
proof (chain)
picking this:
1 < N
0 < Q\<^sup>2
[PROOF STEP]
have "Q^2*N > Q^2*1"
[PROOF STATE]
proof (prove)
using this:
1 < N
0 < Q\<^sup>2

goal (1 subgoal):
 1. Q\<^sup>2 * 1 < Q\<^sup>2 * N
[PROOF STEP]
by (simp only: zmult_zless_mono2)
[PROOF STATE]
proof (state)
this:
Q\<^sup>2 * 1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < Q\<^sup>2
Q\<^sup>2 * 1 < Q\<^sup>2 * N
[PROOF STEP]
have "Q^2*N > 1"
[PROOF STATE]
proof (prove)
using this:
0 < Q\<^sup>2
Q\<^sup>2 * 1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. 1 < Q\<^sup>2 * N
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
with P
[PROOF STATE]
proof (chain)
picking this:
prime (a\<^sup>2 + N * b\<^sup>2)
1 < Q\<^sup>2 * N
[PROOF STEP]
have "?P^2 > 0"
[PROOF STATE]
proof (prove)
using this:
prime (a\<^sup>2 + N * b\<^sup>2)
1 < Q\<^sup>2 * N

goal (1 subgoal):
 1. 0 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
by (simp add: prime_int_iff)
[PROOF STATE]
proof (state)
this:
0 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 < Q\<^sup>2 * N
0 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
[PROOF STEP]
have "?P^2*1 < ?P^2 * (Q^2*N)"
[PROOF STATE]
proof (prove)
using this:
1 < Q\<^sup>2 * N
0 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * 1 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N)
[PROOF STEP]
by (simp only: zmult_zless_mono2)
[PROOF STATE]
proof (state)
this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * 1 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N)

goal (1 subgoal):
 1. b\<^sup>2 \<noteq> d\<^sup>2 \<Longrightarrow> False
[PROOF STEP]
with pos
[PROOF STATE]
proof (chain)
picking this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N) \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * 1 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N) \<le> (a\<^sup>2 + N * b\<^sup>2)\<^sup>2
(a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * 1 < (a\<^sup>2 + N * b\<^sup>2)\<^sup>2 * (Q\<^sup>2 * N)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c \<Longrightarrow> b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<Longrightarrow> b\<^sup>2 = d\<^sup>2
a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c \<Longrightarrow> b\<^sup>2 = d\<^sup>2
[PROOF STEP]
have bd: "b^2 = d^2"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<or> a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c
a\<^sup>2 + N * b\<^sup>2 dvd a * d + b * c \<Longrightarrow> b\<^sup>2 = d\<^sup>2
a\<^sup>2 + N * b\<^sup>2 dvd a * d - b * c \<Longrightarrow> b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 = d\<^sup>2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
with abcdN
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2
b\<^sup>2 = d\<^sup>2
[PROOF STEP]
have "a^2 = c^2"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2
b\<^sup>2 = d\<^sup>2

goal (1 subgoal):
 1. a\<^sup>2 = c\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a\<^sup>2 = c\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>prime (a\<^sup>2 + N * b\<^sup>2); 1 < N; a\<^sup>2 + N * b\<^sup>2 = c\<^sup>2 + N * d\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b\<^sup>2 = d\<^sup>2
a\<^sup>2 = c\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b\<^sup>2 = d\<^sup>2
a\<^sup>2 = c\<^sup>2

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>
[PROOF STEP]
by (auto simp only: power2_eq_iff)
[PROOF STATE]
proof (state)
this:
\<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>b\<bar> = \<bar>d\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_assoc: "((x :: Nat) * y) * z = x * (y * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y * z = x * (y * z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * y * z = x * (y * z)
[PROOF STEP]
have ac: "\<And>u v w. undiscr (u::nat discr) * (undiscr v * undiscr w)
                   =  (undiscr u * undiscr v) * undiscr w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v w. undiscr u * (undiscr v * undiscr w) = undiscr u * undiscr v * undiscr w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
undiscr ?u * (undiscr ?v * undiscr ?w) = undiscr ?u * undiscr ?v * undiscr ?w

goal (1 subgoal):
 1. x * y * z = x * (y * z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y * z = x * (y * z)
[PROOF STEP]
apply (cases x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x = \<bottom> \<Longrightarrow> x * y * z = x * (y * z)
 2. \<And>u. x = box\<cdot>u \<Longrightarrow> x * y * z = x * (y * z)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. x = box\<cdot>u \<Longrightarrow> x * y * z = x * (y * z)
[PROOF STEP]
apply (cases y)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>u. \<lbrakk>x = box\<cdot>u; y = \<bottom>\<rbrakk> \<Longrightarrow> x * y * z = x * (y * z)
 2. \<And>u ua. \<lbrakk>x = box\<cdot>u; y = box\<cdot>ua\<rbrakk> \<Longrightarrow> x * y * z = x * (y * z)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u ua. \<lbrakk>x = box\<cdot>u; y = box\<cdot>ua\<rbrakk> \<Longrightarrow> x * y * z = x * (y * z)
[PROOF STEP]
apply (cases z)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>u ua. \<lbrakk>x = box\<cdot>u; y = box\<cdot>ua; z = \<bottom>\<rbrakk> \<Longrightarrow> x * y * z = x * (y * z)
 2. \<And>u ua ub. \<lbrakk>x = box\<cdot>u; y = box\<cdot>ua; z = box\<cdot>ub\<rbrakk> \<Longrightarrow> x * y * z = x * (y * z)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u ua ub. \<lbrakk>x = box\<cdot>u; y = box\<cdot>ua; z = box\<cdot>ub\<rbrakk> \<Longrightarrow> x * y * z = x * (y * z)
[PROOF STEP]
by (simp add: ac)
[PROOF STATE]
proof (state)
this:
x * y * z = x * (y * z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sgn_cinner[simp]: \<open>sgn \<psi> \<bullet>\<^sub>C \<psi> = norm \<psi>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn \<psi> \<bullet>\<^sub>C \<psi> = complex_of_real (norm \<psi>)
[PROOF STEP]
apply (cases \<open>\<psi> = 0\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<psi> = (0::'a) \<Longrightarrow> sgn \<psi> \<bullet>\<^sub>C \<psi> = complex_of_real (norm \<psi>)
 2. \<psi> \<noteq> (0::'a) \<Longrightarrow> sgn \<psi> \<bullet>\<^sub>C \<psi> = complex_of_real (norm \<psi>)
[PROOF STEP]
apply (auto simp: sgn_div_norm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> \<noteq> (0::'a) \<Longrightarrow> inverse (complex_of_real (norm \<psi>)) * (\<psi> \<bullet>\<^sub>C \<psi>) = complex_of_real (norm \<psi>)
[PROOF STEP]
by (smt (verit, ccfv_SIG) cinner_scaleR_left cinner_scaleR_right cnorm_eq cnorm_eq_1 complex_of_real_cmod complex_of_real_nn_iff left_inverse mult.right_neutral mult_scaleR_right norm_eq_zero norm_not_less_zero norm_one of_real_def of_real_eq_iff)


[STATEMENT]
lemma has_derivative_inverse_dieudonne:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
  assumes "open S"
    and "open (f ` S)"
    and "continuous_on S f"
    and "continuous_on (f ` S) g"
    and "\<And>x. x \<in> S \<Longrightarrow> g (f x) = x"
    and "x \<in> S"
    and "(f has_derivative f') (at x)"
    and "bounded_linear g'"
    and "g' \<circ> f' = id"
  shows "(g has_derivative g') (at (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_derivative g') (at (f x))
[PROOF STEP]
apply (rule has_derivative_inverse_basic_x[OF assms(7-9) _ _ assms(2)])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. isCont g (f x)
 2. g (f x) = x
 3. f x \<in> f ` S
 4. \<And>y. y \<in> f ` S \<Longrightarrow> f (g y) = y
[PROOF STEP]
using assms(3-6)
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
continuous_on (f ` S) g
?x \<in> S \<Longrightarrow> g (f ?x) = ?x
x \<in> S

goal (4 subgoals):
 1. isCont g (f x)
 2. g (f x) = x
 3. f x \<in> f ` S
 4. \<And>y. y \<in> f ` S \<Longrightarrow> f (g y) = y
[PROOF STEP]
unfolding continuous_on_eq_continuous_at[OF assms(1)] continuous_on_eq_continuous_at[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. isCont f x
\<forall>x\<in>f ` S. isCont g x
?x \<in> S \<Longrightarrow> g (f ?x) = ?x
x \<in> S

goal (4 subgoals):
 1. isCont g (f x)
 2. g (f x) = x
 3. f x \<in> f ` S
 4. \<And>y. y \<in> f ` S \<Longrightarrow> f (g y) = y
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma finite_proots[simp]:
  fixes p :: "'a::idom poly"
  shows "p\<noteq>0 \<Longrightarrow> finite (proots_within p s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> finite (proots_within p s)
[PROOF STEP]
unfolding proots_within_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> finite {x \<in> s. poly p x = (0::'a)}
[PROOF STEP]
using poly_roots_finite
[PROOF STATE]
proof (prove)
using this:
?p \<noteq> 0 \<Longrightarrow> finite {x. poly ?p x = (0::?'a)}

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> finite {x \<in> s. poly p x = (0::'a)}
[PROOF STEP]
by fast


[STATEMENT]
lemma real_of_rat_remdups_adj: "remdups_adj (map real_of_rat xs) = map real_of_rat (remdups_adj xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. remdups_adj (map real_of_rat xs) = map real_of_rat (remdups_adj xs)
[PROOF STEP]
by (induct xs rule: remdups_adj.induct, auto)


[STATEMENT]
lemma pmf_of_set_UN:
  assumes "finite (\<Union>(f ` A))" "A \<noteq> {}" "\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> {}"
          "\<And>x. x \<in> A \<Longrightarrow> card (f x) = n" "disjoint_family_on f A"
  shows   "pmf_of_set (\<Union>(f ` A)) = do {x \<leftarrow> pmf_of_set A; pmf_of_set (f x)}"
            (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.pmf_of_set (\<Union> (f ` A)) = local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))
[PROOF STEP]
proof (intro pmf_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A
[PROOF STEP]
have [simp]: "finite A"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A

goal (1 subgoal):
 1. finite A
[PROOF STEP]
using infinite_disjoint_family_imp_infinite_UNION[of A f]
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A
\<lbrakk>infinite A; \<And>x. x \<in> A \<Longrightarrow> f x \<noteq> {}; disjoint_family_on f A\<rbrakk> \<Longrightarrow> infinite (\<Union> (f ` A))

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

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A
[PROOF STEP]
have "ereal (pmf (pmf_of_set (\<Union>(f ` A))) x) =
    ereal (indicator (\<Union>x\<in>A. f x) x / real (card (\<Union>x\<in>A. f x)))"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A

goal (1 subgoal):
 1. ereal (pmf (local.pmf_of_set (\<Union> (f ` A))) x) = ereal (indicat_real (\<Union> (f ` A)) x / real (card (\<Union> (f ` A))))
[PROOF STEP]
by (subst pmf_of_set) auto
[PROOF STATE]
proof (state)
this:
ereal (pmf (local.pmf_of_set (\<Union> (f ` A))) x) = ereal (indicat_real (\<Union> (f ` A)) x / real (card (\<Union> (f ` A))))

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ereal (pmf (local.pmf_of_set (\<Union> (f ` A))) x) = ereal (indicat_real (\<Union> (f ` A)) x / real (card (\<Union> (f ` A))))

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A
[PROOF STEP]
have "card (\<Union>x\<in>A. f x) = card A * n"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A

goal (1 subgoal):
 1. card (\<Union> (f ` A)) = card A * n
[PROOF STEP]
by (subst card_UN_disjoint) (auto simp: disjoint_family_on_def)
[PROOF STATE]
proof (state)
this:
card (\<Union> (f ` A)) = card A * n

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (\<Union> (f ` A)) = card A * n

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A
[PROOF STEP]
have "indicator (\<Union>x\<in>A. f x) x / real \<dots> =
              indicator (\<Union>x\<in>A. f x) x / (n * real (card A))"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A

goal (1 subgoal):
 1. indicat_real (\<Union> (f ` A)) x / real (card A * n) = indicat_real (\<Union> (f ` A)) x / (real n * real (card A))
[PROOF STEP]
by (simp add: sum_divide_distrib [symmetric] mult_ac)
[PROOF STATE]
proof (state)
this:
indicat_real (\<Union> (f ` A)) x / real (card A * n) = indicat_real (\<Union> (f ` A)) x / (real n * real (card A))

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
indicat_real (\<Union> (f ` A)) x / real (card A * n) = indicat_real (\<Union> (f ` A)) x / (real n * real (card A))

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A
[PROOF STEP]
have "indicator (\<Union>x\<in>A. f x) x = (\<Sum>y\<in>A. indicator (f y) x)"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A

goal (1 subgoal):
 1. indicator (\<Union> (f ` A)) x = (\<Sum>y\<in>A. indicator (f y) x)
[PROOF STEP]
by (intro indicator_UN_disjoint) simp_all
[PROOF STATE]
proof (state)
this:
indicator (\<Union> (f ` A)) x = (\<Sum>y\<in>A. indicator (f y) x)

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
indicator (\<Union> (f ` A)) x = (\<Sum>y\<in>A. indicator (f y) x)

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A
[PROOF STEP]
have "ereal ((\<Sum>y\<in>A. indicator (f y) x) / (real n * real (card A))) =
                          ereal (pmf ?rhs x)"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> (f ` A))
A \<noteq> {}
?x2 \<in> A \<Longrightarrow> f ?x2 \<noteq> {}
?x2 \<in> A \<Longrightarrow> card (f ?x2) = n
disjoint_family_on f A

goal (1 subgoal):
 1. ereal ((\<Sum>y\<in>A. indicat_real (f y) x) / (real n * real (card A))) = ereal (pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) x)
[PROOF STEP]
by (subst pmf_bind_pmf_of_set) (simp_all add: sum_divide_distrib)
[PROOF STATE]
proof (state)
this:
ereal ((\<Sum>y\<in>A. indicat_real (f y) x) / (real n * real (card A))) = ereal (pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) x)

goal (1 subgoal):
 1. \<And>i. pmf (local.pmf_of_set (\<Union> (f ` A))) i = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ereal (pmf (local.pmf_of_set (\<Union> (f ` A))) x) = ereal (pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) x)
[PROOF STEP]
show "pmf ?lhs x = pmf ?rhs x"
[PROOF STATE]
proof (prove)
using this:
ereal (pmf (local.pmf_of_set (\<Union> (f ` A))) x) = ereal (pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) x)

goal (1 subgoal):
 1. pmf (local.pmf_of_set (\<Union> (f ` A))) x = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pmf (local.pmf_of_set (\<Union> (f ` A))) x = pmf (local.pmf_of_set A \<bind> (\<lambda>x. local.pmf_of_set (f x))) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_gt_zero: "1 < x \<Longrightarrow> 0 < ln x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> 0 < ln x
[PROOF STEP]
using ln_less_cancel_iff [of 1 x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 1; 0 < x\<rbrakk> \<Longrightarrow> (ln 1 < ln x) = (1 < x)

goal (1 subgoal):
 1. 1 < x \<Longrightarrow> 0 < ln x
[PROOF STEP]
by simp


[STATEMENT]
lemma Sbis_trans: "\<lbrakk>c \<approx>s d; d \<approx>s e\<rbrakk> \<Longrightarrow> c \<approx>s e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<approx>s d; d \<approx>s e\<rbrakk> \<Longrightarrow> c \<approx>s e
[PROOF STEP]
using trans_Sbis
[PROOF STATE]
proof (prove)
using this:
trans Sbis

goal (1 subgoal):
 1. \<lbrakk>c \<approx>s d; d \<approx>s e\<rbrakk> \<Longrightarrow> c \<approx>s e
[PROOF STEP]
unfolding trans_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y z. x \<approx>s y \<longrightarrow> y \<approx>s z \<longrightarrow> x \<approx>s z

goal (1 subgoal):
 1. \<lbrakk>c \<approx>s d; d \<approx>s e\<rbrakk> \<Longrightarrow> c \<approx>s e
[PROOF STEP]
by blast


[STATEMENT]
theorem wls_freshEnv_swapEnv_exchange1:
assumes "wlsEnv rho"
shows "freshEnv xs x2 (rho &[x1 \<and> x2]_xs) = freshEnv xs x1 rho"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. freshEnv xs x2 (rho &[x1 \<and> x2]_xs) = freshEnv xs x1 rho
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho

goal (1 subgoal):
 1. freshEnv xs x2 (rho &[x1 \<and> x2]_xs) = freshEnv xs x1 rho
[PROOF STEP]
by (intro freshEnv_swapEnv_exchange1) auto


[STATEMENT]
lemma continuous_on_vec_lambda[continuous_intros]:
  "(\<And>i. continuous_on S (f i)) \<Longrightarrow> continuous_on S (\<lambda>x. \<chi> i. f i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. continuous_on S (f i)) \<Longrightarrow> continuous_on S (\<lambda>x. \<chi>i. f i x)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<forall>x\<in>S. (f i \<longlongrightarrow> f i x) (at x within S)) \<Longrightarrow> \<forall>x\<in>S. ((\<lambda>x. \<chi>i. f i x) \<longlongrightarrow> (\<chi>i. f i x)) (at x within S)
[PROOF STEP]
by (auto intro: tendsto_vec_lambda)


[STATEMENT]
lemma refl_symm_closure_is_symm_refl_closure:
  fixes Rel :: "('a \<times> 'a) set"
  shows "symcl (Rel\<^sup>=) = (symcl Rel)\<^sup>="
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symcl (Rel\<^sup>=) = (symcl Rel)\<^sup>=
[PROOF STEP]
by (auto simp add: symcl_def refl)


[STATEMENT]
lemma f_dom_not_zero:
  shows "f \<in> ({i::nat. n \<ge> 1 \<and> i < 2^n} \<rightarrow>\<^sub>E {0,1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {i. 1 \<le> n \<and> i < 2 ^ n} \<rightarrow>\<^sub>E {0, 1}
[PROOF STEP]
using dim dom
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
f \<in> {i. i < 2 ^ n} \<rightarrow>\<^sub>E {0, 1}

goal (1 subgoal):
 1. f \<in> {i. 1 \<le> n \<and> i < 2 ^ n} \<rightarrow>\<^sub>E {0, 1}
[PROOF STEP]
by simp


[STATEMENT]
lemma rel_fun_trans2:
  "rel_fun P1 (rel_fun P2 Q) g g' \<Longrightarrow> rel_fun R P1 f1 f1' \<Longrightarrow> rel_fun R P2 f2 f2' \<Longrightarrow>
    rel_fun R Q (\<lambda>x. g (f1 x) (f2 x)) (\<lambda>y. g' (f1' y) (f2' y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rel_fun P1 (rel_fun P2 Q) g g'; rel_fun R P1 f1 f1'; rel_fun R P2 f2 f2'\<rbrakk> \<Longrightarrow> rel_fun R Q (\<lambda>x. g (f1 x) (f2 x)) (\<lambda>y. g' (f1' y) (f2' y))
[PROOF STEP]
by (auto simp: rel_fun_def)


[STATEMENT]
lemma transpose_board_correct: "s\<^sub>i \<in> b \<longleftrightarrow> (transpose_square s\<^sub>i) \<in> transpose_board b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s\<^sub>i \<in> b) = (transpose_square s\<^sub>i \<in> transpose_board b)
[PROOF STEP]
unfolding transpose_board_def transpose_square_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s\<^sub>i \<in> b) = ((case s\<^sub>i of (i, j) \<Rightarrow> (j, i)) \<in> {(j, i) |i j. (i, j) \<in> b})
[PROOF STEP]
by (auto split: prod.splits)


[STATEMENT]
lemma inc_mat_dim_col: "dim_col (inc_mat_of Vs Bs) = length Bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (inc_mat_of Vs Bs) = length Bs
[PROOF STEP]
by (simp add:  inc_mat_of_def)


[STATEMENT]
lemma pt_eqvt_fun1b:
  fixes f     :: "'a\<Rightarrow>'b"
  assumes a: "\<forall>(pi::'x prm). pi\<bullet>f = f"
  shows "((supp f)::'x set)={}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp f = {}
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
\<forall>pi. pi \<bullet> f = f

goal (1 subgoal):
 1. supp f = {}
[PROOF STEP]
by (simp add: supp_def)


[STATEMENT]
lemma vifintersection_vsubset_lower:
  assumes "i \<in>\<^sub>\<circ> I"
  shows "(\<Inter>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i) \<subseteq>\<^sub>\<circ> f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I) \<subseteq>\<^sub>\<circ> f i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in>\<^sub>\<circ> I

goal (1 subgoal):
 1. \<Inter>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I) \<subseteq>\<^sub>\<circ> f i
[PROOF STEP]
by blast


[STATEMENT]
lemma closed_map_paired_continuous_map_left:
  assumes f: "continuous_map X Y f" and Y: "Hausdorff_space Y"
  shows "closed_map X (prod_topology Y X) (\<lambda>x. (f x,x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_map X (prod_topology Y X) (\<lambda>x. (f x, x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed_map X (prod_topology Y X) (\<lambda>x. (f x, x))
[PROOF STEP]
have eq: "(\<lambda>x. (f x,x)) = (\<lambda>(a,b). (b,a)) \<circ> (\<lambda>x. (x,f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (f x, x)) = (\<lambda>(a, b). (b, a)) \<circ> (\<lambda>x. (x, f x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (f x, x)) = (\<lambda>(a, b). (b, a)) \<circ> (\<lambda>x. (x, f x))

goal (1 subgoal):
 1. closed_map X (prod_topology Y X) (\<lambda>x. (f x, x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_map X (prod_topology Y X) (\<lambda>x. (f x, x))
[PROOF STEP]
unfolding eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_map X (prod_topology Y X) ((\<lambda>(a, b). (b, a)) \<circ> (\<lambda>x. (x, f x)))
[PROOF STEP]
proof (rule closed_map_compose)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. closed_map X ?X' (\<lambda>x. (x, f x))
 2. closed_map ?X' (prod_topology Y X) (\<lambda>(a, b). (b, a))
[PROOF STEP]
show "closed_map X (prod_topology X Y) (\<lambda>x. (x, f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_map X (prod_topology X Y) (\<lambda>x. (x, f x))
[PROOF STEP]
using Y closed_map_paired_continuous_map_right f
[PROOF STATE]
proof (prove)
using this:
Hausdorff_space Y
\<lbrakk>continuous_map ?X ?Y ?f; Hausdorff_space ?Y\<rbrakk> \<Longrightarrow> closed_map ?X (prod_topology ?X ?Y) (\<lambda>x. (x, ?f x))
continuous_map X Y f

goal (1 subgoal):
 1. closed_map X (prod_topology X Y) (\<lambda>x. (x, f x))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
closed_map X (prod_topology X Y) (\<lambda>x. (x, f x))

goal (1 subgoal):
 1. closed_map (prod_topology X Y) (prod_topology Y X) (\<lambda>(a, b). (b, a))
[PROOF STEP]
show "closed_map (prod_topology X Y) (prod_topology Y X) (\<lambda>(a, b). (b, a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_map (prod_topology X Y) (prod_topology Y X) (\<lambda>(a, b). (b, a))
[PROOF STEP]
by (metis homeomorphic_map_swap homeomorphic_imp_closed_map)
[PROOF STATE]
proof (state)
this:
closed_map (prod_topology X Y) (prod_topology Y X) (\<lambda>(a, b). (b, a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
closed_map X (prod_topology Y X) (\<lambda>x. (f x, x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [simp]:
  shows "(\<approx>A) `` {x} = (\<approx>A) `` {y} \<longleftrightarrow> x \<approx>A y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<approx>A `` {x} = \<approx>A `` {y}) = x \<approx>A y
[PROOF STEP]
unfolding str_eq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({(x, y). \<forall>z. (x @ z \<in> A) = (y @ z \<in> A)} `` {x} = {(x, y). \<forall>z. (x @ z \<in> A) = (y @ z \<in> A)} `` {y}) = ((x, y) \<in> {(x, y). \<forall>z. (x @ z \<in> A) = (y @ z \<in> A)})
[PROOF STEP]
by auto


[STATEMENT]
lemma from_cnf_less_\<omega>_exp:
  assumes "\<forall>k \<in> set ks. k < l"
  shows "from_cnf ks < \<omega> ** l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_cnf ks < \<omega> ** l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>k\<in>set ks. k < l

goal (1 subgoal):
 1. from_cnf ks < \<omega> ** l
[PROOF STEP]
by (induct ks) (auto simp: additive_principal.sum_less additive_principal_omega_exp)


[STATEMENT]
lemma le_less_trans:
  assumes "x \<le>\<^sub>a y" and "y <\<^sub>a z"
  shows "x <\<^sub>a z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x <\<^sub>a z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<le>\<^sub>a y
y <\<^sub>a z

goal (1 subgoal):
 1. x <\<^sub>a z
[PROOF STEP]
by (auto simp: less_le_not_le intro: order_trans)


[STATEMENT]
lemma leadsTo_Un:
     "[| F \<in> A leadsTo C; F \<in> B leadsTo C |] ==> F \<in> (A \<union> B) leadsTo C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> A \<longmapsto> C; F \<in> B \<longmapsto> C\<rbrakk> \<Longrightarrow> F \<in> A \<union> B \<longmapsto> C
[PROOF STEP]
using leadsTo_Union [of "{A, B}" F C]
[PROOF STATE]
proof (prove)
using this:
(\<And>Aa. Aa \<in> {A, B} \<Longrightarrow> F \<in> Aa \<longmapsto> C) \<Longrightarrow> F \<in> \<Union> {A, B} \<longmapsto> C

goal (1 subgoal):
 1. \<lbrakk>F \<in> A \<longmapsto> C; F \<in> B \<longmapsto> C\<rbrakk> \<Longrightarrow> F \<in> A \<union> B \<longmapsto> C
[PROOF STEP]
by auto


[STATEMENT]
lemma cos_2pi_minus [simp]: "cos (2 * pi - x) = cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (2 * pi - x) = cos x
[PROOF STEP]
by (metis (no_types, opaque_lifting) cos_add cos_minus cos_two_pi sin_minus sin_two_pi
      diff_0_right minus_diff_eq mult_1 mult_zero_left uminus_add_conv_diff)


[STATEMENT]
lemma sfirst_eq_eSuc: "sfirst P \<omega> = eSuc n \<longleftrightarrow> (\<not> P \<omega>) \<and> sfirst P (stl \<omega>) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sfirst P \<omega> = eSuc n) = (\<not> P \<omega> \<and> sfirst P (stl \<omega>) = n)
[PROOF STEP]
by (subst sfirst.simps) auto


[STATEMENT]
lemma alw_sconst: "(alw (\<lambda>xs. shd xs = h) t) = (t = sconst h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alw (\<lambda>xs. shd xs = h) t = (t = sconst h)
[PROOF STEP]
by (simp add: snth_sconst[symmetric] alw_iff_sdrop)


[STATEMENT]
lemma tendsto_mult_ereal_pos:
  fixes f g::"_ \<Rightarrow> ereal"
  assumes "(f \<longlongrightarrow> l) F" "(g \<longlongrightarrow> m) F" "l>0" "m>0"
  shows "((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
proof (cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
 2. \<not> ?P \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
assume *: "l = \<infinity> \<or> m = \<infinity>"
[PROOF STATE]
proof (state)
this:
l = \<infinity> \<or> m = \<infinity>

goal (2 subgoals):
 1. ?P \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
 2. \<not> ?P \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l = \<infinity> \<or> m = \<infinity>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
l = \<infinity> \<or> m = \<infinity>

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
proof (cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; ?P1\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
 2. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; \<not> ?P1\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
assume "m = \<infinity>"
[PROOF STATE]
proof (state)
this:
m = \<infinity>

goal (2 subgoals):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; ?P1\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
 2. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; \<not> ?P1\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = \<infinity>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = \<infinity>

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
using tendsto_mult_ereal_PInf assms
[PROOF STATE]
proof (prove)
using this:
m = \<infinity>
\<lbrakk>(?f \<longlongrightarrow> ?l) ?F; 0 < ?l; (?g \<longlongrightarrow> \<infinity>) ?F\<rbrakk> \<Longrightarrow> ((\<lambda>x. ?f x * ?g x) \<longlongrightarrow> \<infinity>) ?F
(f \<longlongrightarrow> l) F
(g \<longlongrightarrow> m) F
0 < l
0 < m

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F

goal (1 subgoal):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; m \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; m \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
assume "\<not>(m = \<infinity>)"
[PROOF STATE]
proof (state)
this:
m \<noteq> \<infinity>

goal (1 subgoal):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; m \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> \<infinity>
[PROOF STEP]
have "l = \<infinity>"
[PROOF STATE]
proof (prove)
using this:
m \<noteq> \<infinity>

goal (1 subgoal):
 1. l = \<infinity>
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
m \<noteq> \<infinity>
l = \<infinity> \<or> m = \<infinity>

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

goal (1 subgoal):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; m \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l = \<infinity>
[PROOF STEP]
have "((\<lambda>x. g x * f x) \<longlongrightarrow> l * m) F"
[PROOF STATE]
proof (prove)
using this:
l = \<infinity>

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) \<longlongrightarrow> l * m) F
[PROOF STEP]
using tendsto_mult_ereal_PInf assms
[PROOF STATE]
proof (prove)
using this:
l = \<infinity>
\<lbrakk>(?f \<longlongrightarrow> ?l) ?F; 0 < ?l; (?g \<longlongrightarrow> \<infinity>) ?F\<rbrakk> \<Longrightarrow> ((\<lambda>x. ?f x * ?g x) \<longlongrightarrow> \<infinity>) ?F
(f \<longlongrightarrow> l) F
(g \<longlongrightarrow> m) F
0 < l
0 < m

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) \<longlongrightarrow> l * m) F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g x * f x) \<longlongrightarrow> l * m) F

goal (1 subgoal):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; m \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g x * f x) \<longlongrightarrow> l * m) F

goal (1 subgoal):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; m \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
have "\<And>x. g x * f x = f x * g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. g x * f x = f x * g x
[PROOF STEP]
using mult.commute
[PROOF STATE]
proof (prove)
using this:
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. \<And>x. g x * f x = f x * g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g ?x * f ?x = f ?x * g ?x

goal (1 subgoal):
 1. \<lbrakk>l = \<infinity> \<or> m = \<infinity>; m \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. g x * f x) \<longlongrightarrow> l * m) F
g ?x * f ?x = f ?x * g ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. g x * f x) \<longlongrightarrow> l * m) F
g ?x * f ?x = f ?x * g ?x

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F

goal (1 subgoal):
 1. \<not> (l = \<infinity> \<or> m = \<infinity>) \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (l = \<infinity> \<or> m = \<infinity>) \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
assume "\<not>(l = \<infinity> \<or> m = \<infinity>)"
[PROOF STATE]
proof (state)
this:
\<not> (l = \<infinity> \<or> m = \<infinity>)

goal (1 subgoal):
 1. \<not> (l = \<infinity> \<or> m = \<infinity>) \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (l = \<infinity> \<or> m = \<infinity>)
[PROOF STEP]
have "l < \<infinity>" "m < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
\<not> (l = \<infinity> \<or> m = \<infinity>)

goal (1 subgoal):
 1. l < \<infinity> &&& m < \<infinity>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l < \<infinity>
m < \<infinity>

goal (1 subgoal):
 1. \<not> (l = \<infinity> \<or> m = \<infinity>) \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l < \<infinity>
m < \<infinity>
[PROOF STEP]
obtain lr mr where "l = ereal lr" "m = ereal mr"
[PROOF STATE]
proof (prove)
using this:
l < \<infinity>
m < \<infinity>

goal (1 subgoal):
 1. (\<And>lr mr. \<lbrakk>l = ereal lr; m = ereal mr\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>l>0\<close> \<open>m>0\<close>
[PROOF STATE]
proof (prove)
using this:
l < \<infinity>
m < \<infinity>
0 < l
0 < m

goal (1 subgoal):
 1. (\<And>lr mr. \<lbrakk>l = ereal lr; m = ereal mr\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis ereal_cases ereal_less(6) not_less_iff_gr_or_eq)
[PROOF STATE]
proof (state)
this:
l = ereal lr
m = ereal mr

goal (1 subgoal):
 1. \<not> (l = \<infinity> \<or> m = \<infinity>) \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l = ereal lr
m = ereal mr
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
l = ereal lr
m = ereal mr

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
using tendsto_mult_real_ereal assms
[PROOF STATE]
proof (prove)
using this:
l = ereal lr
m = ereal mr
\<lbrakk>(?u \<longlongrightarrow> ereal ?l) ?F; (?v \<longlongrightarrow> ereal ?m) ?F\<rbrakk> \<Longrightarrow> ((\<lambda>n. ?u n * ?v n) \<longlongrightarrow> ereal ?l * ereal ?m) ?F
(f \<longlongrightarrow> l) F
(g \<longlongrightarrow> m) F
0 < l
0 < m

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x * g x) \<longlongrightarrow> l * m) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ereal_mono_minus_cancel:
  fixes a b c :: ereal
  shows "c - a \<le> c - b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c < \<infinity> \<Longrightarrow> b \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c - a \<le> c - b; 0 \<le> c; c < \<infinity>\<rbrakk> \<Longrightarrow> b \<le> a
[PROOF STEP]
by (cases a b c rule: ereal3_cases) auto


[STATEMENT]
lemma crypts_union_2:
 "crypts H \<union> crypts H' \<subseteq> crypts (H \<union> H')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. crypts H \<union> crypts H' \<subseteq> crypts (H \<union> H')
[PROOF STEP]
by (rule subsetI, erule UnE, erule_tac [!] crypts.induct, auto)


[STATEMENT]
lemma coprime_Suc_left_nat [simp]:
  "coprime (Suc n) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (Suc n) n
[PROOF STEP]
using coprime_add_one_left [of n]
[PROOF STATE]
proof (prove)
using this:
coprime (n + 1) n

goal (1 subgoal):
 1. coprime (Suc n) n
[PROOF STEP]
by simp


[STATEMENT]
lemma mono_restrict_space: "sets M \<le> sets N \<Longrightarrow> sets (restrict_space M X) \<subseteq> sets (restrict_space N X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets M \<subseteq> sets N \<Longrightarrow> sets (restrict_space M X) \<subseteq> sets (restrict_space N X)
[PROOF STEP]
unfolding sets_restrict_space
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets M \<subseteq> sets N \<Longrightarrow> sets.restricted_space M X \<subseteq> sets.restricted_space N X
[PROOF STEP]
by (rule image_mono)


[STATEMENT]
lemma not_is_NoMsg: "(\<not> is_NoMsg m) = is_Msg m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> is_NoMsg m) = is_Msg m
[PROOF STEP]
by (simp add: is_NoMsg_defs)


[STATEMENT]
lemma eucl_of_list_prod_if:
  assumes "length xs = DIM('a::executable_euclidean_space) + DIM('b::executable_euclidean_space)"
  shows "eucl_of_list xs =
    (eucl_of_list (take DIM('a) xs)::'a, eucl_of_list (drop DIM('a) xs)::'b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list xs = (eucl_of_list (take DIM('a) xs), eucl_of_list (drop DIM('a) xs))
[PROOF STEP]
apply (rule euclidean_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> eucl_of_list xs \<bullet> b = (eucl_of_list (take DIM('a) xs), eucl_of_list (drop DIM('a) xs)) \<bullet> b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = DIM('a) + DIM('b)

goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> eucl_of_list xs \<bullet> b = (eucl_of_list (take DIM('a) xs), eucl_of_list (drop DIM('a) xs)) \<bullet> b
[PROOF STEP]
apply (auto simp: eucl_of_list_inner dest!: Basis_prodD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>length xs = DIM('a) + DIM('b); a \<in> Basis\<rbrakk> \<Longrightarrow> xs ! index Basis_list a = eucl_of_list xs \<bullet> a
[PROOF STEP]
apply (subst eucl_of_list_inner_le)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a. \<lbrakk>length xs = DIM('a) + DIM('b); a \<in> Basis\<rbrakk> \<Longrightarrow> a \<in> Basis
 2. \<And>a. \<lbrakk>length xs = DIM('a) + DIM('b); a \<in> Basis\<rbrakk> \<Longrightarrow> DIM('a) \<le> length xs
 3. \<And>a. \<lbrakk>length xs = DIM('a) + DIM('b); a \<in> Basis\<rbrakk> \<Longrightarrow> xs ! index Basis_list a = xs ! index Basis_list a
[PROOF STEP]
apply (auto simp: Basis_list_prod_def index_append in_set_zip)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done