[STATEMENT]
lemma cc_Suc_le:
  assumes "j < n - 3"
  shows "int (cc (Suc j)) \<le> 2 + (int (cc (j + 2)) gchoose 2) + (\<Sum>i=j+4..n-1. int (cc i) gchoose (i - j))"
            \<comment>\<open>Could be proved without coercing to @{typ int}, because everything is non-negative.\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
let ?f = "\<lambda>i j. (int (aa i) gchoose (i - j)) + (int (bb i) gchoose (i - j))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
let ?S = "\<lambda>x y. (\<Sum>i=j+x..n-y. (- 1)^(i - j) * ?f i j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
let ?S3 = "\<lambda>x y. (\<Sum>i=j+x..n-y. (int (cc i) gchoose (i - j)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have ie1: "int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (cc i) gchoose k" if "0 < k" for i k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
0 < k
[PROOF STEP]
have "int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i) + int (bb i) gchoose k"
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i) + int (bb i) gchoose k
[PROOF STEP]
by (rule gbinomial_int_plus_le) simp_all
[PROOF STATE]
proof (state)
this:
int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i) + int (bb i) gchoose k

goal (1 subgoal):
 1. int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i) + int (bb i) gchoose k

goal (1 subgoal):
 1. int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k
[PROOF STEP]
have "\<dots> = int (cc i) gchoose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (aa i) + int (bb i) gchoose k = int (aa i + bb i) gchoose k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (aa i) + int (bb i) gchoose k = int (aa i + bb i) gchoose k

goal (1 subgoal):
 1. int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k

goal (1 subgoal):
 1. int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
int (aa i) gchoose k + (int (bb i) gchoose k) \<le> int (aa i + bb i) gchoose k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < ?k47 \<Longrightarrow> int (aa ?i47) gchoose ?k47 + (int (bb ?i47) gchoose ?k47) \<le> int (aa ?i47 + bb ?i47) gchoose ?k47

goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from d_gr_0
[PROOF STATE]
proof (chain)
picking this:
0 < poly_deg f
[PROOF STEP]
have "0 \<le> int d - 1"
[PROOF STATE]
proof (prove)
using this:
0 < poly_deg f

goal (1 subgoal):
 1. 0 \<le> int (poly_deg f) - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> int (poly_deg f) - 1

goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
j < card X - 3
[PROOF STEP]
have "0 < n - Suc j"
[PROOF STATE]
proof (prove)
using this:
j < card X - 3

goal (1 subgoal):
 1. 0 < card X - Suc j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < card X - Suc j

goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have f_nonneg: "0 \<le> ?f i j" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))
[PROOF STEP]
by (simp add: gbinomial_int_nonneg)
[PROOF STATE]
proof (state)
this:
0 \<le> int (aa ?i47) gchoose (?i47 - j) + (int (bb ?i47) gchoose (?i47 - j))

goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
proof (cases "n = j + 4")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
card X = j + 4

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
hence j: "j = n - 4"
[PROOF STATE]
proof (prove)
using this:
card X = j + 4

goal (1 subgoal):
 1. j = card X - 4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j = card X - 4

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have 1: "n - Suc j = 3" and "j < n - 1" and 2: "Suc (n - 3) = Suc (Suc j)" and 3: "n - (n - 3) = 3"
      and 4: "n - j = 4" and 5: "n - Suc 0 = Suc (Suc (Suc j))" and 6: "n - 2 = Suc (Suc j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card X - Suc j = 3 &&& j < card X - 1 &&& Suc (card X - 3) = Suc (Suc j)) &&& (card X - (card X - 3) = 3 &&& card X - j = 4) &&& card X - Suc 0 = Suc (Suc (Suc j)) &&& card X - 2 = Suc (Suc j)
[PROOF STEP]
by (simp_all add: True)
[PROOF STATE]
proof (state)
this:
card X - Suc j = 3
j < card X - 1
Suc (card X - 3) = Suc (Suc j)
card X - (card X - 3) = 3
card X - j = 4
card X - Suc 0 = Suc (Suc (Suc j))
card X - 2 = Suc (Suc j)

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from \<open>j < n - 1\<close>
[PROOF STATE]
proof (chain)
picking this:
j < card X - 1
[PROOF STEP]
have "int (cc (Suc j)) = 2 + 2 * (- 1) ^ (n - j) * (int d - 1 gchoose (n - Suc j)) +
           (\<Sum>i = j+2..n-1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))"
[PROOF STATE]
proof (prove)
using this:
j < card X - 1

goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) = 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))
[PROOF STEP]
by (rule cc_Suc)
[PROOF STATE]
proof (state)
this:
int (aa (Suc j) + bb (Suc j)) = 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (aa (Suc j) + bb (Suc j)) = 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> = (2 + ((int (aa (n - 2)) gchoose 2) + (int (bb (n - 2)) gchoose 2))) +
                    (2 * (int d - 1 gchoose 3) - ((int (aa (n - 1)) gchoose 3) + (int (bb (n - 1)) gchoose 3)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + (2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)))
