[STATEMENT]
lemma det_swap_initial_rows: assumes A: "A \<in> carrier_mat m m"
  and lt: "k + n \<le> m"
  shows "det A = (- 1) ^ (k * n) *
    det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
define sw where "sw = (\<lambda> (A :: 'a mat) xs. fold (\<lambda> (i,j). swaprows i j) xs A)"
[PROOF STATE]
proof (state)
this:
sw = (\<lambda>A xs. fold (\<lambda>(i, j). swaprows i j) xs A)

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
have dim_sw[simp]: "dim_row (sw A xs) = dim_row A" "dim_col (sw A xs) = dim_col A" for xs A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (sw A xs) = dim_row A &&& dim_col (sw A xs) = dim_col A
[PROOF STEP]
unfolding sw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (fold (\<lambda>(x, y). swaprows x y) xs A) = dim_row A &&& dim_col (fold (\<lambda>(x, y). swaprows x y) xs A) = dim_col A
[PROOF STEP]
by (induct xs arbitrary: A, auto)
[PROOF STATE]
proof (state)
this:
dim_row (sw ?A ?xs) = dim_row ?A
dim_col (sw ?A ?xs) = dim_col ?A

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
dim_row (sw ?A ?xs) = dim_row ?A
dim_col (sw ?A ?xs) = dim_col ?A

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
fix xs and A :: "'a mat"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
assume "dim_row A = dim_col A" "\<And> i j. (i,j) \<in> set xs \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j"
[PROOF STATE]
proof (state)
this:
dim_row A = dim_col A
(?i, ?j) \<in> set xs \<Longrightarrow> ?i < dim_col A \<and> ?j < dim_col A \<and> ?i \<noteq> ?j

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
hence "det (sw A xs) = (-1)^(length xs) * det A"
[PROOF STATE]
proof (prove)
using this:
dim_row A = dim_col A
(?i, ?j) \<in> set xs \<Longrightarrow> ?i < dim_col A \<and> ?j < dim_col A \<and> ?i \<noteq> ?j

goal (1 subgoal):
 1. det (sw A xs) = (- (1::'a)) ^ length xs * det A
[PROOF STEP]
unfolding sw_def
[PROOF STATE]
proof (prove)
using this:
dim_row A = dim_col A
(?i, ?j) \<in> set xs \<Longrightarrow> ?i < dim_col A \<and> ?j < dim_col A \<and> ?i \<noteq> ?j

goal (1 subgoal):
 1. det (fold (\<lambda>(x, y). swaprows x y) xs A) = (- (1::'a)) ^ length xs * det A
[PROOF STEP]
proof (induct xs arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set [] \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) [] A) = (- (1::'a)) ^ length [] * det A
 2. \<And>a xs A. \<lbrakk>\<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set xs \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) xs A) = (- (1::'a)) ^ length xs * det A; dim_row A = dim_col A; \<And>i j. (i, j) \<in> set (a # xs) \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) (a # xs) A) = (- (1::'a)) ^ length (a # xs) * det A
[PROOF STEP]
case (Cons xy xs A)
[PROOF STATE]
proof (state)
this:
\<lbrakk>dim_row ?A = dim_col ?A; \<And>i j. (i, j) \<in> set xs \<Longrightarrow> i < dim_col ?A \<and> j < dim_col ?A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>a. case a of (a, b) \<Rightarrow> swaprows a b) xs ?A) = (- (1::'a)) ^ length xs * det ?A
dim_row A = dim_col A
(?i, ?j) \<in> set (xy # xs) \<Longrightarrow> ?i < dim_col A \<and> ?j < dim_col A \<and> ?i \<noteq> ?j

goal (2 subgoals):
 1. \<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set [] \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) [] A) = (- (1::'a)) ^ length [] * det A
 2. \<And>a xs A. \<lbrakk>\<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set xs \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) xs A) = (- (1::'a)) ^ length xs * det A; dim_row A = dim_col A; \<And>i j. (i, j) \<in> set (a # xs) \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) (a # xs) A) = (- (1::'a)) ^ length (a # xs) * det A
[PROOF STEP]
obtain x y where xy: "xy = (x,y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. xy = (x, y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
xy = (x, y)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set [] \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) [] A) = (- (1::'a)) ^ length [] * det A
 2. \<And>a xs A. \<lbrakk>\<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set xs \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) xs A) = (- (1::'a)) ^ length xs * det A; dim_row A = dim_col A; \<And>i j. (i, j) \<in> set (a # xs) \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) (a # xs) A) = (- (1::'a)) ^ length (a # xs) * det A
[PROOF STEP]
from Cons(3)[unfolded xy, of x y] Cons(2)
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<in> set ((x, y) # xs) \<Longrightarrow> x < dim_col A \<and> y < dim_col A \<and> x \<noteq> y
dim_row A = dim_col A
[PROOF STEP]
have [simp]: "det (swaprows x y A) = - det A"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> set ((x, y) # xs) \<Longrightarrow> x < dim_col A \<and> y < dim_col A \<and> x \<noteq> y
dim_row A = dim_col A

goal (1 subgoal):
 1. det (swaprows x y A) = - det A
[PROOF STEP]
by (intro det_swaprows, auto)
[PROOF STATE]
proof (state)
this:
det (swaprows x y A) = - det A

goal (2 subgoals):
 1. \<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set [] \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) [] A) = (- (1::'a)) ^ length [] * det A
 2. \<And>a xs A. \<lbrakk>\<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set xs \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) xs A) = (- (1::'a)) ^ length xs * det A; dim_row A = dim_col A; \<And>i j. (i, j) \<in> set (a # xs) \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) (a # xs) A) = (- (1::'a)) ^ length (a # xs) * det A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (fold (\<lambda>a. case a of (a, b) \<Rightarrow> swaprows a b) (xy # xs) A) = (- (1::'a)) ^ length (xy # xs) * det A
[PROOF STEP]
unfolding xy
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (fold (\<lambda>a. case a of (a, b) \<Rightarrow> swaprows a b) ((x, y) # xs) A) = (- (1::'a)) ^ length ((x, y) # xs) * det A
[PROOF STEP]
by (simp, insert Cons(2-), (subst Cons(1), auto)+)
[PROOF STATE]
proof (state)
this:
det (fold (\<lambda>a. case a of (a, b) \<Rightarrow> swaprows a b) (xy # xs) A) = (- (1::'a)) ^ length (xy # xs) * det A

goal (1 subgoal):
 1. \<And>A. \<lbrakk>dim_row A = dim_col A; \<And>i j. (i, j) \<in> set [] \<Longrightarrow> i < dim_col A \<and> j < dim_col A \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (fold (\<lambda>(x, y). swaprows x y) [] A) = (- (1::'a)) ^ length [] * det A
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
det (sw A xs) = (- (1::'a)) ^ length xs * det A

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>dim_row ?Aa2 = dim_col ?Aa2; \<And>i j. (i, j) \<in> set ?xs2 \<Longrightarrow> i < dim_col ?Aa2 \<and> j < dim_col ?Aa2 \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (sw ?Aa2 ?xs2) = (- (1::'a)) ^ length ?xs2 * det ?Aa2

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
note sw = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>dim_row ?Aa2 = dim_col ?Aa2; \<And>i j. (i, j) \<in> set ?xs2 \<Longrightarrow> i < dim_col ?Aa2 \<and> j < dim_col ?Aa2 \<and> i \<noteq> j\<rbrakk> \<Longrightarrow> det (sw ?Aa2 ?xs2) = (- (1::'a)) ^ length ?xs2 * det ?Aa2

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
define swb where "swb = (\<lambda> A i n. sw A (map (\<lambda> j. (j,Suc j)) [i ..< i + n]))"
[PROOF STATE]
proof (state)
this:
swb = (\<lambda>A i n. sw A (map (\<lambda>j. (j, Suc j)) [i..<i + n]))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
swb = (\<lambda>A i n. sw A (map (\<lambda>j. (j, Suc j)) [i..<i + n]))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
fix k n and A :: "'a mat"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
assume k_n: "k + n < dim_row A"
[PROOF STATE]
proof (state)
this:
k + n < dim_row A

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
hence "swb A k n = mat (dim_row A) (dim_col A) (\<lambda> (i,j). let r =
      (if i < k \<or> i > k + n then i else if i = k + n then k else Suc i)
      in A $$ (r,j))"
[PROOF STATE]
proof (prove)
using this:
k + n < dim_row A

goal (1 subgoal):
 1. swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j))
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k + 0 < dim_row A \<Longrightarrow> swb A k 0 = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + 0 < i then i else if i = k + 0 then k else Suc i in A $$ (r, j))
 2. \<And>n. \<lbrakk>k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j)); k + Suc n < dim_row A\<rbrakk> \<Longrightarrow> swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
k + 0 < dim_row A

goal (2 subgoals):
 1. k + 0 < dim_row A \<Longrightarrow> swb A k 0 = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + 0 < i then i else if i = k + 0 then k else Suc i in A $$ (r, j))
 2. \<And>n. \<lbrakk>k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j)); k + Suc n < dim_row A\<rbrakk> \<Longrightarrow> swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swb A k 0 = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < k \<or> k + 0 < i then i else if i = k + 0 then k else Suc i in A $$ (r, j))
[PROOF STEP]
unfolding swb_def sw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>(x, y). swaprows x y) (map (\<lambda>j. (j, Suc j)) [k..<k + 0]) A = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < k \<or> k + 0 < i then i else if i = k + 0 then k else Suc i in A $$ (r, j))
[PROOF STEP]
by (rule eq_matI, auto)
[PROOF STATE]
proof (state)
this:
swb A k 0 = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < k \<or> k + 0 < i then i else if i = k + 0 then k else Suc i in A $$ (r, j))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j)); k + Suc n < dim_row A\<rbrakk> \<Longrightarrow> swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j)); k + Suc n < dim_row A\<rbrakk> \<Longrightarrow> swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j))
k + Suc n < dim_row A

