[STATEMENT]
theorem gen_ramanujan_sum_dirichlet_expr:
  fixes f h :: "nat \<Rightarrow> complex" and n k :: nat
  defines "g \<equiv> (\<lambda>k. moebius_mu k * h k)"
  defines "F \<equiv> dirichlet_prod f g"
  defines "N \<equiv> k div gcd n k"
  assumes "completely_multiplicative_function f"
          "multiplicative_function h"
  assumes "\<And>p. prime p \<Longrightarrow> f(p) \<noteq> 0 \<and> f(p) \<noteq> h(p)"
  assumes "k > 0" "n > 0"
  shows "s f g k n = (F(k)*g(N)) div (F(N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
define a where "a \<equiv> gcd n k"
[PROOF STATE]
proof (state)
this:
a \<equiv> gcd n k

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have 2: "k = a*N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = a * N
[PROOF STEP]
unfolding a_def N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = gcd n k * (k div gcd n k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k = a * N

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have 3: "a > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a
[PROOF STEP]
using a_def assms(7,8)
[PROOF STATE]
proof (prove)
using this:
a \<equiv> gcd n k
0 < k
0 < n

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

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have Ngr0: "N > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < N
[PROOF STEP]
using assms(7,8) 2 N_def
[PROOF STATE]
proof (prove)
using this:
0 < k
0 < n
k = a * N
N \<equiv> k div gcd n k

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

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have f_k_not_z: "f k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f k \<noteq> 0
[PROOF STEP]
using completely_multiplicative_nonzero assms(4,6,7)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>completely_multiplicative_function ?f; ?d \<noteq> 0; \<And>p. prime p \<Longrightarrow> ?f p \<noteq> 0\<rbrakk> \<Longrightarrow> ?f ?d \<noteq> 0
completely_multiplicative_function f
prime ?p \<Longrightarrow> f ?p \<noteq> 0 \<and> f ?p \<noteq> h ?p
0 < k

goal (1 subgoal):
 1. f k \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f k \<noteq> 0

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have f_N_not_z: "f N \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f N \<noteq> 0
[PROOF STEP]
using completely_multiplicative_nonzero assms(4,6) Ngr0
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>completely_multiplicative_function ?f; ?d \<noteq> 0; \<And>p. prime p \<Longrightarrow> ?f p \<noteq> 0\<rbrakk> \<Longrightarrow> ?f ?d \<noteq> 0
completely_multiplicative_function f
prime ?p \<Longrightarrow> f ?p \<noteq> 0 \<and> f ?p \<noteq> h ?p
0 < N

goal (1 subgoal):
 1. f N \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f N \<noteq> 0

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have bij: "bij_betw (\<lambda>d. a div d) {d. d dvd a} {d. d dvd a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((div) a) {d. d dvd a} {d. d dvd a}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((div) a) {d. d dvd a} \<and> (div) a ` {d. d dvd a} = {d. d dvd a}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on ((div) a) {d. d dvd a}
 2. (div) a ` {d. d dvd a} = {d. d dvd a}
[PROOF STEP]
show inj: "inj_on (\<lambda>d. a div d) {d. d dvd a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((div) a) {d. d dvd a}
[PROOF STEP]
using inj_on_def "3" dvd_div_eq_2
[PROOF STATE]
proof (prove)
using this:
inj_on ?f ?A = (\<forall>x\<in>?A. \<forall>y\<in>?A. ?f x = ?f y \<longrightarrow> x = y)
0 < a
\<lbrakk>0 < ?c; ?a dvd ?c; ?b dvd ?c; ?c div ?a = ?c div ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. inj_on ((div) a) {d. d dvd a}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inj_on ((div) a) {d. d dvd a}

goal (1 subgoal):
 1. (div) a ` {d. d dvd a} = {d. d dvd a}
[PROOF STEP]
show surj: "(\<lambda>d. a div d) ` {d. d dvd a} = {d. d dvd a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (div) a ` {d. d dvd a} = {d. d dvd a}
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{d. d dvd a}. y = a div x} = {d. d dvd a}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {y. \<exists>x\<in>{d. d dvd a}. y = a div x} \<subseteq> {d. d dvd a}
 2. {d. d dvd a} \<subseteq> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
show " {y. \<exists>x\<in>{d. d dvd a}. y = a div x} \<subseteq> {d. d dvd a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{d. d dvd a}. y = a div x} \<subseteq> {d. d dvd a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y. \<exists>x\<in>{d. d dvd a}. y = a div x} \<subseteq> {d. d dvd a}

goal (1 subgoal):
 1. {d. d dvd a} \<subseteq> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
show "{d. d dvd a} \<subseteq> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {d. d dvd a} \<subseteq> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a} \<Longrightarrow> x \<in> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a} \<Longrightarrow> x \<in> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
assume a: "d \<in> {d. d dvd a}"
[PROOF STATE]
proof (state)
this:
d \<in> {d. d dvd a}

goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a} \<Longrightarrow> x \<in> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
d \<in> {d. d dvd a}
[PROOF STEP]
have 1: "(a div d) \<in> {d. d dvd a}"
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a}

goal (1 subgoal):
 1. a div d \<in> {d. d dvd a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a div d \<in> {d. d dvd a}

goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a} \<Longrightarrow> x \<in> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
d \<in> {d. d dvd a}
[PROOF STEP]
have 2: "d = a div (a div d)"
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a}

goal (1 subgoal):
 1. d = a div (a div d)
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a}
0 < a

goal (1 subgoal):
 1. d = a div (a div d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d = a div (a div d)

goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a} \<Longrightarrow> x \<in> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
from 1 2
[PROOF STATE]
proof (chain)
picking this:
a div d \<in> {d. d dvd a}
d = a div (a div d)
[PROOF STEP]
show "d \<in> {y. \<exists>x\<in>{d. d dvd a}. y = a div x} "
[PROOF STATE]
proof (prove)
using this:
a div d \<in> {d. d dvd a}
d = a div (a div d)

goal (1 subgoal):
 1. d \<in> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
