[STATEMENT]
lemma homeomorphic_scaling:
  fixes S :: "'a::real_normed_vector set"
  assumes "c \<noteq> 0"
  shows "S homeomorphic ((\<lambda>x. c *\<^sub>R x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic (*\<^sub>R) c ` S
[PROOF STEP]
unfolding homeomorphic_minimal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f g. (\<forall>x\<in>S. f x \<in> (*\<^sub>R) c ` S \<and> g (f x) = x) \<and> (\<forall>y\<in>(*\<^sub>R) c ` S. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on ((*\<^sub>R) c ` S) g
[PROOF STEP]
apply (rule_tac x="\<lambda>x. c *\<^sub>R x" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. (\<forall>x\<in>S. c *\<^sub>R x \<in> (*\<^sub>R) c ` S \<and> g (c *\<^sub>R x) = x) \<and> (\<forall>y\<in>(*\<^sub>R) c ` S. g y \<in> S \<and> c *\<^sub>R g y = y) \<and> continuous_on S ((*\<^sub>R) c) \<and> continuous_on ((*\<^sub>R) c ` S) g
[PROOF STEP]
apply (rule_tac x="\<lambda>x. (1 / c) *\<^sub>R x" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>S. c *\<^sub>R x \<in> (*\<^sub>R) c ` S \<and> (1 / c) *\<^sub>R c *\<^sub>R x = x) \<and> (\<forall>y\<in>(*\<^sub>R) c ` S. (1 / c) *\<^sub>R y \<in> S \<and> c *\<^sub>R (1 / c) *\<^sub>R y = y) \<and> continuous_on S ((*\<^sub>R) c) \<and> continuous_on ((*\<^sub>R) c ` S) ((*\<^sub>R) (1 / c))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0

goal (1 subgoal):
 1. (\<forall>x\<in>S. c *\<^sub>R x \<in> (*\<^sub>R) c ` S \<and> (1 / c) *\<^sub>R c *\<^sub>R x = x) \<and> (\<forall>y\<in>(*\<^sub>R) c ` S. (1 / c) *\<^sub>R y \<in> S \<and> c *\<^sub>R (1 / c) *\<^sub>R y = y) \<and> continuous_on S ((*\<^sub>R) c) \<and> continuous_on ((*\<^sub>R) c ` S) ((*\<^sub>R) (1 / c))
[PROOF STEP]
by (auto simp: continuous_intros)


[STATEMENT]
lemma alt_group_card_carrier:
  assumes "n \<ge> 2" shows "2 * card (carrier (alt_group n)) = fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * card (carrier (alt_group n)) = fact n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * card (carrier (alt_group n)) = fact n
[PROOF STEP]
have "card (rcosets\<^bsub>sym_group n\<^esub> (carrier (alt_group n))) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) = 2
[PROOF STEP]
using iso_same_card[OF sign_iso[OF assms]]
[PROOF STATE]
proof (prove)
using this:
card (carrier (sym_group n Mod carrier (alt_group n))) = card (carrier sign_img)

goal (1 subgoal):
 1. card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) = 2
[PROOF STEP]
unfolding FactGroup_def sign_img_def
[PROOF STATE]
proof (prove)
using this:
card (carrier \<lparr>carrier = rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n), monoid.mult = (<#>\<^bsub>sym_group n\<^esub>), one = carrier (alt_group n)\<rparr>) = card (carrier \<lparr>carrier = {- 1, 1}, monoid.mult = (*), one = 1\<rparr>)

goal (1 subgoal):
 1. card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) = 2

goal (1 subgoal):
 1. 2 * card (carrier (alt_group n)) = fact n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) = 2

goal (1 subgoal):
 1. 2 * card (carrier (alt_group n)) = fact n
[PROOF STEP]
using group.lagrange[OF sym_group_is_group alt_group_is_subgroup, of n]
[PROOF STATE]
proof (prove)
using this:
card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) = 2
card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) * card (carrier (alt_group n)) = order (sym_group n)

goal (1 subgoal):
 1. 2 * card (carrier (alt_group n)) = fact n
[PROOF STEP]
unfolding order_def sym_group_card_carrier
[PROOF STATE]
proof (prove)
using this:
card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) = 2
card (rcosets\<^bsub>sym_group n\<^esub> carrier (alt_group n)) * card (carrier (alt_group n)) = fact n

goal (1 subgoal):
 1. 2 * card (carrier (alt_group n)) = fact n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * card (carrier (alt_group n)) = fact n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma M_cong_7_mod_8: "[M = 7] (mod 8)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [M = 7] (mod 8)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [M = 7] (mod 8)
[PROOF STEP]
have "2 ^ 3 dvd (2 ^ p :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ 3 dvd 2 ^ p
[PROOF STEP]
using p_gt_2
[PROOF STATE]
proof (prove)
using this:
2 < p

goal (1 subgoal):
 1. 2 ^ 3 dvd 2 ^ p
[PROOF STEP]
by (intro le_imp_power_dvd) auto
[PROOF STATE]
proof (state)
this:
2 ^ 3 dvd 2 ^ p

goal (1 subgoal):
 1. [M = 7] (mod 8)
[PROOF STEP]
hence "[2 ^ p - 1 = 0 - 1] (mod (8 :: int))"
[PROOF STATE]
proof (prove)
using this:
2 ^ 3 dvd 2 ^ p

goal (1 subgoal):
 1. [2 ^ p - 1 = 0 - 1] (mod 8)
[PROOF STEP]
by (intro cong_diff) (auto simp: cong_def)
[PROOF STATE]
proof (state)
this:
[2 ^ p - 1 = 0 - 1] (mod 8)

goal (1 subgoal):
 1. [M = 7] (mod 8)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[2 ^ p - 1 = 0 - 1] (mod 8)

goal (1 subgoal):
 1. [M = 7] (mod 8)
[PROOF STEP]
have "2 ^ p - 1 = int M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ p - 1 = int M
[PROOF STEP]
by (simp add: M_def of_nat_diff)
[PROOF STATE]
proof (state)
this:
2 ^ p - 1 = int M

goal (1 subgoal):
 1. [M = 7] (mod 8)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[int M = 0 - 1] (mod 8)
[PROOF STEP]
have "int M mod int 8 = 7"
[PROOF STATE]
proof (prove)
using this:
[int M = 0 - 1] (mod 8)

goal (1 subgoal):
 1. int M mod int 8 = 7
[PROOF STEP]
by (simp add: cong_def)
[PROOF STATE]
proof (state)
this:
int M mod int 8 = 7

goal (1 subgoal):
 1. [M = 7] (mod 8)
[PROOF STEP]
thus "[M = 7] (mod 8)"
[PROOF STATE]
proof (prove)
using this:
int M mod int 8 = 7

goal (1 subgoal):
 1. [M = 7] (mod 8)
[PROOF STEP]
by (subst (asm) zmod_int [symmetric]) (auto simp: cong_def)
[PROOF STATE]
proof (state)
this:
[M = 7] (mod 8)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma append_split_vec_distrib_scalar_prod:
  assumes "dim_vec (u @\<^sub>v w) = dim_vec x"
  shows "(u @\<^sub>v w) \<bullet> x = u \<bullet> (vec_first x (dim_vec u)) + w \<bullet> (vec_last x (dim_vec w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)
[PROOF STEP]
have "(u @\<^sub>v w) \<bullet> (vec_first x (dim_vec u) @\<^sub>v vec_last x (dim_vec w)) =
              u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> (vec_first x (dim_vec u) @\<^sub>v vec_last x (dim_vec w)) = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)
[PROOF STEP]
by (meson carrier_vec_dim_vec scalar_prod_append vec_first_carrier vec_last_carrier)
[PROOF STATE]
proof (state)
this:
(u @\<^sub>v w) \<bullet> (vec_first x (dim_vec u) @\<^sub>v vec_last x (dim_vec w)) = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(u @\<^sub>v w) \<bullet> (vec_first x (dim_vec u) @\<^sub>v vec_last x (dim_vec w)) = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(u @\<^sub>v w) \<bullet> (vec_first x (dim_vec u) @\<^sub>v vec_last x (dim_vec w)) = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)
[PROOF STEP]
by (metis assms carrier_vec_dim_vec index_append_vec(2) vec_first_last_append)
[PROOF STATE]
proof (state)
this:
(u @\<^sub>v w) \<bullet> x = u \<bullet> vec_first x (dim_vec u) + w \<bullet> vec_last x (dim_vec w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma asymp_equiv_at_top_imp_at:
  "(\<lambda>x. f (a - inverse x)) \<sim>[at_top] (\<lambda>x. g (a - inverse x)) \<Longrightarrow>
   (\<lambda>x. f (a + inverse x)) \<sim>[at_top] (\<lambda>x. g (a + inverse x)) \<Longrightarrow> f \<sim>[at a] g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. f (a - inverse x)) \<sim>[at_top] (\<lambda>x. g (a - inverse x)); (\<lambda>x. f (a + inverse x)) \<sim>[at_top] (\<lambda>x. g (a + inverse x))\<rbrakk> \<Longrightarrow> f \<sim>[at a] g
