[STATEMENT]
lemma coprime_iff_prime_factors_disjoint:
  fixes x y :: "'a :: factorial_semiring"
  assumes "x \<noteq> 0" "y \<noteq> 0"
  shows "coprime x y \<longleftrightarrow> prime_factors x \<inter> prime_factors y = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime x y = (prime_factors x \<inter> prime_factors y = {})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. coprime x y \<Longrightarrow> prime_factors x \<inter> prime_factors y = {}
 2. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
assume "coprime x y"
[PROOF STATE]
proof (state)
this:
coprime x y

goal (2 subgoals):
 1. coprime x y \<Longrightarrow> prime_factors x \<inter> prime_factors y = {}
 2. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
have False if "p \<in> prime_factors x" "p \<in> prime_factors y" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
from that assms
[PROOF STATE]
proof (chain)
picking this:
p \<in># prime_factorization x
p \<in># prime_factorization y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
[PROOF STEP]
have "p dvd x" "p dvd y"
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization x
p \<in># prime_factorization y
x \<noteq> (0::'a)
y \<noteq> (0::'a)

goal (1 subgoal):
 1. p dvd x &&& p dvd y
[PROOF STEP]
by (auto simp: prime_factors_dvd)
[PROOF STATE]
proof (state)
this:
p dvd x
p dvd y

goal (1 subgoal):
 1. False
[PROOF STEP]
with \<open>coprime x y\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime x y
p dvd x
p dvd y
[PROOF STEP]
have "p dvd 1"
[PROOF STATE]
proof (prove)
using this:
coprime x y
p dvd x
p dvd y

goal (1 subgoal):
 1. is_unit p
[PROOF STEP]
using coprime_common_divisor
[PROOF STATE]
proof (prove)
using this:
coprime x y
p dvd x
p dvd y
\<lbrakk>coprime ?a ?b; ?c dvd ?a; ?c dvd ?b\<rbrakk> \<Longrightarrow> is_unit ?c

goal (1 subgoal):
 1. is_unit p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_unit p

goal (1 subgoal):
 1. False
[PROOF STEP]
with that assms
[PROOF STATE]
proof (chain)
picking this:
p \<in># prime_factorization x
p \<in># prime_factorization y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
is_unit p
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization x
p \<in># prime_factorization y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
is_unit p

goal (1 subgoal):
 1. False
[PROOF STEP]
by (auto simp: prime_factors_dvd)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?p \<in># prime_factorization x; ?p \<in># prime_factorization y\<rbrakk> \<Longrightarrow> False

goal (2 subgoals):
 1. coprime x y \<Longrightarrow> prime_factors x \<inter> prime_factors y = {}
 2. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
thus "prime_factors x \<inter> prime_factors y = {}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p \<in># prime_factorization x; ?p \<in># prime_factorization y\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime_factors x \<inter> prime_factors y = {}

goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
assume disjoint: "prime_factors x \<inter> prime_factors y = {}"
[PROOF STATE]
proof (state)
this:
prime_factors x \<inter> prime_factors y = {}

goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
show "coprime x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime x y
[PROOF STEP]
proof (rule coprimeI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd x; c dvd y\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd x; c dvd y\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
assume d: "d dvd x" "d dvd y"
[PROOF STATE]
proof (state)
this:
d dvd x
d dvd y

goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd x; c dvd y\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
show "is_unit d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit d
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
assume "\<not>is_unit d"
[PROOF STATE]
proof (state)
this:
\<not> is_unit d

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> is_unit d

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
from this and d assms
[PROOF STATE]
proof (chain)
picking this:
\<not> is_unit d
d dvd x
d dvd y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
[PROOF STEP]
have "d \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> is_unit d
d dvd x
d dvd y
x \<noteq> (0::'a)
y \<noteq> (0::'a)

goal (1 subgoal):
 1. d \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d \<noteq> (0::'a)

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> is_unit d
d \<noteq> (0::'a)
[PROOF STEP]
obtain p where p: "prime p" "p dvd d"
[PROOF STATE]
proof (prove)
using this:
\<not> is_unit d
d \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; p dvd d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prime_divisor_exists
[PROOF STATE]
proof (prove)
using this:
\<not> is_unit d
d \<noteq> (0::'a)
\<lbrakk>?a \<noteq> (0::?'a); \<not> is_unit ?a\<rbrakk> \<Longrightarrow> \<exists>b. b dvd ?a \<and> prime b

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; p dvd d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p
p dvd d

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
with d and assms
[PROOF STATE]
proof (chain)
picking this:
d dvd x
d dvd y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
prime p
p dvd d
[PROOF STEP]
have "p \<in> prime_factors x \<inter> prime_factors y"
[PROOF STATE]
proof (prove)
using this:
d dvd x
d dvd y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
prime p
p dvd d

goal (1 subgoal):
 1. p \<in> prime_factors x \<inter> prime_factors y
[PROOF STEP]
by (auto simp: prime_factors_dvd)
[PROOF STATE]
proof (state)
this:
p \<in> prime_factors x \<inter> prime_factors y

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
with disjoint
[PROOF STATE]
proof (chain)
picking this:
prime_factors x \<inter> prime_factors y = {}
p \<in> prime_factors x \<inter> prime_factors y
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
prime_factors x \<inter> prime_factors y = {}
p \<in> prime_factors x \<inter> prime_factors y

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_unit d

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coprime x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sq_norm_row_sylvester_mat1:
  fixes f g :: "'a :: conjugatable_ring poly"
  assumes i: "i < degree g"
  shows "\<parallel>(row (sylvester_mat f g) i)\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
proof (cases "f = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
 2. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f = 0

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
 2. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f = 0

goal (1 subgoal):
 1. \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
by (auto simp add: sylvester_mat_def row_def sq_norm_vec_def o_def
        interv_sum_list_conv_sum_set_nat i intro!: sum_list_zero)
[PROOF STATE]
proof (state)
this:
\<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f \<noteq> 0

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
note f = False
[PROOF STATE]
proof (state)
this:
f \<noteq> 0

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
let ?f = "\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
let ?h = "\<lambda>j. j + i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
let ?row = "vec (degree f + degree g) ?f "
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
let ?g = "\<lambda>j. degree f - j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have image_g: "?g ` {0..<Suc (degree f)} = {0..<Suc (degree f)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (-) (degree f) ` {0..<Suc (degree f)} = {0..<Suc (degree f)}
[PROOF STEP]
by (auto simp add: image_def)
       (metis (no_types, opaque_lifting) Nat.add_diff_assoc add.commute add_diff_cancel_left'
        atLeastLessThan_iff diff_Suc_Suc diff_Suc_less less_Suc_eq_le zero_le)
[PROOF STATE]
proof (state)
this:
(-) (degree f) ` {0..<Suc (degree f)} = {0..<Suc (degree f)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have bij_h: "bij_betw ?h {0..<Suc (degree f)} {i..< Suc (degree f + i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>j. j + i) {0..<Suc (degree f)} {i..<Suc (degree f + i)}
[PROOF STEP]
unfolding bij_betw_def image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>j. j + i) {0..<Suc (degree f)} \<and> {y. \<exists>x\<in>{0..<Suc (degree f)}. y = x + i} = {i..<Suc (degree f + i)}
[PROOF STEP]
by (auto, metis atLeastLessThan_iff le_add_diff_inverse2
        less_diff_conv linorder_not_less not_less_eq zero_order(3))
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>j. j + i) {0..<Suc (degree f)} {i..<Suc (degree f + i)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "\<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>?row\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>vec (degree f + degree g) (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))\<parallel>\<^sup>2
[PROOF STEP]
by (rule arg_cong[of _ _ "sq_norm_vec"], insert i,
        auto simp add: row_def sylvester_mat_def sylvester_mat_sub_def)
[PROOF STATE]
proof (state)
this:
\<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>vec (degree f + degree g) (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))\<parallel>\<^sup>2

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>vec (degree f + degree g) (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))\<parallel>\<^sup>2

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum_list (map (sq_norm \<circ> ?f) [0..<degree f + degree g])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>vec (degree f + degree g) (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))\<parallel>\<^sup>2 = sum_list (map (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) [0..<degree f + degree g])
[PROOF STEP]
unfolding sq_norm_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map sq_norm (list_of_vec (vec (degree f + degree g) (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))))) = sum_list (map (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) [0..<degree f + degree g])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<parallel>vec (degree f + degree g) (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))\<parallel>\<^sup>2 = sum_list (map (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) [0..<degree f + degree g])

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<parallel>vec (degree f + degree g) (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))\<parallel>\<^sup>2 = sum_list (map (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) [0..<degree f + degree g])

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum (sq_norm \<circ> ?f) {0..<degree f + degree g}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) [0..<degree f + degree g]) = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {0..<degree f + degree g}
[PROOF STEP]
unfolding interv_sum_list_conv_sum_set_nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) (set [0..<degree f + degree g]) = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {0..<degree f + degree g}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum_list (map (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) [0..<degree f + degree g]) = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {0..<degree f + degree g}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) [0..<degree f + degree g]) = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {0..<degree f + degree g}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum (sq_norm \<circ> ?f) {i..< Suc (degree f + i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {0..<degree f + degree g} = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {i..<Suc (degree f + i)}
[PROOF STEP]
by (rule sum.mono_neutral_right, insert i, auto)
[PROOF STATE]
proof (state)
this:
sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {0..<degree f + degree g} = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {i..<Suc (degree f + i)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {0..<degree f + degree g} = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {i..<Suc (degree f + i)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum ((sq_norm \<circ> ?f) \<circ> ?h) {0..<Suc (degree f)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {i..<Suc (degree f + i)} = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a)) \<circ> (\<lambda>j. j + i)) {0..<Suc (degree f)}
[PROOF STEP]
by (unfold o_def, rule sum.reindex_bij_betw[symmetric, OF bij_h])
[PROOF STATE]
proof (state)
this:
sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {i..<Suc (degree f + i)} = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a)) \<circ> (\<lambda>j. j + i)) {0..<Suc (degree f)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a))) {i..<Suc (degree f + i)} = sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a)) \<circ> (\<lambda>j. j + i)) {0..<Suc (degree f)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum (\<lambda>j. sq_norm (coeff f (degree f - j))) {0..<Suc (degree f)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a)) \<circ> (\<lambda>j. j + i)) {0..<Suc (degree f)} = (\<Sum>j = 0..<Suc (degree f). sq_norm_conjugate (coeff f (degree f - j)))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a)) \<circ> (\<lambda>j. j + i)) {0..<Suc (degree f)} = (\<Sum>j = 0..<Suc (degree f). sq_norm_conjugate (coeff f (degree f - j)))

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (sq_norm \<circ> (\<lambda>j. if i \<le> j \<and> j - i \<le> degree f then coeff f (degree f + i - j) else (0::'a)) \<circ> (\<lambda>j. j + i)) {0..<Suc (degree f)} = (\<Sum>j = 0..<Suc (degree f). sq_norm_conjugate (coeff f (degree f - j)))

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum ((\<lambda>j. sq_norm (coeff f j)) \<circ> ?g) {0..<Suc (degree f)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<Suc (degree f). sq_norm_conjugate (coeff f (degree f - j))) = sum ((\<lambda>j. sq_norm_conjugate (coeff f j)) \<circ> (-) (degree f)) {0..<Suc (degree f)}
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<Suc (degree f). sq_norm_conjugate (coeff f (degree f - j))) = (\<Sum>x = 0..<Suc (degree f). sq_norm_conjugate (coeff f (degree f - x)))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<Suc (degree f). sq_norm_conjugate (coeff f (degree f - j))) = sum ((\<lambda>j. sq_norm_conjugate (coeff f j)) \<circ> (-) (degree f)) {0..<Suc (degree f)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<Suc (degree f). sq_norm_conjugate (coeff f (degree f - j))) = sum ((\<lambda>j. sq_norm_conjugate (coeff f j)) \<circ> (-) (degree f)) {0..<Suc (degree f)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum (\<lambda>j. sq_norm (coeff f j)) (?g ` {0..<Suc (degree f)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>j. sq_norm_conjugate (coeff f j)) \<circ> (-) (degree f)) {0..<Suc (degree f)} = (\<Sum>j\<in>(-) (degree f) ` {0..<Suc (degree f)}. sq_norm_conjugate (coeff f j))
[PROOF STEP]
by (rule sum.reindex[symmetric], auto simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>j. sq_norm_conjugate (coeff f j)) \<circ> (-) (degree f)) {0..<Suc (degree f)} = (\<Sum>j\<in>(-) (degree f) ` {0..<Suc (degree f)}. sq_norm_conjugate (coeff f j))

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>j. sq_norm_conjugate (coeff f j)) \<circ> (-) (degree f)) {0..<Suc (degree f)} = (\<Sum>j\<in>(-) (degree f) ` {0..<Suc (degree f)}. sq_norm_conjugate (coeff f j))

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>(-) (degree f) ` {0..<Suc (degree f)}. sq_norm_conjugate (coeff f j)) = sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)}
[PROOF STEP]
unfolding image_g
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<Suc (degree f). sq_norm_conjugate (coeff f j)) = sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>(-) (degree f) ` {0..<Suc (degree f)}. sq_norm_conjugate (coeff f j)) = sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>(-) (degree f) ` {0..<Suc (degree f)}. sq_norm_conjugate (coeff f j)) = sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)}

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
have "... = sum_list (map sq_norm (coeffs f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)} = sum_list (map sq_norm (coeffs f))
[PROOF STEP]
unfolding coeffs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)} = sum_list (map sq_norm (if f = 0 then [] else map (coeff f) [0..<Suc (degree f)]))
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0

