[STATEMENT]
lemma vec_of_poly_rev_shifted_scalar_prod:
  fixes p v
  defines "q \<equiv> poly_of_vec v"
  assumes m[simp]: "degree p = m" and n: "dim_vec v = n"
  assumes j: "j < m+n"
  shows "vec_of_poly_rev_shifted p n (n+m-Suc j) \<bullet> v = coeff (p * q) j" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j
[PROOF STEP]
have id1: "\<And> i. m + i - (n + m - Suc j) = i + Suc j - n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. m + i - (n + m - Suc j) = i + Suc j - n
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < m + n

goal (1 subgoal):
 1. \<And>i. m + i - (n + m - Suc j) = i + Suc j - n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m + ?i - (n + m - Suc j) = ?i + Suc j - n

goal (1 subgoal):
 1. vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j
[PROOF STEP]
let ?g = "\<lambda> i. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) *  v $ i else 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j
[PROOF STEP]
have "?thesis = ((\<Sum>i = 0..<n. ?g i) =
        (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else 0)))" (is "_ = (?l = ?r)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j) = ((\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))))
[PROOF STEP]
unfolding vec_of_poly_rev_shifted_def coeff_mult m scalar_prod_def n q_def
      coeff_poly_of_vec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i = 0..<n. vec n (\<lambda>i. if i \<le> n + m - Suc j \<and> n + m - Suc j \<le> m + i then coeff p (m + i - (n + m - Suc j)) else (0::'a)) $ i * v $ i) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))) = ((\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))))
[PROOF STEP]
by (subst sum.cong, insert id1, auto)
[PROOF STATE]
proof (state)
this:
(vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j) = ((\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))))

goal (1 subgoal):
 1. vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j) = ((\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))))

goal (1 subgoal):
 1. vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j
[PROOF STEP]
have "..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "?r = (\<Sum>i\<le>j. (if j - i < n then coeff p i * v $ (n - Suc (j - i)) else 0))" (is "_ = sum ?f _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<le>j. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<le>j. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<le>j. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "sum ?f {..j} = sum ?f ({i. i \<le> j \<and> j - i < n} \<union> {i. i \<le> j \<and> \<not> j - i < n})"
      (is "_ = sum _ (?R1 \<union> ?R2)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>j. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<union> {i. i \<le> j \<and> \<not> j - i < n}. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>j. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<union> {i. i \<le> j \<and> \<not> j - i < n}. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>j. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<union> {i. i \<le> j \<and> \<not> j - i < n}. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "\<dots> = sum ?f ?R1 + sum ?f ?R2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<union> {i. i \<le> j \<and> \<not> j - i < n}. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (\<Sum>i | i \<le> j \<and> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) + (\<Sum>i | i \<le> j \<and> \<not> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))
[PROOF STEP]
by (subst sum.union_disjoint, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<union> {i. i \<le> j \<and> \<not> j - i < n}. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (\<Sum>i | i \<le> j \<and> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) + (\<Sum>i | i \<le> j \<and> \<not> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<union> {i. i \<le> j \<and> \<not> j - i < n}. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (\<Sum>i | i \<le> j \<and> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) + (\<Sum>i | i \<le> j \<and> \<not> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "sum ?f ?R2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i \<le> j \<and> \<not> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<le> j \<and> \<not> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<le> j \<and> \<not> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "sum ?f ?R1 + 0 = sum (\<lambda> i. coeff p i * v $ (i + n - Suc j)) ?R1"
      (is "_ = sum ?F _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i \<le> j \<and> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) + (0::'a) = (\<Sum>i | i \<le> j \<and> j - i < n. coeff p i * v $ (i + n - Suc j))
[PROOF STEP]
by (subst sum.cong, auto simp: ac_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<le> j \<and> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) + (0::'a) = (\<Sum>i | i \<le> j \<and> j - i < n. coeff p i * v $ (i + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<le> j \<and> j - i < n. if j - i < n then coeff p i * v $ (n - Suc (j - i)) else (0::'a)) + (0::'a) = (\<Sum>i | i \<le> j \<and> j - i < n. coeff p i * v $ (i + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "\<dots> = sum ?F ((?R1 \<inter> {..m}) \<union> (?R1 - {..m}))"
      (is "_ = sum _ (?R \<union> ?R')")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i \<le> j \<and> j - i < n. coeff p i * v $ (i + n - Suc j)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m} \<union> ({i. i \<le> j \<and> j - i < n} - {..m}). coeff p i * v $ (i + n - Suc j))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<le> j \<and> j - i < n. coeff p i * v $ (i + n - Suc j)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m} \<union> ({i. i \<le> j \<and> j - i < n} - {..m}). coeff p i * v $ (i + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<le> j \<and> j - i < n. coeff p i * v $ (i + n - Suc j)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m} \<union> ({i. i \<le> j \<and> j - i < n} - {..m}). coeff p i * v $ (i + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "\<dots> = sum ?F ?R + sum ?F ?R'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m} \<union> ({i. i \<le> j \<and> j - i < n} - {..m}). coeff p i * v $ (i + n - Suc j)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m}. coeff p i * v $ (i + n - Suc j)) + (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j))
[PROOF STEP]
by (subst sum.union_disjoint, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m} \<union> ({i. i \<le> j \<and> j - i < n} - {..m}). coeff p i * v $ (i + n - Suc j)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m}. coeff p i * v $ (i + n - Suc j)) + (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m} \<union> ({i. i \<le> j \<and> j - i < n} - {..m}). coeff p i * v $ (i + n - Suc j)) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m}. coeff p i * v $ (i + n - Suc j)) + (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "sum ?F ?R' = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)
[PROOF STEP]
assume "x > m"
[PROOF STATE]
proof (state)
this:
m < x

goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)
[PROOF STEP]
from coeff_eq_0[OF this[folded m]]
[PROOF STATE]
proof (chain)
picking this:
coeff p x = (0::'a)
[PROOF STEP]
have "?F x = 0"
[PROOF STATE]
proof (prove)
using this:
coeff p x = (0::'a)

goal (1 subgoal):
 1. coeff p x * v $ (x + n - Suc j) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff p x * v $ (x + n - Suc j) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
m < ?x2 \<Longrightarrow> coeff p ?x2 * v $ (?x2 + n - Suc j) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m < ?x2 \<Longrightarrow> coeff p ?x2 * v $ (?x2 + n - Suc j) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)
[PROOF STEP]
by (subst sum.neutral, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} - {..m}. coeff p i * v $ (i + n - Suc j)) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m}. coeff p i * v $ (i + n - Suc j)) + (0::'a)
[PROOF STEP]
have r: "?r = sum ?F ?R"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m}. coeff p i * v $ (i + n - Suc j)) + (0::'a)

goal (1 subgoal):
 1. (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m}. coeff p i * v $ (i + n - Suc j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m}. coeff p i * v $ (i + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "?l = sum ?g ({i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i}
      \<union> {i. i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i)})"
      (is "_ = sum _ (?L1 \<union> ?L2)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<union> {i. i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i)}. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<union> {i. i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i)}. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<union> {i. i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i)}. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "\<dots> = sum ?g ?L1 + sum ?g ?L2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<union> {i. i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i)}. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) + (\<Sum>i | i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i). if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a))