[PROOF STEP]
by (simp add: 1 2 3 4 5 6)
[PROOF STATE]
proof (state)
this:
2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + (2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)))

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + (2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)))

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> \<le> (2 + ((int (aa (n - 2)) gchoose 2) + (int (bb (n - 2)) gchoose 2))) + 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + (2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3))) \<le> 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + 0
[PROOF STEP]
proof (rule add_left_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
from cc_n_minus_1
[PROOF STATE]
proof (chain)
picking this:
aa (card X - 1) + bb (card X - 1) = 2 * poly_deg f
[PROOF STEP]
have eq1: "int (aa (n - 1)) + int (bb (n - 1)) = 2 * int d"
[PROOF STATE]
proof (prove)
using this:
aa (card X - 1) + bb (card X - 1) = 2 * poly_deg f

goal (1 subgoal):
 1. int (aa (card X - 1)) + int (bb (card X - 1)) = 2 * int (poly_deg f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (aa (card X - 1)) + int (bb (card X - 1)) = 2 * int (poly_deg f)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
hence ie2: "int (aa (n - 1)) \<le> 2 * int d"
[PROOF STATE]
proof (prove)
using this:
int (aa (card X - 1)) + int (bb (card X - 1)) = 2 * int (poly_deg f)

goal (1 subgoal):
 1. int (aa (card X - 1)) \<le> 2 * int (poly_deg f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (aa (card X - 1)) \<le> 2 * int (poly_deg f)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
from \<open>0 \<le> int d - 1\<close>
[PROOF STATE]
proof (chain)
picking this:
0 \<le> int (poly_deg f) - 1
[PROOF STEP]
have "int d - 1 gchoose 3 \<le> int d gchoose 3"
[PROOF STATE]
proof (prove)
using this:
0 \<le> int (poly_deg f) - 1

goal (1 subgoal):
 1. int (poly_deg f) - 1 gchoose 3 \<le> int (poly_deg f) gchoose 3
[PROOF STEP]
by (rule gbinomial_int_mono) simp
[PROOF STATE]
proof (state)
this:
int (poly_deg f) - 1 gchoose 3 \<le> int (poly_deg f) gchoose 3

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
hence "2 * (int d - 1 gchoose 3) \<le> 2 * (int d gchoose 3)"
[PROOF STATE]
proof (prove)
using this:
int (poly_deg f) - 1 gchoose 3 \<le> int (poly_deg f) gchoose 3

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) \<le> 2 * (int (poly_deg f) gchoose 3)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) - 1 gchoose 3) \<le> 2 * (int (poly_deg f) gchoose 3)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) - 1 gchoose 3) \<le> 2 * (int (poly_deg f) gchoose 3)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
from _ ie2
[PROOF STATE]
proof (chain)
picking this:
PROP ?psi \<Longrightarrow> PROP ?psi
int (aa (card X - 1)) \<le> 2 * int (poly_deg f)
[PROOF STEP]
have "\<dots> \<le> int (aa (n - 1)) gchoose 3 + (2 * int d - int (aa (n - 1)) gchoose 3)"
[PROOF STATE]
proof (prove)
using this:
PROP ?psi \<Longrightarrow> PROP ?psi
int (aa (card X - 1)) \<le> 2 * int (poly_deg f)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) gchoose 3) \<le> int (aa (card X - 1)) gchoose 3 + (2 * int (poly_deg f) - int (aa (card X - 1)) gchoose 3)
[PROOF STEP]
by (rule binomial_int_ineq_3) simp
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) gchoose 3) \<le> int (aa (card X - 1)) gchoose 3 + (2 * int (poly_deg f) - int (aa (card X - 1)) gchoose 3)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) gchoose 3) \<le> int (aa (card X - 1)) gchoose 3 + (2 * int (poly_deg f) - int (aa (card X - 1)) gchoose 3)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
have "\<dots> = int (aa (n - 1)) gchoose 3 + (int (bb (n - 1)) gchoose 3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (aa (card X - 1)) gchoose 3 + (2 * int (poly_deg f) - int (aa (card X - 1)) gchoose 3) = int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)
[PROOF STEP]
by (simp flip: eq1)
[PROOF STATE]
proof (state)
this:
int (aa (card X - 1)) gchoose 3 + (2 * int (poly_deg f) - int (aa (card X - 1)) gchoose 3) = int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * (int (poly_deg f) - 1 gchoose 3) \<le> int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)
[PROOF STEP]
show "2 * (int d - 1 gchoose 3) - (int (aa (n - 1)) gchoose 3 + (int (bb (n - 1)) gchoose 3)) \<le> 0"
[PROOF STATE]
proof (prove)
using this:
2 * (int (poly_deg f) - 1 gchoose 3) \<le> int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)

goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3)) \<le> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + (2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3))) \<le> 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + 0

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + (2 * (int (poly_deg f) - 1 gchoose 3) - (int (aa (card X - 1)) gchoose 3 + (int (bb (card X - 1)) gchoose 3))) \<le> 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + 0

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> = 2 + ((int (aa (n - 2)) gchoose 2) + (int (bb (n - 2)) gchoose 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + 0 = 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + 0 = 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2))

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) + 0 = 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2))

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from ie1
[PROOF STATE]
proof (chain)
picking this:
0 < ?k47 \<Longrightarrow> int (aa ?i47) gchoose ?k47 + (int (bb ?i47) gchoose ?k47) \<le> int (aa ?i47 + bb ?i47) gchoose ?k47
[PROOF STEP]
have "\<dots> \<le> 2 + (int (cc (n - 2)) gchoose 2)"
[PROOF STATE]
proof (prove)
using this:
0 < ?k47 \<Longrightarrow> int (aa ?i47) gchoose ?k47 + (int (bb ?i47) gchoose ?k47) \<le> int (aa ?i47 + bb ?i47) gchoose ?k47

goal (1 subgoal):
 1. 2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) \<le> 2 + (int (aa (card X - 2) + bb (card X - 2)) gchoose 2)
