[STATEMENT]
lemma multiplicity_normalize_right [simp]:
  "multiplicity p (normalize x) = multiplicity p x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
 2. x \<noteq> (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
x \<noteq> (0::'a)

goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
 2. x \<noteq> (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
have "normalize x = (1 div unit_factor x) * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize x = (1::'a) div unit_factor x * x
[PROOF STEP]
by (simp add: unit_div_commute is_unit_unit_factor)
[PROOF STATE]
proof (state)
this:
normalize x = (1::'a) div unit_factor x * x

goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
 2. x \<noteq> (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
normalize x = (1::'a) div unit_factor x * x

goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
 2. x \<noteq> (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
have "multiplicity p \<dots> = multiplicity p x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p ((1::'a) div unit_factor x * x) = multiplicity p x
[PROOF STEP]
by (rule multiplicity_times_unit_right) (simp add: is_unit_unit_factor)
[PROOF STATE]
proof (state)
this:
multiplicity p ((1::'a) div unit_factor x * x) = multiplicity p x

goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
 2. x \<noteq> (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity p (normalize x) = multiplicity p x

goal (1 subgoal):
 1. multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
multiplicity p (normalize x) = multiplicity p x

goal (1 subgoal):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (normalize x) = multiplicity p x
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma rev_le [simp]:
  "rev xs \<le>\<^sub>v rev ys \<longleftrightarrow> xs \<le>\<^sub>v ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
assume i: "i < length ys" and [simp]: "length xs = length ys"
      and "\<forall>i < length ys. rev xs ! i \<le> rev ys ! i"
[PROOF STATE]
proof (state)
this:
i < length ys
length xs = length ys
\<forall>i<length ys. rev xs ! i \<le> rev ys ! i

goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length ys
length xs = length ys
\<forall>i<length ys. rev xs ! i \<le> rev ys ! i
[PROOF STEP]
have "rev xs ! (length ys - i - 1) \<le> rev ys ! (length ys - i - 1)"
[PROOF STATE]
proof (prove)
using this:
i < length ys
length xs = length ys
\<forall>i<length ys. rev xs ! i \<le> rev ys ! i

goal (1 subgoal):
 1. rev xs ! (length ys - i - 1) \<le> rev ys ! (length ys - i - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rev xs ! (length ys - i - 1) \<le> rev ys ! (length ys - i - 1)

goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rev xs ! (length ys - i - 1) \<le> rev ys ! (length ys - i - 1)
[PROOF STEP]
have "xs ! i \<le> ys ! i"
[PROOF STATE]
proof (prove)
using this:
rev xs ! (length ys - i - 1) \<le> rev ys ! (length ys - i - 1)

goal (1 subgoal):
 1. xs ! i \<le> ys ! i
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
rev xs ! (length ys - i - 1) \<le> rev ys ! (length ys - i - 1)
i < length ys

goal (1 subgoal):
 1. xs ! i \<le> ys ! i
[PROOF STEP]
by (auto simp: rev_nth)
[PROOF STATE]
proof (state)
this:
xs ! i \<le> ys ! i

goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < length ys; length xs = length ys; \<forall>i<length ys. rev xs ! i \<le> rev ys ! i\<rbrakk> \<Longrightarrow> xs ! ?i2 \<le> ys ! ?i2

goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?i2 < length ys; length xs = length ys; \<forall>i<length ys. rev xs ! i \<le> rev ys ! i\<rbrakk> \<Longrightarrow> xs ! ?i2 \<le> ys ! ?i2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < length ys; length xs = length ys; \<forall>i<length ys. rev xs ! i \<le> rev ys ! i\<rbrakk> \<Longrightarrow> xs ! ?i2 \<le> ys ! ?i2

goal (1 subgoal):
 1. (rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)
[PROOF STEP]
by (auto simp: less_eq_def rev_nth)
[PROOF STATE]
proof (state)
this:
(rev xs \<le>\<^sub>v rev ys) = (xs \<le>\<^sub>v ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<L>\<^sub>b_iter_mono:
  assumes "u \<le> v" shows "vi u n \<le> vi v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<L>\<^sub>b ^^ n) u \<le> (\<L>\<^sub>b ^^ n) v
[PROOF STEP]
using assms \<L>\<^sub>b_mono
[PROOF STATE]
proof (prove)
using this:
u \<le> v
?u \<le> ?v \<Longrightarrow> \<L>\<^sub>b ?u \<le> \<L>\<^sub>b ?v

goal (1 subgoal):
 1. (\<L>\<^sub>b ^^ n) u \<le> (\<L>\<^sub>b ^^ n) v
[PROOF STEP]
by (induction n) auto


[STATEMENT]
lemma val_of_append[simp]: "valid (l@[v]) i \<Longrightarrow>
      val_of (l@[v]) i = (if valid l i then val_of l i else v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid (l @ [v]) i \<Longrightarrow> val_of (l @ [v]) i = (if valid l i then val_of l i else v)
[PROOF STEP]
unfolding valid_def val_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < i \<and> i \<le> length (l @ [v]) \<Longrightarrow> (l @ [v]) ! (i - 1) = (if 0 < i \<and> i \<le> length l then l ! (i - 1) else v)
[PROOF STEP]
by (auto simp: nth_append)


[STATEMENT]
lemma mset_msort: "mset (msort xs) = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (msort xs) = mset xs
[PROOF STEP]
proof(induction xs rule: msort.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (take (x div 2) xs)) = mset (take (x div 2) xs); \<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (drop (x div 2) xs)) = mset (drop (x div 2) xs)\<rbrakk> \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
case (1 xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x = length xs; \<not> ?x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (take (?x div 2) xs)) = mset (take (?x div 2) xs)
\<lbrakk>?x = length xs; \<not> ?x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (drop (?x div 2) xs)) = mset (drop (?x div 2) xs)

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (take (x div 2) xs)) = mset (take (x div 2) xs); \<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (drop (x div 2) xs)) = mset (drop (x div 2) xs)\<rbrakk> \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
let ?n = "length xs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (take (x div 2) xs)) = mset (take (x div 2) xs); \<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (drop (x div 2) xs)) = mset (drop (x div 2) xs)\<rbrakk> \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
let ?ys = "take (?n div 2) xs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (take (x div 2) xs)) = mset (take (x div 2) xs); \<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (drop (x div 2) xs)) = mset (drop (x div 2) xs)\<rbrakk> \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
let ?zs = "drop (?n div 2) xs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (take (x div 2) xs)) = mset (take (x div 2) xs); \<And>x. \<lbrakk>x = length xs; \<not> x \<le> 1\<rbrakk> \<Longrightarrow> mset (msort (drop (x div 2) xs)) = mset (drop (x div 2) xs)\<rbrakk> \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (msort xs) = mset xs
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> mset (msort xs) = mset xs
 2. \<not> ?P \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
assume "?n \<le> 1"
[PROOF STATE]
proof (state)
this:
length xs \<le> 1

goal (2 subgoals):
 1. ?P \<Longrightarrow> mset (msort xs) = mset xs
 2. \<not> ?P \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
length xs \<le> 1

goal (1 subgoal):
 1. mset (msort xs) = mset xs
[PROOF STEP]
by(simp add: msort.simps[of xs])
[PROOF STATE]
proof (state)
this:
mset (msort xs) = mset xs

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
assume "\<not> ?n \<le> 1"
[PROOF STATE]
proof (state)
this:
\<not> length xs \<le> 1

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
hence "mset (msort xs) = mset (msort ?ys) + mset (msort ?zs)"
[PROOF STATE]
proof (prove)
using this:
\<not> length xs \<le> 1

goal (1 subgoal):
 1. mset (msort xs) = mset (msort (take (length xs div 2) xs)) + mset (msort (drop (length xs div 2) xs))
[PROOF STEP]
by(simp add: msort.simps[of xs] mset_merge)
[PROOF STATE]
proof (state)
this:
mset (msort xs) = mset (msort (take (length xs div 2) xs)) + mset (msort (drop (length xs div 2) xs))

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mset (msort xs) = mset (msort (take (length xs div 2) xs)) + mset (msort (drop (length xs div 2) xs))

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
have "\<dots> = mset ?ys + mset ?zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (msort (take (length xs div 2) xs)) + mset (msort (drop (length xs div 2) xs)) = mset (take (length xs div 2) xs) + mset (drop (length xs div 2) xs)
[PROOF STEP]
using \<open>\<not> ?n \<le> 1\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> length xs \<le> 1

goal (1 subgoal):
 1. mset (msort (take (length xs div 2) xs)) + mset (msort (drop (length xs div 2) xs)) = mset (take (length xs div 2) xs) + mset (drop (length xs div 2) xs)
[PROOF STEP]
by(simp add: "1.IH")
[PROOF STATE]
proof (state)
this:
mset (msort (take (length xs div 2) xs)) + mset (msort (drop (length xs div 2) xs)) = mset (take (length xs div 2) xs) + mset (drop (length xs div 2) xs)

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mset (msort (take (length xs div 2) xs)) + mset (msort (drop (length xs div 2) xs)) = mset (take (length xs div 2) xs) + mset (drop (length xs div 2) xs)

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
have "\<dots> = mset (?ys @ ?zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (take (length xs div 2) xs) + mset (drop (length xs div 2) xs) = mset (take (length xs div 2) xs @ drop (length xs div 2) xs)
[PROOF STEP]
by (simp del: append_take_drop_id)
[PROOF STATE]
proof (state)
this:
mset (take (length xs div 2) xs) + mset (drop (length xs div 2) xs) = mset (take (length xs div 2) xs @ drop (length xs div 2) xs)

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mset (take (length xs div 2) xs) + mset (drop (length xs div 2) xs) = mset (take (length xs div 2) xs @ drop (length xs div 2) xs)

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
have "\<dots> = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (take (length xs div 2) xs @ drop (length xs div 2) xs) = mset xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mset (take (length xs div 2) xs @ drop (length xs div 2) xs) = mset xs

goal (1 subgoal):
 1. \<not> length xs \<le> 1 \<Longrightarrow> mset (msort xs) = mset xs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mset (msort xs) = mset xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mset (msort xs) = mset xs

goal (1 subgoal):
 1. mset (msort xs) = mset xs
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mset (msort xs) = mset xs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mset (msort xs) = mset xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prv_ball_Num_imp_ball_suc:  \<comment> \<open>O9\<close>
assumes [simp]: "x \<in> var" "\<phi> \<in> fmla"
shows "prv (imp (ball x (Num n) \<phi>)
                (ball x (suc (Num n)) (imp (neg (eql (Var x) (suc (Num n)))) \<phi>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp (ball x (Num n) \<phi>) (ball x (suc (Num n)) (imp (neg (eql (Var x) (suc (Num n)))) \<phi>)))
[PROOF STEP]
apply(nrule r: nprv_prvI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {} (imp (ball x (Num n) \<phi>) (ball x (suc (Num n)) (imp (neg (eql (Var x) (suc (Num n)))) \<phi>)))
[PROOF STEP]
apply(nrule r: nprv_impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {ball x (Num n) \<phi>} (ball x (suc (Num n)) (imp (neg (eql (Var x) (suc (Num n)))) \<phi>))
[PROOF STEP]
apply(nrule r: nprv_ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {LLq (Var x) (suc (Num n)), ball x (Num n) \<phi>} (imp (neg (eql (Var x) (suc (Num n)))) \<phi>)
[PROOF STEP]
apply(nrule r: nprv_impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {neg (eql (Var x) (suc (Num n))), LLq (Var x) (suc (Num n)), ball x (Num n) \<phi>} \<phi>
[PROOF STEP]
apply(nrule r: nprv_LLq_neg_Num_sucE01)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {LLq (Var x) (Num n), neg (eql (Var x) (suc (Num n))), LLq (Var x) (suc (Num n)), ball x (Num n) \<phi>} \<phi>
[PROOF STEP]
apply(nrule r: nprv_clear4_2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {LLq (Var x) (Num n), LLq (Var x) (suc (Num n)), ball x (Num n) \<phi>} \<phi>
[PROOF STEP]
apply(nrule r: nprv_clear3_2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {LLq (Var x) (Num n), ball x (Num n) \<phi>} \<phi>
[PROOF STEP]
apply(nrule r: nprv_ballE0[of x "Num n" \<phi> _ "Var x"])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.


[STATEMENT]
lemma antisym_llexord:
  assumes r: "antisymp r"
  and irrefl: "\<And>x. \<not> r x x"
  shows "antisymp (llexord r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. antisymp (llexord r)
[PROOF STEP]
proof(rule antisympI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>llexord r x y; llexord r y x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix xs ys
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>llexord r x y; llexord r y x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "llexord r xs ys"
    and "llexord r ys xs"
[PROOF STATE]
proof (state)
this:
llexord r xs ys
llexord r ys xs

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>llexord r x y; llexord r y x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "llexord r xs ys \<and> llexord r ys xs"
[PROOF STATE]
proof (prove)
using this:
llexord r xs ys
llexord r ys xs

goal (1 subgoal):
 1. llexord r xs ys \<and> llexord r ys xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
llexord r xs ys \<and> llexord r ys xs

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>llexord r x y; llexord r y x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus "xs = ys"
[PROOF STATE]
proof (prove)
using this:
llexord r xs ys \<and> llexord r ys xs

goal (1 subgoal):
 1. xs = ys
[PROOF STEP]
by (coinduct rule: llist.coinduct)
      (auto 4 3 simp add: not_lnull_conv irrefl dest: antisympD[OF r, simplified])
[PROOF STATE]
proof (state)
this:
xs = ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_subpath [simp]:
  fixes g :: "real \<Rightarrow> 'a::real_normed_vector"
  assumes "path g" "u \<in> {0..1}" "v \<in> {0..1}"
    shows "path(subpath u v g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path (subpath u v g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path (subpath u v g)
[PROOF STEP]
have "continuous_on {0..1} (g \<circ> (\<lambda>x. ((v-u) * x+ u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (g \<circ> (\<lambda>x. (v - u) * x + u))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path g
u \<in> {0..1}
v \<in> {0..1}

goal (1 subgoal):
 1. continuous_on {0..1} (g \<circ> (\<lambda>x. (v - u) * x + u))
[PROOF STEP]
apply (intro continuous_intros; simp add: image_affinity_atLeastAtMost [where c=u])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> u \<and> u \<le> 1; 0 \<le> v \<and> v \<le> 1; path g\<rbrakk> \<Longrightarrow> (u \<le> v \<longrightarrow> continuous_on {u..v} g) \<and> (\<not> u \<le> v \<longrightarrow> continuous_on {v..u} g)
[PROOF STEP]
apply (auto simp: path_def continuous_on_subset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (g \<circ> (\<lambda>x. (v - u) * x + u))

goal (1 subgoal):
 1. path (subpath u v g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} (g \<circ> (\<lambda>x. (v - u) * x + u))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (g \<circ> (\<lambda>x. (v - u) * x + u))

goal (1 subgoal):
 1. path (subpath u v g)
[PROOF STEP]
by (simp add: path_def subpath_def)
[PROOF STATE]
proof (state)
this:
path (subpath u v g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dgrad_sig_setD_rep_list_lt:
  assumes "dickson_grading d" and "p \<in> dgrad_sig_set' j d"
  shows "d (punit.lt (rep_list p)) \<le> dgrad_max d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
proof (cases "rep_list p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rep_list p = 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
 2. rep_list p \<noteq> 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
rep_list p = 0

goal (2 subgoals):
 1. rep_list p = 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
 2. rep_list p \<noteq> 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
by (simp add: True dgrad_max_0)
[PROOF STATE]
proof (state)
this:
d (punit.lt (rep_list p)) \<le> dgrad_max d

goal (1 subgoal):
 1. rep_list p \<noteq> 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rep_list p \<noteq> 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
rep_list p \<noteq> 0

goal (1 subgoal):
 1. rep_list p \<noteq> 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
p \<in> dgrad_sig_set' j d
[PROOF STEP]
have "p \<in> dgrad_max_set d"
[PROOF STATE]
proof (prove)
using this:
p \<in> dgrad_sig_set' j d

goal (1 subgoal):
 1. p \<in> dgrad_max_set d
[PROOF STEP]
by (simp add: dgrad_sig_set'_def)
[PROOF STATE]
proof (state)
this:
p \<in> dgrad_max_set d

goal (1 subgoal):
 1. rep_list p \<noteq> 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
with assms(1)
[PROOF STATE]
proof (chain)
picking this:
dickson_grading d
p \<in> dgrad_max_set d
[PROOF STEP]
have "rep_list p \<in> punit_dgrad_max_set d"
[PROOF STATE]
proof (prove)
using this:
dickson_grading d
p \<in> dgrad_max_set d

goal (1 subgoal):
 1. rep_list p \<in> punit_dgrad_max_set d
[PROOF STEP]
by (rule dgrad_max_2)
[PROOF STATE]
proof (state)
this:
rep_list p \<in> punit_dgrad_max_set d

goal (1 subgoal):
 1. rep_list p \<noteq> 0 \<Longrightarrow> d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
rep_list p \<in> punit_dgrad_max_set d

goal (1 subgoal):
 1. d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
rep_list p \<in> punit_dgrad_max_set d
rep_list p \<noteq> 0

goal (1 subgoal):
 1. d (punit.lt (rep_list p)) \<le> dgrad_max d
[PROOF STEP]
by (rule punit.dgrad_p_setD_lp[simplified])
[PROOF STATE]
proof (state)
this:
d (punit.lt (rep_list p)) \<le> dgrad_max d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_unique:
  "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> independent B \<Longrightarrow> card B = n \<Longrightarrow> dim V = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<subseteq> V; V \<subseteq> span B; independent B; card B = n\<rbrakk> \<Longrightarrow> dim V = n
[PROOF STEP]
by (metis basis_card_eq_dim)


[STATEMENT]
lemma rbt_split_comp_size: "(l2, b, r2) = rbt_split_comp t2 a \<Longrightarrow> size l2 + size r2 \<le> size t2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l2, b, r2) = local.rbt_split_comp t2 a \<Longrightarrow> size l2 + size r2 \<le> size t2
[PROOF STEP]
by (induction t2 a arbitrary: l2 b r2 rule: rbt_split_comp.induct)
     (auto split: order.splits if_splits prod.splits)


[STATEMENT]
lemma GS_rec_fun_eq_GS_iter:
  assumes "\<forall>s' < s. v_next s' = GS_rec_fun v s'" "\<forall>s' \<in> {s'. s \<le> s'}. v_next s' = v s'"
  shows "GS_rec_fun v s = GS_rec_iter v_next s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
have "{s'. s' < s} \<union> {s'. s \<le> s'} = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {s'. s' < s} \<union> {s'. s \<le> s'} = UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{s'. s' < s} \<union> {s'. s \<le> s'} = UNIV

goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
hence *: "(\<Sum>s'<s. f s') + (\<Sum>s'\<in>Collect ((\<le>) s). f s') = (\<Sum>s' \<in> UNIV. f s')" for f
[PROOF STATE]
proof (prove)
using this:
{s'. s' < s} \<union> {s'. s \<le> s'} = UNIV

goal (1 subgoal):
 1. sum f {..<s} + sum f (Collect ((\<le>) s)) = sum f UNIV
[PROOF STEP]
by (subst sum.union_disjoint[symmetric]) (auto simp add: lessThan_def)
[PROOF STATE]
proof (state)
this:
sum ?f4 {..<s} + sum ?f4 (Collect ((\<le>) s)) = sum ?f4 UNIV

goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
have "GS_rec_fun v s = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GS_rec_fun v s = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s')))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>s'<s. v_next s' = GS_rec_fun v s'
\<forall>s'\<in>{s'. s \<le> s'}. v_next s' = v s'

goal (1 subgoal):
 1. GS_rec_fun v s = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s')))
[PROOF STEP]
by (subst GS_rec_fun.simps) auto
[PROOF STATE]
proof (state)
this:
GS_rec_fun v s = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s')))

goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
GS_rec_fun v s = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s')))

goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
have "\<dots> = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v_next s')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s'))) = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v_next s')))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>s'<s. v_next s' = GS_rec_fun v s'
\<forall>s'\<in>{s'. s \<le> s'}. v_next s' = v s'

goal (1 subgoal):
 1. (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s'))) = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v_next s')))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s'))) = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v_next s')))

goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v s'))) = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v_next s')))

goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
have "\<dots> = GS_rec_iter v_next s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v_next s'))) = GS_rec_iter v_next s
[PROOF STEP]
by (auto simp: * GS_rec_iter_def)
[PROOF STATE]
proof (state)
this:
(\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * v_next s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v_next s'))) = GS_rec_iter v_next s

goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
GS_rec_fun v s = GS_rec_iter v_next s

goal (1 subgoal):
 1. GS_rec_fun v s = GS_rec_iter v_next s
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
GS_rec_fun v s = GS_rec_iter v_next s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_distrib:
  fixes c::real
  assumes nn: "0 \<le> c"
  shows "c * max a b = max (c * a) (c * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * max a b = max (c * a) (c * b)
[PROOF STEP]
proof(cases "a \<le> b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
 2. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a \<le> b

goal (2 subgoals):
 1. a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
 2. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<le> b

goal (2 subgoals):
 1. a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
 2. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
with nn
[PROOF STATE]
proof (chain)
picking this:
0 \<le> c
a \<le> b
[PROOF STEP]
have "c * a \<le> c * b"
[PROOF STATE]
proof (prove)
using this:
0 \<le> c
a \<le> b

goal (1 subgoal):
 1. c * a \<le> c * b
[PROOF STEP]
by(auto intro:mult_left_mono)
[PROOF STATE]
proof (state)
this:
c * a \<le> c * b

goal (2 subgoals):
 1. a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
 2. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
c * a \<le> c * b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<le> b
c * a \<le> c * b

goal (1 subgoal):
 1. c * max a b = max (c * a) (c * b)
[PROOF STEP]
by(simp add:max.absorb2)
[PROOF STATE]
proof (state)
this:
c * max a b = max (c * a) (c * b)

goal (1 subgoal):
 1. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> a \<le> b

goal (1 subgoal):
 1. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> a \<le> b
[PROOF STEP]
have "b \<le> a"
[PROOF STATE]
proof (prove)
using this:
\<not> a \<le> b

goal (1 subgoal):
 1. b \<le> a
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
b \<le> a

goal (1 subgoal):
 1. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<le> a

goal (1 subgoal):
 1. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
with nn
[PROOF STATE]
proof (chain)
picking this:
0 \<le> c
b \<le> a
[PROOF STEP]
have "c * b \<le> c * a"
[PROOF STATE]
proof (prove)
using this:
0 \<le> c
b \<le> a

goal (1 subgoal):
 1. c * b \<le> c * a
[PROOF STEP]
by(auto intro:mult_left_mono)
[PROOF STATE]
proof (state)
this:
c * b \<le> c * a

goal (1 subgoal):
 1. \<not> a \<le> b \<Longrightarrow> c * max a b = max (c * a) (c * b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b \<le> a
c * b \<le> c * a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<le> a
c * b \<le> c * a

goal (1 subgoal):
 1. c * max a b = max (c * a) (c * b)
[PROOF STEP]
by(simp add:max.absorb1)
[PROOF STATE]
proof (state)
this:
c * max a b = max (c * a) (c * b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cauchy_product_sums:
  fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}"
  assumes a: "summable (\<lambda>k. norm (a k))"
    and b: "summable (\<lambda>k. norm (b k))"
  shows "(\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
let ?S1 = "\<lambda>n::nat. {..<n} \<times> {..<n}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
let ?S2 = "\<lambda>n::nat. {(i,j). i + j < n}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
have S1_mono: "\<And>m n. m \<le> n \<Longrightarrow> ?S1 m \<subseteq> ?S1 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. m \<le> n \<Longrightarrow> {..<m} \<times> {..<m} \<subseteq> {..<n} \<times> {..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?m \<le> ?n \<Longrightarrow> {..<?m} \<times> {..<?m} \<subseteq> {..<?n} \<times> {..<?n}

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
have S2_le_S1: "\<And>n. ?S2 n \<subseteq> ?S1 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. {(i, j). i + j < n} \<subseteq> {..<n} \<times> {..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(i, j). i + j < ?n} \<subseteq> {..<?n} \<times> {..<?n}

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
have S1_le_S2: "\<And>n. ?S1 (n div 2) \<subseteq> ?S2 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. {..<n div 2} \<times> {..<n div 2} \<subseteq> {(i, j). i + j < n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..<?n div 2} \<times> {..<?n div 2} \<subseteq> {(i, j). i + j < ?n}

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
have finite_S1: "\<And>n. finite (?S1 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. finite ({..<n} \<times> {..<n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite ({..<?n} \<times> {..<?n})

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
with S2_le_S1
[PROOF STATE]
proof (chain)
picking this:
{(i, j). i + j < ?n} \<subseteq> {..<?n} \<times> {..<?n}
finite ({..<?n} \<times> {..<?n})
[PROOF STEP]
have finite_S2: "\<And>n. finite (?S2 n)"
[PROOF STATE]
proof (prove)
using this:
{(i, j). i + j < ?n} \<subseteq> {..<?n} \<times> {..<?n}
finite ({..<?n} \<times> {..<?n})

goal (1 subgoal):
 1. \<And>n. finite {(i, j). i + j < n}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {(i, j). i + j < ?n}

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
let ?g = "\<lambda>(i,j). a i * b j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
let ?f = "\<lambda>(i,j). norm (a i) * norm (b j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
have f_nonneg: "\<And>x. 0 \<le> ?f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 \<le> (case x of (i, j) \<Rightarrow> norm (a i) * norm (b j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> (case ?x of (i, j) \<Rightarrow> norm (a i) * norm (b j))

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> (case ?x of (i, j) \<Rightarrow> norm (a i) * norm (b j))
[PROOF STEP]
have norm_sum_f: "\<And>A. norm (sum ?f A) = sum ?f A"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (case ?x of (i, j) \<Rightarrow> norm (a i) * norm (b j))

goal (1 subgoal):
 1. \<And>A. norm (\<Sum>(i, j)\<in>A. norm (a i) * norm (b j)) = (\<Sum>(i, j)\<in>A. norm (a i) * norm (b j))
[PROOF STEP]
unfolding real_norm_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> (case ?x of (i, j) \<Rightarrow> norm (a i) * norm (b j))

goal (1 subgoal):
 1. \<And>A. \<bar>\<Sum>(i, j)\<in>A. norm (a i) * norm (b j)\<bar> = (\<Sum>(i, j)\<in>A. norm (a i) * norm (b j))
[PROOF STEP]
by (simp only: abs_of_nonneg sum_nonneg [rule_format])
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(i, j)\<in>?A. norm (a i) * norm (b j)) = (\<Sum>(i, j)\<in>?A. norm (a i) * norm (b j))

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
have "(\<lambda>n. (\<Sum>k<n. a k) * (\<Sum>k<n. b k)) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sum a {..<n} * sum b {..<n}) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)
[PROOF STEP]
by (intro tendsto_mult summable_LIMSEQ summable_norm_cancel [OF a] summable_norm_cancel [OF b])
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sum a {..<n} * sum b {..<n}) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. sum a {..<n} * sum b {..<n}) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)
[PROOF STEP]
have 1: "(\<lambda>n. sum ?g (?S1 n)) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. sum a {..<n} * sum b {..<n}) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. a i * b j) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)
[PROOF STEP]
by (simp only: sum_product sum.Sigma [rule_format] finite_lessThan)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. a i * b j) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
have "(\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))
[PROOF STEP]
using a b
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. norm (a k))
summable (\<lambda>k. norm (b k))

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))
[PROOF STEP]
by (intro tendsto_mult summable_LIMSEQ)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))
[PROOF STEP]
have "(\<lambda>n. sum ?f (?S1 n)) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j)) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))
[PROOF STEP]
by (simp only: sum_product sum.Sigma [rule_format] finite_lessThan)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j)) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j)) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))
[PROOF STEP]
have "convergent (\<lambda>n. sum ?f (?S1 n))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j)) \<longlonglongrightarrow> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))