[PROOF STEP]
unfolding asymp_equiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. if f (a - inverse x) = 0 \<and> g (a - inverse x) = 0 then 1 else f (a - inverse x) / g (a - inverse x)) \<longlongrightarrow> 1) at_top; ((\<lambda>x. if f (a + inverse x) = 0 \<and> g (a + inverse x) = 0 then 1 else f (a + inverse x) / g (a + inverse x)) \<longlongrightarrow> 1) at_top\<rbrakk> \<Longrightarrow> (\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<midarrow>a\<rightarrow> 1
[PROOF STEP]
using asymp_equiv_at_top_imp_at_left[of a] asymp_equiv_at_top_imp_at_right[of a]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f (a - inverse x)) \<sim>[at_top] (\<lambda>x. g (a - inverse x)) \<Longrightarrow> f \<sim>[at_left a] g
(\<lambda>x. f (a + inverse x)) \<sim>[at_top] (\<lambda>x. g (a + inverse x)) \<Longrightarrow> f \<sim>[at_right a] g

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. if f (a - inverse x) = 0 \<and> g (a - inverse x) = 0 then 1 else f (a - inverse x) / g (a - inverse x)) \<longlongrightarrow> 1) at_top; ((\<lambda>x. if f (a + inverse x) = 0 \<and> g (a + inverse x) = 0 then 1 else f (a + inverse x) / g (a + inverse x)) \<longlongrightarrow> 1) at_top\<rbrakk> \<Longrightarrow> (\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<midarrow>a\<rightarrow> 1
[PROOF STEP]
by (intro filterlim_split_at) (auto simp: asymp_equiv_def)


[STATEMENT]
lemma frechet_derivative_sqrt: "frechet_derivative (\<lambda>x. sqrt (f x)) (at x) =
  (\<lambda>v. (if f x > 0 then 1 else -1) / (2 * sqrt (f x)) * frechet_derivative f (at x) v)"
  if "f differentiable at x" "f x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frechet_derivative (\<lambda>x. sqrt (f x)) (at x) = (\<lambda>v. (if 0 < f x then 1 else - 1) / (2 * sqrt (f x)) * frechet_derivative f (at x) v)
[PROOF STEP]
apply (rule frechet_derivative_at')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. sqrt (f x)) has_derivative (\<lambda>v. (if 0 < f x then 1 else - 1) / (2 * sqrt (f x)) * frechet_derivative f (at x) v)) (at x)
[PROOF STEP]
apply (rule sqrt_has_derivative[THEN has_derivative_eq_rhs])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (f has_derivative ?f'3) (at x)
 2. f x \<noteq> 0
 3. (\<lambda>xa. (if 0 < f x then 1 else - 1) / (2 * sqrt (f x)) * ?f'3 xa) = (\<lambda>v. (if 0 < f x then 1 else - 1) / (2 * sqrt (f x)) * frechet_derivative f (at x) v)
[PROOF STEP]
by (auto intro!: frechet_derivative_worksI that simp: divide_simps)


[STATEMENT]
lemma mat_of_vec_mult_vec:
  fixes a b c :: "'a::conjugatable_field vec"
  assumes a: "a \<in> carrier_vec d" and b: "b \<in> carrier_vec d"
  shows "mat 1 d (\<lambda>(i, j). (conjugate a) $ j) *\<^sub>v b = vec 1 (\<lambda>k. inner_prod a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 1 d (\<lambda>(i, j). conjugate a $ j) *\<^sub>v b = vec 1 (\<lambda>k. inner_prod a b)
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (vec 1 (\<lambda>k. inner_prod a b)) \<Longrightarrow> (mat 1 d (\<lambda>(i, j). conjugate a $ j) *\<^sub>v b) $ i = vec 1 (\<lambda>k. inner_prod a b) $ i
 2. dim_vec (mat 1 d (\<lambda>(i, j). conjugate a $ j) *\<^sub>v b) = dim_vec (vec 1 (\<lambda>k. inner_prod a b))
[PROOF STEP]
apply (simp add: scalar_prod_def carrier_vecD[OF a] carrier_vecD[OF b])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<Sum>i = 0..<d. conjugate (a $ i) * b $ i) = (\<Sum>i = 0..<d. b $ i * conjugate (a $ i))
 2. dim_vec (mat 1 d (\<lambda>(i, j). conjugate a $ j) *\<^sub>v b) = dim_vec (vec 1 (\<lambda>k. inner_prod a b))
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. {0..<d} = {0..<d}
 2. \<And>x. x \<in> {0..<d} \<Longrightarrow> conjugate (a $ x) * b $ x = b $ x * conjugate (a $ x)
 3. dim_vec (mat 1 d (\<lambda>(i, j). conjugate a $ j) *\<^sub>v b) = dim_vec (vec 1 (\<lambda>k. inner_prod a b))
[PROOF STEP]
by auto


[STATEMENT]
lemma conjugate_vec_sprod_comm:
  fixes v w :: "'a :: {conjugatable_ring, comm_ring} vec"
  assumes "v : carrier_vec n" and "w : carrier_vec n"
  shows "v \<bullet>c w = (conjugate w \<bullet> v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet>c w = conjugate w \<bullet> v
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate w). v $ i * conjugate w $ i) = (\<Sum>i = 0..<dim_vec v. conjugate w $ i * v $ i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
w \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate w). v $ i * conjugate w $ i) = (\<Sum>i = 0..<dim_vec v. conjugate w $ i * v $ i)
[PROOF STEP]
by(subst sum.ivl_cong, auto simp: ac_simps)


[STATEMENT]
lemma cos_times_cos: "cos w * cos z = (cos (w - z) + cos (w + z)) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos w * cos z = (cos (w - z) + cos (w + z)) / (2::'a)
[PROOF STEP]
by (simp add: cos_diff cos_add)