[PROOF STEP]
by (rule add_left_mono) simp
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) \<le> 2 + (int (aa (card X - 2) + bb (card X - 2)) gchoose 2)

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 2)) gchoose 2 + (int (bb (card X - 2)) gchoose 2)) \<le> 2 + (int (aa (card X - 2) + bb (card X - 2)) gchoose 2)

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> = 2 + (int (cc (j + 2)) gchoose 2) + ?S3 4 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + (int (aa (card X - 2) + bb (card X - 2)) gchoose 2) = 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
by (simp add: True)
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 2) + bb (card X - 2)) gchoose 2) = 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))

goal (2 subgoals):
 1. card X = j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
 2. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))

goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
card X \<noteq> j + 4

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
j < card X - 3
card X \<noteq> j + 4
[PROOF STEP]
have "j + 4 \<le> n - 1"
[PROOF STATE]
proof (prove)
using this:
j < card X - 3
card X \<noteq> j + 4

goal (1 subgoal):
 1. j + 4 \<le> card X - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j + 4 \<le> card X - 1

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from n_gr_1
[PROOF STATE]
proof (chain)
picking this:
1 < card X
[PROOF STEP]
have "0 < n - 1"
[PROOF STATE]
proof (prove)
using this:
1 < card X

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

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
j < card X - 3
[PROOF STEP]
have "j + 2 \<le> n - 1" and "j + 2 \<le> n - 2"
[PROOF STATE]
proof (prove)
using this:
j < card X - 3

goal (1 subgoal):
 1. j + 2 \<le> card X - 1 &&& j + 2 \<le> card X - 2
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
j + 2 \<le> card X - 1
j + 2 \<le> card X - 2

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
hence "n - j = Suc (n - Suc j)"
[PROOF STATE]
proof (prove)
using this:
j + 2 \<le> card X - 1
j + 2 \<le> card X - 2

goal (1 subgoal):
 1. card X - j = Suc (card X - Suc j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card X - j = Suc (card X - Suc j)

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
hence 1: "(- 1) ^ (n - Suc j) = - ((- (1::int)) ^ (n - j))"
[PROOF STATE]
proof (prove)
using this:
card X - j = Suc (card X - Suc j)

goal (1 subgoal):
 1. (- 1) ^ (card X - Suc j) = - ((- 1) ^ (card X - j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- 1) ^ (card X - Suc j) = - ((- 1) ^ (card X - j))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
j < card X - 3
[PROOF STEP]
have "j < n - 1"
[PROOF STATE]
proof (prove)
using this:
j < card X - 3

goal (1 subgoal):
 1. j < card X - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j < card X - 1

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
hence "int (cc (Suc j)) = 2 + 2 * (- 1)^(n - j) * ((int d - 1) gchoose (n - Suc j)) + ?S 2 1"
[PROOF STATE]
proof (prove)
using this:
j < card X - 1

goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) = 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))
[PROOF STEP]
by (rule cc_Suc)
[PROOF STATE]
proof (state)
this:
int (aa (Suc j) + bb (Suc j)) = 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (aa (Suc j) + bb (Suc j)) = 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> = 2 * (- 1)^(n - j) * ((int d - 1) gchoose (n - Suc j)) +
                    (- 1)^(n - Suc j) * ((int (aa (n - 1)) gchoose (n - Suc j)) + (int (bb (n - 1)) gchoose (n - Suc j))) +
                    (2 + ?S 2 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))))
[PROOF STEP]
using \<open>0 < n - 1\<close> \<open>j + 2 \<le> n - 1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < card X - 1
j + 2 \<le> card X - 1

goal (1 subgoal):
 1. 2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))))
[PROOF STEP]
by (simp only: sum_tail_nat) (simp flip: numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 + 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (\<Sum>i = j + 2..card X - 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> \<le> (int (cc (n - 1)) gchoose (n - Suc j)) + (2 + ?S 2 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))))
[PROOF STEP]
proof (rule add_right_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have rl: "x - y \<le> x" if "0 \<le> y" for x y :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - y \<le> x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 \<le> y

goal (1 subgoal):
 1. x - y \<le> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> ?y47 \<Longrightarrow> ?x47 - ?y47 \<le> ?x47

goal (1 subgoal):
 1. 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have "2 * (- 1)^(n - j) * ((int d - 1) gchoose (n - Suc j)) +
                    (- 1)^(n - Suc j) * ((int (aa (n - 1)) gchoose (n - Suc j)) + (int (bb (n - 1)) gchoose (n - Suc j))) =
              (-1)^(n - j) * (2 * ((int d - 1) gchoose (n - Suc j)) -
                    (int (aa (n - 1)) gchoose (n - Suc j)) - (int (bb (n - 1)) gchoose (n - Suc j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) = (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j)))
[PROOF STEP]
by (simp only: 1 algebra_simps)
[PROOF STATE]
proof (state)
this:
2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) = (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j)))

goal (1 subgoal):
 1. 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) = (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j)))

goal (1 subgoal):
 1. 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have "\<dots> \<le> (int (cc (n - 1))) gchoose (n - Suc j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
proof (cases "even (n - j)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
even (card X - j)

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
hence "(- 1) ^ (n - j) * (2 * (int d - 1 gchoose (n - Suc j)) - (int (aa (n - 1)) gchoose (n - Suc j)) -
                (int (bb (n - 1)) gchoose (n - Suc j))) =
              2 * (int d - 1 gchoose (n - Suc j)) - ((int (aa (n - 1)) gchoose (n - Suc j)) +
                                                     (int (bb (n - 1)) gchoose (n - Suc j)))"
