[STATEMENT]
lemma ffact_add_nat:
  "ffact n (x + y) = (\<Sum>k=0..n. (n choose k) * ffact k x * ffact (n - k) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ffact 0 (x + y) = (\<Sum>k = 0..0. (0 choose k) * ffact k x * ffact (0 - k) y)
 2. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. ffact 0 (x + y) = (\<Sum>k = 0..0. (0 choose k) * ffact k x * ffact (0 - k) y)
 2. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact 0 (x + y) = (\<Sum>k = 0..0. (0 choose k) * ffact k x * ffact (0 - k) y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ffact 0 (x + y) = (\<Sum>k = 0..0. (0 choose k) * ffact k x * ffact (0 - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
let ?s = "\<lambda>k. (n choose k) * ffact k x * ffact (n - k) y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
let ?t = "\<lambda>k. ffact k x * ffact (Suc n - k) y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
let ?u = "\<lambda>k. ffact (Suc k) x * ffact (n - k) y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "ffact (Suc n) (x + y) = (x + y - n) * ffact n (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact (Suc n) (x + y) = (x + y - n) * ffact n (x + y)
[PROOF STEP]
by (simp add: ffact_Suc_rev_nat)
[PROOF STATE]
proof (state)
this:
ffact (Suc n) (x + y) = (x + y - n) * ffact n (x + y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ffact (Suc n) (x + y) = (x + y - n) * ffact n (x + y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (x + y - n) * (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y - n) * ffact n (x + y) = (x + y - n) * (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y)
[PROOF STEP]
using Suc.hyps
[PROOF STATE]
proof (prove)
using this:
ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y)

goal (1 subgoal):
 1. (x + y - n) * ffact n (x + y) = (x + y - n) * (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x + y - n) * ffact n (x + y) = (x + y - n) * (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y - n) * ffact n (x + y) = (x + y - n) * (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. ?s k * (x + y - n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y - n) * (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n))
[PROOF STEP]
by (simp add: mult.commute sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(x + y - n) * (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y - n) * (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. ?s k * ((y + k - n) + (x - k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n)) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n)) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k)))
[PROOF STEP]
have "?s k * (x + y - n) = ?s k * ((y + k - n) + (x - k))" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n) = (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k))
[PROOF STEP]
by (cases "k \<le> x \<or> n - k \<le> y") (auto simp add: ffact_nat_triv)
[PROOF STATE]
proof (state)
this:
(n choose ?k) * ffact ?k x * ffact (n - ?k) y * (x + y - n) = (n choose ?k) * ffact ?k x * ffact (n - ?k) y * (y + ?k - n + (x - ?k))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n)) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k)))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(n choose ?k) * ffact ?k x * ffact (n - ?k) y * (x + y - n) = (n choose ?k) * ffact ?k x * ffact (n - ?k) y * (y + ?k - n + (x - ?k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(n choose ?k) * ffact ?k x * ffact (n - ?k) y * (x + y - n) = (n choose ?k) * ffact ?k x * ffact (n - ?k) y * (y + ?k - n + (x - ?k))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n)) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k)))
[PROOF STEP]
by (auto intro: sum.cong simp only: refl)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n)) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n)) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k)))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (x + y - n)) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k)))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. (n choose k) * (?t k + ?u k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k))) = (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by (auto intro!: sum.cong simp add: Suc_diff_le ffact_Suc_rev_nat) algebra
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k))) = (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y * (y + k - n + (x - k))) = (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. (n choose k) * ?t k) + (\<Sum>k = 0..n. (n choose k) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by (simp add: sum.distrib add_mult_distrib2 mult.commute mult.left_commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = ?t 0 + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "\<dots> = (?t 0 + (\<Sum>k = 0..n. (n choose Suc k) * ?u k)) + (\<Sum>k = 0..n. (n choose k) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "(\<Sum>k = Suc 0..n. (n choose k) * ?t k) = (\<Sum>k = 0..n. (n choose Suc k) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "(\<Sum>k = Suc 0..n. (n choose k) * ?t k) = (\<Sum>k = Suc 0..Suc n. (n choose k) * ?t k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = Suc 0..Suc n. (n choose k) * (ffact k x * ffact (Suc n - k) y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = Suc 0..Suc n. (n choose k) * (ffact k x * ffact (Suc n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = Suc 0..Suc n. (n choose k) * (ffact k x * ffact (Suc n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "\<dots> = (sum ((\<lambda>k. (n choose k) * ?t k) o Suc) {0..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = sum ((\<lambda>k. (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n}
[PROOF STEP]
by (simp only: sum.reindex[symmetric, of Suc] inj_Suc image_Suc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = sum ((\<lambda>k. (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n}

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = sum ((\<lambda>k. (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n}

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. (n choose Suc k) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>k. (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n} = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>k. (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n} = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = Suc 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by (simp add: sum.atLeast_Suc_atMost[of _ _ "\<lambda>k. (n choose k) * ?t k"])
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "\<dots> = ?t 0 + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by (simp add: distrib_right sum.distrib)
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
let ?v = "\<lambda>k. (Suc n choose k) * ffact k x * ffact (Suc n - k) y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = ?v 0 + (\<Sum>k = 0..n. (Suc n choose (Suc k)) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = ?v 0 + (\<Sum>k = Suc 0..Suc n. ?v k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) = (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
by (simp only: sum.shift_bounds_cl_Suc_ivl diff_Suc_Suc mult.assoc)
[PROOF STATE]
proof (state)
this:
(Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) = (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) = (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
by (simp add: sum.atLeast_Suc_atMost)
[PROOF STATE]
proof (state)
this:
(Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal (1 subgoal):
 1. ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_of_fourth_powers:
  "30 * (\<Sum>i=0..n. i * i * i * i) =
    n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 30 * (\<Sum>i = 0..0. i * i * i * i) = 0 * Suc 0 * Suc (2 * 0) * (3 * 0 * 0 + 3 * 0 - 1)
 2. \<And>n. 30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1) \<Longrightarrow> 30 * (\<Sum>i = 0..Suc n. i * i * i * i) = Suc n * Suc (Suc n) * Suc (2 * Suc n) * (3 * Suc n * Suc n + 3 * Suc n - 1)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. 30 * (\<Sum>i = 0..0. i * i * i * i) = 0 * Suc 0 * Suc (2 * 0) * (3 * 0 * 0 + 3 * 0 - 1)
 2. \<And>n. 30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1) \<Longrightarrow> 30 * (\<Sum>i = 0..Suc n. i * i * i * i) = Suc n * Suc (Suc n) * Suc (2 * Suc n) * (3 * Suc n * Suc n + 3 * Suc n - 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 30 * (\<Sum>i = 0..0. i * i * i * i) = 0 * Suc 0 * Suc (2 * 0) * (3 * 0 * 0 + 3 * 0 - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
30 * (\<Sum>i = 0..0. i * i * i * i) = 0 * Suc 0 * Suc (2 * 0) * (3 * 0 * 0 + 3 * 0 - 1)

goal (1 subgoal):
 1. \<And>n. 30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1) \<Longrightarrow> 30 * (\<Sum>i = 0..Suc n. i * i * i * i) = Suc n * Suc (Suc n) * Suc (2 * Suc n) * (3 * Suc n * Suc n + 3 * Suc n - 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1) \<Longrightarrow> 30 * (\<Sum>i = 0..Suc n. i * i * i * i) = Suc n * Suc (Suc n) * Suc (2 * Suc n) * (3 * Suc n * Suc n + 3 * Suc n - 1)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1)

goal (1 subgoal):
 1. \<And>n. 30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1) \<Longrightarrow> 30 * (\<Sum>i = 0..Suc n. i * i * i * i) = Suc n * Suc (Suc n) * Suc (2 * Suc n) * (3 * Suc n * Suc n + 3 * Suc n - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
30 * (\<Sum>i = 0..n. i * i * i * i) = n * Suc n * Suc (2 * n) * (3 * n * n + 3 * n - 1)

goal (1 subgoal):
 1. 30 * (\<Sum>i = 0..Suc n. i * i * i * i) = Suc n * Suc (Suc n) * Suc (2 * Suc n) * (3 * Suc n * Suc n + 3 * Suc n - 1)
[PROOF STEP]
by (cases n)  \<comment> \<open>eliminates the subtraction\<close>
      simp_all
[PROOF STATE]
proof (state)
this:
30 * (\<Sum>i = 0..Suc n. i * i * i * i) = Suc n * Suc (Suc n) * Suc (2 * Suc n) * (3 * Suc n * Suc n + 3 * Suc n - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eucl_of_list_inner_eq: "(eucl_of_list xs::'a) \<bullet> eucl_of_list ys = inner_lv_rel xs ys"
  if "length xs = DIM('a::executable_euclidean_space)" "length ys = DIM('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list xs \<bullet> eucl_of_list ys = inner_lv_rel xs ys
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
length xs = DIM('a)
length ys = DIM('a)

goal (1 subgoal):
 1. eucl_of_list xs \<bullet> eucl_of_list ys = inner_lv_rel xs ys
[PROOF STEP]
by (subst euclidean_inner[abs_def], subst sum_list_Basis_list[symmetric])
      (auto simp: eucl_of_list_inner sum_list_sum_nth index_nth_id inner_lv_rel_def)


[STATEMENT]
lemma ket_0_dim:
  shows "dim_vec ket_0 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec ket_0 = 2
[PROOF STEP]
unfolding ket_0_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (unit_vec 2 0) = 2
[PROOF STEP]
by simp


[STATEMENT]
lemma lead_coeff_pderiv:
  fixes p :: "'a::{comm_semiring_1,semiring_no_zero_divisors,semiring_char_0} poly"
  shows "lead_coeff (pderiv p) = of_nat (degree p) * lead_coeff p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (pderiv p) = of_nat (degree p) * lead_coeff p
[PROOF STEP]
apply (auto simp:degree_pderiv coeff_pderiv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1::'a) + of_nat (degree p - Suc 0)) * coeff p (Suc (degree p - Suc 0)) = of_nat (degree p) * lead_coeff p
[PROOF STEP]
apply (cases "degree p")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree p = 0 \<Longrightarrow> ((1::'a) + of_nat (degree p - Suc 0)) * coeff p (Suc (degree p - Suc 0)) = of_nat (degree p) * lead_coeff p
 2. \<And>nat. degree p = Suc nat \<Longrightarrow> ((1::'a) + of_nat (degree p - Suc 0)) * coeff p (Suc (degree p - Suc 0)) = of_nat (degree p) * lead_coeff p
[PROOF STEP]
by (auto simp add: coeff_eq_0)


[STATEMENT]
lemma isShortestPath_length_less_V:
  assumes SV: "s\<in>V"
  assumes PATH: "isShortestPath s p t"
  shows "length p < card V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length p < card V
[PROOF STEP]
using simplePath_length_less_V[OF SV]
[PROOF STATE]
proof (prove)
using this:
isSimplePath s ?p ?v \<Longrightarrow> length ?p < card V

goal (1 subgoal):
 1. length p < card V
[PROOF STEP]
using shortestPath_is_simple[OF PATH]
[PROOF STATE]
proof (prove)
using this:
isSimplePath s ?p ?v \<Longrightarrow> length ?p < card V
isSimplePath s p t

goal (1 subgoal):
 1. length p < card V
[PROOF STEP]
.


[STATEMENT]
lemma conjugate_exponent_real_ennreal:
  assumes "p> (1::real)"
  shows "conjugate_exponent(ennreal p) = ennreal(conjugate_exponent p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate_exponent (ennreal p) = ennreal (conjugate_exponent p)
[PROOF STEP]
unfolding conjugate_exponent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + 1 / (ennreal p - 1) = ennreal (1 + 1 / (p - 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. 1 + 1 / (ennreal p - 1) = ennreal (1 + 1 / (p - 1))
[PROOF STEP]
by (auto, metis diff_gt_0_iff_gt divide_ennreal ennreal_1 ennreal_minus zero_le_one)


[STATEMENT]
lemma path_image_rectpath_subset_cbox:
  assumes "Re a \<le> Re b" "Im a \<le> Im b"
  shows   "path_image (rectpath a b) \<subseteq> cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (rectpath a b) \<subseteq> cbox a b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re a \<le> Re b
Im a \<le> Im b

goal (1 subgoal):
 1. path_image (rectpath a b) \<subseteq> cbox a b
[PROOF STEP]
by (auto simp: path_image_rectpath in_cbox_complex_iff)


[STATEMENT]
lemma inc_mat_row_list_map_elem: "j < length Bs \<Longrightarrow> i < length Vs \<Longrightarrow>
    row (inc_mat_of Vs Bs) i $ j = map_vec (\<lambda> bl . if ((Vs ! i) \<in> bl) then 1 else 0) (vec_of_list Bs) $ j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < length Bs; i < length Vs\<rbrakk> \<Longrightarrow> row (inc_mat_of Vs Bs) i $ j = map_vec (\<lambda>bl. if Vs ! i \<in> bl then 1::'b else (0::'b)) (vec_of_list Bs) $ j
[PROOF STEP]
by (simp add: inc_mat_of_def vec_of_list_index)


[STATEMENT]
theorem gcsort_sorted:
  assumes
    A: "index_less index key" and
    B: "index_mono index key" and
    C: "length xs \<le> p"
  shows "sorted (map key (gcsort index key p xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
let ?t = "(0, [length xs], xs)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
have "sort_inv key (gcsort_aux index key p ?t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sort_inv key (gcsort_aux index key p (0, [length xs], xs))
[PROOF STEP]
by (rule gcsort_sort_inv [OF A B _ C], rule gcsort_add_input,
     rule gcsort_aux_set, rule gcsort_sort_input)
[PROOF STATE]
proof (state)
this:
sort_inv key (gcsort_aux index key p (0, [length xs], xs))

goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sort_inv key (gcsort_aux index key p (0, [length xs], xs))

goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
have "add_inv (length xs) (gcsort_aux index key p ?t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_inv (length xs) (gcsort_aux index key p (0, [length xs], xs))
[PROOF STEP]
by (rule gcsort_add_inv [OF A _ _ C],
     rule gcsort_aux_set, rule gcsort_add_input)
[PROOF STATE]
proof (state)
this:
add_inv (length xs) (gcsort_aux index key p (0, [length xs], xs))

goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sort_inv key (gcsort_aux index key p (0, [length xs], xs))
add_inv (length xs) (gcsort_aux index key p (0, [length xs], xs))
[PROOF STEP]
have "sorted (map key (gcsort_out (gcsort_aux index key p ?t)))"
[PROOF STATE]
proof (prove)
using this:
sort_inv key (gcsort_aux index key p (0, [length xs], xs))
add_inv (length xs) (gcsort_aux index key p (0, [length xs], xs))

goal (1 subgoal):
 1. sorted (map key (gcsort_out (gcsort_aux index key p (0, [length xs], xs))))
[PROOF STEP]
by (rule gcsort_sort_intro, simp add: gcsort_sort_form)
[PROOF STATE]
proof (state)
this:
sorted (map key (gcsort_out (gcsort_aux index key p (0, [length xs], xs))))

goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sorted (map key (gcsort_out (gcsort_aux index key p (0, [length xs], xs))))

goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
have "?t = gcsort_in xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0, [length xs], xs) = gcsort_in xs
[PROOF STEP]
by (simp add: gcsort_in_def)
[PROOF STATE]
proof (state)
this:
(0, [length xs], xs) = gcsort_in xs

goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sorted (map key (gcsort_out (gcsort_aux index key p (0, [length xs], xs))))
(0, [length xs], xs) = gcsort_in xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted (map key (gcsort_out (gcsort_aux index key p (0, [length xs], xs))))
(0, [length xs], xs) = gcsort_in xs

goal (1 subgoal):
 1. sorted (map key (gcsort index key p xs))
[PROOF STEP]
by (simp add: gcsort_def)
[PROOF STATE]
proof (state)
this:
sorted (map key (gcsort index key p xs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reciprocal_sum:
  fixes P :: "'a \<Rightarrow> 'b::comm_semiring_0 poly"
  assumes hP: "\<And>k. degree (P k) \<le> p"
  shows "reciprocal_poly p (\<Sum>k\<in>A. P k) = (\<Sum>k\<in>A. reciprocal_poly p (P k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly p (sum P A) = (\<Sum>k\<in>A. reciprocal_poly p (P k))
[PROOF STEP]
proof (induct A rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> reciprocal_poly p (sum P A) = (\<Sum>k\<in>A. reciprocal_poly p (P k))
 2. reciprocal_poly p (sum P {}) = (\<Sum>k\<in>{}. reciprocal_poly p (P k))
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
case (infinite A)
[PROOF STATE]
proof (state)
this:
infinite A

goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> reciprocal_poly p (sum P A) = (\<Sum>k\<in>A. reciprocal_poly p (P k))
 2. reciprocal_poly p (sum P {}) = (\<Sum>k\<in>{}. reciprocal_poly p (P k))
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. reciprocal_poly p (sum P A) = (\<Sum>k\<in>A. reciprocal_poly p (P k))
[PROOF STEP]
by (simp add: reciprocal_0)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (sum P A) = (\<Sum>k\<in>A. reciprocal_poly p (P k))

goal (2 subgoals):
 1. reciprocal_poly p (sum P {}) = (\<Sum>k\<in>{}. reciprocal_poly p (P k))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. reciprocal_poly p (sum P {}) = (\<Sum>k\<in>{}. reciprocal_poly p (P k))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. reciprocal_poly p (sum P {}) = (\<Sum>k\<in>{}. reciprocal_poly p (P k))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly p (sum P {}) = (\<Sum>k\<in>{}. reciprocal_poly p (P k))
[PROOF STEP]
by (simp add: reciprocal_0)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (sum P {}) = (\<Sum>k\<in>{}. reciprocal_poly p (P k))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
assume "x \<notin> F"
     and "reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))"
     and "finite F"
[PROOF STATE]
proof (state)
this:
x \<notin> F
reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))
finite F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<notin> F
reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))
finite F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
hence "reciprocal_poly p (sum P (insert x F))
      = reciprocal_poly p (P x) + reciprocal_poly p (sum P F)"
[PROOF STATE]
proof (prove)
using this:
x \<notin> F
reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))
finite F

goal (1 subgoal):
 1. reciprocal_poly p (sum P (insert x F)) = reciprocal_poly p (P x) + reciprocal_poly p (sum P F)
[PROOF STEP]
by (auto simp add: reciprocal_add hP degree_sum_le)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (sum P (insert x F)) = reciprocal_poly p (P x) + reciprocal_poly p (sum P F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))\<rbrakk> \<Longrightarrow> reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<notin> F
reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))
finite F
reciprocal_poly p (sum P (insert x F)) = reciprocal_poly p (P x) + reciprocal_poly p (sum P F)
[PROOF STEP]
show "reciprocal_poly p (sum P (insert x F))
      = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))"
[PROOF STATE]
proof (prove)
using this:
x \<notin> F
reciprocal_poly p (sum P F) = (\<Sum>k\<in>F. reciprocal_poly p (P k))
finite F
reciprocal_poly p (sum P (insert x F)) = reciprocal_poly p (P x) + reciprocal_poly p (sum P F)

goal (1 subgoal):
 1. reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))
[PROOF STEP]
by (auto simp: Groups_Big.comm_monoid_add_class.sum.insert_if)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (sum P (insert x F)) = (\<Sum>k\<in>insert x F. reciprocal_poly p (P k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permute_list_map:
  assumes "f permutes {..<length xs}"
  shows "permute_list f (map g xs) = map g (permute_list f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list f (map g xs) = map g (permute_list f xs)
[PROOF STEP]
using permutes_in_image[OF assms]
[PROOF STATE]
proof (prove)
using this:
(f ?x \<in> {..<length xs}) = (?x \<in> {..<length xs})

goal (1 subgoal):
 1. permute_list f (map g xs) = map g (permute_list f xs)
[PROOF STEP]
by (auto simp: permute_list_def)


[STATEMENT]
lemma convex_hull_linear_image:
  assumes f: "linear f"
  shows "f ` (convex hull s) = convex hull (f ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (convex hull s) = convex hull f ` s
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f ` (convex hull s) \<subseteq> convex hull f ` s
 2. convex hull f ` s \<subseteq> f ` (convex hull s)
[PROOF STEP]
show "convex hull (f ` s) \<subseteq> f ` (convex hull s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull f ` s \<subseteq> f ` (convex hull s)
[PROOF STEP]
by (intro hull_minimal image_mono hull_subset convex_linear_image assms convex_convex_hull)
[PROOF STATE]
proof (state)
this:
convex hull f ` s \<subseteq> f ` (convex hull s)

goal (1 subgoal):
 1. f ` (convex hull s) \<subseteq> convex hull f ` s
[PROOF STEP]
show "f ` (convex hull s) \<subseteq> convex hull (f ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (convex hull s) \<subseteq> convex hull f ` s
[PROOF STEP]
proof (unfold image_subset_iff_subset_vimage, rule hull_minimal)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. s \<subseteq> f -` (convex hull f ` s)
 2. convex (f -` (convex hull f ` s))
[PROOF STEP]
show "s \<subseteq> f -` (convex hull (f ` s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<subseteq> f -` (convex hull f ` s)
[PROOF STEP]
by (fast intro: hull_inc)
[PROOF STATE]
proof (state)
this:
s \<subseteq> f -` (convex hull f ` s)

goal (1 subgoal):
 1. convex (f -` (convex hull f ` s))
[PROOF STEP]
show "convex (f -` (convex hull (f ` s)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (f -` (convex hull f ` s))
[PROOF STEP]
by (intro convex_linear_vimage [OF f] convex_convex_hull)
[PROOF STATE]
proof (state)
this:
convex (f -` (convex hull f ` s))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ` (convex hull s) \<subseteq> convex hull f ` s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pow_ge_zero[intro]: assumes a: "a \<ge> (0 :: 'a)"
  shows "a ^ n \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> a ^ n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (0::'a) \<le> a ^ 0
 2. \<And>n. (0::'a) \<le> a ^ n \<Longrightarrow> (0::'a) \<le> a ^ Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (0::'a) \<le> a ^ 0
 2. \<And>n. (0::'a) \<le> a ^ n \<Longrightarrow> (0::'a) \<le> a ^ Suc n
[PROOF STEP]
from one_ge_zero
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> (1::'a)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> (1::'a)

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

goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> a ^ n \<Longrightarrow> (0::'a) \<le> a ^ Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> a ^ n \<Longrightarrow> (0::'a) \<le> a ^ Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> a ^ n

goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> a ^ n \<Longrightarrow> (0::'a) \<le> a ^ Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> a ^ Suc n
[PROOF STEP]
using times_left_mono[OF Suc a]
[PROOF STATE]
proof (prove)
using this:
(0::'a) * a ^ n \<le> a * a ^ n

goal (1 subgoal):
 1. (0::'a) \<le> a ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> a ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_powr[continuous_intros]:
  fixes f g :: "_ \<Rightarrow> real"
  assumes "continuous_on s f" "continuous_on s g" and "\<forall>x\<in>s. f x \<noteq> 0"
  shows "continuous_on s (\<lambda>x. (f x) powr (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x powr g x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on s f
continuous_on s g
\<forall>x\<in>s. f x \<noteq> 0

goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x powr g x)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s)
\<forall>x\<in>s. (g \<longlongrightarrow> g x) (at x within s)
\<forall>x\<in>s. f x \<noteq> 0

goal (1 subgoal):
 1. \<forall>x\<in>s. ((\<lambda>x. f x powr g x) \<longlongrightarrow> f x powr g x) (at x within s)
[PROOF STEP]
by (fast intro: tendsto_powr)


[STATEMENT]
lemma degree0isovarspar :
  assumes deg0 : "MPoly_Type.degree (p::real mpoly) x = 0"
  shows "isolate_variable_sparse p x 0 = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolate_variable_sparse p x 0 = p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isolate_variable_sparse p x 0 = p
[PROOF STEP]
have h1 : "p = (\<Sum>i::nat \<le>MPoly_Type.degree p x. isolate_variable_sparse p x i * Var x ^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = (\<Sum>i\<le>MPoly_Type.degree p x. isolate_variable_sparse p x i * Var x ^ i)
[PROOF STEP]
using sum_over_zero
[PROOF STATE]
proof (prove)
using this:
?mp = (\<Sum>i\<le>MPoly_Type.degree ?mp ?x. isolate_variable_sparse ?mp ?x i * Var ?x ^ i)

goal (1 subgoal):
 1. p = (\<Sum>i\<le>MPoly_Type.degree p x. isolate_variable_sparse p x i * Var x ^ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = (\<Sum>i\<le>MPoly_Type.degree p x. isolate_variable_sparse p x i * Var x ^ i)

goal (1 subgoal):
 1. isolate_variable_sparse p x 0 = p
[PROOF STEP]
have h2a : "\<forall>f. (\<Sum>i::nat \<le>0. f i) = f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. sum f {..0} = f 0
[PROOF STEP]
apply(simp add: sum_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. comm_monoid_set.F (+) (0::'a) f {0} = f 0
[PROOF STEP]
by (metis add.right_neutral comm_monoid_add_class.sum_def finite.emptyI insert_absorb insert_not_empty sum.empty sum.insert)
[PROOF STATE]
proof (state)
this:
\<forall>f. sum f {..0} = f 0

goal (1 subgoal):
 1. isolate_variable_sparse p x 0 = p
[PROOF STEP]
have h2 : "p = isolate_variable_sparse p x 0 * Var x ^ 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = isolate_variable_sparse p x 0 * Var x ^ 0
[PROOF STEP]
using deg0 h1 h2a
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree p x = 0
p = (\<Sum>i\<le>MPoly_Type.degree p x. isolate_variable_sparse p x i * Var x ^ i)
\<forall>f. sum f {..0} = f 0

goal (1 subgoal):
 1. p = isolate_variable_sparse p x 0 * Var x ^ 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = isolate_variable_sparse p x 0 * Var x ^ 0

goal (1 subgoal):
 1. isolate_variable_sparse p x 0 = p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolate_variable_sparse p x 0 = p
[PROOF STEP]
using h2
[PROOF STATE]
proof (prove)
using this:
p = isolate_variable_sparse p x 0 * Var x ^ 0

goal (1 subgoal):
 1. isolate_variable_sparse p x 0 = p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isolate_variable_sparse p x 0 = p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_int_dvd_imp_dvd_gauss_cnj:
  fixes z :: gauss_int
  assumes "of_int n dvd z"
  shows   "of_int n dvd gauss_cnj z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int n dvd gauss_cnj z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int n dvd gauss_cnj z
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
of_int n dvd z
[PROOF STEP]
obtain u where "z = of_int n * u"
[PROOF STATE]
proof (prove)
using this:
of_int n dvd z

goal (1 subgoal):
 1. (\<And>u. z = of_int n * u \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z = of_int n * u

goal (1 subgoal):
 1. of_int n dvd gauss_cnj z
[PROOF STEP]
hence "gauss_cnj z = of_int n * gauss_cnj u"
[PROOF STATE]
proof (prove)
using this:
z = of_int n * u

goal (1 subgoal):
 1. gauss_cnj z = of_int n * gauss_cnj u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gauss_cnj z = of_int n * gauss_cnj u

goal (1 subgoal):
 1. of_int n dvd gauss_cnj z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
gauss_cnj z = of_int n * gauss_cnj u

goal (1 subgoal):
 1. of_int n dvd gauss_cnj z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int n dvd gauss_cnj z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cdot_norm: "cinner x y = ((norm (x+y))\<^sup>2 - (norm (x-y))\<^sup>2 - \<i> * (norm (x + \<i> *\<^sub>C y))\<^sup>2 + \<i> * (norm (x - \<i> *\<^sub>C y))\<^sup>2) / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner x y = (complex_of_real ((norm (x + y))\<^sup>2 - (norm (x - y))\<^sup>2) - \<i> * complex_of_real ((norm (x + \<i> *\<^sub>C y))\<^sup>2) + \<i> * complex_of_real ((norm (x - \<i> *\<^sub>C y))\<^sup>2)) / 4
[PROOF STEP]
unfolding power2_norm_eq_cinner
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner x y = (complex_of_real ((norm (x + y))\<^sup>2 - (norm (x - y))\<^sup>2) - \<i> * complex_of_real ((norm (x + \<i> *\<^sub>C y))\<^sup>2) + \<i> * complex_of_real ((norm (x - \<i> *\<^sub>C y))\<^sup>2)) / 4
[PROOF STEP]
by (simp add: power2_norm_eq_cinner cinner_add_left cinner_add_right
      cinner_diff_left cinner_diff_right ring_distribs)


[STATEMENT]
lemma "2 \<le> x \<and> x \<le> 125841 / 50000 \<and> 2 \<le> y \<and> y \<le> 125841 / 50000 \<and> 2 \<le> z \<and> z \<le> 125841 / 50000 \<longrightarrow>
    2 * (x * z + x * y + y * z) - (x * x + y * y + z * z) \<ge> (0::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> x \<and> x \<le> 125841 / 50000 \<and> 2 \<le> y \<and> y \<le> 125841 / 50000 \<and> 2 \<le> z \<and> z \<le> 125841 / 50000 \<longrightarrow> 0 \<le> 2 * (x * z + x * y + y * z) - (x * x + y * y + z * z)
[PROOF STEP]
by sos


[STATEMENT]
lemma orthogonal_basis_exists2:
  fixes V :: "(real^'b) list"
  assumes B: "is_basis (set V)"
  and d: "distinct V"
  shows "vec.independent (set (Gram_Schmidt2 V)) \<and> (set V) \<subseteq> vec.span (set (Gram_Schmidt2 V))
  \<and> (card (set (Gram_Schmidt2 V)) = vec.dim (set V)) \<and> pairwise orthogonal (set (Gram_Schmidt2 V))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (set (Gram_Schmidt2 V)) \<and> set V \<subseteq> vec.span (set (Gram_Schmidt2 V)) \<and> card (set (Gram_Schmidt2 V)) = vec.dim (set V) \<and> pairwise orthogonal (set (Gram_Schmidt2 V))
[PROOF STEP]
by (metis Gram_Schmidt.orthogonal_basis_exists Gram_Schmidt2_def distinct_rev set_rev
      B basis_orthogonal2 d)


[STATEMENT]
lemma invertible_mat_four_block_mat_lower_right_id:
  assumes A: "(A::'a::comm_ring_1 mat) \<in> carrier_mat m m" and B: "B = 0\<^sub>m m (n-m)" and C: "C = 0\<^sub>m (n-m) m"
    and D: "D = 1\<^sub>m (n-m)" and "n>m" and inv_A: "invertible_mat A"
  shows "invertible_mat (four_block_mat A B C D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat (four_block_mat A B C D)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible_mat (four_block_mat A B C D)
[PROOF STEP]
have "Determinant.det (four_block_mat A B C D) = Determinant.det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (four_block_mat A B C D) = Determinant.det A
[PROOF STEP]
by (rule det_four_block_mat_lower_right_id, insert assms, auto)
[PROOF STATE]
proof (state)
this:
Determinant.det (four_block_mat A B C D) = Determinant.det A

goal (1 subgoal):
 1. invertible_mat (four_block_mat A B C D)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Determinant.det (four_block_mat A B C D) = Determinant.det A

goal (1 subgoal):
 1. invertible_mat (four_block_mat A B C D)
[PROOF STEP]
using inv_A
[PROOF STATE]
proof (prove)
using this:
Determinant.det (four_block_mat A B C D) = Determinant.det A
invertible_mat A

goal (1 subgoal):
 1. invertible_mat (four_block_mat A B C D)
[PROOF STEP]
by (metis (no_types, lifting) assms(1) assms(4) carrier_matD(1) carrier_matD(2) carrier_mat_triv
        index_mat_four_block(2) index_mat_four_block(3) index_one_mat(2) index_one_mat(3)
        invertible_iff_is_unit_JNF)
[PROOF STATE]
proof (state)
this:
invertible_mat (four_block_mat A B C D)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "f91 n = (if 100 < n then n - 10 else 91)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f91 n = (if 100 < n then n - 10 else 91)
[PROOF STEP]
by (induct n rule: f91.induct) auto


[STATEMENT]
lemma powr_sum: "x \<noteq> 0 \<Longrightarrow> finite A \<Longrightarrow> x powr sum f A = (\<Prod>y\<in>A. x powr f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<noteq> (0::'a); finite A\<rbrakk> \<Longrightarrow> x powr sum f A = (\<Prod>y\<in>A. x powr f y)
[PROOF STEP]
by (simp add: powr_def exp_sum sum_distrib_right)


[STATEMENT]
lemma suminf_minus_initial_segment: "summable f \<Longrightarrow> (\<Sum>n. f (n + k)) = (\<Sum>n. f n) - (\<Sum>i<k. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<Sum>n. f (n + k)) = (\<Sum>n. f n) - sum f {..<k}
[PROOF STEP]
by (rule sums_unique[symmetric]) (auto simp: sums_iff_shift)


[STATEMENT]
lemma register_Snd_register_Fst[simp]:
  assumes \<open>register F\<close>
  shows \<open>(F o Snd; F o Fst) = F o swap\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<circ> Snd;F \<circ> Fst) = F \<circ> swap
[PROOF STEP]
apply (rule tensor_extensionality)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. preregister (F \<circ> Snd;F \<circ> Fst)
 2. preregister (F \<circ> swap)
 3. \<And>a b. (F \<circ> Snd;F \<circ> Fst) (a \<otimes>\<^sub>u b) = (F \<circ> swap) (a \<otimes>\<^sub>u b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
register F

goal (3 subgoals):
 1. preregister (F \<circ> Snd;F \<circ> Fst)
 2. preregister (F \<circ> swap)
 3. \<And>a b. (F \<circ> Snd;F \<circ> Fst) (a \<otimes>\<^sub>u b) = (F \<circ> swap) (a \<otimes>\<^sub>u b)
[PROOF STEP]
by (auto simp: register_pair_apply Fst_def Snd_def register_mult tensor_update_mult)


[STATEMENT]
lemma (in padic_integers) residue_ring_card:
"finite (carrier (Zp_res_ring n)) \<and> card (carrier (Zp_res_ring n)) = nat (p^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier (residue_ring (p ^ n))) \<and> card (carrier (residue_ring (p ^ n))) = nat (p ^ n)
[PROOF STEP]
using p_res_ring_car[of n]
[PROOF STATE]
proof (prove)
using this:
carrier (residue_ring (p ^ n)) = {0..<p ^ n}

goal (1 subgoal):
 1. finite (carrier (residue_ring (p ^ n))) \<and> card (carrier (residue_ring (p ^ n))) = nat (p ^ n)
[PROOF STEP]
by simp


[STATEMENT]
lemma to_fun_plus:
  assumes "g \<in> carrier P"
  assumes "f \<in> carrier P"
  assumes "x \<in> carrier R"
  shows "to_fun (f \<oplus>\<^bsub>P\<^esub> g) x = (to_fun f x) \<oplus> (to_fun g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (f \<oplus>\<^bsub>P\<^esub> g) x = to_fun f x \<oplus> to_fun g x
[PROOF STEP]
using assms to_fun_eval[of ] eval_ring_hom[of x]
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier P
f \<in> carrier P
x \<in> carrier R
\<lbrakk>?f \<in> carrier P; ?x \<in> carrier R\<rbrakk> \<Longrightarrow> to_fun ?f ?x = eval R R (\<lambda>x. x) ?x ?f
x \<in> carrier R \<Longrightarrow> eval R R (\<lambda>x. x) x \<in> ring_hom P R

goal (1 subgoal):
 1. to_fun (f \<oplus>\<^bsub>P\<^esub> g) x = to_fun f x \<oplus> to_fun g x
[PROOF STEP]
by (simp add: ring_hom_add)


[STATEMENT]
lemma supremum_smaller_closure [simp]:
  assumes "finite S"
  shows "supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
proof (cases "smaller_subset x S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. smaller_subset x S = {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
 2. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
case [simp]: True
[PROOF STATE]
proof (state)
this:
smaller_subset x S = {}

goal (2 subgoals):
 1. smaller_subset x S = {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
 2. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)

goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
smaller_subset x S \<noteq> {}

goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
have "smaller_subset x S \<subseteq> smaller_subset x (closure S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smaller_subset x S \<subseteq> smaller_subset x (closure S)
[PROOF STEP]
unfolding pre_subset_eq_pos_subset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smaller_subset x S \<subseteq> closure (smaller_subset x S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
smaller_subset x S \<subseteq> smaller_subset x (closure S)

goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
smaller_subset x S \<subseteq> smaller_subset x (closure S)
[PROOF STEP]
have l: "less_eq (supremum (smaller_subset x S)) (supremum (smaller_subset x (closure S)))"
[PROOF STATE]
proof (prove)
using this:
smaller_subset x S \<subseteq> smaller_subset x (closure S)

goal (1 subgoal):
 1. less_eq (supremum (smaller_subset x S)) (supremum (smaller_subset x (closure S)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
smaller_subset x S \<subseteq> smaller_subset x (closure S)
finite S

goal (1 subgoal):
 1. less_eq (supremum (smaller_subset x S)) (supremum (smaller_subset x (closure S)))
[PROOF STEP]
unfolding pre_subset_eq_pos_subset
[PROOF STATE]
proof (prove)
using this:
smaller_subset x S \<subseteq> closure (smaller_subset x S)
finite S

goal (1 subgoal):
 1. less_eq (supremum (smaller_subset x S)) (supremum (closure (smaller_subset x S)))
[PROOF STEP]
by (intro supremum_subset_less_eq) auto
[PROOF STATE]
proof (state)
this:
less_eq (supremum (smaller_subset x S)) (supremum (smaller_subset x (closure S)))

goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
smaller_subset x S \<noteq> {}
[PROOF STEP]
have "supremum (closure (smaller_subset x S)) \<in> closure S"
[PROOF STATE]
proof (prove)
using this:
smaller_subset x S \<noteq> {}

goal (1 subgoal):
 1. supremum (closure (smaller_subset x S)) \<in> closure S
[PROOF STEP]
using assms cl.closure_mono[OF smaller_subset_mono]
[PROOF STATE]
proof (prove)
using this:
smaller_subset x S \<noteq> {}
finite S
closure (smaller_subset ?x1 ?T) \<subseteq> closure ?T

goal (1 subgoal):
 1. supremum (closure (smaller_subset x S)) \<in> closure S
[PROOF STEP]
using \<open>smaller_subset x S \<subseteq> smaller_subset x (closure S)\<close>
[PROOF STATE]
proof (prove)
using this:
smaller_subset x S \<noteq> {}
finite S
closure (smaller_subset ?x1 ?T) \<subseteq> closure ?T
smaller_subset x S \<subseteq> smaller_subset x (closure S)

goal (1 subgoal):
 1. supremum (closure (smaller_subset x S)) \<in> closure S
[PROOF STEP]
by (auto simp add: assms intro!: supremum_in_closure)
[PROOF STATE]
proof (state)
this:
supremum (closure (smaller_subset x S)) \<in> closure S

goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
from closure_to_cons_listE[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>ss. \<lbrakk>ss \<noteq> []; fold f ss e = supremum (closure (smaller_subset x S)); set ss \<subseteq> S\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain ss where
    dec : "supremum (smaller_subset x (closure S)) = Finite_Set.fold f e (set ss)"
    and inv: "ss \<noteq> []" "set ss \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
(\<And>ss. \<lbrakk>ss \<noteq> []; fold f ss e = supremum (closure (smaller_subset x S)); set ss \<subseteq> S\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>ss. \<lbrakk>supremum (smaller_subset x (closure S)) = supremum (set ss); ss \<noteq> []; set ss \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: cl.fold_set_fold) force
[PROOF STATE]
proof (state)
this:
supremum (smaller_subset x (closure S)) = supremum (set ss)
ss \<noteq> []
set ss \<subseteq> S

goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
supremum (smaller_subset x (closure S)) = supremum (set ss)
ss \<noteq> []
set ss \<subseteq> S
[PROOF STEP]
have "set ss \<subseteq> smaller_subset x S"
[PROOF STATE]
proof (prove)
using this:
supremum (smaller_subset x (closure S)) = supremum (set ss)
ss \<noteq> []
set ss \<subseteq> S

goal (1 subgoal):
 1. set ss \<subseteq> smaller_subset x S
[PROOF STEP]
using supremum_sound[OF assms]
[PROOF STATE]
proof (prove)
using this:
supremum (smaller_subset x (closure S)) = supremum (set ss)
ss \<noteq> []
set ss \<subseteq> S
?t \<in> S \<Longrightarrow> less_eq ?t (supremum S)

goal (1 subgoal):
 1. set ss \<subseteq> smaller_subset x S
[PROOF STEP]
using supremum_smaller_subset[OF assms]
[PROOF STATE]
proof (prove)
using this:
supremum (smaller_subset x (closure S)) = supremum (set ss)
ss \<noteq> []
set ss \<subseteq> S
?t \<in> S \<Longrightarrow> less_eq ?t (supremum S)
less_eq (supremum (smaller_subset ?x S)) ?x

goal (1 subgoal):
 1. set ss \<subseteq> smaller_subset x S
[PROOF STEP]
by (auto simp: smaller_subset_def)
      (metis List.finite_set assms cl.finite_S_finite_closure dec trans supremum_smaller_subset supremum_sound)
[PROOF STATE]
proof (state)
this:
set ss \<subseteq> smaller_subset x S

goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set ss \<subseteq> smaller_subset x S
[PROOF STEP]
have "less_eq (supremum (smaller_subset x (closure S))) (supremum (smaller_subset x S))"
[PROOF STATE]
proof (prove)
using this:
set ss \<subseteq> smaller_subset x S

goal (1 subgoal):
 1. less_eq (supremum (smaller_subset x (closure S))) (supremum (smaller_subset x S))
[PROOF STEP]
using inv assms
[PROOF STATE]
proof (prove)
using this:
set ss \<subseteq> smaller_subset x S
ss \<noteq> []
set ss \<subseteq> S
finite S

goal (1 subgoal):
 1. less_eq (supremum (smaller_subset x (closure S))) (supremum (smaller_subset x S))
[PROOF STEP]
unfolding dec
[PROOF STATE]
proof (prove)
using this:
set ss \<subseteq> smaller_subset x S
ss \<noteq> []
set ss \<subseteq> S
finite S

goal (1 subgoal):
 1. less_eq (supremum (set ss)) (supremum (smaller_subset x S))
[PROOF STEP]
by (intro supremum_subset_less_eq) auto
[PROOF STATE]
proof (state)
this:
less_eq (supremum (smaller_subset x (closure S))) (supremum (smaller_subset x S))

goal (1 subgoal):
 1. smaller_subset x S \<noteq> {} \<Longrightarrow> supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
less_eq (supremum (smaller_subset x (closure S))) (supremum (smaller_subset x S))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
less_eq (supremum (smaller_subset x (closure S))) (supremum (smaller_subset x S))

goal (1 subgoal):
 1. supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
using l anti_sym
[PROOF STATE]
proof (prove)
using this:
less_eq (supremum (smaller_subset x (closure S))) (supremum (smaller_subset x S))
less_eq (supremum (smaller_subset x S)) (supremum (smaller_subset x (closure S)))
\<lbrakk>less_eq ?x ?y; less_eq ?y ?x\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
supremum (smaller_subset x (closure S)) = supremum (smaller_subset x S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_zero_row_eq_row_zero: "is_zero_row a A = (row a A = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row a A = (row a A = 0)
[PROOF STEP]
unfolding is_zero_row_def' row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j. A $ a $ j = (0::'b)) = (vec_lambda (($) (A $ a)) = 0)
[PROOF STEP]
unfolding vec_nth_inverse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j. A $ a $ j = (0::'b)) = (A $ a = 0)
[PROOF STEP]
unfolding vec_eq_iff zero_index
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j. A $ a $ j = (0::'b)) = (\<forall>i. A $ a $ i = (0::'b))
[PROOF STEP]
..


[STATEMENT]
lemma tendsto_add_const_iff:
  "((\<lambda>x. c + f x :: 'a::topological_group_add) \<longlongrightarrow> c + d) F \<longleftrightarrow> (f \<longlongrightarrow> d) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) F = (f \<longlongrightarrow> d) F
[PROOF STEP]
using tendsto_add[OF tendsto_const[of c], of f d]
    and tendsto_add[OF tendsto_const[of "-c"], of "\<lambda>x. c + f x" "c + d"]
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> d) ?F \<Longrightarrow> ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) ?F
((\<lambda>x. c + f x) \<longlongrightarrow> c + d) ?F \<Longrightarrow> ((\<lambda>x. - c + (c + f x)) \<longlongrightarrow> - c + (c + d)) ?F

goal (1 subgoal):
 1. ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) F = (f \<longlongrightarrow> d) F
[PROOF STEP]
by auto


[STATEMENT]
lemma epsilon_inverse_omega: "\<epsilon> = inverse \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<epsilon> = inverse \<omega>
[PROOF STEP]
by (simp add: epsilon_def omega_def star_n_inverse)


[STATEMENT]
lemma pairwise_disjnt_Un:
  assumes "pairwise disjnt ({M} \<union> {N} \<union> V)" "M \<notin> V" "N \<notin> V"
  shows "pairwise disjnt ({M \<union> N} \<union> V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint ({M \<union> N} \<union> V)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
disjoint ({M} \<union> {N} \<union> V)
M \<notin> V
N \<notin> V

goal (1 subgoal):
 1. disjoint ({M \<union> N} \<union> V)
[PROOF STEP]
unfolding pairwise_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{M} \<union> {N} \<union> V. \<forall>y\<in>{M} \<union> {N} \<union> V. x \<noteq> y \<longrightarrow> disjnt x y
M \<notin> V
N \<notin> V

goal (1 subgoal):
 1. \<forall>x\<in>{M \<union> N} \<union> V. \<forall>y\<in>{M \<union> N} \<union> V. x \<noteq> y \<longrightarrow> disjnt x y
[PROOF STEP]
by auto


[STATEMENT]
lemma index_map_mat[simp]:
  "i < dim_row A \<Longrightarrow> j < dim_col A \<Longrightarrow> map_mat f A $$ (i,j) = f (A $$ (i,j))"
  "dim_row (map_mat f A) = dim_row A" "dim_col (map_mat f A) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < dim_row A; j < dim_col A\<rbrakk> \<Longrightarrow> map_mat f A $$ (i, j) = f (A $$ (i, j))) &&& dim_row (map_mat f A) = dim_row A &&& dim_col (map_mat f A) = dim_col A
[PROOF STEP]
unfolding map_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < dim_row A; j < dim_col A\<rbrakk> \<Longrightarrow> mat (dim_row A) (dim_col A) (\<lambda>ij. f (A $$ ij)) $$ (i, j) = f (A $$ (i, j))) &&& dim_row (mat (dim_row A) (dim_col A) (\<lambda>ij. f (A $$ ij))) = dim_row A &&& dim_col (mat (dim_row A) (dim_col A) (\<lambda>ij. f (A $$ ij))) = dim_col A
[PROOF STEP]
by auto


[STATEMENT]
lemma log_mult:
  "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow>
    log a (x * y) = log a x + log a y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1; 0 < x; 0 < y\<rbrakk> \<Longrightarrow> log a (x * y) = log a x + log a y
[PROOF STEP]
by (simp add: log_def ln_mult divide_inverse distrib_right)


[STATEMENT]
lemma mtx_vec_mult_minus_ldistrib: "A *\<^sub>V (x - y) =  A *\<^sub>V x -  A *\<^sub>V y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>V (x - y) = A *\<^sub>V x - A *\<^sub>V y
[PROOF STEP]
by (metis (no_types, lifting) add_diff_cancel diff_add_cancel
      matrix_vector_right_distrib sq_mtx_vec_mult.rep_eq)