[PROOF STEP]
by (subst sum.union_disjoint, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<union> {i. i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i)}. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) + (\<Sum>i | i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i). if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<union> {i. i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i)}. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) + (\<Sum>i | i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i). if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "sum ?g ?L2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i). if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i). if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i < n \<and> \<not> (i \<le> n + m - Suc j \<and> n - Suc j \<le> i). if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "sum ?g ?L1 + 0 = sum (\<lambda> i. coeff p (i + Suc j - n) * v $ i) ?L1"
      (is "_ = sum ?G _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) + (0::'a) = (\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. coeff p (i + Suc j - n) * v $ i)
[PROOF STEP]
by (subst sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) + (0::'a) = (\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. coeff p (i + Suc j - n) * v $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) + (0::'a) = (\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. coeff p (i + Suc j - n) * v $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "\<dots> = sum ?G (?L1 \<inter> {i. i + Suc j - n \<le> m} \<union> (?L1 - {i. i + Suc j - n \<le> m}))"
      (is "_ = sum _ (?L \<union> ?L')")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. coeff p (i + Suc j - n) * v $ i) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m} \<union> ({i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}). coeff p (i + Suc j - n) * v $ i)
[PROOF STEP]
by (subst sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. coeff p (i + Suc j - n) * v $ i) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m} \<union> ({i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}). coeff p (i + Suc j - n) * v $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i. coeff p (i + Suc j - n) * v $ i) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m} \<union> ({i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}). coeff p (i + Suc j - n) * v $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "\<dots> = sum ?G ?L + sum ?G ?L'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m} \<union> ({i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}). coeff p (i + Suc j - n) * v $ i) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) + (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i)
[PROOF STEP]
by (subst sum.union_disjoint, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m} \<union> ({i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}). coeff p (i + Suc j - n) * v $ i) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) + (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m} \<union> ({i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}). coeff p (i + Suc j - n) * v $ i) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) + (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "sum ?G ?L' = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)
[PROOF STEP]
assume "x + Suc j - n > m"
[PROOF STATE]
proof (state)
this:
m < x + Suc j - n

goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)
[PROOF STEP]
from coeff_eq_0[OF this[folded m]]
[PROOF STATE]
proof (chain)
picking this:
coeff p (x + Suc j - n) = (0::'a)
[PROOF STEP]
have "?G x = 0"
[PROOF STATE]
proof (prove)
using this:
coeff p (x + Suc j - n) = (0::'a)

goal (1 subgoal):
 1. coeff p (x + Suc j - n) * v $ x = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff p (x + Suc j - n) * v $ x = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
m < ?x2 + Suc j - n \<Longrightarrow> coeff p (?x2 + Suc j - n) * v $ ?x2 = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m < ?x2 + Suc j - n \<Longrightarrow> coeff p (?x2 + Suc j - n) * v $ ?x2 = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)
[PROOF STEP]
by (subst sum.neutral, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} - {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) + (0::'a)
[PROOF STEP]
have l: "?l = sum ?G ?L"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) + (0::'a)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
let ?bij = "\<lambda> i. i + n - Suc j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
assume x: "j < m + n" "Suc (x + j) - n \<le> m" "x < n" "n - Suc j \<le> x"
[PROOF STATE]
proof (state)
this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
define y where "y = x + Suc j - n"
[PROOF STATE]
proof (state)
this:
y = x + Suc j - n

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x
[PROOF STEP]
have "x + Suc j \<ge> n"
[PROOF STATE]
proof (prove)
using this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x

goal (1 subgoal):
 1. n \<le> x + Suc j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n \<le> x + Suc j

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x
n \<le> x + Suc j
[PROOF STEP]
have xy: "x = ?bij y"
[PROOF STATE]
proof (prove)
using this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x
n \<le> x + Suc j

goal (1 subgoal):
 1. x = y + n - Suc j
[PROOF STEP]
unfolding y_def
[PROOF STATE]
proof (prove)
using this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x
n \<le> x + Suc j

goal (1 subgoal):
 1. x = x + Suc j - n + n - Suc j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = y + n - Suc j

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x
[PROOF STEP]
have y: "y \<in> ?R"
[PROOF STATE]
proof (prove)
using this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x

goal (1 subgoal):
 1. y \<in> {i. i \<le> j \<and> j - i < n} \<inter> {..m}
[PROOF STEP]
unfolding y_def
[PROOF STATE]
proof (prove)
using this:
j < m + n
Suc (x + j) - n \<le> m
x < n
n - Suc j \<le> x

goal (1 subgoal):
 1. x + Suc j - n \<in> {i. i \<le> j \<and> j - i < n} \<inter> {..m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> {i. i \<le> j \<and> j - i < n} \<inter> {..m}

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
have "x \<in> ?bij ` ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> (\<lambda>i. i + n - Suc j) ` ({i. i \<le> j \<and> j - i < n} \<inter> {..m})
[PROOF STEP]
unfolding xy
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y + n - Suc j \<in> (\<lambda>i. i + n - Suc j) ` ({i. i \<le> j \<and> j - i < n} \<inter> {..m})
[PROOF STEP]
using y
[PROOF STATE]
proof (prove)
using this:
y \<in> {i. i \<le> j \<and> j - i < n} \<inter> {..m}

goal (1 subgoal):
 1. y + n - Suc j \<in> (\<lambda>i. i + n - Suc j) ` ({i. i \<le> j \<and> j - i < n} \<inter> {..m})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> (\<lambda>i. i + n - Suc j) ` ({i. i \<le> j \<and> j - i < n} \<inter> {..m})

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>j < m + n; Suc (?x2 + j) - n \<le> m; ?x2 < n; n - Suc j \<le> ?x2\<rbrakk> \<Longrightarrow> ?x2 \<in> (\<lambda>i. i + n - Suc j) ` ({i. i \<le> j \<and> j - i < n} \<inter> {..m})

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
note tedious = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>j < m + n; Suc (?x2 + j) - n \<le> m; ?x2 < n; n - Suc j \<le> ?x2\<rbrakk> \<Longrightarrow> ?x2 \<in> (\<lambda>i. i + n - Suc j) ` ({i. i \<le> j \<and> j - i < n} \<inter> {..m})

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))
[PROOF STEP]
unfolding l r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{i. i < n \<and> i \<le> n + m - Suc j \<and> n - Suc j \<le> i} \<inter> {i. i + Suc j - n \<le> m}. coeff p (i + Suc j - n) * v $ i) = (\<Sum>i\<in>{i. i \<le> j \<and> j - i < n} \<inter> {..m}. coeff p i * v $ (i + n - Suc j))
[PROOF STEP]
by (rule sum.reindex_cong[of ?bij], insert j, auto simp: inj_on_def tedious)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. if i \<le> n + m - Suc j \<and> n - Suc j \<le> i then coeff p (i + Suc j - n) * v $ i else (0::'a)) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a)))

goal (1 subgoal):
 1. vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j) = ((\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j) = ((\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))) = (\<Sum>i\<le>j. coeff p i * (if j - i < n then v $ (n - Suc (j - i)) else (0::'a))))

goal (1 subgoal):
 1. vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec_of_poly_rev_shifted p n (n + m - Suc j) \<bullet> v = coeff (p * q) j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powa_power_eq:
  assumes "a \<ge> 1" shows "a powa (of_nat n) = a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
have "incseq (\<lambda>m. rat_of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>m. rat_of_nat n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>m. rat_of_nat n)

goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>m. rat_of_nat n)

goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
have "(\<lambda>na. real_of_rat (rat_of_nat n)) \<longlonglongrightarrow> real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>na. real_of_rat (rat_of_nat n)) \<longlonglongrightarrow> real n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>na. real_of_rat (rat_of_nat n)) \<longlonglongrightarrow> real n

goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>na. real_of_rat (rat_of_nat n)) \<longlonglongrightarrow> real n

goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
have "(\<lambda>na. a pow\<^sub>\<rat> rat_of_nat n) \<longlonglongrightarrow> a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>na. a pow\<^sub>\<rat> rat_of_nat n) \<longlonglongrightarrow> a ^ n
[PROOF STEP]
using powrat_power_eq assms
[PROOF STATE]
proof (prove)
using this:
0 < ?a \<Longrightarrow> ?a pow\<^sub>\<rat> rat_of_nat ?n = ?a ^ ?n
1 \<le> a

goal (1 subgoal):
 1. (\<lambda>na. a pow\<^sub>\<rat> rat_of_nat n) \<longlonglongrightarrow> a ^ n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>na. a pow\<^sub>\<rat> rat_of_nat n) \<longlonglongrightarrow> a ^ n

goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
incseq (\<lambda>m. rat_of_nat n)
(\<lambda>na. real_of_rat (rat_of_nat n)) \<longlonglongrightarrow> real n
(\<lambda>na. a pow\<^sub>\<rat> rat_of_nat n) \<longlonglongrightarrow> a ^ n
[PROOF STEP]
have "(\<lambda>na. a pow\<^sub>\<rat> incseq_of (real n) na) \<longlonglongrightarrow> a ^ n"
[PROOF STATE]
proof (prove)
using this:
incseq (\<lambda>m. rat_of_nat n)
(\<lambda>na. real_of_rat (rat_of_nat n)) \<longlonglongrightarrow> real n
(\<lambda>na. a pow\<^sub>\<rat> rat_of_nat n) \<longlonglongrightarrow> a ^ n

goal (1 subgoal):
 1. (\<lambda>na. a pow\<^sub>\<rat> incseq_of (real n) na) \<longlonglongrightarrow> a ^ n
[PROOF STEP]
using powa_indep_incseq_of' assms
[PROOF STATE]
proof (prove)
using this:
incseq (\<lambda>m. rat_of_nat n)
(\<lambda>na. real_of_rat (rat_of_nat n)) \<longlonglongrightarrow> real n
(\<lambda>na. a pow\<^sub>\<rat> rat_of_nat n) \<longlonglongrightarrow> a ^ n
\<lbrakk>1 \<le> ?a; incseq ?r; (\<lambda>n. real_of_rat (?r n)) \<longlonglongrightarrow> ?x; (\<lambda>n. ?a pow\<^sub>\<rat> ?r n) \<longlonglongrightarrow> ?y\<rbrakk> \<Longrightarrow> (\<lambda>n. ?a pow\<^sub>\<rat> incseq_of ?x n) \<longlonglongrightarrow> ?y
1 \<le> a

goal (1 subgoal):
 1. (\<lambda>na. a pow\<^sub>\<rat> incseq_of (real n) na) \<longlonglongrightarrow> a ^ n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>na. a pow\<^sub>\<rat> incseq_of (real n) na) \<longlonglongrightarrow> a ^ n

goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>na. a pow\<^sub>\<rat> incseq_of (real n) na) \<longlonglongrightarrow> a ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>na. a pow\<^sub>\<rat> incseq_of (real n) na) \<longlonglongrightarrow> a ^ n

goal (1 subgoal):
 1. a powa real n = a ^ n
[PROOF STEP]
by (metis Lim_def limI powa_def)
[PROOF STATE]
proof (state)
this:
a powa real n = a ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dvd_smult:
  assumes "p dvd q"
  shows "p dvd smult a q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd smult a q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p dvd smult a q
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p dvd q
[PROOF STEP]
obtain k where "q = p * k"
[PROOF STATE]
proof (prove)
using this:
p dvd q

goal (1 subgoal):
 1. (\<And>k. q = p * k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
q = p * k

goal (1 subgoal):
 1. p dvd smult a q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q = p * k
[PROOF STEP]
have "smult a q = p * smult a k"
[PROOF STATE]
proof (prove)
using this:
q = p * k

goal (1 subgoal):
 1. smult a q = p * smult a k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
smult a q = p * smult a k

goal (1 subgoal):
 1. p dvd smult a q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
smult a q = p * smult a k
[PROOF STEP]
show "p dvd smult a q"
[PROOF STATE]
proof (prove)
using this:
smult a q = p * smult a k

goal (1 subgoal):
 1. p dvd smult a q
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
p dvd smult a q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fbrelation_vunionD[dest]:
  assumes "fbrelation (r \<union>\<^sub>\<circ> s)"
  shows "fbrelation r" and "fbrelation s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fbrelation r &&& fbrelation s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fbrelation (r \<union>\<^sub>\<circ> s)

goal (1 subgoal):
 1. fbrelation r &&& fbrelation s
[PROOF STEP]
by auto


[STATEMENT]
lemma sublist_append_back:
  fixes l1 l2
  shows "subseq l1 (l2 @ l1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subseq l1 (l2 @ l1)
[PROOF STEP]
by blast

\<comment> \<open>NOTE can be solved directly with 'subseq\_rev\_drop\_many'.\<close>


[STATEMENT]
lemma formulaTrueExtendWithEntailedClauses:
  fixes formula :: Formula and formula0 :: Formula and valuation :: Valuation
  assumes formulaEntailed: "\<forall> (clause::Clause). clause el formula \<longrightarrow> formulaEntailsClause formula0 clause" and "consistent valuation"
  shows "formulaTrue formula0 valuation \<longrightarrow> formulaTrue formula valuation"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. formulaTrue formula0 valuation \<longrightarrow> formulaTrue formula valuation
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. formulaTrue formula0 valuation \<Longrightarrow> formulaTrue formula valuation
[PROOF STEP]
assume "formulaTrue formula0 valuation"
[PROOF STATE]
proof (state)
this:
formulaTrue formula0 valuation

goal (1 subgoal):
 1. formulaTrue formula0 valuation \<Longrightarrow> formulaTrue formula valuation
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
formulaTrue formula0 valuation

goal (1 subgoal):
 1. formulaTrue formula0 valuation \<Longrightarrow> formulaTrue formula valuation
[PROOF STEP]
fix clause :: Clause
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. formulaTrue formula0 valuation \<Longrightarrow> formulaTrue formula valuation
[PROOF STEP]
assume "clause el formula"
[PROOF STATE]
proof (state)
this:
clause el formula

goal (1 subgoal):
 1. formulaTrue formula0 valuation \<Longrightarrow> formulaTrue formula valuation
[PROOF STEP]
with formulaEntailed
[PROOF STATE]
proof (chain)
picking this:
\<forall>clause. clause el formula \<longrightarrow> formulaEntailsClause formula0 clause
clause el formula
[PROOF STEP]
have "formulaEntailsClause formula0 clause"
[PROOF STATE]
proof (prove)
using this:
\<forall>clause. clause el formula \<longrightarrow> formulaEntailsClause formula0 clause
clause el formula

goal (1 subgoal):
 1. formulaEntailsClause formula0 clause
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
formulaEntailsClause formula0 clause

goal (1 subgoal):
 1. formulaTrue formula0 valuation \<Longrightarrow> formulaTrue formula valuation
[PROOF STEP]
with \<open>formulaTrue formula0 valuation\<close> \<open>consistent valuation\<close>
[PROOF STATE]
proof (chain)
picking this:
formulaTrue formula0 valuation
consistent valuation
formulaEntailsClause formula0 clause
[PROOF STEP]
have "clauseTrue clause valuation"
[PROOF STATE]
proof (prove)
using this:
formulaTrue formula0 valuation
consistent valuation
formulaEntailsClause formula0 clause

goal (1 subgoal):
 1. clauseTrue clause valuation
[PROOF STEP]
by (simp add:formulaEntailsClause_def)
[PROOF STATE]
proof (state)
this:
clauseTrue clause valuation

goal (1 subgoal):
 1. formulaTrue formula0 valuation \<Longrightarrow> formulaTrue formula valuation
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?clause2 el formula \<Longrightarrow> clauseTrue ?clause2 valuation

goal (1 subgoal):
 1. formulaTrue formula0 valuation \<Longrightarrow> formulaTrue formula valuation
[PROOF STEP]
thus "formulaTrue formula valuation"
[PROOF STATE]
proof (prove)
using this:
?clause2 el formula \<Longrightarrow> clauseTrue ?clause2 valuation

goal (1 subgoal):
 1. formulaTrue formula valuation
[PROOF STEP]
by (simp add:formulaTrueIffAllClausesAreTrue)
[PROOF STATE]
proof (state)
this:
formulaTrue formula valuation

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_zero_mult: "poly_mult zero_poly p = zero_poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult zero_poly p = zero_poly
[PROOF STEP]
unfolding zero_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult [] p = []
[PROOF STEP]
using poly_mult.simps
[PROOF STATE]
proof (prove)
using this:
poly_mult [] ?q = []
poly_mult (?mc # ?p) ?q = poly_add (monom_mult_poly ?mc ?q) (poly_mult ?p ?q)

goal (1 subgoal):
 1. poly_mult [] p = []
[PROOF STEP]
by auto


[STATEMENT]
lemma bigthetaI':
  assumes "c1 > 0" "c2 > 0"
  assumes "eventually (\<lambda>x. c1 * (norm (g x)) \<le> (norm (f x)) \<and> (norm (f x)) \<le> c2 * (norm (g x))) F"
  shows   "f \<in> \<Theta>[F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> \<Theta>[F](g)
[PROOF STEP]
apply (rule bigthetaI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f \<in> O[F](g)
 2. f \<in> \<Omega>[F](g)
[PROOF STEP]
apply (rule landau_o.bigI[OF assms(2)])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. norm (f x) \<le> c2 * norm (g x)
 2. f \<in> \<Omega>[F](g)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. c1 * norm (g x) \<le> norm (f x) \<and> norm (f x) \<le> c2 * norm (g x)

goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. norm (f x) \<le> c2 * norm (g x)
 2. f \<in> \<Omega>[F](g)
[PROOF STEP]
apply (eventually_elim, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> \<Omega>[F](g)
[PROOF STEP]
apply (rule landau_omega.bigI[OF assms(1)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. c1 * norm (g x) \<le> norm (f x)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. c1 * norm (g x) \<le> norm (f x) \<and> norm (f x) \<le> c2 * norm (g x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. c1 * norm (g x) \<le> norm (f x)
[PROOF STEP]
apply (eventually_elim, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lemLineContainsEndpoint:
    shows "inLine q (line joining p to q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
define linePQ where "linePQ = line joining p to q"
[PROOF STATE]
proof (state)
this:
linePQ = line joining p to q

goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
have bp: "basepoint linePQ = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basepoint linePQ = p
[PROOF STEP]
by (simp add: linePQ_def)
[PROOF STATE]
proof (state)
this:
basepoint linePQ = p

goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
have dir: "direction linePQ = from p to q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. direction linePQ = from p to q
[PROOF STEP]
by (simp add: linePQ_def)
[PROOF STATE]
proof (state)
this:
direction linePQ = from p to q

goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
have endq: "basepoint linePQ \<leadsto> direction linePQ = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basepoint linePQ \<leadsto> direction linePQ = q
[PROOF STEP]
by (metis bp dir lemLineEndpoint)
[PROOF STATE]
proof (state)
this:
basepoint linePQ \<leadsto> direction linePQ = q

goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
have "(0 + 1 = 1)  \<and> (positionVector q = 0**(positionVector p) \<oplus> 1**(positionVector q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) + (1::'a) = (1::'a) \<and> positionVector q = (0::'a) ** positionVector p \<oplus> (1::'a) ** positionVector q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) + (1::'a) = (1::'a) \<and> positionVector q = (0::'a) ** positionVector p \<oplus> (1::'a) ** positionVector q

goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
hence "collinear q p q"
[PROOF STATE]
proof (prove)
using this:
(0::'a) + (1::'a) = (1::'a) \<and> positionVector q = (0::'a) ** positionVector p \<oplus> (1::'a) ** positionVector q

goal (1 subgoal):
 1. collinear q p q
[PROOF STEP]
by (metis collinear.simps)
[PROOF STATE]
proof (state)
this:
collinear q p q

goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
hence "collinear q (basepoint linePQ) (basepoint linePQ \<leadsto> direction linePQ)"
[PROOF STATE]
proof (prove)
using this:
collinear q p q

goal (1 subgoal):
 1. collinear q (basepoint linePQ) (basepoint linePQ \<leadsto> direction linePQ)
[PROOF STEP]
by (metis bp endq)
[PROOF STATE]
proof (state)
this:
collinear q (basepoint linePQ) (basepoint linePQ \<leadsto> direction linePQ)

goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
collinear q (basepoint linePQ) (basepoint linePQ \<leadsto> direction linePQ)

goal (1 subgoal):
 1. inLine q line joining p to q
[PROOF STEP]
by (simp add: linePQ_def)
[PROOF STATE]
proof (state)
this:
inLine q line joining p to q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_eq_size_basis : "basis_for V vs \<Longrightarrow> length vs = dim V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs \<Longrightarrow> length vs = dim_R V
[PROOF STEP]
using max_lin_independent_set_in_Span
        Least_equality[
          of "\<lambda>n::nat. \<exists>us. length us = n \<and> set us \<subseteq> V \<and> RSpan us = V" "length vs"
        ]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?vs \<subseteq> V; set ?us \<subseteq> RSpan ?vs; R_lin_independent ?us\<rbrakk> \<Longrightarrow> length ?us \<le> length ?vs
\<lbrakk>\<exists>us. length us = length vs \<and> set us \<subseteq> V \<and> RSpan us = V; \<And>y. \<exists>us. length us = y \<and> set us \<subseteq> V \<and> RSpan us = V \<Longrightarrow> length vs \<le> y\<rbrakk> \<Longrightarrow> (LEAST n. \<exists>us. length us = n \<and> set us \<subseteq> V \<and> RSpan us = V) = length vs

goal (1 subgoal):
 1. set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs \<Longrightarrow> length vs = dim_R V
[PROOF STEP]
unfolding dim_R_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?vs \<subseteq> V; set ?us \<subseteq> RSpan ?vs; R_lin_independent ?us\<rbrakk> \<Longrightarrow> length ?us \<le> length ?vs
\<lbrakk>\<exists>us. length us = length vs \<and> set us \<subseteq> V \<and> RSpan us = V; \<And>y. \<exists>us. length us = y \<and> set us \<subseteq> V \<and> RSpan us = V \<Longrightarrow> length vs \<le> y\<rbrakk> \<Longrightarrow> (LEAST n. \<exists>us. length us = n \<and> set us \<subseteq> V \<and> RSpan us = V) = length vs

goal (1 subgoal):
 1. set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs \<Longrightarrow> length vs = (if \<exists>ms. set ms \<subseteq> V \<and> RSpan ms = V then LEAST n. \<exists>ms. length ms = n \<and> set ms \<subseteq> V \<and> RSpan ms = V else 0)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma basis_left_null_space_in_left_null_space:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows "basis_left_null_space A \<subseteq> left_null_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_left_null_space A \<subseteq> left_null_space A
[PROOF STEP]
proof (unfold basis_left_null_space_def left_null_space_def, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
fix i::'rows
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
assume rank_le_i: " rank A \<le> to_nat i"
[PROOF STATE]
proof (state)
this:
rank A \<le> mod_type_class.to_nat i

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
have "row i (P_Gauss_Jordan A) v* A = ((P_Gauss_Jordan A) $ i) v* A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row i (P_Gauss_Jordan A) v* A = P_Gauss_Jordan A $ i v* A
[PROOF STEP]
unfolding row_def vec_nth_inverse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_Gauss_Jordan A $ i v* A = P_Gauss_Jordan A $ i v* A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
row i (P_Gauss_Jordan A) v* A = P_Gauss_Jordan A $ i v* A

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row i (P_Gauss_Jordan A) v* A = P_Gauss_Jordan A $ i v* A

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
have "... = ((P_Gauss_Jordan A) ** A) $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_Gauss_Jordan A $ i v* A = (P_Gauss_Jordan A ** A) $ i
[PROOF STEP]
unfolding row_matrix_matrix_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P_Gauss_Jordan A ** A) $ i = (P_Gauss_Jordan A ** A) $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P_Gauss_Jordan A $ i v* A = (P_Gauss_Jordan A ** A) $ i

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P_Gauss_Jordan A $ i v* A = (P_Gauss_Jordan A ** A) $ i

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
have "... = (Gauss_Jordan A) $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P_Gauss_Jordan A ** A) $ i = Gauss_Jordan A $ i
[PROOF STEP]
unfolding P_Gauss_Jordan_def Gauss_Jordan_PA_eq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fst (Gauss_Jordan_PA A) ** A) $ i = snd (Gauss_Jordan_PA A) $ i
[PROOF STEP]
using fst_Gauss_Jordan_PA
[PROOF STATE]
proof (prove)
using this:
fst (Gauss_Jordan_PA ?A) ** ?A = snd (Gauss_Jordan_PA ?A)

goal (1 subgoal):
 1. (fst (Gauss_Jordan_PA A) ** A) $ i = snd (Gauss_Jordan_PA A) $ i
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(P_Gauss_Jordan A ** A) $ i = Gauss_Jordan A $ i

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(P_Gauss_Jordan A ** A) $ i = Gauss_Jordan A $ i

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan A $ i = 0
[PROOF STEP]
by (rule rank_less_row_i_imp_i_is_zero[OF rank_le_i])
[PROOF STATE]
proof (state)
this:
Gauss_Jordan A $ i = 0

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
show "row i (P_Gauss_Jordan A) v* A = 0"
[PROOF STATE]
proof (prove)
using this:
row i (P_Gauss_Jordan A) v* A = 0

goal (1 subgoal):
 1. row i (P_Gauss_Jordan A) v* A = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
row i (P_Gauss_Jordan A) v* A = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fst_o_funPair [simp]: "fst o (funPair f g) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst \<circ> funPair f g = f
[PROOF STEP]
by (simp add: funPair_def o_def)


[STATEMENT]
lemma row_space_row_echelon[simp]: "row_space (row_echelon A) = row_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_space (row_echelon A) = row_space A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. row_space (row_echelon A) = row_space A
[PROOF STEP]
obtain P where *: "P \<in> Units (ring_mat TYPE('a::field) (dim_row A) Nil)" and **: "row_echelon A = P * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. \<lbrakk>P \<in> Units (ring_mat TYPE('a) (dim_row A) []); row_echelon A = P * A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule row_echelon_transform)
[PROOF STATE]
proof (state)
this:
P \<in> Units (ring_mat TYPE('a) (dim_row A) [])
row_echelon A = P * A

goal (1 subgoal):
 1. row_space (row_echelon A) = row_space A
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
P \<in> Units (ring_mat TYPE('a) (dim_row A) [])
[PROOF STEP]
have "row_space (P * A) = row_space A"
[PROOF STATE]
proof (prove)
using this:
P \<in> Units (ring_mat TYPE('a) (dim_row A) [])

goal (1 subgoal):
 1. row_space (P * A) = row_space A
[PROOF STEP]
by (rule row_space_mult_unit)
[PROOF STATE]
proof (state)
this:
row_space (P * A) = row_space A

goal (1 subgoal):
 1. row_space (row_echelon A) = row_space A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
row_space (P * A) = row_space A

goal (1 subgoal):
 1. row_space (row_echelon A) = row_space A
[PROOF STEP]
by (simp only: **)
[PROOF STATE]
proof (state)
this:
row_space (row_echelon A) = row_space A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma changes_poly_at_pders_0:"changes_poly_at (pders p) 0 = changes (coeffs p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (pders p) 0 = changes (coeffs p)
[PROOF STEP]
unfolding changes_poly_at_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p 0) (pders p)) = changes (coeffs p)
[PROOF STEP]
apply (subst (1 2) changes_map_sgn_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map sgn (map (\<lambda>p. poly p 0) (pders p))) = changes (map sgn (coeffs p))
[PROOF STEP]
by (auto simp add:pders_coeffs_sgn_eq comp_def)


[STATEMENT]
lemma tree_rank_estimate:
  "tree_invar (Node e a r ts) \<Longrightarrow>
    size (tree_to_multiset (Node e a r ts)) = (2::nat)^r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tree_invar (Node e a r ts) \<Longrightarrow> size (tree_to_multiset (Node e a r ts)) = 2 ^ r
[PROOF STEP]
proof (induct r arbitrary: e a ts)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>e a ts. tree_invar (Node e a 0 ts) \<Longrightarrow> size (tree_to_multiset (Node e a 0 ts)) = 2 ^ 0
 2. \<And>r e a ts. \<lbrakk>\<And>e a ts. tree_invar (Node e a r ts) \<Longrightarrow> size (tree_to_multiset (Node e a r ts)) = 2 ^ r; tree_invar (Node e a (Suc r) ts)\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node e a (Suc r) ts)) = 2 ^ Suc r
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
tree_invar (Node e a 0 ts)

goal (2 subgoals):
 1. \<And>e a ts. tree_invar (Node e a 0 ts) \<Longrightarrow> size (tree_to_multiset (Node e a 0 ts)) = 2 ^ 0
 2. \<And>r e a ts. \<lbrakk>\<And>e a ts. tree_invar (Node e a r ts) \<Longrightarrow> size (tree_to_multiset (Node e a r ts)) = 2 ^ r; tree_invar (Node e a (Suc r) ts)\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node e a (Suc r) ts)) = 2 ^ Suc r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
tree_invar (Node e a 0 ts)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
tree_invar (Node e a 0 ts)

goal (1 subgoal):
 1. size (tree_to_multiset (Node e a 0 ts)) = 2 ^ 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size (tree_to_multiset (Node e a 0 ts)) = 2 ^ 0

goal (1 subgoal):
 1. \<And>r e a ts. \<lbrakk>\<And>e a ts. tree_invar (Node e a r ts) \<Longrightarrow> size (tree_to_multiset (Node e a r ts)) = 2 ^ r; tree_invar (Node e a (Suc r) ts)\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node e a (Suc r) ts)) = 2 ^ Suc r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r e a ts. \<lbrakk>\<And>e a ts. tree_invar (Node e a r ts) \<Longrightarrow> size (tree_to_multiset (Node e a r ts)) = 2 ^ r; tree_invar (Node e a (Suc r) ts)\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node e a (Suc r) ts)) = 2 ^ Suc r
[PROOF STEP]
case (Suc r)
[PROOF STATE]
proof (state)
this:
tree_invar (Node ?e ?a r ?ts) \<Longrightarrow> size (tree_to_multiset (Node ?e ?a r ?ts)) = 2 ^ r
tree_invar (Node e a (Suc r) ts)

goal (1 subgoal):
 1. \<And>r e a ts. \<lbrakk>\<And>e a ts. tree_invar (Node e a r ts) \<Longrightarrow> size (tree_to_multiset (Node e a r ts)) = 2 ^ r; tree_invar (Node e a (Suc r) ts)\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node e a (Suc r) ts)) = 2 ^ Suc r
[PROOF STEP]
from Suc(2)
[PROOF STATE]
proof (chain)
picking this:
tree_invar (Node e a (Suc r) ts)
[PROOF STEP]
obtain e1 a1 ts1 e2 a2 ts2 where link:
    "(Node e a (Suc r) ts) = link (Node e1 a1 r ts1) (Node e2 a2 r ts2)"
    and inv1: "tree_invar (Node e1 a1 r ts1) "
    and inv2: "tree_invar (Node e2 a2 r ts2)"
[PROOF STATE]
proof (prove)
using this:
tree_invar (Node e a (Suc r) ts)

goal (1 subgoal):
 1. (\<And>e1 a1 ts1 e2 a2 ts2. \<lbrakk>Node e a (Suc r) ts = link (Node e1 a1 r ts1) (Node e2 a2 r ts2); tree_invar (Node e1 a1 r ts1); tree_invar (Node e2 a2 r ts2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp blast
[PROOF STATE]
proof (state)
this:
Node e a (Suc r) ts = link (Node e1 a1 r ts1) (Node e2 a2 r ts2)
tree_invar (Node e1 a1 r ts1)
tree_invar (Node e2 a2 r ts2)

goal (1 subgoal):
 1. \<And>r e a ts. \<lbrakk>\<And>e a ts. tree_invar (Node e a r ts) \<Longrightarrow> size (tree_to_multiset (Node e a r ts)) = 2 ^ r; tree_invar (Node e a (Suc r) ts)\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node e a (Suc r) ts)) = 2 ^ Suc r
[PROOF STEP]
from link_length[of "(Node e1 a1 r ts1)" "(Node e2 a2 r ts2)"]
    Suc(1)[OF inv1] Suc(1)[OF inv2] link
[PROOF STATE]
proof (chain)
picking this:
size (tree_to_multiset (link (Node e1 a1 r ts1) (Node e2 a2 r ts2))) = size (tree_to_multiset (Node e1 a1 r ts1)) + size (tree_to_multiset (Node e2 a2 r ts2))
size (tree_to_multiset (Node e1 a1 r ts1)) = 2 ^ r
size (tree_to_multiset (Node e2 a2 r ts2)) = 2 ^ r
Node e a (Suc r) ts = link (Node e1 a1 r ts1) (Node e2 a2 r ts2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
size (tree_to_multiset (link (Node e1 a1 r ts1) (Node e2 a2 r ts2))) = size (tree_to_multiset (Node e1 a1 r ts1)) + size (tree_to_multiset (Node e2 a2 r ts2))
size (tree_to_multiset (Node e1 a1 r ts1)) = 2 ^ r
size (tree_to_multiset (Node e2 a2 r ts2)) = 2 ^ r
Node e a (Suc r) ts = link (Node e1 a1 r ts1) (Node e2 a2 r ts2)

goal (1 subgoal):
 1. size (tree_to_multiset (Node e a (Suc r) ts)) = 2 ^ Suc r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size (tree_to_multiset (Node e a (Suc r) ts)) = 2 ^ Suc r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordinal_exp_left_cancel_less [simp]:
"oSuc 0 < w \<Longrightarrow> (w ** x < w ** y) = (x < y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oSuc 0 < w \<Longrightarrow> (w ** x < w ** y) = (x < y)
[PROOF STEP]
by (rule normal.cancel_less[OF normal_exp])


[STATEMENT]
theorem getEnv_psubstEnv_Some[simp]:
assumes "rho xs x = Some X"
shows "(rho &[rho']) xs x = Some (X #[rho'])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[rho'] xs x = Some X #[rho']
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
rho xs x = Some X

goal (1 subgoal):
 1. rho &[rho'] xs x = Some X #[rho']
[PROOF STEP]
unfolding psubstEnv_def
[PROOF STATE]
proof (prove)
using this:
rho xs x = Some X

goal (1 subgoal):
 1. (case rho xs x of None \<Rightarrow> rho' xs x | Some X \<Rightarrow> Some X #[rho']) = Some X #[rho']
[PROOF STEP]
by simp


[STATEMENT]
lemma zero_carrier_mat[simp]: "0\<^sub>m nr nc \<in> carrier_mat nr nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>m nr nc \<in> carrier_mat nr nc
[PROOF STEP]
unfolding carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>m nr nc \<in> {m. dim_row m = nr \<and> dim_col m = nc}
[PROOF STEP]
by auto


[STATEMENT]
lemma cospoly_upper:
  "cos x \<le> cospoly (Suc (4*n)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
proof (cases rule: le_cases [of 0 x])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> cos x \<le> cospoly (Suc (4 * n)) x
 2. x \<le> 0 \<Longrightarrow> cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
case le
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> cos x \<le> cospoly (Suc (4 * n)) x
 2. x \<le> 0 \<Longrightarrow> cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
by (simp add: cospoly_upper_nonneg)
[PROOF STATE]
proof (state)
this:
cos x \<le> cospoly (Suc (4 * n)) x

goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
case ge
[PROOF STATE]
proof (state)
this:
x \<le> 0

goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<le> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<le> 0

goal (1 subgoal):
 1. cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
using cospoly_upper_nonneg [of "-x"]
[PROOF STATE]
proof (prove)
using this:
x \<le> 0
0 \<le> - x \<Longrightarrow> cos (- x) \<le> cospoly (Suc (4 * ?n)) (- x)

goal (1 subgoal):
 1. cos x \<le> cospoly (Suc (4 * n)) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cos x \<le> cospoly (Suc (4 * n)) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_before_le_index: "card (before x xs) \<le> index xs x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (before x xs) \<le> index xs x
[PROOF STEP]
apply(cases "x \<in> set xs")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<in> set xs \<Longrightarrow> card (before x xs) \<le> index xs x
 2. x \<notin> set xs \<Longrightarrow> card (before x xs) \<le> index xs x
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<notin> set xs \<Longrightarrow> card (before x xs) \<le> index xs x
 2. x \<in> set xs \<Longrightarrow> card (before x xs) \<le> index xs x
[PROOF STEP]
apply (simp add: before_in_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set xs \<Longrightarrow> card (before x xs) \<le> index xs x
[PROOF STEP]
apply(induction xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<in> set [] \<Longrightarrow> card (before x []) \<le> index [] x
 2. \<And>a xs. \<lbrakk>x \<in> set xs \<Longrightarrow> card (before x xs) \<le> index xs x; x \<in> set (a # xs)\<rbrakk> \<Longrightarrow> card (before x (a # xs)) \<le> index (a # xs) x
[PROOF STEP]
apply (simp add: before_in_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>x \<in> set xs \<Longrightarrow> card (before x xs) \<le> index xs x; x \<in> set (a # xs)\<rbrakk> \<Longrightarrow> card (before x (a # xs)) \<le> index (a # xs) x
[PROOF STEP]
apply (auto simp: card_insert_if)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma r_prepend_total:
  assumes "recfn 1 r" and "total r"
  shows "eval (r_prepend vs r) [x] \<down>=
    (if x < length vs then vs ! x else the (eval r [x - length vs]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (r_prepend vs r) [x] \<down>= (if x < length vs then vs ! x else the (eval r [x - length vs]))
[PROOF STEP]
proof (induction vs arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. eval (r_prepend [] r) [x] \<down>= (if x < length [] then [] ! x else the (eval r [x - length []]))
 2. \<And>a vs x. (\<And>x. eval (r_prepend vs r) [x] \<down>= (if x < length vs then vs ! x else the (eval r [x - length vs]))) \<Longrightarrow> eval (r_prepend (a # vs) r) [x] \<down>= (if x < length (a # vs) then (a # vs) ! x else the (eval r [x - length (a # vs)]))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x. eval (r_prepend [] r) [x] \<down>= (if x < length [] then [] ! x else the (eval r [x - length []]))
 2. \<And>a vs x. (\<And>x. eval (r_prepend vs r) [x] \<down>= (if x < length vs then vs ! x else the (eval r [x - length vs]))) \<Longrightarrow> eval (r_prepend (a # vs) r) [x] \<down>= (if x < length (a # vs) then (a # vs) ! x else the (eval r [x - length (a # vs)]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (r_prepend [] r) [x] \<down>= (if x < length [] then [] ! x else the (eval r [x - length []]))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
recfn 1 r
Partial_Recursive.total r

goal (1 subgoal):
 1. eval (r_prepend [] r) [x] \<down>= (if x < length [] then [] ! x else the (eval r [x - length []]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval (r_prepend [] r) [x] \<down>= (if x < length [] then [] ! x else the (eval r [x - length []]))

goal (1 subgoal):
 1. \<And>a vs x. (\<And>x. eval (r_prepend vs r) [x] \<down>= (if x < length vs then vs ! x else the (eval r [x - length vs]))) \<Longrightarrow> eval (r_prepend (a # vs) r) [x] \<down>= (if x < length (a # vs) then (a # vs) ! x else the (eval r [x - length (a # vs)]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a vs x. (\<And>x. eval (r_prepend vs r) [x] \<down>= (if x < length vs then vs ! x else the (eval r [x - length vs]))) \<Longrightarrow> eval (r_prepend (a # vs) r) [x] \<down>= (if x < length (a # vs) then (a # vs) ! x else the (eval r [x - length (a # vs)]))
[PROOF STEP]
case (Cons v vs)
[PROOF STATE]
proof (state)
this:
eval (r_prepend vs r) [?x] \<down>= (if ?x < length vs then vs ! ?x else the (eval r [?x - length vs]))

goal (1 subgoal):
 1. \<And>a vs x. (\<And>x. eval (r_prepend vs r) [x] \<down>= (if x < length vs then vs ! x else the (eval r [x - length vs]))) \<Longrightarrow> eval (r_prepend (a # vs) r) [x] \<down>= (if x < length (a # vs) then (a # vs) ! x else the (eval r [x - length (a # vs)]))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (r_prepend (v # vs) r) [x] \<down>= (if x < length (v # vs) then (v # vs) ! x else the (eval r [x - length (v # vs)]))
[PROOF STEP]
using assms Cons
[PROOF STATE]
proof (prove)
using this:
recfn 1 r
Partial_Recursive.total r
eval (r_prepend vs r) [?x] \<down>= (if ?x < length vs then vs ! ?x else the (eval r [?x - length vs]))

goal (1 subgoal):
 1. eval (r_prepend (v # vs) r) [x] \<down>= (if x < length (v # vs) then (v # vs) ! x else the (eval r [x - length (v # vs)]))
[PROOF STEP]
by (cases "x = 0") (auto simp add: r_prepend_recfn)
[PROOF STATE]
proof (state)
this:
eval (r_prepend (v # vs) r) [x] \<down>= (if x < length (v # vs) then (v # vs) ! x else the (eval r [x - length (v # vs)]))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_numeral_less_ceiling [simp]: "- numeral v < \<lceil>x\<rceil> \<longleftrightarrow> - numeral v < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- numeral v < \<lceil>x\<rceil>) = (- numeral v < x)
[PROOF STEP]
by (simp add: less_ceiling_iff)


[STATEMENT]
lemma canonical_separator_initial :
  assumes "q1 \<in> states M" and "q2 \<in> states M"
  shows "initial (canonical_separator M q1 q2) = Inl (q1,q2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FSM.initial (canonical_separator M q1 q2) = Inl (q1, q2)
[PROOF STEP]
unfolding canonical_separator_simps[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inl (q1, q2) = Inl (q1, q2)
[PROOF STEP]
by simp


[STATEMENT]
lemma diameter_compact_attained:
  assumes "compact S"
    and "S \<noteq> {}"
  shows "\<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S
[PROOF STEP]
have b: "bounded S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded S
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
compact S

goal (1 subgoal):
 1. bounded S
[PROOF STEP]
by (rule compact_imp_bounded)
[PROOF STATE]
proof (state)
this:
bounded S

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bounded S
[PROOF STEP]
obtain x y where xys: "x\<in>S" "y\<in>S"
    and xy: "\<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y"
[PROOF STATE]
proof (prove)
using this:
bounded S

goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> S; y \<in> S; \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using compact_sup_maxdistance[OF assms]
[PROOF STATE]
proof (prove)
using this:
bounded S
\<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y

goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> S; y \<in> S; \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> S
y \<in> S
\<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S
y \<in> S
\<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
have "diameter S \<le> dist x y"
[PROOF STATE]
proof (prove)
using this:
x \<in> S
y \<in> S
\<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y

goal (1 subgoal):
 1. diameter S \<le> dist x y
[PROOF STEP]
unfolding diameter_def
[PROOF STATE]
proof (prove)
using this:
x \<in> S
y \<in> S
\<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y

goal (1 subgoal):
 1. (if S = {} then 0 else SUP (x, y)\<in>S \<times> S. dist x y) \<le> dist x y
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> S; y \<in> S; \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y; S \<noteq> {}\<rbrakk> \<Longrightarrow> (SUP x\<in>S \<times> S. case x of (x, xa) \<Rightarrow> dist x xa) \<le> dist x y
[PROOF STEP]
apply (rule cSUP_least, fast+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
diameter S \<le> dist x y

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
diameter S \<le> dist x y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
diameter S \<le> dist x y

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S
[PROOF STEP]
by (metis b diameter_bounded_bound order_antisym xys)
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma maxdeg_max:
  assumes "finite A" and "p \<in> A"
  shows "poly_deg p \<le> maxdeg A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg p \<le> maxdeg A
[PROOF STEP]
unfolding maxdeg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg p \<le> Max (poly_deg ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
p \<in> A

goal (1 subgoal):
 1. poly_deg p \<le> Max (poly_deg ` A)
[PROOF STEP]
by auto


[STATEMENT]
theorem HFail_HInv4b:
  assumes act: "HFail s  s' p"
  and inv: "HInv4b s q"
  shows "HInv4b s' q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HInv4b s' q
[PROOF STEP]
proof(cases "p=q")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = q \<Longrightarrow> HInv4b s' q
 2. p \<noteq> q \<Longrightarrow> HInv4b s' q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = q

goal (2 subgoals):
 1. p = q \<Longrightarrow> HInv4b s' q
 2. p \<noteq> q \<Longrightarrow> HInv4b s' q
[PROOF STEP]
with HFail_HInv4b_p[OF act]
[PROOF STATE]
proof (chain)
picking this:
HInv4b s' p
p = q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
HInv4b s' p
p = q

goal (1 subgoal):
 1. HInv4b s' q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
HInv4b s' q

goal (1 subgoal):
 1. p \<noteq> q \<Longrightarrow> HInv4b s' q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> q \<Longrightarrow> HInv4b s' q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> q

goal (1 subgoal):
 1. p \<noteq> q \<Longrightarrow> HInv4b s' q
[PROOF STEP]
from HFail_HInv4b_q[OF act False inv]
[PROOF STATE]
proof (chain)
picking this:
HInv4b s' q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
HInv4b s' q

goal (1 subgoal):
 1. HInv4b s' q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
HInv4b s' q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Left_Coset_is_orbit:
  "x \<in> G \<Longrightarrow> x \<cdot>| H = orbit.Class x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> G \<Longrightarrow> x \<cdot>| H = orbit.Class x
[PROOF STEP]
using translation_apply
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> G; ?b \<in> G\<rbrakk> \<Longrightarrow> (?a)\<^sub>R ?b = ?b \<cdot> ?a

goal (1 subgoal):
 1. x \<in> G \<Longrightarrow> x \<cdot>| H = orbit.Class x
[PROOF STEP]
by (auto simp: orbit_equality Left_Coset_def) (metis imageI sub)


[STATEMENT]
lemma sstart_in_streams: "xs \<in> lists S \<Longrightarrow> sstart S xs \<subseteq> streams S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> lists S \<Longrightarrow> sstart S xs \<subseteq> streams S
[PROOF STEP]
by (induction xs) (auto simp: sstart.simps(2))


[STATEMENT]
lemma dual_additive_antitone:
  assumes "dual_additive f"
    shows "isotone (uminus \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isotone (uminus \<circ> f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isotone (uminus \<circ> f)
[PROOF STEP]
have "\<forall>x y . f (x \<squnion> y) \<le> f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. f (x \<squnion> y) \<le> f x
[PROOF STEP]
using assms dual_additive_def
[PROOF STATE]
proof (prove)
using this:
dual_additive f
dual_additive ?f \<equiv> \<forall>x y. ?f (x \<squnion> y) = ?f x \<sqinter> ?f y

goal (1 subgoal):
 1. \<forall>x y. f (x \<squnion> y) \<le> f x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x y. f (x \<squnion> y) \<le> f x

goal (1 subgoal):
 1. isotone (uminus \<circ> f)
[PROOF STEP]
hence "\<forall>x y . x \<le> y \<longrightarrow> f y \<le> f x"
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. f (x \<squnion> y) \<le> f x

goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> f y \<le> f x
[PROOF STEP]
by (metis sup_absorb2)
[PROOF STATE]
proof (state)
this:
\<forall>x y. x \<le> y \<longrightarrow> f y \<le> f x

goal (1 subgoal):
 1. isotone (uminus \<circ> f)
[PROOF STEP]
hence "\<forall>x y . x \<le> y \<longrightarrow> -(f x) \<le> -(f y)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<le> y \<longrightarrow> f y \<le> f x

goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> - f x \<le> - f y
[PROOF STEP]
by (simp add: p_antitone)
[PROOF STATE]
proof (state)
this:
\<forall>x y. x \<le> y \<longrightarrow> - f x \<le> - f y

goal (1 subgoal):
 1. isotone (uminus \<circ> f)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<le> y \<longrightarrow> - f x \<le> - f y

goal (1 subgoal):
 1. isotone (uminus \<circ> f)
[PROOF STEP]
by (simp add: isotone_def)
[PROOF STATE]
proof (state)
this:
isotone (uminus \<circ> f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma above_trans:
assumes TRANS: "trans r" and
        IN1: "b \<in> above r a" and IN2: "c \<in> above r b"
shows "c \<in> above r a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<in> above r a
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<in> above r a
[PROOF STEP]
have "(a,b) \<in> r \<and> (b,c) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a, b) \<in> r \<and> (b, c) \<in> r
[PROOF STEP]
using IN1 IN2 above_def
[PROOF STATE]
proof (prove)
using this:
b \<in> above r a
c \<in> above r b
above ?r ?a \<equiv> {b. (?a, b) \<in> ?r}

goal (1 subgoal):
 1. (a, b) \<in> r \<and> (b, c) \<in> r
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(a, b) \<in> r \<and> (b, c) \<in> r

goal (1 subgoal):
 1. c \<in> above r a
[PROOF STEP]
hence "(a,c) \<in> r"
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> r \<and> (b, c) \<in> r

goal (1 subgoal):
 1. (a, c) \<in> r
[PROOF STEP]
using TRANS trans_def[of r]
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> r \<and> (b, c) \<in> r
trans r
trans r = (\<forall>x y z. (x, y) \<in> r \<longrightarrow> (y, z) \<in> r \<longrightarrow> (x, z) \<in> r)

goal (1 subgoal):
 1. (a, c) \<in> r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(a, c) \<in> r

goal (1 subgoal):
 1. c \<in> above r a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(a, c) \<in> r

goal (1 subgoal):
 1. c \<in> above r a
[PROOF STEP]
unfolding above_def
[PROOF STATE]
proof (prove)
using this:
(a, c) \<in> r

goal (1 subgoal):
 1. c \<in> {b. (a, b) \<in> r}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<in> above r a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_dfs_eq_rtrancl: "prod_is_node A B x \<Longrightarrow> prod_is_node A B y \<Longrightarrow>
  prod_memb y (prod_dfs A B x) = ((x, y) \<in> (succsr (prod_succs A B))\<^sup>*)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prod_is_node A B x; prod_is_node A B y\<rbrakk> \<Longrightarrow> prod_memb y (prod_dfs A B x) = ((x, y) \<in> (succsr (prod_succs A B))\<^sup>*)
[PROOF STEP]
by (unfold prod_dfs_def) (rule dfs_eq_rtrancl)


[STATEMENT]
lemma (in group) prime_power_complementary_groups:
  assumes "Factorial_Ring.prime p" "Factorial_Ring.prime q" "p \<noteq> q"
  and "subgroup P G" "card P = p ^ x"
  and "subgroup Q G" "card Q = q ^ y"
  shows "complementary P Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complementary P Q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. complementary P Q
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
prime q
p \<noteq> q
subgroup P G
card P = p ^ x
subgroup Q G
card Q = q ^ y
[PROOF STEP]
have "coprime (card P) (card Q)"
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
p \<noteq> q
subgroup P G
card P = p ^ x
subgroup Q G
card Q = q ^ y

goal (1 subgoal):
 1. coprime (card P) (card Q)
[PROOF STEP]
by (metis coprime_power_right_iff primes_coprime coprime_def)
[PROOF STATE]
proof (state)
this:
coprime (card P) (card Q)

goal (1 subgoal):
 1. complementary P Q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coprime (card P) (card Q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime (card P) (card Q)

goal (1 subgoal):
 1. complementary P Q
[PROOF STEP]
using subgroups_card_coprime_imp_compl assms complementary_def
[PROOF STATE]
proof (prove)
using this:
coprime (card P) (card Q)
\<lbrakk>subgroup ?H G; subgroup ?J G; coprime (card ?H) (card ?J)\<rbrakk> \<Longrightarrow> complementary ?H ?J
prime p
prime q
p \<noteq> q
subgroup P G
card P = p ^ x
subgroup Q G
card Q = q ^ y
complementary ?H1.0 ?H2.0 = (?H1.0 \<inter> ?H2.0 = {\<one>})

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_real_cpx:
  fixes a::complex
  fixes b::complex
  assumes "a\<in> Reals"
  shows "a* (Re b) = Re (a * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * complex_of_real (Re b) = complex_of_real (Re (a * b))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> \<real>

goal (1 subgoal):
 1. a * complex_of_real (Re b) = complex_of_real (Re (a * b))
[PROOF STEP]
by (metis Reals_cases complex.exhaust complex.sel(1) complex_of_real_mult_Complex of_real_mult)


[STATEMENT]
lemma fps_to_fls_eq_imp_fps_eq:
  assumes "fps_to_fls f = fps_to_fls g"
  shows   "f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = g
[PROOF STEP]
proof (intro fps_ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. f $ n = g $ n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. f $ n = g $ n
[PROOF STEP]
have "f $ n = fps_to_fls g $$ int n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f $ n = fps_to_fls g $$ int n
[PROOF STEP]
by (simp add: assms[symmetric])
[PROOF STATE]
proof (state)
this:
f $ n = fps_to_fls g $$ int n

goal (1 subgoal):
 1. \<And>n. f $ n = g $ n
[PROOF STEP]
thus "f $ n = g $ n"
[PROOF STATE]
proof (prove)
using this:
f $ n = fps_to_fls g $$ int n

goal (1 subgoal):
 1. f $ n = g $ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f $ n = g $ n

goal:
No subgoals!
[PROOF STEP]
qed