[STATEMENT]
lemma cube_minus2:
fixes p q
shows "(((p::rat_poly) - (q::rat_poly))^3)
                = (p^3) - 3*(p^2)*(q) + 3*(p)*(q^2) - (q^3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
using cube_minus
[PROOF STATE]
proof (prove)
using this:
\<forall>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3

goal (1 subgoal):
 1. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
by auto


[STATEMENT]
lemma outer_minus_minus:
  fixes a::"complex Matrix.vec"
  assumes "dim_vec a = dim_vec b"
  and "dim_vec u = dim_vec v"
  shows "outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v -
      outer_prod b u +  outer_prod b v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
have "outer_prod (a - b) (u - v) = outer_prod a (u - v)
    - outer_prod b (u - v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a (u - v) - outer_prod b (u - v)
[PROOF STEP]
using  outer_prod_minus_left assms
[PROOF STATE]
proof (prove)
using this:
dim_vec ?v = dim_vec ?x \<Longrightarrow> outer_prod (?v - ?x) ?w = outer_prod ?v ?w - outer_prod ?x ?w
dim_vec a = dim_vec b
dim_vec u = dim_vec v

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a (u - v) - outer_prod b (u - v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod (a - b) (u - v) = outer_prod a (u - v) - outer_prod b (u - v)

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
outer_prod (a - b) (u - v) = outer_prod a (u - v) - outer_prod b (u - v)

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
have "... = outer_prod a u - outer_prod a v -
    outer_prod b (u - v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod a (u - v) - outer_prod b (u - v) = outer_prod a u - outer_prod a v - outer_prod b (u - v)
[PROOF STEP]
using assms outer_prod_minus_right
[PROOF STATE]
proof (prove)
using this:
dim_vec a = dim_vec b
dim_vec u = dim_vec v
dim_vec ?w = dim_vec ?x \<Longrightarrow> outer_prod ?v (?w - ?x) = outer_prod ?v ?w - outer_prod ?v ?x

goal (1 subgoal):
 1. outer_prod a (u - v) - outer_prod b (u - v) = outer_prod a u - outer_prod a v - outer_prod b (u - v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod a (u - v) - outer_prod b (u - v) = outer_prod a u - outer_prod a v - outer_prod b (u - v)

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
outer_prod a (u - v) - outer_prod b (u - v) = outer_prod a u - outer_prod a v - outer_prod b (u - v)

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
have "... = outer_prod a u - outer_prod a v -
    (outer_prod b u - outer_prod b v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod a u - outer_prod a v - outer_prod b (u - v) = outer_prod a u - outer_prod a v - (outer_prod b u - outer_prod b v)
[PROOF STEP]
using assms outer_prod_minus_right
[PROOF STATE]
proof (prove)
using this:
dim_vec a = dim_vec b
dim_vec u = dim_vec v
dim_vec ?w = dim_vec ?x \<Longrightarrow> outer_prod ?v (?w - ?x) = outer_prod ?v ?w - outer_prod ?v ?x

goal (1 subgoal):
 1. outer_prod a u - outer_prod a v - outer_prod b (u - v) = outer_prod a u - outer_prod a v - (outer_prod b u - outer_prod b v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod a u - outer_prod a v - outer_prod b (u - v) = outer_prod a u - outer_prod a v - (outer_prod b u - outer_prod b v)

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
outer_prod a u - outer_prod a v - outer_prod b (u - v) = outer_prod a u - outer_prod a v - (outer_prod b u - outer_prod b v)

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
have "...  = outer_prod a u - outer_prod a v -
    outer_prod b u +  outer_prod b v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod a u - outer_prod a v - (outer_prod b u - outer_prod b v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
proof (rule mat_minus_minus)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. outer_prod a u - outer_prod a v \<in> carrier_mat ?n ?m
 2. outer_prod b u \<in> carrier_mat ?n ?m
 3. outer_prod b v \<in> carrier_mat ?n ?m
[PROOF STEP]
show "outer_prod b u \<in> carrier_mat (dim_vec b) (dim_vec u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod b u \<in> carrier_mat (dim_vec b) (dim_vec u)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod b u \<in> carrier_mat (dim_vec b) (dim_vec u)

goal (2 subgoals):
 1. outer_prod a u - outer_prod a v \<in> carrier_mat (dim_vec b) (dim_vec u)
 2. outer_prod b v \<in> carrier_mat (dim_vec b) (dim_vec u)
[PROOF STEP]
show "outer_prod b v \<in> carrier_mat (dim_vec b) (dim_vec u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod b v \<in> carrier_mat (dim_vec b) (dim_vec u)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec a = dim_vec b
dim_vec u = dim_vec v

goal (1 subgoal):
 1. outer_prod b v \<in> carrier_mat (dim_vec b) (dim_vec u)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod b v \<in> carrier_mat (dim_vec b) (dim_vec u)

goal (1 subgoal):
 1. outer_prod a u - outer_prod a v \<in> carrier_mat (dim_vec b) (dim_vec u)
[PROOF STEP]
show "outer_prod a u - outer_prod a v \<in> carrier_mat (dim_vec b) (dim_vec u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod a u - outer_prod a v \<in> carrier_mat (dim_vec b) (dim_vec u)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec a = dim_vec b
dim_vec u = dim_vec v

goal (1 subgoal):
 1. outer_prod a u - outer_prod a v \<in> carrier_mat (dim_vec b) (dim_vec u)
[PROOF STEP]
by (metis carrier_vecI minus_carrier_mat outer_prod_dim)
[PROOF STATE]
proof (state)
this:
outer_prod a u - outer_prod a v \<in> carrier_mat (dim_vec b) (dim_vec u)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
outer_prod a u - outer_prod a v - (outer_prod b u - outer_prod b v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v

goal (1 subgoal):
 1. outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
outer_prod (a - b) (u - v) = outer_prod a u - outer_prod a v - outer_prod b u + outer_prod b v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_hull_set_plus:
  "convex hull (S + T) = convex hull S + convex hull T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull (S + T) = convex hull S + convex hull T
[PROOF STEP]
unfolding set_plus_image
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull (\<lambda>(x, y). x + y) ` (S \<times> T) = (\<lambda>(x, y). x + y) ` ((convex hull S) \<times> (convex hull T))
[PROOF STEP]
apply (subst convex_hull_linear_image [symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. linear (\<lambda>(x, y). x + y)
 2. (\<lambda>(x, y). x + y) ` (convex hull S \<times> T) = (\<lambda>(x, y). x + y) ` ((convex hull S) \<times> (convex hull T))
[PROOF STEP]
apply (simp add: linear_iff scaleR_right_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). x + y) ` (convex hull S \<times> T) = (\<lambda>(x, y). x + y) ` ((convex hull S) \<times> (convex hull T))
[PROOF STEP]
apply (simp add: convex_hull_Times)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sin_times_cos: "sin w * cos z = (sin (w + z) + sin (w - z)) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin w * cos z = (sin (w + z) + sin (w - z)) / (2::'a)
[PROOF STEP]
by (simp add: sin_diff sin_add)


[STATEMENT]
theorem (in group) group_right_one: "x * 1 = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
have "x * 1 = x * (inverse x * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (1::'a) = x * (inverse x * x)
[PROOF STEP]
by (simp only: group_left_inverse)
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x * (inverse x * x)

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x * (inverse x * x)

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
have "\<dots> = x * inverse x * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (inverse x * x) = x * inverse x * x
[PROOF STEP]
by (simp only: group_assoc)
[PROOF STATE]
proof (state)
this:
x * (inverse x * x) = x * inverse x * x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * (inverse x * x) = x * inverse x * x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
have "\<dots> = 1 * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * inverse x * x = (1::'a) * x
[PROOF STEP]
by (simp only: group_right_inverse)
[PROOF STATE]
proof (state)
this:
x * inverse x * x = (1::'a) * x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * inverse x * x = (1::'a) * x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
have "\<dots> = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) * x = x
[PROOF STEP]
by (simp only: group_left_one)
[PROOF STATE]
proof (state)
this:
(1::'a) * x = x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x * (1::'a) = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * (1::'a) = x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_interchange_columns:
shows "det (interchange_columns A i j) = of_int (if i = j then 1 else -1) * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A
[PROOF STEP]
have "(interchange_columns A i j) = (\<chi> a b. A $ a $ (Transposition.transpose i j) b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_columns A i j = (\<chi>a b. A $ a $ Transposition.transpose i j b)
[PROOF STEP]
unfolding interchange_columns_def Transposition.transpose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>ia ja. if ja = i then A $ ia $ j else if ja = j then A $ ia $ i else A $ ia $ ja) = (\<chi>a b. A $ a $ (if b = i then j else if b = j then i else b))
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
interchange_columns A i j = (\<chi>a b. A $ a $ Transposition.transpose i j b)

goal (1 subgoal):
 1. det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A
[PROOF STEP]
hence "det(interchange_columns A i j) = det(\<chi> a b. A $ a $ (Transposition.transpose i j) b)"
[PROOF STATE]
proof (prove)
using this:
interchange_columns A i j = (\<chi>a b. A $ a $ Transposition.transpose i j b)

goal (1 subgoal):
 1. det (interchange_columns A i j) = det (\<chi>a b. A $ a $ Transposition.transpose i j b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (interchange_columns A i j) = det (\<chi>a b. A $ a $ Transposition.transpose i j b)

goal (1 subgoal):
 1. det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (interchange_columns A i j) = det (\<chi>a b. A $ a $ Transposition.transpose i j b)

goal (1 subgoal):
 1. det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A
[PROOF STEP]
have "... = of_int (sign (Transposition.transpose i j)) * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (\<chi>a b. A $ a $ Transposition.transpose i j b) = of_int (sign (Transposition.transpose i j)) * det A
[PROOF STEP]
by (rule det_permute_columns[of "Transposition.transpose i j" A], simp add: permutes_swap_id)
[PROOF STATE]
proof (state)
this:
det (\<chi>a b. A $ a $ Transposition.transpose i j b) = of_int (sign (Transposition.transpose i j)) * det A

goal (1 subgoal):
 1. det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (interchange_columns A i j) = of_int (sign (Transposition.transpose i j)) * det A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det (interchange_columns A i j) = of_int (sign (Transposition.transpose i j)) * det A

goal (1 subgoal):
 1. det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A
[PROOF STEP]
unfolding sign_swap_id
[PROOF STATE]
proof (prove)
using this:
det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A

goal (1 subgoal):
 1. det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det (interchange_columns A i j) = of_int (if i = j then 1 else - 1) * det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_extensional_funcset_not_inj_on:
  assumes "finite S" "finite T" "card S \<le> card T"
  shows "card {f \<in> extensional_funcset S T. \<not> inj_on f S} = (card T) ^ (card S) - (fact (card T)) div (fact (card T - card S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = card T ^ card S - fact (card T) div fact (card T - card S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = card T ^ card S - fact (card T) div fact (card T - card S)
[PROOF STEP]
have subset: "{f : extensional_funcset S T. inj_on f S} <= extensional_funcset S T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S} \<subseteq> S \<rightarrow>\<^sub>E T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f \<in> S \<rightarrow>\<^sub>E T. inj_on f S} \<subseteq> S \<rightarrow>\<^sub>E T

goal (1 subgoal):
 1. card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = card T ^ card S - fact (card T) div fact (card T - card S)
[PROOF STEP]
from finite_subset[OF subset] assms
[PROOF STATE]
proof (chain)
picking this:
finite (S \<rightarrow>\<^sub>E T) \<Longrightarrow> finite {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}
finite S
finite T
card S \<le> card T
[PROOF STEP]
have finite: "finite {f : extensional_funcset S T. inj_on f S}"
[PROOF STATE]
proof (prove)
using this:
finite (S \<rightarrow>\<^sub>E T) \<Longrightarrow> finite {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}
finite S
finite T
card S \<le> card T

goal (1 subgoal):
 1. finite {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}
[PROOF STEP]
by (auto intro!: finite_PiE)
[PROOF STATE]
proof (state)
this:
finite {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}

goal (1 subgoal):
 1. card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = card T ^ card S - fact (card T) div fact (card T - card S)
[PROOF STEP]
have "{f \<in> extensional_funcset S T. \<not> inj_on f S} = extensional_funcset S T - {f \<in> extensional_funcset S T. inj_on f S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = (S \<rightarrow>\<^sub>E T) - {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = (S \<rightarrow>\<^sub>E T) - {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}

goal (1 subgoal):
 1. card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = card T ^ card S - fact (card T) div fact (card T - card S)
[PROOF STEP]
from assms this finite subset
[PROOF STATE]
proof (chain)
picking this:
finite S
finite T
card S \<le> card T
{f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = (S \<rightarrow>\<^sub>E T) - {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}
finite {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}
{f \<in> S \<rightarrow>\<^sub>E T. inj_on f S} \<subseteq> S \<rightarrow>\<^sub>E T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite S
finite T
card S \<le> card T
{f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = (S \<rightarrow>\<^sub>E T) - {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}
finite {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S}
{f \<in> S \<rightarrow>\<^sub>E T. inj_on f S} \<subseteq> S \<rightarrow>\<^sub>E T

goal (1 subgoal):
 1. card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = card T ^ card S - fact (card T) div fact (card T - card S)
[PROOF STEP]
by (simp add: card_Diff_subset card_PiE card_extensional_funcset_inj_on prod_constant)
[PROOF STATE]
proof (state)
this:
card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = card T ^ card S - fact (card T) div fact (card T - card S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_same_card: "G \<cong> H \<Longrightarrow> card (carrier G) = card (carrier H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<cong> H \<Longrightarrow> card (carrier G) = card (carrier H)
[PROOF STEP]
using bij_betw_same_card
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B

goal (1 subgoal):
 1. G \<cong> H \<Longrightarrow> card (carrier G) = card (carrier H)
[PROOF STEP]
unfolding is_iso_def iso_def
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B

goal (1 subgoal):
 1. {h \<in> hom G H. bij_betw h (carrier G) (carrier H)} \<noteq> {} \<Longrightarrow> card (carrier G) = card (carrier H)
[PROOF STEP]
by auto


[STATEMENT]
lemma card_bijections_domain_and_range_permutation_eq_1:
  assumes "finite A" "finite B"
  assumes "card A = card B"
  shows "card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
finite B
card A = card B
[PROOF STEP]
have "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B =
    {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card A = card B

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
[PROOF STEP]
by (metis (no_types, lifting) PiE_cong bij_betw_implies_surj_on_and_card_eq)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 1
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
finite A
finite B
card A = card B

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 1
[PROOF STEP]
by (simp add: card_surjective_functions_domain_and_range_permutation Partition_diag)
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma op_norm_eq_0: "(\<parallel>A\<parallel>\<^sub>o\<^sub>p = 0) = (A = 0)" for A :: "('a::real_normed_field)^'n^'m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<parallel>A\<parallel>\<^sub>o\<^sub>p = 0) = (A = 0)
[PROOF STEP]
unfolding onorm_eq_0[OF blin_matrix_vector_mult]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. A *v x = 0) = (A = 0)
[PROOF STEP]
using matrix_axis_0[of 1 A]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(1::'a) \<noteq> (0::'a); \<forall>i. A *v \<e> i = 0\<rbrakk> \<Longrightarrow> A = 0

goal (1 subgoal):
 1. (\<forall>x. A *v x = 0) = (A = 0)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma euclid_ext2_works:
  assumes "euclid_ext2 a b = (p,q,u,v,d)"
  shows "p*a+q*b = d" and "d = gcd a b" and "gcd a b * u = -b" and "gcd a b * v = a"
  and "u = -b div gcd a b" and "v = a div gcd a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p * a + q * b = d &&& d = gcd a b &&& gcd a b * u = - b) &&& gcd a b * v = a &&& u = - b div gcd a b &&& v = a div gcd a b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
euclid_ext2 a b = (p, q, u, v, d)

goal (1 subgoal):
 1. (p * a + q * b = d &&& d = gcd a b &&& gcd a b * u = - b) &&& gcd a b * v = a &&& u = - b div gcd a b &&& v = a div gcd a b
[PROOF STEP]
unfolding euclid_ext2_def
[PROOF STATE]
proof (prove)
using this:
(fst (bezout_coefficients a b), snd (bezout_coefficients a b), - b div gcd a b, a div gcd a b, gcd a b) = (p, q, u, v, d)

goal (1 subgoal):
 1. (p * a + q * b = d &&& d = gcd a b &&& gcd a b * u = - b) &&& gcd a b * v = a &&& u = - b div gcd a b &&& v = a div gcd a b
[PROOF STEP]
by (auto simp add: bezout_coefficients_fst_snd)


[STATEMENT]
lemma cosine_law_triangle:
  "dist b c ^ 2 = dist a b ^ 2 + dist a c ^ 2 - 2 * dist a b * dist a c * cos (angle b a c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist b c)\<^sup>2 = (dist a b)\<^sup>2 + (dist a c)\<^sup>2 - 2 * dist a b * dist a c * cos (angle b a c)
[PROOF STEP]
using cosine_law_vector[of "b - a" "c - a"]
[PROOF STATE]
proof (prove)
using this:
(norm (b - a - (c - a)))\<^sup>2 = (norm (b - a))\<^sup>2 + (norm (c - a))\<^sup>2 - 2 * norm (b - a) * norm (c - a) * cos (vangle (b - a) (c - a))

goal (1 subgoal):
 1. (dist b c)\<^sup>2 = (dist a b)\<^sup>2 + (dist a c)\<^sup>2 - 2 * dist a b * dist a c * cos (angle b a c)
[PROOF STEP]
by (simp add: dist_norm angle_def vangle_commute norm_minus_commute)


[STATEMENT]
lemma inner_prod_adjoint_comp:
  assumes "(U::'a::conjugatable_field Matrix.mat) \<in> carrier_mat n n"
and "(V::'a::conjugatable_field Matrix.mat) \<in> carrier_mat n n"
and "i < n"
and "j < n"
shows "Complex_Matrix.inner_prod  (Matrix.col V i) (Matrix.col U j) =
  ((Complex_Matrix.adjoint V) * U) $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
have "Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) =
    Matrix.scalar_prod (Matrix.col U j) (Matrix.row (Complex_Matrix.adjoint V) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = Matrix.col U j \<bullet> Matrix.row (Complex_Matrix.adjoint V) i
[PROOF STEP]
using adjoint_row[of i V] assms
[PROOF STATE]
proof (prove)
using this:
i < dim_col V \<Longrightarrow> Matrix.row (Complex_Matrix.adjoint V) i = conjugate (Matrix.col V i)
U \<in> carrier_mat n n
V \<in> carrier_mat n n
i < n
j < n

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = Matrix.col U j \<bullet> Matrix.row (Complex_Matrix.adjoint V) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = Matrix.col U j \<bullet> Matrix.row (Complex_Matrix.adjoint V) i

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = Matrix.col U j \<bullet> Matrix.row (Complex_Matrix.adjoint V) i

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
have "... = Matrix.scalar_prod (Matrix.row (Complex_Matrix.adjoint V) i) (Matrix.col U j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.col U j \<bullet> Matrix.row (Complex_Matrix.adjoint V) i = Matrix.row (Complex_Matrix.adjoint V) i \<bullet> Matrix.col U j
[PROOF STEP]
by (metis adjoint_row assms(1) assms(2) assms(3) carrier_matD(1) carrier_matD(2) Matrix.col_dim
        conjugate_vec_sprod_comm)
[PROOF STATE]
proof (state)
this:
Matrix.col U j \<bullet> Matrix.row (Complex_Matrix.adjoint V) i = Matrix.row (Complex_Matrix.adjoint V) i \<bullet> Matrix.col U j

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.col U j \<bullet> Matrix.row (Complex_Matrix.adjoint V) i = Matrix.row (Complex_Matrix.adjoint V) i \<bullet> Matrix.col U j

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
have "... = ((Complex_Matrix.adjoint V) * U) $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint V) i \<bullet> Matrix.col U j = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
U \<in> carrier_mat n n
V \<in> carrier_mat n n
i < n
j < n

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint V) i \<bullet> Matrix.col U j = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
by (simp add:times_mat_def)
[PROOF STATE]
proof (state)
this:
Matrix.row (Complex_Matrix.adjoint V) i \<bullet> Matrix.col U j = (Complex_Matrix.adjoint V * U) $$ (i, j)

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (Matrix.col V i) (Matrix.col U j) = (Complex_Matrix.adjoint V * U) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bst_of_list_map:
  fixes f :: "'a :: linorder \<Rightarrow> 'b :: linorder"
  assumes "strict_mono_on A f" "set xs \<subseteq> A"
  shows   "bst_of_list (map f xs) = map_tree f (bst_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst_of_list (map f xs) = map_tree f (bst_of_list xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_mono_on A f
set xs \<subseteq> A

goal (1 subgoal):
 1. bst_of_list (map f xs) = map_tree f (bst_of_list xs)
[PROOF STEP]
proof (induction xs rule: bst_of_list.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>strict_mono_on A f; set [] \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f []) = map_tree f (bst_of_list [])
 2. \<And>x xs. \<lbrakk>\<lbrakk>strict_mono_on A f; set (filter (\<lambda>y. y < x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter (\<lambda>y. y < x) xs)) = map_tree f (bst_of_list (filter (\<lambda>y. y < x) xs)); \<lbrakk>strict_mono_on A f; set (filter ((<) x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter ((<) x) xs)) = map_tree f (bst_of_list (filter ((<) x) xs)); strict_mono_on A f; set (x # xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (x # xs)) = map_tree f (bst_of_list (x # xs))
[PROOF STEP]
case (2 x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>strict_mono_on A f; set (filter (\<lambda>y. y < x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter (\<lambda>y. y < x) xs)) = map_tree f (bst_of_list (filter (\<lambda>y. y < x) xs))
\<lbrakk>strict_mono_on A f; set (filter ((<) x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter ((<) x) xs)) = map_tree f (bst_of_list (filter ((<) x) xs))
strict_mono_on A f
set (x # xs) \<subseteq> A

goal (2 subgoals):
 1. \<lbrakk>strict_mono_on A f; set [] \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f []) = map_tree f (bst_of_list [])
 2. \<And>x xs. \<lbrakk>\<lbrakk>strict_mono_on A f; set (filter (\<lambda>y. y < x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter (\<lambda>y. y < x) xs)) = map_tree f (bst_of_list (filter (\<lambda>y. y < x) xs)); \<lbrakk>strict_mono_on A f; set (filter ((<) x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter ((<) x) xs)) = map_tree f (bst_of_list (filter ((<) x) xs)); strict_mono_on A f; set (x # xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (x # xs)) = map_tree f (bst_of_list (x # xs))
[PROOF STEP]
have "[xa\<leftarrow>xs . f xa < f x] = [xa\<leftarrow>xs . xa < x]" and "[xa\<leftarrow>xs . f xa > f x] = [xa\<leftarrow>xs . xa > x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>xa. f xa < f x) xs = filter (\<lambda>xa. xa < x) xs &&& filter (\<lambda>xa. f x < f xa) xs = filter ((<) x) xs
[PROOF STEP]
using "2.prems"
[PROOF STATE]
proof (prove)
using this:
strict_mono_on A f
set (x # xs) \<subseteq> A

goal (1 subgoal):
 1. filter (\<lambda>xa. f xa < f x) xs = filter (\<lambda>xa. xa < x) xs &&& filter (\<lambda>xa. f x < f xa) xs = filter ((<) x) xs
[PROOF STEP]
by (auto simp: strict_mono_on_imp_less_iff intro!: filter_cong)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>xa. f xa < f x) xs = filter (\<lambda>xa. xa < x) xs
filter (\<lambda>xa. f x < f xa) xs = filter ((<) x) xs

goal (2 subgoals):
 1. \<lbrakk>strict_mono_on A f; set [] \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f []) = map_tree f (bst_of_list [])
 2. \<And>x xs. \<lbrakk>\<lbrakk>strict_mono_on A f; set (filter (\<lambda>y. y < x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter (\<lambda>y. y < x) xs)) = map_tree f (bst_of_list (filter (\<lambda>y. y < x) xs)); \<lbrakk>strict_mono_on A f; set (filter ((<) x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter ((<) x) xs)) = map_tree f (bst_of_list (filter ((<) x) xs)); strict_mono_on A f; set (x # xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (x # xs)) = map_tree f (bst_of_list (x # xs))
[PROOF STEP]
with 2
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>strict_mono_on A f; set (filter (\<lambda>y. y < x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter (\<lambda>y. y < x) xs)) = map_tree f (bst_of_list (filter (\<lambda>y. y < x) xs))
\<lbrakk>strict_mono_on A f; set (filter ((<) x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter ((<) x) xs)) = map_tree f (bst_of_list (filter ((<) x) xs))
strict_mono_on A f
set (x # xs) \<subseteq> A
filter (\<lambda>xa. f xa < f x) xs = filter (\<lambda>xa. xa < x) xs
filter (\<lambda>xa. f x < f xa) xs = filter ((<) x) xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>strict_mono_on A f; set (filter (\<lambda>y. y < x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter (\<lambda>y. y < x) xs)) = map_tree f (bst_of_list (filter (\<lambda>y. y < x) xs))
\<lbrakk>strict_mono_on A f; set (filter ((<) x) xs) \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f (filter ((<) x) xs)) = map_tree f (bst_of_list (filter ((<) x) xs))
strict_mono_on A f
set (x # xs) \<subseteq> A
filter (\<lambda>xa. f xa < f x) xs = filter (\<lambda>xa. xa < x) xs
filter (\<lambda>xa. f x < f xa) xs = filter ((<) x) xs

goal (1 subgoal):
 1. bst_of_list (map f (x # xs)) = map_tree f (bst_of_list (x # xs))
[PROOF STEP]
by (auto simp: filter_map o_def)
[PROOF STATE]
proof (state)
this:
bst_of_list (map f (x # xs)) = map_tree f (bst_of_list (x # xs))

goal (1 subgoal):
 1. \<lbrakk>strict_mono_on A f; set [] \<subseteq> A\<rbrakk> \<Longrightarrow> bst_of_list (map f []) = map_tree f (bst_of_list [])
[PROOF STEP]
qed auto


[STATEMENT]
lemma subseteq_list_Union_mset:
  assumes "length Ci = n"
  assumes "length CAi = n"
  assumes "\<forall>i<n.  Ci ! i \<subseteq># CAi ! i "
  shows "\<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length Ci = n
length CAi = n
\<forall>i<n. Ci ! i \<subseteq># CAi ! i

goal (1 subgoal):
 1. \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
proof (induction n arbitrary: Ci CAi)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Ci CAi. \<lbrakk>length Ci = 0; length CAi = 0; \<forall>i<0. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
 2. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
length Ci = 0
length CAi = 0
\<forall>i<0. Ci ! i \<subseteq># CAi ! i

goal (2 subgoals):
 1. \<And>Ci CAi. \<lbrakk>length Ci = 0; length CAi = 0; \<forall>i<0. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
 2. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length Ci = 0
length CAi = 0
\<forall>i<0. Ci ! i \<subseteq># CAi ! i
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length Ci = 0
length CAi = 0
\<forall>i<0. Ci ! i \<subseteq># CAi ! i

goal (1 subgoal):
 1. \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)

goal (1 subgoal):
 1. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>length ?Ci = n; length ?CAi = n; \<forall>i<n. ?Ci ! i \<subseteq># ?CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset ?Ci) \<subseteq># \<Sum>\<^sub># (mset ?CAi)
length Ci = Suc n
length CAi = Suc n
\<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i

goal (1 subgoal):
 1. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length ?Ci = n; length ?CAi = n; \<forall>i<n. ?Ci ! i \<subseteq># ?CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset ?Ci) \<subseteq># \<Sum>\<^sub># (mset ?CAi)
length Ci = Suc n
length CAi = Suc n
\<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i
[PROOF STEP]
have "\<forall>i<n. tl Ci ! i \<subseteq># tl CAi ! i"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length ?Ci = n; length ?CAi = n; \<forall>i<n. ?Ci ! i \<subseteq># ?CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset ?Ci) \<subseteq># \<Sum>\<^sub># (mset ?CAi)
length Ci = Suc n
length CAi = Suc n
\<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i

goal (1 subgoal):
 1. \<forall>i<n. tl Ci ! i \<subseteq># tl CAi ! i
[PROOF STEP]
by (simp add: nth_tl)
[PROOF STATE]
proof (state)
this:
\<forall>i<n. tl Ci ! i \<subseteq># tl CAi ! i

goal (1 subgoal):
 1. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
hence "\<Sum>\<^sub>#(mset (tl Ci)) \<subseteq># \<Sum>\<^sub>#(mset (tl CAi))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<n. tl Ci ! i \<subseteq># tl CAi ! i

goal (1 subgoal):
 1. \<Sum>\<^sub># (mset (tl Ci)) \<subseteq># \<Sum>\<^sub># (mset (tl CAi))
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<forall>i<n. tl Ci ! i \<subseteq># tl CAi ! i
\<lbrakk>length ?Ci = n; length ?CAi = n; \<forall>i<n. ?Ci ! i \<subseteq># ?CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset ?Ci) \<subseteq># \<Sum>\<^sub># (mset ?CAi)
length Ci = Suc n
length CAi = Suc n
\<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i

goal (1 subgoal):
 1. \<Sum>\<^sub># (mset (tl Ci)) \<subseteq># \<Sum>\<^sub># (mset (tl CAi))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (mset (tl Ci)) \<subseteq># \<Sum>\<^sub># (mset (tl CAi))

goal (1 subgoal):
 1. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (mset (tl Ci)) \<subseteq># \<Sum>\<^sub># (mset (tl CAi))

goal (1 subgoal):
 1. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
have "hd Ci \<subseteq># hd CAi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd Ci \<subseteq># hd CAi
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length ?Ci = n; length ?CAi = n; \<forall>i<n. ?Ci ! i \<subseteq># ?CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset ?Ci) \<subseteq># \<Sum>\<^sub># (mset ?CAi)
length Ci = Suc n
length CAi = Suc n
\<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i

goal (1 subgoal):
 1. hd Ci \<subseteq># hd CAi
[PROOF STEP]
by (metis hd_conv_nth length_greater_0_conv zero_less_Suc)
[PROOF STATE]
proof (state)
this:
hd Ci \<subseteq># hd CAi

goal (1 subgoal):
 1. \<And>n Ci CAi. \<lbrakk>\<And>Ci CAi. \<lbrakk>length Ci = n; length CAi = n; \<forall>i<n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi); length Ci = Suc n; length CAi = Suc n; \<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<Sum>\<^sub># (mset (tl Ci)) \<subseteq># \<Sum>\<^sub># (mset (tl CAi))
hd Ci \<subseteq># hd CAi
[PROOF STEP]
show "\<Sum>\<^sub>#(mset Ci) \<subseteq># \<Sum>\<^sub>#(mset CAi)"
[PROOF STATE]
proof (prove)
using this:
\<Sum>\<^sub># (mset (tl Ci)) \<subseteq># \<Sum>\<^sub># (mset (tl CAi))
hd Ci \<subseteq># hd CAi

goal (1 subgoal):
 1. \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<Sum>\<^sub># (mset (tl Ci)) \<subseteq># \<Sum>\<^sub># (mset (tl CAi))
hd Ci \<subseteq># hd CAi
\<lbrakk>length ?Ci = n; length ?CAi = n; \<forall>i<n. ?Ci ! i \<subseteq># ?CAi ! i\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (mset ?Ci) \<subseteq># \<Sum>\<^sub># (mset ?CAi)
length Ci = Suc n
length CAi = Suc n
\<forall>i<Suc n. Ci ! i \<subseteq># CAi ! i

goal (1 subgoal):
 1. \<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)
[PROOF STEP]
by (cases Ci; cases CAi) (auto intro: subset_mset.add_mono)
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (mset Ci) \<subseteq># \<Sum>\<^sub># (mset CAi)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma congruent_triangleI_sas:
  assumes "dist a1 b1 = dist a2 b2"
  assumes "dist b1 c1 = dist b2 c2"
  assumes "angle a1 b1 c1 = angle a2 b2 c2"
  shows   "congruent_triangle a1 b1 c1 a2 b2 c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. congruent_triangle a1 b1 c1 a2 b2 c2
[PROOF STEP]
proof (rule congruent_triangleI_sss)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. dist a1 b1 = dist a2 b2
 2. dist b1 c1 = dist b2 c2
 3. dist a1 c1 = dist a2 c2
[PROOF STEP]
show "dist a1 c1 = dist a2 c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist a1 c1 = dist a2 c2
[PROOF STEP]
proof (rule power2_eq_imp_eq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (dist a1 c1)\<^sup>2 = (dist a2 c2)\<^sup>2
 2. 0 \<le> dist a1 c1
 3. 0 \<le> dist a2 c2
[PROOF STEP]
from cosine_law_triangle[of a1 c1 b1] cosine_law_triangle[of a2 c2 b2] assms
[PROOF STATE]
proof (chain)
picking this:
(dist a1 c1)\<^sup>2 = (dist b1 a1)\<^sup>2 + (dist b1 c1)\<^sup>2 - 2 * dist b1 a1 * dist b1 c1 * cos (angle a1 b1 c1)
(dist a2 c2)\<^sup>2 = (dist b2 a2)\<^sup>2 + (dist b2 c2)\<^sup>2 - 2 * dist b2 a2 * dist b2 c2 * cos (angle a2 b2 c2)
dist a1 b1 = dist a2 b2
dist b1 c1 = dist b2 c2
angle a1 b1 c1 = angle a2 b2 c2
[PROOF STEP]
show "(dist a1 c1)\<^sup>2 = (dist a2 c2)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(dist a1 c1)\<^sup>2 = (dist b1 a1)\<^sup>2 + (dist b1 c1)\<^sup>2 - 2 * dist b1 a1 * dist b1 c1 * cos (angle a1 b1 c1)
(dist a2 c2)\<^sup>2 = (dist b2 a2)\<^sup>2 + (dist b2 c2)\<^sup>2 - 2 * dist b2 a2 * dist b2 c2 * cos (angle a2 b2 c2)
dist a1 b1 = dist a2 b2
dist b1 c1 = dist b2 c2
angle a1 b1 c1 = angle a2 b2 c2

goal (1 subgoal):
 1. (dist a1 c1)\<^sup>2 = (dist a2 c2)\<^sup>2
[PROOF STEP]
by (simp add: dist_commute)
[PROOF STATE]
proof (state)
this:
(dist a1 c1)\<^sup>2 = (dist a2 c2)\<^sup>2

goal (2 subgoals):
 1. 0 \<le> dist a1 c1
 2. 0 \<le> dist a2 c2
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
dist a1 c1 = dist a2 c2

goal (2 subgoals):
 1. dist a1 b1 = dist a2 b2
 2. dist b1 c1 = dist b2 c2
[PROOF STEP]
qed fact+


[STATEMENT]
theorem catalan_closed_form_gbinomial:
  "real (catalan n) = 2 * (- 4) ^ n * (1/2 gchoose Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)
[PROOF STEP]
have "(catalan n :: real) = fps_nth fps_catalan n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (catalan n) = fps_nth fps_catalan n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (catalan n) = fps_nth fps_catalan n

goal (1 subgoal):
 1. real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (catalan n) = fps_nth fps_catalan n

goal (1 subgoal):
 1. real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)
[PROOF STEP]
have "\<dots> = 2 * (- 4) ^ n * (1/2 gchoose Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_nth fps_catalan n = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)
[PROOF STEP]
by (subst fps_catalan_fps_binomial)
       (simp add: fps_div_fps_X_nth numeral_fps_const fps_compose_linear)
[PROOF STATE]
proof (state)
this:
fps_nth fps_catalan n = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)

goal (1 subgoal):
 1. real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)

goal (1 subgoal):
 1. real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (catalan n) = 2 * (- 4) ^ n * (1 / 2 gchoose Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem card_equiv_rel_eq_card_partitions:
  "card {R. equiv A R} = card {P. partition_on A P}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {R. equiv A R} = card {P. partition_on A P}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {R. equiv A R} = card {P. partition_on A P}
[PROOF STEP]
have "bij_betw (\<lambda>R. A // R) {R. equiv A R} {P. partition_on A P}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((//) A) {R. equiv A R} {P. partition_on A P}
[PROOF STEP]
by (rule bij_betw_partition_of)
[PROOF STATE]
proof (state)
this:
bij_betw ((//) A) {R. equiv A R} {P. partition_on A P}

goal (1 subgoal):
 1. card {R. equiv A R} = card {P. partition_on A P}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
bij_betw ((//) A) {R. equiv A R} {P. partition_on A P}
[PROOF STEP]
show "card {R. equiv A R} = card {P. partition_on A P}"
[PROOF STATE]
proof (prove)
using this:
bij_betw ((//) A) {R. equiv A R} {P. partition_on A P}

goal (1 subgoal):
 1. card {R. equiv A R} = card {P. partition_on A P}
[PROOF STEP]
by (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card {R. equiv A R} = card {P. partition_on A P}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_prod_smult_left_right:
  fixes u v :: "complex vec"
  assumes dimu: "u \<in> carrier_vec n" and dimv: "v \<in> carrier_vec n"
  shows "inner_prod (a \<cdot>\<^sub>v u) (b \<cdot>\<^sub>v v) = conjugate a * b  * inner_prod u v" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod (a \<cdot>\<^sub>v u) (b \<cdot>\<^sub>v v) = conjugate a * b * inner_prod u v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> carrier_vec n
v \<in> carrier_vec n

goal (1 subgoal):
 1. inner_prod (a \<cdot>\<^sub>v u) (b \<cdot>\<^sub>v v) = conjugate a * b * inner_prod u v
[PROOF STEP]
apply (simp add: scalar_prod_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> carrier_vec n; v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. b * v $ i * (cnj a * cnj (u $ i))) = cnj a * b * (\<Sum>i = 0..<n. v $ i * cnj (u $ i))
[PROOF STEP]
apply (subst sum_distrib_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> carrier_vec n; v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. b * v $ i * (cnj a * cnj (u $ i))) = (\<Sum>n = 0..<n. cnj a * b * (v $ n * cnj (u $ n)))
[PROOF STEP]
by (rule sum.cong, auto)


[STATEMENT]
lemma onorm_cinner_right:
  assumes "bounded_linear r"
  shows "onorm (\<lambda>x. f \<bullet>\<^sub>C r x) \<le> norm f * onorm r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. f \<bullet>\<^sub>C r x) \<le> norm f * onorm r
[PROOF STEP]
proof (rule onorm_bound)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> norm f * onorm r
 2. \<And>x. cmod (f \<bullet>\<^sub>C r x) \<le> norm f * onorm r * norm x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> norm f * onorm r
 2. \<And>x. cmod (f \<bullet>\<^sub>C r x) \<le> norm f * onorm r * norm x
[PROOF STEP]
have "norm (f \<bullet>\<^sub>C r x) \<le> norm f * norm (r x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (f \<bullet>\<^sub>C r x) \<le> norm f * norm (r x)
[PROOF STEP]
by (simp add: Cauchy_Schwarz_ineq2)
[PROOF STATE]
proof (state)
this:
cmod (f \<bullet>\<^sub>C r x) \<le> norm f * norm (r x)

goal (2 subgoals):
 1. 0 \<le> norm f * onorm r
 2. \<And>x. cmod (f \<bullet>\<^sub>C r x) \<le> norm f * onorm r * norm x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (f \<bullet>\<^sub>C r x) \<le> norm f * norm (r x)

goal (2 subgoals):
 1. 0 \<le> norm f * onorm r
 2. \<And>x. cmod (f \<bullet>\<^sub>C r x) \<le> norm f * onorm r * norm x
[PROOF STEP]
have "\<dots> \<le> onorm r * norm x * norm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm f * norm (r x) \<le> onorm r * norm x * norm f
[PROOF STEP]
by (simp add: assms mult.commute mult_left_mono onorm)
[PROOF STATE]
proof (state)
this:
norm f * norm (r x) \<le> onorm r * norm x * norm f

goal (2 subgoals):
 1. 0 \<le> norm f * onorm r
 2. \<And>x. cmod (f \<bullet>\<^sub>C r x) \<le> norm f * onorm r * norm x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (f \<bullet>\<^sub>C r x) \<le> onorm r * norm x * norm f
[PROOF STEP]
show "norm (f \<bullet>\<^sub>C r x) \<le> norm f * onorm r * norm x"
[PROOF STATE]
proof (prove)
using this:
cmod (f \<bullet>\<^sub>C r x) \<le> onorm r * norm x * norm f

goal (1 subgoal):
 1. cmod (f \<bullet>\<^sub>C r x) \<le> norm f * onorm r * norm x
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
cmod (f \<bullet>\<^sub>C r x) \<le> norm f * onorm r * norm x

goal (1 subgoal):
 1. 0 \<le> norm f * onorm r
[PROOF STEP]
qed (intro mult_nonneg_nonneg norm_ge_zero onorm_pos_le assms)


[STATEMENT]
lemma dist_point_def:
  fixes p\<^sub>0 :: "('k::finite) point"
  shows "dist p\<^sub>0 p\<^sub>1 = sqrt (\<Sum>k \<in> UNIV. (p\<^sub>0$k - p\<^sub>1$k)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist p\<^sub>0 p\<^sub>1 = sqrt (\<Sum>k\<in>UNIV. (p\<^sub>0 $ k - p\<^sub>1 $ k)\<^sup>2)
[PROOF STEP]
unfolding dist_vec_def L2_set_def dist_real_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>UNIV. \<bar>p\<^sub>0 $ i - p\<^sub>1 $ i\<bar>\<^sup>2) = sqrt (\<Sum>k\<in>UNIV. (p\<^sub>0 $ k - p\<^sub>1 $ k)\<^sup>2)
[PROOF STEP]
by simp


[STATEMENT]
lemma fps_compose_mult_distrib_lemma:
  assumes c0: "c$0 = (0::'a::idom)"
  shows "((a oo c) * (b oo c))$n = sum (\<lambda>s. sum (\<lambda>i. a$i * b$(s - i) * (c^s) $ n) {0..s}) {0..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((a oo c) * (b oo c)) $ n = (\<Sum>s = 0..n. \<Sum>i = 0..s. a $ i * b $ (s - i) * c ^ s $ n)
[PROOF STEP]
unfolding product_composition_lemma[OF c0 c0] power_add[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, m)\<in>{(k, m). k + m \<le> n}. a $ k * b $ m * c ^ (k + m) $ n) = (\<Sum>s = 0..n. \<Sum>i = 0..s. a $ i * b $ (s - i) * c ^ s $ n)
[PROOF STEP]
unfolding sum_pair_less_iff[where a = "\<lambda>k. a$k" and b="\<lambda>m. b$m" and c="\<lambda>s. (c ^ s)$n" and n = n]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>s = 0..n. \<Sum>i = 0..s. a $ i * b $ (s - i) * c ^ s $ n) = (\<Sum>s = 0..n. \<Sum>i = 0..s. a $ i * b $ (s - i) * c ^ s $ n)
[PROOF STEP]
..


[STATEMENT]
lemma card_extensional_funcset_surj_on:
  assumes "finite A" "finite B"
  shows "card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)" (is "card ?F = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
have "card ?F = fact (card B) * card (?F // range_permutation A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B)
[PROOF STEP]
using \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite B

goal (1 subgoal):
 1. card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B)
[PROOF STEP]
by (simp only: card_equiv_class_restricted_same_size[OF equiv_range_permutation surj_on_respects_range_permutation card_of_equiv_class])
[PROOF STATE]
proof (state)
this:
card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B)

goal (1 subgoal):
 1. card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B)

goal (1 subgoal):
 1. card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
have "\<dots> = fact (card B) * Stirling (card A) (card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (card B) * card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. fact (card B) * card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
by (simp only: card_surjective_functions_range_permutation)
[PROOF STATE]
proof (state)
this:
fact (card B) * card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = fact (card B) * Stirling (card A) (card B)

goal (1 subgoal):
 1. card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)

goal (1 subgoal):
 1. card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} = fact (card B) * Stirling (card A) (card B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_multiple: "sin (n * x) = 2 * cos x * sin ((n - 1) * x) - sin ((n - 2) * x)"
  for x :: "'a :: {banach,real_normed_field}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (n * x) = (2::'a) * cos x * sin ((n - (1::'a)) * x) - sin ((n - (2::'a)) * x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sin (n * x) = (2::'a) * cos x * sin ((n - (1::'a)) * x) - sin ((n - (2::'a)) * x)
[PROOF STEP]
have "sin ((n - 1) * x + x) + sin ((n - 1) * x - x) = 2 * cos x * sin ((n - 1) * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin ((n - (1::'a)) * x + x) + sin ((n - (1::'a)) * x - x) = (2::'a) * cos x * sin ((n - (1::'a)) * x)
[PROOF STEP]
by (simp add: sin_add sin_diff)
[PROOF STATE]
proof (state)
this:
sin ((n - (1::'a)) * x + x) + sin ((n - (1::'a)) * x - x) = (2::'a) * cos x * sin ((n - (1::'a)) * x)

goal (1 subgoal):
 1. sin (n * x) = (2::'a) * cos x * sin ((n - (1::'a)) * x) - sin ((n - (2::'a)) * x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sin ((n - (1::'a)) * x + x) + sin ((n - (1::'a)) * x - x) = (2::'a) * cos x * sin ((n - (1::'a)) * x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sin ((n - (1::'a)) * x + x) + sin ((n - (1::'a)) * x - x) = (2::'a) * cos x * sin ((n - (1::'a)) * x)

goal (1 subgoal):
 1. sin (n * x) = (2::'a) * cos x * sin ((n - (1::'a)) * x) - sin ((n - (2::'a)) * x)
[PROOF STEP]
by (simp add: left_diff_distrib' eq_diff_eq)
[PROOF STATE]
proof (state)
this:
sin (n * x) = (2::'a) * cos x * sin ((n - (1::'a)) * x) - sin ((n - (2::'a)) * x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_mult_transpose_dot_column:
  shows "transpose A ** A = (\<chi> i j. inner (column i A) (column j A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** A = (\<chi>i j. inner (column i A) (column j A))
[PROOF STEP]
by (simp add: matrix_matrix_mult_def vec_eq_iff transpose_def column_def inner_vec_def)


[STATEMENT]
lemma cos_treble_cos: "cos (3 * x) = 4 * cos x ^ 3 - 3 * cos x"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
have *: "(sin x * (sin x * 3)) = 3 - (cos x * (cos x * 3))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin x * (sin x * (3::'a)) = (3::'a) - cos x * (cos x * (3::'a))
[PROOF STEP]
by (simp add: mult.assoc [symmetric] sin_squared_eq [unfolded power2_eq_square])
[PROOF STATE]
proof (state)
this:
sin x * (sin x * (3::'a)) = (3::'a) - cos x * (cos x * (3::'a))

goal (1 subgoal):
 1. cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
have "cos(3 * x) = cos(2*x + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos ((3::'a) * x) = cos ((2::'a) * x + x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cos ((3::'a) * x) = cos ((2::'a) * x + x)

goal (1 subgoal):
 1. cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos ((3::'a) * x) = cos ((2::'a) * x + x)

goal (1 subgoal):
 1. cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
have "\<dots> = 4 * cos x ^ 3 - 3 * cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos ((2::'a) * x + x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
unfolding cos_add cos_double sin_double
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((cos x)\<^sup>2 - (sin x)\<^sup>2) * cos x - (2::'a) * sin x * cos x * sin x = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
by (simp add: * field_simps power2_eq_square power3_eq_cube)
[PROOF STATE]
proof (state)
this:
cos ((2::'a) * x + x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x

goal (1 subgoal):
 1. cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x

goal (1 subgoal):
 1. cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cos ((3::'a) * x) = (4::'a) * cos x ^ 3 - (3::'a) * cos x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proj2_incident_abs:
  assumes "v \<noteq> 0" and "w \<noteq> 0"
  shows "proj2_incident (proj2_abs v) (proj2_line_abs w) \<longleftrightarrow> v \<bullet> w = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj2_incident (proj2_abs v) (proj2_line_abs w) = (v \<bullet> w = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proj2_incident (proj2_abs v) (proj2_line_abs w) = (v \<bullet> w = 0)
[PROOF STEP]
from \<open>v \<noteq> 0\<close> and proj2_rep_abs2
[PROOF STATE]
proof (chain)
picking this:
v \<noteq> 0
?v \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_rep (proj2_abs ?v) = k *\<^sub>R ?v
[PROOF STEP]
obtain j where "j \<noteq> 0" and "proj2_rep (proj2_abs v) = j *\<^sub>R v"
[PROOF STATE]
proof (prove)
using this:
v \<noteq> 0
?v \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_rep (proj2_abs ?v) = k *\<^sub>R ?v

goal (1 subgoal):
 1. (\<And>j. \<lbrakk>j \<noteq> 0; proj2_rep (proj2_abs v) = j *\<^sub>R v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j \<noteq> 0
proj2_rep (proj2_abs v) = j *\<^sub>R v

goal (1 subgoal):
 1. proj2_incident (proj2_abs v) (proj2_line_abs w) = (v \<bullet> w = 0)
[PROOF STEP]
from \<open>w \<noteq> 0\<close> and proj2_line_rep_abs
[PROOF STATE]
proof (chain)
picking this:
w \<noteq> 0
?v \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_line_rep (proj2_line_abs ?v) = k *\<^sub>R ?v
[PROOF STEP]
obtain k where "k \<noteq> 0"
    and "proj2_line_rep (proj2_line_abs w) = k *\<^sub>R w"
[PROOF STATE]
proof (prove)
using this:
w \<noteq> 0
?v \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_line_rep (proj2_line_abs ?v) = k *\<^sub>R ?v

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k \<noteq> 0; proj2_line_rep (proj2_line_abs w) = k *\<^sub>R w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k \<noteq> 0
proj2_line_rep (proj2_line_abs w) = k *\<^sub>R w

goal (1 subgoal):
 1. proj2_incident (proj2_abs v) (proj2_line_abs w) = (v \<bullet> w = 0)
[PROOF STEP]
with \<open>j \<noteq> 0\<close> and \<open>proj2_rep (proj2_abs v) = j *\<^sub>R v\<close>
[PROOF STATE]
proof (chain)
picking this:
j \<noteq> 0
proj2_rep (proj2_abs v) = j *\<^sub>R v
k \<noteq> 0
proj2_line_rep (proj2_line_abs w) = k *\<^sub>R w
[PROOF STEP]
show "proj2_incident (proj2_abs v) (proj2_line_abs w) \<longleftrightarrow> v \<bullet> w = 0"
[PROOF STATE]
proof (prove)
using this:
j \<noteq> 0
proj2_rep (proj2_abs v) = j *\<^sub>R v
k \<noteq> 0
proj2_line_rep (proj2_line_abs w) = k *\<^sub>R w

goal (1 subgoal):
 1. proj2_incident (proj2_abs v) (proj2_line_abs w) = (v \<bullet> w = 0)
[PROOF STEP]
unfolding proj2_incident_def
[PROOF STATE]
proof (prove)
using this:
j \<noteq> 0
proj2_rep (proj2_abs v) = j *\<^sub>R v
k \<noteq> 0
proj2_line_rep (proj2_line_abs w) = k *\<^sub>R w

goal (1 subgoal):
 1. (proj2_rep (proj2_abs v) \<bullet> proj2_line_rep (proj2_line_abs w) = 0) = (v \<bullet> w = 0)
[PROOF STEP]
by (simp add: dot_scaleR_mult)
[PROOF STATE]
proof (state)
this:
proj2_incident (proj2_abs v) (proj2_line_abs w) = (v \<bullet> w = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_map2_plus:
  assumes "length xs = length ys"
  shows "sum_list (map2 (+) xs ys) = sum_list xs + sum_list (ys::'a::comm_monoid_add list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map2 (+) xs ys) = sum_list xs + sum_list ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. sum_list (map2 (+) xs ys) = sum_list xs + sum_list ys
[PROOF STEP]
proof (induct rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum_list (map2 (+) [] []) = sum_list [] + sum_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list (map2 (+) xs ys) = sum_list xs + sum_list ys\<rbrakk> \<Longrightarrow> sum_list (map2 (+) (x # xs) (y # ys)) = sum_list (x # xs) + sum_list (y # ys)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. sum_list (map2 (+) [] []) = sum_list [] + sum_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list (map2 (+) xs ys) = sum_list xs + sum_list ys\<rbrakk> \<Longrightarrow> sum_list (map2 (+) (x # xs) (y # ys)) = sum_list (x # xs) + sum_list (y # ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map2 (+) [] []) = sum_list [] + sum_list []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map2 (+) [] []) = sum_list [] + sum_list []

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list (map2 (+) xs ys) = sum_list xs + sum_list ys\<rbrakk> \<Longrightarrow> sum_list (map2 (+) (x # xs) (y # ys)) = sum_list (x # xs) + sum_list (y # ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list (map2 (+) xs ys) = sum_list xs + sum_list ys\<rbrakk> \<Longrightarrow> sum_list (map2 (+) (x # xs) (y # ys)) = sum_list (x # xs) + sum_list (y # ys)
[PROOF STEP]
case (Cons x xs y ys)
[PROOF STATE]
proof (state)
this:
length xs = length ys
sum_list (map2 (+) xs ys) = sum_list xs + sum_list ys

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list (map2 (+) xs ys) = sum_list xs + sum_list ys\<rbrakk> \<Longrightarrow> sum_list (map2 (+) (x # xs) (y # ys)) = sum_list (x # xs) + sum_list (y # ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map2 (+) (x # xs) (y # ys)) = sum_list (x # xs) + sum_list (y # ys)
[PROOF STEP]
by (simp add: Cons(2) ac_simps)
[PROOF STATE]
proof (state)
this:
sum_list (map2 (+) (x # xs) (y # ys)) = sum_list (x # xs) + sum_list (y # ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_first_terms:
  fixes x :: "'a::{real_normed_algebra_1,banach}"
  shows "exp x = (\<Sum>n<k. inverse(fact n) *\<^sub>R (x ^ n)) + (\<Sum>n. inverse(fact (n + k)) *\<^sub>R (x ^ (n + k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x = (\<Sum>n<k. x ^ n /\<^sub>R fact n) + (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. exp x = (\<Sum>n<k. x ^ n /\<^sub>R fact n) + (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k))
[PROOF STEP]
have "exp x = suminf (\<lambda>n. inverse(fact n) *\<^sub>R (x^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x = (\<Sum>n. x ^ n /\<^sub>R fact n)
[PROOF STEP]
by (simp add: exp_def)
[PROOF STATE]
proof (state)
this:
exp x = (\<Sum>n. x ^ n /\<^sub>R fact n)

goal (1 subgoal):
 1. exp x = (\<Sum>n<k. x ^ n /\<^sub>R fact n) + (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
exp x = (\<Sum>n. x ^ n /\<^sub>R fact n)

goal (1 subgoal):
 1. exp x = (\<Sum>n<k. x ^ n /\<^sub>R fact n) + (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k))
[PROOF STEP]
from summable_exp_generic
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. ?x ^ n /\<^sub>R fact n)
[PROOF STEP]
have "\<dots> = (\<Sum> n. inverse(fact(n+k)) *\<^sub>R (x ^ (n + k))) +
    (\<Sum> n::nat<k. inverse(fact n) *\<^sub>R (x^n))" (is "_ = _ + ?a")
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. ?x ^ n /\<^sub>R fact n)

goal (1 subgoal):
 1. (\<Sum>n. x ^ n /\<^sub>R fact n) = (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k)) + (\<Sum>n<k. x ^ n /\<^sub>R fact n)
[PROOF STEP]
by (rule suminf_split_initial_segment)
[PROOF STATE]
proof (state)
this:
(\<Sum>n. x ^ n /\<^sub>R fact n) = (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k)) + (\<Sum>n<k. x ^ n /\<^sub>R fact n)

goal (1 subgoal):
 1. exp x = (\<Sum>n<k. x ^ n /\<^sub>R fact n) + (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
exp x = (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k)) + (\<Sum>n<k. x ^ n /\<^sub>R fact n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
exp x = (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k)) + (\<Sum>n<k. x ^ n /\<^sub>R fact n)

goal (1 subgoal):
 1. exp x = (\<Sum>n<k. x ^ n /\<^sub>R fact n) + (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp x = (\<Sum>n<k. x ^ n /\<^sub>R fact n) + (\<Sum>n. x ^ (n + k) /\<^sub>R fact (n + k))

goal:
No subgoals!
[PROOF STEP]
qed