[STATEMENT]
lemma llast_ltake:
  assumes "enat (Suc n) < llength xs"
  shows "llast (ltake (enat (Suc n)) xs) = lnth xs n" (is "llast ?A = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llast (ltake (enat (Suc n)) xs) = lnth xs n
[PROOF STEP]
unfolding llast_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case llength (ltake (enat (Suc n)) xs) of enat (Suc xa) \<Rightarrow> lnth (ltake (enat (Suc n)) xs) xa) = lnth xs n
[PROOF STEP]
using llength_ltake'[OF assms]
[PROOF STATE]
proof (prove)
using this:
llength (ltake (enat (Suc n)) xs) = enat (Suc n)

goal (1 subgoal):
 1. (case llength (ltake (enat (Suc n)) xs) of enat (Suc xa) \<Rightarrow> lnth (ltake (enat (Suc n)) xs) xa) = lnth xs n
[PROOF STEP]
by (auto simp add: lnth_ltake)


[STATEMENT]
lemma expands_to_arctan_ms_pos_exp_pos:
  assumes "e > 0" "trimmed_pos (MS (MSLCons (C, e) xs) g)" "basis_wf basis"
          "(f expands_to MS (MSLCons (C, e) xs) g) basis"
  shows   "((\<lambda>x. arctan (f x)) expands_to MS (minus_ms_aux (const_ms_aux (pi / 2))
             (arctan_ms_aux (inverse_ms_aux (MSLCons (C, e) xs))))
               (\<lambda>x. arctan (g x))) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. arctan (f x)) expands_to MS (minus_ms_aux (const_ms_aux (pi / 2)) (arctan_ms_aux (inverse_ms_aux (MSLCons (C, e) xs)))) (\<lambda>x. arctan (g x))) basis
[PROOF STEP]
using arctan_ms_aux_inf[of "MSLCons (C, e) xs" basis g] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<exists>ea>0. ms_aux_hd_exp (MSLCons (C, e) xs) = Some ea; 0 < fst (dominant_term_ms_aux (MSLCons (C, e) xs)); trimmed_ms_aux (MSLCons (C, e) xs); basis_wf basis; is_expansion_aux (MSLCons (C, e) xs) g basis\<rbrakk> \<Longrightarrow> is_expansion_aux (minus_ms_aux (const_ms_aux (pi / 2)) (arctan_ms_aux (inverse_ms_aux (MSLCons (C, e) xs)))) (\<lambda>x. arctan (g x)) basis
0 < e
trimmed_pos (MS (MSLCons (C, e) xs) g)
basis_wf basis
(f expands_to MS (MSLCons (C, e) xs) g) basis

goal (1 subgoal):
 1. ((\<lambda>x. arctan (f x)) expands_to MS (minus_ms_aux (const_ms_aux (pi / 2)) (arctan_ms_aux (inverse_ms_aux (MSLCons (C, e) xs)))) (\<lambda>x. arctan (g x))) basis
[PROOF STEP]
by (auto simp: expands_to.simps snd_dominant_term_ms_aux_MSLCons o_def
                 dominant_term_ms_aux_MSLCons trimmed_pos_def elim: eventually_mono)


[STATEMENT]
lemma  zmult_gt_one:"\<lbrakk>2 \<le> m; 0 < xa\<rbrakk> \<Longrightarrow> 1 < int m * xa"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>2 \<le> m; 0 < xa\<rbrakk> \<Longrightarrow> 1 < int m * xa
[PROOF STEP]
by (metis ge2_zmult_pos mult.commute)


[STATEMENT]
lemma ord_congruence_set_memI:
  assumes "x \<in> nonzero Q\<^sub>p"
  assumes "ord x mod n = a"
  shows "x \<in> ord_congruence_set n a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> ord_congruence_set n a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p
ord x mod n = a

goal (1 subgoal):
 1. x \<in> ord_congruence_set n a
[PROOF STEP]
by (metis (mono_tags, lifting) mem_Collect_eq ord_congruence_set_def)


[STATEMENT]
lemma ftranclD2:
  "(x, y) |\<in>| R|\<^sup>+| \<Longrightarrow> \<exists>z. (x = z \<or> (x, z) |\<in>| R|\<^sup>+|) \<and> (z, y) |\<in>| R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) |\<in>| R|\<^sup>+| \<Longrightarrow> \<exists>z. (x = z \<or> (x, z) |\<in>| R|\<^sup>+|) \<and> (z, y) |\<in>| R
[PROOF STEP]
by (induct rule: ftrancl_induct) auto


[STATEMENT]
lemma fls_regpart_plus [simp]: "fls_regpart (f + g) = fls_regpart f + fls_regpart g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_regpart (f + g) = fls_regpart f + fls_regpart g
[PROOF STEP]
by (intro fps_ext) simp


[STATEMENT]
lemma filter_sorted_list_of_set:
  "finite B \<Longrightarrow> A \<subseteq> B \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set B) = sorted_list_of_set A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite B; A \<subseteq> B\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set B) = sorted_list_of_set A
[PROOF STEP]
proof (induct B arbitrary: A rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
case (insert x B)
[PROOF STATE]
proof (state)
this:
finite B
x \<notin> B
?A \<subseteq> B \<Longrightarrow> filter (\<lambda>x. x \<in> ?A) (sorted_list_of_set B) = sorted_list_of_set ?A
A \<subseteq> insert x B

goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite B
x \<notin> B
?A \<subseteq> B \<Longrightarrow> filter (\<lambda>x. x \<in> ?A) (sorted_list_of_set B) = sorted_list_of_set ?A
A \<subseteq> insert x B
[PROOF STEP]
have "finite A"
[PROOF STATE]
proof (prove)
using this:
finite B
x \<notin> B
?A \<subseteq> B \<Longrightarrow> filter (\<lambda>x. x \<in> ?A) (sorted_list_of_set B) = sorted_list_of_set ?A
A \<subseteq> insert x B

goal (1 subgoal):
 1. finite A
[PROOF STEP]
by (auto simp: finite_subset)
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
from insert(1,2)
[PROOF STATE]
proof (chain)
picking this:
finite B
x \<notin> B
[PROOF STEP]
have "filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) =
             filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)"
[PROOF STATE]
proof (prove)
using this:
finite B
x \<notin> B

goal (1 subgoal):
 1. filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)
[PROOF STEP]
by (intro filter_cong) auto
[PROOF STATE]
proof (state)
this:
filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)

goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite A
filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite A
filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)

goal (1 subgoal):
 1. filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x B)) = sorted_list_of_set A
[PROOF STEP]
using insert(1,2,4) insert(3)[of "A - {x}"] sorted_list_of_set_insert_remove[of A x]
[PROOF STATE]
proof (prove)
using this:
finite A
filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)
finite B
x \<notin> B
A \<subseteq> insert x B
A - {x} \<subseteq> B \<Longrightarrow> filter (\<lambda>xa. xa \<in> A - {x}) (sorted_list_of_set B) = sorted_list_of_set (A - {x})
finite A \<Longrightarrow> sorted_list_of_set (insert x A) = insort x (sorted_list_of_set (A - {x}))

goal (1 subgoal):
 1. filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x B)) = sorted_list_of_set A
[PROOF STEP]
by (cases "x \<in> A") (auto  simp: filter_insort filter_insort_triv subset_insert_iff insert_absorb)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x B)) = sorted_list_of_set A

goal (1 subgoal):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
[PROOF STEP]
qed simp


[STATEMENT]
lemma concat_take_Suc_app_nth:
  assumes "x < length l"
  shows "concat (take (Suc x) l) = concat (take x l) @ l ! x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (take (Suc x) l) = concat (take x l) @ l ! x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x < length l

goal (1 subgoal):
 1. concat (take (Suc x) l) = concat (take x l) @ l ! x
[PROOF STEP]
by (auto simp: take_Suc_conv_app_nth)


[STATEMENT]
lemma vec_dim_card: "vec.dim (UNIV::('a::{field}^'n) set) = CARD ('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
let ?f="\<lambda>i::'n. axis i (1::'a)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
have "vec.dim (UNIV::('a::{field}^'n) set) = card (cart_basis::('a^'n) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim UNIV = card cart_basis
[PROOF STEP]
unfolding vec.dim_UNIV
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card cart_basis = card cart_basis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
vec.dim UNIV = card cart_basis

goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec.dim UNIV = card cart_basis

goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
have "... = card ({i. i\<in> UNIV}::('n) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card cart_basis = card {i. i \<in> UNIV}
[PROOF STEP]
proof (rule bij_betw_same_card[of ?f, symmetric], unfold bij_betw_def, auto)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. inj (\<lambda>i. axis i (1::'a))
 2. \<And>xa. axis xa (1::'a) \<in> cart_basis
 3. \<And>x. x \<in> cart_basis \<Longrightarrow> x \<in> range (\<lambda>x. axis x (1::'a))
[PROOF STEP]
show "inj (\<lambda>i::'n. axis i (1::'a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>i. axis i (1::'a))
[PROOF STEP]
by (simp add: inj_on_def axis_eq_axis)
[PROOF STATE]
proof (state)
this:
inj (\<lambda>i. axis i (1::'a))

goal (2 subgoals):
 1. \<And>xa. axis xa (1::'a) \<in> cart_basis
 2. \<And>x. x \<in> cart_basis \<Longrightarrow> x \<in> range (\<lambda>x. axis x (1::'a))
[PROOF STEP]
fix i::'n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. axis xa (1::'a) \<in> cart_basis
 2. \<And>x. x \<in> cart_basis \<Longrightarrow> x \<in> range (\<lambda>x. axis x (1::'a))
[PROOF STEP]
show "axis i 1 \<in> cart_basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. axis i (1::'b) \<in> cart_basis
[PROOF STEP]
unfolding cart_basis_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. axis i (1::'b) \<in> {axis i (1::'b) |i. i \<in> UNIV}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
axis i (1::?'b1) \<in> cart_basis

goal (1 subgoal):
 1. \<And>x. x \<in> cart_basis \<Longrightarrow> x \<in> range (\<lambda>x. axis x (1::'a))
[PROOF STEP]
fix x::"'a^'n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cart_basis \<Longrightarrow> x \<in> range (\<lambda>x. axis x (1::'a))
[PROOF STEP]
assume "x \<in> cart_basis"
[PROOF STATE]
proof (state)
this:
x \<in> cart_basis

goal (1 subgoal):
 1. \<And>x. x \<in> cart_basis \<Longrightarrow> x \<in> range (\<lambda>x. axis x (1::'a))
[PROOF STEP]
thus "x \<in> range (\<lambda>i. axis i 1)"
[PROOF STATE]
proof (prove)
using this:
x \<in> cart_basis

goal (1 subgoal):
 1. x \<in> range (\<lambda>i. axis i (1::'a))
[PROOF STEP]
unfolding cart_basis_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {axis i (1::'a) |i. i \<in> UNIV}

goal (1 subgoal):
 1. x \<in> range (\<lambda>i. axis i (1::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> range (\<lambda>i. axis i (1::'a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card cart_basis = card {i. i \<in> UNIV}

goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card cart_basis = card {i. i \<in> UNIV}

goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
have "... = CARD('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i \<in> UNIV} = CARD('n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {i. i \<in> UNIV} = CARD('n)

goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vec.dim UNIV = CARD('n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec.dim UNIV = CARD('n)

goal (1 subgoal):
 1. vec.dim UNIV = CARD('n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec.dim UNIV = CARD('n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma move_matrix_ortho: "move_matrix A j i = move_matrix (move_matrix A j 0) 0 i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. move_matrix A j i = move_matrix (move_matrix A j 0) 0 i
[PROOF STEP]
apply (subst Rep_matrix_inject[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (move_matrix A j i) = Rep_matrix (move_matrix (move_matrix A j 0) 0 i)
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. Rep_matrix (move_matrix A j i) x xa = Rep_matrix (move_matrix (move_matrix A j 0) 0 i) x xa
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma subsumption_preserves_redundancy :
  assumes "redundant C S"
  assumes "subsumes C D"
  shows "redundant D S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. redundant D S
[PROOF STEP]
using assms tautology_monotonous
[PROOF STATE]
proof (prove)
using this:
redundant C S
subsumes C D
\<lbrakk>tautology ?C; ?C \<subseteq> ?D\<rbrakk> \<Longrightarrow> tautology ?D

goal (1 subgoal):
 1. redundant D S
[PROOF STEP]
unfolding redundant_def subsumes_def
[PROOF STATE]
proof (prove)
using this:
tautology C \<or> (\<exists>D. D \<in> S \<and> D \<subseteq> C)
C \<subseteq> D
\<lbrakk>tautology ?C; ?C \<subseteq> ?D\<rbrakk> \<Longrightarrow> tautology ?D

goal (1 subgoal):
 1. tautology D \<or> (\<exists>Da. Da \<in> S \<and> Da \<subseteq> D)
[PROOF STEP]
by blast


[STATEMENT]
lemma fps_binomial_add_mult: "fps_binomial (c+d) = fps_binomial c * fps_binomial d" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
let ?P = "?r - ?l"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
let ?b = "fps_binomial"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
let ?db = "\<lambda>x. fps_deriv (?b x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
have "fps_deriv ?P = ?db c * ?b d + ?b c * ?db d - ?db (c + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_deriv (fps_binomial c) * fps_binomial d + fps_binomial c * fps_deriv (fps_binomial d) - fps_deriv (fps_binomial (c + d))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_deriv (fps_binomial c) * fps_binomial d + fps_binomial c * fps_deriv (fps_binomial d) - fps_deriv (fps_binomial (c + d))

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_deriv (fps_binomial c) * fps_binomial d + fps_binomial c * fps_deriv (fps_binomial d) - fps_deriv (fps_binomial (c + d))

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
have "\<dots> = inverse (1 + fps_X) *
      (fps_const c * ?b c * ?b d + fps_const d * ?b c * ?b d - fps_const (c+d) * ?b (c + d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (fps_binomial c) * fps_binomial d + fps_binomial c * fps_deriv (fps_binomial d) - fps_deriv (fps_binomial (c + d)) = inverse (1 + fps_X) * (fps_const c * fps_binomial c * fps_binomial d + fps_const d * fps_binomial c * fps_binomial d - fps_const (c + d) * fps_binomial (c + d))
[PROOF STEP]
unfolding fps_binomial_deriv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_const c * fps_binomial c / (1 + fps_X) * fps_binomial d + fps_binomial c * (fps_const d * fps_binomial d / (1 + fps_X)) - fps_const (c + d) * fps_binomial (c + d) / (1 + fps_X) = inverse (1 + fps_X) * (fps_const c * fps_binomial c * fps_binomial d + fps_const d * fps_binomial c * fps_binomial d - fps_const (c + d) * fps_binomial (c + d))
[PROOF STEP]
by (simp add: fps_divide_def field_simps)
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_binomial c) * fps_binomial d + fps_binomial c * fps_deriv (fps_binomial d) - fps_deriv (fps_binomial (c + d)) = inverse (1 + fps_X) * (fps_const c * fps_binomial c * fps_binomial d + fps_const d * fps_binomial c * fps_binomial d - fps_const (c + d) * fps_binomial (c + d))

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_binomial c) * fps_binomial d + fps_binomial c * fps_deriv (fps_binomial d) - fps_deriv (fps_binomial (c + d)) = inverse (1 + fps_X) * (fps_const c * fps_binomial c * fps_binomial d + fps_const d * fps_binomial c * fps_binomial d - fps_const (c + d) * fps_binomial (c + d))

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
have "\<dots> = (fps_const (c + d)/ (1 + fps_X)) * ?P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (1 + fps_X) * (fps_const c * fps_binomial c * fps_binomial d + fps_const d * fps_binomial c * fps_binomial d - fps_const (c + d) * fps_binomial (c + d)) = fps_const (c + d) / (1 + fps_X) * (fps_binomial c * fps_binomial d - fps_binomial (c + d))
[PROOF STEP]
by (simp add: field_simps fps_divide_unit fps_const_add[symmetric] del: fps_const_add)
[PROOF STATE]
proof (state)
this:
inverse (1 + fps_X) * (fps_const c * fps_binomial c * fps_binomial d + fps_const d * fps_binomial c * fps_binomial d - fps_const (c + d) * fps_binomial (c + d)) = fps_const (c + d) / (1 + fps_X) * (fps_binomial c * fps_binomial d - fps_binomial (c + d))

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_const (c + d) / (1 + fps_X) * (fps_binomial c * fps_binomial d - fps_binomial (c + d))
[PROOF STEP]
have th0: "fps_deriv ?P = fps_const (c+d) * ?P / (1 + fps_X)"
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_const (c + d) / (1 + fps_X) * (fps_binomial c * fps_binomial d - fps_binomial (c + d))

goal (1 subgoal):
 1. fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_const (c + d) * (fps_binomial c * fps_binomial d - fps_binomial (c + d)) / (1 + fps_X)
[PROOF STEP]
by (simp add: fps_divide_def)
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_const (c + d) * (fps_binomial c * fps_binomial d - fps_binomial (c + d)) / (1 + fps_X)

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
have "?P = fps_const (?P$0) * ?b (c + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_binomial c * fps_binomial d - fps_binomial (c + d) = fps_const ((fps_binomial c * fps_binomial d - fps_binomial (c + d)) $ 0) * fps_binomial (c + d)
[PROOF STEP]
unfolding fps_binomial_ODE_unique[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_const (c + d) * (fps_binomial c * fps_binomial d - fps_binomial (c + d)) / (1 + fps_X)
[PROOF STEP]
using th0
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_const (c + d) * (fps_binomial c * fps_binomial d - fps_binomial (c + d)) / (1 + fps_X)

goal (1 subgoal):
 1. fps_deriv (fps_binomial c * fps_binomial d - fps_binomial (c + d)) = fps_const (c + d) * (fps_binomial c * fps_binomial d - fps_binomial (c + d)) / (1 + fps_X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_binomial c * fps_binomial d - fps_binomial (c + d) = fps_const ((fps_binomial c * fps_binomial d - fps_binomial (c + d)) $ 0) * fps_binomial (c + d)

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps_binomial c * fps_binomial d - fps_binomial (c + d) = fps_const ((fps_binomial c * fps_binomial d - fps_binomial (c + d)) $ 0) * fps_binomial (c + d)
[PROOF STEP]
have "?P = 0"
[PROOF STATE]
proof (prove)
using this:
fps_binomial c * fps_binomial d - fps_binomial (c + d) = fps_const ((fps_binomial c * fps_binomial d - fps_binomial (c + d)) $ 0) * fps_binomial (c + d)

goal (1 subgoal):
 1. fps_binomial c * fps_binomial d - fps_binomial (c + d) = 0
[PROOF STEP]
by (simp add: fps_mult_nth)
[PROOF STATE]
proof (state)
this:
fps_binomial c * fps_binomial d - fps_binomial (c + d) = 0

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps_binomial c * fps_binomial d - fps_binomial (c + d) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_binomial c * fps_binomial d - fps_binomial (c + d) = 0

goal (1 subgoal):
 1. fps_binomial (c + d) = fps_binomial c * fps_binomial d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_binomial (c + d) = fps_binomial c * fps_binomial d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma height'_node31:
  "height m > 0 \<Longrightarrow> hD(node31 l a m b r) =
   max (hD l) (max (height m) (height r)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height m \<Longrightarrow> hD (node31 l a m b r) = max (hD l) (max (height m) (height r)) + 1
[PROOF STEP]
by(induct l a m b r rule: node31.induct)(simp_all add: max_def)


[STATEMENT]
lemma fset_img_eq: "\<forall>x \<in> fset xs. f x = x \<Longrightarrow> f |`| xs = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>fset xs. f x = x \<Longrightarrow> f |`| xs = xs
[PROOF STEP]
using fset_inject[of xs "f |`| xs"]
[PROOF STATE]
proof (prove)
using this:
(fset xs = fset (f |`| xs)) = (xs = f |`| xs)

goal (1 subgoal):
 1. \<forall>x\<in>fset xs. f x = x \<Longrightarrow> f |`| xs = xs
[PROOF STEP]
by simp


[STATEMENT]
lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded s \<Longrightarrow> bounded (snd ` s)
[PROOF STEP]
unfolding bounded_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x e. \<forall>y\<in>s. dist x y \<le> e \<Longrightarrow> \<exists>x e. \<forall>y\<in>snd ` s. dist x y \<le> e
[PROOF STEP]
by (metis (no_types, opaque_lifting) dist_snd_le image_iff order.trans)


[STATEMENT]
lemma cosh_real_at_bot: "filterlim (cosh :: real \<Rightarrow> real) at_top at_bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim cosh at_top at_bot
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filterlim cosh at_top at_bot
[PROOF STEP]
have "filterlim (\<lambda>x. cosh (-x) :: real) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. cosh (- x) :> at_top
[PROOF STEP]
by (simp add: cosh_real_at_top)
[PROOF STATE]
proof (state)
this:
LIM x at_top. cosh (- x) :> at_top

goal (1 subgoal):
 1. filterlim cosh at_top at_bot
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
LIM x at_top. cosh (- x) :> at_top

goal (1 subgoal):
 1. filterlim cosh at_top at_bot
[PROOF STEP]
by (subst filterlim_at_bot_mirror)
[PROOF STATE]
proof (state)
this:
filterlim cosh at_top at_bot

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Arg_inverse: "Arg(inverse z) = (if z \<in> \<real> then Arg z else - Arg z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
proof (cases "z \<in> \<real>")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> \<real> \<Longrightarrow> Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
 2. z \<notin> \<real> \<Longrightarrow> Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z \<in> \<real>

goal (2 subgoals):
 1. z \<in> \<real> \<Longrightarrow> Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
 2. z \<notin> \<real> \<Longrightarrow> Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> \<real>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> \<real>

goal (1 subgoal):
 1. Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
by simp (metis Arg2pi_inverse Arg2pi_real Arg_real Reals_inverse)
[PROOF STATE]
proof (state)
this:
Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)

goal (1 subgoal):
 1. z \<notin> \<real> \<Longrightarrow> Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<notin> \<real> \<Longrightarrow> Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z \<notin> \<real>

goal (1 subgoal):
 1. z \<notin> \<real> \<Longrightarrow> Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<notin> \<real>
[PROOF STEP]
have z: "Arg z < pi" "z \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<real>

goal (1 subgoal):
 1. Arg z < pi &&& z \<noteq> 0
[PROOF STEP]
using Arg_eq_0_pi Arg_le_pi
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<real>
(Arg ?z = 0 \<or> Arg ?z = pi) = (?z \<in> \<real>)
Arg ?z \<le> pi

goal (1 subgoal):
 1. Arg z < pi &&& z \<noteq> 0
[PROOF STEP]
by (auto simp: less_eq_real_def)
[PROOF STATE]
proof (state)
this:
Arg z < pi
z \<noteq> 0

goal (1 subgoal):
 1. z \<notin> \<real> \<Longrightarrow> Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)
[PROOF STEP]
apply (rule Arg_unique [of "inverse (norm z)"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. complex_of_real (inverse (cmod z)) * exp (\<i> * complex_of_real (if z \<in> \<real> then Arg z else - Arg z)) = inverse z
 2. 0 < inverse (cmod z)
 3. - pi < (if z \<in> \<real> then Arg z else - Arg z)
 4. (if z \<in> \<real> then Arg z else - Arg z) \<le> pi
[PROOF STEP]
using False z mpi_less_Arg [of z] Arg_eq [of z]
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<real>
Arg z < pi
z \<noteq> 0
- pi < Arg z
z \<noteq> 0 \<Longrightarrow> z = complex_of_real (cmod z) * exp (\<i> * complex_of_real (Arg z))

goal (4 subgoals):
 1. complex_of_real (inverse (cmod z)) * exp (\<i> * complex_of_real (if z \<in> \<real> then Arg z else - Arg z)) = inverse z
 2. 0 < inverse (cmod z)
 3. - pi < (if z \<in> \<real> then Arg z else - Arg z)
 4. (if z \<in> \<real> then Arg z else - Arg z) \<le> pi
[PROOF STEP]
by (auto simp: exp_minus field_simps)
[PROOF STATE]
proof (state)
this:
Arg (inverse z) = (if z \<in> \<real> then Arg z else - Arg z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_of_mat:
  fixes subsets :: "nat list list"
  fixes signs :: "rat list list"
  shows "(matrix_A signs subsets) \<in> carrier_mat (length subsets) (length signs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat signs subsets \<in> carrier_mat (length subsets) (length signs)
[PROOF STEP]
unfolding matrix_A_def carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows_list (length signs) (map (mtx_row signs) subsets) \<in> {m. dim_row m = length subsets \<and> dim_col m = length signs}
[PROOF STEP]
by auto


[STATEMENT]
lemma zip_fill_code [code]:
  "zip_fill xs [] = map (\<lambda>x. (Some x, None)) xs"
  "zip_fill [] ys = map (\<lambda>y. (None, Some y)) ys"
  "zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip_fill xs [] = map (\<lambda>x. (Some x, None)) xs &&& zip_fill [] ys = map (\<lambda>y. (None, Some y)) ys &&& zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip_fill xs [] = map (\<lambda>x. (Some x, None)) xs
[PROOF STEP]
by (induct xs) (auto simp: zip_fill_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. zip_fill [] ys = map (\<lambda>y. (None, Some y)) ys
 2. zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip_fill [] ys = map (\<lambda>y. (None, Some y)) ys
[PROOF STEP]
by (induct ys) (auto simp: zip_fill_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip_fill (x # xs) (y # ys) = (Some x, Some y) # zip_fill xs ys
[PROOF STEP]
by (auto simp: zip_fill_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma supp_perm_pair:
  fixes p::"perm"
  shows "supp p \<subseteq> {a, b} \<longleftrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (supp p \<subseteq> {a, b}) = (p = 0 \<or> p = (b \<rightleftharpoons> a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (supp p \<subseteq> {a, b}) = (p = 0 \<or> p = (b \<rightleftharpoons> a))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (supp p \<subseteq> {a, b}) = (p = 0 \<or> p = (b \<rightleftharpoons> a))
[PROOF STEP]
assume "supp p \<subseteq> {a, b}"
[PROOF STATE]
proof (state)
this:
supp p \<subseteq> {a, b}

goal (1 subgoal):
 1. (supp p \<subseteq> {a, b}) = (p = 0 \<or> p = (b \<rightleftharpoons> a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
supp p \<subseteq> {a, b}
[PROOF STEP]
have "p = 0 \<or> p = (b \<rightleftharpoons> a)"
[PROOF STATE]
proof (prove)
using this:
supp p \<subseteq> {a, b}

goal (1 subgoal):
 1. p = 0 \<or> p = (b \<rightleftharpoons> a)
[PROOF STEP]
apply (induct p rule: perm_struct_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 = 0 \<or> 0 = (b \<rightleftharpoons> a)
 2. \<And>p aa ba. \<lbrakk>p = 0 \<or> p = (b \<rightleftharpoons> a); supp p \<subseteq> {a, b}; aa \<in> {a, b}; ba \<in> {a, b}; aa \<noteq> ba; sort_of aa = sort_of ba\<rbrakk> \<Longrightarrow> (aa \<rightleftharpoons> ba) + p = 0 \<or> (aa \<rightleftharpoons> ba) + p = (b \<rightleftharpoons> a)
[PROOF STEP]
apply (auto simp: swap_cancel supp_zero_perm supp_swap)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> b; sort_of a = sort_of b; (a \<rightleftharpoons> b) \<noteq> (b \<rightleftharpoons> a)\<rbrakk> \<Longrightarrow> (a \<rightleftharpoons> b) = 0
[PROOF STEP]
apply (simp add: swap_commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
p = 0 \<or> p = (b \<rightleftharpoons> a)

goal (1 subgoal):
 1. (supp p \<subseteq> {a, b}) = (p = 0 \<or> p = (b \<rightleftharpoons> a))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
supp p \<subseteq> {a, b} \<Longrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)

goal (1 subgoal):
 1. (supp p \<subseteq> {a, b}) = (p = 0 \<or> p = (b \<rightleftharpoons> a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
supp p \<subseteq> {a, b} \<Longrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)
[PROOF STEP]
show "supp p \<subseteq> {a, b} \<longleftrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)"
[PROOF STATE]
proof (prove)
using this:
supp p \<subseteq> {a, b} \<Longrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)

goal (1 subgoal):
 1. (supp p \<subseteq> {a, b}) = (p = 0 \<or> p = (b \<rightleftharpoons> a))
[PROOF STEP]
by (auto simp: supp_zero_perm supp_swap split: if_splits)
[PROOF STATE]
proof (state)
this:
(supp p \<subseteq> {a, b}) = (p = 0 \<or> p = (b \<rightleftharpoons> a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma antisym_conv1:
  assumes "\<not> x <\<^sub>a y"
  shows "x \<le>\<^sub>a y \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le>\<^sub>a y) = (x = y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> x <\<^sub>a y

goal (1 subgoal):
 1. (x \<le>\<^sub>a y) = (x = y)
[PROOF STEP]
by (simp add: le_less)


[STATEMENT]
lemma add_rat [simp]:
  assumes "b \<noteq> 0" and "d \<noteq> 0"
  shows "Fract a b + Fract c d = Fract (a * d + c * b) (b * d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fract a b + Fract c d = Fract (a * d + c * b) (b * d)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
b \<noteq> 0
d \<noteq> 0

goal (1 subgoal):
 1. Fract a b + Fract c d = Fract (a * d + c * b) (b * d)
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma count_distinct_mset_list_index: "i1 < length xs \<Longrightarrow> i2 < length xs \<Longrightarrow> i1 \<noteq> i2 \<Longrightarrow>
    distinct_mset (mset xs) \<Longrightarrow> xs ! i1 \<noteq> xs ! i2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i1 < length xs; i2 < length xs; i1 \<noteq> i2; distinct_mset (mset xs)\<rbrakk> \<Longrightarrow> xs ! i1 \<noteq> xs ! i2
[PROOF STEP]
by (simp add:  nth_eq_iff_index_eq)


[STATEMENT]
lemma nn_integral_0_1_power:
  "(\<integral>\<^sup>+y\<in>{0<..<1}. ennreal (y ^ n) \<partial>lborel) = ennreal (1 / (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
have *: "((\<lambda>a. a ^ (n + 1) / real (n + 1)) has_real_derivative x ^ n) (at x)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>a. a ^ (n + 1) / real (n + 1)) has_real_derivative x ^ n) (at x)
[PROOF STEP]
by (rule derivative_eq_intros refl | simp)+
[PROOF STATE]
proof (state)
this:
((\<lambda>a. a ^ (n + 1) / real (n + 1)) has_real_derivative ?x ^ n) (at ?x)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
have "(\<integral>\<^sup>+y\<in>{0<..<1}. ennreal (y ^ n) \<partial>lborel) = (\<integral>\<^sup>+y\<in>{0..1}. ennreal (y ^ n) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = \<integral>\<^sup>+x\<in>{0..1}. ennreal (x ^ n)\<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong_AE AE_I[of _ _ "{0,1}"])
       (auto simp: indicator_def emeasure_lborel_countable)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = \<integral>\<^sup>+x\<in>{0..1}. ennreal (x ^ n)\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = \<integral>\<^sup>+x\<in>{0..1}. ennreal (x ^ n)\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
have "\<dots> = ennreal (1 ^ (n + 1) / (n + 1) - 0 ^ (n + 1) / (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 ^ (n + 1) / real (n + 1) - 0 ^ (n + 1) / real (n + 1))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
((\<lambda>a. a ^ (n + 1) / real (n + 1)) has_real_derivative ?x ^ n) (at ?x)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 ^ (n + 1) / real (n + 1) - 0 ^ (n + 1) / real (n + 1))
[PROOF STEP]
by (intro nn_integral_FTC_Icc) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 ^ (n + 1) / real (n + 1) - 0 ^ (n + 1) / real (n + 1))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 ^ (n + 1) / real (n + 1) - 0 ^ (n + 1) / real (n + 1))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
have "\<dots> = ennreal (1 / (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (1 ^ (n + 1) / real (n + 1) - 0 ^ (n + 1) / real (n + 1)) = ennreal (1 / real (n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ennreal (1 ^ (n + 1) / real (n + 1) - 0 ^ (n + 1) / real (n + 1)) = ennreal (1 / real (n + 1))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / real (n + 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / real (n + 1))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0<..<1}. ennreal (x ^ n)\<partial>lborel = ennreal (1 / (real n + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Hermite_unique:
  fixes K::"'a::{bezout_ring_div,normalization_euclidean_semiring,unique_euclidean_ring}^'n::mod_type^'n::mod_type"
  assumes A_PH: "A = P ** H"
  and A_QK: "A = Q ** K"
  and inv_A: "invertible A"
  and inv_P: "invertible P"
  and inv_Q: "invertible Q"
  and H: "Hermite associates residues H"
  and K: "Hermite associates residues K"
  shows "H = K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H = K
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. H = K
[PROOF STEP]
have cs_residues: "Complete_set_residues residues"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complete_set_residues residues
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
Hermite associates residues H

goal (1 subgoal):
 1. Complete_set_residues residues
[PROOF STEP]
unfolding Hermite_def
[PROOF STATE]
proof (prove)
using this:
Complete_set_non_associates associates \<and> Complete_set_residues residues \<and> echelon_form H \<and> (\<forall>i. \<not> is_zero_row i H \<longrightarrow> H $ i $ (LEAST n. H $ i $ n \<noteq> (0::'a)) \<in> associates) \<and> (\<forall>i. \<not> is_zero_row i H \<longrightarrow> (\<forall>j<i. H $ j $ (LEAST n. H $ i $ n \<noteq> (0::'a)) \<in> residues (H $ i $ (LEAST n. H $ i $ n \<noteq> (0::'a)))))

goal (1 subgoal):
 1. Complete_set_residues residues
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complete_set_residues residues

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have inv_H: "invertible H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible H
[PROOF STEP]
by (metis A_PH inv_A inv_P invertible_def invertible_mult matrix_mul_assoc matrix_mul_lid)
[PROOF STATE]
proof (state)
this:
invertible H

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have inv_K: "invertible K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible K
[PROOF STEP]
by (metis A_QK inv_A inv_Q invertible_def invertible_mult matrix_mul_assoc matrix_mul_lid)
[PROOF STATE]
proof (state)
this:
invertible K

goal (1 subgoal):
 1. H = K
[PROOF STEP]
define U where "U = (matrix_inv P)**Q"
[PROOF STATE]
proof (state)
this:
U = matrix_inv P ** Q

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have inv_U: "invertible U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible U
[PROOF STEP]
by (metis U_def inv_P inv_Q invertible_def invertible_mult matrix_inv_left matrix_inv_right)
[PROOF STATE]
proof (state)
this:
invertible U

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have H_UK: "H = U ** K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H = U ** K
[PROOF STEP]
using A_PH A_QK inv_P
[PROOF STATE]
proof (prove)
using this:
A = P ** H
A = Q ** K
invertible P

goal (1 subgoal):
 1. H = U ** K
[PROOF STEP]
by (metis U_def matrix_inv_left matrix_mul_assoc matrix_mul_lid)
[PROOF STATE]
proof (state)
this:
H = U ** K

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have "det K *k U = H ** adjugate K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det K *k U = H ** adjugate K
[PROOF STEP]
unfolding H_UK matrix_mul_assoc[symmetric] mult_adjugate_det matrix_mul_mat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det K *k U = det K *k U
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det K *k U = H ** adjugate K

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have upper_triangular_H: "upper_triangular H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular H
[PROOF STEP]
by (metis H Hermite_def echelon_form_imp_upper_triagular)
[PROOF STATE]
proof (state)
this:
upper_triangular H

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have upper_triangular_K: "upper_triangular K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular K
[PROOF STEP]
by (metis K Hermite_def echelon_form_imp_upper_triagular)
[PROOF STATE]
proof (state)
this:
upper_triangular K

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have upper_triangular_U: "upper_triangular U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular U
[PROOF STEP]
by (metis H_UK inv_K matrix_inv_right matrix_mul_assoc matrix_mul_rid upper_triangular_H
      upper_triangular_K upper_triangular_inverse upper_triangular_mult)
[PROOF STATE]
proof (state)
this:
upper_triangular U

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have unit_det_U: "is_unit (det U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (det U)
[PROOF STEP]
by (metis inv_U invertible_iff_is_unit)
[PROOF STATE]
proof (state)
this:
is_unit (det U)

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have is_unit_diagonal_U: "(\<forall>i. is_unit (U $ i $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. is_unit (U $ i $ i)
[PROOF STEP]
by (rule is_unit_diagonal[OF upper_triangular_U unit_det_U])
[PROOF STATE]
proof (state)
this:
\<forall>i. is_unit (U $ i $ i)

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have Uii_1: "(\<forall>i. (U $ i $ i) = 1)" and Hii_Kii: "(\<forall>i. (H $ i $ i) = (K $ i $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. U $ i $ i = (1::'a) &&& \<forall>i. H $ i $ i = K $ i $ i
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. U $ i $ i = (1::'a)
 2. \<And>i. H $ i $ i = K $ i $ i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. U $ i $ i = (1::'a)
 2. \<And>i. H $ i $ i = K $ i $ i
[PROOF STEP]
have Hii: "H $ i $ i \<in> associates"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H $ i $ i \<in> associates
[PROOF STEP]
by (rule diagonal_in_associates[OF H inv_H upper_triangular_H])
[PROOF STATE]
proof (state)
this:
H $ i $ i \<in> associates

goal (2 subgoals):
 1. \<And>i. U $ i $ i = (1::'a)
 2. \<And>i. H $ i $ i = K $ i $ i
[PROOF STEP]
have Kii: "K $ i $ i \<in> associates"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K $ i $ i \<in> associates
[PROOF STEP]
by (rule diagonal_in_associates[OF K inv_K upper_triangular_K])
[PROOF STATE]
proof (state)
this:
K $ i $ i \<in> associates

goal (2 subgoals):
 1. \<And>i. U $ i $ i = (1::'a)
 2. \<And>i. H $ i $ i = K $ i $ i
[PROOF STEP]
have ass_Hii_Kii: "normalize (H $ i $ i) = normalize (K $ i $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (H $ i $ i) = normalize (K $ i $ i)
[PROOF STEP]
by (meson associatedI inv_H inv_K invertible_iff_is_unit is_unit_diagonal
                unit_imp_dvd upper_triangular_H upper_triangular_K)
[PROOF STATE]
proof (state)
this:
normalize (H $ i $ i) = normalize (K $ i $ i)

goal (2 subgoals):
 1. \<And>i. U $ i $ i = (1::'a)
 2. \<And>i. H $ i $ i = K $ i $ i
[PROOF STEP]
show Hii_eq_Kii: "H $ i $ i = K $ i $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H $ i $ i = K $ i $ i
[PROOF STEP]
by (metis Hermite_def Hii K Kii ass_Hii_Kii in_Ass_not_associated)
[PROOF STATE]
proof (state)
this:
H $ i $ i = K $ i $ i

goal (1 subgoal):
 1. \<And>i. U $ i $ i = (1::'a)
[PROOF STEP]
have "H $ i $ i = U $ i $ i * K $ i $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H $ i $ i = U $ i $ i * K $ i $ i
[PROOF STEP]
by (metis H_UK upper_triangular_K upper_triangular_U upper_triangular_mult_diagonal)
[PROOF STATE]
proof (state)
this:
H $ i $ i = U $ i $ i * K $ i $ i

goal (1 subgoal):
 1. \<And>i. U $ i $ i = (1::'a)
[PROOF STEP]
thus "U $ i $ i = 1"
[PROOF STATE]
proof (prove)
using this:
H $ i $ i = U $ i $ i * K $ i $ i

goal (1 subgoal):
 1. U $ i $ i = (1::'a)
[PROOF STEP]
unfolding Hii_eq_Kii mult_cancel_right1
[PROOF STATE]
proof (prove)
using this:
K $ i $ i = (0::'a) \<or> U $ i $ i = (1::'a)

goal (1 subgoal):
 1. U $ i $ i = (1::'a)
[PROOF STEP]
by (metis Hii_eq_Kii inv_H invertible_iff_is_unit
        is_unit_diagonal not_is_unit_0 upper_triangular_H)
[PROOF STATE]
proof (state)
this:
U $ i $ i = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i. U $ i $ i = (1::'a)
\<forall>i. H $ i $ i = K $ i $ i

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have zero_above: "\<forall>j s. j\<ge>1 \<and> j < ncols A - to_nat s \<longrightarrow> U $ s $ (s + from_nat j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j s. 1 \<le> j \<and> j < ncols A - mod_type_class.to_nat s \<longrightarrow> U $ s $ (s + mod_type_class.from_nat j) = (0::'a)
[PROOF STEP]
proof (clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j s. \<lbrakk>1 \<le> j; j < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat j) = (0::'a)
[PROOF STEP]
fix j s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j s. \<lbrakk>1 \<le> j; j < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat j) = (0::'a)
[PROOF STEP]
assume  "1 \<le> j" and "j < ncols A - (to_nat (s::'n))"
[PROOF STATE]
proof (state)
this:
1 \<le> j
j < ncols A - mod_type_class.to_nat s

goal (1 subgoal):
 1. \<And>j s. \<lbrakk>1 \<le> j; j < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat j) = (0::'a)
[PROOF STEP]
thus "U $ s $ (s + from_nat j) = 0"
[PROOF STATE]
proof (prove)
using this:
1 \<le> j
j < ncols A - mod_type_class.to_nat s

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat j) = (0::'a)
[PROOF STEP]
proof (induct j rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 1 \<le> y; y < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat y) = (0::'a); 1 \<le> x; x < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat x) = (0::'a)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 1 \<le> y; y < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat y) = (0::'a); 1 \<le> x; x < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat x) = (0::'a)
[PROOF STEP]
assume induct_step: "(\<And>y. y < p \<Longrightarrow> 1 \<le> y \<Longrightarrow> y < ncols A - to_nat s \<Longrightarrow> U $ s $ (s + from_nat y) = 0)"
        and p1: "1 \<le> p" and p2: "p < ncols A - to_nat s"
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y < p; 1 \<le> ?y; ?y < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat ?y) = (0::'a)
1 \<le> p
p < ncols A - mod_type_class.to_nat s

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 1 \<le> y; y < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat y) = (0::'a); 1 \<le> x; x < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat x) = (0::'a)
[PROOF STEP]
have s_less: "s < s + from_nat p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s < s + mod_type_class.from_nat p
[PROOF STEP]
using p1 p2
[PROOF STATE]
proof (prove)
using this:
1 \<le> p
p < ncols A - mod_type_class.to_nat s

goal (1 subgoal):
 1. s < s + mod_type_class.from_nat p
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
1 \<le> p
p < CARD('n) - mod_type_class.to_nat s

goal (1 subgoal):
 1. s < s + mod_type_class.from_nat p
[PROOF STEP]
by (metis One_nat_def add.commute add_diff_cancel_right' add_lessD1 add_to_nat_def
          from_nat_to_nat_id less_diff_conv neq_iff not_le
          to_nat_from_nat_id to_nat_le zero_less_Suc)
[PROOF STATE]
proof (state)
this:
s < s + mod_type_class.from_nat p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 1 \<le> y; y < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat y) = (0::'a); 1 \<le> x; x < ncols A - mod_type_class.to_nat s\<rbrakk> \<Longrightarrow> U $ s $ (s + mod_type_class.from_nat x) = (0::'a)
[PROOF STEP]
show "U $ s $ (s + from_nat p) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have UNIV_rw: "UNIV = insert s (UNIV-{s})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = insert s (UNIV - {s})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
UNIV = insert s (UNIV - {s})

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have UNIV_s_rw: "UNIV-{s} = insert (s + from_nat p) ((UNIV-{s}) - {s + from_nat p})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV - {s} = insert (s + mod_type_class.from_nat p) (UNIV - {s} - {s + mod_type_class.from_nat p})
[PROOF STEP]
using p1 p2 s_less
[PROOF STATE]
proof (prove)
using this:
1 \<le> p
p < ncols A - mod_type_class.to_nat s
s < s + mod_type_class.from_nat p

goal (1 subgoal):
 1. UNIV - {s} = insert (s + mod_type_class.from_nat p) (UNIV - {s} - {s + mod_type_class.from_nat p})
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
1 \<le> p
p < CARD('n) - mod_type_class.to_nat s
s < s + mod_type_class.from_nat p

goal (1 subgoal):
 1. UNIV - {s} = insert (s + mod_type_class.from_nat p) (UNIV - {s} - {s + mod_type_class.from_nat p})
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
UNIV - {s} = insert (s + mod_type_class.from_nat p) (UNIV - {s} - {s + mod_type_class.from_nat p})

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have sum_rw: "(\<Sum>k\<in>UNIV-{s}. U $ s $ k * K $ k $ (s + from_nat p))
          = U $ s $ (s + from_nat p) * K $ (s + from_nat p) $ (s + from_nat p)
          + (\<Sum>k\<in>(UNIV-{s})-{s + from_nat p}. U $ s $ k * K $ k $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV - {s}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + (\<Sum>k\<in>UNIV - {s} - {s + mod_type_class.from_nat p}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))
[PROOF STEP]
using UNIV_s_rw sum.insert
[PROOF STATE]
proof (prove)
using this:
UNIV - {s} = insert (s + mod_type_class.from_nat p) (UNIV - {s} - {s + mod_type_class.from_nat p})
\<lbrakk>finite ?A; ?x \<notin> ?A\<rbrakk> \<Longrightarrow> sum ?g (insert ?x ?A) = ?g ?x + sum ?g ?A

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV - {s}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + (\<Sum>k\<in>UNIV - {s} - {s + mod_type_class.from_nat p}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))
[PROOF STEP]
by (metis (erased, lifting) Diff_iff finite singletonI)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV - {s}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + (\<Sum>k\<in>UNIV - {s} - {s + mod_type_class.from_nat p}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have sum_0: "(\<Sum>k\<in>(UNIV-{s})-{s + from_nat p}. U $ s $ k * K $ k $ (s + from_nat p)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV - {s} - {s + mod_type_class.from_nat p}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = (0::'a)
[PROOF STEP]
proof (rule sum.neutral, rule)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV - {s} - {s + mod_type_class.from_nat p} \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV - {s} - {s + mod_type_class.from_nat p} \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
assume x: "x \<in> UNIV - {s} - {s + from_nat p}"
[PROOF STATE]
proof (state)
this:
x \<in> UNIV - {s} - {s + mod_type_class.from_nat p}

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV - {s} - {s + mod_type_class.from_nat p} \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
show "U $ s $ x * K $ x $ (s + from_nat p) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
proof (cases "x<s")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x < s \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
 2. \<not> x < s \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < s

goal (2 subgoals):
 1. x < s \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
 2. \<not> x < s \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x < s

goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
using upper_triangular_U
[PROOF STATE]
proof (prove)
using this:
x < s
upper_triangular U

goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
unfolding upper_triangular_def
[PROOF STATE]
proof (prove)
using this:
x < s
\<forall>i j. j < i \<longrightarrow> U $ i $ j = (0::'a)

goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)

goal (1 subgoal):
 1. \<not> x < s \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < s \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < s

goal (1 subgoal):
 1. \<not> x < s \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
hence x_g_s: "x>s"
[PROOF STATE]
proof (prove)
using this:
\<not> x < s

goal (1 subgoal):
 1. s < x
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
\<not> x < s
x \<in> UNIV - {s} - {s + mod_type_class.from_nat p}

goal (1 subgoal):
 1. s < x
[PROOF STEP]
by (metis Diff_iff neq_iff singletonI)
[PROOF STATE]
proof (state)
this:
s < x

goal (1 subgoal):
 1. \<not> x < s \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
proof (cases "x<s+from_nat p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
 2. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < s + mod_type_class.from_nat p

goal (2 subgoals):
 1. x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
 2. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
define a where "a = to_nat x - to_nat s"
[PROOF STATE]
proof (state)
this:
a = mod_type_class.to_nat x - mod_type_class.to_nat s

goal (2 subgoals):
 1. x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
 2. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
from x_g_s
[PROOF STATE]
proof (chain)
picking this:
s < x
[PROOF STEP]
have "to_nat s < to_nat x"
[PROOF STATE]
proof (prove)
using this:
s < x

goal (1 subgoal):
 1. mod_type_class.to_nat s < mod_type_class.to_nat x
[PROOF STEP]
by (rule to_nat_mono)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat s < mod_type_class.to_nat x

goal (2 subgoals):
 1. x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
 2. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
hence xa: "x=s+(from_nat a)"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat s < mod_type_class.to_nat x

goal (1 subgoal):
 1. x = s + mod_type_class.from_nat a
[PROOF STEP]
unfolding a_def add_to_nat_def
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat s < mod_type_class.to_nat x

goal (1 subgoal):
 1. x = mod_type_class.from_nat (mod_type_class.to_nat s + mod_type_class.to_nat (mod_type_class.from_nat (mod_type_class.to_nat x - mod_type_class.to_nat s)))
[PROOF STEP]
by (simp add: less_imp_diff_less to_nat_less_card algebra_simps to_nat_from_nat_id)
[PROOF STATE]
proof (state)
this:
x = s + mod_type_class.from_nat a

goal (2 subgoals):
 1. x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
 2. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have "U $ s $ x =0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U $ s $ x = (0::'a)
[PROOF STEP]
proof (unfold xa, rule induct_step)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. a < p
 2. 1 \<le> a
 3. a < ncols A - mod_type_class.to_nat s
[PROOF STEP]
show a_p: "a<p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < p
[PROOF STEP]
unfolding a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat x - mod_type_class.to_nat s < p
[PROOF STEP]
using p2
[PROOF STATE]
proof (prove)
using this:
p < ncols A - mod_type_class.to_nat s

goal (1 subgoal):
 1. mod_type_class.to_nat x - mod_type_class.to_nat s < p
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
p < CARD('n) - mod_type_class.to_nat s

goal (1 subgoal):
 1. mod_type_class.to_nat x - mod_type_class.to_nat s < p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p < CARD('n) - mod_type_class.to_nat s \<Longrightarrow> mod_type_class.to_nat x - mod_type_class.to_nat s < p
[PROOF STEP]
have "x < from_nat (to_nat s + to_nat (from_nat p::'n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < mod_type_class.from_nat (mod_type_class.to_nat s + mod_type_class.to_nat (mod_type_class.from_nat p))
[PROOF STEP]
by (metis (no_types) True add_to_nat_def)
[PROOF STATE]
proof (state)
this:
x < mod_type_class.from_nat (mod_type_class.to_nat s + mod_type_class.to_nat (mod_type_class.from_nat p))

goal (1 subgoal):
 1. p < CARD('n) - mod_type_class.to_nat s \<Longrightarrow> mod_type_class.to_nat x - mod_type_class.to_nat s < p
[PROOF STEP]
hence "to_nat x - to_nat s < to_nat (from_nat p::'n)"
[PROOF STATE]
proof (prove)
using this:
x < mod_type_class.from_nat (mod_type_class.to_nat s + mod_type_class.to_nat (mod_type_class.from_nat p))

goal (1 subgoal):
 1. mod_type_class.to_nat x - mod_type_class.to_nat s < mod_type_class.to_nat (mod_type_class.from_nat p)
[PROOF STEP]
by (simp add: add.commute less_diff_conv2 less_imp_le to_nat_le x_g_s)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat x - mod_type_class.to_nat s < mod_type_class.to_nat (mod_type_class.from_nat p)

goal (1 subgoal):
 1. p < CARD('n) - mod_type_class.to_nat s \<Longrightarrow> mod_type_class.to_nat x - mod_type_class.to_nat s < p
[PROOF STEP]
thus "to_nat x - to_nat s < p"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat x - mod_type_class.to_nat s < mod_type_class.to_nat (mod_type_class.from_nat p)

goal (1 subgoal):
 1. mod_type_class.to_nat x - mod_type_class.to_nat s < p
[PROOF STEP]
by (metis (no_types) from_nat_eq_imp_eq from_nat_to_nat_id le_less_trans
                        less_imp_le not_le to_nat_less_card)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat x - mod_type_class.to_nat s < p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a < p

goal (2 subgoals):
 1. 1 \<le> a
 2. a < ncols A - mod_type_class.to_nat s
[PROOF STEP]
show "1 \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> a
[PROOF STEP]
by (auto simp add: a_def p1 p2) (metis Suc_leI to_nat_mono x_g_s zero_less_diff)
[PROOF STATE]
proof (state)
this:
1 \<le> a

goal (1 subgoal):
 1. a < ncols A - mod_type_class.to_nat s
[PROOF STEP]
show "a < ncols A - to_nat s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < ncols A - mod_type_class.to_nat s
[PROOF STEP]
using a_p p2
[PROOF STATE]
proof (prove)
using this:
a < p
p < ncols A - mod_type_class.to_nat s

goal (1 subgoal):
 1. a < ncols A - mod_type_class.to_nat s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a < ncols A - mod_type_class.to_nat s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
U $ s $ x = (0::'a)

goal (2 subgoals):
 1. x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
 2. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
U $ s $ x = (0::'a)

goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)

goal (1 subgoal):
 1. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < s + mod_type_class.from_nat p

goal (1 subgoal):
 1. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
hence "x>s+from_nat p"
[PROOF STATE]
proof (prove)
using this:
\<not> x < s + mod_type_class.from_nat p

goal (1 subgoal):
 1. s + mod_type_class.from_nat p < x
[PROOF STEP]
using x_g_s x
[PROOF STATE]
proof (prove)
using this:
\<not> x < s + mod_type_class.from_nat p
s < x
x \<in> UNIV - {s} - {s + mod_type_class.from_nat p}

goal (1 subgoal):
 1. s + mod_type_class.from_nat p < x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s + mod_type_class.from_nat p < x

goal (1 subgoal):
 1. \<not> x < s + mod_type_class.from_nat p \<Longrightarrow> U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
s + mod_type_class.from_nat p < x

goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
using upper_triangular_K
[PROOF STATE]
proof (prove)
using this:
s + mod_type_class.from_nat p < x
upper_triangular K

goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
unfolding upper_triangular_def
[PROOF STATE]
proof (prove)
using this:
s + mod_type_class.from_nat p < x
\<forall>i j. j < i \<longrightarrow> K $ i $ j = (0::'a)

goal (1 subgoal):
 1. U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
U $ s $ x * K $ x $ (s + mod_type_class.from_nat p) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV - {s} - {s + mod_type_class.from_nat p}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = (0::'a)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have "H $ s $ (s + from_nat p) = (\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H $ s $ (s + mod_type_class.from_nat p) = (\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))
[PROOF STEP]
unfolding H_UK matrix_matrix_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. \<Sum>k\<in>UNIV. U $ i $ k * K $ k $ j) $ s $ (s + mod_type_class.from_nat p) = (\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
H $ s $ (s + mod_type_class.from_nat p) = (\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
H $ s $ (s + mod_type_class.from_nat p) = (\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have "... = (\<Sum>k\<in>insert s (UNIV-{s}). U $ s $ k * K $ k $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = (\<Sum>k\<in>insert s (UNIV - {s}). U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))
[PROOF STEP]
using UNIV_rw
[PROOF STATE]
proof (prove)
using this:
UNIV = insert s (UNIV - {s})

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = (\<Sum>k\<in>insert s (UNIV - {s}). U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = (\<Sum>k\<in>insert s (UNIV - {s}). U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = (\<Sum>k\<in>insert s (UNIV - {s}). U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have "... = U $ s $ s * K $ s $ (s + from_nat p)
          + (\<Sum>k\<in>UNIV-{s}. U $ s $ k * K $ k $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>insert s (UNIV - {s}). U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + (\<Sum>k\<in>UNIV - {s}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))
[PROOF STEP]
by (rule sum.insert, simp_all)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert s (UNIV - {s}). U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + (\<Sum>k\<in>UNIV - {s}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert s (UNIV - {s}). U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + (\<Sum>k\<in>UNIV - {s}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have "... = U $ s $ s * K $ s $ (s + from_nat p)
          + U $ s $ (s + from_nat p) * K $ (s + from_nat p) $ (s + from_nat p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + (\<Sum>k\<in>UNIV - {s}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p)
[PROOF STEP]
unfolding sum_rw sum_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + (U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + (0::'a)) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + (\<Sum>k\<in>UNIV - {s}. U $ s $ k * K $ k $ (s + mod_type_class.from_nat p)) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
H $ s $ (s + mod_type_class.from_nat p) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p)
[PROOF STEP]
have H_s_sp: "H $ s $ (s + from_nat p)
          = U $ s $ (s + from_nat p) * K $ (s + from_nat p) $ (s + from_nat p) + K $ s $ (s + from_nat p)"
[PROOF STATE]
proof (prove)
using this:
H $ s $ (s + mod_type_class.from_nat p) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p)

goal (1 subgoal):
 1. H $ s $ (s + mod_type_class.from_nat p) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + K $ s $ (s + mod_type_class.from_nat p)
[PROOF STEP]
using Uii_1
[PROOF STATE]
proof (prove)
using this:
H $ s $ (s + mod_type_class.from_nat p) = U $ s $ s * K $ s $ (s + mod_type_class.from_nat p) + U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p)
\<forall>i. U $ i $ i = (1::'a)

goal (1 subgoal):
 1. H $ s $ (s + mod_type_class.from_nat p) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + K $ s $ (s + mod_type_class.from_nat p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
H $ s $ (s + mod_type_class.from_nat p) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + K $ s $ (s + mod_type_class.from_nat p)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
hence cong_HK: "cong (H $ s $ (s + from_nat p)) (K $ s $ (s + from_nat p)) (K $ (s+from_nat p) $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
using this:
H $ s $ (s + mod_type_class.from_nat p) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + K $ s $ (s + mod_type_class.from_nat p)

goal (1 subgoal):
 1. cong (H $ s $ (s + mod_type_class.from_nat p)) (K $ s $ (s + mod_type_class.from_nat p)) (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
H $ s $ (s + mod_type_class.from_nat p) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + K $ s $ (s + mod_type_class.from_nat p)

goal (1 subgoal):
 1. \<exists>k. H $ s $ (s + mod_type_class.from_nat p) - K $ s $ (s + mod_type_class.from_nat p) = K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cong (H $ s $ (s + mod_type_class.from_nat p)) (K $ s $ (s + mod_type_class.from_nat p)) (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have H_s_sp_residues: "(H $ s $ (s + from_nat p)) \<in> residues (K $ (s+from_nat p) $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
[PROOF STEP]
using above_diagonal_in_residues[OF H inv_H upper_triangular_H s_less]
[PROOF STATE]
proof (prove)
using this:
H $ s $ (LEAST n. H $ (s + mod_type_class.from_nat p) $ n \<noteq> (0::'a)) \<in> residues (H $ (s + mod_type_class.from_nat p) $ (LEAST n. H $ (s + mod_type_class.from_nat p) $ n \<noteq> (0::'a)))

goal (1 subgoal):
 1. H $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
[PROOF STEP]
unfolding diagonal_least_nonzero[OF H inv_H upper_triangular_H]
[PROOF STATE]
proof (prove)
using this:
H $ s $ (s + mod_type_class.from_nat p) \<in> residues (H $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. H $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
[PROOF STEP]
by (metis Hii_Kii)
[PROOF STATE]
proof (state)
this:
H $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have K_s_sp_residues: "(K $ s $ (s + from_nat p)) \<in> residues (K $ (s+from_nat p) $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
[PROOF STEP]
using above_diagonal_in_residues[OF K inv_K upper_triangular_K s_less]
[PROOF STATE]
proof (prove)
using this:
K $ s $ (LEAST n. K $ (s + mod_type_class.from_nat p) $ n \<noteq> (0::'a)) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (LEAST n. K $ (s + mod_type_class.from_nat p) $ n \<noteq> (0::'a)))

goal (1 subgoal):
 1. K $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
[PROOF STEP]
unfolding diagonal_least_nonzero[OF K inv_K upper_triangular_K]
[PROOF STATE]
proof (prove)
using this:
K $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. K $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
K $ s $ (s + mod_type_class.from_nat p) \<in> residues (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have Hs_sp_Ks_sp: "(H $ s $ (s + from_nat p)) = (K $ s $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H $ s $ (s + mod_type_class.from_nat p) = K $ s $ (s + mod_type_class.from_nat p)
[PROOF STEP]
using cong_HK in_Res_not_congruent[OF cs_residues H_s_sp_residues K_s_sp_residues]
[PROOF STATE]
proof (prove)
using this:
cong (H $ s $ (s + mod_type_class.from_nat p)) (K $ s $ (s + mod_type_class.from_nat p)) (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
H $ s $ (s + mod_type_class.from_nat p) \<noteq> K $ s $ (s + mod_type_class.from_nat p) \<Longrightarrow> \<not> cong (H $ s $ (s + mod_type_class.from_nat p)) (K $ s $ (s + mod_type_class.from_nat p)) (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. H $ s $ (s + mod_type_class.from_nat p) = K $ s $ (s + mod_type_class.from_nat p)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
H $ s $ (s + mod_type_class.from_nat p) = K $ s $ (s + mod_type_class.from_nat p)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
have "is_unit (K $ (s + from_nat p) $ (s + from_nat p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))
[PROOF STEP]
by (metis Hii_Kii inv_H invertible_iff_is_unit is_unit_diagonal upper_triangular_H)
[PROOF STATE]
proof (state)
this:
is_unit (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
hence "K $ (s + from_nat p) $ (s + from_nat p) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
is_unit (K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p))

goal (1 subgoal):
 1. K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) \<noteq> (0::'a)
[PROOF STEP]
by (metis not_is_unit_0)
[PROOF STATE]
proof (state)
this:
K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) \<noteq> (0::'a)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) \<noteq> (0::'a)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
unfolding from_nat_1
[PROOF STATE]
proof (prove)
using this:
K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) \<noteq> (0::'a)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
using H_s_sp
[PROOF STATE]
proof (prove)
using this:
K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) \<noteq> (0::'a)
H $ s $ (s + mod_type_class.from_nat p) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + K $ s $ (s + mod_type_class.from_nat p)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
unfolding Hs_sp_Ks_sp
[PROOF STATE]
proof (prove)
using this:
K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) \<noteq> (0::'a)
K $ s $ (s + mod_type_class.from_nat p) = U $ s $ (s + mod_type_class.from_nat p) * K $ (s + mod_type_class.from_nat p) $ (s + mod_type_class.from_nat p) + K $ s $ (s + mod_type_class.from_nat p)

goal (1 subgoal):
 1. U $ s $ (s + mod_type_class.from_nat p) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U $ s $ (s + mod_type_class.from_nat p) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
U $ s $ (s + mod_type_class.from_nat p) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
U $ s $ (s + mod_type_class.from_nat j) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>j s. 1 \<le> j \<and> j < ncols A - mod_type_class.to_nat s \<longrightarrow> U $ s $ (s + mod_type_class.from_nat j) = (0::'a)

goal (1 subgoal):
 1. H = K
[PROOF STEP]
have "U = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U = mat (1::'a)
[PROOF STEP]
proof (unfold mat_def vec_eq_iff, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. U $ ia $ ia = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
fix ia
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. U $ ia $ ia = (1::'a)
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
show "U $ ia $ ia = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U $ ia $ ia = (1::'a)
[PROOF STEP]
using Uii_1
[PROOF STATE]
proof (prove)
using this:
\<forall>i. U $ i $ i = (1::'a)

goal (1 subgoal):
 1. U $ ia $ ia = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U $ ia $ ia = (1::'a)

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
assume i_ia: "i \<noteq> ia"
[PROOF STATE]
proof (state)
this:
i \<noteq> ia

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
show "U $ i $ ia = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U $ i $ ia = (0::'a)
[PROOF STEP]
proof (cases "ia<i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
 2. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
ia < i

goal (2 subgoals):
 1. ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
 2. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ia < i

goal (1 subgoal):
 1. U $ i $ ia = (0::'a)
[PROOF STEP]
using upper_triangular_U
[PROOF STATE]
proof (prove)
using this:
ia < i
upper_triangular U

goal (1 subgoal):
 1. U $ i $ ia = (0::'a)
[PROOF STEP]
unfolding upper_triangular_def
[PROOF STATE]
proof (prove)
using this:
ia < i
\<forall>i j. j < i \<longrightarrow> U $ i $ j = (0::'a)

goal (1 subgoal):
 1. U $ i $ ia = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U $ i $ ia = (0::'a)

goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> ia < i

goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
hence i_less_ia: "i<ia"
[PROOF STATE]
proof (prove)
using this:
\<not> ia < i

goal (1 subgoal):
 1. i < ia
[PROOF STEP]
using i_ia
[PROOF STATE]
proof (prove)
using this:
\<not> ia < i
i \<noteq> ia

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

goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
define a where "a = to_nat ia - to_nat i"
[PROOF STATE]
proof (state)
this:
a = mod_type_class.to_nat ia - mod_type_class.to_nat i

goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
have ia_eq: "ia = i + from_nat a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia = i + mod_type_class.from_nat a
[PROOF STEP]
unfolding a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia = i + mod_type_class.from_nat (mod_type_class.to_nat ia - mod_type_class.to_nat i)
[PROOF STEP]
by (metis i_less_ia a_def add_to_nat_def dual_order.strict_iff_order from_nat_to_nat_id
            le_add_diff_inverse less_imp_diff_less to_nat_from_nat_id to_nat_less_card to_nat_mono)
[PROOF STATE]
proof (state)
this:
ia = i + mod_type_class.from_nat a

goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
have "1 \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> a
[PROOF STEP]
unfolding a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> mod_type_class.to_nat ia - mod_type_class.to_nat i
[PROOF STEP]
by (metis diff_is_0_eq i_less_ia less_one not_less to_nat_mono)
[PROOF STATE]
proof (state)
this:
1 \<le> a

goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 \<le> a

goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
have "a < ncols A - to_nat i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < ncols A - mod_type_class.to_nat i
[PROOF STEP]
unfolding a_def ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat ia - mod_type_class.to_nat i < CARD('n) - mod_type_class.to_nat i
[PROOF STEP]
by (metis False diff_less_mono not_less to_nat_less_card to_nat_mono')
[PROOF STATE]
proof (state)
this:
a < ncols A - mod_type_class.to_nat i

goal (1 subgoal):
 1. \<not> ia < i \<Longrightarrow> U $ i $ ia = (0::'a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 \<le> a
a < ncols A - mod_type_class.to_nat i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<le> a
a < ncols A - mod_type_class.to_nat i

goal (1 subgoal):
 1. U $ i $ ia = (0::'a)
[PROOF STEP]
using zero_above
[PROOF STATE]
proof (prove)
using this:
1 \<le> a
a < ncols A - mod_type_class.to_nat i
\<forall>j s. 1 \<le> j \<and> j < ncols A - mod_type_class.to_nat s \<longrightarrow> U $ s $ (s + mod_type_class.from_nat j) = (0::'a)

goal (1 subgoal):
 1. U $ i $ ia = (0::'a)
[PROOF STEP]
unfolding ia_eq
[PROOF STATE]
proof (prove)
using this:
1 \<le> a
a < ncols A - mod_type_class.to_nat i
\<forall>j s. 1 \<le> j \<and> j < ncols A - mod_type_class.to_nat s \<longrightarrow> U $ s $ (s + mod_type_class.from_nat j) = (0::'a)

goal (1 subgoal):
 1. U $ i $ (i + mod_type_class.from_nat a) = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
U $ i $ ia = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
U $ i $ ia = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
U = mat (1::'a)

goal (1 subgoal):
 1. H = K
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
U = mat (1::'a)

goal (1 subgoal):
 1. H = K
[PROOF STEP]
using H_UK matrix_mul_lid
[PROOF STATE]
proof (prove)
using this:
U = mat (1::'a)
H = U ** K
mat (1::?'a) ** ?A = ?A

goal (1 subgoal):
 1. H = K
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
H = K

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_default_map:
assumes "i<na"
shows "nth_default x (map f [0..<na]) i = f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default x (map f [0..<na]) i = f i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < na

goal (1 subgoal):
 1. nth_default x (map f [0..<na]) i = f i
[PROOF STEP]
by (simp add: nth_default_nth)


[STATEMENT]
lemma Im_divide_real:
  assumes "is_real b" and "b \<noteq> 0"
  shows "Im (a / b) = (Im a) / (Re b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (a / b) = Im a / Re b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_real b
b \<noteq> 0

goal (1 subgoal):
 1. Im (a / b) = Im a / Re b
[PROOF STEP]
by (simp add: complex_is_Real_iff)


[STATEMENT]
lemma rep_nat_pp_inj:
  assumes "rep_nat_pp x = rep_nat_pp y"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
have "abs_nat_pp (rep_nat_pp x) = abs_nat_pp (rep_nat_pp y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_nat_pp (rep_nat_pp x) = abs_nat_pp (rep_nat_pp y)
[PROOF STEP]
by (simp only: assms)
[PROOF STATE]
proof (state)
this:
abs_nat_pp (rep_nat_pp x) = abs_nat_pp (rep_nat_pp y)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
abs_nat_pp (rep_nat_pp x) = abs_nat_pp (rep_nat_pp y)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Path_append [simp]:
  "\<And>p. Path p f q (as@bs)  = (\<exists>y. Path p f y as \<and> Path y f q bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. Path p f q (as @ bs) = (\<exists>y. Path p f y as \<and> Path y f q bs)
[PROOF STEP]
by(induct as, simp+)