d \<in> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{d. d dvd a} \<subseteq> {y. \<exists>x\<in>{d. d dvd a}. y = a div x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(div) a ` {d. d dvd a} = {d. d dvd a}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bij_betw ((div) a) {d. d dvd a} {d. d dvd a}

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "s f g k n = (\<Sum>d | d dvd a. f(d)*moebius_mu(k div d)*h(k div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s f g k n = (\<Sum>d | d dvd a. f d * moebius_mu (k div d) * h (k div d))
[PROOF STEP]
unfolding gen_ramanujan_sum_def g_def a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd gcd n k. f d * (moebius_mu (k div d) * h (k div d))) = (\<Sum>d | d dvd gcd n k. f d * moebius_mu (k div d) * h (k div d))
[PROOF STEP]
by (simp add: mult.assoc)
[PROOF STATE]
proof (state)
this:
s f g k n = (\<Sum>d | d dvd a. f d * moebius_mu (k div d) * h (k div d))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
s f g k n = (\<Sum>d | d dvd a. f d * moebius_mu (k div d) * h (k div d))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd a. f(d) * moebius_mu(a*N div d)*h(a*N div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (k div d) * h (k div d)) = (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d))
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
k = a * N

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (k div d) * h (k div d)) = (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f d * moebius_mu (k div d) * h (k div d)) = (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f d * moebius_mu (k div d) * h (k div d)) = (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd a. f(a div d) * moebius_mu(N*d)*h(N*d))"
    (is "?a = ?b")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
define f_aux where "f_aux \<equiv> (\<lambda>d. f d * moebius_mu (a * N div d) * h (a * N div d))"
[PROOF STATE]
proof (state)
this:
f_aux \<equiv> \<lambda>d. f d * moebius_mu (a * N div d) * h (a * N div d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
have 1: "?a = (\<Sum>d | d dvd a. f_aux d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f_aux d)
[PROOF STEP]
using f_aux_def
[PROOF STATE]
proof (prove)
using this:
f_aux \<equiv> \<lambda>d. f d * moebius_mu (a * N div d) * h (a * N div d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f_aux d)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f_aux d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f_aux d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
fix d :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
assume "d dvd a"
[PROOF STATE]
proof (state)
this:
d dvd a

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d dvd a
[PROOF STEP]
have "N * a div (a div d) = N * d"
[PROOF STATE]
proof (prove)
using this:
d dvd a

goal (1 subgoal):
 1. N * a div (a div d) = N * d
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
d dvd a
0 < a

goal (1 subgoal):
 1. N * a div (a div d) = N * d
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
N * a div (a div d) = N * d

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?d2 dvd a \<Longrightarrow> N * a div (a div ?d2) = N * ?d2

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?d2 dvd a \<Longrightarrow> N * a div (a div ?d2) = N * ?d2
[PROOF STEP]
have 2: "?b = (\<Sum>d | d dvd a. f_aux (a div d))"
[PROOF STATE]
proof (prove)
using this:
?d2 dvd a \<Longrightarrow> N * a div (a div ?d2) = N * ?d2

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a. f_aux (a div d))
[PROOF STEP]
unfolding f_aux_def
[PROOF STATE]
proof (prove)
using this:
?d2 dvd a \<Longrightarrow> N * a div (a div ?d2) = N * ?d2

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (a * N div (a div d)) * h (a * N div (a div d)))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a. f_aux (a div d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
show "?a = ?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
using bij 1 2
[PROOF STATE]
proof (prove)
using this:
bij_betw ((div) a) {d. d dvd a} {d. d dvd a}
(\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f_aux d)
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a. f_aux (a div d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
by (simp add: sum.reindex_bij_betw[of "((div) a)" "{d. d dvd a}" "{d. d dvd a}"])
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f d * moebius_mu (a * N div d) * h (a * N div d)) = (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d div f d))"
   (is "?a = ?b")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
have "?a = (\<Sum>d | d dvd a \<and> coprime N d. f(a div d) * moebius_mu (N*d) * h (N*d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a \<and> coprime N d. f (a div d) * moebius_mu (N * d) * h (N * d))
[PROOF STEP]
by (rule sum.mono_neutral_right)(auto simp add: moebius_prod_not_coprime 3)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a \<and> coprime N d. f (a div d) * moebius_mu (N * d) * h (N * d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a \<and> coprime N d. f (a div d) * moebius_mu (N * d) * h (N * d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * f(a div d) * moebius_mu d * h d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a \<and> coprime N d. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * f (a div d) * moebius_mu d * h d)
[PROOF STEP]
proof (rule sum.cong,simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a \<and> coprime N d} \<Longrightarrow> f (a div x) * moebius_mu (N * x) * h (N * x) = moebius_mu N * h N * f (a div x) * moebius_mu x * h x
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a \<and> coprime N d} \<Longrightarrow> f (a div x) * moebius_mu (N * x) * h (N * x) = moebius_mu N * h N * f (a div x) * moebius_mu x * h x
[PROOF STEP]
assume a: "d \<in> {d. d dvd a \<and> coprime N d}"
[PROOF STATE]
proof (state)
this:
d \<in> {d. d dvd a \<and> coprime N d}

goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a \<and> coprime N d} \<Longrightarrow> f (a div x) * moebius_mu (N * x) * h (N * x) = moebius_mu N * h N * f (a div x) * moebius_mu x * h x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d \<in> {d. d dvd a \<and> coprime N d}
[PROOF STEP]
have 1: "moebius_mu (N*d) = moebius_mu N * moebius_mu d"
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a \<and> coprime N d}

goal (1 subgoal):
 1. moebius_mu (N * d) = moebius_mu N * moebius_mu d
[PROOF STEP]
using mult_moebius
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a \<and> coprime N d}
multiplicative_function moebius_mu

goal (1 subgoal):
 1. moebius_mu (N * d) = moebius_mu N * moebius_mu d
[PROOF STEP]
unfolding multiplicative_function_def
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a \<and> coprime N d}
moebius_mu 0 = (0::?'a) \<and> moebius_mu 1 = (1::?'a) \<and> (\<forall>a b. 1 < a \<longrightarrow> 1 < b \<longrightarrow> coprime a b \<longrightarrow> moebius_mu (a * b) = moebius_mu a * moebius_mu b)

goal (1 subgoal):
 1. moebius_mu (N * d) = moebius_mu N * moebius_mu d
[PROOF STEP]
by (simp add: moebius_mu.mult_coprime)
[PROOF STATE]
proof (state)
this:
moebius_mu (N * d) = moebius_mu N * moebius_mu d

goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a \<and> coprime N d} \<Longrightarrow> f (a div x) * moebius_mu (N * x) * h (N * x) = moebius_mu N * h N * f (a div x) * moebius_mu x * h x
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
d \<in> {d. d dvd a \<and> coprime N d}
[PROOF STEP]
have 2: "h (N*d) = h N * h d"
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a \<and> coprime N d}

goal (1 subgoal):
 1. h (N * d) = h N * h d
[PROOF STEP]
using assms(5)
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a \<and> coprime N d}
multiplicative_function h

goal (1 subgoal):
 1. h (N * d) = h N * h d
[PROOF STEP]
unfolding multiplicative_function_def
[PROOF STATE]
proof (prove)
using this:
d \<in> {d. d dvd a \<and> coprime N d}
h 0 = 0 \<and> h 1 = 1 \<and> (\<forall>a b. 1 < a \<longrightarrow> 1 < b \<longrightarrow> coprime a b \<longrightarrow> h (a * b) = h a * h b)

goal (1 subgoal):
 1. h (N * d) = h N * h d
[PROOF STEP]
by (simp add: assms(5) multiplicative_function.mult_coprime)
[PROOF STATE]
proof (state)
this:
h (N * d) = h N * h d

goal (1 subgoal):
 1. \<And>x. x \<in> {d. d dvd a \<and> coprime N d} \<Longrightarrow> f (a div x) * moebius_mu (N * x) * h (N * x) = moebius_mu N * h N * f (a div x) * moebius_mu x * h x
[PROOF STEP]
show "f (a div d) * moebius_mu (N * d) * h (N * d) =
         moebius_mu N * h N * f (a div d) * moebius_mu d * h d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (a div d) * moebius_mu (N * d) * h (N * d) = moebius_mu N * h N * f (a div d) * moebius_mu d * h d
[PROOF STEP]
by (simp add: divide_simps 1 2)
[PROOF STATE]
proof (state)
this:
f (a div d) * moebius_mu (N * d) * h (N * d) = moebius_mu N * h N * f (a div d) * moebius_mu d * h d

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a \<and> coprime N d. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * f (a div d) * moebius_mu d * h d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a \<and> coprime N d. f (a div d) * moebius_mu (N * d) * h (N * d)) = (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * f (a div d) * moebius_mu d * h d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * (f a div f d) * moebius_mu d * h d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * f (a div d) * moebius_mu d * h d) = (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * (f a / f d) * moebius_mu d * h d)
[PROOF STEP]
by (intro sum.cong refl) (use multipl_div_mono[of f _ a] assms(4,6-8) 3 in force)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * f (a div d) * moebius_mu d * h d) = (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * (f a / f d) * moebius_mu d * h d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * f (a div d) * moebius_mu d * h d) = (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * (f a / f d) * moebius_mu d * h d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
have "\<dots> = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d div f d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * (f a / f d) * moebius_mu d * h d) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
by (simp add: sum_distrib_left algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a \<and> coprime N d. moebius_mu N * h N * (f a / f d) * moebius_mu d * h d) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))

goal (1 subgoal):
 1. (\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a. f (a div d) * moebius_mu (N * d) * h (N * d)) = moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> =
           moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in> prime_factors a \<and> \<not> (p dvd N)}. 1 - (h p div f p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
have "multiplicative_function (\<lambda>d. h d div f d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function (\<lambda>d. h d / f d)
[PROOF STEP]
using multiplicative_function_divide
             comp_to_mult
             assms(4,5)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>multiplicative_function ?f; multiplicative_function ?g\<rbrakk> \<Longrightarrow> multiplicative_function (\<lambda>n. ?f n / ?g n)
completely_multiplicative_function ?f \<Longrightarrow> multiplicative_function ?f
completely_multiplicative_function f
multiplicative_function h

goal (1 subgoal):
 1. multiplicative_function (\<lambda>d. h d / f d)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
multiplicative_function (\<lambda>d. h d / f d)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
multiplicative_function (\<lambda>d. h d / f d)
[PROOF STEP]
have "(\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d div f d)) =
    (\<Prod>p\<in>{p. p \<in> prime_factors a \<and> \<not> (p dvd N)}. 1 - (h p div f p))"
[PROOF STATE]
proof (prove)
using this:
multiplicative_function (\<lambda>d. h d / f d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
using sum_divisors_moebius_mu_times_multiplicative_revisited[
         of "(\<lambda>d. h d div f d)" a N]
           assms(8) Ngr0 3
[PROOF STATE]
proof (prove)
using this:
multiplicative_function (\<lambda>d. h d / f d)
\<lbrakk>multiplicative_function (\<lambda>d. h d / f d); 0 < a; 0 < N\<rbrakk> \<Longrightarrow> (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
0 < n
0 < N
0 < a

goal (1 subgoal):
 1. (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * f a * (\<Sum>d | d dvd a \<and> coprime N d. moebius_mu d * (h d / f d)) = moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = f(a) * moebius_mu(N) * h(N) *
     ((\<Prod>p\<in>{p. p \<in> prime_factors (a*N)}. 1 - (h p div f p)) div
     (\<Prod>p\<in>{p. p \<in> prime_factors N}. 1 - (h p div f p)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
have "{p. p \<in>prime_factors a \<and> \<not> p dvd N} =
          ({p. p \<in>prime_factors (a*N)} - {p. p \<in>prime_factors N})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. p \<in># prime_factorization a \<and> \<not> p dvd N} = {p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}
[PROOF STEP]
using p_div_set[of a N]
[PROOF STATE]
proof (prove)
using this:
{p. p \<in># prime_factorization a \<and> \<not> p dvd N} = {p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}

goal (1 subgoal):
 1. {p. p \<in># prime_factorization a \<and> \<not> p dvd N} = {p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{p. p \<in># prime_factorization a \<and> \<not> p dvd N} = {p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{p. p \<in># prime_factorization a \<and> \<not> p dvd N} = {p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}
[PROOF STEP]
have eq2: "(\<Prod>p\<in>{p. p \<in>prime_factors a \<and> \<not> p dvd N}. 1 - h p / f p) =
          prod (\<lambda>p. 1 - h p / f p) ({p. p \<in>prime_factors (a*N)} - {p. p \<in>prime_factors N})"
[PROOF STATE]
proof (prove)
using this:
{p. p \<in># prime_factorization a \<and> \<not> p dvd N} = {p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}

goal (1 subgoal):
 1. (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}. 1 - h p / f p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
have eq: "\<dots> = prod (\<lambda>p. 1 - h p / f p) {p. p \<in>prime_factors (a*N)} div
                     prod (\<lambda>p. 1 - h p / f p) {p. p \<in>prime_factors N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)
[PROOF STEP]
proof (intro prod_div_sub,simp,simp,simp add: "3" Ngr0 dvd_prime_factors,simp,standard)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in># prime_factorization N \<Longrightarrow> f b = 0 \<or> h b \<noteq> f b
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in># prime_factorization N \<Longrightarrow> f b = 0 \<or> h b \<noteq> f b
[PROOF STEP]
assume "b \<in># prime_factorization N"
[PROOF STATE]
proof (state)
this:
b \<in># prime_factorization N

goal (1 subgoal):
 1. \<And>b. b \<in># prime_factorization N \<Longrightarrow> f b = 0 \<or> h b \<noteq> f b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in># prime_factorization N
[PROOF STEP]
have p_b: "prime b"
[PROOF STATE]
proof (prove)
using this:
b \<in># prime_factorization N

goal (1 subgoal):
 1. prime b
[PROOF STEP]
using in_prime_factors_iff
[PROOF STATE]
proof (prove)
using this:
b \<in># prime_factorization N
(?p \<in># prime_factorization ?x) = (?x \<noteq> (0::?'a) \<and> ?p dvd ?x \<and> prime ?p)

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

goal (1 subgoal):
 1. \<And>b. b \<in># prime_factorization N \<Longrightarrow> f b = 0 \<or> h b \<noteq> f b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime b
[PROOF STEP]
show "f b = 0 \<or> h b \<noteq> f b"
[PROOF STATE]
proof (prove)
using this:
prime b

goal (1 subgoal):
 1. f b = 0 \<or> h b \<noteq> f b
[PROOF STEP]
using assms(6)[OF p_b]
[PROOF STATE]
proof (prove)
using this:
prime b
f b \<noteq> 0 \<and> f b \<noteq> h b

goal (1 subgoal):
 1. f b = 0 \<or> h b \<noteq> f b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f b = 0 \<or> h b \<noteq> f b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>{p. p \<in> prime_factors (a*N)}. 1 - (h p div f p)) div
     (\<Prod>p\<in>{p. p \<in> prime_factors N}. 1 - (h p div f p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
[PROOF STEP]
have "(\<Prod>p\<in>{p. p \<in>prime_factors a \<and> \<not> p dvd N}. 1 - h p / f p) =
        (\<Prod>p\<in>{p. p \<in> prime_factors (a*N)}. 1 - (h p div f p)) div
     (\<Prod>p\<in>{p. p \<in> prime_factors N}. 1 - (h p div f p))"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)

goal (1 subgoal):
 1. (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)
[PROOF STEP]
using eq eq2
[PROOF STATE]
proof (prove)
using this:
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p)
(\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)} - {p. p \<in># prime_factorization N}. 1 - h p / f p)

goal (1 subgoal):
 1. (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = (\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)

goal (1 subgoal):
 1. moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * f a * (\<Prod>p\<in>{p. p \<in># prime_factorization a \<and> \<not> p dvd N}. 1 - h p / f p) = f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = f(a) * moebius_mu(N) * h(N) * (F(k) div f(k)) * (f(N) div F(N))"
   (is "?a = ?b")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
have "F(N) = (f N) *(\<Prod>p\<in> prime_factors N. 1 - (h p div f p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F N = f N * (\<Prod>p\<in>prime_factors N. 1 - h p / f p)
[PROOF STEP]
unfolding F_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>k. moebius_mu k * h k) N = f N * (\<Prod>p\<in>prime_factors N. 1 - h p / f p)
[PROOF STEP]
by (intro dirichlet_prod_completely_multiplicative_left) (auto simp add: Ngr0 assms(4-6))
[PROOF STATE]
proof (state)
this:
F N = f N * (\<Prod>p\<in>prime_factors N. 1 - h p / f p)

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
F N = f N * (\<Prod>p\<in>prime_factors N. 1 - h p / f p)
[PROOF STEP]
have eq_1: "(\<Prod>p\<in> prime_factors N. 1 - (h p div f p)) =
               F N div f N"
[PROOF STATE]
proof (prove)
using this:
F N = f N * (\<Prod>p\<in>prime_factors N. 1 - h p / f p)

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors N. 1 - h p / f p) = F N / f N
[PROOF STEP]
using 2 f_N_not_z
[PROOF STATE]
proof (prove)
using this:
F N = f N * (\<Prod>p\<in>prime_factors N. 1 - h p / f p)
k = a * N
f N \<noteq> 0

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors N. 1 - h p / f p) = F N / f N
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors N. 1 - h p / f p) = F N / f N

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
have "F(k) = (f k) * (\<Prod>p\<in> prime_factors k. 1 - (h p div f p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F k = f k * (\<Prod>p\<in>prime_factors k. 1 - h p / f p)
[PROOF STEP]
unfolding F_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>k. moebius_mu k * h k) k = f k * (\<Prod>p\<in>prime_factors k. 1 - h p / f p)
[PROOF STEP]
by (intro dirichlet_prod_completely_multiplicative_left) (auto simp add: assms(4-7))
[PROOF STATE]
proof (state)
this:
F k = f k * (\<Prod>p\<in>prime_factors k. 1 - h p / f p)

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
F k = f k * (\<Prod>p\<in>prime_factors k. 1 - h p / f p)
[PROOF STEP]
have eq_2: "(\<Prod>p\<in> prime_factors k. 1 - (h p div f p)) =
               F k div f k"
[PROOF STATE]
proof (prove)
using this:
F k = f k * (\<Prod>p\<in>prime_factors k. 1 - h p / f p)

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors k. 1 - h p / f p) = F k / f k
[PROOF STEP]
using 2 f_k_not_z
[PROOF STATE]
proof (prove)
using this:
F k = f k * (\<Prod>p\<in>prime_factors k. 1 - h p / f p)
k = a * N
f k \<noteq> 0

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors k. 1 - h p / f p) = F k / f k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors k. 1 - h p / f p) = F k / f k

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
have "?a = f a * moebius_mu N * h N *
           ((\<Prod>p\<in> prime_factors k. 1 - (h p div f p)) div
           (\<Prod>p\<in> prime_factors N. 1 - (h p div f p)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * ((\<Prod>p\<in>prime_factors k. 1 - h p / f p) / (\<Prod>p\<in>prime_factors N. 1 - h p / f p))
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
k = a * N

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * ((\<Prod>p\<in>prime_factors k. 1 - h p / f p) / (\<Prod>p\<in>prime_factors N. 1 - h p / f p))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * ((\<Prod>p\<in>prime_factors k. 1 - h p / f p) / (\<Prod>p\<in>prime_factors N. 1 - h p / f p))

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * ((\<Prod>p\<in>prime_factors k. 1 - h p / f p) / (\<Prod>p\<in>prime_factors N. 1 - h p / f p))

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
have  "\<dots> = f a * moebius_mu N * h N * ((F k div f k) div (F N div f N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>prime_factors k. 1 - h p / f p) / (\<Prod>p\<in>prime_factors N. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k / (F N / f N))
[PROOF STEP]
by (simp add: eq_1 eq_2)
[PROOF STATE]
proof (state)
this:
f a * moebius_mu N * h N * ((\<Prod>p\<in>prime_factors k. 1 - h p / f p) / (\<Prod>p\<in>prime_factors N. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k / (F N / f N))

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k / (F N / f N))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k / (F N / f N))

goal (1 subgoal):
 1. f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f a * moebius_mu N * h N * ((\<Prod>p\<in>{p. p \<in># prime_factorization (a * N)}. 1 - h p / f p) / (\<Prod>p\<in>{p. p \<in># prime_factorization N}. 1 - h p / f p)) = f a * moebius_mu N * h N * (F k / f k) * (f N / F N)

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = moebius_mu N * h N * ((F k * f a * f N) div (F N * f k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a * moebius_mu N * h N * (F k / f k) * (f N / F N) = moebius_mu N * h N * (F k * f a * f N / (F N * f k))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
f a * moebius_mu N * h N * (F k / f k) * (f N / F N) = moebius_mu N * h N * (F k * f a * f N / (F N * f k))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f a * moebius_mu N * h N * (F k / f k) * (f N / F N) = moebius_mu N * h N * (F k * f a * f N / (F N * f k))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = moebius_mu N * h N * ((F k * f(a*N)) div (F N * f k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_mu N * h N * (F k * f a * f N / (F N * f k)) = moebius_mu N * h N * (F k * f (a * N) / (F N * f k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. moebius_mu N * h N * (F k * f a * f N / (F N * f k)) = moebius_mu N * h N * (F k * f (a * N) / (F N * f k))
[PROOF STEP]
have "f a * f N = f (a*N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a * f N = f (a * N)
[PROOF STEP]
proof (cases "a = 1 \<or> N = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 1 \<or> N = 1 \<Longrightarrow> f a * f N = f (a * N)
 2. \<not> (a = 1 \<or> N = 1) \<Longrightarrow> f a * f N = f (a * N)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = 1 \<or> N = 1

goal (2 subgoals):
 1. a = 1 \<or> N = 1 \<Longrightarrow> f a * f N = f (a * N)
 2. \<not> (a = 1 \<or> N = 1) \<Longrightarrow> f a * f N = f (a * N)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = 1 \<or> N = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = 1 \<or> N = 1

goal (1 subgoal):
 1. f a * f N = f (a * N)
[PROOF STEP]
using assms(4) completely_multiplicative_function_def[of f]
[PROOF STATE]
proof (prove)
using this:
a = 1 \<or> N = 1
completely_multiplicative_function f
completely_multiplicative_function f \<equiv> f 0 = 0 \<and> f (Suc 0) = 1 \<and> (\<forall>a b. 1 < a \<longrightarrow> 1 < b \<longrightarrow> f (a * b) = f a * f b)

goal (1 subgoal):
 1. f a * f N = f (a * N)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a * f N = f (a * N)

goal (1 subgoal):
 1. \<not> (a = 1 \<or> N = 1) \<Longrightarrow> f a * f N = f (a * N)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (a = 1 \<or> N = 1) \<Longrightarrow> f a * f N = f (a * N)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (a = 1 \<or> N = 1)

goal (1 subgoal):
 1. \<not> (a = 1 \<or> N = 1) \<Longrightarrow> f a * f N = f (a * N)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (a = 1 \<or> N = 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (a = 1 \<or> N = 1)

goal (1 subgoal):
 1. f a * f N = f (a * N)
[PROOF STEP]
using 2 assms(4) completely_multiplicative_function_def[of f]
             Ngr0 3
[PROOF STATE]
proof (prove)
using this:
\<not> (a = 1 \<or> N = 1)
k = a * N
completely_multiplicative_function f
completely_multiplicative_function f \<equiv> f 0 = 0 \<and> f (Suc 0) = 1 \<and> (\<forall>a b. 1 < a \<longrightarrow> 1 < b \<longrightarrow> f (a * b) = f a * f b)
0 < N
0 < a

goal (1 subgoal):
 1. f a * f N = f (a * N)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a * f N = f (a * N)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f a * f N = f (a * N)

goal (1 subgoal):
 1. moebius_mu N * h N * (F k * f a * f N / (F N * f k)) = moebius_mu N * h N * (F k * f (a * N) / (F N * f k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f a * f N = f (a * N)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f a * f N = f (a * N)

goal (1 subgoal):
 1. moebius_mu N * h N * (F k * f a * f N / (F N * f k)) = moebius_mu N * h N * (F k * f (a * N) / (F N * f k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * (F k * f a * f N / (F N * f k)) = moebius_mu N * h N * (F k * f (a * N) / (F N * f k))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * (F k * f a * f N / (F N * f k)) = moebius_mu N * h N * (F k * f (a * N) / (F N * f k))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * (F k * f a * f N / (F N * f k)) = moebius_mu N * h N * (F k * f (a * N) / (F N * f k))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = moebius_mu N * h N * ((F k * f(k)) div (F N * f k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_mu N * h N * (F k * f (a * N) / (F N * f k)) = moebius_mu N * h N * (F k * f k / (F N * f k))
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
k = a * N

goal (1 subgoal):
 1. moebius_mu N * h N * (F k * f (a * N) / (F N * f k)) = moebius_mu N * h N * (F k * f k / (F N * f k))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * (F k * f (a * N) / (F N * f k)) = moebius_mu N * h N * (F k * f k / (F N * f k))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * (F k * f (a * N) / (F N * f k)) = moebius_mu N * h N * (F k * f k / (F N * f k))

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = g(N) * (F k div F N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_mu N * h N * (F k * f k / (F N * f k)) = g N * (F k / F N)
[PROOF STEP]
using f_k_not_z g_def
[PROOF STATE]
proof (prove)
using this:
f k \<noteq> 0
g \<equiv> \<lambda>k. moebius_mu k * h k

goal (1 subgoal):
 1. moebius_mu N * h N * (F k * f k / (F N * f k)) = g N * (F k / F N)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * (F k * f k / (F N * f k)) = g N * (F k / F N)

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
moebius_mu N * h N * (F k * f k / (F N * f k)) = g N * (F k / F N)

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
have "\<dots> = (F(k)*g(N)) div (F(N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g N * (F k / F N) = F k * g N / F N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g N * (F k / F N) = F k * g N / F N

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
s f g k n = F k * g N / F N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
s f g k n = F k * g N / F N

goal (1 subgoal):
 1. s f g k n = F k * g N / F N
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s f g k n = F k * g N / F N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compute_less_pp[code]:
  "xs < (ys :: 'a :: linorder \<Rightarrow>\<^sub>0 'b :: {zero, linorder}) \<longleftrightarrow>
    (\<exists>i\<in>keys xs \<union> keys ys. lookup xs i < lookup ys i \<and>
    (\<forall>j\<in>keys xs \<union> keys ys. j < i \<longrightarrow> lookup xs j = lookup ys j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs < ys) = (\<exists>i\<in>keys xs \<union> keys ys. lookup xs i < lookup ys i \<and> (\<forall>j\<in>keys xs \<union> keys ys. j < i \<longrightarrow> lookup xs j = lookup ys j))
[PROOF STEP]
proof transfer
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>finite {x. xs x \<noteq> (0::'b)}; finite {x. ys x \<noteq> (0::'b)}\<rbrakk> \<Longrightarrow> less_fun xs ys = (\<exists>i\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. xs i < ys i \<and> (\<forall>j\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. j < i \<longrightarrow> xs j = ys j))
[PROOF STEP]
fix f g :: "'a \<Rightarrow> 'b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>finite {x. xs x \<noteq> (0::'b)}; finite {x. ys x \<noteq> (0::'b)}\<rbrakk> \<Longrightarrow> less_fun xs ys = (\<exists>i\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. xs i < ys i \<and> (\<forall>j\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. j < i \<longrightarrow> xs j = ys j))
[PROOF STEP]
let ?dom = "{i. f i \<noteq> 0} \<union> {i. g i \<noteq> 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>finite {x. xs x \<noteq> (0::'b)}; finite {x. ys x \<noteq> (0::'b)}\<rbrakk> \<Longrightarrow> less_fun xs ys = (\<exists>i\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. xs i < ys i \<and> (\<forall>j\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. j < i \<longrightarrow> xs j = ys j))
[PROOF STEP]
have "less_fun f g \<longleftrightarrow> (\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. less_fun f g = (\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k'))
[PROOF STEP]
unfolding less_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k')) = (\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k'))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
less_fun f g = (\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k'))

goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>finite {x. xs x \<noteq> (0::'b)}; finite {x. ys x \<noteq> (0::'b)}\<rbrakk> \<Longrightarrow> less_fun xs ys = (\<exists>i\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. xs i < ys i \<and> (\<forall>j\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. j < i \<longrightarrow> xs j = ys j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
less_fun f g = (\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k'))

goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>finite {x. xs x \<noteq> (0::'b)}; finite {x. ys x \<noteq> (0::'b)}\<rbrakk> \<Longrightarrow> less_fun xs ys = (\<exists>i\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. xs i < ys i \<and> (\<forall>j\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. j < i \<longrightarrow> xs j = ys j))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>i. f i < g i \<and> (i \<in> ?dom \<and> (\<forall>j\<in>?dom. j < i \<longrightarrow> f j = g j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k')) = (\<exists>i. f i < g i \<and> i \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))
[PROOF STEP]
proof (intro iff_exI conj_cong refl)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
assume "f k < g k"
[PROOF STATE]
proof (state)
this:
f k < g k

goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
hence k: "k \<in> ?dom"
[PROOF STATE]
proof (prove)
using this:
f k < g k

goal (1 subgoal):
 1. k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}

goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
have "(\<forall>k'<k. f k' = g k') = (\<forall>k'\<in>{..<k}. f k' = g k')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k'<k. f k' = g k') = (\<forall>k'\<in>{..<k}. f k' = g k')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>k'<k. f k' = g k') = (\<forall>k'\<in>{..<k}. f k' = g k')

goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k'<k. f k' = g k') = (\<forall>k'\<in>{..<k}. f k' = g k')

goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>j\<in>({k. f k \<noteq> 0} \<union> {k. g k \<noteq> 0}) \<inter> {..<k}. f j = g j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k'\<in>{..<k}. f k' = g k') = (\<forall>j\<in>({k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}) \<inter> {..<k}. f j = g j)
[PROOF STEP]
by (intro Ball_subset_right) auto
[PROOF STATE]
proof (state)
this:
(\<forall>k'\<in>{..<k}. f k' = g k') = (\<forall>j\<in>({k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}) \<inter> {..<k}. f j = g j)

goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k'\<in>{..<k}. f k' = g k') = (\<forall>j\<in>({k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}) \<inter> {..<k}. f j = g j)

goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>j\<in>({k. f k \<noteq> 0} \<union> {k. g k \<noteq> 0}). j < k \<longrightarrow> f j = g j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<in>({k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}) \<inter> {..<k}. f j = g j) = (\<forall>j\<in>{k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>j\<in>({k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}) \<inter> {..<k}. f j = g j) = (\<forall>j\<in>{k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j)

goal (1 subgoal):
 1. \<And>k. f k < g k \<Longrightarrow> (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<forall>k'<k. f k' = g k') = (\<forall>j\<in>{k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j)
[PROOF STEP]
show "(\<forall>k'<k. f k' = g k') \<longleftrightarrow> k \<in> ?dom \<and> (\<forall>j\<in>?dom. j < k \<longrightarrow> f j = g j)"
[PROOF STATE]
proof (prove)
using this:
(\<forall>k'<k. f k' = g k') = (\<forall>j\<in>{k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j)

goal (1 subgoal):
 1. (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
(\<forall>k'<k. f k' = g k') = (\<forall>j\<in>{k. f k \<noteq> (0::'b)} \<union> {k. g k \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j)
k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}

goal (1 subgoal):
 1. (\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<forall>k'<k. f k' = g k') = (k \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < k \<longrightarrow> f j = g j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k')) = (\<exists>i. f i < g i \<and> i \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))

goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>finite {x. xs x \<noteq> (0::'b)}; finite {x. ys x \<noteq> (0::'b)}\<rbrakk> \<Longrightarrow> less_fun xs ys = (\<exists>i\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. xs i < ys i \<and> (\<forall>j\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. j < i \<longrightarrow> xs j = ys j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>k. f k < g k \<and> (\<forall>k'<k. f k' = g k')) = (\<exists>i. f i < g i \<and> i \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))

goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>finite {x. xs x \<noteq> (0::'b)}; finite {x. ys x \<noteq> (0::'b)}\<rbrakk> \<Longrightarrow> less_fun xs ys = (\<exists>i\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. xs i < ys i \<and> (\<forall>j\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. j < i \<longrightarrow> xs j = ys j))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>i\<in>?dom. f i < g i \<and> (\<forall>j\<in>?dom. j < i \<longrightarrow> f j = g j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>i. f i < g i \<and> i \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j)) = (\<exists>i\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. f i < g i \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))
[PROOF STEP]
by (simp add: Bex_def conj_ac)
[PROOF STATE]
proof (state)
this:
(\<exists>i. f i < g i \<and> i \<in> {i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)} \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j)) = (\<exists>i\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. f i < g i \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))

goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>finite {x. xs x \<noteq> (0::'b)}; finite {x. ys x \<noteq> (0::'b)}\<rbrakk> \<Longrightarrow> less_fun xs ys = (\<exists>i\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. xs i < ys i \<and> (\<forall>j\<in>{k. xs k \<noteq> (0::'b)} \<union> {k. ys k \<noteq> (0::'b)}. j < i \<longrightarrow> xs j = ys j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
less_fun f g = (\<exists>i\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. f i < g i \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))
[PROOF STEP]
show "less_fun f g \<longleftrightarrow> (\<exists>i\<in>?dom. f i < g i \<and> (\<forall>j\<in>?dom. j < i \<longrightarrow> f j = g j))"
[PROOF STATE]
proof (prove)
using this:
less_fun f g = (\<exists>i\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. f i < g i \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))

goal (1 subgoal):
 1. less_fun f g = (\<exists>i\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. f i < g i \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
less_fun f g = (\<exists>i\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. f i < g i \<and> (\<forall>j\<in>{i. f i \<noteq> (0::'b)} \<union> {i. g i \<noteq> (0::'b)}. j < i \<longrightarrow> f j = g j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma affine_hull_insert_subset_span:
  "affine hull (insert a S) \<subseteq> {a + v| v . v \<in> span {x - a | x . x \<in> S}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull insert a S \<subseteq> {a + v |v. v \<in> span {x - a |x. x \<in> S}}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine hull insert a S \<subseteq> {a + v |v. v \<in> span {x - a |x. x \<in> S}}
[PROOF STEP]
have "\<exists>v T u. x = a + v \<and> (finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v)"
    if "finite F" "F \<noteq> {}" "F \<subseteq> insert a S" "sum u F = 1" "(\<Sum>v\<in>F. u v *\<^sub>R v) = x"
    for x F u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v T u. x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>v T u. x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v
[PROOF STEP]
have *: "(\<lambda>x. x - a) ` (F - {a}) \<subseteq> {x - a |x. x \<in> S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x - a) ` (F - {a}) \<subseteq> {x - a |x. x \<in> S}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
finite F
F \<noteq> {}
F \<subseteq> insert a S
sum u F = 1
(\<Sum>v\<in>F. u v *\<^sub>R v) = x

goal (1 subgoal):
 1. (\<lambda>x. x - a) ` (F - {a}) \<subseteq> {x - a |x. x \<in> S}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x - a) ` (F - {a}) \<subseteq> {x - a |x. x \<in> S}

goal (1 subgoal):
 1. \<exists>v T u. x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v T u. x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. x = a + ?v
 2. finite ?T1
 3. ?T1 \<subseteq> {x - a |x. x \<in> S}
 4. (\<Sum>v\<in>?T1. ?u2 v *\<^sub>R v) = ?v
[PROOF STEP]
show "finite ((\<lambda>x. x - a) ` (F - {a}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>x. x - a) ` (F - {a}))
[PROOF STEP]
by (simp add: that(1))
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>x. x - a) ` (F - {a}))

