[STATEMENT]
lemma partition_on_le_set_elements:
  assumes "finite A"
  assumes "partition_on A P"
  shows "card P \<le> card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card P \<le> card A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
partition_on A P

goal (1 subgoal):
 1. card P \<le> card A
[PROOF STEP]
proof (induct A arbitrary: P)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P. partition_on {} P \<Longrightarrow> card P \<le> card {}
 2. \<And>x F P. \<lbrakk>finite F; x \<notin> F; \<And>P. partition_on F P \<Longrightarrow> card P \<le> card F; partition_on (insert x F) P\<rbrakk> \<Longrightarrow> card P \<le> card (insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
partition_on {} P

goal (2 subgoals):
 1. \<And>P. partition_on {} P \<Longrightarrow> card P \<le> card {}
 2. \<And>x F P. \<lbrakk>finite F; x \<notin> F; \<And>P. partition_on F P \<Longrightarrow> card P \<le> card F; partition_on (insert x F) P\<rbrakk> \<Longrightarrow> card P \<le> card (insert x F)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
partition_on {} P
[PROOF STEP]
show "card P \<le> card {}"
[PROOF STATE]
proof (prove)
using this:
partition_on {} P

goal (1 subgoal):
 1. card P \<le> card {}
[PROOF STEP]
by (simp add: partition_on_empty)
[PROOF STATE]
proof (state)
this:
card P \<le> card {}

goal (1 subgoal):
 1. \<And>x F P. \<lbrakk>finite F; x \<notin> F; \<And>P. partition_on F P \<Longrightarrow> card P \<le> card F; partition_on (insert x F) P\<rbrakk> \<Longrightarrow> card P \<le> card (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F P. \<lbrakk>finite F; x \<notin> F; \<And>P. partition_on F P \<Longrightarrow> card P \<le> card F; partition_on (insert x F) P\<rbrakk> \<Longrightarrow> card P \<le> card (insert x F)
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
partition_on A ?P \<Longrightarrow> card ?P \<le> card A
partition_on (insert a A) P

goal (1 subgoal):
 1. \<And>x F P. \<lbrakk>finite F; x \<notin> F; \<And>P. partition_on F P \<Longrightarrow> card P \<le> card F; partition_on (insert x F) P\<rbrakk> \<Longrightarrow> card P \<le> card (insert x F)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card P \<le> card (insert a A)
[PROOF STEP]
proof (cases "{a} \<in> P")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {a} \<in> P \<Longrightarrow> card P \<le> card (insert a A)
 2. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
{a} \<in> P

goal (2 subgoals):
 1. {a} \<in> P \<Longrightarrow> card P \<le> card (insert a A)
 2. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
have prop_partition_on: "\<forall>p\<in>P. p \<noteq> {}" "\<Union>P = insert a A"
      "\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>P. p \<noteq> {} &&& \<Union> P = insert a A &&& \<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
[PROOF STEP]
using \<open>partition_on (insert a A) P\<close>
[PROOF STATE]
proof (prove)
using this:
partition_on (insert a A) P

goal (1 subgoal):
 1. \<forall>p\<in>P. p \<noteq> {} &&& \<Union> P = insert a A &&& \<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
[PROOF STEP]
by (fastforce elim: partition_onE)+
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>P. p \<noteq> {}
\<Union> P = insert a A
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}

goal (2 subgoals):
 1. {a} \<in> P \<Longrightarrow> card P \<le> card (insert a A)
 2. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
from this(2, 3) \<open>a \<notin> A\<close> \<open>{a} \<in> P\<close>
[PROOF STATE]
proof (chain)
picking this:
\<Union> P = insert a A
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
a \<notin> A
{a} \<in> P
[PROOF STEP]
have A_eq: "A = \<Union>(P - {{a}})"
[PROOF STATE]
proof (prove)
using this:
\<Union> P = insert a A
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
a \<notin> A
{a} \<in> P

goal (1 subgoal):
 1. A = \<Union> (P - {{a}})
[PROOF STEP]
by auto (metis Int_iff UnionI empty_iff insert_iff)
[PROOF STATE]
proof (state)
this:
A = \<Union> (P - {{a}})

goal (2 subgoals):
 1. {a} \<in> P \<Longrightarrow> card P \<le> card (insert a A)
 2. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
from prop_partition_on A_eq
[PROOF STATE]
proof (chain)
picking this:
\<forall>p\<in>P. p \<noteq> {}
\<Union> P = insert a A
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
A = \<Union> (P - {{a}})
[PROOF STEP]
have partition_on: "partition_on A (P - {{a}})"
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>P. p \<noteq> {}
\<Union> P = insert a A
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
A = \<Union> (P - {{a}})

goal (1 subgoal):
 1. partition_on A (P - {{a}})
[PROOF STEP]
by (intro partition_onI) auto
[PROOF STATE]
proof (state)
this:
partition_on A (P - {{a}})

goal (2 subgoals):
 1. {a} \<in> P \<Longrightarrow> card P \<le> card (insert a A)
 2. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
from insert.hyps(3) this
[PROOF STATE]
proof (chain)
picking this:
partition_on A ?P \<Longrightarrow> card ?P \<le> card A
partition_on A (P - {{a}})
[PROOF STEP]
have "card (P - {{a}}) \<le> card A"
[PROOF STATE]
proof (prove)
using this:
partition_on A ?P \<Longrightarrow> card ?P \<le> card A
partition_on A (P - {{a}})

goal (1 subgoal):
 1. card (P - {{a}}) \<le> card A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (P - {{a}}) \<le> card A

goal (2 subgoals):
 1. {a} \<in> P \<Longrightarrow> card P \<le> card (insert a A)
 2. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
from this insert(1, 2, 4) \<open>{a} \<in> P\<close>
[PROOF STATE]
proof (chain)
picking this:
card (P - {{a}}) \<le> card A
finite A
a \<notin> A
partition_on (insert a A) P
{a} \<in> P
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (P - {{a}}) \<le> card A
finite A
a \<notin> A
partition_on (insert a A) P
{a} \<in> P

goal (1 subgoal):
 1. card P \<le> card (insert a A)
[PROOF STEP]
using finite_elements[OF \<open>finite A\<close> partition_on]
[PROOF STATE]
proof (prove)
using this:
card (P - {{a}}) \<le> card A
finite A
a \<notin> A
partition_on (insert a A) P
{a} \<in> P
finite (P - {{a}})

goal (1 subgoal):
 1. card P \<le> card (insert a A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card P \<le> card (insert a A)

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
{a} \<notin> P

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
from \<open>partition_on (insert a A) P\<close>
[PROOF STATE]
proof (chain)
picking this:
partition_on (insert a A) P
[PROOF STEP]
obtain p where p_def: "p \<in> P" "a \<in> p"
[PROOF STATE]
proof (prove)
using this:
partition_on (insert a A) P

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p \<in> P; a \<in> p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (blast elim: partition_onE)
[PROOF STATE]
proof (state)
this:
p \<in> P
a \<in> p

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
from \<open>partition_on (insert a A) P\<close> p_def
[PROOF STATE]
proof (chain)
picking this:
partition_on (insert a A) P
p \<in> P
a \<in> p
[PROOF STEP]
have a_notmem: "\<forall>p'\<in> P - {p}. a \<notin> p'"
[PROOF STATE]
proof (prove)
using this:
partition_on (insert a A) P
p \<in> P
a \<in> p

goal (1 subgoal):
 1. \<forall>p'\<in>P - {p}. a \<notin> p'
[PROOF STEP]
by (blast elim: partition_onE)
[PROOF STATE]
proof (state)
this:
\<forall>p'\<in>P - {p}. a \<notin> p'

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
from \<open>partition_on (insert a A) P\<close> p_def
[PROOF STATE]
proof (chain)
picking this:
partition_on (insert a A) P
p \<in> P
a \<in> p
[PROOF STEP]
have "p - {a} \<notin> P"
[PROOF STATE]
proof (prove)
using this:
partition_on (insert a A) P
p \<in> P
a \<in> p

goal (1 subgoal):
 1. p - {a} \<notin> P
[PROOF STEP]
unfolding partition_on_def disjoint_def
[PROOF STATE]
proof (prove)
using this:
\<Union> P = insert a A \<and> (\<forall>a\<in>P. \<forall>b\<in>P. a \<noteq> b \<longrightarrow> a \<inter> b = {}) \<and> {} \<notin> P
p \<in> P
a \<in> p

goal (1 subgoal):
 1. p - {a} \<notin> P
[PROOF STEP]
by (metis Diff_insert_absorb Diff_subset inf.orderE mk_disjoint_insert)
[PROOF STATE]
proof (state)
this:
p - {a} \<notin> P

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
let ?P' = "insert (p - {a}) (P - {p})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
have "partition_on A ?P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_on A (insert (p - {a}) (P - {p}))
[PROOF STEP]
proof (rule partition_onI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>pa. pa \<in> insert (p - {a}) (P - {p}) \<Longrightarrow> pa \<noteq> {}
 2. \<Union> (insert (p - {a}) (P - {p})) = A
 3. \<And>pa p'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); p' \<in> insert (p - {a}) (P - {p}); pa \<noteq> p'\<rbrakk> \<Longrightarrow> pa \<inter> p' = {}
[PROOF STEP]
from \<open>partition_on (insert a A) P\<close>
[PROOF STATE]
proof (chain)
picking this:
partition_on (insert a A) P
[PROOF STEP]
have "\<forall>p\<in>P. p \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
partition_on (insert a A) P

goal (1 subgoal):
 1. \<forall>p\<in>P. p \<noteq> {}
[PROOF STEP]
by (auto elim: partition_onE)
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>P. p \<noteq> {}

goal (3 subgoals):
 1. \<And>pa. pa \<in> insert (p - {a}) (P - {p}) \<Longrightarrow> pa \<noteq> {}
 2. \<Union> (insert (p - {a}) (P - {p})) = A
 3. \<And>pa p'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); p' \<in> insert (p - {a}) (P - {p}); pa \<noteq> p'\<rbrakk> \<Longrightarrow> pa \<inter> p' = {}
[PROOF STEP]
from this p_def \<open>{a} \<notin> P\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>p\<in>P. p \<noteq> {}
p \<in> P
a \<in> p
{a} \<notin> P
[PROOF STEP]
show "\<And>p'. p'\<in>insert (p - {a}) (P - {p}) \<Longrightarrow> p' \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>P. p \<noteq> {}
p \<in> P
a \<in> p
{a} \<notin> P

goal (1 subgoal):
 1. \<And>p'. p' \<in> insert (p - {a}) (P - {p}) \<Longrightarrow> p' \<noteq> {}
[PROOF STEP]
by (simp; metis (no_types) Diff_eq_empty_iff subset_singletonD)
[PROOF STATE]
proof (state)
this:
?p' \<in> insert (p - {a}) (P - {p}) \<Longrightarrow> ?p' \<noteq> {}

goal (2 subgoals):
 1. \<Union> (insert (p - {a}) (P - {p})) = A
 2. \<And>pa p'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); p' \<in> insert (p - {a}) (P - {p}); pa \<noteq> p'\<rbrakk> \<Longrightarrow> pa \<inter> p' = {}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Union> (insert (p - {a}) (P - {p})) = A
 2. \<And>pa p'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); p' \<in> insert (p - {a}) (P - {p}); pa \<noteq> p'\<rbrakk> \<Longrightarrow> pa \<inter> p' = {}
[PROOF STEP]
from \<open>partition_on (insert a A) P\<close>
[PROOF STATE]
proof (chain)
picking this:
partition_on (insert a A) P
[PROOF STEP]
have "\<Union>P = insert a A"
[PROOF STATE]
proof (prove)
using this:
partition_on (insert a A) P

goal (1 subgoal):
 1. \<Union> P = insert a A
[PROOF STEP]
by (auto elim: partition_onE)
[PROOF STATE]
proof (state)
this:
\<Union> P = insert a A

goal (2 subgoals):
 1. \<Union> (insert (p - {a}) (P - {p})) = A
 2. \<And>pa p'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); p' \<in> insert (p - {a}) (P - {p}); pa \<noteq> p'\<rbrakk> \<Longrightarrow> pa \<inter> p' = {}
[PROOF STEP]
from p_def this \<open>a \<notin> A\<close> a_notmem
[PROOF STATE]
proof (chain)
picking this:
p \<in> P
a \<in> p
\<Union> P = insert a A
a \<notin> A
\<forall>p'\<in>P - {p}. a \<notin> p'
[PROOF STEP]
show "\<Union>(insert (p - {a}) (P - {p})) = A"
[PROOF STATE]
proof (prove)
using this:
p \<in> P
a \<in> p
\<Union> P = insert a A
a \<notin> A
\<forall>p'\<in>P - {p}. a \<notin> p'

goal (1 subgoal):
 1. \<Union> (insert (p - {a}) (P - {p})) = A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> (insert (p - {a}) (P - {p})) = A

goal (1 subgoal):
 1. \<And>pa p'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); p' \<in> insert (p - {a}) (P - {p}); pa \<noteq> p'\<rbrakk> \<Longrightarrow> pa \<inter> p' = {}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>pa p'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); p' \<in> insert (p - {a}) (P - {p}); pa \<noteq> p'\<rbrakk> \<Longrightarrow> pa \<inter> p' = {}
[PROOF STEP]
show "\<And>pa pa'. pa\<in>insert (p - {a}) (P - {p}) \<Longrightarrow> pa'\<in>insert (p - {a}) (P - {p}) \<Longrightarrow> pa \<noteq> pa' \<Longrightarrow> pa \<inter> pa' = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pa pa'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); pa' \<in> insert (p - {a}) (P - {p}); pa \<noteq> pa'\<rbrakk> \<Longrightarrow> pa \<inter> pa' = {}
[PROOF STEP]
using \<open>partition_on (insert a A) P\<close> p_def a_notmem
[PROOF STATE]
proof (prove)
using this:
partition_on (insert a A) P
p \<in> P
a \<in> p
\<forall>p'\<in>P - {p}. a \<notin> p'

goal (1 subgoal):
 1. \<And>pa pa'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); pa' \<in> insert (p - {a}) (P - {p}); pa \<noteq> pa'\<rbrakk> \<Longrightarrow> pa \<inter> pa' = {}
[PROOF STEP]
unfolding partition_on_def disjoint_def
[PROOF STATE]
proof (prove)
using this:
\<Union> P = insert a A \<and> (\<forall>a\<in>P. \<forall>b\<in>P. a \<noteq> b \<longrightarrow> a \<inter> b = {}) \<and> {} \<notin> P
p \<in> P
a \<in> p
\<forall>p'\<in>P - {p}. a \<notin> p'

goal (1 subgoal):
 1. \<And>pa pa'. \<lbrakk>pa \<in> insert (p - {a}) (P - {p}); pa' \<in> insert (p - {a}) (P - {p}); pa \<noteq> pa'\<rbrakk> \<Longrightarrow> pa \<inter> pa' = {}
[PROOF STEP]
by (metis disjoint_iff_not_equal insert_Diff insert_iff)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?pa \<in> insert (p - {a}) (P - {p}); ?pa' \<in> insert (p - {a}) (P - {p}); ?pa \<noteq> ?pa'\<rbrakk> \<Longrightarrow> ?pa \<inter> ?pa' = {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
partition_on A (insert (p - {a}) (P - {p}))

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
have "finite P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite P
[PROOF STEP]
using \<open>finite A\<close> \<open>partition_on A ?P'\<close> finite_elements
[PROOF STATE]
proof (prove)
using this:
finite A
partition_on A (insert (p - {a}) (P - {p}))
\<lbrakk>finite ?A; partition_on ?A ?P\<rbrakk> \<Longrightarrow> finite ?P

goal (1 subgoal):
 1. finite P
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
finite P

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
have "card P = Suc (card (P - {p}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card P = Suc (card (P - {p}))
[PROOF STEP]
using p_def \<open>finite P\<close> card.remove
[PROOF STATE]
proof (prove)
using this:
p \<in> P
a \<in> p
finite P
\<lbrakk>finite ?A; ?x \<in> ?A\<rbrakk> \<Longrightarrow> card ?A = Suc (card (?A - {?x}))

goal (1 subgoal):
 1. card P = Suc (card (P - {p}))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card P = Suc (card (P - {p}))

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card P = Suc (card (P - {p}))

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
have "\<dots> = card ?P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (card (P - {p})) = card (insert (p - {a}) (P - {p}))
[PROOF STEP]
using \<open>p - {a} \<notin> P\<close> \<open>finite P\<close>
[PROOF STATE]
proof (prove)
using this:
p - {a} \<notin> P
finite P

goal (1 subgoal):
 1. Suc (card (P - {p})) = card (insert (p - {a}) (P - {p}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc (card (P - {p})) = card (insert (p - {a}) (P - {p}))

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc (card (P - {p})) = card (insert (p - {a}) (P - {p}))

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
have "\<dots> \<le> card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert (p - {a}) (P - {p})) \<le> card A
[PROOF STEP]
using \<open>partition_on A ?P'\<close> insert.hyps(3)
[PROOF STATE]
proof (prove)
using this:
partition_on A (insert (p - {a}) (P - {p}))
partition_on A ?P \<Longrightarrow> card ?P \<le> card A

goal (1 subgoal):
 1. card (insert (p - {a}) (P - {p})) \<le> card A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (insert (p - {a}) (P - {p})) \<le> card A

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (insert (p - {a}) (P - {p})) \<le> card A

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
have "\<dots> \<le> card (insert a A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A \<le> card (insert a A)
[PROOF STEP]
by (simp add: card_insert_le \<open>finite A\<close> )
[PROOF STATE]
proof (state)
this:
card A \<le> card (insert a A)

goal (1 subgoal):
 1. {a} \<notin> P \<Longrightarrow> card P \<le> card (insert a A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card P \<le> card (insert a A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card P \<le> card (insert a A)

goal (1 subgoal):
 1. card P \<le> card (insert a A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card P \<le> card (insert a A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card P \<le> card (insert a A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma translation_invert:
  fixes a :: "'a::ab_group_add"
  assumes "(\<lambda>x. a + x) ` A = (\<lambda>x. a + x) ` B"
  shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
have "(\<lambda>x. -a + x) ` ((\<lambda>x. a + x) ` A) = (\<lambda>x. - a + x) ` ((\<lambda>x. a + x) ` B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (+) (- a) ` (+) a ` A = (+) (- a) ` (+) a ` B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(+) a ` A = (+) a ` B

goal (1 subgoal):
 1. (+) (- a) ` (+) a ` A = (+) (- a) ` (+) a ` B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(+) (- a) ` (+) a ` A = (+) (- a) ` (+) a ` B

goal (1 subgoal):
 1. A = B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(+) (- a) ` (+) a ` A = (+) (- a) ` (+) a ` B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(+) (- a) ` (+) a ` A = (+) (- a) ` (+) a ` B

goal (1 subgoal):
 1. A = B
[PROOF STEP]
using translation_assoc[of "-a" a A] translation_assoc[of "-a" a B]
[PROOF STATE]
proof (prove)
using this:
(+) (- a) ` (+) a ` A = (+) (- a) ` (+) a ` B
(+) (- a) ` (+) a ` A = (+) (a + - a) ` A
(+) (- a) ` (+) a ` B = (+) (a + - a) ` B

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma normal_upper_triangular_matrix_is_diagonal:
  fixes A :: "'a::conjugatable_ordered_field mat"
  assumes "A \<in> carrier_mat n n"
    and tri: "upper_triangular A"
    and norm: "A * adjoint A = adjoint A * A"
  shows "diagonal_mat A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_mat A
[PROOF STEP]
proof (rule disjE[of "n = 0" "n > 0"], blast)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> diagonal_mat A
 2. 0 < n \<Longrightarrow> diagonal_mat A
[PROOF STEP]
have dim: "dim_row A = n" "dim_col A = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row A = n &&& dim_col A = n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
upper_triangular A
A * adjoint A = adjoint A * A

goal (1 subgoal):
 1. dim_row A = n &&& dim_col A = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row A = n
dim_col A = n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> diagonal_mat A
 2. 0 < n \<Longrightarrow> diagonal_mat A
[PROOF STEP]
from norm
[PROOF STATE]
proof (chain)
picking this:
A * adjoint A = adjoint A * A
[PROOF STEP]
have eq0: "\<And>i j. (A * adjoint A)$$(i,j) = (adjoint A * A)$$(i,j)"
[PROOF STATE]
proof (prove)
using this:
A * adjoint A = adjoint A * A

goal (1 subgoal):
 1. \<And>i j. (A * adjoint A) $$ (i, j) = (adjoint A * A) $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A * adjoint A) $$ (?i, ?j) = (adjoint A * A) $$ (?i, ?j)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> diagonal_mat A
 2. 0 < n \<Longrightarrow> diagonal_mat A
[PROOF STEP]
have nat_induct_strong:
    "\<And>P. (P::nat\<Rightarrow>bool) 0 \<Longrightarrow> (\<And>i. i < n \<Longrightarrow> (\<And>k. k < i \<Longrightarrow> P k) \<Longrightarrow> P i) \<Longrightarrow> (\<And>i. i < n \<Longrightarrow> P i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<lbrakk>P 0; \<And>i. \<lbrakk>i < n; \<And>k. k < i \<Longrightarrow> P k\<rbrakk> \<Longrightarrow> P i\<rbrakk> \<Longrightarrow> (\<And>i. i < n \<Longrightarrow> P i)
[PROOF STEP]
by (metis dual_order.strict_trans infinite_descent0 linorder_neqE_nat)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?P 0; \<And>i. \<lbrakk>i < n; \<And>k. k < i \<Longrightarrow> ?P k\<rbrakk> \<Longrightarrow> ?P i; ?i < n\<rbrakk> \<Longrightarrow> ?P ?i

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> diagonal_mat A
 2. 0 < n \<Longrightarrow> diagonal_mat A
[PROOF STEP]
show "n = 0 \<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = 0 \<Longrightarrow> diagonal_mat A
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> diagonal_mat A
[PROOF STEP]
unfolding diagonal_mat_def
[PROOF STATE]
proof (prove)
using this:
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> \<forall>i<dim_row A. \<forall>j<dim_col A. i \<noteq> j \<longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n = 0 \<Longrightarrow> diagonal_mat A

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> diagonal_mat A
[PROOF STEP]
show "n > 0 \<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> diagonal_mat A
[PROOF STEP]
unfolding diagonal_mat_def dim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
apply (rule allI, rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> \<forall>j<n. i \<noteq> j \<longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
apply (rule nat_induct_strong)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> \<forall>j<n. 0 \<noteq> j \<longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
proof (rule allI, rule impI, rule impI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
assume asm: "n > 0"
[PROOF STATE]
proof (state)
this:
0 < n

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
from tri upper_triangularD[of A 0 j] dim
[PROOF STATE]
proof (chain)
picking this:
upper_triangular A
\<lbrakk>upper_triangular A; 0 < j; j < dim_row A\<rbrakk> \<Longrightarrow> A $$ (j, 0) = (0::'a)
dim_row A = n
dim_col A = n
[PROOF STEP]
have z0: "\<And>j. 0< j \<Longrightarrow> j < n \<Longrightarrow> A$$(j, 0) = 0"
[PROOF STATE]
proof (prove)
using this:
upper_triangular A
\<lbrakk>upper_triangular A; 0 < j; j < dim_row A\<rbrakk> \<Longrightarrow> A $$ (j, 0) = (0::'a)
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. \<And>j. \<lbrakk>0 < j; j < n\<rbrakk> \<Longrightarrow> A $$ (j, 0) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?j; ?j < n\<rbrakk> \<Longrightarrow> A $$ (?j, 0) = (0::'a)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < ?j; ?j < n\<rbrakk> \<Longrightarrow> A $$ (?j, 0) = (0::'a)
[PROOF STEP]
have ada00: "(adjoint A * A)$$(0,0) = conjugate (A$$(0,0)) * A$$(0,0)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?j; ?j < n\<rbrakk> \<Longrightarrow> A $$ (?j, 0) = (0::'a)

goal (1 subgoal):
 1. (adjoint A * A) $$ (0, 0) = conjugate (A $$ (0, 0)) * A $$ (0, 0)
[PROOF STEP]
using asm dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?j; ?j < n\<rbrakk> \<Longrightarrow> A $$ (?j, 0) = (0::'a)
0 < n
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. (adjoint A * A) $$ (0, 0) = conjugate (A $$ (0, 0)) * A $$ (0, 0)
[PROOF STEP]
by (auto simp add: scalar_prod_def adjoint_eval sum.atLeast_Suc_lessThan)
[PROOF STATE]
proof (state)
this:
(adjoint A * A) $$ (0, 0) = conjugate (A $$ (0, 0)) * A $$ (0, 0)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
have aad00: "(A * adjoint A)$$(0,0) = (\<Sum>k=0..<n. A$$(0, k) * conjugate (A$$(0, k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * adjoint A) $$ (0, 0) = (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
[PROOF STEP]
using asm dim
[PROOF STATE]
proof (prove)
using this:
0 < n
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. (A * adjoint A) $$ (0, 0) = (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
[PROOF STEP]
by (auto simp add: scalar_prod_def adjoint_eval)
[PROOF STATE]
proof (state)
this:
(A * adjoint A) $$ (0, 0) = (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k)))

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(A * adjoint A) $$ (0, 0) = (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k)))

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
have
      "\<dots> = A$$(0,0) * conjugate (A$$(0,0))
          + (\<Sum>k=1..<n. A$$(0, k) * conjugate (A$$(0, k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = A $$ (0, 0) * conjugate (A $$ (0, 0)) + (\<Sum>k = 1..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
[PROOF STEP]
using dim asm
[PROOF STATE]
proof (prove)
using this:
dim_row A = n
dim_col A = n
0 < n

goal (1 subgoal):
 1. (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = A $$ (0, 0) * conjugate (A $$ (0, 0)) + (\<Sum>k = 1..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
[PROOF STEP]
by (subst sum.atLeast_Suc_lessThan[of 0 n "\<lambda>k. A$$(0, k) * conjugate (A$$(0, k))"], auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = A $$ (0, 0) * conjugate (A $$ (0, 0)) + (\<Sum>k = 1..<n. A $$ (0, k) * conjugate (A $$ (0, k)))

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(A * adjoint A) $$ (0, 0) = (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
(\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = A $$ (0, 0) * conjugate (A $$ (0, 0)) + (\<Sum>k = 1..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
[PROOF STEP]
have f1tneq0: "(\<Sum>k=(Suc 0)..<n. A$$(0, k) * conjugate (A$$(0, k))) = 0"
[PROOF STATE]
proof (prove)
using this:
(A * adjoint A) $$ (0, 0) = (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
(\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = A $$ (0, 0) * conjugate (A $$ (0, 0)) + (\<Sum>k = 1..<n. A $$ (0, k) * conjugate (A $$ (0, k)))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = (0::'a)
[PROOF STEP]
using eq0 ada00
[PROOF STATE]
proof (prove)
using this:
(A * adjoint A) $$ (0, 0) = (\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
(\<Sum>k = 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = A $$ (0, 0) * conjugate (A $$ (0, 0)) + (\<Sum>k = 1..<n. A $$ (0, k) * conjugate (A $$ (0, k)))
(A * adjoint A) $$ (?i, ?j) = (adjoint A * A) $$ (?i, ?j)
(adjoint A * A) $$ (0, 0) = conjugate (A $$ (0, 0)) * A $$ (0, 0)

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = (0::'a)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..<n. A $$ (0, k) * conjugate (A $$ (0, k))) = (0::'a)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
have geq0: "\<And>k. k < n \<Longrightarrow> A$$(0, k) * conjugate (A$$(0, k)) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k < n \<Longrightarrow> (0::'a) \<le> A $$ (0, k) * conjugate (A $$ (0, k))
[PROOF STEP]
using conjugate_square_positive
[PROOF STATE]
proof (prove)
using this:
(0::?'a) \<le> ?a * conjugate ?a

goal (1 subgoal):
 1. \<And>k. k < n \<Longrightarrow> (0::'a) \<le> A $$ (0, k) * conjugate (A $$ (0, k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < n \<Longrightarrow> (0::'a) \<le> A $$ (0, ?k) * conjugate (A $$ (0, ?k))

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
have "\<And>k. 1 \<le> k \<Longrightarrow> k < n \<Longrightarrow> A$$(0, k) * conjugate (A$$(0, k)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>1 \<le> k; k < n\<rbrakk> \<Longrightarrow> A $$ (0, k) * conjugate (A $$ (0, k)) = (0::'a)
[PROOF STEP]
by (rule sum_nonneg_0[of "{1..<n}"], auto, rule geq0, auto, rule f1tneq0)
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 \<le> ?k; ?k < n\<rbrakk> \<Longrightarrow> A $$ (0, ?k) * conjugate (A $$ (0, ?k)) = (0::'a)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>0 < n; i < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
 2. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 3. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
with dim asm
[PROOF STATE]
proof (chain)
picking this:
dim_row A = n
dim_col A = n
0 < n
\<lbrakk>1 \<le> ?k; ?k < n\<rbrakk> \<Longrightarrow> A $$ (0, ?k) * conjugate (A $$ (0, ?k)) = (0::'a)
[PROOF STEP]
show
      case0: "\<And>j. 0 < n \<Longrightarrow> j < n \<Longrightarrow> 0 \<noteq> j \<Longrightarrow> A $$ (0, j) = 0"
[PROOF STATE]
proof (prove)
using this:
dim_row A = n
dim_col A = n
0 < n
\<lbrakk>1 \<le> ?k; ?k < n\<rbrakk> \<Longrightarrow> A $$ (0, ?k) * conjugate (A $$ (0, ?k)) = (0::'a)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>0 < n; j < n; 0 \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (0, j) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < n; ?j < n; 0 \<noteq> ?j\<rbrakk> \<Longrightarrow> A $$ (0, ?j) = (0::'a)

goal (2 subgoals):
 1. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 2. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < n; ?j < n; 0 \<noteq> ?j\<rbrakk> \<Longrightarrow> A $$ (0, ?j) = (0::'a)

goal (2 subgoals):
 1. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 2. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 2. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
assume asm: "n > 0" "i < n" "i > 0"
        and ih: "\<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = 0"
[PROOF STATE]
proof (state)
this:
0 < n
i < n
0 < i
?k < i \<Longrightarrow> \<forall>j<n. ?k \<noteq> j \<longrightarrow> A $$ (?k, j) = (0::'a)

goal (2 subgoals):
 1. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 2. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n
i < n
0 < i
?k < i \<Longrightarrow> \<forall>j<n. ?k \<noteq> j \<longrightarrow> A $$ (?k, j) = (0::'a)
[PROOF STEP]
have "\<And>j. j<n \<Longrightarrow> i \<noteq> j \<Longrightarrow> A $$ (i, j) = 0"
[PROOF STATE]
proof (prove)
using this:
0 < n
i < n
0 < i
?k < i \<Longrightarrow> \<forall>j<n. ?k \<noteq> j \<longrightarrow> A $$ (?k, j) = (0::'a)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have inter_part: "\<And>b m e. (b::nat) < e \<Longrightarrow> b < m \<Longrightarrow> m < e \<Longrightarrow> {b..<m} \<union> {m..<e} = {b..<e}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b m e. \<lbrakk>b < e; b < m; m < e\<rbrakk> \<Longrightarrow> {b..<m} \<union> {m..<e} = {b..<e}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?b < ?e; ?b < ?m; ?m < ?e\<rbrakk> \<Longrightarrow> {?b..<?m} \<union> {?m..<?e} = {?b..<?e}

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?b < ?e; ?b < ?m; ?m < ?e\<rbrakk> \<Longrightarrow> {?b..<?m} \<union> {?m..<?e} = {?b..<?e}
[PROOF STEP]
have
          "\<And>b m e f. (b::nat) < e \<Longrightarrow> b < m \<Longrightarrow> m < e
            \<Longrightarrow> (\<Sum>k=b..<e. f k) = (\<Sum>k\<in>{b..<m}\<union>{m..<e}. f k)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?b < ?e; ?b < ?m; ?m < ?e\<rbrakk> \<Longrightarrow> {?b..<?m} \<union> {?m..<?e} = {?b..<?e}

goal (1 subgoal):
 1. \<And>b m e f. \<lbrakk>b < e; b < m; m < e\<rbrakk> \<Longrightarrow> sum f {b..<e} = sum f ({b..<m} \<union> {m..<e})
[PROOF STEP]
using sum.union_disjoint
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?b < ?e; ?b < ?m; ?m < ?e\<rbrakk> \<Longrightarrow> {?b..<?m} \<union> {?m..<?e} = {?b..<?e}
\<lbrakk>finite ?A; finite ?B; ?A \<inter> ?B = {}\<rbrakk> \<Longrightarrow> sum ?g (?A \<union> ?B) = sum ?g ?A + sum ?g ?B

goal (1 subgoal):
 1. \<And>b m e f. \<lbrakk>b < e; b < m; m < e\<rbrakk> \<Longrightarrow> sum f {b..<e} = sum f ({b..<m} \<union> {m..<e})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?b < ?e; ?b < ?m; ?m < ?e\<rbrakk> \<Longrightarrow> sum ?f {?b..<?e} = sum ?f ({?b..<?m} \<union> {?m..<?e})

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?b < ?e; ?b < ?m; ?m < ?e\<rbrakk> \<Longrightarrow> sum ?f {?b..<?e} = sum ?f ({?b..<?m} \<union> {?m..<?e})
[PROOF STEP]
have sum_part:
          "\<And>b m e f. (b::nat) < e \<Longrightarrow> b < m \<Longrightarrow> m < e
                      \<Longrightarrow> (\<Sum>k=b..<e. f k) = (\<Sum>k=b..<m. f k) + (\<Sum>k=m..<e. f k)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?b < ?e; ?b < ?m; ?m < ?e\<rbrakk> \<Longrightarrow> sum ?f {?b..<?e} = sum ?f ({?b..<?m} \<union> {?m..<?e})

goal (1 subgoal):
 1. \<And>b m e f. \<lbrakk>b < e; b < m; m < e\<rbrakk> \<Longrightarrow> sum f {b..<e} = sum f {b..<m} + sum f {m..<e}
[PROOF STEP]
by (auto simp add: sum.union_disjoint)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?b1 < ?e1; ?b1 < ?m1; ?m1 < ?e1\<rbrakk> \<Longrightarrow> sum ?f1 {?b1..<?e1} = sum ?f1 {?b1..<?m1} + sum ?f1 {?m1..<?e1}

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
from tri upper_triangularD[of A j i] asm dim
[PROOF STATE]
proof (chain)
picking this:
upper_triangular A
\<lbrakk>upper_triangular A; j < i; i < dim_row A\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
0 < n
i < n
0 < i
dim_row A = n
dim_col A = n
[PROOF STEP]
have
            zsi0: "\<And>j. j < i \<Longrightarrow> A$$(i, j) = 0"
[PROOF STATE]
proof (prove)
using this:
upper_triangular A
\<lbrakk>upper_triangular A; j < i; i < dim_row A\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
0 < n
i < n
0 < i
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?j2 < i \<Longrightarrow> A $$ (i, ?j2) = (0::'a)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
from tri upper_triangularD[of A j i] asm dim
[PROOF STATE]
proof (chain)
picking this:
upper_triangular A
\<lbrakk>upper_triangular A; j < i; i < dim_row A\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
0 < n
i < n
0 < i
dim_row A = n
dim_col A = n
[PROOF STEP]
have
            zsi1: "\<And>k. i < k \<Longrightarrow> k < n \<Longrightarrow> A$$(k, i) = 0"
[PROOF STATE]
proof (prove)
using this:
upper_triangular A
\<lbrakk>upper_triangular A; j < i; i < dim_row A\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
0 < n
i < n
0 < i
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. \<And>k. \<lbrakk>i < k; k < n\<rbrakk> \<Longrightarrow> A $$ (k, i) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>i < ?k2; ?k2 < n\<rbrakk> \<Longrightarrow> A $$ (?k2, i) = (0::'a)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have
          "(A * adjoint A)$$(i, i)
          = (\<Sum>k=0..<n. conjugate (A$$(i, k)) * A$$(i, k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * adjoint A) $$ (i, i) = (\<Sum>k = 0..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
using asm dim
[PROOF STATE]
proof (prove)
using this:
0 < n
i < n
0 < i
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. (A * adjoint A) $$ (i, i) = (\<Sum>k = 0..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
apply (auto simp add: scalar_prod_def adjoint_eval)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row A; 0 < i; dim_col A = dim_row A; n = dim_row A\<rbrakk> \<Longrightarrow> (\<Sum>ia = 0..<dim_row A. A $$ (i, ia) * conjugate (A $$ (i, ia))) = (\<Sum>k = 0..<dim_row A. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
apply (rule sum.cong, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(A * adjoint A) $$ (i, i) = (\<Sum>k = 0..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A * adjoint A) $$ (i, i) = (\<Sum>k = 0..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have
          "\<dots> = (\<Sum>k=0..<i. conjugate (A$$(i, k)) * A$$(i, k))
              + (\<Sum>k=i..<n. conjugate (A$$(i, k)) * A$$(i, k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (\<Sum>k = 0..<i. conjugate (A $$ (i, k)) * A $$ (i, k)) + (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
0 < n
i < n
0 < i

goal (1 subgoal):
 1. (\<Sum>k = 0..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (\<Sum>k = 0..<i. conjugate (A $$ (i, k)) * A $$ (i, k)) + (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
by (auto simp add: sum_part[of 0 n i])
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (\<Sum>k = 0..<i. conjugate (A $$ (i, k)) * A $$ (i, k)) + (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (\<Sum>k = 0..<i. conjugate (A $$ (i, k)) * A $$ (i, k)) + (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have
          "\<dots> = (\<Sum>k=i..<n. conjugate (A$$(i, k)) * A$$(i, k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<i. conjugate (A $$ (i, k)) * A $$ (i, k)) + (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
using zsi0
[PROOF STATE]
proof (prove)
using this:
?j2 < i \<Longrightarrow> A $$ (i, ?j2) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>k = 0..<i. conjugate (A $$ (i, k)) * A $$ (i, k)) + (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<i. conjugate (A $$ (i, k)) * A $$ (i, k)) + (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<i. conjugate (A $$ (i, k)) * A $$ (i, k)) + (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have
          "\<dots> = conjugate (A$$(i, i)) * A$$(i, i)
            + (\<Sum>k=(Suc i)..<n. conjugate (A$$(i, k)) * A$$(i, k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
0 < n
i < n
0 < i

goal (1 subgoal):
 1. (\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
by (auto simp add: sum.atLeast_Suc_lessThan)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(A * adjoint A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
have
          adaii: "(A * adjoint A)$$(i, i)
            = conjugate (A$$(i, i)) * A$$(i, i)
            + (\<Sum>k=(Suc i)..<n. conjugate (A$$(i, k)) * A$$(i, k))"
[PROOF STATE]
proof (prove)
using this:
(A * adjoint A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. (A * adjoint A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(A * adjoint A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have
          "(adjoint A * A)$$(i, i) = (\<Sum>k=0..<n. conjugate (A$$(k, i)) * A$$(k, i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (adjoint A * A) $$ (i, i) = (\<Sum>k = 0..<n. conjugate (A $$ (k, i)) * A $$ (k, i))
[PROOF STEP]
using asm dim
[PROOF STATE]
proof (prove)
using this:
0 < n
i < n
0 < i
dim_row A = n
dim_col A = n

goal (1 subgoal):
 1. (adjoint A * A) $$ (i, i) = (\<Sum>k = 0..<n. conjugate (A $$ (k, i)) * A $$ (k, i))
[PROOF STEP]
by (auto simp add: scalar_prod_def adjoint_eval)
[PROOF STATE]
proof (state)
this:
(adjoint A * A) $$ (i, i) = (\<Sum>k = 0..<n. conjugate (A $$ (k, i)) * A $$ (k, i))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(adjoint A * A) $$ (i, i) = (\<Sum>k = 0..<n. conjugate (A $$ (k, i)) * A $$ (k, i))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have
          "\<dots> = (\<Sum>k=0..<i. conjugate (A$$(k, i)) * A$$(k, i))
              + (\<Sum>k=i..<n. conjugate (A$$(k, i)) * A$$(k, i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = (\<Sum>k = 0..<i. conjugate (A $$ (k, i)) * A $$ (k, i)) + (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i))
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
0 < n
i < n
0 < i

goal (1 subgoal):
 1. (\<Sum>k = 0..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = (\<Sum>k = 0..<i. conjugate (A $$ (k, i)) * A $$ (k, i)) + (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i))
[PROOF STEP]
by (auto simp add: sum_part[of 0 n i])
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = (\<Sum>k = 0..<i. conjugate (A $$ (k, i)) * A $$ (k, i)) + (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = (\<Sum>k = 0..<i. conjugate (A $$ (k, i)) * A $$ (k, i)) + (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have
            "\<dots> = (\<Sum>k=i..<n. conjugate (A$$(k, i)) * A$$(k, i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<i. conjugate (A $$ (k, i)) * A $$ (k, i)) + (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i))
[PROOF STEP]
using asm ih
[PROOF STATE]
proof (prove)
using this:
0 < n
i < n
0 < i
?k < i \<Longrightarrow> \<forall>j<n. ?k \<noteq> j \<longrightarrow> A $$ (?k, j) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>k = 0..<i. conjugate (A $$ (k, i)) * A $$ (k, i)) + (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<i. conjugate (A $$ (k, i)) * A $$ (k, i)) + (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<i. conjugate (A $$ (k, i)) * A $$ (k, i)) + (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have
            "\<dots> = conjugate (A$$(i, i)) * A$$(i, i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = conjugate (A $$ (i, i)) * A $$ (i, i)
[PROOF STEP]
using asm zsi1
[PROOF STATE]
proof (prove)
using this:
0 < n
i < n
0 < i
\<lbrakk>i < ?k2; ?k2 < n\<rbrakk> \<Longrightarrow> A $$ (?k2, i) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = conjugate (A $$ (i, i)) * A $$ (i, i)
[PROOF STEP]
by (auto simp add: sum.atLeast_Suc_lessThan)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = i..<n. conjugate (A $$ (k, i)) * A $$ (k, i)) = conjugate (A $$ (i, i)) * A $$ (i, i)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(adjoint A * A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i)
[PROOF STEP]
have "(adjoint A * A)$$(i, i) = conjugate (A$$(i, i)) * A$$(i, i)"
[PROOF STATE]
proof (prove)
using this:
(adjoint A * A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i)

goal (1 subgoal):
 1. (adjoint A * A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(adjoint A * A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
with adaii eq0
[PROOF STATE]
proof (chain)
picking this:
(A * adjoint A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
(A * adjoint A) $$ (?i, ?j) = (adjoint A * A) $$ (?i, ?j)
(adjoint A * A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i)
[PROOF STEP]
have
          fsitoneq0: "(\<Sum>k=(Suc i)..<n. conjugate (A$$(i, k)) * A$$(i, k)) = 0"
[PROOF STATE]
proof (prove)
using this:
(A * adjoint A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i) + (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k))
(A * adjoint A) $$ (?i, ?j) = (adjoint A * A) $$ (?i, ?j)
(adjoint A * A) $$ (i, i) = conjugate (A $$ (i, i)) * A $$ (i, i)

goal (1 subgoal):
 1. (\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc i..<n. conjugate (A $$ (i, k)) * A $$ (i, k)) = (0::'a)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
have "\<And>k. k<n \<Longrightarrow> i < k \<Longrightarrow> conjugate (A$$(i, k)) * A$$(i, k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n; i < k\<rbrakk> \<Longrightarrow> conjugate (A $$ (i, k)) * A $$ (i, k) = (0::'a)
[PROOF STEP]
by (rule sum_nonneg_0[of "{(Suc i)..<n}"], auto, subst mult.commute,
              rule conjugate_square_positive, rule fsitoneq0)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?k2 < n; i < ?k2\<rbrakk> \<Longrightarrow> conjugate (A $$ (i, ?k2)) * A $$ (i, ?k2) = (0::'a)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?k2 < n; i < ?k2\<rbrakk> \<Longrightarrow> conjugate (A $$ (i, ?k2)) * A $$ (i, ?k2) = (0::'a)
[PROOF STEP]
have "\<And>k. k<n  \<Longrightarrow> i<k \<Longrightarrow> A $$ (i, k) = 0"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?k2 < n; i < ?k2\<rbrakk> \<Longrightarrow> conjugate (A $$ (i, ?k2)) * A $$ (i, ?k2) = (0::'a)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n; i < k\<rbrakk> \<Longrightarrow> A $$ (i, k) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?k2 < n; i < ?k2\<rbrakk> \<Longrightarrow> A $$ (i, ?k2) = (0::'a)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j; 0 < n; i < n; 0 < i; \<And>k. k < i \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
with zsi0
[PROOF STATE]
proof (chain)
picking this:
?j2 < i \<Longrightarrow> A $$ (i, ?j2) = (0::'a)
\<lbrakk>?k2 < n; i < ?k2\<rbrakk> \<Longrightarrow> A $$ (i, ?k2) = (0::'a)
[PROOF STEP]
show "\<And>j. j<n \<Longrightarrow> i \<noteq> j \<Longrightarrow> A $$ (i, j) = 0"
[PROOF STATE]
proof (prove)
using this:
?j2 < i \<Longrightarrow> A $$ (i, ?j2) = (0::'a)
\<lbrakk>?k2 < n; i < ?k2\<rbrakk> \<Longrightarrow> A $$ (i, ?k2) = (0::'a)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; i \<noteq> j\<rbrakk> \<Longrightarrow> A $$ (i, j) = (0::'a)
[PROOF STEP]
by (metis linorder_neqE_nat)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?j2 < n; i \<noteq> ?j2\<rbrakk> \<Longrightarrow> A $$ (i, ?j2) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?j < n; i \<noteq> ?j\<rbrakk> \<Longrightarrow> A $$ (i, ?j) = (0::'a)

goal (2 subgoals):
 1. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 2. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < n; ?i3 < n; 0 < ?i3; \<And>k. k < ?i3 \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a); ?j < n; ?i3 \<noteq> ?j\<rbrakk> \<Longrightarrow> A $$ (?i3, ?j) = (0::'a)

goal (2 subgoals):
 1. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
 2. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
with case0
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < n; ?j < n; 0 \<noteq> ?j\<rbrakk> \<Longrightarrow> A $$ (0, ?j) = (0::'a)
\<lbrakk>0 < n; ?i3 < n; 0 < ?i3; \<And>k. k < ?i3 \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a); ?j < n; ?i3 \<noteq> ?j\<rbrakk> \<Longrightarrow> A $$ (?i3, ?j) = (0::'a)
[PROOF STEP]
show "\<And>i ia.
       0 < n \<Longrightarrow>
       i < n \<Longrightarrow>
       ia < n \<Longrightarrow>
       (\<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = 0) \<Longrightarrow>
       \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = 0"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < n; ?j < n; 0 \<noteq> ?j\<rbrakk> \<Longrightarrow> A $$ (0, ?j) = (0::'a)
\<lbrakk>0 < n; ?i3 < n; 0 < ?i3; \<And>k. k < ?i3 \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a); ?j < n; ?i3 \<noteq> ?j\<rbrakk> \<Longrightarrow> A $$ (?i3, ?j) = (0::'a)

goal (1 subgoal):
 1. \<And>i ia. \<lbrakk>0 < n; i < n; ia < n; \<And>k. k < ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ia \<noteq> j \<longrightarrow> A $$ (ia, j) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < n; ?i < n; ?ia < n; \<And>k. k < ?ia \<Longrightarrow> \<forall>j<n. k \<noteq> j \<longrightarrow> A $$ (k, j) = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>j<n. ?ia \<noteq> j \<longrightarrow> A $$ (?ia, j) = (0::'a)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>0 < n; i < n\<rbrakk> \<Longrightarrow> i < n
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < n \<Longrightarrow> diagonal_mat A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ent_conjE2: "\<lbrakk>B\<Longrightarrow>\<^sub>AC\<rbrakk> \<Longrightarrow> A\<and>\<^sub>AB\<Longrightarrow>\<^sub>AC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<Longrightarrow>\<^sub>A C \<Longrightarrow> A \<and>\<^sub>A B \<Longrightarrow>\<^sub>A C
[PROOF STEP]
unfolding entails_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>h. h \<Turnstile> B \<longrightarrow> h \<Turnstile> C \<Longrightarrow> \<forall>h. h \<Turnstile> A \<and>\<^sub>A B \<longrightarrow> h \<Turnstile> C
[PROOF STEP]
by (auto simp: mod_and_dist)


[STATEMENT]
lemma borel_measurable_continuous_Pair:
  fixes f :: "'a \<Rightarrow> 'b::second_countable_topology" and g :: "'a \<Rightarrow> 'c::second_countable_topology"
  assumes [measurable]: "f \<in> borel_measurable M"
  assumes [measurable]: "g \<in> borel_measurable M"
  assumes H: "continuous_on UNIV (\<lambda>x. H (fst x) (snd x))"
  shows "(\<lambda>x. H (f x) (g x)) \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. H (f x) (g x)) \<in> borel_measurable M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. H (f x) (g x)) \<in> borel_measurable M
[PROOF STEP]
have eq: "(\<lambda>x. H (f x) (g x)) = (\<lambda>x. (\<lambda>x. H (fst x) (snd x)) (f x, g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. H (f x) (g x)) = (\<lambda>x. H (fst (f x, g x)) (snd (f x, g x)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. H (f x) (g x)) = (\<lambda>x. H (fst (f x, g x)) (snd (f x, g x)))

goal (1 subgoal):
 1. (\<lambda>x. H (f x) (g x)) \<in> borel_measurable M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. H (f x) (g x)) \<in> borel_measurable M
[PROOF STEP]
unfolding eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. H (fst (f x, g x)) (snd (f x, g x))) \<in> borel_measurable M
[PROOF STEP]
by (rule borel_measurable_continuous_on[OF H]) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. H (f x) (g x)) \<in> borel_measurable M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma takeAllSubset:
  "set (takeAll (%x. x\<in> P) list) \<subseteq> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (takeAll (\<lambda>x. x \<in> P) list) \<subseteq> P
[PROOF STEP]
by (metis Int_subset_iff listIntersectionWithSet)


[STATEMENT]
lemma sum_list_list_of_pdevs: "sum_list (map snd (list_of_pdevs x)) = sum_list (dense_list_of_pdevs x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map snd (list_of_pdevs x)) = sum_list (dense_list_of_pdevs x)
[PROOF STEP]
by (auto intro!: sum.mono_neutral_cong_left
    simp add: degree_gt sum_list_distinct_conv_sum_set dense_list_of_pdevs_def list_of_pdevs_def)


[STATEMENT]
lemma mset_merge:
  "mset (merge xs ys) = mset xs + mset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (merge xs ys) = mset xs + mset ys
[PROOF STEP]
by (induction xs ys rule: merge.induct) simp_all


[STATEMENT]
lemma arith_is_1:
  "\<lbrakk> x \<le> Suc 0; x > 0 \<rbrakk> \<Longrightarrow> x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> Suc 0; 0 < x\<rbrakk> \<Longrightarrow> x = 1
[PROOF STEP]
by arith


[STATEMENT]
lemma dvd_PM_iff: "p dvd q \<longleftrightarrow> divides_ff (content_ff_ff p) (content_ff_ff q) \<and>
  map_poly to_fract p dvd map_poly to_fract q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p dvd q) = (divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p dvd q) = (divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q)
[PROOF STEP]
interpret map_poly_inj_idom_hom to_fract
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly_inj_idom_hom to_fract
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p dvd q) = (divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q)
[PROOF STEP]
let ?E = "map_poly to_fract"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p dvd q) = (divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q)
[PROOF STEP]
show ?thesis (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p dvd q) = (divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p dvd q \<Longrightarrow> divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
 2. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
assume "p dvd q"
[PROOF STATE]
proof (state)
this:
p dvd q

goal (2 subgoals):
 1. p dvd q \<Longrightarrow> divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
 2. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd q
[PROOF STEP]
obtain r where qpr: "q = p * r"
[PROOF STATE]
proof (prove)
using this:
p dvd q

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

goal (2 subgoals):
 1. p dvd q \<Longrightarrow> divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
 2. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
from arg_cong[OF this, of ?E]
[PROOF STATE]
proof (chain)
picking this:
map_poly to_fract q = map_poly to_fract (p * r)
[PROOF STEP]
have dvd: "?E p dvd ?E q"
[PROOF STATE]
proof (prove)
using this:
map_poly to_fract q = map_poly to_fract (p * r)

goal (1 subgoal):
 1. map_poly to_fract p dvd map_poly to_fract q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map_poly to_fract p dvd map_poly to_fract q

goal (2 subgoals):
 1. p dvd q \<Longrightarrow> divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
 2. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
from content_ff_map_poly_to_fract
[PROOF STATE]
proof (chain)
picking this:
content_ff (map_poly to_fract ?p) \<in> range to_fract
[PROOF STEP]
obtain cq where cq: "content_ff_ff q = to_fract cq"
[PROOF STATE]
proof (prove)
using this:
content_ff (map_poly to_fract ?p) \<in> range to_fract

goal (1 subgoal):
 1. (\<And>cq. content_ff (map_poly to_fract q) = to_fract cq \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
content_ff (map_poly to_fract q) = to_fract cq

goal (2 subgoals):
 1. p dvd q \<Longrightarrow> divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
 2. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
from content_ff_map_poly_to_fract
[PROOF STATE]
proof (chain)
picking this:
content_ff (map_poly to_fract ?p) \<in> range to_fract
[PROOF STEP]
obtain cp where cp: "content_ff_ff p = to_fract cp"
[PROOF STATE]
proof (prove)
using this:
content_ff (map_poly to_fract ?p) \<in> range to_fract

goal (1 subgoal):
 1. (\<And>cp. content_ff (map_poly to_fract p) = to_fract cp \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
content_ff (map_poly to_fract p) = to_fract cp

goal (2 subgoals):
 1. p dvd q \<Longrightarrow> divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
 2. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
from content_ff_map_poly_to_fract
[PROOF STATE]
proof (chain)
picking this:
content_ff (map_poly to_fract ?p) \<in> range to_fract
[PROOF STEP]
obtain cr where cr: "content_ff_ff r = to_fract cr"
[PROOF STATE]
proof (prove)
using this:
content_ff (map_poly to_fract ?p) \<in> range to_fract

goal (1 subgoal):
 1. (\<And>cr. content_ff (map_poly to_fract r) = to_fract cr \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
content_ff (map_poly to_fract r) = to_fract cr

goal (2 subgoals):
 1. p dvd q \<Longrightarrow> divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
 2. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
from gauss_lemma[of "?E p" "?E r", folded hom_distribs qpr, unfolded cq cp cr]
[PROOF STATE]
proof (chain)
picking this:
to_fract cq =dff to_fract cp * to_fract cr
[PROOF STEP]
have "divides_ff (content_ff_ff p) (content_ff_ff q)"
[PROOF STATE]
proof (prove)
using this:
to_fract cq =dff to_fract cp * to_fract cr

goal (1 subgoal):
 1. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q))
[PROOF STEP]
unfolding cq cp eq_dff_def
[PROOF STATE]
proof (prove)
using this:
divides_ff (to_fract cq) (to_fract cp * to_fract cr) \<and> divides_ff (to_fract cp * to_fract cr) (to_fract cq)

goal (1 subgoal):
 1. divides_ff (to_fract cp) (to_fract cq)
[PROOF STEP]
by (metis divides_ff_def divides_ff_trans)
[PROOF STATE]
proof (state)
this:
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q))

goal (2 subgoals):
 1. p dvd q \<Longrightarrow> divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
 2. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
with dvd
[PROOF STATE]
proof (chain)
picking this:
map_poly to_fract p dvd map_poly to_fract q
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q))
[PROOF STEP]
show ?r
[PROOF STATE]
proof (prove)
using this:
map_poly to_fract p dvd map_poly to_fract q
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q))

goal (1 subgoal):
 1. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q

goal (1 subgoal):
 1. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
assume ?r
[PROOF STATE]
proof (state)
this:
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q

goal (1 subgoal):
 1. divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q \<Longrightarrow> p dvd q
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd q
[PROOF STEP]
proof (cases "q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q = 0 \<Longrightarrow> p dvd q
 2. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
q = 0

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> p dvd q
 2. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
with \<open>?r\<close>
[PROOF STATE]
proof (chain)
picking this:
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
q = 0
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
using this:
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
q = 0

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

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

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
note q = this
[PROOF STATE]
proof (state)
this:
q \<noteq> 0

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
hence q': "?E q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0

goal (1 subgoal):
 1. map_poly to_fract q \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map_poly to_fract q \<noteq> 0

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
from \<open>?r\<close>
[PROOF STATE]
proof (chain)
picking this:
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q
[PROOF STEP]
obtain rr where qpr: "?E q = ?E p * rr"
[PROOF STATE]
proof (prove)
using this:
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q

goal (1 subgoal):
 1. (\<And>rr. map_poly to_fract q = map_poly to_fract p * rr \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> (\<exists>k. map_poly to_fract q = map_poly to_fract p * k)

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

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
with q
[PROOF STATE]
proof (chain)
picking this:
q \<noteq> 0
map_poly to_fract q = map_poly to_fract p * rr
[PROOF STEP]
have p: "p \<noteq> 0" and Ep: "?E p \<noteq> 0" and rr: "rr \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0
map_poly to_fract q = map_poly to_fract p * rr

goal (1 subgoal):
 1. p \<noteq> 0 &&& map_poly to_fract p \<noteq> 0 &&& rr \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0
map_poly to_fract p \<noteq> 0
rr \<noteq> 0

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
from gauss_lemma[of "?E p" rr, folded qpr]
[PROOF STATE]
proof (chain)
picking this:
content_ff (map_poly to_fract q) =dff content_ff (map_poly to_fract p) * content_ff rr
[PROOF STEP]
have ct: "content_ff_ff q =dff content_ff_ff p * content_ff rr"
[PROOF STATE]
proof (prove)
using this:
content_ff (map_poly to_fract q) =dff content_ff (map_poly to_fract p) * content_ff rr

goal (1 subgoal):
 1. content_ff (map_poly to_fract q) =dff content_ff (map_poly to_fract p) * content_ff rr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
content_ff (map_poly to_fract q) =dff content_ff (map_poly to_fract p) * content_ff rr

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
from content_ff_map_poly_to_fract[of p]
[PROOF STATE]
proof (chain)
picking this:
content_ff (map_poly to_fract p) \<in> range to_fract
[PROOF STEP]
obtain cp where cp: "content_ff_ff p = to_fract cp"
[PROOF STATE]
proof (prove)
using this:
content_ff (map_poly to_fract p) \<in> range to_fract

goal (1 subgoal):
 1. (\<And>cp. content_ff (map_poly to_fract p) = to_fract cp \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
content_ff (map_poly to_fract p) = to_fract cp

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
from content_ff_map_poly_to_fract[of q]
[PROOF STATE]
proof (chain)
picking this:
content_ff (map_poly to_fract q) \<in> range to_fract
[PROOF STEP]
obtain cq where cq: "content_ff_ff q = to_fract cq"
[PROOF STATE]
proof (prove)
using this:
content_ff (map_poly to_fract q) \<in> range to_fract

goal (1 subgoal):
 1. (\<And>cq. content_ff (map_poly to_fract q) = to_fract cq \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
content_ff (map_poly to_fract q) = to_fract cq

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
from \<open>?r\<close>[unfolded cp cq]
[PROOF STATE]
proof (chain)
picking this:
divides_ff (to_fract cp) (to_fract cq) \<and> map_poly to_fract p dvd map_poly to_fract q
[PROOF STEP]
have "divides_ff (to_fract cp) (to_fract cq)"
[PROOF STATE]
proof (prove)
using this:
divides_ff (to_fract cp) (to_fract cq) \<and> map_poly to_fract p dvd map_poly to_fract q

goal (1 subgoal):
 1. divides_ff (to_fract cp) (to_fract cq)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
divides_ff (to_fract cp) (to_fract cq)

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
with ct[unfolded cp cq eq_dff_def]
[PROOF STATE]
proof (chain)
picking this:
divides_ff (to_fract cq) (to_fract cp * content_ff rr) \<and> divides_ff (to_fract cp * content_ff rr) (to_fract cq)
divides_ff (to_fract cp) (to_fract cq)
[PROOF STEP]
have "content_ff rr \<in> range to_fract"
[PROOF STATE]
proof (prove)
using this:
divides_ff (to_fract cq) (to_fract cp * content_ff rr) \<and> divides_ff (to_fract cp * content_ff rr) (to_fract cq)
divides_ff (to_fract cp) (to_fract cq)

goal (1 subgoal):
 1. content_ff rr \<in> range to_fract
[PROOF STEP]
by (metis (no_types, lifting) Ep content_ff_0_iff cp divides_ff_def
          divides_ff_trans mult.commute mult_right_cancel range_eqI)
[PROOF STATE]
proof (state)
this:
content_ff rr \<in> range to_fract

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
from range_to_fract_embed_poly[OF content_ff_to_fract_coeffs_to_fract[OF this]]
[PROOF STATE]
proof (chain)
picking this:
rr = map_poly to_fract (map_poly inv_embed rr)
[PROOF STEP]
obtain r
        where rr: "rr = ?E r"
[PROOF STATE]
proof (prove)
using this:
rr = map_poly to_fract (map_poly inv_embed rr)

goal (1 subgoal):
 1. (\<And>r. rr = map_poly to_fract r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rr = map_poly to_fract r

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
from qpr[unfolded rr, folded hom_distribs]
[PROOF STATE]
proof (chain)
picking this:
map_poly to_fract q = map_poly to_fract (p * r)
[PROOF STEP]
have "q = p * r"
[PROOF STATE]
proof (prove)
using this:
map_poly to_fract q = map_poly to_fract (p * r)

goal (1 subgoal):
 1. q = p * r
[PROOF STEP]
by (rule injectivity)
[PROOF STATE]
proof (state)
this:
q = p * r

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> p dvd q
[PROOF STEP]
thus "p dvd q"
[PROOF STATE]
proof (prove)
using this:
q = p * r

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

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(p dvd q) = (divides_ff (content_ff (map_poly to_fract p)) (content_ff (map_poly to_fract q)) \<and> map_poly to_fract p dvd map_poly to_fract q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dist_triangle_lt: "dist x z + dist y z < e \<Longrightarrow> dist x y < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x z + dist y z < e \<Longrightarrow> dist x y < e
[PROOF STEP]
by (rule le_less_trans [OF dist_triangle2])


[STATEMENT]
lemma rep_list_monom_mult: "rep_list (monom_mult c t r) = punit.monom_mult c t (rep_list r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rep_list (monom_mult c t r) = local.punit.monom_mult c t (rep_list r)
[PROOF STEP]
unfolding mult_scalar_monomial[symmetric] times_monomial_left[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rep_list (monomial c t \<odot> r) = monomial c t * rep_list r
[PROOF STEP]
by (rule rep_list_mult_scalar)


[STATEMENT]
lemma Suc_length_conv_snoc: "(Suc n = length xs) = (\<exists>y ys. xs = ys @ [y] \<and> length ys = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc n = length xs) = (\<exists>y ys. xs = ys @ [y] \<and> length ys = n)
[PROOF STEP]
by (cases xs rule: rev_cases) auto


[STATEMENT]
lemma therm_dyn_up_real_arith:
  assumes "a > 0" and Thyps: "Tmin \<le> T" "T \<le> Tmax" "Tmax < (L::real)"
    and thyps: "0 \<le> \<tau>" "\<forall>\<tau>\<in>{0..\<tau>}. \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a) "
  shows "L - Tmax \<le> exp (-(a * \<tau>)) * (L - T)"
    and "L - exp (-(a * \<tau>)) * (L - T) \<le> Tmax"
    and "Tmin \<le> L - exp (-(a * \<tau>)) * (L - T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) &&& L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax &&& Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
have "0 \<le> \<tau> \<and> \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<tau> \<and> \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a)
[PROOF STEP]
using thyps
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau>
\<forall>\<tau>\<in>{0..\<tau>}. \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a)

goal (1 subgoal):
 1. 0 \<le> \<tau> \<and> \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> \<tau> \<and> \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a)

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
hence "ln ((L - Tmax) / (L - T)) \<le> - a * \<tau> \<and> - a * \<tau> \<le> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau> \<and> \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a)

goal (1 subgoal):
 1. ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
[PROOF STEP]
using assms(1) divide_le_cancel
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau> \<and> \<tau> \<le> - (ln ((L - Tmax) / (L - T)) / a)
0 < a
(?a / ?c \<le> ?b / ?c) = (((0::?'a) < ?c \<longrightarrow> ?a \<le> ?b) \<and> (?c < (0::?'a) \<longrightarrow> ?b \<le> ?a))

goal (1 subgoal):
 1. ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
have "(L - Tmax) / (L - T) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (L - Tmax) / (L - T)
[PROOF STEP]
using Thyps
[PROOF STATE]
proof (prove)
using this:
Tmin \<le> T
T \<le> Tmax
Tmax < L

goal (1 subgoal):
 1. 0 < (L - Tmax) / (L - T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < (L - Tmax) / (L - T)

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
0 < (L - Tmax) / (L - T)
[PROOF STEP]
have "(L - Tmax) / (L - T) \<le> exp (-a * \<tau>) \<and> exp (-a * \<tau>) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
0 < (L - Tmax) / (L - T)

goal (1 subgoal):
 1. (L - Tmax) / (L - T) \<le> exp (- a \<cdot> \<tau>) \<and> exp (- a \<cdot> \<tau>) \<le> 1
[PROOF STEP]
using exp_ln exp_le_one_iff
[PROOF STATE]
proof (prove)
using this:
ln ((L - Tmax) / (L - T)) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
0 < (L - Tmax) / (L - T)
0 < ?x \<Longrightarrow> exp (ln ?x) = ?x
(exp ?x \<le> 1) = (?x \<le> 0)

goal (1 subgoal):
 1. (L - Tmax) / (L - T) \<le> exp (- a \<cdot> \<tau>) \<and> exp (- a \<cdot> \<tau>) \<le> 1
[PROOF STEP]
by (metis exp_less_cancel_iff not_less)
[PROOF STATE]
proof (state)
this:
(L - Tmax) / (L - T) \<le> exp (- a \<cdot> \<tau>) \<and> exp (- a \<cdot> \<tau>) \<le> 1

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(L - Tmax) / (L - T) \<le> exp (- a \<cdot> \<tau>) \<and> exp (- a \<cdot> \<tau>) \<le> 1

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
have "L - T > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < L - T
[PROOF STEP]
using Thyps
[PROOF STATE]
proof (prove)
using this:
Tmin \<le> T
T \<le> Tmax
Tmax < L

goal (1 subgoal):
 1. 0 < L - T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < L - T

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(L - Tmax) / (L - T) \<le> exp (- a \<cdot> \<tau>) \<and> exp (- a \<cdot> \<tau>) \<le> 1
0 < L - T
[PROOF STEP]
have obs: "(L - Tmax) \<le> exp (-a * \<tau>) * (L - T) \<and> exp (-a * \<tau>) * (L - T) \<le> (L - T)"
[PROOF STATE]
proof (prove)
using this:
(L - Tmax) / (L - T) \<le> exp (- a \<cdot> \<tau>) \<and> exp (- a \<cdot> \<tau>) \<le> 1
0 < L - T

goal (1 subgoal):
 1. L - Tmax \<le> exp (- a \<cdot> \<tau>) \<cdot> (L - T) \<and> exp (- a \<cdot> \<tau>) \<cdot> (L - T) \<le> L - T
[PROOF STEP]
by (simp add: pos_divide_le_eq)
[PROOF STATE]
proof (state)
this:
L - Tmax \<le> exp (- a \<cdot> \<tau>) \<cdot> (L - T) \<and> exp (- a \<cdot> \<tau>) \<cdot> (L - T) \<le> L - T

goal (3 subgoals):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
 2. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 3. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
thus "(L - Tmax) \<le> exp (-(a * \<tau>)) * (L - T)"
[PROOF STATE]
proof (prove)
using this:
L - Tmax \<le> exp (- a \<cdot> \<tau>) \<cdot> (L - T) \<and> exp (- a \<cdot> \<tau>) \<cdot> (L - T) \<le> L - T

goal (1 subgoal):
 1. L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)

goal (2 subgoals):
 1. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
 2. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
thus "L - exp (-(a * \<tau>)) * (L - T) \<le> Tmax"
[PROOF STATE]
proof (prove)
using this:
L - Tmax \<le> exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)

goal (1 subgoal):
 1. L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T) \<le> Tmax

goal (1 subgoal):
 1. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
show "Tmin \<le> L - exp (-(a * \<tau>)) * (L - T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
using Thyps and obs
[PROOF STATE]
proof (prove)
using this:
Tmin \<le> T
T \<le> Tmax
Tmax < L
L - Tmax \<le> exp (- a \<cdot> \<tau>) \<cdot> (L - T) \<and> exp (- a \<cdot> \<tau>) \<cdot> (L - T) \<le> L - T

goal (1 subgoal):
 1. Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Tmin \<le> L - exp (- (a \<cdot> \<tau>)) \<cdot> (L - T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in finite_measure) finite_measure_UNION:
  assumes A: "range A \<subseteq> sets M" "disjoint_family A"
  shows "(\<lambda>i. measure M (A i)) sums (measure M (\<Union>i. A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. Sigma_Algebra.measure M (A i)) sums Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
using measure_UNION[OF A]
[PROOF STATE]
proof (prove)
using this:
emeasure M (\<Union> (range A)) \<noteq> \<infinity> \<Longrightarrow> (\<lambda>i. Sigma_Algebra.measure M (A i)) sums Sigma_Algebra.measure M (\<Union> (range A))

goal (1 subgoal):
 1. (\<lambda>i. Sigma_Algebra.measure M (A i)) sums Sigma_Algebra.measure M (\<Union> (range A))
[PROOF STEP]
by simp


[STATEMENT]
lemma CJ_Oi_Oa: "\<lfloor>(\<^bold>O\<^sub>iA \<^bold>\<and> \<^bold>\<diamond>\<^sub>aA \<^bold>\<and> \<^bold>\<diamond>\<^sub>a(\<^bold>\<not>A)) \<^bold>\<rightarrow> \<^bold>O\<^sub>aA\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>c. (\<lambda>w. (\<^bold>O\<^sub>iA) c w \<and> (\<^bold>\<diamond>\<^sub>aA) c w \<and> \<I>av w \<sqinter> (\<^bold>\<not>A) c) \<sqsubseteq> (\<^bold>O\<^sub>aA) c
[PROOF STEP]
using sem_5e sem_4a
[PROOF STATE]
proof (prove)
using this:
\<forall>X Y Z. Y \<sqsubseteq> X \<and> ob X Z \<and> \<I>Y \<sqinter> Z \<longrightarrow> ob Y Z
\<forall>w. av w \<sqsubseteq> pv w

goal (1 subgoal):
 1. \<forall>c. (\<lambda>w. (\<^bold>O\<^sub>iA) c w \<and> (\<^bold>\<diamond>\<^sub>aA) c w \<and> \<I>av w \<sqinter> (\<^bold>\<not>A) c) \<sqsubseteq> (\<^bold>O\<^sub>aA) c
[PROOF STEP]
by blast


[STATEMENT]
lemma vifintersection_vintersection_family:
  assumes "I \<noteq> 0"
  shows "(\<Inter>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i) \<inter>\<^sub>\<circ> (\<Inter>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. B i) = (\<Inter>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i \<inter>\<^sub>\<circ> B i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter>\<^sub>\<circ> (VLambda I A `\<^sub>\<circ> I) \<inter>\<^sub>\<circ> \<Inter>\<^sub>\<circ> (VLambda I B `\<^sub>\<circ> I) = \<Inter>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. A a \<inter>\<^sub>\<circ> B a) `\<^sub>\<circ> I)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
I \<noteq> 0

goal (1 subgoal):
 1. \<Inter>\<^sub>\<circ> (VLambda I A `\<^sub>\<circ> I) \<inter>\<^sub>\<circ> \<Inter>\<^sub>\<circ> (VLambda I B `\<^sub>\<circ> I) = \<Inter>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. A a \<inter>\<^sub>\<circ> B a) `\<^sub>\<circ> I)
[PROOF STEP]
by (intro vsubset_antisym vsubsetI, intro vifintersectionI | tactic\<open>all_tac\<close>)
    blast+