goal (1 subgoal):
 1. sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)} = sum_list (map sq_norm (if f = 0 then [] else map (coeff f) [0..<Suc (degree f)]))
[PROOF STEP]
by (simp add: interv_sum_list_conv_sum_set_nat)
[PROOF STATE]
proof (state)
this:
sum (sq_norm \<circ> coeff f) {0..<Suc (degree f)} = sum_list (map sq_norm (coeffs f))

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = sum_list (map sq_norm (coeffs f))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = sum_list (map sq_norm (coeffs f))

goal (1 subgoal):
 1. \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
unfolding sq_norm_poly_def
[PROOF STATE]
proof (prove)
using this:
\<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = sum_list (map sq_norm (coeffs f))

goal (1 subgoal):
 1. \<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = sum_list (map sq_norm (coeffs f))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<parallel>row (sylvester_mat f g) i\<parallel>\<^sup>2 = \<parallel>f\<parallel>\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_vmult_column_sum:
  fixes A::"'a::{field}^'n^'m"
  shows "\<exists>f. A *v x = sum (\<lambda>y. f y *s y) (columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. A *v x = (\<Sum>y\<in>columns A. f y *s y)
[PROOF STEP]
proof (rule exI[of _ "\<lambda>y. sum (\<lambda>i. x $ i) {i. y = column i A}"])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
let ?f="\<lambda>y. sum (\<lambda>i. x $ i) {i. y = column i A}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
let ?g="(\<lambda>y. {i. y=column i (A)})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
have inj: "inj_on ?g (columns (A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>y. {i. y = column i A}) (columns A)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>columns A. \<forall>y\<in>columns A. {i. x = column i A} = {i. y = column i A} \<longrightarrow> x = y
[PROOF STEP]
unfolding columns_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{column i A |i. i \<in> UNIV}. \<forall>y\<in>{column i A |i. i \<in> UNIV}. {i. x = column i A} = {i. y = column i A} \<longrightarrow> x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>y. {i. y = column i A}) (columns A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
have union_univ: "\<Union> (?g`(columns (A))) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>y\<in>columns A. {i. y = column i A}) = UNIV
[PROOF STEP]
unfolding columns_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>y\<in>{column i A |i. i \<in> UNIV}. {i. y = column i A}) = UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>y\<in>columns A. {i. y = column i A}) = UNIV

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
have "A *v x = (\<Sum>i\<in>UNIV. x $ i *s column i A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v x = (\<Sum>i\<in>UNIV. x $ i *s column i A)
[PROOF STEP]
unfolding matrix_mult_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. x $ i *s column i A) = (\<Sum>i\<in>UNIV. x $ i *s column i A)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
A *v x = (\<Sum>i\<in>UNIV. x $ i *s column i A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A *v x = (\<Sum>i\<in>UNIV. x $ i *s column i A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
have "... = sum (\<lambda>i.  x $ i *s column i A) (\<Union>(?g`(columns A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. x $ i *s column i A) = (\<Sum>i\<in>(\<Union>y\<in>columns A. {i. y = column i A}). x $ i *s column i A)
[PROOF STEP]
unfolding union_univ
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. x $ i *s column i A) = (\<Sum>i\<in>UNIV. x $ i *s column i A)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. x $ i *s column i A) = (\<Sum>i\<in>(\<Union>y\<in>columns A. {i. y = column i A}). x $ i *s column i A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. x $ i *s column i A) = (\<Sum>i\<in>(\<Union>y\<in>columns A. {i. y = column i A}). x $ i *s column i A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
have "... = sum (sum ((\<lambda>i.  x $ i *s column i A)))  (?g`(columns A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>(\<Union>y\<in>columns A. {i. y = column i A}). x $ i *s column i A) = sum (sum (\<lambda>i. x $ i *s column i A)) ((\<lambda>y. {i. y = column i A}) ` columns A)
[PROOF STEP]
by (rule sum.Union_disjoint[unfolded o_def], auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>(\<Union>y\<in>columns A. {i. y = column i A}). x $ i *s column i A) = sum (sum (\<lambda>i. x $ i *s column i A)) ((\<lambda>y. {i. y = column i A}) ` columns A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>(\<Union>y\<in>columns A. {i. y = column i A}). x $ i *s column i A) = sum (sum (\<lambda>i. x $ i *s column i A)) ((\<lambda>y. {i. y = column i A}) ` columns A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
have "... = sum ((sum ((\<lambda>i.  x $ i *s column i A))) \<circ> ?g)  (columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sum (\<lambda>i. x $ i *s column i A)) ((\<lambda>y. {i. y = column i A}) ` columns A) = sum (sum (\<lambda>i. x $ i *s column i A) \<circ> (\<lambda>y. {i. y = column i A})) (columns A)
[PROOF STEP]
by (rule sum.reindex, simp add: inj)
[PROOF STATE]
proof (state)
this:
sum (sum (\<lambda>i. x $ i *s column i A)) ((\<lambda>y. {i. y = column i A}) ` columns A) = sum (sum (\<lambda>i. x $ i *s column i A) \<circ> (\<lambda>y. {i. y = column i A})) (columns A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (sum (\<lambda>i. x $ i *s column i A)) ((\<lambda>y. {i. y = column i A}) ` columns A) = sum (sum (\<lambda>i. x $ i *s column i A) \<circ> (\<lambda>y. {i. y = column i A})) (columns A)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
have "... =  sum (\<lambda>y. ?f y *s y) (columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sum (\<lambda>i. x $ i *s column i A) \<circ> (\<lambda>y. {i. y = column i A})) (columns A) = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
proof (rule sum.cong, unfold o_def)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. columns A = columns A
 2. \<And>xa. xa \<in> columns A \<Longrightarrow> (\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
fix xa
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. columns A = columns A
 2. \<And>xa. xa \<in> columns A \<Longrightarrow> (\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
have "sum (\<lambda>i. x $ i *s column i A) {i. xa = column i A}
      = sum (\<lambda>i. x $ i *s xa) {i. xa = column i A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i *s xa)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i *s xa)

goal (2 subgoals):
 1. columns A = columns A
 2. \<And>xa. xa \<in> columns A \<Longrightarrow> (\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i *s xa)

goal (2 subgoals):
 1. columns A = columns A
 2. \<And>xa. xa \<in> columns A \<Longrightarrow> (\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
have "... = sum (\<lambda>i. x $ i) {i. xa = column i A} *s xa"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | xa = column i A. x $ i *s xa) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
using vec.scale_sum_left[of "(\<lambda>i. x $ i)" "{i. xa = column i A}" xa]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i | xa = column i A. x $ i) *s xa = (\<Sum>a\<in>{i. xa = column i A}. x $ a *s xa)

goal (1 subgoal):
 1. (\<Sum>i | xa = column i A. x $ i *s xa) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>i | xa = column i A. x $ i *s xa) = (\<Sum>i | xa = column i A. x $ i) *s xa

goal (2 subgoals):
 1. columns A = columns A
 2. \<And>xa. xa \<in> columns A \<Longrightarrow> (\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
show "(\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa

goal (1 subgoal):
 1. (\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>i | xa = column i A. x $ i *s column i A) = (\<Sum>i | xa = column i A. x $ i) *s xa

goal (1 subgoal):
 1. columns A = columns A
[PROOF STEP]
qed rule
[PROOF STATE]
proof (state)
this:
sum (sum (\<lambda>i. x $ i *s column i A) \<circ> (\<lambda>y. {i. y = column i A})) (columns A) = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
show "A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)"
[PROOF STATE]
proof (prove)
using this:
A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)

goal (1 subgoal):
 1. A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A *v x = (\<Sum>y\<in>columns A. (\<Sum>i | y = column i A. x $ i) *s y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_le_of_rat_iff [simp]: "0 \<le> (of_rat r :: 'a::linordered_field) \<longleftrightarrow> 0 \<le> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) \<le> of_rat r) = (0 \<le> r)
[PROOF STEP]
using of_rat_less_eq [of 0 r, where 'a = 'a]
[PROOF STATE]
proof (prove)
using this:
(of_rat 0 \<le> of_rat r) = (0 \<le> r)

goal (1 subgoal):
 1. ((0::'a) \<le> of_rat r) = (0 \<le> r)
[PROOF STEP]
by simp


[STATEMENT]
lemma bilinear_lzero:
  assumes "bilinear h"
  shows "h 0 x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (0::'a) x = (0::'c)
[PROOF STEP]
using bilinear_ladd [OF assms, of 0 0 x]
[PROOF STATE]
proof (prove)
using this:
h ((0::'a) + (0::'a)) x = h (0::'a) x + h (0::'a) x

goal (1 subgoal):
 1. h (0::'a) x = (0::'c)
[PROOF STEP]
by (simp add: eq_add_iff field_simps)


[STATEMENT]
lemma foldr_max_length: "foldr (\<lambda>xs. max (length xs)) lss n = fold max (map length lss) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>xs. max (length xs)) lss n = fold max (map length lss) n
[PROOF STEP]
apply(subst List.foldr_fold)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> set lss; y \<in> set lss\<rbrakk> \<Longrightarrow> max (length y) \<circ> max (length x) = max (length x) \<circ> max (length y)
 2. fold (\<lambda>xs. max (length xs)) lss n = fold max (map length lss) n
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>xs. max (length xs)) lss n = fold max (map length lss) n
[PROOF STEP]
apply(induction lss arbitrary: n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. fold (\<lambda>xs. max (length xs)) [] n = fold max (map length []) n
 2. \<And>a lss n. (\<And>n. fold (\<lambda>xs. max (length xs)) lss n = fold max (map length lss) n) \<Longrightarrow> fold (\<lambda>xs. max (length xs)) (a # lss) n = fold max (map length (a # lss)) n
[PROOF STEP]
apply(simp; fail)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a lss n. (\<And>n. fold (\<lambda>xs. max (length xs)) lss n = fold max (map length lss) n) \<Longrightarrow> fold (\<lambda>xs. max (length xs)) (a # lss) n = fold max (map length (a # lss)) n
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma isCont_tanh: "cosh x \<noteq> 0 \<Longrightarrow> isCont tanh (x :: 'a :: {real_normed_field, banach})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh x \<noteq> (0::'a) \<Longrightarrow> isCont tanh x
[PROOF STEP]
unfolding tanh_def [abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh x \<noteq> (0::'a) \<Longrightarrow> isCont (\<lambda>x. sinh x / cosh x) x
[PROOF STEP]
by (auto intro!: continuous_intros isCont_divide isCont_sinh isCont_cosh)


[STATEMENT]
theorem regular_Int:
  assumes S: "regular S" and T: "regular T" shows "regular (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. regular (S \<inter> T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. regular (S \<inter> T)
[PROOF STEP]
obtain fsmS fsmT where "S = {xs. accepts fsmS xs}" "T = {xs. accepts fsmT xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>fsmS fsmT. \<lbrakk>S = {xs. accepts fsmS xs}; T = {xs. accepts fsmT xs}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using S T
[PROOF STATE]
proof (prove)
using this:
regular S
regular T

goal (1 subgoal):
 1. (\<And>fsmS fsmT. \<lbrakk>S = {xs. accepts fsmS xs}; T = {xs. accepts fsmT xs}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: regular_def)
[PROOF STATE]
proof (state)
this:
S = {xs. accepts fsmS xs}
T = {xs. accepts fsmT xs}

goal (1 subgoal):
 1. regular (S \<inter> T)
[PROOF STEP]
hence "S \<inter> T = {xs. accepts (Times fsmS fsmT) xs}"
[PROOF STATE]
proof (prove)
using this:
S = {xs. accepts fsmS xs}
T = {xs. accepts fsmT xs}

goal (1 subgoal):
 1. S \<inter> T = {xs. accepts (Times fsmS fsmT) xs}
[PROOF STEP]
by (auto simp: accepts_Times_iff [of fsmS fsmT])
[PROOF STATE]
proof (state)
this:
S \<inter> T = {xs. accepts (Times fsmS fsmT) xs}

goal (1 subgoal):
 1. regular (S \<inter> T)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<inter> T = {xs. accepts (Times fsmS fsmT) xs}

goal (1 subgoal):
 1. regular (S \<inter> T)
[PROOF STEP]
by (metis regular_def)
[PROOF STATE]
proof (state)
this:
regular (S \<inter> T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_compact_bound:
  assumes "compact A" "continuous_on A f"
  obtains B where "B \<ge> 0" "\<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 \<le> B; \<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 \<le> B; \<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms(2,1)
[PROOF STATE]
proof (chain)
picking this:
continuous_on A f
compact A
[PROOF STEP]
have "compact (f ` A)"
[PROOF STATE]
proof (prove)
using this:
continuous_on A f
compact A

goal (1 subgoal):
 1. compact (f ` A)
[PROOF STEP]
by (rule compact_continuous_image)
[PROOF STATE]
proof (state)
this:
compact (f ` A)

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 \<le> B; \<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compact (f ` A)
[PROOF STEP]
obtain B where "\<forall>x\<in>A. norm (f x) \<le> B"
[PROOF STATE]
proof (prove)
using this:
compact (f ` A)

goal (1 subgoal):
 1. (\<And>B. \<forall>x\<in>A. norm (f x) \<le> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto dest!: compact_imp_bounded simp: bounded_iff)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>A. norm (f x) \<le> B

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 \<le> B; \<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
hence "max B 0 \<ge> 0" and "\<forall>x\<in>A. norm (f x) \<le> max B 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>A. norm (f x) \<le> B

goal (1 subgoal):
 1. 0 \<le> max B 0 &&& \<forall>x\<in>A. norm (f x) \<le> max B 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> max B 0
\<forall>x\<in>A. norm (f x) \<le> max B 0

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 \<le> B; \<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> max B 0
\<forall>x\<in>A. norm (f x) \<le> max B 0

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 \<le> max B 0
\<forall>x\<in>A. norm (f x) \<le> max B 0
\<lbrakk>0 \<le> ?B; \<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> ?B\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_path_component:
  fixes S :: "'a::real_normed_vector set"
  assumes "open S"
  shows "open (path_component_set S x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (path_component_set S x)
[PROOF STEP]
unfolding open_contains_ball
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xa\<in>path_component_set S x. \<exists>e>0. ball xa e \<subseteq> path_component_set S x
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> path_component_set S x \<Longrightarrow> \<exists>e>0. ball xa e \<subseteq> path_component_set S x
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> path_component_set S x \<Longrightarrow> \<exists>e>0. ball xa e \<subseteq> path_component_set S x
[PROOF STEP]
assume as: "y \<in> path_component_set S x"
[PROOF STATE]
proof (state)
this:
y \<in> path_component_set S x

goal (1 subgoal):
 1. \<And>xa. xa \<in> path_component_set S x \<Longrightarrow> \<exists>e>0. ball xa e \<subseteq> path_component_set S x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> path_component_set S x
[PROOF STEP]
have "y \<in> S"
[PROOF STATE]
proof (prove)
using this:
y \<in> path_component_set S x

goal (1 subgoal):
 1. y \<in> S
[PROOF STEP]
by (simp add: path_component_mem(2))
[PROOF STATE]
proof (state)
this:
y \<in> S

goal (1 subgoal):
 1. \<And>xa. xa \<in> path_component_set S x \<Longrightarrow> \<exists>e>0. ball xa e \<subseteq> path_component_set S x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> S
[PROOF STEP]
obtain e where e: "e > 0" "ball y e \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
y \<in> S

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; ball y e \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms openE
[PROOF STATE]
proof (prove)
using this:
y \<in> S
open S
\<lbrakk>open ?S; ?x \<in> ?S; \<And>e. \<lbrakk>0 < e; ball ?x e \<subseteq> ?S\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; ball y e \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < e
ball y e \<subseteq> S

goal (1 subgoal):
 1. \<And>xa. xa \<in> path_component_set S x \<Longrightarrow> \<exists>e>0. ball xa e \<subseteq> path_component_set S x
[PROOF STEP]
have "\<And>u. dist y u < e \<Longrightarrow> path_component S x u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. dist y u < e \<Longrightarrow> path_component S x u
[PROOF STEP]
by (metis (full_types) as centre_in_ball convex_ball convex_imp_path_connected e mem_Collect_eq mem_ball path_component_eq path_component_of_subset path_connected_component)
[PROOF STATE]
proof (state)
this:
dist y ?u < e \<Longrightarrow> path_component S x ?u

goal (1 subgoal):
 1. \<And>xa. xa \<in> path_component_set S x \<Longrightarrow> \<exists>e>0. ball xa e \<subseteq> path_component_set S x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist y ?u < e \<Longrightarrow> path_component S x ?u
[PROOF STEP]
show "\<exists>e > 0. ball y e \<subseteq> path_component_set S x"
[PROOF STATE]
proof (prove)
using this:
dist y ?u < e \<Longrightarrow> path_component S x ?u

goal (1 subgoal):
 1. \<exists>e>0. ball y e \<subseteq> path_component_set S x
[PROOF STEP]
using \<open>e>0\<close>
[PROOF STATE]
proof (prove)
using this:
dist y ?u < e \<Longrightarrow> path_component S x ?u
0 < e

goal (1 subgoal):
 1. \<exists>e>0. ball y e \<subseteq> path_component_set S x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>e>0. ball y e \<subseteq> path_component_set S x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lead_coeff_power: "lead_coeff (p ^ n) = lead_coeff p ^ n"
  for p :: "'a::{comm_semiring_1,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (p ^ n) = lead_coeff p ^ n
[PROOF STEP]
by (induct n) (simp_all add: lead_coeff_mult)


[STATEMENT]
lemma vfsequences_on_vsubset_mono:
  assumes "A \<subseteq>\<^sub>\<circ> B "
  shows "vfsequences_on A \<subseteq>\<^sub>\<circ> vfsequences_on B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vfsequences_on A \<subseteq>\<^sub>\<circ> vfsequences_on B
[PROOF STEP]
proof(intro vsubsetI vfsequences_onI; elim vfsequences_onE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>vfsequence x; \<And>i. i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A\<rbrakk> \<Longrightarrow> vfsequence x
 2. \<And>x i. \<lbrakk>i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x; vfsequence x; \<And>i. i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A\<rbrakk> \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> B
[PROOF STEP]
fix i xs
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>vfsequence x; \<And>i. i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A\<rbrakk> \<Longrightarrow> vfsequence x
 2. \<And>x i. \<lbrakk>i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x; vfsequence x; \<And>i. i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A\<rbrakk> \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> B
[PROOF STEP]
assume prems: "i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> xs" "\<And>i. i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> xs \<Longrightarrow> xs\<lparr>i\<rparr> \<in>\<^sub>\<circ> A"
[PROOF STATE]
proof (state)
this:
i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> xs
?i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> xs \<Longrightarrow> xs\<lparr>?i\<rparr> \<in>\<^sub>\<circ> A

goal (2 subgoals):
 1. \<And>x. \<lbrakk>vfsequence x; \<And>i. i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A\<rbrakk> \<Longrightarrow> vfsequence x
 2. \<And>x i. \<lbrakk>i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x; vfsequence x; \<And>i. i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A\<rbrakk> \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> B
[PROOF STEP]
from assms prems(2)[OF prems(1)]
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq>\<^sub>\<circ> B
xs\<lparr>i\<rparr> \<in>\<^sub>\<circ> A
[PROOF STEP]
show "xs\<lparr>i\<rparr> \<in>\<^sub>\<circ> B"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq>\<^sub>\<circ> B
xs\<lparr>i\<rparr> \<in>\<^sub>\<circ> A

goal (1 subgoal):
 1. xs\<lparr>i\<rparr> \<in>\<^sub>\<circ> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs\<lparr>i\<rparr> \<in>\<^sub>\<circ> B

goal (1 subgoal):
 1. \<And>x. \<lbrakk>vfsequence x; \<And>i. i \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> x \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A\<rbrakk> \<Longrightarrow> vfsequence x
[PROOF STEP]
qed


[STATEMENT]
lemma of_nat_ffact:
  "of_nat (ffact n m) = ffact n (of_nat m :: 'a :: comm_ring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (ffact n m) = ffact n (of_nat m)
[PROOF STEP]
proof (induct n arbitrary: m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. of_nat (ffact 0 m) = ffact 0 (of_nat m)
 2. \<And>n m. (\<And>m. of_nat (ffact n m) = ffact n (of_nat m)) \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>m. of_nat (ffact 0 m) = ffact 0 (of_nat m)
 2. \<And>n m. (\<And>m. of_nat (ffact n m) = ffact n (of_nat m)) \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (ffact 0 m) = ffact 0 (of_nat m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_nat (ffact 0 m) = ffact 0 (of_nat m)

goal (1 subgoal):
 1. \<And>n m. (\<And>m. of_nat (ffact n m) = ffact n (of_nat m)) \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. (\<And>m. of_nat (ffact n m) = ffact n (of_nat m)) \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
of_nat (ffact n ?m) = ffact n (of_nat ?m)

goal (1 subgoal):
 1. \<And>n m. (\<And>m. of_nat (ffact n m) = ffact n (of_nat m)) \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
proof (cases m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
 2. \<And>nat. m = Suc nat \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
m = 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
 2. \<And>nat. m = Suc nat \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = 0

goal (1 subgoal):
 1. of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
by (simp add: ffact_Suc_nat ffact_Suc)
[PROOF STATE]
proof (state)
this:
of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
ma__ = Suc m

goal (1 subgoal):
 1. \<And>nat. ma__ = Suc nat \<Longrightarrow> of_nat (ffact (Suc n) ma__) = ffact (Suc n) (of_nat ma__)
[PROOF STEP]
with Suc.hyps
[PROOF STATE]
proof (chain)
picking this:
of_nat (ffact n ?m) = ffact n (of_nat ?m)
ma__ = Suc m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
of_nat (ffact n ?m) = ffact n (of_nat ?m)
ma__ = Suc m

goal (1 subgoal):
 1. of_nat (ffact (Suc n) ma__) = ffact (Suc n) (of_nat ma__)
[PROOF STEP]
by (simp add: algebra_simps ffact_Suc_nat ffact_Suc)
[PROOF STATE]
proof (state)
this:
of_nat (ffact (Suc n) ma__) = ffact (Suc n) (of_nat ma__)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_nat (ffact (Suc n) m) = ffact (Suc n) (of_nat m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_fps_X_power [simp]:
  "eval_fps (fps_X ^ m :: 'a :: {banach, real_normed_div_algebra} fps) z = z ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fps (fps_X ^ m) z = z ^ m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_fps (fps_X ^ m) z = z ^ m
[PROOF STEP]
have "(\<lambda>n::nat. if n \<in> {m} then z ^ n else 0 :: 'a) sums (\<Sum>n\<in>{m::nat}. z ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n \<in> {m} then z ^ n else (0::'a)) sums sum ((^) z) {m}
[PROOF STEP]
by (rule sums_If_finite_set) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> {m} then z ^ n else (0::'a)) sums sum ((^) z) {m}

goal (1 subgoal):
 1. eval_fps (fps_X ^ m) z = z ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> {m} then z ^ n else (0::'a)) sums sum ((^) z) {m}

goal (1 subgoal):
 1. eval_fps (fps_X ^ m) z = z ^ m
[PROOF STEP]
have "?this \<longleftrightarrow> (\<lambda>n::nat. fps_nth (fps_X ^ m) n * z ^ n) sums (\<Sum>n\<in>{m::nat}. z ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n \<in> {m} then z ^ n else (0::'a)) sums sum ((^) z) {m} = (\<lambda>n. fps_nth (fps_X ^ m) n * z ^ n) sums sum ((^) z) {m}
[PROOF STEP]
by (intro sums_cong) (auto simp: fps_X_power_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> {m} then z ^ n else (0::'a)) sums sum ((^) z) {m} = (\<lambda>n. fps_nth (fps_X ^ m) n * z ^ n) sums sum ((^) z) {m}

goal (1 subgoal):
 1. eval_fps (fps_X ^ m) z = z ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> {m} then z ^ n else (0::'a)) sums sum ((^) z) {m} = (\<lambda>n. fps_nth (fps_X ^ m) n * z ^ n) sums sum ((^) z) {m}

goal (1 subgoal):
 1. eval_fps (fps_X ^ m) z = z ^ m
[PROOF STEP]
have "(\<Sum>n\<in>{m::nat}. z ^ n) = z ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) z) {m} = z ^ m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((^) z) {m} = z ^ m

goal (1 subgoal):
 1. eval_fps (fps_X ^ m) z = z ^ m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. fps_nth (fps_X ^ m) n * z ^ n) sums z ^ m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. fps_nth (fps_X ^ m) n * z ^ n) sums z ^ m

goal (1 subgoal):
 1. eval_fps (fps_X ^ m) z = z ^ m
[PROOF STEP]
by (simp add: eval_fps_def sums_iff)
[PROOF STATE]
proof (state)
this:
eval_fps (fps_X ^ m) z = z ^ m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma univ_predicate_impl_forall:
  assumes "equiv A R"
  assumes "P respects R"
  assumes "X \<in> A // R"
  assumes "univ P X"
  shows "\<forall>x\<in>X. P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>X. P x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x\<in>X. P x
[PROOF STEP]
from assms(1,3)
[PROOF STATE]
proof (chain)
picking this:
equiv A R
X \<in> A // R
[PROOF STEP]
obtain x where "x \<in> X"
[PROOF STATE]
proof (prove)
using this:
equiv A R
X \<in> A // R

goal (1 subgoal):
 1. (\<And>x. x \<in> X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis equiv_class_self quotientE)
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (1 subgoal):
 1. \<forall>x\<in>X. P x
[PROOF STEP]
from \<open>x \<in> X\<close> assms(1,3)
[PROOF STATE]
proof (chain)
picking this:
x \<in> X
equiv A R
X \<in> A // R
[PROOF STEP]
have "X = R `` {x}"
[PROOF STATE]
proof (prove)
using this:
x \<in> X
equiv A R
X \<in> A // R

goal (1 subgoal):
 1. X = R `` {x}
[PROOF STEP]
by (metis Image_singleton_iff equiv_class_eq quotientE)
[PROOF STATE]
proof (state)
this:
X = R `` {x}

goal (1 subgoal):
 1. \<forall>x\<in>X. P x
[PROOF STEP]
from assms(1,2,4) this
[PROOF STATE]
proof (chain)
picking this:
equiv A R
P respects R
univ P X
X = R `` {x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
equiv A R
P respects R
univ P X
X = R `` {x}

goal (1 subgoal):
 1. \<forall>x\<in>X. P x
[PROOF STEP]
using equiv_class_eq_iff univ_commute'
[PROOF STATE]
proof (prove)
using this:
equiv A R
P respects R
univ P X
X = R `` {x}
equiv ?A ?r \<Longrightarrow> ((?x, ?y) \<in> ?r) = (?r `` {?x} = ?r `` {?y} \<and> ?x \<in> ?A \<and> ?y \<in> ?A)
\<lbrakk>equiv ?A ?r; ?f respects ?r; ?x \<in> ?A\<rbrakk> \<Longrightarrow> univ ?f (?r `` {?x}) = ?f ?x

goal (1 subgoal):
 1. \<forall>x\<in>X. P x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>X. P x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_rev_upt [simp]: "j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
assume jk_i: "j + k < i"
[PROOF STATE]
proof (state)
this:
j + k < i

goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
have "[i>..j] = rev [j..<i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [i>..j] = rev [j..<i]
[PROOF STEP]
using rev_upt_upt
[PROOF STATE]
proof (prove)
using this:
rev [?i..<?j] = [?j>..?i]

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

goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[i>..j] = rev [j..<i]

goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
have "... ! k = [j..<i] ! (length [j..<i] - 1 - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev [j..<i] ! k = [j..<i] ! (length [j..<i] - 1 - k)
[PROOF STEP]
using jk_i
[PROOF STATE]
proof (prove)
using this:
j + k < i

goal (1 subgoal):
 1. rev [j..<i] ! k = [j..<i] ! (length [j..<i] - 1 - k)
[PROOF STEP]
by (simp add: rev_nth)
[PROOF STATE]
proof (state)
this:
rev [j..<i] ! k = [j..<i] ! (length [j..<i] - 1 - k)

goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rev [j..<i] ! k = [j..<i] ! (length [j..<i] - 1 - k)

goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
have "... = [j..<i] ! (i - j - 1 - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [j..<i] ! (length [j..<i] - 1 - k) = [j..<i] ! (i - j - 1 - k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[j..<i] ! (length [j..<i] - 1 - k) = [j..<i] ! (i - j - 1 - k)

goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[j..<i] ! (length [j..<i] - 1 - k) = [j..<i] ! (i - j - 1 - k)

goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
have "... = j + (i - j - 1 - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [j..<i] ! (i - j - 1 - k) = j + (i - j - 1 - k)
[PROOF STEP]
by (rule nth_upt, insert jk_i, auto)
[PROOF STATE]
proof (state)
this:
[j..<i] ! (i - j - 1 - k) = j + (i - j - 1 - k)

goal (1 subgoal):
 1. j + k < i \<Longrightarrow> [i>..j] ! k = i - 1 - k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[i>..j] ! k = j + (i - j - 1 - k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[i>..j] ! k = j + (i - j - 1 - k)

goal (1 subgoal):
 1. [i>..j] ! k = i - 1 - k
[PROOF STEP]
using jk_i
[PROOF STATE]
proof (prove)
using this:
[i>..j] ! k = j + (i - j - 1 - k)
j + k < i

goal (1 subgoal):
 1. [i>..j] ! k = i - 1 - k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[i>..j] ! k = i - 1 - k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma alg_dvd_diff [intro]:
  fixes x y z :: "'a :: field_char_0"
  shows "x alg_dvd y \<Longrightarrow> x alg_dvd z \<Longrightarrow> x alg_dvd (y - z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x alg_dvd y; x alg_dvd z\<rbrakk> \<Longrightarrow> x alg_dvd y - z
[PROOF STEP]
unfolding alg_dvd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(x = (0::'a) \<longrightarrow> y = (0::'a)) \<and> algebraic_int (y / x); (x = (0::'a) \<longrightarrow> z = (0::'a)) \<and> algebraic_int (z / x)\<rbrakk> \<Longrightarrow> (x = (0::'a) \<longrightarrow> y - z = (0::'a)) \<and> algebraic_int ((y - z) / x)
[PROOF STEP]
by (auto simp: diff_divide_distrib)


[STATEMENT]
lemma div_gcd_dvd1: "(a :: 'a :: semiring_gcd) div gcd a b dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a div gcd a b dvd a
[PROOF STEP]
by (metis dvd_def dvd_div_mult_self gcd_dvd1)


[STATEMENT]
lemma dyad_rec_41 [simp]: "dyad_rec b l r ((4 * real m + 1) / 2 ^ (Suc n)) = l (dyad_rec b l r ((2*m + 1) / 2^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dyad_rec b l r ((4 * real m + 1) / 2 ^ Suc n) = l (dyad_rec b l r ((2 * real m + 1) / 2 ^ n))
[PROOF STEP]
proof (rule dyad_rec.psimps)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dyad_rec_dom (b, l, r, (4 * real m + 1) / 2 ^ Suc n)
[PROOF STEP]
show "dyad_rec_dom (b, l, r, (4 * real m + 1) / 2 ^ Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dyad_rec_dom (b, l, r, (4 * real m + 1) / 2 ^ Suc n)
[PROOF STEP]
by (metis add.commute dyad_rec_level_termination lessI of_nat_Suc of_nat_mult of_nat_numeral)
[PROOF STATE]
proof (state)
this:
dyad_rec_dom (b, l, r, (4 * real m + 1) / 2 ^ Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stc_mult:
  "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk>
               \<Longrightarrow> stc (x * y) = stc(x) * stc(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> stc (x * y) = stc x * stc y
[PROOF STEP]
by (simp add: stc_unique stc_SComplex stc_approx_self approx_mult_HFinite)


[STATEMENT]
lemma cosine_sum_lemma:
   "(1/2 + (\<Sum>k = Suc 0..n. cos(real k * x))) * sin(x/2) =  sin((real n + 1/2) * x) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
consider "n=0" | "n \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n = 0 \<Longrightarrow> thesis; 1 \<le> n \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = 0 \<Longrightarrow> ?thesis; 1 \<le> n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>n = 0 \<Longrightarrow> ?thesis; 1 \<le> n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = 0 \<Longrightarrow> ?thesis; 1 \<le> n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
 2. 1 \<le> n \<Longrightarrow> (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
1 \<le> n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
 2. 1 \<le> n \<Longrightarrow> (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> n
[PROOF STEP]
have "(\<Sum>k = Suc 0..n. (sin (real k * x + x/2) * 2 - sin (real k * x - x/2) * 2) / 2)
        = sin (real n * x + x/2) - sin (x/2)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 \<le> 0 \<Longrightarrow> (\<Sum>k = Suc 0..0. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real 0 * x + x / 2) - sin (x / 2)
 2. \<And>n. \<lbrakk>1 \<le> n \<Longrightarrow> (\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2); 1 \<le> Suc n\<rbrakk> \<Longrightarrow> (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
1 \<le> n \<Longrightarrow> (\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2)
1 \<le> Suc n

goal (2 subgoals):
 1. 1 \<le> 0 \<Longrightarrow> (\<Sum>k = Suc 0..0. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real 0 * x + x / 2) - sin (x / 2)
 2. \<And>n. \<lbrakk>1 \<le> n \<Longrightarrow> (\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2); 1 \<le> Suc n\<rbrakk> \<Longrightarrow> (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
[PROOF STEP]
proof (cases "n=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
 2. n \<noteq> 0 \<Longrightarrow> (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
 2. n \<noteq> 0 \<Longrightarrow> (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
[PROOF STEP]
with Suc
[PROOF STATE]
proof (chain)
picking this:
1 \<le> n \<Longrightarrow> (\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2)
1 \<le> Suc n
n \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<le> n \<Longrightarrow> (\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2)
1 \<le> Suc n
n \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
[PROOF STEP]
by (simp add: divide_simps algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real (Suc n) * x + x / 2) - sin (x / 2)

goal (1 subgoal):
 1. 1 \<le> 0 \<Longrightarrow> (\<Sum>k = Suc 0..0. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real 0 * x + x / 2) - sin (x / 2)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
 2. 1 \<le> n \<Longrightarrow> (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = Suc 0..n. (sin (real k * x + x / 2) * 2 - sin (real k * x - x / 2) * 2) / 2) = sin (real n * x + x / 2) - sin (x / 2)

goal (1 subgoal):
 1. (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
by (simp add: distrib_right sum_distrib_right cos_times_sin)
[PROOF STATE]
proof (state)
this:
(1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> (1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(1 / 2 + (\<Sum>k = Suc 0..n. cos (real k * x))) * sin (x / 2) = sin ((real n + 1 / 2) * x) / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ucl_iff: "(\<forall>a A B. (a,A) \<in> R \<and> A \<subseteq> B \<longrightarrow> (a,B) \<in> R) \<longleftrightarrow> R \<parallel> U = R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a A B. (a, A) \<in> R \<and> A \<subseteq> B \<longrightarrow> (a, B) \<in> R) = (R \<parallel> Multirelations.U = R)
[PROOF STEP]
by (clarsimp simp: mr_simp, blast)


[STATEMENT]
theorem "\<not> (\<forall>j (i::int). j \<le> i \<longrightarrow> (\<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>j i. j \<le> i \<longrightarrow> (\<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i))
[PROOF STEP]
by cooper


[STATEMENT]
lemma sds_anonymous_neutral':
  assumes perm: "\<sigma> permutes alts" and wf: "is_pref_profile R1" "is_pref_profile R2"
  assumes eq: "anonymous_profile R1 =
                 image_mset (map ((`) \<sigma>)) (anonymous_profile R2)"
  shows   "pmf (sds R1) (\<sigma> x) = pmf (sds R2) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (sds R1) (\<sigma> x) = pmf (sds R2) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf (sds R1) (\<sigma> x) = pmf (sds R2) x
[PROOF STEP]
have "sds R1 = map_pmf \<sigma> (sds R2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sds R1 = map_pmf \<sigma> (sds R2)
[PROOF STEP]
by (intro sds_anonymous_neutral) fact+
[PROOF STATE]
proof (state)
this:
sds R1 = map_pmf \<sigma> (sds R2)

goal (1 subgoal):
 1. pmf (sds R1) (\<sigma> x) = pmf (sds R2) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sds R1 = map_pmf \<sigma> (sds R2)

goal (1 subgoal):
 1. pmf (sds R1) (\<sigma> x) = pmf (sds R2) x
[PROOF STEP]
have "pmf \<dots> (\<sigma> x) = pmf (sds R2) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (map_pmf \<sigma> (sds R2)) (\<sigma> x) = pmf (sds R2) x
[PROOF STEP]
by (intro pmf_map_inj' permutes_inj[OF perm])
[PROOF STATE]
proof (state)
this:
pmf (map_pmf \<sigma> (sds R2)) (\<sigma> x) = pmf (sds R2) x

goal (1 subgoal):
 1. pmf (sds R1) (\<sigma> x) = pmf (sds R2) x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pmf (sds R1) (\<sigma> x) = pmf (sds R2) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pmf (sds R1) (\<sigma> x) = pmf (sds R2) x

goal (1 subgoal):
 1. pmf (sds R1) (\<sigma> x) = pmf (sds R2) x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
pmf (sds R1) (\<sigma> x) = pmf (sds R2) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enc_atom_lang_Arbitrary_Except_True: "\<lbrakk>r < length I;
   case I ! r of Inl p' \<Rightarrow> p = p' | Inr P \<Rightarrow> p \<in> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow>
  [enc_atom I p a] \<in> lang n (Atom (Arbitrary_Except r True))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r < length I; case I ! r of Inl p' \<Rightarrow> p = p' | Inr P \<Rightarrow> p \<in> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> [enc_atom I p a] \<in> lang n (Atom (Arbitrary_Except r True))
[PROOF STEP]
unfolding lang.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r < length I; case I ! r of Inl p' \<Rightarrow> p = p' | Inr P \<Rightarrow> p \<in> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> [enc_atom I p a] \<in> {[x] |x. lookup (Arbitrary_Except r True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}
[PROOF STEP]
by (force intro!: enc_atom_bool_take_drop_True
    image_eqI[of _ _ "(\<lambda>J. take r J @ drop (r + 1) J) (enc_atom_bool I p)"]
    simp: \<sigma>_def set_n_lists)


[STATEMENT]
lemma prob_reachable_le:
  assumes [simp]: "m \<le> n"
  shows "p x y m * p y w (n - m) \<le> p x w n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p x y m * p y w (n - m) \<le> p x w n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p x y m * p y w (n - m) \<le> p x w n
[PROOF STEP]
have "p x y m * p y w (n - m) = (\<integral>\<^sup>+y'. ennreal (p x y m * p y w (n - m)) * indicator {y} y' \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (p x y m * p y w (n - m)) = \<integral>\<^sup>+y'\<in>{y}. ennreal (p x y m * p y w (n - m))\<partial>count_space UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ennreal (p x y m * p y w (n - m)) = \<integral>\<^sup>+y'\<in>{y}. ennreal (p x y m * p y w (n - m))\<partial>count_space UNIV

goal (1 subgoal):
 1. p x y m * p y w (n - m) \<le> p x w n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (p x y m * p y w (n - m)) = \<integral>\<^sup>+y'\<in>{y}. ennreal (p x y m * p y w (n - m))\<partial>count_space UNIV

goal (1 subgoal):
 1. p x y m * p y w (n - m) \<le> p x w n
[PROOF STEP]
have "\<dots> \<le> p x w (m + (n - m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+y'\<in>{y}. ennreal (p x y m * p y w (n - m))\<partial>count_space UNIV \<le> ennreal (p x w (m + (n - m)))
[PROOF STEP]
by (subst p_add)
       (auto intro!: nn_integral_mono split: split_indicator simp del: nn_integral_indicator_singleton)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+y'\<in>{y}. ennreal (p x y m * p y w (n - m))\<partial>count_space UNIV \<le> ennreal (p x w (m + (n - m)))

goal (1 subgoal):
 1. p x y m * p y w (n - m) \<le> p x w n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (p x y m * p y w (n - m)) \<le> ennreal (p x w (m + (n - m)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (p x y m * p y w (n - m)) \<le> ennreal (p x w (m + (n - m)))

goal (1 subgoal):
 1. p x y m * p y w (n - m) \<le> p x w n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p x y m * p y w (n - m) \<le> p x w n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quotient_group_UN: "quotient_group H = (\<lambda>g. \<lceil>g|H\<rceil>) ` G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quotient_group H = (\<lambda>g. BinOpSetGroup.Abs_G_perm (G // LCoset_rel H) (+) (LCoset_rel H `` {g})) ` G
[PROOF STEP]
using natural_quotient_hom_image
[PROOF STATE]
proof (prove)
using this:
(\<lambda>a. if a \<in> G then BinOpSetGroup.Abs_G_perm (G // LCoset_rel ?H) (+) (LCoset_rel ?H `` {a}) else 0) ` G = quotient_group ?H

goal (1 subgoal):
 1. quotient_group H = (\<lambda>g. BinOpSetGroup.Abs_G_perm (G // LCoset_rel H) (+) (LCoset_rel H `` {g})) ` G
[PROOF STEP]
by auto


[STATEMENT]
lemma condition_2_part_2:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  defines ia:"ia\<equiv>(if \<forall>m. is_zero_row_upt_k m k A then 0 else to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1)"
  defines B:"B\<equiv>(snd (Gauss_Jordan_column_k (ia,A) k))"
  assumes not_zero_i_suc_k: "\<not> is_zero_row_upt_k i (Suc k) B"
  and all_zero: "\<forall>m. is_zero_row_upt_k m k A"
  and Amk_not_zero: "A $ m $ from_nat k \<noteq> 0"
  shows "Gauss_Jordan_in_ij A 0 (from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A 0 (from_nat k) $ i $ ka \<noteq> 0) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
have ia2: "ia = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia = 0
[PROOF STEP]
unfolding ia
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1) = 0
[PROOF STEP]
using all_zero
[PROOF STATE]
proof (prove)
using this:
\<forall>m. is_zero_row_upt_k m k A

goal (1 subgoal):
 1. (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ia = 0

goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
have B_eq: "B = Gauss_Jordan_in_ij A 0 (from_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
unfolding B Gauss_Jordan_column_k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (let i = fst (ia, A); A = snd (ia, A); from_nat_i = mod_type_class.from_nat i; from_nat_k = mod_type_class.from_nat k in if (\<forall>m\<ge>from_nat_i. A $ m $ from_nat_k = (0::'a)) \<or> i = nrows A then (i, A) else (i + 1, Gauss_Jordan_in_ij A from_nat_i from_nat_k)) = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
unfolding ia2 Let_def fst_conv snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat 0) (mod_type_class.from_nat k))) = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
using Amk_not_zero least_mod_type
[PROOF STATE]
proof (prove)
using this:
A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)
(0::?'a) \<le> ?n

goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat 0) (mod_type_class.from_nat k))) = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
unfolding from_nat_0 nrows_def
[PROOF STATE]
proof (prove)
using this:
A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)
(0::?'a) \<le> ?n

goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>0::'rows. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = CARD('rows) then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))) = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)

goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
have i_eq_0: "i=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = (0::'rows)
[PROOF STEP]
using Amk_not_zero B_eq all_zero condition_1_part_2 from_nat_0 not_zero_i_suc_k
[PROOF STATE]
proof (prove)
using this:
A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)
B = Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k)
\<forall>m. is_zero_row_upt_k m k A
\<lbrakk>?j \<noteq> (0::?'rows); \<forall>m. is_zero_row_upt_k m ?k ?A; ?A $ ?m $ mod_type_class.from_nat ?k \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> is_zero_row_upt_k ?j (Suc ?k) (Gauss_Jordan_in_ij ?A (mod_type_class.from_nat 0) (mod_type_class.from_nat ?k))
mod_type_class.from_nat 0 = (0::?'a)
\<not> is_zero_row_upt_k i (Suc k) B

goal (1 subgoal):
 1. i = (0::'rows)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
i = (0::'rows)

goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
have Least_eq: "(LEAST ka. Gauss_Jordan_in_ij A 0 (from_nat k) $ i $ ka \<noteq> 0) = from_nat k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = mod_type_class.from_nat k
[PROOF STEP]
proof (rule Least_equality)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. \<And>y. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ y \<noteq> (0::'a) \<Longrightarrow> mod_type_class.from_nat k \<le> y
[PROOF STEP]
have "Gauss_Jordan_in_ij A 0 (from_nat k) $ 0 $ from_nat k = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)
[PROOF STEP]
using Gauss_Jordan_in_ij_1 Amk_not_zero least_mod_type
[PROOF STATE]
proof (prove)
using this:
\<exists>n. ?A $ n $ ?j \<noteq> (0::?'a) \<and> ?i \<le> n \<Longrightarrow> Gauss_Jordan_in_ij ?A ?i ?j $ ?i $ ?j = (1::?'a)
A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)
(0::?'a) \<le> ?n

goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)

goal (2 subgoals):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. \<And>y. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ y \<noteq> (0::'a) \<Longrightarrow> mod_type_class.from_nat k \<le> y
[PROOF STEP]
thus "Gauss_Jordan_in_ij A 0 (from_nat k) $ i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)

goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
unfolding i_eq_0
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)

goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. \<And>y. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ y \<noteq> (0::'a) \<Longrightarrow> mod_type_class.from_nat k \<le> y
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ y \<noteq> (0::'a) \<Longrightarrow> mod_type_class.from_nat k \<le> y
[PROOF STEP]
assume not_zero_gauss: "Gauss_Jordan_in_ij A 0 (from_nat k) $ i $ y \<noteq> 0"
[PROOF STATE]
proof (state)
this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ y \<noteq> (0::'a)

goal (1 subgoal):
 1. \<And>y. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ y \<noteq> (0::'a) \<Longrightarrow> mod_type_class.from_nat k \<le> y
[PROOF STEP]
show "from_nat k \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat k \<le> y
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> mod_type_class.from_nat k \<le> y \<Longrightarrow> False
[PROOF STEP]
assume "\<not> from_nat k \<le> y"
[PROOF STATE]
proof (state)
this:
\<not> mod_type_class.from_nat k \<le> y

goal (1 subgoal):
 1. \<not> mod_type_class.from_nat k \<le> y \<Longrightarrow> False
[PROOF STEP]
hence y: "y < from_nat k"
[PROOF STATE]
proof (prove)
using this:
\<not> mod_type_class.from_nat k \<le> y

goal (1 subgoal):
 1. y < mod_type_class.from_nat k
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
y < mod_type_class.from_nat k

goal (1 subgoal):
 1. \<not> mod_type_class.from_nat k \<le> y \<Longrightarrow> False
[PROOF STEP]
have "Gauss_Jordan_in_ij A 0 (from_nat k) $ 0 $ y = A $ 0 $ y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ y = A $ (0::'rows) $ y
[PROOF STEP]
by (rule Gauss_Jordan_in_ij_preserves_previous_elements'[OF all_zero to_nat_le[OF y] Amk_not_zero])
[PROOF STATE]
proof (state)
this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ y = A $ (0::'rows) $ y

goal (1 subgoal):
 1. \<not> mod_type_class.from_nat k \<le> y \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ y = A $ (0::'rows) $ y

goal (1 subgoal):
 1. \<not> mod_type_class.from_nat k \<le> y \<Longrightarrow> False
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ (0::'rows) $ y = (0::'a)
[PROOF STEP]
using all_zero to_nat_le[OF y]
[PROOF STATE]
proof (prove)
using this:
\<forall>m. is_zero_row_upt_k m k A
mod_type_class.to_nat y < k

goal (1 subgoal):
 1. A $ (0::'rows) $ y = (0::'a)
[PROOF STEP]
unfolding is_zero_row_upt_k_def
[PROOF STATE]
proof (prove)
using this:
\<forall>m j. mod_type_class.to_nat j < k \<longrightarrow> A $ m $ j = (0::'a)
mod_type_class.to_nat y < k

goal (1 subgoal):
 1. A $ (0::'rows) $ y = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A $ (0::'rows) $ y = (0::'a)

goal (1 subgoal):
 1. \<not> mod_type_class.from_nat k \<le> y \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ y = (0::'a)
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ y = (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
using not_zero_gauss
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ y = (0::'a)
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ y \<noteq> (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding i_eq_0
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ y = (0::'a)
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ y \<noteq> (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat k \<le> y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = mod_type_class.from_nat k

goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
unfolding Least_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ mod_type_class.from_nat k = (1::'a)
[PROOF STEP]
unfolding i_eq_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)
[PROOF STEP]
by (rule Gauss_Jordan_in_ij_1, auto intro!: Amk_not_zero least_mod_type)
[PROOF STATE]
proof (state)
this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ (LEAST ka. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ i $ ka \<noteq> (0::'a)) = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma DirProds_order:
  assumes "finite I"
  shows "order (DirProds G I) = prod (order \<circ> G) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (DirProds G I) = prod (order \<circ> G) I
[PROOF STEP]
unfolding order_def DirProds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier \<lparr>carrier = Pi\<^sub>E I (carrier \<circ> G), monoid.mult = \<lambda>x y. \<lambda>i\<in>I. x i \<otimes>\<^bsub>G i\<^esub> y i, one = \<lambda>i\<in>I. \<one>\<^bsub>G i\<^esub>\<rparr>) = prod ((\<lambda>S. card (carrier S)) \<circ> G) I
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I

goal (1 subgoal):
 1. card (carrier \<lparr>carrier = Pi\<^sub>E I (carrier \<circ> G), monoid.mult = \<lambda>x y. \<lambda>i\<in>I. x i \<otimes>\<^bsub>G i\<^esub> y i, one = \<lambda>i\<in>I. \<one>\<^bsub>G i\<^esub>\<rparr>) = prod ((\<lambda>S. card (carrier S)) \<circ> G) I
[PROOF STEP]
by (simp add: card_PiE)


[STATEMENT]
lemma ivl_integral_has_vector_derivative:
  fixes f :: "real \<Rightarrow> 'a::banach"
  assumes "continuous_on (closed_segment a b) f"
    and "x \<in> closed_segment a b"
  shows "((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)
[PROOF STEP]
have "((\<lambda>x. integral {x..a} f) has_vector_derivative 0) (at x within {a..b})" if "a \<le> x" "x \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. integral {x..a} f) has_vector_derivative (0::'a)) (at x within {a..b})
[PROOF STEP]
by (rule has_vector_derivative_transform) (auto simp: that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {x..a} f) has_vector_derivative (0::'a)) (at x within {a..b})

goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {x..a} f) has_vector_derivative (0::'a)) (at x within {a..b})

goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)
[PROOF STEP]
have "((\<lambda>x. integral {a..x} f) has_vector_derivative 0) (at x within {b..a})" if "b \<le> x" "x \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. integral {a..x} f) has_vector_derivative (0::'a)) (at x within {b..a})
[PROOF STEP]
by (rule has_vector_derivative_transform) (auto simp: that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>b \<le> x; x \<le> a\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {a..x} f) has_vector_derivative (0::'a)) (at x within {b..a})

goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {x..a} f) has_vector_derivative (0::'a)) (at x within {a..b})
\<lbrakk>b \<le> x; x \<le> a\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {a..x} f) has_vector_derivative (0::'a)) (at x within {b..a})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {x..a} f) has_vector_derivative (0::'a)) (at x within {a..b})
\<lbrakk>b \<le> x; x \<le> a\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {a..x} f) has_vector_derivative (0::'a)) (at x within {b..a})

goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {x..a} f) has_vector_derivative (0::'a)) (at x within {a..b})
\<lbrakk>b \<le> x; x \<le> a\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral {a..x} f) has_vector_derivative (0::'a)) (at x within {b..a})
continuous_on (closed_segment a b) f
x \<in> closed_segment a b

goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)
[PROOF STEP]
by (auto simp: ivl_integral_def closed_segment_eq_real_ivl
        intro!: derivative_eq_intros
        integral_has_vector_derivative[of a b f] integral_has_vector_derivative[of b a "-f"]
        integral_has_vector_derivative'[of b a f])
[PROOF STATE]
proof (state)
this:
((\<lambda>u. ivl_integral a u f) has_vector_derivative f x) (at x within closed_segment a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dual_all: "(\<forall>x. P (\<partial> x)) \<longleftrightarrow> (\<forall>y. P y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. P (\<partial> x)) = (\<forall>y. P y)
[PROOF STEP]
by (metis dual.collapse)


[STATEMENT]
lemma pfsubset_fcard_mono: "A |\<subset>| B \<Longrightarrow> fcard A < fcard B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A |\<subset>| B \<Longrightarrow> fcard A < fcard B
[PROOF STEP]
by transfer (rule psubset_card_mono)


[STATEMENT]
lemma (in finite_measure) finite_Lim_measure_decseq:
  assumes A: "range A \<subseteq> sets M" "decseq A"
  shows "(\<lambda>n. measure M (A n)) \<longlonglongrightarrow> measure M (\<Inter>i. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. Sigma_Algebra.measure M (A n)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Inter> (range A))
[PROOF STEP]
using Lim_measure_decseq[OF A]
[PROOF STATE]
proof (prove)
using this:
(\<And>i. emeasure M (A i) \<noteq> \<infinity>) \<Longrightarrow> (\<lambda>n. Sigma_Algebra.measure M (A n)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Inter> (range A))

goal (1 subgoal):
 1. (\<lambda>n. Sigma_Algebra.measure M (A n)) \<longlonglongrightarrow> Sigma_Algebra.measure M (\<Inter> (range A))
[PROOF STEP]
by simp