goal (1 subgoal):
 1. convergent (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))
[PROOF STEP]
by (rule convergentI)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
convergent (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))
[PROOF STEP]
have Cauchy: "Cauchy (\<lambda>n. sum ?f (?S1 n))"
[PROOF STATE]
proof (prove)
using this:
convergent (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))

goal (1 subgoal):
 1. Cauchy (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))
[PROOF STEP]
by (rule convergent_Cauchy)
[PROOF STATE]
proof (state)
this:
Cauchy (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
have "Zfun (\<lambda>n. sum ?f (?S1 n - ?S2 n)) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) sequentially
[PROOF STEP]
proof (rule ZfunI, simp only: eventually_sequentially norm_sum_f)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
fix r :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
assume r: "0 < r"
[PROOF STATE]
proof (state)
this:
0 < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
from CauchyD [OF Cauchy r]
[PROOF STATE]
proof (chain)
picking this:
\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm ((\<Sum>(i, j)\<in>{..<m} \<times> {..<m}. norm (a i) * norm (b j)) - (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))) < r
[PROOF STEP]
obtain N
      where "\<forall>m\<ge>N. \<forall>n\<ge>N. norm (sum ?f (?S1 m) - sum ?f (?S1 n)) < r"
[PROOF STATE]
proof (prove)
using this:
\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm ((\<Sum>(i, j)\<in>{..<m} \<times> {..<m}. norm (a i) * norm (b j)) - (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))) < r

goal (1 subgoal):
 1. (\<And>N. \<forall>m\<ge>N. \<forall>n\<ge>N. norm ((\<Sum>(i, j)\<in>{..<m} \<times> {..<m}. norm (a i) * norm (b j)) - (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))) < r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<forall>m\<ge>N. \<forall>n\<ge>N. norm ((\<Sum>(i, j)\<in>{..<m} \<times> {..<m}. norm (a i) * norm (b j)) - (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))) < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>m\<ge>N. \<forall>n\<ge>N. norm ((\<Sum>(i, j)\<in>{..<m} \<times> {..<m}. norm (a i) * norm (b j)) - (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))) < r
[PROOF STEP]
have "\<And>m n. N \<le> n \<Longrightarrow> n \<le> m \<Longrightarrow> norm (sum ?f (?S1 m - ?S1 n)) < r"
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<ge>N. \<forall>n\<ge>N. norm ((\<Sum>(i, j)\<in>{..<m} \<times> {..<m}. norm (a i) * norm (b j)) - (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. norm (a i) * norm (b j))) < r

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> norm (\<Sum>(i, j)\<in>{..<m} \<times> {..<m} - {..<n} \<times> {..<n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
by (simp only: sum_diff finite_S1 S1_mono)
[PROOF STATE]
proof (state)
this:
\<lbrakk>N \<le> ?n; ?n \<le> ?m\<rbrakk> \<Longrightarrow> norm (\<Sum>(i, j)\<in>{..<?m} \<times> {..<?m} - {..<?n} \<times> {..<?n}. norm (a i) * norm (b j)) < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>N \<le> ?n; ?n \<le> ?m\<rbrakk> \<Longrightarrow> norm (\<Sum>(i, j)\<in>{..<?m} \<times> {..<?m} - {..<?n} \<times> {..<?n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
have N: "\<And>m n. N \<le> n \<Longrightarrow> n \<le> m \<Longrightarrow> sum ?f (?S1 m - ?S1 n) < r"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>N \<le> ?n; ?n \<le> ?m\<rbrakk> \<Longrightarrow> norm (\<Sum>(i, j)\<in>{..<?m} \<times> {..<?m} - {..<?n} \<times> {..<?n}. norm (a i) * norm (b j)) < r

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> (\<Sum>(i, j)\<in>{..<m} \<times> {..<m} - {..<n} \<times> {..<n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
by (simp only: norm_sum_f)
[PROOF STATE]
proof (state)
this:
\<lbrakk>N \<le> ?n; ?n \<le> ?m\<rbrakk> \<Longrightarrow> (\<Sum>(i, j)\<in>{..<?m} \<times> {..<?m} - {..<?n} \<times> {..<?n}. norm (a i) * norm (b j)) < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
show "\<exists>N. \<forall>n\<ge>N. sum ?f (?S1 n - ?S2 n) < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
proof (intro exI allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
assume "2 * N \<le> n"
[PROOF STATE]
proof (state)
this:
2 * N \<le> n

goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * N \<le> n
[PROOF STEP]
have n: "N \<le> n div 2"
[PROOF STATE]
proof (prove)
using this:
2 * N \<le> n

goal (1 subgoal):
 1. N \<le> n div 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
N \<le> n div 2

goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
have "sum ?f (?S1 n - ?S2 n) \<le> sum ?f (?S1 n - ?S1 (n div 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) \<le> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {..<n div 2} \<times> {..<n div 2}. norm (a i) * norm (b j))
[PROOF STEP]
by (intro sum_mono2 finite_Diff finite_S1 f_nonneg Diff_mono subset_refl S1_le_S2)
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) \<le> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {..<n div 2} \<times> {..<n div 2}. norm (a i) * norm (b j))

goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) \<le> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {..<n div 2} \<times> {..<n div 2}. norm (a i) * norm (b j))

goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
have "\<dots> < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {..<n div 2} \<times> {..<n div 2}. norm (a i) * norm (b j)) < r
[PROOF STEP]
using n div_le_dividend
[PROOF STATE]
proof (prove)
using this:
N \<le> n div 2
?m div ?n \<le> ?m

goal (1 subgoal):
 1. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {..<n div 2} \<times> {..<n div 2}. norm (a i) * norm (b j)) < r
[PROOF STEP]
by (rule N)
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {..<n div 2} \<times> {..<n div 2}. norm (a i) * norm (b j)) < r

goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
show "sum ?f (?S1 n - ?S2 n) < r"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r

goal (1 subgoal):
 1. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>n\<ge>N. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) < r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) sequentially

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) sequentially
[PROOF STEP]
have "Zfun (\<lambda>n. sum ?g (?S1 n - ?S2 n)) sequentially"
[PROOF STATE]
proof (prove)
using this:
Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. norm (a i) * norm (b j)) sequentially

goal (1 subgoal):
 1. Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. a i * b j) sequentially
[PROOF STEP]
apply (rule Zfun_le [rule_format])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. norm (\<Sum>(i, j)\<in>{..<x} \<times> {..<x} - {(i, j). i + j < x}. a i * b j) \<le> norm (\<Sum>(i, j)\<in>{..<x} \<times> {..<x} - {(i, j). i + j < x}. norm (a i) * norm (b j))
[PROOF STEP]
apply (simp only: norm_sum_f)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. norm (\<Sum>(i, j)\<in>{..<x} \<times> {..<x} - {(i, j). i + j < x}. a i * b j) \<le> (\<Sum>(i, j)\<in>{..<x} \<times> {..<x} - {(i, j). i + j < x}. norm (a i) * norm (b j))
[PROOF STEP]
apply (rule order_trans [OF norm_sum sum_mono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x i. i \<in> {..<x} \<times> {..<x} - {(i, j). i + j < x} \<Longrightarrow> norm (case i of (i, j) \<Rightarrow> a i * b j) \<le> (case i of (i, j) \<Rightarrow> norm (a i) * norm (b j))
[PROOF STEP]
apply (auto simp add: norm_mult_ineq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. a i * b j) sequentially

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. a i * b j) sequentially
[PROOF STEP]
have 2: "(\<lambda>n. sum ?g (?S1 n) - sum ?g (?S2 n)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. a i * b j) sequentially

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. a i * b j) - (\<Sum>(i, j)\<in>{(i, j). i + j < n}. a i * b j)) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
unfolding tendsto_Zfun_iff diff_0_right
[PROOF STATE]
proof (prove)
using this:
Zfun (\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n} - {(i, j). i + j < n}. a i * b j) sequentially

goal (1 subgoal):
 1. Zfun (\<lambda>x. (\<Sum>(i, j)\<in>{..<x} \<times> {..<x}. a i * b j) - (\<Sum>(i, j)\<in>{(i, j). i + j < x}. a i * b j)) sequentially
[PROOF STEP]
by (simp only: sum_diff finite_S1 S2_le_S1)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. a i * b j) - (\<Sum>(i, j)\<in>{(i, j). i + j < n}. a i * b j)) \<longlonglongrightarrow> (0::'a)

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. a i * b j) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)
(\<lambda>n. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. a i * b j) - (\<Sum>(i, j)\<in>{(i, j). i + j < n}. a i * b j)) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
have "(\<lambda>n. sum ?g (?S2 n)) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>(i, j)\<in>{..<n} \<times> {..<n}. a i * b j) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)
(\<lambda>n. (\<Sum>(i, j)\<in>{..<n} \<times> {..<n}. a i * b j) - (\<Sum>(i, j)\<in>{(i, j). i + j < n}. a i * b j)) \<longlonglongrightarrow> (0::'a)

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>(i, j)\<in>{(i, j). i + j < n}. a i * b j) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)
[PROOF STEP]
by (rule Lim_transform2)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>(i, j)\<in>{(i, j). i + j < n}. a i * b j) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>(i, j)\<in>{(i, j). i + j < n}. a i * b j) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>(i, j)\<in>{(i, j). i + j < n}. a i * b j) \<longlonglongrightarrow> (\<Sum>k. a k) * (\<Sum>k. b k)

goal (1 subgoal):
 1. (\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))
[PROOF STEP]
by (simp only: sums_def sum.triangle_reindex)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. \<Sum>i\<le>k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trace_length: "length (trace n f g xs x) = Suc x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (trace n f g xs x) = Suc x
[PROOF STEP]
using trace_def
[PROOF STATE]
proof (prove)
using this:
trace ?n ?f ?g ?xs ?x \<equiv> map (\<lambda>y. the (eval (Pr ?n ?f ?g) (y # ?xs))) (rev [0..<Suc ?x])

goal (1 subgoal):
 1. length (trace n f g xs x) = Suc x
[PROOF STEP]
by simp


[STATEMENT]
lemma split_float_intervalD: "split_float_interval X = (A, B) \<Longrightarrow> set_of X \<subseteq> set_of A \<union> set_of B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. split_float_interval X = (A, B) \<Longrightarrow> set_of X \<subseteq> set_of A \<union> set_of B
[PROOF STEP]
by (auto dest!: split_intervalD simp: split_float_interval_def)


[STATEMENT]
lemma sub_block_comp: \<open>sub_block f (sub_block g block) = sub_block (f o g) block\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_block f (sub_block g block) = sub_block (f \<circ> g) block
[PROOF STEP]
using sub_list_comp
[PROOF STATE]
proof (prove)
using this:
sub_list ?f (sub_list ?g ?ps) = sub_list (?f \<circ> ?g) ?ps

goal (1 subgoal):
 1. sub_block f (sub_block g block) = sub_block (f \<circ> g) block
[PROOF STEP]
by (induct block) simp_all


[STATEMENT]
lemma frontier_Union_subset_closure:
  fixes F :: "'a::real_normed_vector set set"
  shows "frontier(\<Union>F) \<subseteq> closure(\<Union>t \<in> F. frontier t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier (\<Union> F) \<subseteq> closure (\<Union> (frontier ` F))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. frontier (\<Union> F) \<subseteq> closure (\<Union> (frontier ` F))
[PROOF STEP]
have "\<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e"
       if "T \<in> F" "y \<in> T" "dist y x < e"
          "x \<notin> interior (\<Union>F)" "0 < e" for x y e T
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
proof (cases "x \<in> T")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
 2. x \<notin> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> T

goal (2 subgoals):
 1. x \<in> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
 2. x \<notin> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
T \<in> F
y \<in> T
dist y x < e
x \<notin> interior (\<Union> F)
0 < e
x \<in> T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
T \<in> F
y \<in> T
dist y x < e
x \<notin> interior (\<Union> F)
0 < e
x \<in> T

goal (1 subgoal):
 1. \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
by (metis Diff_iff Sup_upper closure_subset contra_subsetD dist_self frontier_def interior_mono)
[PROOF STATE]
proof (state)
this:
\<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e

goal (1 subgoal):
 1. x \<notin> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> T

goal (1 subgoal):
 1. x \<notin> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
have 1: "closed_segment x y \<inter> T \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment x y \<inter> T \<noteq> {}
[PROOF STEP]
using \<open>y \<in> T\<close>
[PROOF STATE]
proof (prove)
using this:
y \<in> T

goal (1 subgoal):
 1. closed_segment x y \<inter> T \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
closed_segment x y \<inter> T \<noteq> {}

goal (1 subgoal):
 1. x \<notin> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
have 2: "closed_segment x y - T \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment x y - T \<noteq> {}
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
x \<notin> T

goal (1 subgoal):
 1. closed_segment x y - T \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
closed_segment x y - T \<noteq> {}

goal (1 subgoal):
 1. x \<notin> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
obtain c where "c \<in> closed_segment x y" "c \<in> frontier T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> closed_segment x y; c \<in> frontier T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using False connected_Int_frontier [OF connected_segment 1 2]
[PROOF STATE]
proof (prove)
using this:
x \<notin> T
closed_segment x y \<inter> frontier T \<noteq> {}

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> closed_segment x y; c \<in> frontier T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<in> closed_segment x y
c \<in> frontier T

goal (1 subgoal):
 1. x \<notin> T \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<in> closed_segment x y
c \<in> frontier T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c \<in> closed_segment x y
c \<in> frontier T

goal (1 subgoal):
 1. \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>c \<in> closed_segment x y; c \<in> frontier T\<rbrakk> \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
have "norm (y - x) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (y - x) < e
[PROOF STEP]
by (metis dist_norm \<open>dist y x < e\<close>)
[PROOF STATE]
proof (state)
this:
norm (y - x) < e

goal (1 subgoal):
 1. \<lbrakk>c \<in> closed_segment x y; c \<in> frontier T\<rbrakk> \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
norm (y - x) < e

goal (1 subgoal):
 1. \<lbrakk>c \<in> closed_segment x y; c \<in> frontier T\<rbrakk> \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
have "norm (c - x) \<le> norm (y - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (c - x) \<le> norm (y - x)
[PROOF STEP]
by (simp add: \<open>c \<in> closed_segment x y\<close> segment_bound(1))
[PROOF STATE]
proof (state)
this:
norm (c - x) \<le> norm (y - x)

goal (1 subgoal):
 1. \<lbrakk>c \<in> closed_segment x y; c \<in> frontier T\<rbrakk> \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
norm (y - x) < e
norm (c - x) \<le> norm (y - x)
[PROOF STEP]
have "norm (c - x) < e"
[PROOF STATE]
proof (prove)
using this:
norm (y - x) < e
norm (c - x) \<le> norm (y - x)

goal (1 subgoal):
 1. norm (c - x) < e
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
norm (c - x) < e

goal (1 subgoal):
 1. \<lbrakk>c \<in> closed_segment x y; c \<in> frontier T\<rbrakk> \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (c - x) < e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (c - x) < e

goal (1 subgoal):
 1. \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e
[PROOF STEP]
by (metis (no_types) \<open>c \<in> frontier T\<close> dist_norm that(1))
[PROOF STATE]
proof (state)
this:
\<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>y\<in>F. \<exists>y\<in>frontier y. dist y x < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?T \<in> F; ?y \<in> ?T; dist ?y ?x < ?e; ?x \<notin> interior (\<Union> F); 0 < ?e\<rbrakk> \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y ?x < ?e

goal (1 subgoal):
 1. frontier (\<Union> F) \<subseteq> closure (\<Union> (frontier ` F))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?T \<in> F; ?y \<in> ?T; dist ?y ?x < ?e; ?x \<notin> interior (\<Union> F); 0 < ?e\<rbrakk> \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y ?x < ?e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?T \<in> F; ?y \<in> ?T; dist ?y ?x < ?e; ?x \<notin> interior (\<Union> F); 0 < ?e\<rbrakk> \<Longrightarrow> \<exists>y\<in>F. \<exists>y\<in>frontier y. dist y ?x < ?e

goal (1 subgoal):
 1. frontier (\<Union> F) \<subseteq> closure (\<Union> (frontier ` F))
[PROOF STEP]
by (fastforce simp add: frontier_def closure_approachable)
[PROOF STATE]
proof (state)
this:
frontier (\<Union> F) \<subseteq> closure (\<Union> (frontier ` F))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma plus_1_not_0: "n + (1::nat) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n + 1 \<noteq> 0
[PROOF STEP]
by simp


[STATEMENT]
lemma lattice_transfer[transfer_rule]:
  assumes [transfer_rule]: "bi_unique A" "right_total A"
  shows
    "(
      (A ===> A ===> A) ===>
      (A ===> A ===> (=)) ===>
      (A ===> A ===> (=)) ===>
      (A ===> A ===> A) ===>
      (=)
    )
    (lattice_ow (Collect (Domainp A))) class.lattice"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A ===> A ===> A) ===> (A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> (A ===> A ===> A) ===> (=)) (lattice_ow (Collect (Domainp A))) class.lattice
[PROOF STEP]
unfolding class.lattice_def lattice_ow_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A ===> A ===> A) ===> (A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> (A ===> A ===> A) ===> (=)) (\<lambda>inf le ls sup. semilattice_inf_ow (Collect (Domainp A)) inf le ls \<and> semilattice_sup_ow (Collect (Domainp A)) sup le ls) (\<lambda>inf less_eq less sup. class.semilattice_inf inf less_eq less \<and> class.semilattice_sup sup less_eq less)
[PROOF STEP]
by transfer_prover


[STATEMENT]
lemma (in domain) euclidean_domainI:
  assumes "\<And>a b. \<lbrakk> a \<in> carrier R - { \<zero> }; b \<in> carrier R - { \<zero> } \<rbrakk> \<Longrightarrow>
           \<exists>q r. q \<in> carrier R \<and> r \<in> carrier R \<and> a = (b \<otimes> q) \<oplus> r \<and> ((r = \<zero>) \<or> (\<phi> r < \<phi> b))"
  shows "euclidean_domain R \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euclidean_domain R \<phi>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> carrier R - {\<zero>}; ?b \<in> carrier R - {\<zero>}\<rbrakk> \<Longrightarrow> \<exists>q r. q \<in> carrier R \<and> r \<in> carrier R \<and> ?a = ?b \<otimes> q \<oplus> r \<and> (r = \<zero> \<or> \<phi> r < \<phi> ?b)

goal (1 subgoal):
 1. euclidean_domain R \<phi>
[PROOF STEP]
by unfold_locales auto


[STATEMENT]
lemma det_echelon_form_of_column_k_det:
  fixes A::"'a::{bezout_domain}^'n::{mod_type}^'n::{mod_type}"
  assumes ib: "is_bezout_ext bezout"
  and det: "det_P * det B = det A"
  shows "fst ((echelon_form_of_column_k_det bezout) (det_P,A,i) k) * det B
  = det (fst (snd ((echelon_form_of_column_k_det bezout) (det_P,A,i) k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
let ?interchange="(interchange_rows A (from_nat i)
    (LEAST n. A $ n $ from_nat k \<noteq> 0 \<and> from_nat i \<le> n))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
let ?B="(bezout_iterate ?interchange (nrows A - Suc 0) (from_nat i) (from_nat k) bezout)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
proof (unfold echelon_form_of_column_k_det_def Let_def echelon_form_of_column_k_def,
      auto simp add: assms)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
assume i: "from_nat i < m"
      and Amk: "A $ m $ from_nat k \<noteq> 0"
      and i_not_nrows: "i \<noteq> nrows A "
      and Aik: "A $ from_nat i $ from_nat k = 0"
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i < m
A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)
i \<noteq> nrows A
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)

goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
have "det ?B = det ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
proof (rule det_bezout_iterate[OF ib])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
show "?interchange $ from_nat i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (mono_tags, lifting) Amk LeastI_ex
          dual_order.strict_iff_order i interchange_rows_i)
[PROOF STATE]
proof (state)
this:
interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
show "nrows A - Suc 0 < ncols ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
unfolding nrows_def ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) - Suc 0 < CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
have "... = - det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) = - det A
[PROOF STEP]
proof (rule det_interchange_different_rows, rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mod_type_class.from_nat i = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) \<Longrightarrow> False
[PROOF STEP]
assume i_least: "from_nat i = (LEAST n. A $ n $ from_nat k \<noteq> 0 \<and> from_nat i \<le> n)"
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)

goal (1 subgoal):
 1. mod_type_class.from_nat i = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) \<Longrightarrow> False
[PROOF STEP]
have "A $ from_nat i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (poly_guards_query, lifting) Amk LeastI_ex
          linear i i_least leD)
[PROOF STATE]
proof (state)
this:
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. mod_type_class.from_nat i = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) \<Longrightarrow> False
[PROOF STEP]
thus "False"
[PROOF STATE]
proof (prove)
using this:
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
using Aik
[PROOF STATE]
proof (prove)
using this:
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (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:
det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) = - det A

goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = - det A
[PROOF STEP]
show "- det A = det ?B"
[PROOF STATE]
proof (prove)
using this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = - det A

goal (1 subgoal):
 1. - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
assume i: "i \<noteq> nrows A"
      and Aik: "A $ from_nat i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (state)
this:
i \<noteq> nrows A
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
have "det ?B = det ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
proof (rule det_bezout_iterate[OF ib])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
show "?interchange $ from_nat i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (mono_tags, lifting) Aik LeastI order_refl interchange_rows_i)
[PROOF STATE]
proof (state)
this:
interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
show "nrows A - Suc 0 < ncols ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
unfolding nrows_def ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) - Suc 0 < CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
have "... = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) = det A
[PROOF STEP]
by (rule det_interchange_same_rows, rule Least_equality[symmetric], auto simp add: Aik)
[PROOF STATE]
proof (state)
this:
det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) = det A

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det A
[PROOF STEP]
show "det A = det ?B"
[PROOF STATE]
proof (prove)
using this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det A

goal (1 subgoal):
 1. det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) npMul:
  "\<And> n. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk>
        \<Longrightarrow> npow R (x \<cdot>\<^sub>r y) n = (npow R x n) \<cdot>\<^sub>r (npow R y n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R n\<^esup> = x^\<^bsup>R n\<^esup> \<cdot>\<^sub>r y^\<^bsup>R n\<^esup>
[PROOF STEP]
apply (induct_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R 0\<^esup> = x^\<^bsup>R 0\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
(* n=0 *)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R 0\<^esup> = x^\<^bsup>R 0\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> 1\<^sub>r = 1\<^sub>r \<cdot>\<^sub>r 1\<^sub>r
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
apply (rule ring_r_one [THEN sym])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> 1\<^sub>r \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
apply (simp add:ring_one)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
(* n>0 *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
apply (simp only:npow_suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup> \<cdot>\<^sub>r (x \<cdot>\<^sub>r y) = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r (y^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y)
[PROOF STEP]
apply (rule ring_tOp_rel[THEN sym])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> x^\<^bsup>R na\<^esup> \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> x \<in> carrier R
 3. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> y^\<^bsup>R na\<^esup> \<in> carrier R
 4. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> y \<in> carrier R
[PROOF STEP]
apply (rule npClose, assumption+)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nbae_image_nba_nbae: "nbae_image f (nba_nbae A) = nbae
    (alphabet A) (f ` initial A)
    (\<Union> p \<in> nodes A. \<Union> a \<in> alphabet A. f ` {p} \<times> {a} \<times> f ` transition A a p)
    (f ` {p \<in> nodes A. accepting A p})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nbae_image f (nba_nbae A) = nbae (alphabet A) (f ` initial A) (\<Union>p\<in>nodes A. \<Union>a\<in>alphabet A. f ` {p} \<times> {a} \<times> f ` transition A a p) (f ` {p \<in> nodes A. accepting A p})
[PROOF STEP]
unfolding nba_nbae_def nbae_image_def nbae.simps Set.filter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alphabete (nbae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) {a \<in> nodes A. accepting A a}) = alphabet A \<and> f ` initiale (nbae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) {a \<in> nodes A. accepting A a}) = f ` initial A \<and> (\<lambda>(p, a, q). (f p, a, f q)) ` transitione (nbae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) {a \<in> nodes A. accepting A a}) = (\<Union>p\<in>nodes A. \<Union>a\<in>alphabet A. f ` {p} \<times> {a} \<times> f ` transition A a p) \<and> f ` acceptinge (nbae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) {a \<in> nodes A. accepting A a}) = f ` {p \<in> nodes A. accepting A p}
[PROOF STEP]
by force