[PROOF STATE]
proof (prove)
using this:
even (card X - j)

goal (1 subgoal):
 1. (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) = 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) = 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)))

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) = 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)))

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have "\<dots> \<le> 2 * (int d - 1 gchoose (n - Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j))
[PROOF STEP]
by (rule rl) (simp add: gbinomial_int_nonneg)
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j))

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j))

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have "\<dots> = (int d - 1 gchoose (n - Suc j)) + (int d - 1 gchoose (n - Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) = int (poly_deg f) - 1 gchoose (card X - Suc j) + (int (poly_deg f) - 1 gchoose (card X - Suc j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) = int (poly_deg f) - 1 gchoose (card X - Suc j) + (int (poly_deg f) - 1 gchoose (card X - Suc j))

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) = int (poly_deg f) - 1 gchoose (card X - Suc j) + (int (poly_deg f) - 1 gchoose (card X - Suc j))

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have "\<dots> \<le> (int d - 1) + (int d - 1) gchoose (n - Suc j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (poly_deg f) - 1 gchoose (card X - Suc j) + (int (poly_deg f) - 1 gchoose (card X - Suc j)) \<le> int (poly_deg f) - 1 + (int (poly_deg f) - 1) gchoose (card X - Suc j)
[PROOF STEP]
using \<open>0 < n - Suc j\<close> \<open>0 \<le> int d - 1\<close> \<open>0 \<le> int d - 1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < card X - Suc j
0 \<le> int (poly_deg f) - 1
0 \<le> int (poly_deg f) - 1

goal (1 subgoal):
 1. int (poly_deg f) - 1 gchoose (card X - Suc j) + (int (poly_deg f) - 1 gchoose (card X - Suc j)) \<le> int (poly_deg f) - 1 + (int (poly_deg f) - 1) gchoose (card X - Suc j)
[PROOF STEP]
by (rule gbinomial_int_plus_le)
[PROOF STATE]
proof (state)
this:
int (poly_deg f) - 1 gchoose (card X - Suc j) + (int (poly_deg f) - 1 gchoose (card X - Suc j)) \<le> int (poly_deg f) - 1 + (int (poly_deg f) - 1) gchoose (card X - Suc j)

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (poly_deg f) - 1 gchoose (card X - Suc j) + (int (poly_deg f) - 1 gchoose (card X - Suc j)) \<le> int (poly_deg f) - 1 + (int (poly_deg f) - 1) gchoose (card X - Suc j)

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have "\<dots> \<le> 2 * int d gchoose (n - Suc j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (poly_deg f) - 1 + (int (poly_deg f) - 1) gchoose (card X - Suc j) \<le> 2 * int (poly_deg f) gchoose (card X - Suc j)
[PROOF STEP]
proof (rule gbinomial_int_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> int (poly_deg f) - 1 + (int (poly_deg f) - 1)
 2. int (poly_deg f) - 1 + (int (poly_deg f) - 1) \<le> 2 * int (poly_deg f)
[PROOF STEP]
from \<open>0 \<le> int d - 1\<close>
[PROOF STATE]
proof (chain)
picking this:
0 \<le> int (poly_deg f) - 1
[PROOF STEP]
show "0 \<le> int d - 1 + (int d - 1)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> int (poly_deg f) - 1

goal (1 subgoal):
 1. 0 \<le> int (poly_deg f) - 1 + (int (poly_deg f) - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> int (poly_deg f) - 1 + (int (poly_deg f) - 1)

goal (1 subgoal):
 1. int (poly_deg f) - 1 + (int (poly_deg f) - 1) \<le> 2 * int (poly_deg f)
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
int (poly_deg f) - 1 + (int (poly_deg f) - 1) gchoose (card X - Suc j) \<le> 2 * int (poly_deg f) gchoose (card X - Suc j)

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (poly_deg f) - 1 + (int (poly_deg f) - 1) gchoose (card X - Suc j) \<le> 2 * int (poly_deg f) gchoose (card X - Suc j)

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have "\<dots> = int (cc (n - 1)) gchoose (n - Suc j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * int (poly_deg f) gchoose (card X - Suc j) = int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
by (simp only: cc_n_minus_1) simp
[PROOF STATE]
proof (state)
this:
2 * int (poly_deg f) gchoose (card X - Suc j) = int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal (2 subgoals):
 1. even (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
 2. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal (1 subgoal):
 1. (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal (1 subgoal):
 1. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
odd (card X - j)

goal (1 subgoal):
 1. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
hence "(- 1) ^ (n - j) * (2 * (int d - 1 gchoose (n - Suc j)) - (int (aa (n - 1)) gchoose (n - Suc j)) -
                (int (bb (n - 1)) gchoose (n - Suc j))) =
              ((int (aa (n - 1)) gchoose (n - Suc j)) + (int (bb (n - 1)) gchoose (n - Suc j))) -
                2 * (int d - 1 gchoose (n - Suc j))"
[PROOF STATE]
proof (prove)
using this:
odd (card X - j)

goal (1 subgoal):
 1. (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) = int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)) - 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) = int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)) - 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j))

goal (1 subgoal):
 1. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) = int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)) - 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j))

goal (1 subgoal):
 1. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
have "\<dots> \<le> (int (aa (n - 1)) gchoose (n - Suc j)) + (int (bb (n - 1)) gchoose (n - Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)) - 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) \<le> int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))
[PROOF STEP]
by (rule rl) (simp add: gbinomial_int_nonneg d_gr_0)
[PROOF STATE]
proof (state)
this:
int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)) - 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) \<le> int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))

