[STATEMENT]
lemma take_bit_sum:
  "take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))"
  for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
proof (induction n arbitrary: a)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. take_bit 0 a = (\<Sum>k = 0..<0. push_bit k (of_bool (bit a k)))
 2. \<And>n a. (\<And>a. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))) \<Longrightarrow> take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>a. take_bit 0 a = (\<Sum>k = 0..<0. push_bit k (of_bool (bit a k)))
 2. \<And>n a. (\<And>a. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))) \<Longrightarrow> take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit 0 a = (\<Sum>k = 0..<0. push_bit k (of_bool (bit a k)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
take_bit 0 a = (\<Sum>k = 0..<0. push_bit k (of_bool (bit a k)))

goal (1 subgoal):
 1. \<And>n a. (\<And>a. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))) \<Longrightarrow> take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n a. (\<And>a. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))) \<Longrightarrow> take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
take_bit n ?a1 = (\<Sum>k = 0..<n. push_bit k (of_bool (bit ?a1 k)))

goal (1 subgoal):
 1. \<And>n a. (\<And>a. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))) \<Longrightarrow> take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
have "(\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k))) =
    of_bool (odd a) + (\<Sum>k = Suc 0..<Suc n. push_bit k (of_bool (bit a k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k))) = of_bool (odd a) + (\<Sum>k = Suc 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
by (simp add: sum.atLeast_Suc_lessThan ac_simps bit_0)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k))) = of_bool (odd a) + (\<Sum>k = Suc 0..<Suc n. push_bit k (of_bool (bit a k)))

goal (1 subgoal):
 1. \<And>n a. (\<And>a. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))) \<Longrightarrow> take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k))) = of_bool (odd a) + (\<Sum>k = Suc 0..<Suc n. push_bit k (of_bool (bit a k)))

goal (1 subgoal):
 1. \<And>n a. (\<And>a. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))) \<Longrightarrow> take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
