[STATEMENT]
lemma  det_2: "det (A::'a::comm_ring_1^2^2) = A$1$1 * A$2$2 - A$1$2 * A$2$1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 - A $ 1 $ 2 * A $ 2 $ 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 - A $ 1 $ 2 * A $ 2 $ 1
[PROOF STEP]
have f12: "finite {2::2}" "1 \<notin> {2::2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {2} &&& 1 \<notin> {2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {2}
1 \<notin> {2}

goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 - A $ 1 $ 2 * A $ 2 $ 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 - A $ 1 $ 2 * A $ 2 $ 1
[PROOF STEP]
unfolding det_def UNIV_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | p permutes {1, 2}. of_int (sign p) * (\<Prod>i\<in>{1, 2}. A $ i $ p i)) = A $ 1 $ 1 * A $ 2 $ 2 - A $ 1 $ 2 * A $ 2 $ 1
[PROOF STEP]
unfolding sum_over_permutations_insert[OF f12]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>{1, 2}. \<Sum>q\<in>{p. p permutes {2}}. of_int (sign (Transposition.transpose 1 b \<circ> q)) * (\<Prod>i\<in>{1, 2}. A $ i $ (Transposition.transpose 1 b \<circ> q) i)) = A $ 1 $ 1 * A $ 2 $ 2 - A $ 1 $ 2 * A $ 2 $ 1
[PROOF STEP]
unfolding permutes_sing
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>{1, 2}. \<Sum>q\<in>{p. p = id}. of_int (sign (Transposition.transpose 1 b \<circ> q)) * (\<Prod>i\<in>{1, 2}. A $ i $ (Transposition.transpose 1 b \<circ> q) i)) = A $ 1 $ 1 * A $ 2 $ 2 - A $ 1 $ 2 * A $ 2 $ 1
[PROOF STEP]
by (simp add: sign_swap_id sign_id swap_id_eq)
[PROOF STATE]
proof (state)
this:
det A = A $ 1 $ 1 * A $ 2 $ 2 - A $ 1 $ 2 * A $ 2 $ 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosh_real_nonneg[simp]: "cosh (x :: real) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> cosh x
[PROOF STEP]
using cosh_real_ge_1[of x]
[PROOF STATE]
proof (prove)
using this:
1 \<le> cosh x

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


[STATEMENT]
lemma Sigma_mset_Diff_distrib2: "(SIGMAMSET i\<in>#I. A i - B i) = Sigma_mset I A - Sigma_mset I B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SIGMAMSET i\<in>#I. A i - B i) = Sigma_mset I A - Sigma_mset I B
[PROOF STEP]
by (auto simp: multiset_eq_iff count_sum_mset count_image_mset_Pair sum_mset_if_eq_constant
    Sigma_mset_def iterate_op_plus min_def not_in_iff diff_mult_distrib)


[STATEMENT]
lemma (in aGroup) fSum_zeroTr:"(\<forall>j \<in> nset n (n + m). f j = \<zero>)  \<longrightarrow>
                       fSum A f  n (n + m) = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<in>nset n (n + m). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + m) = \<zero>