goal (3 subgoals):
 1. x = a + ?v
 2. (\<lambda>x. x - a) ` (F - {a}) \<subseteq> {x - a |x. x \<in> S}
 3. (\<Sum>v\<in>(\<lambda>x. x - a) ` (F - {a}). ?u2 v *\<^sub>R v) = ?v
[PROOF STEP]
show "(\<Sum>v\<in>(\<lambda>x. x - a) ` (F - {a}). u(v+a) *\<^sub>R v) = x-a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>(\<lambda>x. x - a) ` (F - {a}). u (v + a) *\<^sub>R v) = x - a
[PROOF STEP]
by (simp add: sum.reindex[unfolded inj_on_def] algebra_simps
            sum_subtractf scaleR_left.sum[symmetric] sum_diff1 that)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>(\<lambda>x. x - a) ` (F - {a}). u (v + a) *\<^sub>R v) = x - a

goal (2 subgoals):
 1. x = a + (x - a)
 2. (\<lambda>x. x - a) ` (F - {a}) \<subseteq> {x - a |x. x \<in> S}
[PROOF STEP]
qed (use \<open>F \<subseteq> insert a S\<close> in auto)
[PROOF STATE]
proof (state)
this:
\<exists>v T u. x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>finite ?F; ?F \<noteq> {}; ?F \<subseteq> insert a S; sum ?u ?F = 1; (\<Sum>v\<in>?F. ?u v *\<^sub>R v) = ?x\<rbrakk> \<Longrightarrow> \<exists>v T u. ?x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v