goal (1 subgoal):
 1. \<And>n. \<lbrakk>k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j)); k + Suc n < dim_row A\<rbrakk> \<Longrightarrow> swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
hence dim: "k + n < dim_row A"
[PROOF STATE]
proof (prove)
using this:
k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j))
k + Suc n < dim_row A

goal (1 subgoal):
 1. k + n < dim_row A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k + n < dim_row A

goal (1 subgoal):
 1. \<And>n. \<lbrakk>k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j)); k + Suc n < dim_row A\<rbrakk> \<Longrightarrow> swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
have id: "swb A k (Suc n) = swaprows (k + n) (Suc k + n) (swb A k n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swb A k (Suc n) = swaprows (k + n) (Suc k + n) (swb A k n)
[PROOF STEP]
unfolding swb_def sw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>(x, y). swaprows x y) (map (\<lambda>j. (j, Suc j)) [k..<k + Suc n]) A = swaprows (k + n) (Suc k + n) (fold (\<lambda>(x, y). swaprows x y) (map (\<lambda>j. (j, Suc j)) [k..<k + n]) A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
swb A k (Suc n) = swaprows (k + n) (Suc k + n) (swb A k n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>k + n < dim_row A \<Longrightarrow> swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j)); k + Suc n < dim_row A\<rbrakk> \<Longrightarrow> swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
unfolding id Suc(1)[OF dim]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swaprows (k + n) (Suc k + n) (mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j))) = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))
[PROOF STEP]
by (rule eq_matI, insert Suc(2), auto)
[PROOF STATE]
proof (state)
this:
swb A k (Suc n) = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < k \<or> k + Suc n < i then i else if i = k + Suc n then k else Suc i in A $$ (r, j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
swb A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?ka2 + ?na2 < dim_row ?Aa2 \<Longrightarrow> swb ?Aa2 ?ka2 ?na2 = mat (dim_row ?Aa2) (dim_col ?Aa2) (\<lambda>(i, j). let r = if i < ?ka2 \<or> ?ka2 + ?na2 < i then i else if i = ?ka2 + ?na2 then ?ka2 else Suc i in ?Aa2 $$ (r, j))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
note swb = this
[PROOF STATE]
proof (state)
this:
?ka2 + ?na2 < dim_row ?Aa2 \<Longrightarrow> swb ?Aa2 ?ka2 ?na2 = mat (dim_row ?Aa2) (dim_col ?Aa2) (\<lambda>(i, j). let r = if i < ?ka2 \<or> ?ka2 + ?na2 < i then i else if i = ?ka2 + ?na2 then ?ka2 else Suc i in ?Aa2 $$ (r, j))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
define swbl where "swbl = (\<lambda> A k n. fold (\<lambda> i A. swb A i n) (rev [0 ..< k]) A)"
[PROOF STATE]
proof (state)
this:
swbl = (\<lambda>A k n. fold (\<lambda>i A. swb A i n) (rev [0..<k]) A)

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
swbl = (\<lambda>A k n. fold (\<lambda>i A. swb A i n) (rev [0..<k]) A)

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
fix k n and A :: "'a mat"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
assume k_n: "k + n \<le> dim_row A"
[PROOF STATE]
proof (state)
this:
k + n \<le> dim_row A

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
hence "swbl A k n = mat (dim_row A) (dim_col A) (\<lambda> (i,j). let r =
      (if i < n then i + k else if i < k + n then i - n else i)
      in A $$ (r,j))"
[PROOF STATE]
proof (prove)
using this:
k + n \<le> dim_row A

goal (1 subgoal):
 1. swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
proof (induct k arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. 0 + n \<le> dim_row A \<Longrightarrow> swbl A 0 n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + 0 else if i < 0 + n then i - n else i in A $$ (r, j))
 2. \<And>k A. \<lbrakk>\<And>A. k + n \<le> dim_row A \<Longrightarrow> swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j)); Suc k + n \<le> dim_row A\<rbrakk> \<Longrightarrow> swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 + n \<le> dim_row A

goal (2 subgoals):
 1. \<And>A. 0 + n \<le> dim_row A \<Longrightarrow> swbl A 0 n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + 0 else if i < 0 + n then i - n else i in A $$ (r, j))
 2. \<And>k A. \<lbrakk>\<And>A. k + n \<le> dim_row A \<Longrightarrow> swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j)); Suc k + n \<le> dim_row A\<rbrakk> \<Longrightarrow> swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 + n \<le> dim_row A

goal (1 subgoal):
 1. swbl A 0 n = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < n then i + 0 else if i < 0 + n then i - n else i in A $$ (r, j))
[PROOF STEP]
unfolding swbl_def
[PROOF STATE]
proof (prove)
using this:
0 + n \<le> dim_row A

goal (1 subgoal):
 1. fold (\<lambda>i A. swb A i n) (rev [0..<0]) A = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < n then i + 0 else if i < 0 + n then i - n else i in A $$ (r, j))
[PROOF STEP]
by (intro eq_matI, auto simp: swb)
[PROOF STATE]
proof (state)
this:
swbl A 0 n = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < n then i + 0 else if i < 0 + n then i - n else i in A $$ (r, j))

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. k + n \<le> dim_row A \<Longrightarrow> swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j)); Suc k + n \<le> dim_row A\<rbrakk> \<Longrightarrow> swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. k + n \<le> dim_row A \<Longrightarrow> swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j)); Suc k + n \<le> dim_row A\<rbrakk> \<Longrightarrow> swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k + n \<le> dim_row ?A \<Longrightarrow> swbl ?A k n = mat (dim_row ?A) (dim_col ?A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < n then i + k else if i < k + n then i - n else i in ?A $$ (r, j))
Suc k + n \<le> dim_row A

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. k + n \<le> dim_row A \<Longrightarrow> swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j)); Suc k + n \<le> dim_row A\<rbrakk> \<Longrightarrow> swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
hence dim: "k + n < dim_row A"
[PROOF STATE]
proof (prove)
using this:
k + n \<le> dim_row ?A \<Longrightarrow> swbl ?A k n = mat (dim_row ?A) (dim_col ?A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < n then i + k else if i < k + n then i - n else i in ?A $$ (r, j))
Suc k + n \<le> dim_row A