have "(\<Sum>k = Suc 0..<Suc n. push_bit k (of_bool (bit a k)))
    = (\<Sum>k = 0..<n. push_bit k (of_bool (bit (a div 2) k))) * 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<Suc n. push_bit k (of_bool (bit a k))) = (\<Sum>k = 0..<n. push_bit k (of_bool (bit (a div (2::'a)) k))) * (2::'a)
[PROOF STEP]
by (simp only: sum.atLeast_Suc_lessThan_Suc_shift) (simp add: sum_distrib_right push_bit_double drop_bit_Suc bit_Suc)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..<Suc n. push_bit k (of_bool (bit a k))) = (\<Sum>k = 0..<n. push_bit k (of_bool (bit (a div (2::'a)) k))) * (2::'a)

goal (1 subgoal):
 1. \<And>n a. (\<And>a. take_bit n a = (\<Sum>k = 0..<n. push_bit k (of_bool (bit a k)))) \<Longrightarrow> take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k))) = of_bool (odd a) + (\<Sum>k = 0..<n. push_bit k (of_bool (bit (a div (2::'a)) k))) * (2::'a)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k))) = of_bool (odd a) + (\<Sum>k = 0..<n. push_bit k (of_bool (bit (a div (2::'a)) k))) * (2::'a)

goal (1 subgoal):
 1. take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
using Suc [of "a div 2"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k))) = of_bool (odd a) + (\<Sum>k = 0..<n. push_bit k (of_bool (bit (a div (2::'a)) k))) * (2::'a)
take_bit n (a div (2::'a)) = (\<Sum>k = 0..<n. push_bit k (of_bool (bit (a div (2::'a)) k)))

goal (1 subgoal):
 1. take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))
[PROOF STEP]
by (simp add: ac_simps take_bit_Suc mod_2_eq_odd)
[PROOF STATE]
proof (state)
this:
take_bit (Suc n) a = (\<Sum>k = 0..<Suc n. push_bit k (of_bool (bit a k)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_nat_ge_1_iff: "of_nat x \<ge> (1 :: 'a :: linordered_semidom) \<longleftrightarrow> x \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1::'a) \<le> of_nat x) = (1 \<le> x)
[PROOF STEP]
using of_nat_le_iff[of 1 x]
[PROOF STATE]
proof (prove)
using this:
(of_nat 1 \<le> of_nat x) = (1 \<le> x)

goal (1 subgoal):
 1. ((1::'a) \<le> of_nat x) = (1 \<le> x)
[PROOF STEP]
by (simp del: of_nat_le_iff)


[STATEMENT]
lemma bezout_ring_imp_diagonal_admits_SNF:
  assumes of: "OFCLASS('a::comm_ring_1, bezout_ring_class)"
  shows "\<forall>A::'a^'n::{mod_type}^'n::{mod_type}. isDiagonal A
    \<longrightarrow> (\<exists>P Q.
        invertible (P::'a^'n::mod_type^'n::mod_type) \<and>
        invertible (Q::'a^'n::mod_type^'n::mod_type) \<and>
        Smith_normal_form (P**A**Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A. isDiagonal A \<longrightarrow> (\<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q))
[PROOF STEP]
proof (rule allI, rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. isDiagonal A \<Longrightarrow> \<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q)
[PROOF STEP]
fix A::"'a^'n::{mod_type}^'n::{mod_type}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. isDiagonal A \<Longrightarrow> \<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q)
[PROOF STEP]
assume A: "isDiagonal A"
[PROOF STATE]
proof (state)
this:
isDiagonal A

goal (1 subgoal):
 1. \<And>A. isDiagonal A \<Longrightarrow> \<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q)
[PROOF STEP]
have br: "class.bezout_ring (*) (1::'a) (+) 0 (-) uminus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
by (rule OFCLASS_bezout_ring_imp_class_bezout_ring[OF of])
[PROOF STATE]
proof (state)
this:
class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus

goal (1 subgoal):
 1. \<And>A. isDiagonal A \<Longrightarrow> \<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q)
[PROOF STEP]
show "\<exists>P Q.
        invertible (P::'a^'n::mod_type^'n::mod_type) \<and>
        invertible (Q::'a^'n::mod_type^'n::mod_type) \<and>
        Smith_normal_form (P**A**Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q)
[PROOF STEP]
by (rule diagonal_to_Smith_PQ_exists_internalize_sort[OF br A])
[PROOF STATE]
proof (state)
this:
\<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma choose_square_sum: "(\<Sum>k\<le>n. (n choose k)^2) = ((2*n) choose n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. (n choose k)\<^sup>2) = 2 * n choose n
[PROOF STEP]
using vandermonde[of n n n]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>n. (n choose k) * (n choose (n - k))) = n + n choose n

goal (1 subgoal):
 1. (\<Sum>k\<le>n. (n choose k)\<^sup>2) = 2 * n choose n
[PROOF STEP]
by (simp add: power2_eq_square mult_2 binomial_symmetric [symmetric])


[STATEMENT]
lemma has_integral_neg_iff: "((\<lambda>x. - f x) has_integral k) S \<longleftrightarrow> (f has_integral - k) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - f x) has_integral k) S = (f has_integral - k) S
[PROOF STEP]
using has_integral_neg[of f "- k"] has_integral_neg[of "\<lambda>x. - f x" k]
[PROOF STATE]
proof (prove)
using this:
(f has_integral - k) ?S \<Longrightarrow> ((\<lambda>x. - f x) has_integral - (- k)) ?S
((\<lambda>x. - f x) has_integral k) ?S \<Longrightarrow> ((\<lambda>x. - (- f x)) has_integral - k) ?S

goal (1 subgoal):
 1. ((\<lambda>x. - f x) has_integral k) S = (f has_integral - k) S
[PROOF STEP]
by auto


[STATEMENT]
lemma Lcm_atLeast1AtMost_Suc:
  "Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
[PROOF STEP]
proof (cases "n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 2. \<not> 0 < n \<Longrightarrow> Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 2. \<not> 0 < n \<Longrightarrow> Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
[PROOF STEP]
proof (rule multiplicity_eq_nat)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
fix p :: nat
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
assume "prime p"
[PROOF STATE]
proof (state)
this:
prime p

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
define x where "x = (if primepow (Suc n) then aprimedivisor (Suc n) else 1)"
[PROOF STATE]
proof (state)
this:
x = (if primepow (Suc n) then aprimedivisor (Suc n) else 1)

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
have "x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
by (auto simp: x_def intro!: aprimedivisor_pos_nat)
[PROOF STATE]
proof (state)
this:
0 < x

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
have "multiplicity p (Lcm {1..n} * x) = multiplicity p (Lcm {1..n}) + multiplicity p x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (Lcm {1..n} * x) = multiplicity p (Lcm {1..n}) + multiplicity p x
[PROOF STEP]
using \<open>prime p\<close> \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
prime p
0 < x

goal (1 subgoal):
 1. multiplicity p (Lcm {1..n} * x) = multiplicity p (Lcm {1..n}) + multiplicity p x
[PROOF STEP]
by (subst prime_elem_multiplicity_mult_distrib) auto
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..n} * x) = multiplicity p (Lcm {1..n}) + multiplicity p x

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..n} * x) = multiplicity p (Lcm {1..n}) + multiplicity p x

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
consider "\<exists>k. Suc n = p ^ k" | "primepow (Suc n)" "\<not>(\<exists>k. Suc n = p ^ k)"
                | "\<not>primepow (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>k. Suc n = p ^ k \<Longrightarrow> thesis; \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> thesis; \<not> primepow (Suc n) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<exists>k. Suc n = p ^ k \<Longrightarrow> ?thesis; \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> ?thesis; \<not> primepow (Suc n) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
hence "multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<exists>k. Suc n = p ^ k \<Longrightarrow> ?thesis; \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> ?thesis; \<not> primepow (Suc n) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
 2. \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
 3. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
assume "\<exists>k. Suc n = p ^ k"
[PROOF STATE]
proof (state)
this:
\<exists>k. Suc n = p ^ k

goal (3 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
 2. \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
 3. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>k. Suc n = p ^ k

goal (1 subgoal):
 1. multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
using \<open>prime p\<close> \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>k. Suc n = p ^ k
prime p
0 < n

goal (1 subgoal):
 1. multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
by (auto simp: x_def aprimedivisor_prime_power intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)

goal (2 subgoals):
 1. \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
 2. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
 2. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
assume *: "primepow (Suc n)" "\<nexists>k. Suc n = p ^ k"
[PROOF STATE]
proof (state)
this:
primepow (Suc n)
\<nexists>k. Suc n = p ^ k

goal (2 subgoals):
 1. \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
 2. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
primepow (Suc n)
\<nexists>k. Suc n = p ^ k
[PROOF STEP]
obtain q k where qk: "prime q" "Suc n = q ^ k" "k > 0" "q \<noteq> p"
[PROOF STATE]
proof (prove)
using this:
primepow (Suc n)
\<nexists>k. Suc n = p ^ k

goal (1 subgoal):
 1. (\<And>q k. \<lbrakk>prime q; Suc n = q ^ k; 0 < k; q \<noteq> p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: primepow_def)
[PROOF STATE]
proof (state)
this:
prime q
Suc n = q ^ k
0 < k
q \<noteq> p

goal (2 subgoals):
 1. \<lbrakk>primepow (Suc n); \<nexists>k. Suc n = p ^ k\<rbrakk> \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
 2. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
prime q
Suc n = q ^ k
0 < k
q \<noteq> p

goal (1 subgoal):
 1. multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
prime q
Suc n = q ^ k
0 < k
q \<noteq> p
prime p

goal (1 subgoal):
 1. multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
by (subst *) (auto simp: x_def aprimedivisor_prime_power prime_multiplicity_other)
[PROOF STATE]
proof (state)
this:
multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)

goal (1 subgoal):
 1. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
assume *: "\<not>primepow (Suc n)"
[PROOF STATE]
proof (state)
this:
\<not> primepow (Suc n)

goal (1 subgoal):
 1. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
hence **: "\<nexists>k. Suc n = p ^ k"
[PROOF STATE]
proof (prove)
using this:
\<not> primepow (Suc n)

goal (1 subgoal):
 1. \<nexists>k. Suc n = p ^ k
[PROOF STEP]
using \<open>prime p\<close> \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> primepow (Suc n)
prime p
0 < n

goal (1 subgoal):
 1. \<nexists>k. Suc n = p ^ k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<nexists>k. Suc n = p ^ k

goal (1 subgoal):
 1. \<not> primepow (Suc n) \<Longrightarrow> multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
\<not> primepow (Suc n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> primepow (Suc n)

goal (1 subgoal):
 1. multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
unfolding x_def
[PROOF STATE]
proof (prove)
using this:
\<not> primepow (Suc n)

goal (1 subgoal):
 1. multiplicity p (if primepow (Suc n) then aprimedivisor (Suc n) else 1) = (if \<exists>k. Suc n = p ^ k then 1 else 0)
[PROOF STEP]
by (subst **) auto
[PROOF STATE]
proof (state)
this:
multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p x = (if \<exists>k. Suc n = p ^ k then 1 else 0)

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
have "multiplicity p (Lcm {1..n}) + \<dots> = multiplicity p (Lcm {1..Suc n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (Lcm {1..n}) + (if \<exists>k. Suc n = p ^ k then 1 else 0) = multiplicity p (Lcm {1..Suc n})
[PROOF STEP]
using \<open>prime p\<close> \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
prime p
0 < n

goal (1 subgoal):
 1. multiplicity p (Lcm {1..n}) + (if \<exists>k. Suc n = p ^ k then 1 else 0) = multiplicity p (Lcm {1..Suc n})
[PROOF STEP]
by (subst multiplicity_Lcm_atLeast1AtMost_Suc) (auto simp: x_def)
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..n}) + (if \<exists>k. Suc n = p ^ k then 1 else 0) = multiplicity p (Lcm {1..Suc n})

goal (3 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
 3. \<And>p. prime p \<Longrightarrow> multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity p (Lcm {1..n} * x) = multiplicity p (Lcm {1..Suc n})
[PROOF STEP]
show "multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * x)"
[PROOF STATE]
proof (prove)
using this:
multiplicity p (Lcm {1..n} * x) = multiplicity p (Lcm {1..Suc n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..Suc n}) = multiplicity p (Lcm {1..n} * x)

goal (2 subgoals):
 1. 0 < Lcm {1..Suc n}
 2. 0 < Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
[PROOF STEP]
qed (use \<open>n > 0\<close> in \<open>auto intro!: Nat.gr0I dest: aprimedivisor_pos_nat\<close>)
[PROOF STATE]
proof (state)
this:
Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> Lcm {1..Suc n} = Lcm {1..n} * (if primepow (Suc n) then aprimedivisor (Suc n) else 1)
[PROOF STEP]
qed auto


[STATEMENT]
lemma between_commute:
   "between (a,b) = between (b,a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. between (a, b) = between (b, a)
[PROOF STEP]
by (auto simp: between_def closed_segment_commute)


[STATEMENT]
lemma poly_of_pm_sum: "poly_of_pm x (sum f I) = (\<Sum>i\<in>I. poly_of_pm x (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_pm x (sum f I) = (\<Sum>i\<in>I. poly_of_pm x (f i))
[PROOF STEP]
by (induct I rule: infinite_finite_induct) (simp_all add: poly_of_pm_plus)


[STATEMENT]
lemma nu_fusion_equal_3:
  assumes "galois l u"
      and "isotone g"
      and "isotone h"
      and "has_greatest_postfixpoint g"
      and "has_greatest_fixpoint h"
      and "h \<circ> u = u \<circ> g"
    shows "\<nu> h = u (p\<nu> g)"
      and "\<nu> h = u (\<nu> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nu> h = u (p\<nu> g) &&& \<nu> h = u (\<nu> g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<nu> h = u (p\<nu> g)
 2. \<nu> h = u (\<nu> g)
[PROOF STEP]
have "\<forall>x . u (g x) = h (u x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. u (g x) = h (u x)
[PROOF STEP]
using assms(6) comp_eq_dest
[PROOF STATE]
proof (prove)
using this:
h \<circ> u = u \<circ> g
?a \<circ> ?b = ?c \<circ> ?d \<Longrightarrow> ?a (?b ?v) = ?c (?d ?v)

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

goal (2 subgoals):
 1. \<nu> h = u (p\<nu> g)
 2. \<nu> h = u (\<nu> g)
[PROOF STEP]
thus "\<nu> h = u (p\<nu> g)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. u (g x) = h (u x)

goal (1 subgoal):
 1. \<nu> h = u (p\<nu> g)
[PROOF STEP]
using assms(1-5) nu_fusion_equal_1
[PROOF STATE]
proof (prove)
using this:
\<forall>x. u (g x) = h (u x)
galois l u
isotone g
isotone h
has_greatest_postfixpoint g
has_greatest_fixpoint h
\<lbrakk>galois ?l ?u; isotone ?g; isotone ?h; has_greatest_postfixpoint ?g; has_greatest_fixpoint ?h; ?h (?u (?l (\<nu> ?h))) \<le> ?u (?g (?l (\<nu> ?h))); ?h (?u (p\<nu> ?g)) = ?u (?g (p\<nu> ?g))\<rbrakk> \<Longrightarrow> \<nu> ?h = ?u (p\<nu> ?g) \<and> \<nu> ?h = ?u (\<nu> ?g)

goal (1 subgoal):
 1. \<nu> h = u (p\<nu> g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<nu> h = u (p\<nu> g)

goal (1 subgoal):
 1. \<nu> h = u (\<nu> g)
[PROOF STEP]
thus "\<nu> h = u (\<nu> g)"
[PROOF STATE]
proof (prove)
using this:
\<nu> h = u (p\<nu> g)

goal (1 subgoal):
 1. \<nu> h = u (\<nu> g)
[PROOF STEP]
by (simp add: assms(2-4) pnu_nu)
[PROOF STATE]
proof (state)
this:
\<nu> h = u (\<nu> g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma b_least_aux1: "b_least f x = x \<or> (b_least f x < x \<and> (f x (b_least f x)) \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b_least f x = x \<or> b_least f x < x \<and> f x (b_least f x) \<noteq> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b_least f x = x \<or> b_least f x < x \<and> f x (b_least f x) \<noteq> 0
[PROOF STEP]
let ?P = "%y. y = x \<or> (y < x \<and> (f x y) \<noteq> 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b_least f x = x \<or> b_least f x < x \<and> f x (b_least f x) \<noteq> 0
[PROOF STEP]
have "?P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = x \<or> x < x \<and> f x x \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = x \<or> x < x \<and> f x x \<noteq> 0

goal (1 subgoal):
 1. b_least f x = x \<or> b_least f x < x \<and> f x (b_least f x) \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = x \<or> x < x \<and> f x x \<noteq> 0
[PROOF STEP]
have "?P (Least ?P)"
[PROOF STATE]
proof (prove)
using this:
x = x \<or> x < x \<and> f x x \<noteq> 0

goal (1 subgoal):
 1. (LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) = x \<or> (LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) < x \<and> f x (LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) \<noteq> 0
[PROOF STEP]
by (rule LeastI)
[PROOF STATE]
proof (state)
this:
(LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) = x \<or> (LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) < x \<and> f x (LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) \<noteq> 0

goal (1 subgoal):
 1. b_least f x = x \<or> b_least f x < x \<and> f x (b_least f x) \<noteq> 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) = x \<or> (LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) < x \<and> f x (LEAST y. y = x \<or> y < x \<and> f x y \<noteq> 0) \<noteq> 0

goal (1 subgoal):
 1. b_least f x = x \<or> b_least f x < x \<and> f x (b_least f x) \<noteq> 0
[PROOF STEP]
by (simp add: b_least_def)
[PROOF STATE]
proof (state)
this:
b_least f x = x \<or> b_least f x < x \<and> f x (b_least f x) \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus_1_even_eqI: assumes "even k = even l" shows
    "(- (1 :: 'b :: comm_ring_1))^k = (- 1)^l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'b)) ^ k = (- (1::'b)) ^ l
[PROOF STEP]
unfolding minus_1_power_even assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if even l then 1::'b else - (1::'b)) = (if even l then 1::'b else - (1::'b))
[PROOF STEP]
by auto


[STATEMENT]
lemma Fract_le_zero_iff: "0 < b \<Longrightarrow> Fract a b \<le> 0 \<longleftrightarrow> a \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < b \<Longrightarrow> (Fract a b \<le> 0) = (a \<le> 0)
[PROOF STEP]
by (simp add: Zero_rat_def mult_le_0_iff)


[STATEMENT]
lemma uminus_real_alg: "- (real_of x) = real_of (- x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - real_of x = real_of (- x)
[PROOF STEP]
by (transfer, rule uminus_3[symmetric])


[STATEMENT]
lemma ball_in_set_nths'_conv: "(\<forall>j \<in> set (nths' l r xs). P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < List.length xs \<longrightarrow> P (xs ! k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<in>set (nths' l r xs). P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < length xs \<longrightarrow> P (xs ! k))
[PROOF STEP]
unfolding set_nths'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<in>{x. \<exists>k\<ge>l. k < r \<and> k < length xs \<and> x = xs ! k}. P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < length xs \<longrightarrow> P (xs ! k))
[PROOF STEP]
by blast


[STATEMENT]
lemma ALGxy_def2:
  "ALGxy A qs init x y = (\<Sum>i\<in>{i. i<length qs \<and> (qs!i \<in> {y,x})}. ALG' A qs init i y + ALG' A qs init i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i | i < length qs \<and> qs ! i \<in> {y, x}. ALG' A qs init i y + ALG' A qs init i x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i | i < length qs \<and> qs ! i \<in> {y, x}. ALG' A qs init i y + ALG' A qs init i x)
[PROOF STEP]
have a: "{i. i<length qs \<and> (qs!i \<in> {y,x})} = {..<length qs} \<inter> {i. (qs!i \<in> {y,x})}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < length qs \<and> qs ! i \<in> {y, x}} = {..<length qs} \<inter> {i. qs ! i \<in> {y, x}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i. i < length qs \<and> qs ! i \<in> {y, x}} = {..<length qs} \<inter> {i. qs ! i \<in> {y, x}}

goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i | i < length qs \<and> qs ! i \<in> {y, x}. ALG' A qs init i y + ALG' A qs init i x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ALGxy A qs init x y = (\<Sum>i | i < length qs \<and> qs ! i \<in> {y, x}. ALG' A qs init i y + ALG' A qs init i x)
[PROOF STEP]
unfolding ALGxy_def a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{..<length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x) = (\<Sum>i\<in>{..<length qs} \<inter> {i. qs ! i \<in> {y, x}}. ALG' A qs init i y + ALG' A qs init i x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ALGxy A qs init x y = (\<Sum>i | i < length qs \<and> qs ! i \<in> {y, x}. ALG' A qs init i y + ALG' A qs init i x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_mset_btree:
  assumes "btree t"
  shows "size (mset_tree t) = 2^rank t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (mset_tree t) = 2 ^ rank t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
btree t

goal (1 subgoal):
 1. size (mset_tree t) = 2 ^ rank t
[PROOF STEP]
proof (induction t)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
case (Node r v ts)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x3aa \<in> set ts; btree ?x3aa\<rbrakk> \<Longrightarrow> size (mset_tree ?x3aa) = 2 ^ rank ?x3aa
btree (Node r v ts)

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
hence IH: "size (mset_tree t) = 2^rank t" if "t \<in> set ts" for t
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x3aa \<in> set ts; btree ?x3aa\<rbrakk> \<Longrightarrow> size (mset_tree ?x3aa) = 2 ^ rank ?x3aa
btree (Node r v ts)

goal (1 subgoal):
 1. size (mset_tree t) = 2 ^ rank t
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x3aa \<in> set ts; btree ?x3aa\<rbrakk> \<Longrightarrow> size (mset_tree ?x3aa) = 2 ^ rank ?x3aa
btree (Node r v ts)
t \<in> set ts

goal (1 subgoal):
 1. size (mset_tree t) = 2 ^ rank t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?t \<in> set ts \<Longrightarrow> size (mset_tree ?t) = 2 ^ rank ?t

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
from Node
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x3aa \<in> set ts; btree ?x3aa\<rbrakk> \<Longrightarrow> size (mset_tree ?x3aa) = 2 ^ rank ?x3aa
btree (Node r v ts)
[PROOF STEP]
have COMPL: "map rank ts = rev [0..<r]"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x3aa \<in> set ts; btree ?x3aa\<rbrakk> \<Longrightarrow> size (mset_tree ?x3aa) = 2 ^ rank ?x3aa
btree (Node r v ts)

goal (1 subgoal):
 1. map rank ts = rev [0..<r]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map rank ts = rev [0..<r]

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
have "size (mset_trees ts) = (\<Sum>t\<leftarrow>ts. size (mset_tree t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (mset_trees ts) = (\<Sum>t\<leftarrow>ts. size (mset_tree t))
[PROOF STEP]
by (induction ts) auto
[PROOF STATE]
proof (state)
this:
size (mset_trees ts) = (\<Sum>t\<leftarrow>ts. size (mset_tree t))

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size (mset_trees ts) = (\<Sum>t\<leftarrow>ts. size (mset_tree t))

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
have "\<dots> = (\<Sum>t\<leftarrow>ts. 2^rank t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>ts. size (mset_tree t)) = (\<Sum>t\<leftarrow>ts. 2 ^ rank t)
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
?t \<in> set ts \<Longrightarrow> size (mset_tree ?t) = 2 ^ rank ?t

goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>ts. size (mset_tree t)) = (\<Sum>t\<leftarrow>ts. 2 ^ rank t)
[PROOF STEP]
by (auto cong: map_cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>ts. size (mset_tree t)) = (\<Sum>t\<leftarrow>ts. 2 ^ rank t)

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>ts. size (mset_tree t)) = (\<Sum>t\<leftarrow>ts. 2 ^ rank t)

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
have "\<dots> = (\<Sum>r\<leftarrow>map rank ts. 2^r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>ts. 2 ^ rank t) = sum_list (map ((^) 2) (map rank ts))
[PROOF STEP]
by (induction ts) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>ts. 2 ^ rank t) = sum_list (map ((^) 2) (map rank ts))

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>ts. 2 ^ rank t) = sum_list (map ((^) 2) (map rank ts))

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<in>{0..<r}. 2^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ((^) 2) (map rank ts)) = sum ((^) 2) {0..<r}
[PROOF STEP]
unfolding COMPL
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ((^) 2) (rev [0..<r])) = sum ((^) 2) {0..<r}
[PROOF STEP]
by (auto simp: rev_map[symmetric] interv_sum_list_conv_sum_set_nat)
[PROOF STATE]
proof (state)
this:
sum_list (map ((^) 2) (map rank ts)) = sum ((^) 2) {0..<r}

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ((^) 2) (map rank ts)) = sum ((^) 2) {0..<r}

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
have "\<dots> = 2^r - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {0..<r} = 2 ^ r - 1
[PROOF STEP]
by (induction r) auto
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {0..<r} = 2 ^ r - 1

goal (1 subgoal):
 1. \<And>x1a x2a x3a. \<lbrakk>\<And>x3aa. \<lbrakk>x3aa \<in> set x3a; btree x3aa\<rbrakk> \<Longrightarrow> size (mset_tree x3aa) = 2 ^ rank x3aa; btree (Node x1a x2a x3a)\<rbrakk> \<Longrightarrow> size (mset_tree (Node x1a x2a x3a)) = 2 ^ rank (Node x1a x2a x3a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size (mset_trees ts) = 2 ^ r - 1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
size (mset_trees ts) = 2 ^ r - 1

goal (1 subgoal):
 1. size (mset_tree (Node r v ts)) = 2 ^ rank (Node r v ts)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
size (mset_tree (Node r v ts)) = 2 ^ rank (Node r v ts)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Hausdorff_Euclidean_space:
   "Hausdorff_space (Euclidean_space n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hausdorff_space (Euclidean_space n)
[PROOF STEP]
unfolding Euclidean_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hausdorff_space (subtopology (powertop_real UNIV) {x. \<forall>i\<ge>n. x i = 0})
[PROOF STEP]
by (rule Hausdorff_space_subtopology) (metis Hausdorff_space_euclidean Hausdorff_space_product_topology)


[STATEMENT]
lemma ennreal_liminf_minus:
  fixes f :: "nat \<Rightarrow> ennreal"
  shows "(\<And>n. f n \<le> c) \<Longrightarrow> liminf (\<lambda>n. c - f n) = c - limsup f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. f n \<le> c) \<Longrightarrow> liminf (\<lambda>n. c - f n) = c - limsup f
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f c. \<lbrakk>pred_fun top ((\<le>) 0) f; 0 \<le> c; \<And>n. f n \<le> c\<rbrakk> \<Longrightarrow> liminf (\<lambda>n. max 0 (c - f n)) = max 0 (c - limsup f)
[PROOF STEP]
apply (simp add: ereal_diff_positive liminf_ereal_cminus)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f c. \<lbrakk>\<forall>x. 0 \<le> f x; 0 \<le> c; \<And>n. f n \<le> c\<rbrakk> \<Longrightarrow> c - limsup f = max 0 (c - limsup f)
[PROOF STEP]
by (metis max.absorb2 ereal_diff_positive Limsup_bounded eventually_sequentiallyI)


[STATEMENT]
lemma (in group) subgroup_conjugation_is_hom:
  "(\<lambda>g. \<lambda>H \<in> {H. subgroup H G}. g <# H #> (inv g)) \<in> hom G (BijGroup {H. subgroup H G})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> hom G (BijGroup {H. subgroup H G})
[PROOF STEP]
unfolding hom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
let ?\<psi> = "\<lambda>g. \<lambda>H. g <# H #> (inv g)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
let ?\<phi> = "\<lambda>g. restrict (?\<psi> g) {H. subgroup H G}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
have Step0: "\<And> g. g \<in> carrier G \<Longrightarrow> (?\<phi> g) \<in> Bij {H. subgroup H G}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>g. g \<in> carrier G \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> Bij {H. subgroup H G}
[PROOF STEP]
using Bij_def subgroup_conjugation_is_bij
[PROOF STATE]
proof (prove)
using this:
Bij ?S = extensional ?S \<inter> {f. bij_betw f ?S ?S}
?g \<in> carrier G \<Longrightarrow> bij_betw (\<lambda>H\<in>{H. subgroup H G}. ?g <# H #> inv ?g) {H. subgroup H G} {H. subgroup H G}

goal (1 subgoal):
 1. \<And>g. g \<in> carrier G \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> Bij {H. subgroup H G}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?g \<in> carrier G \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. ?g <# H #> inv ?g) \<in> Bij {H. subgroup H G}

goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
hence Step1: "?\<phi>: carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G})"
[PROOF STATE]
proof (prove)
using this:
?g \<in> carrier G \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. ?g <# H #> inv ?g) \<in> Bij {H. subgroup H G}

goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G})
[PROOF STEP]
unfolding BijGroup_def
[PROOF STATE]
proof (prove)
using this:
?g \<in> carrier G \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. ?g <# H #> inv ?g) \<in> Bij {H. subgroup H G}

goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> carrier G \<rightarrow> carrier \<lparr>carrier = Bij {H. subgroup H G}, mult = \<lambda>g\<in>Bij {H. subgroup H G}. restrict (compose {H. subgroup H G} g) (Bij {H. subgroup H G}), one = \<lambda>x\<in>{H. subgroup H G}. x\<rparr>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G})

goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
have "\<And> g1 g2. \<lbrakk> g1 \<in> carrier G; g2 \<in> carrier G \<rbrakk> \<Longrightarrow>
                  (\<And> H. H \<in> {H. subgroup H G} \<Longrightarrow> ?\<psi> (g1 \<otimes> g2) H = (?\<phi> g1) ((?\<phi> g2) H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
fix g1 g2 H
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
assume g1: "g1 \<in> carrier G" and g2: "g2 \<in> carrier G" and H': "H \<in> {H. subgroup H G}"
[PROOF STATE]
proof (state)
this:
g1 \<in> carrier G
g2 \<in> carrier G
H \<in> {H. subgroup H G}

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
hence H: "subgroup H G"
[PROOF STATE]
proof (prove)
using this:
g1 \<in> carrier G
g2 \<in> carrier G
H \<in> {H. subgroup H G}

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

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
have "(?\<phi> g1) ((?\<phi> g2) H) = g1 <# (g2 <# H #> (inv g2)) #> (inv g1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H) = g1 <# (g2 <# H #> inv g2) #> inv g1
[PROOF STEP]
by (simp add: H g2 subgroup_conjugation_is_surj2)
[PROOF STATE]
proof (state)
this:
(\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H) = g1 <# (g2 <# H #> inv g2) #> inv g1

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H) = g1 <# (g2 <# H #> inv g2) #> inv g1

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
have " ... = g1 <# (g2 <# H) #> ((inv g2) \<otimes> (inv g1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g1 <# (g2 <# H #> inv g2) #> inv g1 = g1 <# (g2 <# H) #> inv g2 \<otimes> inv g1
[PROOF STEP]
by (simp add: H coset_mult_assoc g1 g2 group.coset_assoc
                    is_group l_coset_subset_G subgroup.subset)
[PROOF STATE]
proof (state)
this:
g1 <# (g2 <# H #> inv g2) #> inv g1 = g1 <# (g2 <# H) #> inv g2 \<otimes> inv g1

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g1 <# (g2 <# H #> inv g2) #> inv g1 = g1 <# (g2 <# H) #> inv g2 \<otimes> inv g1

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
have " ... = g1 <# (g2 <# H) #> inv (g1 \<otimes> g2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g1 <# (g2 <# H) #> inv g2 \<otimes> inv g1 = g1 <# (g2 <# H) #> inv (g1 \<otimes> g2)
[PROOF STEP]
using g1 g2
[PROOF STATE]
proof (prove)
using this:
g1 \<in> carrier G
g2 \<in> carrier G

goal (1 subgoal):
 1. g1 <# (g2 <# H) #> inv g2 \<otimes> inv g1 = g1 <# (g2 <# H) #> inv (g1 \<otimes> g2)
[PROOF STEP]
by (simp add: inv_mult_group)
[PROOF STATE]
proof (state)
this:
g1 <# (g2 <# H) #> inv g2 \<otimes> inv g1 = g1 <# (g2 <# H) #> inv (g1 \<otimes> g2)

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H) = g1 <# (g2 <# H) #> inv (g1 \<otimes> g2)
[PROOF STEP]
have "(?\<phi> g1) ((?\<phi> g2) H) = ?\<psi> (g1 \<otimes> g2) H"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H) = g1 <# (g2 <# H) #> inv (g1 \<otimes> g2)