goal (1 subgoal):
 1. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)) - 2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) \<le> int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))

goal (1 subgoal):
 1. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
from \<open>0 < n - Suc j\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < card X - Suc j
[PROOF STEP]
have "\<dots> \<le> int (cc (n - 1)) gchoose (n - Suc j)"
[PROOF STATE]
proof (prove)
using this:
0 < card X - Suc j

goal (1 subgoal):
 1. int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
by (rule ie1)
[PROOF STATE]
proof (state)
this:
int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j)) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal (1 subgoal):
 1. odd (card X - j) \<Longrightarrow> (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal (1 subgoal):
 1. (- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(- 1) ^ (card X - j) * (2 * (int (poly_deg f) - 1 gchoose (card X - Suc j)) - (int (aa (card X - 1)) gchoose (card X - Suc j)) - (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal (1 subgoal):
 1. 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
show "2 * (- 1)^(n - j) * ((int d - 1) gchoose (n - Suc j)) +
                    (- 1)^(n - Suc j) * ((int (aa (n - 1)) gchoose (n - Suc j)) + (int (bb (n - 1)) gchoose (n - Suc j))) \<le>
                    (int (cc (n - 1))) gchoose (n - Suc j)"
[PROOF STATE]
proof (prove)
using this:
2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal (1 subgoal):
 1. 2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (- 1) ^ (card X - j) * (int (poly_deg f) - 1 gchoose (card X - Suc j)) + (- 1) ^ (card X - Suc j) * (int (aa (card X - 1)) gchoose (card X - Suc j) + (int (bb (card X - 1)) gchoose (card X - Suc j))) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))) \<le> int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> = 2 + (int (cc (n - 1)) gchoose ((n - 1) - j)) + ((int (aa (j + 2)) gchoose 2) +
                    (int (bb (j + 2)) gchoose 2)) + ?S 3 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))) = 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))
[PROOF STEP]
using \<open>j + 2 \<le> n - 2\<close>
[PROOF STATE]
proof (prove)
using this:
j + 2 \<le> card X - 2

goal (1 subgoal):
 1. int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))) = 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))
[PROOF STEP]
by (simp add: sum.atLeast_Suc_atMost numeral_3_eq_3)
[PROOF STATE]
proof (state)
this:
int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))) = 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - Suc j) + (2 + (\<Sum>i = j + 2..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))) = 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> \<le> 2 + (int (cc (n - 1)) gchoose ((n - 1) - j)) + ((int (aa (j + 2)) gchoose 2) +
                    (int (bb (j + 2)) gchoose 2)) + ?S3 4 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
proof (rule add_left_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from \<open>j + 4 \<le> n - 1\<close>
[PROOF STATE]
proof (chain)
picking this:
j + 4 \<le> card X - 1
[PROOF STEP]
have "j + 3 \<le> n - 2"
[PROOF STATE]
proof (prove)
using this:
j + 4 \<le> card X - 1

goal (1 subgoal):
 1. j + 3 \<le> card X - 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j + 3 \<le> card X - 2

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
hence "?S 3 2 = ?S 4 2 - ?f (j + 3) j"
[PROOF STATE]
proof (prove)
using this:
j + 3 \<le> card X - 2

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) - (int (aa (j + 3)) gchoose (j + 3 - j) + (int (bb (j + 3)) gchoose (j + 3 - j)))
[PROOF STEP]
by (simp add: sum.atLeast_Suc_atMost add.commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) - (int (aa (j + 3)) gchoose (j + 3 - j) + (int (bb (j + 3)) gchoose (j + 3 - j)))

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
hence "?S 3 2 \<le> ?S 4 2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) - (int (aa (j + 3)) gchoose (j + 3 - j) + (int (bb (j + 3)) gchoose (j + 3 - j)))

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))
[PROOF STEP]
using f_nonneg[of "j + 3"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) = (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) - (int (aa (j + 3)) gchoose (j + 3 - j) + (int (bb (j + 3)) gchoose (j + 3 - j)))
0 \<le> int (aa (j + 3)) gchoose (j + 3 - j) + (int (bb (j + 3)) gchoose (j + 3 - j))

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))))

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> \<le> ?S3 4 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
proof (rule sum_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {j + 4..card X - 2} \<Longrightarrow> (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {j + 4..card X - 2} \<Longrightarrow> (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
assume "i \<in> {j + 4..n - 2}"
[PROOF STATE]
proof (state)
this:
i \<in> {j + 4..card X - 2}

goal (1 subgoal):
 1. \<And>i. i \<in> {j + 4..card X - 2} \<Longrightarrow> (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
hence "0 < i - j"
[PROOF STATE]
proof (prove)
using this:
i \<in> {j + 4..card X - 2}

goal (1 subgoal):
 1. 0 < i - j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < i - j

goal (1 subgoal):
 1. \<And>i. i \<in> {j + 4..card X - 2} \<Longrightarrow> (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
from f_nonneg[of i]
[PROOF STATE]
proof (chain)
picking this:
0 \<le> int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))
[PROOF STEP]
have "(- 1)^(i - j) * ?f i j \<le> ?f i j"
[PROOF STATE]
proof (prove)
using this:
0 \<le> int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))

goal (1 subgoal):
 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))
[PROOF STEP]
by (smt minus_one_mult_self mult_cancel_right1 pos_zmult_eq_1_iff_lemma zero_less_mult_iff)
[PROOF STATE]
proof (state)
this:
(- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))