[PROOF STEP]
apply (induct_tac m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<in>nset n (n + 0). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + 0) = \<zero>
 2. \<And>na. (\<forall>j\<in>nset n (n + na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + na) = \<zero> \<Longrightarrow> (\<forall>j\<in>nset n (n + Suc na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + Suc na) = \<zero>
[PROOF STEP]
apply (simp add:fSum_def cmp_def slide_def nset_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. (\<forall>j\<in>nset n (n + na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + na) = \<zero> \<Longrightarrow> (\<forall>j\<in>nset n (n + Suc na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + Suc na) = \<zero>
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>(\<forall>j\<in>nset n (n + na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + na) = \<zero>; \<forall>j\<in>nset n (n + Suc na). f j = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>f A f n (n + Suc na) = \<zero>
[PROOF STEP]
apply (subst fSum_Suc)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>na. \<lbrakk>(\<forall>j\<in>nset n (n + na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + na) = \<zero>; \<forall>j\<in>nset n (n + Suc na). f j = \<zero>\<rbrakk> \<Longrightarrow> \<forall>j\<in>nset n (n + Suc na). f j \<in> carrier A
 2. \<And>na. \<lbrakk>(\<forall>j\<in>nset n (n + na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + na) = \<zero>; \<forall>j\<in>nset n (n + Suc na). f j = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>f A f n (n + na) \<plusminus> f (n + Suc na) = \<zero>
[PROOF STEP]
apply (rule ballI, simp add:ag_inc_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>(\<forall>j\<in>nset n (n + na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + na) = \<zero>; \<forall>j\<in>nset n (n + Suc na). f j = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>f A f n (n + na) \<plusminus> f (n + Suc na) = \<zero>
[PROOF STEP]
apply (frule_tac x = "n + Suc na" in bspec, simp add:nset_def,
       simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>(\<forall>j\<in>nset n (n + na). f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>f A f n (n + na) = \<zero>; \<forall>j\<in>nset n (Suc (n + na)). f j = \<zero>; f (Suc (n + na)) = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>f A f n (n + na) \<plusminus> \<zero> = \<zero>
[PROOF STEP]
apply (simp add:nset_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>\<Sigma>\<^sub>f A f n (n + na) = \<zero>; \<forall>j. n \<le> j \<and> j \<le> Suc (n + na) \<longrightarrow> f j = \<zero>\<rbrakk> \<Longrightarrow> \<zero> \<plusminus> \<zero> = \<zero>
[PROOF STEP]
apply (cut_tac ag_inc_zero, simp add:ag_l_zero)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bit_sum_mult_2_cases:
  assumes a: "\<forall>j. \<not> bit a (Suc j)"
  shows "bit (a + 2 * b) n = (if n = 0 then odd a else bit (2 * b) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit (a + (2::'a) * b) n = (if n = 0 then odd a else bit ((2::'a) * b) n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bit (a + (2::'a) * b) n = (if n = 0 then odd a else bit ((2::'a) * b) n)
[PROOF STEP]
have a_eq: "bit a i \<longleftrightarrow> i = 0 \<and> odd a" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit a i = (i = 0 \<and> odd a)
[PROOF STEP]
by (cases i) (simp_all add: a bit_0)
[PROOF STATE]
proof (state)
this:
bit a ?i1 = (?i1 = 0 \<and> odd a)

goal (1 subgoal):
 1. bit (a + (2::'a) * b) n = (if n = 0 then odd a else bit ((2::'a) * b) n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit (a + (2::'a) * b) n = (if n = 0 then odd a else bit ((2::'a) * b) n)
[PROOF STEP]
by (simp add: disjunctive_add[simplified disj_imp] a_eq bit_simps)
[PROOF STATE]
proof (state)
this:
bit (a + (2::'a) * b) n = (if n = 0 then odd a else bit ((2::'a) * b) n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma totient_dvd:
  assumes "m dvd n"
  shows   "totient m dvd totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient m dvd totient n
[PROOF STEP]
proof (cases "m = 0 \<or> n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<or> n = 0 \<Longrightarrow> totient m dvd totient n
 2. \<not> (m = 0 \<or> n = 0) \<Longrightarrow> totient m dvd totient n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (m = 0 \<or> n = 0)

goal (2 subgoals):
 1. m = 0 \<or> n = 0 \<Longrightarrow> totient m dvd totient n
 2. \<not> (m = 0 \<or> n = 0) \<Longrightarrow> totient m dvd totient n
[PROOF STEP]
let ?M = "\<lambda>p m :: nat. multiplicity p m - 1"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<or> n = 0 \<Longrightarrow> totient m dvd totient n
 2. \<not> (m = 0 \<or> n = 0) \<Longrightarrow> totient m dvd totient n
[PROOF STEP]
have "(\<Prod>p\<in>prime_factors m. p ^ ?M p m * (p - 1)) dvd
          (\<Prod>p\<in>prime_factors n. p ^ ?M p n * (p - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors m. p ^ (multiplicity p m - 1) * (p - 1)) dvd (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
using assms False
[PROOF STATE]
proof (prove)
using this:
m dvd n
\<not> (m = 0 \<or> n = 0)

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors m. p ^ (multiplicity p m - 1) * (p - 1)) dvd (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
by (intro prod_dvd_prod_subset2 mult_dvd_mono dvd_refl le_imp_power_dvd diff_le_mono
              dvd_prime_factors dvd_imp_multiplicity_le) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors m. p ^ (multiplicity p m - 1) * (p - 1)) dvd (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))

goal (2 subgoals):
 1. m = 0 \<or> n = 0 \<Longrightarrow> totient m dvd totient n
 2. \<not> (m = 0 \<or> n = 0) \<Longrightarrow> totient m dvd totient n
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> (m = 0 \<or> n = 0)
(\<Prod>p\<in>prime_factors m. p ^ (multiplicity p m - 1) * (p - 1)) dvd (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (m = 0 \<or> n = 0)
(\<Prod>p\<in>prime_factors m. p ^ (multiplicity p m - 1) * (p - 1)) dvd (\<Prod>p\<in>prime_factors n. p ^ (multiplicity p n - 1) * (p - 1))

goal (1 subgoal):
 1. totient m dvd totient n
[PROOF STEP]
by (simp add: totient_formula1)
[PROOF STATE]
proof (state)
this:
totient m dvd totient n

goal (1 subgoal):
 1. m = 0 \<or> n = 0 \<Longrightarrow> totient m dvd totient n
[PROOF STEP]
qed (insert assms, auto)