[STATEMENT]
lemma residue_mult_group_kernel_partition:
  fixes m n :: nat and f :: "nat \<Rightarrow> nat" and G H
  defines "G \<equiv> residue_mult_group n"
  defines "H \<equiv> residue_mult_group m"
  defines "f \<equiv> (\<lambda>k. k mod m)"
  assumes "m > 1" "n > 0" "m dvd n"
  shows "partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)"
        and "card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m"
        and "card (kernel G H f) = totient n div totient m"
        and "b \<in>(rcosets\<^bsub>G\<^esub> kernel G H f) \<Longrightarrow> b \<noteq> {}"
        and "b \<in>(rcosets\<^bsub>G\<^esub> kernel G H f) \<Longrightarrow> card (kernel G H f) = card b"
        and "bij_betw (\<lambda>b. (the_elem (f ` b))) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f) &&& card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m &&& card (kernel G H f) = totient n div totient m) &&& (b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}) &&& (b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b) &&& bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
have "1 < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < m
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
1 < m

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 < m

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
have "m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n
[PROOF STEP]
using \<open>n > 0\<close> \<open>m dvd n\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n
m dvd n

goal (1 subgoal):
 1. m \<le> n
[PROOF STEP]
by (intro dvd_imp_le) auto
[PROOF STATE]
proof (state)
this:
m \<le> n

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 < n
[PROOF STEP]
have "n > 1"
[PROOF STATE]
proof (prove)
using this:
1 < n

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

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
note mn = \<open>m > 1\<close> \<open>n > 1\<close> \<open>m dvd n\<close> \<open>m \<le> n\<close>
[PROOF STATE]
proof (state)
this:
1 < m
1 < n
m dvd n
m \<le> n

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
interpret n: residues_nat n G
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residues_nat n &&& G \<equiv> residue_mult_group n
[PROOF STEP]
using mn
[PROOF STATE]
proof (prove)
using this:
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. residues_nat n &&& G \<equiv> residue_mult_group n
[PROOF STEP]
by unfold_locales (auto simp: assms)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
interpret m: residues_nat m H
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residues_nat m &&& H \<equiv> residue_mult_group m
[PROOF STEP]
using mn
[PROOF STATE]
proof (prove)
using this:
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. residues_nat m &&& H \<equiv> residue_mult_group m
[PROOF STEP]
by unfold_locales (auto simp: assms)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
from mn
[PROOF STATE]
proof (chain)
picking this:
1 < m
1 < n
m dvd n
m \<le> n
[PROOF STEP]
have subset: "f ` carrier G \<subseteq> carrier H"
[PROOF STATE]
proof (prove)
using this:
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. f ` carrier G \<subseteq> carrier H
[PROOF STEP]
by (auto simp: assms(1-3) residue_mult_group_def totatives_def
             dest: coprime_common_divisor_nat intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
f ` carrier G \<subseteq> carrier H

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f ` carrier G \<subseteq> carrier H

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
have super_set: "carrier H \<subseteq> f ` carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier H \<subseteq> f ` carrier G
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
assume "k \<in> carrier H"
[PROOF STATE]
proof (state)
this:
k \<in> carrier H

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
hence k: "k > 0" "k \<le> m" "coprime k m"
[PROOF STATE]
proof (prove)
using this:
k \<in> carrier H

goal (1 subgoal):
 1. 0 < k &&& k \<le> m &&& coprime k m
[PROOF STEP]
by (auto simp: assms(2) residue_mult_group_def totatives_def)
[PROOF STATE]
proof (state)
this:
0 < k
k \<le> m
coprime k m

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
from mn \<open>k \<in> carrier H\<close>
[PROOF STATE]
proof (chain)
picking this:
1 < m
1 < n
m dvd n
m \<le> n
k \<in> carrier H
[PROOF STEP]
have "k < m"
[PROOF STATE]
proof (prove)
using this:
1 < m
1 < n
m dvd n
m \<le> n
k \<in> carrier H

goal (1 subgoal):
 1. k < m
[PROOF STEP]
by (simp add: totatives_less assms(2) residue_mult_group_def)
[PROOF STATE]
proof (state)
this:
k < m

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
define P where "P = {p \<in> prime_factors n. \<not>(p dvd m)}"
[PROOF STATE]
proof (state)
this:
P = {p. p \<in># prime_factorization n \<and> \<not> p dvd m}

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
define a where "a = \<Prod>P"
[PROOF STATE]
proof (state)
this:
a = \<Prod>P

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
have [simp]: "a \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0
[PROOF STEP]
by (auto simp: P_def a_def intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
have [simp]: "prime_factors a = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors a = P
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factors a = P
[PROOF STEP]
have "prime_factors a = set_mset (sum prime_factorization P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors a = set_mset (sum prime_factorization P)
[PROOF STEP]
unfolding a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors (\<Prod>P) = set_mset (sum prime_factorization P)
[PROOF STEP]
using mn
[PROOF STATE]
proof (prove)
using this:
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. prime_factors (\<Prod>P) = set_mset (sum prime_factorization P)
[PROOF STEP]
by (subst prime_factorization_prod)
           (auto simp: P_def prime_factors_dvd prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
prime_factors a = set_mset (sum prime_factorization P)

goal (1 subgoal):
 1. prime_factors a = P
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factors a = set_mset (sum prime_factorization P)

goal (1 subgoal):
 1. prime_factors a = P
[PROOF STEP]
have "sum prime_factorization P = (\<Sum>p\<in>P. {#p#})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum prime_factorization P = (\<Sum>p\<in>P. {#p#})
[PROOF STEP]
using mn
[PROOF STATE]
proof (prove)
using this:
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. sum prime_factorization P = (\<Sum>p\<in>P. {#p#})
[PROOF STEP]
by (intro sum.cong) (auto simp: P_def prime_factorization_prime prime_factors_dvd)
[PROOF STATE]
proof (state)
this:
sum prime_factorization P = (\<Sum>p\<in>P. {#p#})

goal (1 subgoal):
 1. prime_factors a = P
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prime_factors a = set_mset (\<Sum>p\<in>P. {#p#})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prime_factors a = set_mset (\<Sum>p\<in>P. {#p#})

goal (1 subgoal):
 1. prime_factors a = P
[PROOF STEP]
by (simp add: P_def)
[PROOF STATE]
proof (state)
this:
prime_factors a = P

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prime_factors a = P

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
from mn
[PROOF STATE]
proof (chain)
picking this:
1 < m
1 < n
m dvd n
m \<le> n
[PROOF STEP]
have "coprime m a"
[PROOF STATE]
proof (prove)
using this:
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. coprime m a
[PROOF STEP]
by (subst coprime_iff_prime_factors_disjoint) (auto simp: P_def)
[PROOF STATE]
proof (state)
this:
coprime m a

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
hence "\<exists>x. [x = k] (mod m) \<and> [x = 1] (mod a)"
[PROOF STATE]
proof (prove)
using this:
coprime m a

goal (1 subgoal):
 1. \<exists>x. [x = k] (mod m) \<and> [x = 1] (mod a)
[PROOF STEP]
by (intro binary_chinese_remainder_nat)
[PROOF STATE]
proof (state)
this:
\<exists>x. [x = k] (mod m) \<and> [x = 1] (mod a)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. [x = k] (mod m) \<and> [x = 1] (mod a)
[PROOF STEP]
obtain x where x: "[x = k] (mod m)" "[x = 1] (mod a)"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. [x = k] (mod m) \<and> [x = 1] (mod a)

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>[x = k] (mod m); [x = 1] (mod a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[x = k] (mod m)
[x = 1] (mod a)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
from x(1) mn k
[PROOF STATE]
proof (chain)
picking this:
[x = k] (mod m)
1 < m
1 < n
m dvd n
m \<le> n
0 < k
k \<le> m
coprime k m
[PROOF STEP]
have [simp]: "x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
[x = k] (mod m)
1 < m
1 < n
m dvd n
m \<le> n
0 < k
k \<le> m
coprime k m

goal (1 subgoal):
 1. x \<noteq> 0
[PROOF STEP]
using coprime_common_divisor[of k m]
[PROOF STATE]
proof (prove)
using this:
[x = k] (mod m)
1 < m
1 < n
m dvd n
m \<le> n
0 < k
k \<le> m
coprime k m
\<lbrakk>coprime k m; ?c dvd k; ?c dvd m\<rbrakk> \<Longrightarrow> is_unit ?c

goal (1 subgoal):
 1. x \<noteq> 0
[PROOF STEP]
by (auto intro!: Nat.gr0I simp: cong_def)
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
from x(2)
[PROOF STATE]
proof (chain)
picking this:
[x = 1] (mod a)
[PROOF STEP]
have "coprime x a"
[PROOF STATE]
proof (prove)
using this:
[x = 1] (mod a)

goal (1 subgoal):
 1. coprime x a
[PROOF STEP]
using cong_imp_coprime cong_sym
[PROOF STATE]
proof (prove)
using this:
[x = 1] (mod a)
\<lbrakk>[?a = ?b] (mod ?m); coprime ?a ?m\<rbrakk> \<Longrightarrow> coprime ?b ?m
[?b = ?c] (mod ?a) \<Longrightarrow> [?c = ?b] (mod ?a)

goal (1 subgoal):
 1. coprime x a
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
coprime x a

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
hence "coprime x (a * m)"
[PROOF STATE]
proof (prove)
using this:
coprime x a

goal (1 subgoal):
 1. coprime x (a * m)
[PROOF STEP]
using k cong_imp_coprime[OF cong_sym[OF x(1)]]
[PROOF STATE]
proof (prove)
using this:
coprime x a
0 < k
k \<le> m
coprime k m
coprime k m \<Longrightarrow> coprime x m

goal (1 subgoal):
 1. coprime x (a * m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime x (a * m)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coprime x (a * m)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
have "?this \<longleftrightarrow> coprime x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime x (a * m) = coprime x n
[PROOF STEP]
using mn
[PROOF STATE]
proof (prove)
using this:
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. coprime x (a * m) = coprime x n
[PROOF STEP]
by (intro coprime_cong_prime_factors)
         (auto simp: prime_factors_product P_def in_prime_factors_iff)
[PROOF STATE]
proof (state)
this:
coprime x (a * m) = coprime x n

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coprime x n
[PROOF STEP]
have "x mod n \<in> totatives n"
[PROOF STATE]
proof (prove)
using this:
coprime x n

goal (1 subgoal):
 1. x mod n \<in> totatives n
[PROOF STEP]
using mn
[PROOF STATE]
proof (prove)
using this:
coprime x n
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. x mod n \<in> totatives n
[PROOF STEP]
by (auto simp: totatives_def intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
x mod n \<in> totatives n

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x mod n \<in> totatives n

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
have "f (x mod n) = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (x mod n) = k
[PROOF STEP]
using x(1) k mn \<open>k < m\<close>
[PROOF STATE]
proof (prove)
using this:
[x = k] (mod m)
0 < k
k \<le> m
coprime k m
1 < m
1 < n
m dvd n
m \<le> n
k < m

goal (1 subgoal):
 1. f (x mod n) = k
[PROOF STEP]
by (auto simp: assms(3) cong_def mod_mod_cancel)
[PROOF STATE]
proof (state)
this:
f (x mod n) = k

goal (1 subgoal):
 1. \<And>x. x \<in> carrier H \<Longrightarrow> x \<in> f ` carrier G
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x mod n \<in> totatives n
f (x mod n) = k
[PROOF STEP]
show "k \<in> f ` carrier G"
[PROOF STATE]
proof (prove)
using this:
x mod n \<in> totatives n
f (x mod n) = k