goal (1 subgoal):
 1. (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H) = g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2)
[PROOF STEP]
by (simp add: H g1 g2 lcos_m_assoc subgroup.subset)
[PROOF STATE]
proof (state)
this:
(\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H) = g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2)

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<And>H. H \<in> {H. subgroup H G} \<Longrightarrow> g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
thus "?\<psi> (g1 \<otimes> g2) H = (?\<phi> g1) ((?\<phi> g2) H)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H) = g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2)

goal (1 subgoal):
 1. g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?g1.0 \<in> carrier G; ?g2.0 \<in> carrier G; ?H \<in> {H. subgroup H G}\<rbrakk> \<Longrightarrow> ?g1.0 \<otimes> ?g2.0 <# ?H #> inv (?g1.0 \<otimes> ?g2.0) = (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 <# H #> inv ?g1.0) ((\<lambda>H\<in>{H. subgroup H G}. ?g2.0 <# H #> inv ?g2.0) ?H)

goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
hence "\<And> g1 g2. \<lbrakk> g1 \<in> carrier G; g2 \<in> carrier G \<rbrakk> \<Longrightarrow>
         (\<lambda>H \<in> {H. subgroup H G}. ?\<psi> (g1 \<otimes> g2) H) = (\<lambda>H \<in> {H. subgroup H G}. (?\<phi> g1) ((?\<phi> g2) H))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?g1.0 \<in> carrier G; ?g2.0 \<in> carrier G; ?H \<in> {H. subgroup H G}\<rbrakk> \<Longrightarrow> ?g1.0 \<otimes> ?g2.0 <# ?H #> inv (?g1.0 \<otimes> ?g2.0) = (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 <# H #> inv ?g1.0) ((\<lambda>H\<in>{H. subgroup H G}. ?g2.0 <# H #> inv ?g2.0) ?H)

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2)) = (\<lambda>H\<in>{H. subgroup H G}. (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) ((\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2) H))
[PROOF STEP]
by (meson restrict_ext)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?g1.0 \<in> carrier G; ?g2.0 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 \<otimes> ?g2.0 <# H #> inv (?g1.0 \<otimes> ?g2.0)) = (\<lambda>H\<in>{H. subgroup H G}. (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 <# H #> inv ?g1.0) ((\<lambda>H\<in>{H. subgroup H G}. ?g2.0 <# H #> inv ?g2.0) H))

goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
hence Step2: "\<And> g1 g2. \<lbrakk> g1 \<in> carrier G; g2 \<in> carrier G \<rbrakk> \<Longrightarrow>
                ?\<phi> (g1 \<otimes> g2) = (?\<phi> g1) \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> (?\<phi> g2)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?g1.0 \<in> carrier G; ?g2.0 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 \<otimes> ?g2.0 <# H #> inv (?g1.0 \<otimes> ?g2.0)) = (\<lambda>H\<in>{H. subgroup H G}. (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 <# H #> inv ?g1.0) ((\<lambda>H\<in>{H. subgroup H G}. ?g2.0 <# H #> inv ?g2.0) H))

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2)) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> (\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2)
[PROOF STEP]
unfolding BijGroup_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?g1.0 \<in> carrier G; ?g2.0 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 \<otimes> ?g2.0 <# H #> inv (?g1.0 \<otimes> ?g2.0)) = (\<lambda>H\<in>{H. subgroup H G}. (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 <# H #> inv ?g1.0) ((\<lambda>H\<in>{H. subgroup H G}. ?g2.0 <# H #> inv ?g2.0) H))

goal (1 subgoal):
 1. \<And>g1 g2. \<lbrakk>g1 \<in> carrier G; g2 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. g1 \<otimes> g2 <# H #> inv (g1 \<otimes> g2)) = (\<lambda>H\<in>{H. subgroup H G}. g1 <# H #> inv g1) \<otimes>\<^bsub>\<lparr>carrier = Bij {H. subgroup H G}, mult = \<lambda>g\<in>Bij {H. subgroup H G}. restrict (compose {H. subgroup H G} g) (Bij {H. subgroup H G}), one = \<lambda>x\<in>{H. subgroup H G}. x\<rparr>\<^esub> (\<lambda>H\<in>{H. subgroup H G}. g2 <# H #> inv g2)