goal (1 subgoal):
 1. affine hull insert a S \<subseteq> {a + v |v. v \<in> span {x - a |x. x \<in> S}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite ?F; ?F \<noteq> {}; ?F \<subseteq> insert a S; sum ?u ?F = 1; (\<Sum>v\<in>?F. ?u v *\<^sub>R v) = ?x\<rbrakk> \<Longrightarrow> \<exists>v T u. ?x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?F; ?F \<noteq> {}; ?F \<subseteq> insert a S; sum ?u ?F = 1; (\<Sum>v\<in>?F. ?u v *\<^sub>R v) = ?x\<rbrakk> \<Longrightarrow> \<exists>v T u. ?x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v

goal (1 subgoal):
 1. affine hull insert a S \<subseteq> {a + v |v. v \<in> span {x - a |x. x \<in> S}}
[PROOF STEP]
unfolding affine_hull_explicit span_explicit
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?F; ?F \<noteq> {}; ?F \<subseteq> insert a S; sum ?u ?F = 1; (\<Sum>v\<in>?F. ?u v *\<^sub>R v) = ?x\<rbrakk> \<Longrightarrow> \<exists>v T u. ?x = a + v \<and> finite T \<and> T \<subseteq> {x - a |x. x \<in> S} \<and> (\<Sum>v\<in>T. u v *\<^sub>R v) = v

goal (1 subgoal):
 1. {y. \<exists>Sa u. finite Sa \<and> Sa \<noteq> {} \<and> Sa \<subseteq> insert a S \<and> sum u Sa = 1 \<and> (\<Sum>v\<in>Sa. u v *\<^sub>R v) = y} \<subseteq> {a + v |v. v \<in> {\<Sum>a\<in>t. r a *\<^sub>R a |t r. finite t \<and> t \<subseteq> {x - a |x. x \<in> S}}}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
affine hull insert a S \<subseteq> {a + v |v. v \<in> span {x - a |x. x \<in> S}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ate_arev[simp]:
    assumes "a \<in> arcs G" shows "arc_to_ends G (arev a) = prod.swap (arc_to_ends G a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arc_to_ends G (arev a) = prod.swap (arc_to_ends G a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> arcs G

goal (1 subgoal):
 1. arc_to_ends G (arev a) = prod.swap (arc_to_ends G a)
[PROOF STEP]
by (auto simp: arc_to_ends_def)


[STATEMENT]
lemma carrier_Characters: "carrier (Characters G) = characters G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (Characters G) = characters G
[PROOF STEP]
by (simp add: Characters_def)


[STATEMENT]
lemma integrable_\<phi>: "integrable lborel (\<phi> p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable lborel (\<phi> p)
[PROOF STEP]
proof (induct p)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. integrable lborel (\<phi> (a, b))
[PROOF STEP]
case (Pair l i)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>a b. integrable lborel (\<phi> (a, b))
[PROOF STEP]
have "integrable lborel (\<lambda>x. indicator {real_of_int (i - 1) / 2^(l + 1) .. real_of_int (i + 1) / 2^(l + 1)} x *\<^sub>R \<phi> (l, i) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable lborel (\<lambda>x. indicat_real {real_of_int (i - 1) / 2 ^ (l + 1)..real_of_int (i + 1) / 2 ^ (l + 1)} x *\<^sub>R \<phi> (l, i) x)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable lborel (\<lambda>x. indicat_real {real_of_int (i - 1) / 2 ^ (l + 1)..real_of_int (i + 1) / 2 ^ (l + 1)} x *\<^sub>R (case (l, i) of (l, i) \<Rightarrow> \<lambda>x. max 0 (1 - \<bar>x * 2 ^ (l + 1) - real_of_int i\<bar>)) x)
[PROOF STEP]
by (intro borel_integrable_compact) (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
integrable lborel (\<lambda>x. indicat_real {real_of_int (i - 1) / 2 ^ (l + 1)..real_of_int (i + 1) / 2 ^ (l + 1)} x *\<^sub>R \<phi> (l, i) x)

goal (1 subgoal):
 1. \<And>a b. integrable lborel (\<phi> (a, b))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable lborel (\<lambda>x. indicat_real {real_of_int (i - 1) / 2 ^ (l + 1)..real_of_int (i + 1) / 2 ^ (l + 1)} x *\<^sub>R \<phi> (l, i) x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
integrable lborel (\<lambda>x. indicat_real {real_of_int (i - 1) / 2 ^ (l + 1)..real_of_int (i + 1) / 2 ^ (l + 1)} x *\<^sub>R \<phi> (l, i) x)

goal (1 subgoal):
 1. integrable lborel (\<phi> (l, i))
[PROOF STEP]
by (rule Bochner_Integration.integrable_cong[THEN iffD1, rotated -1]) (auto simp: \<phi>_zero_iff)
[PROOF STATE]
proof (state)
this:
integrable lborel (\<phi> (l, i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zgcd_gt1:
  "\<bar>i\<bar> > 1 \<and> \<bar>j\<bar> > 1 \<or> \<bar>i\<bar> = 0 \<and> \<bar>j\<bar> > 1 \<or> \<bar>i\<bar> > 1 \<and> \<bar>j\<bar> = 0"
  if "gcd i j > 1" for i j :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < \<bar>i\<bar> \<and> 1 < \<bar>j\<bar> \<or> \<bar>i\<bar> = 0 \<and> 1 < \<bar>j\<bar> \<or> 1 < \<bar>i\<bar> \<and> \<bar>j\<bar> = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < \<bar>i\<bar> \<and> 1 < \<bar>j\<bar> \<or> \<bar>i\<bar> = 0 \<and> 1 < \<bar>j\<bar> \<or> 1 < \<bar>i\<bar> \<and> \<bar>j\<bar> = 0
[PROOF STEP]
have "\<bar>k\<bar> \<le> 1 \<longleftrightarrow> k = - 1 \<or> k = 0 \<or> k = 1" for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>k\<bar> \<le> 1) = (k = - 1 \<or> k = 0 \<or> k = 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<bar>?k\<bar> \<le> 1) = (?k = - 1 \<or> ?k = 0 \<or> ?k = 1)

goal (1 subgoal):
 1. 1 < \<bar>i\<bar> \<and> 1 < \<bar>j\<bar> \<or> \<bar>i\<bar> = 0 \<and> 1 < \<bar>j\<bar> \<or> 1 < \<bar>i\<bar> \<and> \<bar>j\<bar> = 0
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
1 < gcd i j
(\<bar>?k\<bar> \<le> 1) = (?k = - 1 \<or> ?k = 0 \<or> ?k = 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 < gcd i j
(\<bar>?k\<bar> \<le> 1) = (?k = - 1 \<or> ?k = 0 \<or> ?k = 1)

goal (1 subgoal):
 1. 1 < \<bar>i\<bar> \<and> 1 < \<bar>j\<bar> \<or> \<bar>i\<bar> = 0 \<and> 1 < \<bar>j\<bar> \<or> 1 < \<bar>i\<bar> \<and> \<bar>j\<bar> = 0
[PROOF STEP]
by (auto simp add: not_less)
[PROOF STATE]
proof (state)
this:
1 < \<bar>i\<bar> \<and> 1 < \<bar>j\<bar> \<or> \<bar>i\<bar> = 0 \<and> 1 < \<bar>j\<bar> \<or> 1 < \<bar>i\<bar> \<and> \<bar>j\<bar> = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_eq:
   "sin x = sin y \<longleftrightarrow> (\<exists>n \<in> \<int>. x = y + 2*n*pi \<or> x = -y + (2*n + 1)*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin x = sin y) = (\<exists>n\<in>\<int>. x = y + 2 * n * pi \<or> x = - y + (2 * n + 1) * pi)
[PROOF STEP]
using complex_sin_eq [of x y]
[PROOF STATE]
proof (prove)
using this:
(sin (complex_of_real x) = sin (complex_of_real y)) = (\<exists>n\<in>\<int>. complex_of_real x = complex_of_real y + complex_of_real (2 * n * pi) \<or> complex_of_real x = - complex_of_real y + complex_of_real ((2 * n + 1) * pi))

goal (1 subgoal):
 1. (sin x = sin y) = (\<exists>n\<in>\<int>. x = y + 2 * n * pi \<or> x = - y + (2 * n + 1) * pi)
[PROOF STEP]
by (simp only: sin_of_real Re_complex_of_real of_real_add [symmetric] of_real_minus [symmetric] of_real_mult [symmetric] of_real_eq_iff)


[STATEMENT]
lemma ChiPlus_ChiStar [simp]:
  "\<lbrakk> (S,T) \<in> ChiPlus A  \<rbrakk> \<Longrightarrow> (S,T) \<in> ChiStar A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S, T) \<in> ChiPlus A \<Longrightarrow> (S, T) \<in> ChiStar A
[PROOF STEP]
by (unfold ChiPlus_def ChiStar_def, auto)


[STATEMENT]
lemma iterm_to_fterm_subt: "(iterm_to_fterm t1) \<cdot>\<^sub>t \<sigma> = iterm_to_fterm (t1 \<cdot> (\<lambda>x. fterm_to_iterm (\<sigma> x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iterm_to_fterm t1 \<cdot>\<^sub>t \<sigma> = iterm_to_fterm (t1 \<cdot> (\<lambda>x. fterm_to_iterm (\<sigma> x)))
[PROOF STEP]
by (induction t1) auto


[STATEMENT]
lemma (in group) inj_on_g':
    "\<lbrakk>H \<subseteq> carrier G;  a \<in> carrier G\<rbrakk> \<Longrightarrow> inj_on (\<lambda>y. a \<otimes> y) H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier G; a \<in> carrier G\<rbrakk> \<Longrightarrow> inj_on ((\<otimes>) a) H
[PROOF STEP]
by (force simp add: inj_on_def subsetD)


[STATEMENT]
lemma word_less_imp_diff_less:
  fixes n :: "'a::len word"
  shows "\<lbrakk>k \<le> n; n < m\<rbrakk> \<Longrightarrow> n - k < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<le> n; n < m\<rbrakk> \<Longrightarrow> n - k < m
[PROOF STEP]
by (clarsimp simp: unat_sub word_less_nat_alt
             intro!: less_imp_diff_less)


[STATEMENT]
lemma "\<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>
[PROOF STEP]
have "m = n \<longrightarrow> m + 1 \<noteq> n" for m n :: nat
      \<comment> \<open>inclusion of assertions expressed in ``pure'' logic,\<close>
      \<comment> \<open>without mentioning the state space\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = n \<longrightarrow> m + 1 \<noteq> n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?m = ?n \<longrightarrow> ?m + 1 \<noteq> ?n

goal (1 subgoal):
 1. \<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
?m = ?n \<longrightarrow> ?m + 1 \<noteq> ?n

goal (1 subgoal):
 1. \<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>
[PROOF STEP]
have "\<turnstile> \<lbrace>\<acute>M + 1 \<noteq> \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<lbrace>\<acute>M + 1 \<noteq> \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>
[PROOF STEP]
by hoare
[PROOF STATE]
proof (state)
this:
\<turnstile> \<lbrace>\<acute>M + 1 \<noteq> \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>

goal (1 subgoal):
 1. \<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>

goal (1 subgoal):
 1. \<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<turnstile> \<lbrace>\<acute>M = \<acute>N\<rbrace> \<acute>M := \<acute>M + 1 \<lbrace>\<acute>M \<noteq> \<acute>N\<rbrace>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Corps) val1_neq_0:"\<lbrakk>valuation K v; x \<in> carrier K; v x = 1\<rbrakk> \<Longrightarrow>
                                         x \<noteq> \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; x \<in> carrier K; v x = 1\<rbrakk> \<Longrightarrow> x \<noteq> \<zero>
[PROOF STEP]
apply (rule contrapos_pp, simp+, simp add:value_of_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; \<zero> \<in> carrier K; \<infinity> = 1; x = \<zero>\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (simp only:ant_1[THEN sym], cut_tac z_neq_inf[THEN not_sym, of 1], simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dlist_eq_set_eq: "Dlist.dlist_eq xs ys \<Longrightarrow> set xs = set ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dlist.dlist_eq xs ys \<Longrightarrow> set xs = set ys
[PROOF STEP]
by(simp add: Dlist.dlist_eq_def vimage2p_def)(metis set_remdups)


[STATEMENT]
lemma cf_rcomp_ObjMap_vrange:
  assumes "category \<alpha> \<BB>"
    and "\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "\<SS> : \<BB> \<times>\<^sub>C \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \
"
  shows "\<R>\<^sub>\<circ> (cf_rcomp \<BB> \<SS> \<GG>\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \
\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (cf_rcomp \<BB> \<SS> \<GG>\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \
\<lparr>Obj\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<BB>
\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
\<SS> : \<BB> \<times>\<^sub>C \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (cf_rcomp \<BB> \<SS> \<GG>\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \
\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cf_rcomp_def
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<BB>
\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
\<SS> : \<BB> \<times>\<^sub>C \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (cf_bcomp \<SS> (dghm_id \<BB>) \<GG>\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \
\<lparr>Obj\<rparr>
[PROOF STEP]
by (intro cf_bcomp_ObjMap_vrange) (cs_concl cs_intro: cat_cs_intros)+


[STATEMENT]
lemma is_isolated_vertex_edge: "is_isolated_vertex v \<Longrightarrow> (\<And> e. e \<in> E \<Longrightarrow> \<not> (incident v e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_isolated_vertex v \<Longrightarrow> (\<And>e. e \<in> E \<Longrightarrow> \<not> incident v e)
[PROOF STEP]
unfolding is_isolated_vertex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> V \<and> (\<forall>u\<in>V. \<not> vert_adj u v) \<Longrightarrow> (\<And>e. e \<in> E \<Longrightarrow> \<not> incident v e)
[PROOF STEP]
by (metis (full_types) all_not_in_conv incident_def insert_absorb insert_iff mk_disjoint_insert
      vert_adj_def vert_adj_edge_iff2 vert_adj_imp_inV)


[STATEMENT]
lemma order_fixate_self [simp]:
  "order (fixate a f) a = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (fixate a f) a = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. order (fixate a f) a = 1
[PROOF STEP]
have "card (orbit (fixate a f) a) = card {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (orbit (fixate a f) a) = card {a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (orbit (fixate a f) a) = card {a}

goal (1 subgoal):
 1. order (fixate a f) a = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (orbit (fixate a f) a) = card {a}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (orbit (fixate a f) a) = card {a}

goal (1 subgoal):
 1. order (fixate a f) a = 1
[PROOF STEP]
by (simp only: card_orbit_eq) simp
[PROOF STATE]
proof (state)
this:
order (fixate a f) a = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma e_if_intro[intro]: "\<lbrakk> VNat n \<in> E e1 \<rho>; n = 0 \<longrightarrow> v \<in> E e3 \<rho>; n \<noteq> 0 \<longrightarrow> v \<in> E e2 \<rho> \<rbrakk>
    \<Longrightarrow> v \<in> E (EIf e1 e2 e3) \<rho>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>VNat n \<in> E e1 \<rho>; n = 0 \<longrightarrow> v \<in> E e3 \<rho>; n \<noteq> 0 \<longrightarrow> v \<in> E e2 \<rho>\<rbrakk> \<Longrightarrow> v \<in> E (EIf e1 e2 e3) \<rho>
[PROOF STEP]
by auto