goal (1 subgoal):
 1. k \<in> f ` carrier G
[PROOF STEP]
by (auto simp: assms(1) residue_mult_group_def)
[PROOF STATE]
proof (state)
this:
k \<in> f ` carrier G

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
carrier H \<subseteq> f ` carrier G

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f ` carrier G \<subseteq> carrier H
carrier H \<subseteq> f ` carrier G
[PROOF STEP]
have image_eq: "f ` carrier G = carrier H"
[PROOF STATE]
proof (prove)
using this:
f ` carrier G \<subseteq> carrier H
carrier H \<subseteq> f ` carrier G

goal (1 subgoal):
 1. f ` carrier G = carrier H
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` carrier G = carrier H

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
have [simp]: "f (k \<otimes>\<^bsub>G\<^esub> l) = f k \<otimes>\<^bsub>H\<^esub> f l" if "k \<in> carrier G" "l \<in> carrier G" for k l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (k \<otimes>\<^bsub>G\<^esub> l) = f k \<otimes>\<^bsub>H\<^esub> f l
[PROOF STEP]
using that mn
[PROOF STATE]
proof (prove)
using this:
k \<in> carrier G
l \<in> carrier G
1 < m
1 < n
m dvd n
m \<le> n

goal (1 subgoal):
 1. f (k \<otimes>\<^bsub>G\<^esub> l) = f k \<otimes>\<^bsub>H\<^esub> f l
[PROOF STEP]
by (auto simp: assms(1-3) residue_mult_group_def totatives_def
                                 mod_mod_cancel mod_mult_eq)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?k1 \<in> carrier G; ?l1 \<in> carrier G\<rbrakk> \<Longrightarrow> f (?k1 \<otimes>\<^bsub>G\<^esub> ?l1) = f ?k1 \<otimes>\<^bsub>H\<^esub> f ?l1

goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
interpret f: group_hom G H f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. group_hom G H f
[PROOF STEP]
using subset
[PROOF STATE]
proof (prove)
using this:
f ` carrier G \<subseteq> carrier H

goal (1 subgoal):
 1. group_hom G H f
[PROOF STEP]
by unfold_locales (auto simp: hom_def)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
 6. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
show "bij_betw (\<lambda>b. (the_elem (f ` b))) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) \<and> (\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. (\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H
[PROOF STEP]
show "inj_on (\<lambda>b. (the_elem (f ` b))) (rcosets\<^bsub>G\<^esub> kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
using f.FactGroup_inj_on
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>X. the_elem (f ` X)) (carrier (G Mod kernel G H f))

goal (1 subgoal):
 1. inj_on (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
unfolding FactGroup_def
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>X. the_elem (f ` X)) (carrier \<lparr>carrier = rcosets\<^bsub>G\<^esub> kernel G H f, monoid.mult = (<#>\<^bsub>G\<^esub>), one = kernel G H f\<rparr>)

goal (1 subgoal):
 1. inj_on (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f)

goal (1 subgoal):
 1. (\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H
[PROOF STEP]
have eq: "f ` carrier G = carrier H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` carrier G = carrier H
[PROOF STEP]
using subset super_set
[PROOF STATE]
proof (prove)
using this:
f ` carrier G \<subseteq> carrier H
carrier H \<subseteq> f ` carrier G

goal (1 subgoal):
 1. f ` carrier G = carrier H
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` carrier G = carrier H

goal (1 subgoal):
 1. (\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H
[PROOF STEP]
show "(\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H
[PROOF STEP]
using f.FactGroup_onto[OF eq]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>X. the_elem (f ` X)) ` carrier (G Mod kernel G H f) = carrier H

goal (1 subgoal):
 1. (\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H
[PROOF STEP]
unfolding FactGroup_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>X. the_elem (f ` X)) ` carrier \<lparr>carrier = rcosets\<^bsub>G\<^esub> kernel G H f, monoid.mult = (<#>\<^bsub>G\<^esub>), one = kernel G H f\<rparr> = carrier H

goal (1 subgoal):
 1. (\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>b. the_elem (f ` b)) ` (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier H

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>b. the_elem (f ` b)) (rcosets\<^bsub>G\<^esub> kernel G H f) (carrier H)

goal (5 subgoals):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
 2. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 3. card (kernel G H f) = totient n div totient m
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 5. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
show "partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> carrier G \<Longrightarrow> \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
 2. \<And>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<subseteq> carrier G
[PROOF STEP]
show "\<And>a. a \<in> carrier G \<Longrightarrow>
         \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> carrier G \<Longrightarrow> \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> carrier G \<Longrightarrow> \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> carrier G \<Longrightarrow> \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
assume a_in: "a \<in> carrier G"
[PROOF STATE]
proof (state)
this:
a \<in> carrier G

goal (1 subgoal):
 1. \<And>a. a \<in> carrier G \<Longrightarrow> \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
show "\<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
(*exists*)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
have "\<exists>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
using a_in n.rcosets_part_G[OF f.subgroup_kernel]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
\<Union> (rcosets\<^bsub>G\<^esub> kernel G H f) = carrier G

goal (1 subgoal):
 1. \<exists>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b

goal (1 subgoal):
 1. \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b

goal (1 subgoal):
 1. \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
using group.rcos_disjoint[OF n.is_group f.subgroup_kernel]
[PROOF STATE]
proof (prove)
using this:
\<exists>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
disjoint (rcosets\<^bsub>G\<^esub> kernel G H f)

goal (1 subgoal):
 1. \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b
[PROOF STEP]
by (auto simp: disjoint_def)
[PROOF STATE]
proof (state)
this:
\<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> a \<in> b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?a1 \<in> carrier G \<Longrightarrow> \<exists>!b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<and> ?a1 \<in> b

goal (1 subgoal):
 1. \<And>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<subseteq> carrier G
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<subseteq> carrier G
[PROOF STEP]
show "\<And>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<subseteq> carrier G
[PROOF STEP]
using n.rcosets_part_G f.subgroup_kernel
[PROOF STATE]
proof (prove)
using this:
subgroup ?H G \<Longrightarrow> \<Union> (rcosets\<^bsub>G\<^esub> ?H) = carrier G
subgroup (kernel G H f) G

goal (1 subgoal):
 1. \<And>b. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<subseteq> carrier G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?b1 \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> ?b1 \<subseteq> carrier G

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
(* sizes *)
[PROOF STATE]
proof (state)
this:
Congruence.partition (carrier G) (rcosets\<^bsub>G\<^esub> kernel G H f)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
have lagr: "card (carrier G) = card (rcosets\<^bsub>G\<^esub> kernel G H f) * card (kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier G) = card (rcosets\<^bsub>G\<^esub> kernel G H f) * card (kernel G H f)
[PROOF STEP]
using group.lagrange_finite[OF n.is_group n.fin f.subgroup_kernel] Coset.order_def[of G]
[PROOF STATE]
proof (prove)
using this:
card (rcosets\<^bsub>G\<^esub> kernel G H f) * card (kernel G H f) = Coset.order G
Coset.order G = card (carrier G)

goal (1 subgoal):
 1. card (carrier G) = card (rcosets\<^bsub>G\<^esub> kernel G H f) * card (kernel G H f)
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
card (carrier G) = card (rcosets\<^bsub>G\<^esub> kernel G H f) * card (kernel G H f)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
have k_size: "card (kernel G H f) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card (kernel G H f)
[PROOF STEP]
using f.subgroup_kernel finite_subset n.subgroupE(1) n.subgroupE(2)
[PROOF STATE]
proof (prove)
using this:
subgroup (kernel G H f) G
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
subgroup ?H G \<Longrightarrow> ?H \<subseteq> carrier G
subgroup ?H G \<Longrightarrow> ?H \<noteq> {}

goal (1 subgoal):
 1. 0 < card (kernel G H f)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < card (kernel G H f)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
have G_size: "card (carrier G) = totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier G) = totient n
[PROOF STEP]
using n.order Coset.order_def[of G]
[PROOF STATE]
proof (prove)
using this:
Coset.order G = totient n
Coset.order G = card (carrier G)

goal (1 subgoal):
 1. card (carrier G) = totient n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (carrier G) = totient n

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
have H_size: " totient m = card (carrier H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient m = card (carrier H)
[PROOF STEP]
using n.order Coset.order_def[of H]
[PROOF STATE]
proof (prove)
using this:
Coset.order G = totient n
Coset.order H = card (carrier H)

goal (1 subgoal):
 1. totient m = card (carrier H)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
totient m = card (carrier H)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
totient m = card (carrier H)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
have "\<dots> = card (carrier (G Mod kernel G H f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier H) = card (carrier (G Mod kernel G H f))
[PROOF STEP]
using f.FactGroup_iso[OF image_eq] card_image f.FactGroup_inj_on f.FactGroup_onto image_eq
[PROOF STATE]
proof (prove)
using this:
G Mod kernel G H f \<cong> H
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A
inj_on (\<lambda>X. the_elem (f ` X)) (carrier (G Mod kernel G H f))
f ` carrier G = carrier H \<Longrightarrow> (\<lambda>X. the_elem (f ` X)) ` carrier (G Mod kernel G H f) = carrier H
f ` carrier G = carrier H

goal (1 subgoal):
 1. card (carrier H) = card (carrier (G Mod kernel G H f))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card (carrier H) = card (carrier (G Mod kernel G H f))

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (carrier H) = card (carrier (G Mod kernel G H f))

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
have "\<dots> = card (carrier G) div card (kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)
[PROOF STEP]
have "card (carrier (G Mod kernel G H f)) =
          card (rcosets\<^bsub>G\<^esub> kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier (G Mod kernel G H f)) = card (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
unfolding FactGroup_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier \<lparr>carrier = rcosets\<^bsub>G\<^esub> kernel G H f, monoid.mult = (<#>\<^bsub>G\<^esub>), one = kernel G H f\<rparr>) = card (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (carrier (G Mod kernel G H f)) = card (rcosets\<^bsub>G\<^esub> kernel G H f)

goal (1 subgoal):
 1. card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (carrier (G Mod kernel G H f)) = card (rcosets\<^bsub>G\<^esub> kernel G H f)

goal (1 subgoal):
 1. card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)
[PROOF STEP]
have "\<dots> = card (carrier G) div card (kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = card (carrier G) div card (kernel G H f)
[PROOF STEP]
by (simp add: lagr k_size)
[PROOF STATE]
proof (state)
this:
card (rcosets\<^bsub>G\<^esub> kernel G H f) = card (carrier G) div card (kernel G H f)

goal (1 subgoal):
 1. card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)

goal (1 subgoal):
 1. card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (carrier (G Mod kernel G H f)) = card (carrier G) div card (kernel G H f)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
have "\<dots> = totient n div card (kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier G) div card (kernel G H f) = totient n div card (kernel G H f)
[PROOF STEP]
using G_size
[PROOF STATE]
proof (prove)
using this:
card (carrier G) = totient n

goal (1 subgoal):
 1. card (carrier G) div card (kernel G H f) = totient n div card (kernel G H f)
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
card (carrier G) div card (kernel G H f) = totient n div card (kernel G H f)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
totient m = totient n div card (kernel G H f)
[PROOF STEP]
have eq: "totient m = totient n div card (kernel G H f)"
[PROOF STATE]
proof (prove)
using this:
totient m = totient n div card (kernel G H f)

goal (1 subgoal):
 1. totient m = totient n div card (kernel G H f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
totient m = totient n div card (kernel G H f)

goal (4 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. card (kernel G H f) = totient n div totient m
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 4. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
show "card (kernel G H f) = totient n div totient m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
have "totient m \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient m \<noteq> 0
[PROOF STEP]
using totient_0_iff[of m] assms(4)
[PROOF STATE]
proof (prove)
using this:
(totient m = 0) = (m = 0)
1 < m

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

goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
have "card (kernel G H f) dvd totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (kernel G H f) dvd totient n
[PROOF STEP]
using lagr \<open>card (carrier G) = totient n\<close>
[PROOF STATE]
proof (prove)
using this:
card (carrier G) = card (rcosets\<^bsub>G\<^esub> kernel G H f) * card (kernel G H f)
card (carrier G) = totient n

goal (1 subgoal):
 1. card (kernel G H f) dvd totient n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (kernel G H f) dvd totient n

goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
have "totient m * card (kernel G H f) = totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient m * card (kernel G H f) = totient n
[PROOF STEP]
unfolding eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient n div card (kernel G H f) * card (kernel G H f) = totient n
[PROOF STEP]
using \<open>card (kernel G H f) dvd totient n\<close>
[PROOF STATE]
proof (prove)
using this:
card (kernel G H f) dvd totient n

goal (1 subgoal):
 1. totient n div card (kernel G H f) * card (kernel G H f) = totient n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
totient m * card (kernel G H f) = totient n

goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
have "totient n div totient m = totient m * card (kernel G H f) div totient m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient n div totient m = totient m * card (kernel G H f) div totient m
[PROOF STEP]
using \<open>totient m * card (kernel G H f) = totient n\<close>
[PROOF STATE]
proof (prove)
using this:
totient m * card (kernel G H f) = totient n

goal (1 subgoal):
 1. totient n div totient m = totient m * card (kernel G H f) div totient m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
totient n div totient m = totient m * card (kernel G H f) div totient m

goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
totient n div totient m = totient m * card (kernel G H f) div totient m

goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
have "\<dots> = card (kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient m * card (kernel G H f) div totient m = card (kernel G H f)
[PROOF STEP]
using nonzero_mult_div_cancel_left[OF \<open>totient m \<noteq> 0\<close>]
[PROOF STATE]
proof (prove)
using this:
totient m * ?b div totient m = ?b

goal (1 subgoal):
 1. totient m * card (kernel G H f) div totient m = card (kernel G H f)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
totient m * card (kernel G H f) div totient m = card (kernel G H f)

goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
totient n div totient m = card (kernel G H f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
totient n div totient m = card (kernel G H f)

goal (1 subgoal):
 1. card (kernel G H f) = totient n div totient m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (kernel G H f) = totient n div totient m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (kernel G H f) = totient n div totient m

goal (3 subgoals):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
 2. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 3. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
show "card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
[PROOF STEP]
have H_size: " totient m = card (carrier H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient m = card (carrier H)
[PROOF STEP]
using n.order Coset.order_def[of H]
[PROOF STATE]
proof (prove)
using this:
Coset.order G = totient n
Coset.order H = card (carrier H)

goal (1 subgoal):
 1. totient m = card (carrier H)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
totient m = card (carrier H)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
totient m = card (carrier H)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
[PROOF STEP]
have "\<dots> = card (carrier (G Mod kernel G H f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier H) = card (carrier (G Mod kernel G H f))
[PROOF STEP]
using f.FactGroup_iso[OF image_eq] card_image f.FactGroup_inj_on f.FactGroup_onto image_eq
[PROOF STATE]
proof (prove)
using this:
G Mod kernel G H f \<cong> H
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A
inj_on (\<lambda>X. the_elem (f ` X)) (carrier (G Mod kernel G H f))
f ` carrier G = carrier H \<Longrightarrow> (\<lambda>X. the_elem (f ` X)) ` carrier (G Mod kernel G H f) = carrier H
f ` carrier G = carrier H

goal (1 subgoal):
 1. card (carrier H) = card (carrier (G Mod kernel G H f))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card (carrier H) = card (carrier (G Mod kernel G H f))

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (carrier H) = card (carrier (G Mod kernel G H f))

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
[PROOF STEP]
have "card (carrier (G Mod kernel G H f)) =
          card (rcosets\<^bsub>G\<^esub> kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier (G Mod kernel G H f)) = card (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
unfolding FactGroup_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier \<lparr>carrier = rcosets\<^bsub>G\<^esub> kernel G H f, monoid.mult = (<#>\<^bsub>G\<^esub>), one = kernel G H f\<rparr>) = card (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (carrier (G Mod kernel G H f)) = card (rcosets\<^bsub>G\<^esub> kernel G H f)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
totient m = card (rcosets\<^bsub>G\<^esub> kernel G H f)
[PROOF STEP]
show "card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m"
[PROOF STATE]
proof (prove)
using this:
totient m = card (rcosets\<^bsub>G\<^esub> kernel G H f)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (rcosets\<^bsub>G\<^esub> kernel G H f) = totient m

goal (2 subgoals):
 1. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 2. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
assume "b \<in> rcosets\<^bsub>G\<^esub> kernel G H f"
[PROOF STATE]
proof (state)
this:
b \<in> rcosets\<^bsub>G\<^esub> kernel G H f

goal (2 subgoals):
 1. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
 2. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> rcosets\<^bsub>G\<^esub> kernel G H f
[PROOF STEP]
show "b \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
b \<in> rcosets\<^bsub>G\<^esub> kernel G H f

goal (1 subgoal):
 1. b \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
[PROOF STEP]
have "card b = card (kernel G H f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card b = card (kernel G H f)
[PROOF STEP]
using \<open>b \<in> rcosets\<^bsub>G\<^esub> kernel G H f\<close> f.subgroup_kernel n.card_rcosets_equal n.subgroupE(1)
[PROOF STATE]
proof (prove)
using this:
b \<in> rcosets\<^bsub>G\<^esub> kernel G H f
subgroup (kernel G H f) G
\<lbrakk>?R \<in> rcosets\<^bsub>G\<^esub> ?H; ?H \<subseteq> carrier G\<rbrakk> \<Longrightarrow> card ?H = card ?R
subgroup ?H G \<Longrightarrow> ?H \<subseteq> carrier G

goal (1 subgoal):
 1. card b = card (kernel G H f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card b = card (kernel G H f)

goal (1 subgoal):
 1. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card b = card (kernel G H f)
[PROOF STEP]
have "card b > 0"
[PROOF STATE]
proof (prove)
using this:
card b = card (kernel G H f)

goal (1 subgoal):
 1. 0 < card b
[PROOF STEP]
by (simp add: k_size)
[PROOF STATE]
proof (state)
this:
0 < card b

goal (1 subgoal):
 1. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> b \<noteq> {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < card b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < card b

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<noteq> {}

goal (1 subgoal):
 1. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
assume b_cos: "b \<in> rcosets\<^bsub>G\<^esub> kernel G H f"
[PROOF STATE]
proof (state)
this:
b \<in> rcosets\<^bsub>G\<^esub> kernel G H f

goal (1 subgoal):
 1. b \<in> rcosets\<^bsub>G\<^esub> kernel G H f \<Longrightarrow> card (kernel G H f) = card b
[PROOF STEP]
show "card (kernel G H f) = card b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (kernel G H f) = card b
[PROOF STEP]
using group.card_rcosets_equal[OF n.is_group b_cos]
          f.subgroup_kernel subgroup.subset
[PROOF STATE]
proof (prove)
using this:
kernel G H f \<subseteq> carrier G \<Longrightarrow> card (kernel G H f) = card b
subgroup (kernel G H f) G
subgroup ?H ?G \<Longrightarrow> ?H \<subseteq> carrier ?G

goal (1 subgoal):
 1. card (kernel G H f) = card b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (kernel G H f) = card b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma order_gt_1_gen_not_1:
  assumes "order G > 1"
  shows "\<^bold>g \<noteq> \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>g \<noteq> \<one>
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
assume "\<not> \<^bold>g \<noteq> \<one>"
[PROOF STATE]
proof (state)
this:
\<not> \<^bold>g \<noteq> \<one>

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence "\<^bold>g = \<one>"
[PROOF STATE]
proof (prove)
using this:
\<not> \<^bold>g \<noteq> \<one>

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

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence g_pow_eq_1: "\<^bold>g [^] n = \<one>" for n :: nat
[PROOF STATE]
proof (prove)
using this:
\<^bold>g = \<one>

goal (1 subgoal):
 1. \<^bold>g [^] n = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] ?n = \<one>

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence "range (\<lambda>n :: nat. \<^bold>g [^] n) = {\<one>}"
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] ?n = \<one>

goal (1 subgoal):
 1. range (([^]) \<^bold>g) = {\<one>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range (([^]) \<^bold>g) = {\<one>}

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence "carrier G \<subseteq> {\<one>}"
[PROOF STATE]
proof (prove)
using this:
range (([^]) \<^bold>g) = {\<one>}

goal (1 subgoal):
 1. carrier G \<subseteq> {\<one>}
[PROOF STEP]
using generator
[PROOF STATE]
proof (prove)
using this:
range (([^]) \<^bold>g) = {\<one>}
carrier G \<subseteq> range (([^]) \<^bold>g)

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

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence "order G < 1"
[PROOF STATE]
proof (prove)
using this:
carrier G \<subseteq> {\<one>}

goal (1 subgoal):
 1. order G < 1
[PROOF STEP]
by (metis inj_onD inj_on_generator lessThan_iff g_pow_eq_1 assms less_one neq0_conv)
[PROOF STATE]
proof (state)
this:
order G < 1

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
1 < order G
order G < 1
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
1 < order G
order G < 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nodes_connected_ind_trans: "F\<subseteq>E \<Longrightarrow> trans {(x, y) |x y. nodes_connected (ind F) x y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<subseteq> E \<Longrightarrow> trans {(x, y) |x y. nodes_connected \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr> x y}
[PROOF STEP]
apply(frule ind_valid_graph)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<subseteq> E; valid_graph \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr>\<rbrakk> \<Longrightarrow> trans {(x, y) |x y. nodes_connected \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr> x y}
[PROOF STEP]
unfolding trans_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<subseteq> E; valid_graph \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr>\<rbrakk> \<Longrightarrow> \<forall>x y z. (x, y) \<in> {(x, y) |x y. nodes_connected \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr> x y} \<longrightarrow> (y, z) \<in> {(x, y) |x y. nodes_connected \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr> x y} \<longrightarrow> (x, z) \<in> {(x, y) |x y. nodes_connected \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr> x y}
[PROOF STEP]
using valid_graph.is_path_undir_append
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_graph ?G; is_path_undir ?G ?v ?p1.0 ?u; is_path_undir ?G ?u ?p2.0 ?w\<rbrakk> \<Longrightarrow> is_path_undir ?G ?v (?p1.0 @ ?p2.0) ?w

goal (1 subgoal):
 1. \<lbrakk>F \<subseteq> E; valid_graph \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr>\<rbrakk> \<Longrightarrow> \<forall>x y z. (x, y) \<in> {(x, y) |x y. nodes_connected \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr> x y} \<longrightarrow> (y, z) \<in> {(x, y) |x y. nodes_connected \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr> x y} \<longrightarrow> (x, z) \<in> {(x, y) |x y. nodes_connected \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = F\<rparr> x y}
[PROOF STEP]
by fast


[STATEMENT]
lemma tendsto_snd [tendsto_intros]:
  assumes "(f \<longlongrightarrow> a) F"
  shows "((\<lambda>x. snd (f x)) \<longlongrightarrow> snd a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. snd (f x)) \<longlongrightarrow> snd a) F
[PROOF STEP]
proof (rule topological_tendstoI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
assume "open S" and "snd a \<in> S"
[PROOF STATE]
proof (state)
this:
open S
snd a \<in> S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open S
snd a \<in> S
[PROOF STEP]
have "open (snd -` S)" and "a \<in> snd -` S"
[PROOF STATE]
proof (prove)
using this:
open S
snd a \<in> S

goal (1 subgoal):
 1. open (snd -` S) &&& a \<in> snd -` S
[PROOF STEP]
by (simp_all add: open_vimage_snd)
[PROOF STATE]
proof (state)
this:
open (snd -` S)
a \<in> snd -` S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> a) F
open (snd -` S)
a \<in> snd -` S
[PROOF STEP]
have "eventually (\<lambda>x. f x \<in> snd -` S) F"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> a) F
open (snd -` S)
a \<in> snd -` S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<in> snd -` S
[PROOF STEP]
by (rule topological_tendstoD)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x \<in> snd -` S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x \<in> snd -` S
[PROOF STEP]
show "eventually (\<lambda>x. snd (f x) \<in> S) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<in> snd -` S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. snd (f x) \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deriv_n_hf_minus: "(deriv^^k) (hf n) = (\<lambda>x. (-1)^k * (deriv^^k) (hf n) (1-x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ k) (hf n) = (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x))
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (deriv ^^ 0) (hf n) = (\<lambda>x. (- 1) ^ 0 * (deriv ^^ 0) (hf n) (1 - x))
 2. \<And>k. (deriv ^^ k) (hf n) = (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) \<Longrightarrow> (deriv ^^ Suc k) (hf n) = (\<lambda>x. (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (deriv ^^ 0) (hf n) = (\<lambda>x. (- 1) ^ 0 * (deriv ^^ 0) (hf n) (1 - x))
 2. \<And>k. (deriv ^^ k) (hf n) = (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) \<Longrightarrow> (deriv ^^ Suc k) (hf n) = (\<lambda>x. (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ 0) (hf n) = (\<lambda>x. (- 1) ^ 0 * (deriv ^^ 0) (hf n) (1 - x))
[PROOF STEP]
by (simp add: fun_eq_iff hf_def)
[PROOF STATE]
proof (state)
this:
(deriv ^^ 0) (hf n) = (\<lambda>x. (- 1) ^ 0 * (deriv ^^ 0) (hf n) (1 - x))

goal (1 subgoal):
 1. \<And>k. (deriv ^^ k) (hf n) = (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) \<Longrightarrow> (deriv ^^ Suc k) (hf n) = (\<lambda>x. (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. (deriv ^^ k) (hf n) = (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) \<Longrightarrow> (deriv ^^ Suc k) (hf n) = (\<lambda>x. (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
(deriv ^^ k) (hf n) = (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x))

goal (1 subgoal):
 1. \<And>k. (deriv ^^ k) (hf n) = (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) \<Longrightarrow> (deriv ^^ Suc k) (hf n) = (\<lambda>x. (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x))
[PROOF STEP]
have o: "(\<lambda>x. (deriv ^^ k) (hf n) (1-x)) = (deriv ^^ k) (hf n) \<circ> (-) 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) = (deriv ^^ k) (hf n) \<circ> (-) 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) = (deriv ^^ k) (hf n) \<circ> (-) 1

goal (1 subgoal):
 1. \<And>k. (deriv ^^ k) (hf n) = (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) \<Longrightarrow> (deriv ^^ Suc k) (hf n) = (\<lambda>x. (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ Suc k) (hf n) = (\<lambda>x. (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
have [simp]: "((deriv^^k) (hf n) \<circ> (-) 1) field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ k) (hf n) \<circ> (-) 1 field_differentiable at x
[PROOF STEP]
by (force intro: field_differentiable_compose)
[PROOF STATE]
proof (state)
this:
(deriv ^^ k) (hf n) \<circ> (-) 1 field_differentiable at x

goal (1 subgoal):
 1. \<And>x. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
have "(deriv ^^ Suc k) (hf n) x = deriv (\<lambda>x. (-1) ^ k * (deriv ^^ k) (hf n) (1-x)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ Suc k) (hf n) x = deriv (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) x
[PROOF STEP]
by simp (metis Suc)
[PROOF STATE]
proof (state)
this:
(deriv ^^ Suc k) (hf n) x = deriv (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) x

goal (1 subgoal):
 1. \<And>x. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(deriv ^^ Suc k) (hf n) x = deriv (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) x

goal (1 subgoal):
 1. \<And>x. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
have "\<dots> = (-1) ^ k * deriv (\<lambda>x. (deriv ^^ k) (hf n) (1-x)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) x = (- 1) ^ k * deriv (\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) x
[PROOF STEP]
using o
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) = (deriv ^^ k) (hf n) \<circ> (-) 1

goal (1 subgoal):
 1. deriv (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) x = (- 1) ^ k * deriv (\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) x = (- 1) ^ k * deriv (\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) x

goal (1 subgoal):
 1. \<And>x. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. (- 1) ^ k * (deriv ^^ k) (hf n) (1 - x)) x = (- 1) ^ k * deriv (\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) x

goal (1 subgoal):
 1. \<And>x. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
have "\<dots> = (-1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ k * deriv (\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
by (subst o, subst deriv_chain, auto)
[PROOF STATE]
proof (state)
this:
(- 1) ^ k * deriv (\<lambda>x. (deriv ^^ k) (hf n) (1 - x)) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)

goal (1 subgoal):
 1. \<And>x. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
show "(deriv ^^ Suc k) (hf n) x = (-1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1-x)"
[PROOF STATE]
proof (prove)
using this:
(deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)

goal (1 subgoal):
 1. (deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(deriv ^^ Suc k) (hf n) x = (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(deriv ^^ Suc k) (hf n) = (\<lambda>x. (- 1) ^ Suc k * (deriv ^^ Suc k) (hf n) (1 - x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma div_Tr4:"\<lbrakk> (0::nat) < r; 0 < s; j < s * r \<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; j < s * r\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply (frule div_Tr2 [of "r" "s" "j"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply (frule mult_le_mono [of "j div s" "r - Suc 0" "s" "s"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0\<rbrakk> \<Longrightarrow> s \<le> s
 2. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0; j div s * s \<le> (r - Suc 0) * s\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0; j div s * s \<le> (r - Suc 0) * s\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply (frule add_le_mono [of "j div s * s" "(r - Suc 0) * s" "s" "s"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0; j div s * s \<le> (r - Suc 0) * s\<rbrakk> \<Longrightarrow> s \<le> s
 2. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0; j div s * s \<le> (r - Suc 0) * s; j div s * s + s \<le> (r - Suc 0) * s + s\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0; j div s * s \<le> (r - Suc 0) * s; j div s * s + s \<le> (r - Suc 0) * s + s\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply (thin_tac "j div s * s \<le> (r - Suc 0) * s")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0; j div s * s + s \<le> (r - Suc 0) * s + s\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply (cut_tac add_mult_distrib[THEN sym, of "r - Suc 0" "s" "1"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0; j div s * s + s \<le> (r - Suc 0) * s + s; (r - Suc 0) * s + 1 * s = (r - Suc 0 + 1) * s\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply (simp only:nat_mult_1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; j < s * r; j div s \<le> r - Suc 0; j div s * s + s \<le> (r - Suc 0 + 1) * s; (r - Suc 0) * s + s = (r - Suc 0 + 1) * s\<rbrakk> \<Longrightarrow> j div s * s + s \<le> r * s
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gcd_proj2_if_dvd_int [simp]: "y dvd x \<Longrightarrow> gcd x y = \<bar>y\<bar>"
  for x y :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y dvd x \<Longrightarrow> gcd x y = \<bar>y\<bar>
[PROOF STEP]
by (metis gcd_proj1_if_dvd_int gcd.commute)


[STATEMENT]
lemma scaleQ_add_right: "a *\<^sub>Q x + y = (a *\<^sub>Q x) + (a *\<^sub>Q y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a *\<^sub>Q x + y = (a *\<^sub>Q x) + (a *\<^sub>Q y)
[PROOF STEP]
by (si_simp add: distrib_left)


[STATEMENT]
lemma mono_fMin_commute: "mono f \<Longrightarrow> A \<noteq> {||} \<Longrightarrow> f (fMin A) = fMin (f |`| A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; A \<noteq> {||}\<rbrakk> \<Longrightarrow> f (fMin A) = fMin (f |`| A)
[PROOF STEP]
by transfer (rule mono_Min_commute)


[STATEMENT]
lemma subseteq_qleI2: "(\<And>x. x \<in> M \<Longrightarrow> \<exists>y \<in> N. x \<preceq> y) \<Longrightarrow> M \<subseteq>\<^sub>\<preceq> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> M \<Longrightarrow> \<exists>y\<in>N. x \<preceq> y) \<Longrightarrow> M \<subseteq>\<^sub>\<preceq> N
[PROOF STEP]
by (auto simp add: subseteq_qle_def in_qle_def)


[STATEMENT]
lemma smc_prod_Comp_app_vdomain[smc_cs_simps]:
  assumes "g : b \<mapsto>\<^bsub>\<Prod>\<^sub>S\<^sub>M\<^sub>Ci\<in>\<^sub>\<circ>I. \<AA> i\<^esub> c" and "f : a \<mapsto>\<^bsub>\<Prod>\<^sub>S\<^sub>M\<^sub>Ci\<in>\<^sub>\<circ>I. \<AA> i\<^esub> b"
  shows "\<D>\<^sub>\<circ> (g \<circ>\<^sub>A\<^bsub>(\<Prod>\<^sub>S\<^sub>M\<^sub>Ci\<in>\<^sub>\<circ>I. \<AA> i)\<^esub> f) = I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (g \<circ>\<^sub>A\<^bsub>smc_prod I \<AA>\<^esub> f) = I
[PROOF STEP]
unfolding smc_prod_Comp_app[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<lambda>i\<in>\<^sub>\<circ>I. g\<lparr>i\<rparr> \<circ>\<^sub>A\<^bsub>\<AA> i\<^esub> f\<lparr>i\<rparr>) = I
[PROOF STEP]
by simp


[STATEMENT]
lemma max_torder_ge_conv_disj:
  assumes tot: "torder_on A r" and x: "x \<in> A" and y: "y \<in> A"
  shows "r z (max_torder r x y) \<longleftrightarrow> r z x \<or> r z y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r z (max_torder r x y) = (r z x \<or> r z y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r z (max_torder r x y) = (r z x \<or> r z y)
[PROOF STEP]
from tot
[PROOF STATE]
proof (chain)
picking this:
torder_on A r
[PROOF STEP]
have as: "antisymp r"
    and to: "total_onP A r"
    and trans: "transp r"
    and refl: "refl_onP A r"
[PROOF STATE]
proof (prove)
using this:
torder_on A r

goal (1 subgoal):
 1. (antisymp r &&& total_onP A r) &&& transp r &&& refl_onP A r
[PROOF STEP]
by(auto elim: torder_onE porder_onE)
[PROOF STATE]
proof (state)
this:
antisymp r
total_onP A r
transp r
refl_onP A r

goal (1 subgoal):
 1. r z (max_torder r x y) = (r z x \<or> r z y)
[PROOF STEP]
from refl
[PROOF STATE]
proof (chain)
picking this:
refl_onP A r
[PROOF STEP]
have "{a. Domainp r a} = A"
[PROOF STATE]
proof (prove)
using this:
refl_onP A r

goal (1 subgoal):
 1. {a. Domainp r a} = A
[PROOF STEP]
by (rule refl_onP_DomainPD[symmetric])
[PROOF STATE]
proof (state)
this:
{a. Domainp r a} = A

goal (1 subgoal):
 1. r z (max_torder r x y) = (r z x \<or> r z y)
[PROOF STEP]
from this [symmetric]
[PROOF STATE]
proof (chain)
picking this:
A = {a. Domainp r a}
[PROOF STEP]
have "domain": "\<And>a. Domainp r a \<longleftrightarrow> a \<in> A"
[PROOF STATE]
proof (prove)
using this:
A = {a. Domainp r a}

goal (1 subgoal):
 1. \<And>a. Domainp r a = (a \<in> A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Domainp r ?a = (?a \<in> A)

goal (1 subgoal):
 1. r z (max_torder r x y) = (r z x \<or> r z y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r z (max_torder r x y) = (r z x \<or> r z y)
[PROOF STEP]
using x y
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A

goal (1 subgoal):
 1. r z (max_torder r x y) = (r z x \<or> r z y)
[PROOF STEP]
by(simp add: max_torder_def "domain")(blast dest: total_onPD[OF to] transPD[OF trans])
[PROOF STATE]
proof (state)
this:
r z (max_torder r x y) = (r z x \<or> r z y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cone_add_cone:
  assumes C: "C \<subseteq> carrier_vec n"
  shows "cone C + cone C = cone C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cone C + cone C = cone C
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cone C + cone C \<subseteq> cone C
 2. cone C \<subseteq> cone C + cone C
[PROOF STEP]
note CC = cone_carrier[OF C]
[PROOF STATE]
proof (state)
this:
cone C \<subseteq> carrier_vec n

goal (2 subgoals):
 1. cone C + cone C \<subseteq> cone C
 2. cone C \<subseteq> cone C + cone C
[PROOF STEP]
have "cone C = cone C + {0\<^sub>v n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cone C = cone C + {0\<^sub>v n}
[PROOF STEP]
by (subst add_0_right_vecset[OF CC], simp)
[PROOF STATE]
proof (state)
this:
cone C = cone C + {0\<^sub>v n}

goal (2 subgoals):
 1. cone C + cone C \<subseteq> cone C
 2. cone C \<subseteq> cone C + cone C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cone C = cone C + {0\<^sub>v n}

goal (2 subgoals):
 1. cone C + cone C \<subseteq> cone C
 2. cone C \<subseteq> cone C + cone C
[PROOF STEP]
have "\<dots> \<subseteq> cone C + cone C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cone C + {0\<^sub>v n} \<subseteq> cone C + cone C
[PROOF STEP]
by (rule set_plus_mono2, insert zero_in_cone, auto)
[PROOF STATE]
proof (state)
this:
cone C + {0\<^sub>v n} \<subseteq> cone C + cone C

goal (2 subgoals):
 1. cone C + cone C \<subseteq> cone C
 2. cone C \<subseteq> cone C + cone C
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cone C \<subseteq> cone C + cone C
[PROOF STEP]
show "cone C \<subseteq> cone C + cone C"
[PROOF STATE]
proof (prove)
using this:
cone C \<subseteq> cone C + cone C

goal (1 subgoal):
 1. cone C \<subseteq> cone C + cone C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cone C \<subseteq> cone C + cone C

goal (1 subgoal):
 1. cone C + cone C \<subseteq> cone C
[PROOF STEP]
from cone_elem_sum[OF C]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> cone C; ?y \<in> cone C\<rbrakk> \<Longrightarrow> ?x + ?y \<in> cone C
[PROOF STEP]
show "cone C + cone C \<subseteq> cone C"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> cone C; ?y \<in> cone C\<rbrakk> \<Longrightarrow> ?x + ?y \<in> cone C

goal (1 subgoal):
 1. cone C + cone C \<subseteq> cone C
[PROOF STEP]
by (auto elim!: set_plus_elim)
[PROOF STATE]
proof (state)
this:
cone C + cone C \<subseteq> cone C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tensor_preserves_ide:
    assumes "ide a" and "ide b"
    shows "ide (a \<otimes> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ide (a \<otimes> b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ide (a \<otimes> b)
[PROOF STEP]
have "can (a \<otimes> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. can (a \<otimes> b)
[PROOF STEP]
using assms tensor\<^sub>F\<^sub>M\<^sub>C_def Can_rep_can ide_implies_can can_mkarr_Can
[PROOF STATE]
proof (prove)
using this:
ide a
ide b
?f \<otimes> ?g \<equiv> if arr ?f \<and> arr ?g then mkarr (rep ?f \<^bold>\<otimes> rep ?g) else null
can ?f \<Longrightarrow> Can (rep ?f)
ide ?a \<Longrightarrow> can ?a
Can ?t \<Longrightarrow> can (mkarr ?t)

goal (1 subgoal):
 1. can (a \<otimes> b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
can (a \<otimes> b)

goal (1 subgoal):
 1. ide (a \<otimes> b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
can (a \<otimes> b)

goal (1 subgoal):
 1. ide (a \<otimes> b)
[PROOF STEP]
have "dom (a \<otimes> b) = cod (a \<otimes> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.dom (a \<otimes> b) = cod (a \<otimes> b)
[PROOF STEP]
using assms tensor_in_hom
[PROOF STATE]
proof (prove)
using this:
ide a
ide b
\<lbrakk>\<guillemotleft>?f : ?a \<rightarrow> ?b\<guillemotright>; \<guillemotleft>?g : ?c \<rightarrow> ?d\<guillemotright>\<rbrakk> \<Longrightarrow> \<guillemotleft>?f \<otimes> ?g : ?a \<otimes> ?c \<rightarrow> ?b \<otimes> ?d\<guillemotright>

goal (1 subgoal):
 1. local.dom (a \<otimes> b) = cod (a \<otimes> b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.dom (a \<otimes> b) = cod (a \<otimes> b)

goal (1 subgoal):
 1. ide (a \<otimes> b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
can (a \<otimes> b)
local.dom (a \<otimes> b) = cod (a \<otimes> b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
can (a \<otimes> b)
local.dom (a \<otimes> b) = cod (a \<otimes> b)

goal (1 subgoal):
 1. ide (a \<otimes> b)
[PROOF STEP]
using ide_char
[PROOF STATE]
proof (prove)
using this:
can (a \<otimes> b)
local.dom (a \<otimes> b) = cod (a \<otimes> b)
ide ?f = (can ?f \<and> local.dom ?f = cod ?f)

goal (1 subgoal):
 1. ide (a \<otimes> b)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
ide (a \<otimes> b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subword_split :
"i + j \<le> length w \<Longrightarrow> 0 < k \<Longrightarrow> k < j \<Longrightarrow>
 subword w i j = subword w i k \<cdot> subword w (i + k) (j - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i + j \<le> length w; 0 < k; k < j\<rbrakk> \<Longrightarrow> subword w i j = subword w i k \<cdot> subword w (i + k) (j - k)
[PROOF STEP]
by(simp add: subword_def, subst take_split[where n=k, THEN sym], simp_all,
   rule_tac f="\<lambda>x. take (j - k) (drop x w)" in arg_cong, simp)


[STATEMENT]
lemma in_pair_minus_pairs [simp]: "p \<in>\<^sub>p A -\<^sub>p B \<longleftrightarrow> (p \<in>\<^sub>p A \<and> p \<notin>\<^sub>p B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<in>\<^sub>p A -\<^sub>p B) = (p \<in>\<^sub>p A \<and> p \<notin>\<^sub>p B)
[PROOF STEP]
by (metis Diff_iff in_pair_def in_pair_iff minus_pairs_def prod.collapse)


[STATEMENT]
lemma m_translate_eq:
  assumes "c \<in> carrier R"
  assumes "a \<in> carrier R"
  shows "m_translate c a = c \<otimes> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m_translate c a = c \<otimes> a
[PROOF STEP]
by (simp add: m_translate_def assms(1) assms(2))


[STATEMENT]
lemma functions_of_is_inj_on:
  assumes "finite A" "finite B"
  assumes "\<forall>n. n\<in># N \<longrightarrow> n = 1" "number_partition (card A) N" "size N \<le> card B"
  shows "univ (\<lambda>f. inj_on f A) (functions_of A B N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of A B N)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of A B N)
[PROOF STEP]
have "functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
using assms functions_of
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
\<forall>n. n \<in># N \<longrightarrow> n = 1
number_partition (card A) N
size N \<le> card B
\<lbrakk>finite ?A; finite ?B; number_partition (card ?A) ?N; size ?N \<le> card ?B\<rbrakk> \<Longrightarrow> functions_of ?A ?B ?N \<in> (?A \<rightarrow>\<^sub>E ?B) // domain_and_range_permutation ?A ?B

goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of A B N)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
obtain f where eq_f: "functions_of A B N = domain_and_range_permutation A B `` {f}" and "f \<in> A \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
using this:
functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>functions_of A B N = domain_and_range_permutation A B `` {f}; f \<in> A \<rightarrow>\<^sub>E B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using quotientE
[PROOF STATE]
proof (prove)
using this:
functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
\<lbrakk>?X \<in> ?A // ?r; \<And>x. \<lbrakk>?X = ?r `` {x}; x \<in> ?A\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>functions_of A B N = domain_and_range_permutation A B `` {f}; f \<in> A \<rightarrow>\<^sub>E B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
functions_of A B N = domain_and_range_permutation A B `` {f}
f \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of A B N)
[PROOF STEP]
from eq_f
[PROOF STATE]
proof (chain)
picking this:
functions_of A B N = domain_and_range_permutation A B `` {f}
[PROOF STEP]
have "f \<in> functions_of A B N"
[PROOF STATE]
proof (prove)
using this:
functions_of A B N = domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. f \<in> functions_of A B N
[PROOF STEP]
using \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> equiv_domain_and_range_permutation equiv_class_self
[PROOF STATE]
proof (prove)
using this:
functions_of A B N = domain_and_range_permutation A B `` {f}
f \<in> A \<rightarrow>\<^sub>E B
equiv (?A \<rightarrow>\<^sub>E ?B) (domain_and_range_permutation ?A ?B)
\<lbrakk>equiv ?A ?r; ?a \<in> ?A\<rbrakk> \<Longrightarrow> ?a \<in> ?r `` {?a}

goal (1 subgoal):
 1. f \<in> functions_of A B N
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f \<in> functions_of A B N

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of A B N)
[PROOF STEP]
have "inj_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f A
[PROOF STEP]
using \<open>f \<in> functions_of A B N\<close> assms all_one_implies_inj_on
[PROOF STATE]
proof (prove)
using this:
f \<in> functions_of A B N
finite A
finite B
\<forall>n. n \<in># N \<longrightarrow> n = 1
number_partition (card A) N
size N \<le> card B
\<lbrakk>finite ?A; finite ?B; \<forall>n. n \<in># ?N \<longrightarrow> n = 1; number_partition (card ?A) ?N; size ?N \<le> card ?B; ?f \<in> functions_of ?A ?B ?N\<rbrakk> \<Longrightarrow> inj_on ?f ?A

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

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of A B N)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
inj_on f A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on f A

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of A B N)
[PROOF STEP]
unfolding eq_f
[PROOF STATE]
proof (prove)
using this:
inj_on f A

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (domain_and_range_permutation A B `` {f})
[PROOF STEP]
using equiv_domain_and_range_permutation inj_on_respects_domain_and_range_permutation \<open>f \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (prove)
using this:
inj_on f A
equiv (?A \<rightarrow>\<^sub>E ?B) (domain_and_range_permutation ?A ?B)
(\<lambda>f. inj_on f ?A) respects domain_and_range_permutation ?A ?B
f \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (domain_and_range_permutation A B `` {f})
[PROOF STEP]
by (subst univ_commute') assumption+
[PROOF STATE]
proof (state)
this:
univ (\<lambda>f. inj_on f A) (functions_of A B N)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma leastPD3: "leastP P x \<Longrightarrow> y \<in> Collect P \<Longrightarrow> x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>leastP P x; y \<in> Collect P\<rbrakk> \<Longrightarrow> x \<le> y
[PROOF STEP]
by (blast dest!: leastPD2 setgeD)


[STATEMENT]
lemma borel_eq_atLeastLessThan:
  "borel = sigma UNIV (range (\<lambda>(a, b). {a ..< b :: real}))" (is "_ = ?SIGMA")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel = sigma UNIV (range (\<lambda>(a, b). {a..<b}))
[PROOF STEP]
proof (rule borel_eq_sigmaI5[OF borel_eq_lessThan])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. {x. x <e a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a..<b})))
 2. \<And>a b. {a..<b} \<in> sets borel
[PROOF STEP]
have move_uminus: "\<And>x y::real. -x \<le> y \<longleftrightarrow> -y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (- x \<le> y) = (- y \<le> x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(- ?x \<le> ?y) = (- ?y \<le> ?x)

goal (2 subgoals):
 1. \<And>a. {x. x <e a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a..<b})))
 2. \<And>a b. {a..<b} \<in> sets borel
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. {x. x <e a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a..<b})))
 2. \<And>a b. {a..<b} \<in> sets borel
[PROOF STEP]
have "{..<x} = (\<Union>i::nat. {-real i ..< x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<x} = (\<Union>i. {- real i..<x})
[PROOF STEP]
by (auto simp: move_uminus real_arch_simple)
[PROOF STATE]
proof (state)
this:
{..<x} = (\<Union>i. {- real i..<x})

goal (2 subgoals):
 1. \<And>a. {x. x <e a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a..<b})))
 2. \<And>a b. {a..<b} \<in> sets borel
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{..<x} = (\<Union>i. {- real i..<x})
[PROOF STEP]
show "{y. y <e x} \<in> ?SIGMA"
[PROOF STATE]
proof (prove)
using this:
{..<x} = (\<Union>i. {- real i..<x})

goal (1 subgoal):
 1. {y. y <e x} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a..<b})))
[PROOF STEP]
by (auto intro: sigma_sets.intros(2-) simp: eucl_lessThan)
[PROOF STATE]
proof (state)
this:
{y. y <e x} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a..<b})))

goal (1 subgoal):
 1. \<And>a b. {a..<b} \<in> sets borel
[PROOF STEP]
qed auto


[STATEMENT]
lemma Abs_finfun_inj_finite:
  assumes fin: "finite (UNIV :: 'a set)"
  shows "inj (Abs_finfun :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow>f 'b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj Abs_finfun
[PROOF STEP]
proof(rule inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; Abs_finfun x = Abs_finfun y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y :: "'a \<Rightarrow> 'b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; Abs_finfun x = Abs_finfun y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "Abs_finfun x = Abs_finfun y"
[PROOF STATE]
proof (state)
this:
Abs_finfun x = Abs_finfun y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; Abs_finfun x = Abs_finfun y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Abs_finfun x = Abs_finfun y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; Abs_finfun x = Abs_finfun y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "x \<in> finfun" "y \<in> finfun"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> finfun &&& y \<in> finfun
[PROOF STEP]
unfolding finfun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {f. \<exists>b. finite {a. f a \<noteq> b}} &&& y \<in> {f. \<exists>b. finite {a. f a \<noteq> b}}
[PROOF STEP]
by(auto intro: finite_subset[OF _ fin])
[PROOF STATE]
proof (state)
this:
x \<in> finfun
y \<in> finfun

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; Abs_finfun x = Abs_finfun y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Abs_finfun x = Abs_finfun y
x \<in> finfun
y \<in> finfun
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
Abs_finfun x = Abs_finfun y
x \<in> finfun
y \<in> finfun

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by(simp add: Abs_finfun_inject)
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_cond_exp_cdiv [intro, simp]:
  fixes c::real
  assumes "integrable M f"
  shows "AE x in M. real_cond_exp M F (\<lambda>x. f x / c) x = real_cond_exp M F f x / c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_cond_exp M F (\<lambda>x. f x / c) x = real_cond_exp M F f x / c
[PROOF STEP]
using real_cond_exp_cmult[of _ "1/c", OF assms]
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M F (\<lambda>x. 1 / c * f x) x = 1 / c * real_cond_exp M F f x

goal (1 subgoal):
 1. AE x in M. real_cond_exp M F (\<lambda>x. f x / c) x = real_cond_exp M F f x / c
[PROOF STEP]
by (auto simp add: field_split_simps)


[STATEMENT]
lemma lQuot_empty[simp]:   "lQuot a {} = {}"
  and lQuot_epsilon[simp]: "lQuot a {[]} = {}"
  and lQuot_char[simp]:    "lQuot a {[b]} = (if a = b then {[]} else {})"
  and lQuot_chars[simp]:   "lQuot a {[b] | b. P b} = (if P a then {[]} else {})"
  and lQuot_union[simp]:   "lQuot a (A \<union> B) = lQuot a A \<union> lQuot a B"
  and lQuot_inter[simp]:   "lQuot a (A \<inter> B) = lQuot a A \<inter> lQuot a B"
  and lQuot_compl[simp]:   "lQuot a (-A) = - lQuot a A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lQuot a {} = {} &&& lQuot a {[]} = {} &&& lQuot a {[b]} = (if a = b then {[]} else {})) &&& (lQuot a {[b] |b. P b} = (if P a then {[]} else {}) &&& lQuot a (A \<union> B) = lQuot a A \<union> lQuot a B) &&& lQuot a (A \<inter> B) = lQuot a A \<inter> lQuot a B &&& lQuot a (- A) = - lQuot a A
[PROOF STEP]
by (auto simp: lQuot_def)


[STATEMENT]
lemma NSLIMSEQ_Suc_iff: "((\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l) \<longleftrightarrow> (f \<longlonglongrightarrow>\<^sub>N\<^sub>S l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l = f \<longlonglongrightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S l
 2. f \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
assume *: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l"
[PROOF STATE]
proof (state)
this:
f \<longlonglongrightarrow>\<^sub>N\<^sub>S l

goal (2 subgoals):
 1. (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S l
 2. f \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
show "(\<lambda>n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
proof (rule NSLIMSEQ_I)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>N. N \<in> HNatInfinite \<Longrightarrow> (*f* (\<lambda>n. f (Suc n))) N \<approx> star_of l
[PROOF STEP]
fix N
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>N. N \<in> HNatInfinite \<Longrightarrow> (*f* (\<lambda>n. f (Suc n))) N \<approx> star_of l
[PROOF STEP]
assume "N \<in> HNatInfinite"
[PROOF STATE]
proof (state)
this:
N \<in> HNatInfinite

goal (1 subgoal):
 1. \<And>N. N \<in> HNatInfinite \<Longrightarrow> (*f* (\<lambda>n. f (Suc n))) N \<approx> star_of l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<in> HNatInfinite
[PROOF STEP]
have "(*f* f) (N + 1) \<approx> star_of l"
[PROOF STATE]
proof (prove)
using this:
N \<in> HNatInfinite

goal (1 subgoal):
 1. (*f* f) (N + 1) \<approx> star_of l
[PROOF STEP]
by (simp add: HNatInfinite_add NSLIMSEQ_D *)
[PROOF STATE]
proof (state)
this:
(*f* f) (N + 1) \<approx> star_of l

goal (1 subgoal):
 1. \<And>N. N \<in> HNatInfinite \<Longrightarrow> (*f* (\<lambda>n. f (Suc n))) N \<approx> star_of l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(*f* f) (N + 1) \<approx> star_of l
[PROOF STEP]
show "(*f* (\<lambda>n. f (Suc n))) N \<approx> star_of l"
[PROOF STATE]
proof (prove)
using this:
(*f* f) (N + 1) \<approx> star_of l

goal (1 subgoal):
 1. (*f* (\<lambda>n. f (Suc n))) N \<approx> star_of l
[PROOF STEP]
by (simp add: starfun_shift_one)
[PROOF STATE]
proof (state)
this:
(*f* (\<lambda>n. f (Suc n))) N \<approx> star_of l

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l

goal (1 subgoal):
 1. (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
assume *: "(\<lambda>n. f(Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l"
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l

goal (1 subgoal):
 1. (\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
show "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow>\<^sub>N\<^sub>S l
[PROOF STEP]
proof (rule NSLIMSEQ_I)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>N. N \<in> HNatInfinite \<Longrightarrow> (*f* f) N \<approx> star_of l
[PROOF STEP]
fix N
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>N. N \<in> HNatInfinite \<Longrightarrow> (*f* f) N \<approx> star_of l
[PROOF STEP]
assume "N \<in> HNatInfinite"
[PROOF STATE]
proof (state)
this:
N \<in> HNatInfinite

goal (1 subgoal):
 1. \<And>N. N \<in> HNatInfinite \<Longrightarrow> (*f* f) N \<approx> star_of l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<in> HNatInfinite
[PROOF STEP]
have "(*f* (\<lambda>n. f (Suc n))) (N - 1) \<approx> star_of l"
[PROOF STATE]
proof (prove)
using this:
N \<in> HNatInfinite

goal (1 subgoal):
 1. (*f* (\<lambda>n. f (Suc n))) (N - 1) \<approx> star_of l
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
N \<in> HNatInfinite
(\<lambda>n. f (Suc n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S l

goal (1 subgoal):
 1. (*f* (\<lambda>n. f (Suc n))) (N - 1) \<approx> star_of l
[PROOF STEP]
by (simp add: HNatInfinite_diff NSLIMSEQ_D)
[PROOF STATE]
proof (state)
this:
(*f* (\<lambda>n. f (Suc n))) (N - 1) \<approx> star_of l

goal (1 subgoal):
 1. \<And>N. N \<in> HNatInfinite \<Longrightarrow> (*f* f) N \<approx> star_of l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(*f* (\<lambda>n. f (Suc n))) (N - 1) \<approx> star_of l
[PROOF STEP]
show "(*f* f) N \<approx> star_of l"
[PROOF STATE]
proof (prove)
using this:
(*f* (\<lambda>n. f (Suc n))) (N - 1) \<approx> star_of l

goal (1 subgoal):
 1. (*f* f) N \<approx> star_of l
[PROOF STEP]
by (simp add: \<open>N \<in> HNatInfinite\<close> one_le_HNatInfinite starfun_shift_one)
[PROOF STATE]
proof (state)
this:
(*f* f) N \<approx> star_of l

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f \<longlonglongrightarrow>\<^sub>N\<^sub>S l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quant_equiv_iff [si_eq]:
  fixes x :: "'a['u\<^sub>1::dim_type, 's::unit_system]" and y :: "'a['u\<^sub>2::dim_type, 's::unit_system]"
  shows "x \<cong>\<^sub>Q y \<longleftrightarrow> \<lbrakk>x\<rbrakk>\<^sub>Q = \<lbrakk>y\<rbrakk>\<^sub>Q \<and> QD('u\<^sub>1) = QD('u\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cong>\<^sub>Q y) = (\<lbrakk>x\<rbrakk>\<^sub>Q = \<lbrakk>y\<rbrakk>\<^sub>Q \<and> QD('u\<^sub>1) = QD('u\<^sub>2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<cong>\<^sub>Q y) = (\<lbrakk>x\<rbrakk>\<^sub>Q = \<lbrakk>y\<rbrakk>\<^sub>Q \<and> QD('u\<^sub>1) = QD('u\<^sub>2))
[PROOF STEP]
have "\<forall>t ta. (ta::'a['u\<^sub>2, 's]) = t \<or> mag (fromQ ta) \<noteq> mag (fromQ t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t ta. ta = t \<or> mag (fromQ ta) \<noteq> mag (fromQ t)
[PROOF STEP]
by (simp add: magQ_def quant_eq_iff_mag_eq)
[PROOF STATE]
proof (state)
this:
\<forall>t ta. ta = t \<or> mag (fromQ ta) \<noteq> mag (fromQ t)

goal (1 subgoal):
 1. (x \<cong>\<^sub>Q y) = (\<lbrakk>x\<rbrakk>\<^sub>Q = \<lbrakk>y\<rbrakk>\<^sub>Q \<and> QD('u\<^sub>1) = QD('u\<^sub>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>t ta. ta = t \<or> mag (fromQ ta) \<noteq> mag (fromQ t)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>t ta. ta = t \<or> mag (fromQ ta) \<noteq> mag (fromQ t)

goal (1 subgoal):
 1. (x \<cong>\<^sub>Q y) = (\<lbrakk>x\<rbrakk>\<^sub>Q = \<lbrakk>y\<rbrakk>\<^sub>Q \<and> QD('u\<^sub>1) = QD('u\<^sub>2))
[PROOF STEP]
by (metis (full_types) qequiv.rep_eq coerceQuant_eq_iff2 qeq magQ_def)
[PROOF STATE]
proof (state)
this:
(x \<cong>\<^sub>Q y) = (\<lbrakk>x\<rbrakk>\<^sub>Q = \<lbrakk>y\<rbrakk>\<^sub>Q \<and> QD('u\<^sub>1) = QD('u\<^sub>2))

goal:
No subgoals!
[PROOF STEP]
qed