goal (1 subgoal):
 1. \<And>i. i \<in> {j + 4..card X - 2} \<Longrightarrow> (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))

goal (1 subgoal):
 1. \<And>i. i \<in> {j + 4..card X - 2} \<Longrightarrow> (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
from \<open>0 < i - j\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < i - j
[PROOF STEP]
have "\<dots> \<le> int (cc i) gchoose (i - j)"
[PROOF STATE]
proof (prove)
using this:
0 < i - j

goal (1 subgoal):
 1. int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
by (rule ie1)
[PROOF STATE]
proof (state)
this:
int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)) \<le> int (aa i + bb i) gchoose (i - j)

goal (1 subgoal):
 1. \<And>i. i \<in> {j + 4..card X - 2} \<Longrightarrow> (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
show "(- 1)^(i - j) * ?f i j \<le> int (cc i) gchoose (i - j)"
[PROOF STATE]
proof (prove)
using this:
(- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)

goal (1 subgoal):
 1. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j))) \<le> int (aa i + bb i) gchoose (i - j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i = j + 4..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
show "?S 3 2 \<le> ?S3 4 2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))

goal (1 subgoal):
 1. (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 3..card X - 2. (- 1) ^ (i - j) * (int (aa i) gchoose (i - j) + (int (bb i) gchoose (i - j)))) \<le> 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> = ((int (aa (j + 2)) gchoose 2) + (int (bb (j + 2)) gchoose 2)) + (2 + ?S3 4 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j)) = int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2) + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j)))
[PROOF STEP]
using \<open>0 < n - 1\<close> \<open>j + 4 \<le> n - 1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < card X - 1
j + 4 \<le> card X - 1

goal (1 subgoal):
 1. 2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j)) = int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2) + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j)))
[PROOF STEP]
by (simp only: sum_tail_nat) (simp flip: numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j)) = int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2) + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j)))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 + (int (aa (card X - 1) + bb (card X - 1)) gchoose (card X - 1 - j)) + (int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2)) + (\<Sum>i = j + 4..card X - 2. int (aa i + bb i) gchoose (i - j)) = int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2) + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j)))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
from ie1
[PROOF STATE]
proof (chain)
picking this:
0 < ?k47 \<Longrightarrow> int (aa ?i47) gchoose ?k47 + (int (bb ?i47) gchoose ?k47) \<le> int (aa ?i47 + bb ?i47) gchoose ?k47
[PROOF STEP]
have "\<dots> \<le> int (cc (j + 2)) gchoose 2 + (2 + ?S3 4 1)"
[PROOF STATE]
proof (prove)
using this:
0 < ?k47 \<Longrightarrow> int (aa ?i47) gchoose ?k47 + (int (bb ?i47) gchoose ?k47) \<le> int (aa ?i47 + bb ?i47) gchoose ?k47

goal (1 subgoal):
 1. int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2) + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))) \<le> int (aa (j + 2) + bb (j + 2)) gchoose 2 + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j)))
[PROOF STEP]
by (rule add_right_mono) simp
[PROOF STATE]
proof (state)
this:
int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2) + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))) \<le> int (aa (j + 2) + bb (j + 2)) gchoose 2 + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j)))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (aa (j + 2)) gchoose 2 + (int (bb (j + 2)) gchoose 2) + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))) \<le> int (aa (j + 2) + bb (j + 2)) gchoose 2 + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j)))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
have "\<dots> = 2 + (int (cc (j + 2)) gchoose 2) + ?S3 4 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (aa (j + 2) + bb (j + 2)) gchoose 2 + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))) = 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
by (simp only: ac_simps)
[PROOF STATE]
proof (state)
this:
int (aa (j + 2) + bb (j + 2)) gchoose 2 + (2 + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))) = 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))

goal (1 subgoal):
 1. card X \<noteq> j + 4 \<Longrightarrow> int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))

goal (1 subgoal):
 1. int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