[PROOF STEP]
by (simp add: Step0 compose_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?g1.0 \<in> carrier G; ?g2.0 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 \<otimes> ?g2.0 <# H #> inv (?g1.0 \<otimes> ?g2.0)) = (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 <# H #> inv ?g1.0) \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> (\<lambda>H\<in>{H. subgroup H G}. ?g2.0 <# H #> inv ?g2.0)

goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
show "?\<phi> \<in> {h: carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}).
              \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
using Step1 Step2
[PROOF STATE]
proof (prove)
using this:
(\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G})
\<lbrakk>?g1.0 \<in> carrier G; ?g2.0 \<in> carrier G\<rbrakk> \<Longrightarrow> (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 \<otimes> ?g2.0 <# H #> inv (?g1.0 \<otimes> ?g2.0)) = (\<lambda>H\<in>{H. subgroup H G}. ?g1.0 <# H #> inv ?g1.0) \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> (\<lambda>H\<in>{H. subgroup H G}. ?g2.0 <# H #> inv ?g2.0)

goal (1 subgoal):
 1. (\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>g. \<lambda>H\<in>{H. subgroup H G}. g <# H #> inv g) \<in> {h \<in> carrier G \<rightarrow> carrier (BijGroup {H. subgroup H G}). \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>BijGroup {H. subgroup H G}\<^esub> h y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powrat_mult_base:
      "(x * y) pow\<^sub>\<rat> r = (x pow\<^sub>\<rat> r) * (y pow\<^sub>\<rat> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r * y pow\<^sub>\<rat> r
[PROOF STEP]
proof (cases r)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> (x * y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r * y pow\<^sub>\<rat> r
[PROOF STEP]
case (Fract a b)
[PROOF STATE]
proof (state)
this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> (x * y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r * y pow\<^sub>\<rat> r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r = Fract a b
0 < b
coprime a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. (x * y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r * y pow\<^sub>\<rat> r
[PROOF STEP]
using powrat_def quotient_of_Fract real_root_mult [symmetric]
          power_mult_distrib
[PROOF STATE]
proof (prove)
using this:
r = Fract a b
0 < b
coprime a b
?x pow\<^sub>\<rat> ?r = (if 0 < ?r then root (nat (snd (quotient_of ?r))) (?x ^ nat (fst (quotient_of ?r))) else root (nat (snd (quotient_of ?r))) (1 / ?x ^ nat (- fst (quotient_of ?r))))
quotient_of (Fract ?a ?b) = Rat.normalize (?a, ?b)
root ?n ?x * root ?n ?y = root ?n (?x * ?y)
(?a * ?b) ^ ?n = ?a ^ ?n * ?b ^ ?n

goal (1 subgoal):
 1. (x * y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r * y pow\<^sub>\<rat> r
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(x * y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r * y pow\<^sub>\<rat> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complete_the_square:
  fixes a b c x :: real
  assumes "a \<noteq> 0"
  shows "a*x\<^sup>2 + b * x + c = a * (x + (b / (2*a)))\<^sup>2 - ((b\<^sup>2 - 4* a * c)/(4*a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * x\<^sup>2 + b * x + c = a * (x + b / (2 * a))\<^sup>2 - (b\<^sup>2 - 4 * a * c) / (4 * a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. a * x\<^sup>2 + b * x + c = a * (x + b / (2 * a))\<^sup>2 - (b\<^sup>2 - 4 * a * c) / (4 * a)
[PROOF STEP]
by(simp add: comm_semiring_1_class.power2_sum power2_eq_square[of "b / (2 * a)"] ring_class.ring_distribs(1) division_ring_class.diff_divide_distrib power2_eq_square[of b])


[STATEMENT]
lemma LIMSEQ_inverse_realpow_zero: "1 < x \<Longrightarrow> (\<lambda>n. inverse (x ^ n)) \<longlonglongrightarrow> 0"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> (\<lambda>n. inverse (x ^ n)) \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule filterlim_compose[OF tendsto_inverse_0 filterlim_realpow_sequentially_gt1]) simp


[STATEMENT]
lemma spectral_radius_ev_def: "spectral_radius A = Max (norm ` (Collect (eigen_value A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HMA_Connect.spectral_radius A = Max (cmod ` Collect (eigen_value A))
[PROOF STEP]
unfolding spectral_radius_def eigen_value_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max {uu_. \<exists>v ev. uu_ = cmod ev \<and> eigen_vector A v ev} = Max (cmod ` {k. \<exists>v. eigen_vector A v k})
[PROOF STEP]
by (rule arg_cong[where f = Max], auto)


[STATEMENT]
lemma fps_integral0_linear:
  fixes a b :: "'a::division_ring"
  shows "fps_integral0 (fps_const a * f + fps_const b * g) =
          fps_const a * fps_integral0 f + fps_const b * fps_integral0 g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_integral0 (fps_const a * f + fps_const b * g) = fps_const a * fps_integral0 f + fps_const b * fps_integral0 g
[PROOF STEP]
by    (simp add: fps_integral0_add fps_integral0_fps_const_mult_left)


[STATEMENT]
lemma uint64_nat_bij : "(x :: nat) < 2^64 \<Longrightarrow> nat_of_uint64 (uint64_of_nat x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < 2 ^ 64 \<Longrightarrow> nat_of_uint64 (uint64_of_nat x) = x
[PROOF STEP]
by transfer (simp add: unsigned_of_nat take_bit_nat_eq_self)


[STATEMENT]
lemma not_iless0: "\<not> n < (0::enat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> n < 0
[PROOF STEP]
by (rule not_less_zero)


[STATEMENT]
lemma PiF_gen_subset: "{(\<Pi>' j\<in>J. X j) |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))} \<subseteq>
    Pow (\<Union>J \<in> I. (\<Pi>' j\<in>J. space (M j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Pi' J X |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))} \<subseteq> Pow (\<Union>J\<in>I. \<Pi>' j\<in>J. space (M j))
[PROOF STEP]
by (auto simp: Pi'_def) (blast dest: sets.sets_into_space)


[STATEMENT]
lemma of_rat_inverse: "(of_rat (inverse a) :: 'a::field_char_0) = inverse (of_rat a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (inverse a) = inverse (of_rat a)
[PROOF STEP]
by (cases "a = 0") (simp_all add: nonzero_of_rat_inverse)


[STATEMENT]
lemma (in domain) monom_eq_var_pow:
  assumes "subring K R" "a \<in> carrier R - { \<zero> }"
  shows "monom a n = [ a ] \<otimes>\<^bsub>K[X]\<^esub> (X [^]\<^bsub>K[X]\<^esub> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
have "monom a n = map ((\<otimes>) a) (monom \<one> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.monom a n = map ((\<otimes>) a) (local.monom \<one> n)
[PROOF STEP]
unfolding monom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a # replicate n \<zero> = map ((\<otimes>) a) (\<one> # replicate n \<zero>)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R - {\<zero>}

goal (1 subgoal):
 1. a # replicate n \<zero> = map ((\<otimes>) a) (\<one> # replicate n \<zero>)
[PROOF STEP]
by (induct n) (auto)
[PROOF STATE]
proof (state)
this:
local.monom a n = map ((\<otimes>) a) (local.monom \<one> n)

goal (1 subgoal):
 1. local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.monom a n = map ((\<otimes>) a) (local.monom \<one> n)

goal (1 subgoal):
 1. local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
have " ... = poly_mult [ a ] (monom \<one> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((\<otimes>) a) (local.monom \<one> n) = poly_mult [a] (local.monom \<one> n)
[PROOF STEP]
using poly_mult_const(1)[OF _ monom_is_polynomial assms(2)] carrier_is_subring
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subring (carrier R) R; subring (carrier R) R; ?a1 \<in> carrier R - {\<zero>}\<rbrakk> \<Longrightarrow> poly_mult [a] (local.monom ?a1 ?n1) = map ((\<otimes>) a) (local.monom ?a1 ?n1)
subring (carrier R) R

goal (1 subgoal):
 1. map ((\<otimes>) a) (local.monom \<one> n) = poly_mult [a] (local.monom \<one> n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map ((\<otimes>) a) (local.monom \<one> n) = poly_mult [a] (local.monom \<one> n)

goal (1 subgoal):
 1. local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map ((\<otimes>) a) (local.monom \<one> n) = poly_mult [a] (local.monom \<one> n)

goal (1 subgoal):
 1. local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
have " ... = [ a ] \<otimes>\<^bsub>K[X]\<^esub> (X [^]\<^bsub>K[X]\<^esub> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult [a] (local.monom \<one> n) = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
unfolding unitary_monom_eq_var_pow[OF assms(1)] univ_poly_mult[of R K]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult [a] (X [^]\<^bsub>K [X]\<^esub> n) = poly_mult [a] (X [^]\<^bsub>K [X]\<^esub> n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_mult [a] (local.monom \<one> n) = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n

goal (1 subgoal):
 1. local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n

goal (1 subgoal):
 1. local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.monom a n = [a] \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mono2_step: "C1 \<le> C2 \<Longrightarrow> S1 \<subseteq> S2 \<Longrightarrow> step S1 C1 \<le> step S2 C2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>C1 \<le> C2; S1 \<subseteq> S2\<rbrakk> \<Longrightarrow> step S1 C1 \<le> step S2 C2
[PROOF STEP]
unfolding step_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>C1 \<le> C2; S1 \<subseteq> S2\<rbrakk> \<Longrightarrow> Step (\<lambda>x e S. {s(x := aval e s) |s. s \<in> S}) (\<lambda>b S. {s \<in> S. bval b s}) S1 C1 \<le> Step (\<lambda>x e S. {s(x := aval e s) |s. s \<in> S}) (\<lambda>b S. {s \<in> S. bval b s}) S2 C2
[PROOF STEP]
by(rule mono2_Step) auto


[STATEMENT]
lemma linear_compose_sum:
  assumes lS: "\<forall>a \<in> S. linear s1 s2 (f a)"
  shows "linear s1 s2 (\<lambda>x. sum (\<lambda>a. f a x) S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
proof (cases "finite S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
 2. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite S

goal (2 subgoals):
 1. finite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
 2. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
using lS
[PROOF STATE]
proof (prove)
using this:
finite S
\<forall>a\<in>S. linear (*a) (*b) (f a)

goal (1 subgoal):
 1. linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
by induct (simp_all add: linear_zero linear_compose_add)
[PROOF STATE]
proof (state)
this:
linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)

goal (1 subgoal):
 1. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite S

goal (1 subgoal):
 1. infinite S \<Longrightarrow> linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite S

goal (1 subgoal):
 1. linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)
[PROOF STEP]
by (simp add: linear_zero)
[PROOF STATE]
proof (state)
this:
linear (*a) (*b) (\<lambda>x. \<Sum>a\<in>S. f a x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma msb_shift: "msb w \<longleftrightarrow> w >> LENGTH('a) - 1 \<noteq> 0"
  for w :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. msb w = (w >> LENGTH('a) - 1 \<noteq> 0)
[PROOF STEP]
by (simp add: drop_bit_eq_zero_iff_not_bit_last msb_word_eq shiftr_def)


[STATEMENT]
lemma Lim_component_ge_cart:
  fixes f :: "'a \<Rightarrow> real^'n"
  assumes "(f \<longlongrightarrow> l) net"  "\<not> (trivial_limit net)"  "eventually (\<lambda>x. b \<le> (f x)$i) net"
  shows "b \<le> l$i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<le> l $ i
[PROOF STEP]
by (rule tendsto_le[OF assms(2) tendsto_vec_nth tendsto_const, OF assms(1, 3)])


[STATEMENT]
lemma rel_list_all2_trans:
  "\<lbrakk> \<And>a b c. \<lbrakk>(a,b) \<in> R; (b,c) \<in> S\<rbrakk> \<Longrightarrow> (a,c) \<in> T;
    list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk>
  \<Longrightarrow> list_all2 (fun_of T) as cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a b c. \<lbrakk>(a, b) \<in> R; (b, c) \<in> S\<rbrakk> \<Longrightarrow> (a, c) \<in> T; list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk> \<Longrightarrow> list_all2 (fun_of T) as cs
[PROOF STEP]
by (rule list_all2_trans) auto


[STATEMENT]
lemma poly_no_roots_leq:
  "(\<forall>x. x \<le> a \<longrightarrow> poly p x \<noteq> 0) \<longleftrightarrow>
       ( (p \<noteq> 0 \<and> count_roots_below p a = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<le>a. poly p x \<noteq> 0) = (p \<noteq> 0 \<and> count_roots_below p a = 0)
[PROOF STEP]
by (auto simp: Let_def count_roots_below_correct card_eq_0_iff
             intro: poly_roots_finite)


[STATEMENT]
lemma tensor_mat_add1:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "m2 \<in> carrier_mat d1 d1"
    and "m3 \<in> carrier_mat d2 d2"
  shows "tensor_mat (m1 + m2) m3 = tensor_mat m1 m3 + tensor_mat m2 m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat (m1 + m2) m3 = tensor_mat m1 m3 + tensor_mat m2 m3
[PROOF STEP]
apply (rule eq_matI, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> tensor_mat (m1 + m2) m3 $$ (i, j) = tensor_mat m1 m3 $$ (i, j) + tensor_mat m2 m3 $$ (i, j)
[PROOF STEP]
unfolding tensor_mat_eval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (m1 + m2) $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) + m2 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
using assms(2) comm_semiring_class.distrib
[PROOF STATE]
proof (prove)
using this:
m2 \<in> carrier_mat d1 d1
(?a + ?b) * ?c = ?a * ?c + ?b * ?c

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (m1 + m2) $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) + m2 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
by force


[STATEMENT]
lemma measure_mono_fmeasurable:
  "A \<subseteq> B \<Longrightarrow> A \<in> sets M \<Longrightarrow> B \<in> fmeasurable M \<Longrightarrow> measure M A \<le> measure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; A \<in> sets M; B \<in> fmeasurable M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B
[PROOF STEP]
by (auto simp: measure_def fmeasurable_def intro!: emeasure_mono enn2real_mono)


[STATEMENT]
lemma (in padic_integers) p_res_ring_car:
"carrier (Zp_res_ring k) = {0..<p^k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (residue_ring (p ^ k)) = {0..<p ^ k}
[PROOF STEP]
using residue_ring_def[of "p^k"]
[PROOF STATE]
proof (prove)
using this:
residue_ring (p ^ k) = \<lparr>carrier = {0..p ^ k - 1}, monoid.mult = \<lambda>x y. x * y mod p ^ k, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod p ^ k\<rparr>

goal (1 subgoal):
 1. carrier (residue_ring (p ^ k)) = {0..<p ^ k}
[PROOF STEP]
by auto


[STATEMENT]
lemma cnj_tan: "cnj(tan z) = tan(cnj z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (tan z) = tan (cnj z)
[PROOF STEP]
by (simp add: cnj_cos cnj_sin tan_def)


[STATEMENT]
lemma GDERIV_DERIV_compose:
    "\<lbrakk>GDERIV f x :> df; DERIV g (f x) :> dg\<rbrakk>
     \<Longrightarrow> GDERIV (\<lambda>x. g (f x)) x :> scaleR dg df"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>GDERIV f x :> df; (g has_real_derivative dg) (at (f x))\<rbrakk> \<Longrightarrow> GDERIV (\<lambda>x. g (f x)) x :> dg *\<^sub>R df
[PROOF STEP]
unfolding gderiv_def has_field_derivative_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative (\<lambda>h. inner h df)) (at x); (g has_derivative (*) dg) (at (f x))\<rbrakk> \<Longrightarrow> ((\<lambda>x. g (f x)) has_derivative (\<lambda>h. inner h (dg *\<^sub>R df))) (at x)
[PROOF STEP]
apply (drule (1) has_derivative_compose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(g has_derivative (*) dg) (at (f x)); ((\<lambda>x. g (f x)) has_derivative (\<lambda>x. dg * inner x df)) (at x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. g (f x)) has_derivative (\<lambda>h. inner h (dg *\<^sub>R df))) (at x)
[PROOF STEP]
apply (simp add: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tensor_unpack_sndsnd: \<open>snd (tensor_unpack B C (snd (tensor_unpack A (B * C) i)))
     = snd (tensor_unpack (A * B) C i)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (tensor_unpack B C (snd (tensor_unpack A (B * C) i))) = snd (tensor_unpack (A * B) C i)
[PROOF STEP]
unfolding tensor_unpack_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (snd (i div (B * C), i mod (B * C)) div C, snd (i div (B * C), i mod (B * C)) mod C) = snd (i div C, i mod C)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i mod (B * C) mod C = i mod C
[PROOF STEP]
by (meson dvd_triv_right mod_mod_cancel)


[STATEMENT]
lemma insertion_sum' : "\<And>(n::nat). ((insertion f (\<Sum>i\<le>n. g(i))) = (\<Sum>i\<le>n. insertion f (g i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. insertion f (sum g {..n}) = (\<Sum>i\<le>n. insertion f (g i))
[PROOF STEP]
by (metis (no_types, lifting) fun_sum_commute insertion_add insertion_zero sum.cong)


[STATEMENT]
lemma "eventually (\<lambda>x::real. x < x^2) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. x < x\<^sup>2
[PROOF STEP]
by real_asymp


[STATEMENT]
theorem bird_rationals:
  assumes "m > 0" "n > 0"
  shows "root (traverse_tree (odd_mirror_path (mk_path m n)) (pure rat_of \<diamondop> bird)) = Fract (int m) (int n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root (traverse_tree (odd_mirror_path (mk_path m n)) (pure rat_of \<diamondop> bird)) = Fract (int m) (int n)
[PROOF STEP]
using stern_brocot_rationals[OF assms]
[PROOF STATE]
proof (prove)
using this:
root (traverse_tree (mk_path m n) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int m) (int n)

goal (1 subgoal):
 1. root (traverse_tree (odd_mirror_path (mk_path m n)) (pure rat_of \<diamondop> bird)) = Fract (int m) (int n)
[PROOF STEP]
by (simp add: odd_mirror_bird_stern_brocot[symmetric])


[STATEMENT]
lemma nth_default_ntt_coeff_mult:
"nth_default 0 (ntt_coeffs (f * g)) i =
 nth_default 0 (map2 (*)
  (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)])
  (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i"
(is "?left i = ?right i")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
proof (cases "i\<in>{0..<n}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<in> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
 2. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i \<in> {0..<n}

goal (2 subgoals):
 1. i \<in> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
 2. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> {0..<n}
[PROOF STEP]
have l: "?left i = ntt_coeffs (f * g) ! i"
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<n}

goal (1 subgoal):
 1. nth_default 0 (ntt_coeffs (f * g)) i = ntt_coeffs (f * g) ! i
[PROOF STEP]
by (simp add: nth_default_nth ntt_coeffs_def)
[PROOF STATE]
proof (state)
this:
nth_default 0 (ntt_coeffs (f * g)) i = ntt_coeffs (f * g) ! i

goal (2 subgoals):
 1. i \<in> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
 2. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
have *: "?right i = (poly.coeff (Poly (ntt_coeffs f)) i) * (poly.coeff (Poly (ntt_coeffs g)) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = poly.coeff (Poly (ntt_coeffs f)) i * poly.coeff (Poly (ntt_coeffs g)) i
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<n}

goal (1 subgoal):
 1. nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = poly.coeff (Poly (ntt_coeffs f)) i * poly.coeff (Poly (ntt_coeffs g)) i
[PROOF STEP]
by (metis (no_types, lifting) coeff_Poly_eq diff_zero length_map length_upt
      map_nth_default mult_hom.hom_zero nat_int nth_default_map2 ntt_coeffs_def)
[PROOF STATE]
proof (state)
this:
nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = poly.coeff (Poly (ntt_coeffs f)) i * poly.coeff (Poly (ntt_coeffs g)) i

goal (2 subgoals):
 1. i \<in> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
 2. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = poly.coeff (Poly (ntt_coeffs f)) i * poly.coeff (Poly (ntt_coeffs g)) i
[PROOF STEP]
have r: "?right i = (ntt_coeffs f) ! i * (ntt_coeffs g) ! i"
[PROOF STATE]
proof (prove)
using this:
nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = poly.coeff (Poly (ntt_coeffs f)) i * poly.coeff (Poly (ntt_coeffs g)) i

goal (1 subgoal):
 1. nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = ntt_coeffs f ! i * ntt_coeffs g ! i
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
poly.coeff (Poly (ntt_coeffs f)) i * poly.coeff (Poly (ntt_coeffs g)) i = poly.coeff (Poly (ntt_coeffs f)) i * poly.coeff (Poly (ntt_coeffs g)) i

goal (1 subgoal):
 1. poly.coeff (Poly (ntt_coeffs f)) i * poly.coeff (Poly (ntt_coeffs g)) i = ntt_coeffs f ! i * ntt_coeffs g ! i
[PROOF STEP]
unfolding coeff_Poly
[PROOF STATE]
proof (prove)
using this:
nth_default 0 (ntt_coeffs f) i * nth_default 0 (ntt_coeffs g) i = nth_default 0 (ntt_coeffs f) i * nth_default 0 (ntt_coeffs g) i

goal (1 subgoal):
 1. nth_default 0 (ntt_coeffs f) i * nth_default 0 (ntt_coeffs g) i = ntt_coeffs f ! i * ntt_coeffs g ! i
[PROOF STEP]
using nth_default_nth
[PROOF STATE]
proof (prove)
using this:
nth_default 0 (ntt_coeffs f) i * nth_default 0 (ntt_coeffs g) i = nth_default 0 (ntt_coeffs f) i * nth_default 0 (ntt_coeffs g) i
?n < length ?xs \<Longrightarrow> nth_default ?dflt ?xs ?n = ?xs ! ?n

goal (1 subgoal):
 1. nth_default 0 (ntt_coeffs f) i * nth_default 0 (ntt_coeffs g) i = ntt_coeffs f ! i * ntt_coeffs g ! i
[PROOF STEP]
by (metis True atLeastLessThan_iff diff_zero length_map length_upt ntt_coeffs_def)
[PROOF STATE]
proof (state)
this:
nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = ntt_coeffs f ! i * ntt_coeffs g ! i

goal (2 subgoals):
 1. i \<in> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
 2. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
unfolding l r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ntt_coeffs (f * g) ! i = ntt_coeffs f ! i * ntt_coeffs g ! i
[PROOF STEP]
using ntt_coeffs_mult True
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> ntt_coeffs (?f * ?g) ! ?i = ntt_coeffs ?f ! ?i * ntt_coeffs ?g ! ?i
i \<in> {0..<n}

goal (1 subgoal):
 1. ntt_coeffs (f * g) ! i = ntt_coeffs f ! i * ntt_coeffs g ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i

goal (1 subgoal):
 1. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
i \<notin> {0..<n}

goal (1 subgoal):
 1. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<notin> {0..<n}
[PROOF STEP]
have "?left i = 0"
[PROOF STATE]
proof (prove)
using this:
i \<notin> {0..<n}

goal (1 subgoal):
 1. nth_default 0 (ntt_coeffs (f * g)) i = 0
[PROOF STEP]
unfolding ntt_coeffs_def
[PROOF STATE]
proof (prove)
using this:
i \<notin> {0..<n}

goal (1 subgoal):
 1. nth_default 0 (map (ntt_coeff_poly (f * g)) [0..<n]) i = 0
[PROOF STEP]
by (simp add: nth_default_beyond)
[PROOF STATE]
proof (state)
this:
nth_default 0 (ntt_coeffs (f * g)) i = 0

goal (1 subgoal):
 1. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
nth_default 0 (ntt_coeffs (f * g)) i = 0

goal (1 subgoal):
 1. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
have "?right i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = 0
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
i \<notin> {0..<n}

goal (1 subgoal):
 1. nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = 0
[PROOF STEP]
by (simp add: nth_default_def)
[PROOF STATE]
proof (state)
this:
nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = 0

goal (1 subgoal):
 1. i \<notin> {0..<n} \<Longrightarrow> nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
nth_default 0 (ntt_coeffs (f * g)) i = 0
nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nth_default 0 (ntt_coeffs (f * g)) i = 0
nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i = 0

goal (1 subgoal):
 1. nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
nth_default 0 (ntt_coeffs (f * g)) i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_lt_square: "norm x < a \<longleftrightarrow> 0 < a \<and> cinner x x < complex_of_real (a\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x < a) = (0 < a \<and> cinner x x < complex_of_real (a\<^sup>2))
[PROOF STEP]
by (meson cnorm_ge_square cnorm_le_square less_le_not_le)


[STATEMENT]
lemma AE_iff_measurable:
  "N \<in> sets M \<Longrightarrow> {x\<in>space M. \<not> P x} = N \<Longrightarrow> (AE x in M. P x) \<longleftrightarrow> emeasure M N = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>N \<in> sets M; {x \<in> space M. \<not> P x} = N\<rbrakk> \<Longrightarrow> almost_everywhere M P = (emeasure M N = 0)
[PROOF STEP]
using AE_iff_null[of _ P]
[PROOF STATE]
proof (prove)
using this:
{x \<in> space ?M. \<not> P x} \<in> sets ?M \<Longrightarrow> almost_everywhere ?M P = ({x \<in> space ?M. \<not> P x} \<in> null_sets ?M)

goal (1 subgoal):
 1. \<lbrakk>N \<in> sets M; {x \<in> space M. \<not> P x} = N\<rbrakk> \<Longrightarrow> almost_everywhere M P = (emeasure M N = 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma no_bounded_path_component_imp_winding_number_zero:
  assumes g: "path g" "path_image g \<subseteq> S" "pathfinish g = pathstart g" "z \<notin> S"
      and nb: "\<And>z. bounded (path_component_set (- S) z) \<Longrightarrow> z \<in> S"
  shows "winding_number g z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number g z = 0
[PROOF STEP]
by (simp add: bounded_subset nb path_component_subset_connected_component
                no_bounded_connected_component_imp_winding_number_zero [OF g])


[STATEMENT]
theorem POR_is_not_definable:
  shows "\<not>(\<exists>f. definable f \<and> appFLv f [POR_arg1_rel, POR_arg2_rel] = POR_result_rel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>f. definable f \<and> appFLv f [POR_arg1_rel, POR_arg2_rel] = POR_result_rel
[PROOF STEP]
apply (rule not_definable[where R="unlr POR.delta"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. PCF_lr (unlr POR.delta)
 2. set [POR_arg1_rel, POR_arg2_rel] \<subseteq> unlr POR.delta
 3. POR_result_rel \<notin> unlr POR.delta
[PROOF STEP]
using lr_POR_arg1_rel lr_POR_arg2_rel lr_POR_result_rel PCF_lr_POR_delta
[PROOF STATE]
proof (prove)
using this:
POR_arg1_rel \<in> unlr POR.delta
POR_arg2_rel \<in> unlr POR.delta
POR_result_rel \<notin> unlr POR.delta
PCF_lr (unlr POR.delta)

goal (3 subgoals):
 1. PCF_lr (unlr POR.delta)
 2. set [POR_arg1_rel, POR_arg2_rel] \<subseteq> unlr POR.delta
 3. POR_result_rel \<notin> unlr POR.delta
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma group_semidirect_sum_image_ker:
  assumes f: "f \<in> hom G H" and g: "g \<in> hom H K" and iso: "(g \<circ> f) \<in> iso G K"
     and "group G" "group H" "group K"
   shows "(f ` carrier G) \<inter> (kernel H K g) = {\<one>\<^bsub>H\<^esub>}"
          "f ` carrier G <#>\<^bsub>H\<^esub> (kernel H K g) = carrier H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>} &&& f ` carrier G <#>\<^bsub>H\<^esub> kernel H K g = carrier H
[PROOF STEP]
using group_Int_image_ker [OF f g] group_sum_image_ker [OF f g] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>inj_on (g \<circ> f) (carrier G); Group.group G; Group.group H; Group.group K\<rbrakk> \<Longrightarrow> f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
\<lbrakk>(g \<circ> f) ` carrier G = carrier K; Group.group G; Group.group H; Group.group K\<rbrakk> \<Longrightarrow> f ` carrier G <#>\<^bsub>H\<^esub> kernel H K g = carrier H
f \<in> hom G H
g \<in> hom H K
g \<circ> f \<in> Group.iso G K
Group.group G
Group.group H
Group.group K

goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>} &&& f ` carrier G <#>\<^bsub>H\<^esub> kernel H K g = carrier H
[PROOF STEP]
by (simp_all add: iso_def bij_betw_def)


[STATEMENT]
lemma dirichlet_prod_code [code]:
  "dirichlet_prod f g n = (if n = 0 then 0 else
     fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d * g (n div d) + acc else acc) 1 n 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod f g n = (if n = 0 then 0::'a else fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d * g (n div d) + acc else acc) 1 n (0::'a))
[PROOF STEP]
unfolding dirichlet_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d * g (n div d)) = (if n = 0 then 0::'a else fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d * g (n div d) + acc else acc) 1 n (0::'a))
[PROOF STEP]
by (simp add: sum_divisors_code)


[STATEMENT]
lemma poly_subst_minus:
  "poly_subst f (p - q) = poly_subst f p - poly_subst f (q::('x \<Rightarrow>\<^sub>0 nat) \<Rightarrow>\<^sub>0 'b::comm_ring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_subst f (p - q) = poly_subst f p - poly_subst f q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_subst f (p - q) = poly_subst f p - poly_subst f q
[PROOF STEP]
have "poly_subst f (p + (-q)) = poly_subst f p + poly_subst f (-q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_subst f (p + - q) = poly_subst f p + poly_subst f (- q)
[PROOF STEP]
by (fact poly_subst_plus)
[PROOF STATE]
proof (state)
this:
poly_subst f (p + - q) = poly_subst f p + poly_subst f (- q)

goal (1 subgoal):
 1. poly_subst f (p - q) = poly_subst f p - poly_subst f q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
poly_subst f (p + - q) = poly_subst f p + poly_subst f (- q)

goal (1 subgoal):
 1. poly_subst f (p - q) = poly_subst f p - poly_subst f q
[PROOF STEP]
by (simp add: poly_subst_uminus)
[PROOF STATE]
proof (state)
this:
poly_subst f (p - q) = poly_subst f p - poly_subst f q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cmod_diff_real_less: "Im z \<noteq> 0 \<Longrightarrow> x\<noteq>0 \<Longrightarrow> cmod (z - x) < cmod z + \<bar>x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Im z \<noteq> 0; x \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (z - complex_of_real x) < cmod z + \<bar>x\<bar>
[PROOF STEP]
using cmod_add_real_less [of z "-x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Im z \<noteq> 0; - x \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (z + complex_of_real (- x)) < cmod z + \<bar>- x\<bar>

goal (1 subgoal):
 1. \<lbrakk>Im z \<noteq> 0; x \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (z - complex_of_real x) < cmod z + \<bar>x\<bar>
[PROOF STEP]
by simp


[STATEMENT]
lemma minus_mult_distrib_mat[algebra_simps]: fixes A :: "'a :: ring mat"
  assumes m: "A \<in> carrier_mat nr n" "B \<in> carrier_mat nr n" "C \<in> carrier_mat n nc"
  shows "(A - B) * C = A * C - B * C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A - B) * C = A * C - B * C
[PROOF STEP]
unfolding minus_add_uminus_mat[OF m(1,2)]
    add_mult_distrib_mat[OF m(1) uminus_carrier_mat[OF m(2)] m(3)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * C + - B * C = A * C - B * C
[PROOF STEP]
by (subst uminus_mult_left_mat, insert m, auto)


[STATEMENT]
lemma interior_of_subtopology_subset:
     "U \<inter> X interior_of S \<subseteq> (subtopology X U) interior_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<inter> X interior_of S \<subseteq> subtopology X U interior_of S
[PROOF STEP]
by (auto simp: interior_of_def openin_subtopology)