goal (1 subgoal):
 1. k + n < dim_row A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k + n < dim_row A

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. k + n \<le> dim_row A \<Longrightarrow> swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j)); Suc k + n \<le> dim_row A\<rbrakk> \<Longrightarrow> swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
have id: "swbl A (Suc k) n = swbl (swb A k n) k n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swbl A (Suc k) n = swbl (swb A k n) k n
[PROOF STEP]
unfolding swbl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>i A. swb A i n) (rev [0..<Suc k]) A = fold (\<lambda>i A. swb A i n) (rev [0..<k]) (swb A k n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
swbl A (Suc k) n = swbl (swb A k n) k n

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. k + n \<le> dim_row A \<Longrightarrow> swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j)); Suc k + n \<le> dim_row A\<rbrakk> \<Longrightarrow> swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
unfolding id swb[OF dim]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swbl (mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < k \<or> k + n < i then i else if i = k + n then k else Suc i in A $$ (r, j))) k n = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))
[PROOF STEP]
by (subst Suc(1), insert dim, force, intro eq_matI, auto simp: less_Suc_eq_le)
[PROOF STATE]
proof (state)
this:
swbl A (Suc k) n = mat (dim_row A) (dim_col A) (\<lambda>a. case a of (i, j) \<Rightarrow> let r = if i < n then i + Suc k else if i < Suc k + n then i - n else i in A $$ (r, j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
swbl A k n = mat (dim_row A) (dim_col A) (\<lambda>(i, j). let r = if i < n then i + k else if i < k + n then i - n else i in A $$ (r, j))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?ka2 + ?na2 \<le> dim_row ?Aa2 \<Longrightarrow> swbl ?Aa2 ?ka2 ?na2 = mat (dim_row ?Aa2) (dim_col ?Aa2) (\<lambda>(i, j). let r = if i < ?na2 then i + ?ka2 else if i < ?ka2 + ?na2 then i - ?na2 else i in ?Aa2 $$ (r, j))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
note swbl = this
[PROOF STATE]
proof (state)
this:
?ka2 + ?na2 \<le> dim_row ?Aa2 \<Longrightarrow> swbl ?Aa2 ?ka2 ?na2 = mat (dim_row ?Aa2) (dim_col ?Aa2) (\<lambda>(i, j). let r = if i < ?na2 then i + ?ka2 else if i < ?ka2 + ?na2 then i - ?na2 else i in ?Aa2 $$ (r, j))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?ka2 + ?na2 \<le> dim_row ?Aa2 \<Longrightarrow> swbl ?Aa2 ?ka2 ?na2 = mat (dim_row ?Aa2) (dim_col ?Aa2) (\<lambda>(i, j). let r = if i < ?na2 then i + ?ka2 else if i < ?ka2 + ?na2 then i - ?na2 else i in ?Aa2 $$ (r, j))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
fix k n and A :: "'a mat"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
assume k_n: "k + n \<le> dim_col A" "dim_row A = dim_col A"
[PROOF STATE]
proof (state)
this:
k + n \<le> dim_col A
dim_row A = dim_col A

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
hence "det (swbl A k n) = (-1)^(k*n) * det A"
[PROOF STATE]
proof (prove)
using this:
k + n \<le> dim_col A
dim_row A = dim_col A

goal (1 subgoal):
 1. det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A
[PROOF STEP]
proof (induct k arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A 0 n) = (- (1::'a)) ^ (0 * n) * det A
 2. \<And>k A. \<lbrakk>\<And>A. \<lbrakk>k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A; Suc k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 + n \<le> dim_col A
dim_row A = dim_col A

goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A 0 n) = (- (1::'a)) ^ (0 * n) * det A
 2. \<And>k A. \<lbrakk>\<And>A. \<lbrakk>k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A; Suc k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 + n \<le> dim_col A
dim_row A = dim_col A

goal (1 subgoal):
 1. det (swbl A 0 n) = (- (1::'a)) ^ (0 * n) * det A
[PROOF STEP]
unfolding swbl_def
[PROOF STATE]
proof (prove)
using this:
0 + n \<le> dim_col A
dim_row A = dim_col A

goal (1 subgoal):
 1. det (fold (\<lambda>i A. swb A i n) (rev [0..<0]) A) = (- (1::'a)) ^ (0 * n) * det A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det (swbl A 0 n) = (- (1::'a)) ^ (0 * n) * det A

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. \<lbrakk>k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A; Suc k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. \<lbrakk>k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A; Suc k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<lbrakk>k + n \<le> dim_col ?A; dim_row ?A = dim_col ?A\<rbrakk> \<Longrightarrow> det (swbl ?A k n) = (- (1::'a)) ^ (k * n) * det ?A
Suc k + n \<le> dim_col A
dim_row A = dim_col A

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. \<lbrakk>k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A; Suc k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
hence dim: "k + n < dim_row A"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k + n \<le> dim_col ?A; dim_row ?A = dim_col ?A\<rbrakk> \<Longrightarrow> det (swbl ?A k n) = (- (1::'a)) ^ (k * n) * det ?A
Suc k + n \<le> dim_col A
dim_row A = dim_col A

goal (1 subgoal):
 1. k + n < dim_row A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k + n < dim_row A

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. \<lbrakk>k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A; Suc k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
have id: "swbl A (Suc k) n = swbl (swb A k n) k n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swbl A (Suc k) n = swbl (swb A k n) k n
[PROOF STEP]
unfolding swbl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>i A. swb A i n) (rev [0..<Suc k]) A = fold (\<lambda>i A. swb A i n) (rev [0..<k]) (swb A k n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
swbl A (Suc k) n = swbl (swb A k n) k n

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. \<lbrakk>k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A; Suc k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
have det: "det (swb A k n) = (-1)^n * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swb A k n) = (- (1::'a)) ^ n * det A
[PROOF STEP]
unfolding swb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (sw A (map (\<lambda>j. (j, Suc j)) [k..<k + n])) = (- (1::'a)) ^ n * det A
[PROOF STEP]
by (subst sw, insert Suc(2-), auto)
[PROOF STATE]
proof (state)
this:
det (swb A k n) = (- (1::'a)) ^ n * det A

goal (1 subgoal):
 1. \<And>k A. \<lbrakk>\<And>A. \<lbrakk>k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A; Suc k + n \<le> dim_col A; dim_row A = dim_col A\<rbrakk> \<Longrightarrow> det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swbl (swb A k n) k n) = (- (1::'a)) ^ (Suc k * n) * det A
[PROOF STEP]
by (subst Suc(1), insert Suc(2-), auto simp: det, auto simp: swb power_add)
[PROOF STATE]
proof (state)
this:
det (swbl A (Suc k) n) = (- (1::'a)) ^ (Suc k * n) * det A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (swbl A k n) = (- (1::'a)) ^ (k * n) * det A

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?ka2 + ?na2 \<le> dim_col ?Aa2; dim_row ?Aa2 = dim_col ?Aa2\<rbrakk> \<Longrightarrow> det (swbl ?Aa2 ?ka2 ?na2) = (- (1::'a)) ^ (?ka2 * ?na2) * det ?Aa2

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
note det_swbl = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?ka2 + ?na2 \<le> dim_col ?Aa2; dim_row ?Aa2 = dim_col ?Aa2\<rbrakk> \<Longrightarrow> det (swbl ?Aa2 ?ka2 ?na2) = (- (1::'a)) ^ (?ka2 * ?na2) * det ?Aa2

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
A \<in> carrier_mat m m
k + n \<le> m
[PROOF STEP]
have dim: "dim_row A = dim_col A" "k + n \<le> dim_col A" "k + n \<le> dim_row A" "dim_col A = m"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat m m
k + n \<le> m

goal (1 subgoal):
 1. (dim_row A = dim_col A &&& k + n \<le> dim_col A) &&& k + n \<le> dim_row A &&& dim_col A = m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row A = dim_col A
k + n \<le> dim_col A
k + n \<le> dim_row A
dim_col A = m

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
from arg_cong[OF det_swbl[OF dim(2,1), unfolded swbl[OF dim(3)], unfolded Let_def dim],
      of  "\<lambda> x. (-1)^(k*n) * x"]
[PROOF STATE]
proof (chain)
picking this:
(- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j))) = (- (1::'a)) ^ (k * n) * ((- (1::'a)) ^ (k * n) * det A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j))) = (- (1::'a)) ^ (k * n) * ((- (1::'a)) ^ (k * n) * det A)

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (if i < n then i + k else if i < k + n then i - n else i, j)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma null_sets_subset: "B \<in> null_sets M \<Longrightarrow> A \<in> sets M \<Longrightarrow> A \<subseteq> B \<Longrightarrow> A \<in> null_sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<in> null_sets M; A \<in> sets M; A \<subseteq> B\<rbrakk> \<Longrightarrow> A \<in> null_sets M
[PROOF STEP]
using emeasure_mono[of A B M]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<subseteq> B; B \<in> sets M\<rbrakk> \<Longrightarrow> emeasure M A \<le> emeasure M B

goal (1 subgoal):
 1. \<lbrakk>B \<in> null_sets M; A \<in> sets M; A \<subseteq> B\<rbrakk> \<Longrightarrow> A \<in> null_sets M
[PROOF STEP]
by (simp add: null_sets_def)


[STATEMENT]
lemma num_reachable_norefl_mono:
  "wf_graph \<lparr>nodes=N, edges=E\<rparr> \<Longrightarrow> E' \<subseteq> E \<Longrightarrow> num_reachable_norefl \<lparr>nodes=N, edges=E'\<rparr> v \<le> num_reachable_norefl \<lparr>nodes=N, edges=E\<rparr> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_graph \<lparr>nodes = N, edges = E\<rparr>; E' \<subseteq> E\<rbrakk> \<Longrightarrow> num_reachable_norefl \<lparr>nodes = N, edges = E'\<rparr> v \<le> num_reachable_norefl \<lparr>nodes = N, edges = E\<rparr> v
[PROOF STEP]
apply(simp add: num_reachable_norefl_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_graph \<lparr>nodes = N, edges = E\<rparr>; E' \<subseteq> E\<rbrakk> \<Longrightarrow> card (succ_tran \<lparr>nodes = N, edges = E'\<rparr> v - {v}) \<le> card (succ_tran \<lparr>nodes = N, edges = E\<rparr> v - {v})
[PROOF STEP]
apply(frule_tac E'="E'" and v="v" in succ_tran_mono, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_graph \<lparr>nodes = N, edges = E\<rparr>; E' \<subseteq> E; succ_tran \<lparr>nodes = N, edges = E'\<rparr> v \<subseteq> succ_tran \<lparr>nodes = N, edges = E\<rparr> v\<rbrakk> \<Longrightarrow> card (succ_tran \<lparr>nodes = N, edges = E'\<rparr> v - {v}) \<le> card (succ_tran \<lparr>nodes = N, edges = E\<rparr> v - {v})
[PROOF STEP]
apply(frule_tac v="v" in succ_tran_finite)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_graph \<lparr>nodes = N, edges = E\<rparr>; E' \<subseteq> E; succ_tran \<lparr>nodes = N, edges = E'\<rparr> v \<subseteq> succ_tran \<lparr>nodes = N, edges = E\<rparr> v; finite (succ_tran \<lparr>nodes = N, edges = E\<rparr> v)\<rbrakk> \<Longrightarrow> card (succ_tran \<lparr>nodes = N, edges = E'\<rparr> v - {v}) \<le> card (succ_tran \<lparr>nodes = N, edges = E\<rparr> v - {v})
[PROOF STEP]
using card_mono
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B

goal (1 subgoal):
 1. \<lbrakk>wf_graph \<lparr>nodes = N, edges = E\<rparr>; E' \<subseteq> E; succ_tran \<lparr>nodes = N, edges = E'\<rparr> v \<subseteq> succ_tran \<lparr>nodes = N, edges = E\<rparr> v; finite (succ_tran \<lparr>nodes = N, edges = E\<rparr> v)\<rbrakk> \<Longrightarrow> card (succ_tran \<lparr>nodes = N, edges = E'\<rparr> v - {v}) \<le> card (succ_tran \<lparr>nodes = N, edges = E\<rparr> v - {v})
[PROOF STEP]
by (metis Diff_mono finite_Diff subset_refl)

  \<comment> \<open>backflows\<close>


[STATEMENT]
lemma basis_dense:
  fixes B :: "'a set set"
    and f :: "'a set \<Rightarrow> 'a"
  assumes "topological_basis B"
    and choosefrom_basis: "\<And>B'. B' \<noteq> {} \<Longrightarrow> f B' \<in> B'"
  shows "\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B' \<in> B. f B' \<in> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B'\<in>B. f B' \<in> X)
[PROOF STEP]
proof (intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X. \<lbrakk>open X; X \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. f B' \<in> X
[PROOF STEP]
fix X :: "'a set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X. \<lbrakk>open X; X \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. f B' \<in> X
[PROOF STEP]
assume "open X" and "X \<noteq> {}"
[PROOF STATE]
proof (state)
this:
open X
X \<noteq> {}

goal (1 subgoal):
 1. \<And>X. \<lbrakk>open X; X \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. f B' \<in> X
[PROOF STEP]
from topological_basisE[OF \<open>topological_basis B\<close> \<open>open X\<close> choosefrom_basis[OF \<open>X \<noteq> {}\<close>]]
[PROOF STATE]
proof (chain)
picking this:
(\<And>B'. \<lbrakk>B' \<in> B; f X \<in> B'; B' \<subseteq> X\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain B' where "B' \<in> B" "f X \<in> B'" "B' \<subseteq> X"
[PROOF STATE]
proof (prove)
using this:
(\<And>B'. \<lbrakk>B' \<in> B; f X \<in> B'; B' \<subseteq> X\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>B'. \<lbrakk>B' \<in> B; f X \<in> B'; B' \<subseteq> X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
B' \<in> B
f X \<in> B'
B' \<subseteq> X

goal (1 subgoal):
 1. \<And>X. \<lbrakk>open X; X \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>B'\<in>B. f B' \<in> X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B' \<in> B
f X \<in> B'
B' \<subseteq> X
[PROOF STEP]
show "\<exists>B'\<in>B. f B' \<in> X"
[PROOF STATE]
proof (prove)
using this:
B' \<in> B
f X \<in> B'
B' \<subseteq> X

goal (1 subgoal):
 1. \<exists>B'\<in>B. f B' \<in> X
[PROOF STEP]
by (auto intro!: choosefrom_basis)
[PROOF STATE]
proof (state)
this:
\<exists>B'\<in>B. f B' \<in> X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_const_iff: "summable (\<lambda>_. c) \<longleftrightarrow> c = 0"
  for c :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>_. c) = (c = (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>_. c) = (c = (0::'a))
[PROOF STEP]
have "\<not> summable (\<lambda>_. c)" if "c \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> summable (\<lambda>_. c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> summable (\<lambda>_. c)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
[PROOF STEP]
have "filterlim (\<lambda>n. of_nat n * norm c) at_top sequentially"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. LIM n sequentially. real n * norm c :> at_top
[PROOF STEP]
by (subst mult.commute)
        (auto intro!: filterlim_tendsto_pos_mult_at_top filterlim_real_sequentially)
[PROOF STATE]
proof (state)
this:
LIM n sequentially. real n * norm c :> at_top

goal (1 subgoal):
 1. \<not> summable (\<lambda>_. c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM n sequentially. real n * norm c :> at_top
[PROOF STEP]
have "\<not> convergent (\<lambda>n. norm (\<Sum>k<n. c))"
[PROOF STATE]
proof (prove)
using this:
LIM n sequentially. real n * norm c :> at_top

goal (1 subgoal):
 1. \<not> convergent (\<lambda>n. norm (\<Sum>k<n. c))
[PROOF STEP]
by (intro filterlim_at_infinity_imp_not_convergent filterlim_at_top_imp_at_infinity)
        (simp_all add: sum_constant_scaleR)
[PROOF STATE]
proof (state)
this:
\<not> convergent (\<lambda>n. norm (\<Sum>k<n. c))

goal (1 subgoal):
 1. \<not> summable (\<lambda>_. c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> convergent (\<lambda>n. norm (\<Sum>k<n. c))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> convergent (\<lambda>n. norm (\<Sum>k<n. c))

goal (1 subgoal):
 1. \<not> summable (\<lambda>_. c)
[PROOF STEP]
unfolding summable_iff_convergent
[PROOF STATE]
proof (prove)
using this:
\<not> convergent (\<lambda>n. norm (\<Sum>k<n. c))

goal (1 subgoal):
 1. \<not> convergent (\<lambda>n. \<Sum>_<n. c)
[PROOF STEP]
using convergent_norm
[PROOF STATE]
proof (prove)
using this:
\<not> convergent (\<lambda>n. norm (\<Sum>k<n. c))
convergent ?f \<Longrightarrow> convergent (\<lambda>n. norm (?f n))

goal (1 subgoal):
 1. \<not> convergent (\<lambda>n. \<Sum>_<n. c)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> summable (\<lambda>_. c)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a) \<Longrightarrow> \<not> summable (\<lambda>_. c)

goal (1 subgoal):
 1. summable (\<lambda>_. c) = (c = (0::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a) \<Longrightarrow> \<not> summable (\<lambda>_. c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a) \<Longrightarrow> \<not> summable (\<lambda>_. c)

goal (1 subgoal):
 1. summable (\<lambda>_. c) = (c = (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
summable (\<lambda>_. c) = (c = (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deriv_hf_minus: "deriv (hf n) = (\<lambda>x. - deriv (hf n) (1-x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (hf n) = (\<lambda>x. - deriv (hf n) (1 - x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. deriv (hf n) x = - deriv (hf n) (1 - x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. deriv (hf n) x = - deriv (hf n) (1 - x)
[PROOF STEP]
have "hf n = hf n \<circ> (\<lambda>x. (1-x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hf n = hf n \<circ> (-) 1
[PROOF STEP]
by (simp add: fun_eq_iff hf_def mult.commute)
[PROOF STATE]
proof (state)
this:
hf n = hf n \<circ> (-) 1

goal (1 subgoal):
 1. \<And>x. deriv (hf n) x = - deriv (hf n) (1 - x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hf n = hf n \<circ> (-) 1
[PROOF STEP]
have "deriv (hf n) x = deriv (hf n \<circ> (\<lambda>x. (1-x))) x"
[PROOF STATE]
proof (prove)
using this:
hf n = hf n \<circ> (-) 1

goal (1 subgoal):
 1. deriv (hf n) x = deriv (hf n \<circ> (-) 1) x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
deriv (hf n) x = deriv (hf n \<circ> (-) 1) x

goal (1 subgoal):
 1. \<And>x. deriv (hf n) x = - deriv (hf n) (1 - x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deriv (hf n) x = deriv (hf n \<circ> (-) 1) x

goal (1 subgoal):
 1. \<And>x. deriv (hf n) x = - deriv (hf n) (1 - x)
[PROOF STEP]
have "\<dots> = deriv (hf n) (1-x) * deriv ((-) 1) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (hf n \<circ> (-) 1) x = deriv (hf n) (1 - x) * deriv ((-) 1) x
[PROOF STEP]
by (intro real_derivative_chain) auto
[PROOF STATE]
proof (state)
this:
deriv (hf n \<circ> (-) 1) x = deriv (hf n) (1 - x) * deriv ((-) 1) x

goal (1 subgoal):
 1. \<And>x. deriv (hf n) x = - deriv (hf n) (1 - x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
deriv (hf n) x = deriv (hf n) (1 - x) * deriv ((-) 1) x
[PROOF STEP]
show "deriv (hf n) x = - deriv (hf n) (1-x)"
[PROOF STATE]
proof (prove)
using this:
deriv (hf n) x = deriv (hf n) (1 - x) * deriv ((-) 1) x

goal (1 subgoal):
 1. deriv (hf n) x = - deriv (hf n) (1 - x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
deriv (hf n) x = - deriv (hf n) (1 - x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_approx_aux:
  assumes "x \<ge> x\<^sub>0"
  shows   "1 + integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> 1 + integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 \<le> 1 + integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x\<^sub>0 \<le> x
[PROOF STEP]
have "integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
x\<^sub>0 \<le> x

goal (1 subgoal):
 1. 0 \<le> integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x
[PROOF STEP]
by (intro integral_nonneg ballI g_nonneg divide_nonneg_nonneg g_integrable) simp_all
[PROOF STATE]
proof (state)
this:
0 \<le> integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x

goal (1 subgoal):
 1. 1 \<le> 1 + integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x

goal (1 subgoal):
 1. 1 \<le> 1 + integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> 1 + integral (\<lambda>u. g u / u powr (p + 1)) x\<^sub>0 x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_eq_diff_mod_0_conv: "
  a \<le> (b::nat) \<Longrightarrow> (a mod m = b mod m) = ((b - a) mod m = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (a mod m = b mod m) = ((b - a) mod m = 0)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<le> b; a mod m = b mod m\<rbrakk> \<Longrightarrow> (b - a) mod m = 0
 2. \<lbrakk>a \<le> b; (b - a) mod m = 0\<rbrakk> \<Longrightarrow> a mod m = b mod m
[PROOF STEP]
apply (rule mod_eq_imp_diff_mod_0, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; (b - a) mod m = 0\<rbrakk> \<Longrightarrow> a mod m = b mod m
[PROOF STEP]
apply (rule diff_mod_0_imp_mod_eq, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma power_diff_sum:
  fixes a b :: "'a :: {comm_ring_1,power}"
  assumes "k > 0"
  shows "a^k - b^k = (a-b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
have insert_lb: "m < n \<Longrightarrow> insert m {Suc m..<n} = {m..<n}" for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < n \<Longrightarrow> insert m {Suc m..<n} = {m..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?m1 < ?n1 \<Longrightarrow> insert ?m1 {Suc ?m1..<?n1} = {?m1..<?n1}

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
have "?rhs = sum (\<lambda>i. a * (a^i * b^(k-1-i))) {0..<k} -
    sum (\<lambda>i. b * (a^i * b^(k-1-i))) {0..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i)) = (\<Sum>i = 0..<k. a * (a ^ i * b ^ (k - 1 - i))) - (\<Sum>i = 0..<k. b * (a ^ i * b ^ (k - 1 - i)))
[PROOF STEP]
by (simp add: sum_distrib_left[symmetric] algebra_simps)
[PROOF STATE]
proof (state)
this:
(a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i)) = (\<Sum>i = 0..<k. a * (a ^ i * b ^ (k - 1 - i))) - (\<Sum>i = 0..<k. b * (a ^ i * b ^ (k - 1 - i)))

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i)) = (\<Sum>i = 0..<k. a * (a ^ i * b ^ (k - 1 - i))) - (\<Sum>i = 0..<k. b * (a ^ i * b ^ (k - 1 - i)))

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
have "... = sum ((\<lambda>i. (a^i * b^(k-i))) \<circ> (\<lambda>i. i+1)) {0..<k} -
    sum (\<lambda>i. (a^i * (b^(1+(k-1-i))))) {0..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<k. a * (a ^ i * b ^ (k - 1 - i))) - (\<Sum>i = 0..<k. b * (a ^ i * b ^ (k - 1 - i))) = sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (1 + (k - 1 - i)))
[PROOF STEP]
by (simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<k. a * (a ^ i * b ^ (k - 1 - i))) - (\<Sum>i = 0..<k. b * (a ^ i * b ^ (k - 1 - i))) = sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (1 + (k - 1 - i)))

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<k. a * (a ^ i * b ^ (k - 1 - i))) - (\<Sum>i = 0..<k. b * (a ^ i * b ^ (k - 1 - i))) = sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (1 + (k - 1 - i)))

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
have "... = sum ((\<lambda>i. (a^i * b^(k-i))) \<circ> (\<lambda>i. i+1)) {0..<k} -
    sum (\<lambda>i. (a^i * b^(k-i))) {0..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (1 + (k - 1 - i))) = sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (k - i))
[PROOF STEP]
by (intro arg_cong2[where f="(-)"] sum.cong arg_cong2[where f="(*)"]
        arg_cong2[where f="(\<lambda>x y. x ^ y)"]) auto
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (1 + (k - 1 - i))) = sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (k - i))

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (1 + (k - 1 - i))) = sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (k - i))

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
have "... = sum (\<lambda>i. (a^i * b^(k-i))) (insert k {1..<k}) -
    sum (\<lambda>i. (a^i * b^(k-i))) (insert 0 {Suc 0..<k})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (k - i)) = (\<Sum>i\<in>insert k {1..<k}. a ^ i * b ^ (k - i)) - (\<Sum>i\<in>insert 0 {Suc 0..<k}. a ^ i * b ^ (k - i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (k - i)) = (\<Sum>i\<in>insert k {1..<k}. a ^ i * b ^ (k - i)) - (\<Sum>i\<in>insert 0 {Suc 0..<k}. a ^ i * b ^ (k - i))
[PROOF STEP]
by (subst sum.reindex[symmetric], simp, subst insert_lb, auto)
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (k - i)) = (\<Sum>i\<in>insert k {1..<k}. a ^ i * b ^ (k - i)) - (\<Sum>i\<in>insert 0 {Suc 0..<k}. a ^ i * b ^ (k - i))

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>i. a ^ i * b ^ (k - i)) \<circ> (\<lambda>i. i + 1)) {0..<k} - (\<Sum>i = 0..<k. a ^ i * b ^ (k - i)) = (\<Sum>i\<in>insert k {1..<k}. a ^ i * b ^ (k - i)) - (\<Sum>i\<in>insert 0 {Suc 0..<k}. a ^ i * b ^ (k - i))

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
have "... = ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>insert k {1..<k}. a ^ i * b ^ (k - i)) - (\<Sum>i\<in>insert 0 {Suc 0..<k}. a ^ i * b ^ (k - i)) = a ^ k - b ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert k {1..<k}. a ^ i * b ^ (k - i)) - (\<Sum>i\<in>insert 0 {Suc 0..<k}. a ^ i * b ^ (k - i)) = a ^ k - b ^ k

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i)) = a ^ k - b ^ k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i)) = a ^ k - b ^ k

goal (1 subgoal):
 1. a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
a ^ k - b ^ k = (a - b) * (\<Sum>i = 0..<k. a ^ i * b ^ (k - 1 - i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lcm_fin_0_iff:
  "Lcm\<^sub>f\<^sub>i\<^sub>n A = 0 \<longleftrightarrow> 0 \<in> A" if "finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Lcm\<^sub>f\<^sub>i\<^sub>n A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (Lcm\<^sub>f\<^sub>i\<^sub>n A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
by (induct A) (auto simp: lcm_eq_0_iff)


[STATEMENT]
lemma f_pre_additive:
  assumes "is_conjugation f g"
  shows "f (x + y) \<le> z \<longleftrightarrow> f x + f y \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f (x + y) \<le> z) = (f x + f y \<le> z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f (x + y) \<le> z) = (f x + f y \<le> z)
[PROOF STEP]
have "f (x + y) \<le> z \<longleftrightarrow> x + y \<le> -g (-z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f (x + y) \<le> z) = (x + y \<le> - g (- z))
[PROOF STEP]
by (metis assms conj_galois_1)
[PROOF STATE]
proof (state)
this:
(f (x + y) \<le> z) = (x + y \<le> - g (- z))

goal (1 subgoal):
 1. (f (x + y) \<le> z) = (f x + f y \<le> z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f (x + y) \<le> z) = (x + y \<le> - g (- z))

goal (1 subgoal):
 1. (f (x + y) \<le> z) = (f x + f y \<le> z)
[PROOF STEP]
have "... \<longleftrightarrow> x \<le> -g (-z) \<and> y \<le> -g (-z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y \<le> - g (- z)) = (x \<le> - g (- z) \<and> y \<le> - g (- z))
[PROOF STEP]
by (metis le_sup_iff)
[PROOF STATE]
proof (state)
this:
(x + y \<le> - g (- z)) = (x \<le> - g (- z) \<and> y \<le> - g (- z))

goal (1 subgoal):
 1. (f (x + y) \<le> z) = (f x + f y \<le> z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y \<le> - g (- z)) = (x \<le> - g (- z) \<and> y \<le> - g (- z))

goal (1 subgoal):
 1. (f (x + y) \<le> z) = (f x + f y \<le> z)
[PROOF STEP]
have "... \<longleftrightarrow> f x \<le> z \<and> f y \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> - g (- z) \<and> y \<le> - g (- z)) = (f x \<le> z \<and> f y \<le> z)
[PROOF STEP]
by (metis assms conj_galois_1)
[PROOF STATE]
proof (state)
this:
(x \<le> - g (- z) \<and> y \<le> - g (- z)) = (f x \<le> z \<and> f y \<le> z)

goal (1 subgoal):
 1. (f (x + y) \<le> z) = (f x + f y \<le> z)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(x \<le> - g (- z) \<and> y \<le> - g (- z)) = (f x \<le> z \<and> f y \<le> z)

goal (1 subgoal):
 1. (f (x + y) \<le> z) = (f x + f y \<le> z)
[PROOF STEP]
by (metis le_sup_iff calculation)
[PROOF STATE]
proof (state)
this:
(f (x + y) \<le> z) = (f x + f y \<le> z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord_1_right [simp]: "ord (n::nat) 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord n 1 = 1
[PROOF STEP]
using ord_divides[of 1 1 n]
[PROOF STATE]
proof (prove)
using this:
[1 ^ 1 = 1] (mod n) = is_unit (ord n 1)

goal (1 subgoal):
 1. ord n 1 = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma neg_less_minus_divideC_eq [field_simps]:
  "a < - (b /\<^sub>C c) \<longleftrightarrow> - b < c *\<^sub>C a" if "c < 0"
    for a b :: "'a :: ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a < - (b /\<^sub>C c)) = (- b < c *\<^sub>C a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a < - (b /\<^sub>C c)) = (- b < c *\<^sub>C a)
[PROOF STEP]
have *: "- b = c *\<^sub>C a \<longleftrightarrow> b = - (c *\<^sub>C a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- b = c *\<^sub>C a) = (b = - (c *\<^sub>C a))
[PROOF STEP]
by (metis add.inverse_inverse)
[PROOF STATE]
proof (state)
this:
(- b = c *\<^sub>C a) = (b = - (c *\<^sub>C a))

goal (1 subgoal):
 1. (a < - (b /\<^sub>C c)) = (- b < c *\<^sub>C a)
[PROOF STEP]
from that neg_le_minus_divideC_eq [of c a b]
[PROOF STATE]
proof (chain)
picking this:
c < 0
c < 0 \<Longrightarrow> (a \<le> - (b /\<^sub>C c)) = (- b \<le> c *\<^sub>C a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c < 0
c < 0 \<Longrightarrow> (a \<le> - (b /\<^sub>C c)) = (- b \<le> c *\<^sub>C a)

goal (1 subgoal):
 1. (a < - (b /\<^sub>C c)) = (- b < c *\<^sub>C a)
[PROOF STEP]
by (auto simp add: le_less *)
[PROOF STATE]
proof (state)
this:
(a < - (b /\<^sub>C c)) = (- b < c *\<^sub>C a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccspan_Inf_def: \<open>ccspan A = Inf {S. A \<subseteq> space_as_set S}\<close>
  for A::\<open>('a::cbanach) set\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}
[PROOF STEP]
have \<open>x \<in> space_as_set (ccspan A)
    \<Longrightarrow> x \<in> space_as_set (Inf {S. A \<subseteq> space_as_set S})\<close>
    for x::'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
assume \<open>x \<in> space_as_set (ccspan A)\<close>
[PROOF STATE]
proof (state)
this:
x \<in> space_as_set (ccspan A)

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
hence "x \<in> closure (cspan A)"
[PROOF STATE]
proof (prove)
using this:
x \<in> space_as_set (ccspan A)

goal (1 subgoal):
 1. x \<in> closure (cspan A)
[PROOF STEP]
by (simp add: ccspan.rep_eq)
[PROOF STATE]
proof (state)
this:
x \<in> closure (cspan A)

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
hence \<open>x \<in> closure (complex_vector.span A)\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> closure (cspan A)

goal (1 subgoal):
 1. x \<in> closure (cspan A)
[PROOF STEP]
unfolding ccspan_def
[PROOF STATE]
proof (prove)
using this:
x \<in> closure (cspan A)

goal (1 subgoal):
 1. x \<in> closure (cspan A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> closure (cspan A)

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
hence \<open>\<exists> y::nat \<Rightarrow> 'a. (\<forall> n. y n \<in> (complex_vector.span A)) \<and> y \<longlonglongrightarrow> x\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> closure (cspan A)

goal (1 subgoal):
 1. \<exists>y. (\<forall>n. y n \<in> cspan A) \<and> y \<longlonglongrightarrow> x
[PROOF STEP]
by (simp add: closure_sequential)
[PROOF STATE]
proof (state)
this:
\<exists>y. (\<forall>n. y n \<in> cspan A) \<and> y \<longlonglongrightarrow> x

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>y. (\<forall>n. y n \<in> cspan A) \<and> y \<longlonglongrightarrow> x
[PROOF STEP]
obtain y where \<open>\<forall> n. y n \<in> (complex_vector.span A)\<close> and \<open>y \<longlonglongrightarrow> x\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>y. (\<forall>n. y n \<in> cspan A) \<and> y \<longlonglongrightarrow> x

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>\<forall>n. y n \<in> cspan A; y \<longlonglongrightarrow> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>n. y n \<in> cspan A
y \<longlonglongrightarrow> x

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
have \<open>y n \<in> \<Inter> {S. (complex_vector.span A) \<subseteq> S \<and> closed_csubspace S}\<close>
      for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y n \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
using  \<open>\<forall> n. y n \<in> (complex_vector.span A)\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>n. y n \<in> cspan A

goal (1 subgoal):
 1. y n \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y ?n \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
have \<open>closed_csubspace S \<Longrightarrow> closed S\<close>
      for S::\<open>'a set\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace S \<Longrightarrow> closed S
[PROOF STEP]
by (simp add: closed_csubspace.closed)
[PROOF STATE]
proof (state)
this:
closed_csubspace ?S \<Longrightarrow> closed ?S

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
hence \<open>closed ( \<Inter> {S. (complex_vector.span A) \<subseteq> S \<and> closed_csubspace S})\<close>
[PROOF STATE]
proof (prove)
using this:
closed_csubspace ?S \<Longrightarrow> closed ?S

goal (1 subgoal):
 1. closed (\<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closed (\<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S})

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
hence \<open>x \<in> \<Inter> {S. (complex_vector.span A) \<subseteq> S \<and> closed_csubspace S}\<close>
[PROOF STATE]
proof (prove)
using this:
closed (\<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S})

goal (1 subgoal):
 1. x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
using \<open>y \<longlonglongrightarrow> x\<close>
[PROOF STATE]
proof (prove)
using this:
closed (\<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S})
y \<longlonglongrightarrow> x

goal (1 subgoal):
 1. x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
using \<open>\<And>n. y n \<in> \<Inter> {S. complex_vector.span A \<subseteq> S \<and> closed_csubspace S}\<close> closed_sequentially
[PROOF STATE]
proof (prove)
using this:
closed (\<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S})
y \<longlonglongrightarrow> x
y ?n \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
\<lbrakk>closed ?s; \<forall>n. ?f n \<in> ?s; ?f \<longlonglongrightarrow> ?l\<rbrakk> \<Longrightarrow> ?l \<in> ?s

goal (1 subgoal):
 1. x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
have \<open>{S. A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. (complex_vector.span A) \<subseteq> S \<and> closed_csubspace S}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {S. A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
using Collect_mono_iff
[PROOF STATE]
proof (prove)
using this:
(Collect ?P \<subseteq> Collect ?Q) = (\<forall>x. ?P x \<longrightarrow> ?Q x)

goal (1 subgoal):
 1. {S. A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
by (simp add: Collect_mono_iff closed_csubspace.subspace complex_vector.span_minimal)
[PROOF STATE]
proof (state)
this:
{S. A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. cspan A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
{S. A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
have \<open>x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
{S. A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. cspan A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
have "(x::'a) \<in> \<Inter> {x. A \<subseteq> x \<and> closed_csubspace x}"
      if "(x::'a) \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}"
      for x :: 'a
        and A :: "'a set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> \<Inter> {x. A \<subseteq> x \<and> closed_csubspace x}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> \<Inter> {x. A \<subseteq> x \<and> closed_csubspace x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?x \<in> \<Inter> {S. ?A \<subseteq> S \<and> closed_csubspace S} \<Longrightarrow> ?x \<in> \<Inter> {x. ?A \<subseteq> x \<and> closed_csubspace x}

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A) \<Longrightarrow> x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}
?x \<in> \<Inter> {S. ?A \<subseteq> S \<and> closed_csubspace S} \<Longrightarrow> ?x \<in> \<Inter> {x. ?A \<subseteq> x \<and> closed_csubspace x}
[PROOF STEP]
show \<open>x \<in> space_as_set (Inf {S. A \<subseteq> space_as_set S})\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}
?x \<in> \<Inter> {S. ?A \<subseteq> S \<and> closed_csubspace S} \<Longrightarrow> ?x \<in> \<Inter> {x. ?A \<subseteq> x \<and> closed_csubspace x}

goal (1 subgoal):
 1. x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x A. \<lbrakk>x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}; \<And>x A. x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S} \<Longrightarrow> x \<in> \<Inter> {x. A \<subseteq> x \<and> closed_csubspace x}\<rbrakk> \<Longrightarrow> x \<in> \<Inter> {x. A \<subseteq> x \<and> closed_csubspace x}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> space_as_set (ccspan A) \<Longrightarrow> ?x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})

goal (1 subgoal):
 1. ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> space_as_set (ccspan A) \<Longrightarrow> ?x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})

goal (1 subgoal):
 1. ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}
[PROOF STEP]
have \<open>x \<in> space_as_set (Inf {S. A \<subseteq> space_as_set S})
             \<Longrightarrow> x \<in> space_as_set (ccspan A)\<close>
    for x::'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> x \<in> space_as_set (ccspan A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> x \<in> space_as_set (ccspan A)
[PROOF STEP]
assume \<open>x \<in> space_as_set (Inf {S. A \<subseteq> space_as_set S})\<close>
[PROOF STATE]
proof (state)
this:
x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})

goal (1 subgoal):
 1. x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> x \<in> space_as_set (ccspan A)
[PROOF STEP]
hence \<open>x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})

goal (1 subgoal):
 1. x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x A. x \<in> \<Inter> {x. A \<subseteq> x \<and> closed_csubspace x} \<Longrightarrow> x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> x \<in> space_as_set (ccspan A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> x \<in> space_as_set (ccspan A)
[PROOF STEP]
have \<open>{S. (complex_vector.span A) \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. A \<subseteq> S \<and> closed_csubspace S}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {S. cspan A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
using Collect_mono_iff complex_vector.span_superset
[PROOF STATE]
proof (prove)
using this:
(Collect ?P \<subseteq> Collect ?Q) = (\<forall>x. ?P x \<longrightarrow> ?Q x)
?S \<subseteq> cspan ?S

goal (1 subgoal):
 1. {S. cspan A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{S. cspan A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> x \<in> space_as_set (ccspan A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}
{S. cspan A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
have \<open>x \<in> \<Inter> {S. (complex_vector.span A) \<subseteq> S \<and> closed_csubspace S}\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Inter> {S. A \<subseteq> S \<and> closed_csubspace S}
{S. cspan A \<subseteq> S \<and> closed_csubspace S} \<subseteq> {S. A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> x \<in> space_as_set (ccspan A)
[PROOF STEP]
thus \<open>x \<in> space_as_set (ccspan A)\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Inter> {S. cspan A \<subseteq> S \<and> closed_csubspace S}

goal (1 subgoal):
 1. x \<in> space_as_set (ccspan A)
[PROOF STEP]
by (metis (no_types, lifting) Inter_iff space_as_set closure_subset mem_Collect_eq ccspan.rep_eq)
[PROOF STATE]
proof (state)
this:
x \<in> space_as_set (ccspan A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> ?x \<in> space_as_set (ccspan A)

goal (1 subgoal):
 1. ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?x \<in> space_as_set (ccspan A) \<Longrightarrow> ?x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
?x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> ?x \<in> space_as_set (ccspan A)
[PROOF STEP]
have \<open>space_as_set (ccspan A) = space_as_set (Inf {S. A \<subseteq> space_as_set S})\<close>
[PROOF STATE]
proof (prove)
using this:
?x \<in> space_as_set (ccspan A) \<Longrightarrow> ?x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
?x \<in> space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S}) \<Longrightarrow> ?x \<in> space_as_set (ccspan A)

goal (1 subgoal):
 1. space_as_set (ccspan A) = space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
space_as_set (ccspan A) = space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})

goal (1 subgoal):
 1. ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
space_as_set (ccspan A) = space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})

goal (1 subgoal):
 1. ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}
[PROOF STEP]
using space_as_set_inject
[PROOF STATE]
proof (prove)
using this:
space_as_set (ccspan A) = space_as_set (\<Sqinter> {S. A \<subseteq> space_as_set S})
(space_as_set ?x = space_as_set ?y) = (?x = ?y)

goal (1 subgoal):
 1. ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ccspan A = \<Sqinter> {S. A \<subseteq> space_as_set S}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma image_mset_If:
  "image_mset (\<lambda>x. if P x then f x else g x) A =
     image_mset f (filter_mset P A) + image_mset g (filter_mset (\<lambda>x. \<not>P x) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset (\<lambda>x. if P x then f x else g x) A = image_mset f (filter_mset P A) + image_mset g {#x \<in># A. \<not> P x#}
[PROOF STEP]
by (induction A) auto


[STATEMENT]
lemma Zfun_ssubst: "eventually (\<lambda>x. f x = g x) F \<Longrightarrow> Zfun g F \<Longrightarrow> Zfun f F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in F. f x = g x; Zfun g F\<rbrakk> \<Longrightarrow> Zfun f F
[PROOF STEP]
unfolding Zfun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in F. f x = g x; \<forall>r>0. \<forall>\<^sub>F x in F. norm (g x) < r\<rbrakk> \<Longrightarrow> \<forall>r>0. \<forall>\<^sub>F x in F. norm (f x) < r
[PROOF STEP]
by (auto elim!: eventually_rev_mp)


[STATEMENT]
lemma fds_nth_higher_deriv:
  "fds_nth ((fds_deriv ^^ k) F) = (\<lambda>n. (-1) ^ k * of_real (ln n) ^ k * fds_nth F n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth ((fds_deriv ^^ k) F) = (\<lambda>n. (- (1::'a)) ^ k * of_real (ln (real n)) ^ k * fds_nth F n)
[PROOF STEP]
by (induction k) (auto simp: fds_nth_deriv fun_eq_iff simp flip: scaleR_conv_of_real)


[STATEMENT]
lemma diameter_disconnected_graph:
  assumes "\<not> is_connected_set V"
  shows "diameter = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diameter = \<infinity>
[PROOF STEP]
unfolding diameter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (eccentricity ` V) = \<infinity>
[PROOF STEP]
using eccentricity_disconnected_graph
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> is_connected_set V; ?v \<in> V\<rbrakk> \<Longrightarrow> eccentricity ?v = \<infinity>

goal (1 subgoal):
 1. Sup (eccentricity ` V) = \<infinity>
[PROOF STEP]
by (metis SUP_eq_const assms is_connected_set_empty)


[STATEMENT]
lemma minus_subgroup: "A \<in> subgroup \<Longrightarrow> -a \<in> A \<Longrightarrow> a \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> subgroup; - a \<in> A\<rbrakk> \<Longrightarrow> a \<in> A
[PROOF STEP]
apply (subst (asm) subgroup_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> {A. (0::'a) \<in> A \<and> (\<forall>a b. a \<in> A \<and> b \<in> A \<longrightarrow> a + b \<in> A \<and> - a \<in> A)}; - a \<in> A\<rbrakk> \<Longrightarrow> a \<in> A
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- a \<in> A; (0::'a) \<in> A; \<forall>a b. a \<in> A \<and> b \<in> A \<longrightarrow> a + b \<in> A \<and> - a \<in> A\<rbrakk> \<Longrightarrow> a \<in> A
[PROOF STEP]
apply (drule_tac x="-a" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- a \<in> A; (0::'a) \<in> A; \<forall>b. - a \<in> A \<and> b \<in> A \<longrightarrow> - a + b \<in> A \<and> - (- a) \<in> A\<rbrakk> \<Longrightarrow> a \<in> A
[PROOF STEP]
by simp


[STATEMENT]
lemma left_add_mult_distrib_mset:
  "repeat_mset i u + (repeat_mset j u + k) = repeat_mset (i+j) u + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. repeat_mset i u + (repeat_mset j u + k) = repeat_mset (i + j) u + k
[PROOF STEP]
by (auto simp: multiset_eq_iff add_mult_distrib)


[STATEMENT]
lemma inc_closed:
  assumes "a \<in> carrier Z\<^sub>p"
  shows "\<iota> a \<in> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<iota> a \<in> carrier Q\<^sub>p
[PROOF STEP]
using Q\<^sub>p_def \<iota>_def assms Zp.inc_is_hom ring_hom_closed
[PROOF STATE]
proof (prove)
using this:
Q\<^sub>p \<equiv> Frac Z\<^sub>p
\<iota> \<equiv> Frac_inc Z\<^sub>p
a \<in> carrier Z\<^sub>p
Frac_inc Z\<^sub>p \<in> ring_hom Z\<^sub>p (Frac Z\<^sub>p)
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h ?x \<in> carrier ?S

goal (1 subgoal):
 1. \<iota> a \<in> carrier Q\<^sub>p
[PROOF STEP]
by fastforce


[STATEMENT]
lemma complex_mult_cnj_cmod:
  shows "z * cnj z = cor ((cmod z)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z * cnj z = cor ((cmod z)\<^sup>2)
[PROOF STEP]
using complex_norm_square
[PROOF STATE]
proof (prove)
using this:
cor ((cmod ?z)\<^sup>2) = ?z * cnj ?z

goal (1 subgoal):
 1. z * cnj z = cor ((cmod z)\<^sup>2)
[PROOF STEP]
by auto


[STATEMENT]
lemma rat_inv_eq:
  assumes "Fract a b = Fract c d"
  assumes "b > 0"
  assumes "d > 0"
  assumes "coprime a b"
  assumes "coprime c d"
  shows "a = c \<and> b = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = c \<and> b = d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = c \<and> b = d
[PROOF STEP]
from \<open>b > 0\<close> \<open>d > 0\<close> \<open>Fract a b = Fract c d\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < b
0 < d
Fract a b = Fract c d
[PROOF STEP]
have *: "a * d = c * b"
[PROOF STATE]
proof (prove)
using this:
0 < b
0 < d
Fract a b = Fract c d

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

goal (1 subgoal):
 1. a = c \<and> b = d
[PROOF STEP]
from arg_cong[where f=sgn, OF this] \<open>b > 0\<close> \<open>d > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
sgn (a * d) = sgn (c * b)
0 < b
0 < d
[PROOF STEP]
have "sgn a = sgn c"
[PROOF STATE]
proof (prove)
using this:
sgn (a * d) = sgn (c * b)
0 < b
0 < d

goal (1 subgoal):
 1. sgn a = sgn c
[PROOF STEP]
by (simp add: sgn_mult)
[PROOF STATE]
proof (state)
this:
sgn a = sgn c

goal (1 subgoal):
 1. a = c \<and> b = d
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
a * d = c * b
sgn a = sgn c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a * d = c * b
sgn a = sgn c

goal (1 subgoal):
 1. a = c \<and> b = d
[PROOF STEP]
using \<open>b > 0\<close> \<open>d > 0\<close> coprime_crossproduct_int[OF \<open>coprime a b\<close> \<open>coprime c d\<close>]
[PROOF STATE]
proof (prove)
using this:
a * d = c * b
sgn a = sgn c
0 < b
0 < d
(\<bar>a\<bar> * \<bar>d\<bar> = \<bar>c\<bar> * \<bar>b\<bar>) = (\<bar>a\<bar> = \<bar>c\<bar> \<and> \<bar>d\<bar> = \<bar>b\<bar>)

goal (1 subgoal):
 1. a = c \<and> b = d
[PROOF STEP]
by (simp add: abs_sgn)
[PROOF STATE]
proof (state)
this:
a = c \<and> b = d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scaleR_le_self_cancel:
  fixes c::"'a::ordered_real_vector"
  shows "a *\<^sub>R c \<le> c \<longleftrightarrow> (1 < a \<and> c \<le> 0 \<or> a < 1 \<and> 0 \<le> c \<or> a = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a *\<^sub>R c \<le> c) = (1 < a \<and> c \<le> (0::'a) \<or> a < 1 \<and> (0::'a) \<le> c \<or> a = 1)
[PROOF STEP]
using scaleR_le_0_iff[of "a - 1" c]
[PROOF STATE]
proof (prove)
using this:
((a - 1) *\<^sub>R c \<le> (0::'a)) = (0 < a - 1 \<and> c \<le> (0::'a) \<or> a - 1 < 0 \<and> (0::'a) \<le> c \<or> a - 1 = 0)

goal (1 subgoal):
 1. (a *\<^sub>R c \<le> c) = (1 < a \<and> c \<le> (0::'a) \<or> a < 1 \<and> (0::'a) \<le> c \<or> a = 1)
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma connected_openin_eq:
      "connected S \<longleftrightarrow>
       \<not>(\<exists>E1 E2. openin (top_of_set S) E1 \<and>
                 openin (top_of_set S) E2 \<and>
                 E1 \<union> E2 = S \<and> E1 \<inter> E2 = {} \<and>
                 E1 \<noteq> {} \<and> E2 \<noteq> {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected S = (\<nexists>E1 E2. openin (top_of_set S) E1 \<and> openin (top_of_set S) E2 \<and> E1 \<union> E2 = S \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})
[PROOF STEP]
unfolding connected_openin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>E1 E2. openin (top_of_set S) E1 \<and> openin (top_of_set S) E2 \<and> S \<subseteq> E1 \<union> E2 \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {}) = (\<nexists>E1 E2. openin (top_of_set S) E1 \<and> openin (top_of_set S) E2 \<and> E1 \<union> E2 = S \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})
[PROOF STEP]
by (metis (no_types, lifting) Un_subset_iff openin_imp_subset subset_antisym)


[STATEMENT]
lemma conjugate_preserve_poincare_between [simp]:
  assumes "u \<in> unit_disc" and "v \<in> unit_disc" and "w \<in> unit_disc"
  shows "poincare_between (conjugate u) (conjugate v) (conjugate w) \<longleftrightarrow>
         poincare_between u v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
proof (cases "u = v \<or> v = w")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u = v \<or> v = w \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
 2. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
u = v \<or> v = w

goal (2 subgoals):
 1. u = v \<or> v = w \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
 2. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
u = v \<or> v = w

goal (1 subgoal):
 1. poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u = v \<or> v = w
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc

goal (1 subgoal):
 1. poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
unfolding poincare_between_def
[PROOF STATE]
proof (prove)
using this:
u = v \<or> v = w
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc

goal (1 subgoal):
 1. (conjugate u = conjugate v \<or> conjugate v = conjugate w \<or> (let cr = cross_ratio (conjugate u) (conjugate v) (conjugate w) (inversion (conjugate v)) in is_real (to_complex cr) \<and> Re (to_complex cr) < 0)) = (u = v \<or> v = w \<or> (let cr = cross_ratio u v w (inversion v) in is_real (to_complex cr) \<and> Re (to_complex cr) < 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w

goal (1 subgoal):
 1. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (u = v \<or> v = w)

goal (1 subgoal):
 1. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> (u = v \<or> v = w)

goal (1 subgoal):
 1. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
hence "conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w"
[PROOF STATE]
proof (prove)
using this:
\<not> (u = v \<or> v = w)

goal (1 subgoal):
 1. conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w
[PROOF STEP]
using conjugate_inj
[PROOF STATE]
proof (prove)
using this:
\<not> (u = v \<or> v = w)
conjugate ?x = conjugate ?y \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w

goal (1 subgoal):
 1. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w

goal (1 subgoal):
 1. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
have "v \<noteq> inversion v" "w \<noteq> inversion v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<noteq> inversion v &&& w \<noteq> inversion v
[PROOF STEP]
using inversion_noteq_unit_disc[of v w]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w

goal (1 subgoal):
 1. v \<noteq> inversion v &&& w \<noteq> inversion v
[PROOF STEP]
using inversion_noteq_unit_disc[of v v]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w
\<lbrakk>v \<in> unit_disc; v \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> v

goal (1 subgoal):
 1. v \<noteq> inversion v &&& w \<noteq> inversion v
[PROOF STEP]
using \<open>v \<in> unit_disc\<close> \<open>w \<in> unit_disc\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w
\<lbrakk>v \<in> unit_disc; v \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> v
v \<in> unit_disc
w \<in> unit_disc

goal (1 subgoal):
 1. v \<noteq> inversion v &&& w \<noteq> inversion v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<noteq> inversion v
w \<noteq> inversion v

goal (1 subgoal):
 1. \<not> (u = v \<or> v = w) \<Longrightarrow> poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> (u = v \<or> v = w)
conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w
v \<noteq> inversion v
w \<noteq> inversion v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (u = v \<or> v = w)
conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w
v \<noteq> inversion v
w \<noteq> inversion v

goal (1 subgoal):
 1. poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> (u = v \<or> v = w)
conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w
v \<noteq> inversion v
w \<noteq> inversion v
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc

goal (1 subgoal):
 1. poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
using conjugate_cross_ratio[of v w "inversion v" u]
[PROOF STATE]
proof (prove)
using this:
\<not> (u = v \<or> v = w)
conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w
v \<noteq> inversion v
w \<noteq> inversion v
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<noteq> w; v \<noteq> inversion v; w \<noteq> inversion v\<rbrakk> \<Longrightarrow> cross_ratio (conjugate u) (conjugate v) (conjugate w) (conjugate (inversion v)) = conjugate (cross_ratio u v w (inversion v))

goal (1 subgoal):
 1. poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w
[PROOF STEP]
unfolding poincare_between_def
[PROOF STATE]
proof (prove)
using this:
\<not> (u = v \<or> v = w)
conjugate u \<noteq> conjugate v \<and> conjugate v \<noteq> conjugate w
v \<noteq> inversion v
w \<noteq> inversion v
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<noteq> w; v \<noteq> inversion v; w \<noteq> inversion v\<rbrakk> \<Longrightarrow> cross_ratio (conjugate u) (conjugate v) (conjugate w) (conjugate (inversion v)) = conjugate (cross_ratio u v w (inversion v))

goal (1 subgoal):
 1. (conjugate u = conjugate v \<or> conjugate v = conjugate w \<or> (let cr = cross_ratio (conjugate u) (conjugate v) (conjugate w) (inversion (conjugate v)) in is_real (to_complex cr) \<and> Re (to_complex cr) < 0)) = (u = v \<or> v = w \<or> (let cr = cross_ratio u v w (inversion v) in is_real (to_complex cr) \<and> Re (to_complex cr) < 0))
[PROOF STEP]
by (metis conjugate_id_iff conjugate_involution inversion_def inversion_sym o_apply)
[PROOF STATE]
proof (state)
this:
poincare_between (conjugate u) (conjugate v) (conjugate w) = poincare_between u v w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [code abstract]:
    "Rep_FingerTree (app s t) =
      FingerTreeStruc.app (Rep_FingerTree s) (Rep_FingerTree t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_FingerTree (app s t) = FingerTreeStruc.app (Rep_FingerTree s) (Rep_FingerTree t)
[PROOF STEP]
by (simp add: app_def FingerTreeStruc.app_correct)


[STATEMENT]
lemma GDERIV_inverse:
    "\<lbrakk>GDERIV f x :> df; f x \<noteq> 0\<rbrakk>
     \<Longrightarrow> GDERIV (\<lambda>x. inverse (f x)) x :> - (inverse (f x))\<^sup>2 *\<^sub>R df"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>GDERIV f x :> df; f x \<noteq> 0\<rbrakk> \<Longrightarrow> GDERIV (\<lambda>x. inverse (f x)) x :> - (inverse (f x))\<^sup>2 *\<^sub>R df
[PROOF STEP]
by (metis DERIV_inverse GDERIV_DERIV_compose numerals(2))


[STATEMENT]
lemma carrier_mult_of [simp]: "carrier (mult_of R) = carrier R - {\<zero>\<^bsub>R\<^esub>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (Ring_Divisibility.mult_of R) = carrier R - {\<zero>\<^bsub>R\<^esub>}
[PROOF STEP]
by (simp add: mult_of_def)


[STATEMENT]
lemma disj_matrices_add_zero_le: "disj_matrices A B \<Longrightarrow>
  (0 <= A + B) = (0 <= A & 0 <= (B::('a::lattice_ab_group_add) matrix))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disj_matrices A B \<Longrightarrow> (0 \<le> A + B) = (0 \<le> A \<and> 0 \<le> B)
[PROOF STEP]
by (rule disj_matrices_add[of 0 0 A B, simplified])


[STATEMENT]
lemma same_orbit_char:
  assumes "m \<in> M" "n \<in> M"
  shows "(m, n) \<in> same_orbit_rel = (\<exists>g \<in> carrier G. ((\<phi> g) n = m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((m, n) \<in> same_orbit_rel) = (\<exists>g\<in>carrier G. \<phi> g n = m)
[PROOF STEP]
unfolding same_orbit_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((m, n) \<in> {p \<in> M \<times> M. \<exists>g\<in>carrier G. \<phi> g (snd p) = fst p}) = (\<exists>g\<in>carrier G. \<phi> g n = m)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m \<in> M
n \<in> M

goal (1 subgoal):
 1. ((m, n) \<in> {p \<in> M \<times> M. \<exists>g\<in>carrier G. \<phi> g (snd p) = fst p}) = (\<exists>g\<in>carrier G. \<phi> g n = m)
[PROOF STEP]
by auto