int (aa (Suc j) + bb (Suc j)) \<le> 2 + (int (aa (j + 2) + bb (j + 2)) gchoose 2) + (\<Sum>i = j + 4..card X - 1. int (aa i + bb i) gchoose (i - j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma div_diff_self2: "(n - m) div m = n div m - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n - m) div m = n div m - Suc 0
[PROOF STEP]
apply (case_tac "m = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> (n - m) div m = n div m - Suc 0
[PROOF STEP]
apply (case_tac "n < m", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<noteq> 0; \<not> n < m\<rbrakk> \<Longrightarrow> (n - m) div m = n div m - Suc 0
[PROOF STEP]
apply (case_tac "n = m", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<noteq> 0; \<not> n < m; n \<noteq> m\<rbrakk> \<Longrightarrow> (n - m) div m = n div m - Suc 0
[PROOF STEP]
apply (simp add: div_if)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lhd_llist_of_stream [simp]: "lhd (llist_of_stream xs) = shd xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lhd (llist_of_stream xs) = shd xs
[PROOF STEP]
by(simp add: llist_of_stream_def)


[STATEMENT]
lemma Uvariation_trans [trans]: "Uvariation \<omega> \<nu> U \<Longrightarrow> Uvariation \<nu> \<mu> V \<Longrightarrow> Uvariation \<omega> \<mu> (U\<union>V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Uvariation \<omega> \<nu> U; Uvariation \<nu> \<mu> V\<rbrakk> \<Longrightarrow> Uvariation \<omega> \<mu> (U \<union> V)
[PROOF STEP]
unfolding Uvariation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i. i \<notin> U \<longrightarrow> \<omega> i = \<nu> i; \<forall>i. i \<notin> V \<longrightarrow> \<nu> i = \<mu> i\<rbrakk> \<Longrightarrow> \<forall>i. i \<notin> U \<union> V \<longrightarrow> \<omega> i = \<mu> i
[PROOF STEP]
by simp


[STATEMENT]
lemma ccw'_sortedP_polychain_of2:
  assumes "ccw'.sortedP 0 [u, v]"
  shows "ccw'.sortedP x0 (map snd (polychain_of x0 [u, v]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccw'.sortedP x0 (map snd (polychain_of x0 [u, v]))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ccw'.sortedP 0 [u, v]

goal (1 subgoal):
 1. ccw'.sortedP x0 (map snd (polychain_of x0 [u, v]))
[PROOF STEP]
by (auto intro!: linorder_list0.sortedP.Nil linorder_list0.sortedP.Cons
    elim!: linorder_list0.sortedP_Cons simp: ac_simps ccw'.translate_origin)


[STATEMENT]
lemma snd_o_Pair: "(snd o (Pair x)) = (% x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd \<circ> Pair x = (\<lambda>x. x)
[PROOF STEP]
apply(rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. (snd \<circ> Pair x) xa = xa
[PROOF STEP]
by simp


[STATEMENT]
theorem wls_psubstEnv_substEnv_compose_freshEnv:
assumes "wlsEnv rho" and "wlsEnv rho'" and "wls (asSort ys) Y"
assumes "freshEnv ys y rho'"
shows "((rho &[Y / y]_ys) &[rho']) = ((rho &[rho']) &[(Y #[rho']) / y]_ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[Y / y]_ys &[rho'] = rho &[rho'] &[Y #[rho'] / y]_ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho
wlsEnv rho'
wls (asSort ys) Y
freshEnv ys y rho'

goal (1 subgoal):
 1. rho &[Y / y]_ys &[rho'] = rho &[rho'] &[Y #[rho'] / y]_ys
[PROOF STEP]
by (simp add: psubstEnv_substEnv_compose_freshEnv)


[STATEMENT]
lemma bounded_clinear_divide: "bounded_clinear (\<lambda>x. x / y)"
  for y :: "'a::complex_normed_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_clinear (\<lambda>x. x / y)
[PROOF STEP]
unfolding divide_inverse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_clinear (\<lambda>x. x * inverse y)
[PROOF STEP]
by (rule bounded_clinear_mult_left)


[STATEMENT]
lemma monotone_ldropn_aux: "monotone lprefix (fun_ord lprefix) (\<lambda>xs n. ldropn n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (\<sqsubseteq>) llist.le_fun (\<lambda>xs n. ldropn n xs)
[PROOF STEP]
by(rule llist_lift.fixp_preserves_mono1[OF ldrop_mono ldrop_conv_fixp])
  (simp add: ldropn_fixp_case_conv monotone_fun_ord_apply)


[STATEMENT]
lemma insertion_zero : "insertion f (Const 0 ::real mpoly) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f (Const 0) = 0
[PROOF STEP]
by (metis add_cancel_right_right add_zero insertion_zero)


[STATEMENT]
lemma lead_monom_Const [simp]: "lead_monom (Const c) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_monom (Const c) = 0
[PROOF STEP]
by (simp add: lead_monom_def Const.rep_eq Const\<^sub>0_def)


[STATEMENT]
lemma field_class: "field (cring_class_ops::'a::field ring)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. field cring_class_ops
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<one>\<^bsub>cring_class_ops\<^esub> \<noteq> \<zero>\<^bsub>cring_class_ops\<^esub>
 2. \<And>a b. \<lbrakk>a \<otimes>\<^bsub>cring_class_ops\<^esub> b = \<zero>\<^bsub>cring_class_ops\<^esub>; a \<in> carrier cring_class_ops; b \<in> carrier cring_class_ops\<rbrakk> \<Longrightarrow> a = \<zero>\<^bsub>cring_class_ops\<^esub> \<or> b = \<zero>\<^bsub>cring_class_ops\<^esub>
 3. Units cring_class_ops = carrier cring_class_ops - {\<zero>\<^bsub>cring_class_ops\<^esub>}
[PROOF STEP]
apply (simp_all add: cring_class_ops_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Units \<lparr>carrier = UNIV, mult = (*), one = 1::'a, zero = 0::'a, add = (+)\<rparr> = UNIV - {0::'a}
[PROOF STEP]
apply (auto simp add: Units_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<noteq> (0::'a) \<Longrightarrow> \<exists>xa. xa * x = (1::'a) \<and> x * xa = (1::'a)
[PROOF STEP]
apply (rule_tac x="1 / x" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<noteq> (0::'a) \<Longrightarrow> (1::'a) / x * x = (1::'a) \<and> x * ((1::'a) / x) = (1::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma abs_conv_abscissa_perzeta: "abs_conv_abscissa (fds_perzeta q) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_conv_abscissa (fds_perzeta q) \<le> 1
[PROOF STEP]
proof (rule abs_conv_abscissa_leI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c'. 1 < ereal c' \<Longrightarrow> \<exists>s. s \<bullet> 1 = c' \<and> fds_abs_converges (fds_perzeta q) s
[PROOF STEP]
fix c
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c'. 1 < ereal c' \<Longrightarrow> \<exists>s. s \<bullet> 1 = c' \<and> fds_abs_converges (fds_perzeta q) s
[PROOF STEP]
assume c: "ereal c > 1"
[PROOF STATE]
proof (state)
this:
1 < ereal c

goal (1 subgoal):
 1. \<And>c'. 1 < ereal c' \<Longrightarrow> \<exists>s. s \<bullet> 1 = c' \<and> fds_abs_converges (fds_perzeta q) s
[PROOF STEP]
hence "summable (\<lambda>n. n powr -c)"
[PROOF STATE]
proof (prove)
using this:
1 < ereal c

goal (1 subgoal):
 1. summable (\<lambda>x. real x powr - c)
[PROOF STEP]
by (simp add: summable_real_powr_iff)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>x. real x powr - c)

goal (1 subgoal):
 1. \<And>c'. 1 < ereal c' \<Longrightarrow> \<exists>s. s \<bullet> 1 = c' \<and> fds_abs_converges (fds_perzeta q) s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
summable (\<lambda>x. real x powr - c)

goal (1 subgoal):
 1. \<And>c'. 1 < ereal c' \<Longrightarrow> \<exists>s. s \<bullet> 1 = c' \<and> fds_abs_converges (fds_perzeta q) s
[PROOF STEP]
have "?this \<longleftrightarrow> fds_abs_converges (fds_perzeta q) (of_real c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>x. real x powr - c) = fds_abs_converges (fds_perzeta q) (complex_of_real c)
[PROOF STEP]
unfolding fds_abs_converges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>x. real x powr - c) = summable (\<lambda>n. cmod (fds_nth (fds_perzeta q) n / nat_power n (complex_of_real c)))
[PROOF STEP]
by (intro summable_cong eventually_mono[OF eventually_gt_at_top[of 0]])
       (auto simp: norm_divide norm_powr_real_powr fds_perzeta_def powr_minus field_simps)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>x. real x powr - c) = fds_abs_converges (fds_perzeta q) (complex_of_real c)

goal (1 subgoal):
 1. \<And>c'. 1 < ereal c' \<Longrightarrow> \<exists>s. s \<bullet> 1 = c' \<and> fds_abs_converges (fds_perzeta q) s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fds_abs_converges (fds_perzeta q) (complex_of_real c)
[PROOF STEP]
show "\<exists>s. s \<bullet> 1 = c \<and> fds_abs_converges (fds_perzeta q) s"
[PROOF STATE]
proof (prove)
using this:
fds_abs_converges (fds_perzeta q) (complex_of_real c)

goal (1 subgoal):
 1. \<exists>s. s \<bullet> 1 = c \<and> fds_abs_converges (fds_perzeta q) s
[PROOF STEP]
by (intro exI[of _ "of_real c"]) auto
[PROOF STATE]
proof (state)
this:
\<exists>s. s \<bullet> 1 = c \<and> fds_abs_converges (fds_perzeta q) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma natfun_bigo_1E:
  assumes "(f :: nat \<Rightarrow> _) \<in> O(\<lambda>_. 1)"
  obtains C where "C \<ge> lb" "\<And>n. norm (f n) \<le> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C. \<lbrakk>lb \<le> C; \<And>n. norm (f n) \<le> C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>C. \<lbrakk>lb \<le> C; \<And>n. norm (f n) \<le> C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f \<in> O(\<lambda>_. 1::'a)
[PROOF STEP]
obtain C N where "\<forall>n\<ge>N. norm (f n) \<le> C"
[PROOF STATE]
proof (prove)
using this:
f \<in> O(\<lambda>_. 1::'a)

goal (1 subgoal):
 1. (\<And>N C. \<forall>n\<ge>N. norm (f n) \<le> C \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim!: landau_o.bigE simp: eventually_at_top_linorder)
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>N. norm (f n) \<le> C

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>lb \<le> C; \<And>n. norm (f n) \<le> C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
hence *: "norm (f n) \<le> Max ({C, lb} \<union> (norm ` f ` {..<N}))" for n
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>N. norm (f n) \<le> C

goal (1 subgoal):
 1. norm (f n) \<le> Max ({C, lb} \<union> norm ` f ` {..<N})
[PROOF STEP]
by (cases "n \<ge> N") (subst Max_ge_iff; force simp: image_iff)+
[PROOF STATE]
proof (state)
this:
norm (f ?n) \<le> Max ({C, lb} \<union> norm ` f ` {..<N})

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>lb \<le> C; \<And>n. norm (f n) \<le> C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
norm (f ?n) \<le> Max ({C, lb} \<union> norm ` f ` {..<N})

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>lb \<le> C; \<And>n. norm (f n) \<le> C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "Max ({C, lb} \<union> (norm ` f ` {..<N})) \<ge> lb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lb \<le> Max ({C, lb} \<union> norm ` f ` {..<N})
[PROOF STEP]
by (intro Max.coboundedI) auto
[PROOF STATE]
proof (state)
this:
lb \<le> Max ({C, lb} \<union> norm ` f ` {..<N})

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>lb \<le> C; \<And>n. norm (f n) \<le> C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
norm (f ?n) \<le> Max ({C, lb} \<union> norm ` f ` {..<N})
lb \<le> Max ({C, lb} \<union> norm ` f ` {..<N})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (f ?n) \<le> Max ({C, lb} \<union> norm ` f ` {..<N})
lb \<le> Max ({C, lb} \<union> norm ` f ` {..<N})

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
norm (f ?n) \<le> Max ({C, lb} \<union> norm ` f ` {..<N})
lb \<le> Max ({C, lb} \<union> norm ` f ` {..<N})
\<lbrakk>lb \<le> ?C; \<And>n. norm (f n) \<le> ?C\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed