[STATEMENT]
theorem measure_mon_conv:
  assumes ms: "measure_space M" and
  Ams: "\<And>n. A n \<in> measurable_sets M" and AB: "A\<up>B"
  shows "(\<lambda>n. measure M (A n)) \<longlonglongrightarrow> measure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from AB
[PROOF STATE]
proof (chain)
picking this:
A\<up>B
[PROOF STEP]
have up: "\<And>n. A n \<subseteq> A (Suc n)"
[PROOF STATE]
proof (prove)
using this:
A\<up>B

goal (1 subgoal):
 1. \<And>n. A n \<subseteq> A (Suc n)
[PROOF STEP]
by (simp only: mon_conv_set_def)
[PROOF STATE]
proof (state)
this:
A ?n \<subseteq> A (Suc ?n)

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
A ?n \<subseteq> A (Suc ?n)

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
have "mkdisjoint A i \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mkdisjoint A i \<in> measurable_sets M
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> mkdisjoint A i \<in> measurable_sets M
 2. \<And>nat. i = Suc nat \<Longrightarrow> mkdisjoint A i \<in> measurable_sets M
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> mkdisjoint A i \<in> measurable_sets M
 2. \<And>nat. i = Suc nat \<Longrightarrow> mkdisjoint A i \<in> measurable_sets M
[PROOF STEP]
with Ams
[PROOF STATE]
proof (chain)
picking this:
A ?n \<in> measurable_sets M
i = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A ?n \<in> measurable_sets M
i = 0

goal (1 subgoal):
 1. mkdisjoint A i \<in> measurable_sets M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mkdisjoint A i \<in> measurable_sets M

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> mkdisjoint A i \<in> measurable_sets M
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> mkdisjoint A i \<in> measurable_sets M
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
i__ = Suc i

goal (1 subgoal):
 1. \<And>nat. i__ = Suc nat \<Longrightarrow> mkdisjoint A i__ \<in> measurable_sets M
[PROOF STEP]
have "A (Suc i) - A i = A (Suc i) \<inter> - A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A (Suc i) - A i = A (Suc i) \<inter> - A i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A (Suc i) - A i = A (Suc i) \<inter> - A i

goal (1 subgoal):
 1. \<And>nat. i__ = Suc nat \<Longrightarrow> mkdisjoint A i__ \<in> measurable_sets M
[PROOF STEP]
with Suc ms Ams
[PROOF STATE]
proof (chain)
picking this:
i__ = Suc i
measure_space M
A ?n \<in> measurable_sets M
A (Suc i) - A i = A (Suc i) \<inter> - A i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i__ = Suc i
measure_space M
A ?n \<in> measurable_sets M
A (Suc i) - A i = A (Suc i) \<inter> - A i

goal (1 subgoal):
 1. mkdisjoint A i__ \<in> measurable_sets M
[PROOF STEP]
by (auto simp add: measure_space_def sigma_algebra_def sigma_algebra_inter)
[PROOF STATE]
proof (state)
this:
mkdisjoint A i__ \<in> measurable_sets M

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mkdisjoint A i \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
mkdisjoint A ?i2 \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
hence i: "\<And>i. mkdisjoint A i \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
mkdisjoint A ?i2 \<in> measurable_sets M

goal (1 subgoal):
 1. \<And>i. mkdisjoint A i \<in> measurable_sets M
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mkdisjoint A ?i \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
with ms
[PROOF STATE]
proof (chain)
picking this:
measure_space M
mkdisjoint A ?i \<in> measurable_sets M
[PROOF STEP]
have un: "(\<Union>i. mkdisjoint A i) \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
measure_space M
mkdisjoint A ?i \<in> measurable_sets M

goal (1 subgoal):
 1. \<Union> (range (mkdisjoint A)) \<in> measurable_sets M
[PROOF STEP]
by (simp add: measure_space_def sigma_algebra_def)
[PROOF STATE]
proof (state)
this:
\<Union> (range (mkdisjoint A)) \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<Union> (range (mkdisjoint A)) \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
mkdisjoint A ?i \<in> measurable_sets M
[PROOF STEP]
have range: "range (mkdisjoint A) \<subseteq> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
mkdisjoint A ?i \<in> measurable_sets M

goal (1 subgoal):
 1. range (mkdisjoint A) \<subseteq> measurable_sets M
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
range (mkdisjoint A) \<subseteq> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
range (mkdisjoint A) \<subseteq> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from up
[PROOF STATE]
proof (chain)
picking this:
A ?n \<subseteq> A (Suc ?n)
[PROOF STEP]
have "\<forall>i j. i \<noteq> j \<longrightarrow>  mkdisjoint A i \<inter> mkdisjoint A j = {}"
[PROOF STATE]
proof (prove)
using this:
A ?n \<subseteq> A (Suc ?n)

goal (1 subgoal):
 1. \<forall>i j. i \<noteq> j \<longrightarrow> mkdisjoint A i \<inter> mkdisjoint A j = {}
[PROOF STEP]
by (simp add: mkdisjoint_disj)
[PROOF STATE]
proof (state)
this:
\<forall>i j. i \<noteq> j \<longrightarrow> mkdisjoint A i \<inter> mkdisjoint A j = {}

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>i j. i \<noteq> j \<longrightarrow> mkdisjoint A i \<inter> mkdisjoint A j = {}

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
note ms
[PROOF STATE]
proof (state)
this:
measure_space M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<Union> (range (mkdisjoint A)) \<in> measurable_sets M
range (mkdisjoint A) \<subseteq> measurable_sets M
\<forall>i j. i \<noteq> j \<longrightarrow> mkdisjoint A i \<inter> mkdisjoint A j = {}
measure_space M
[PROOF STEP]
have sums:
    "(\<lambda>i. measure M (mkdisjoint A i)) sums (measure M (\<Union>i. mkdisjoint A i))"
[PROOF STATE]
proof (prove)
using this:
\<Union> (range (mkdisjoint A)) \<in> measurable_sets M
range (mkdisjoint A) \<subseteq> measurable_sets M
\<forall>i j. i \<noteq> j \<longrightarrow> mkdisjoint A i \<inter> mkdisjoint A j = {}
measure_space M

goal (1 subgoal):
 1. (\<lambda>i. Measure.measure M (mkdisjoint A i)) sums Measure.measure M (\<Union> (range (mkdisjoint A)))
[PROOF STEP]
by (simp add: measure_space_def countably_additive_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. Measure.measure M (mkdisjoint A i)) sums Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
hence "(\<Sum>i. measure M (mkdisjoint A i)) = (measure M (\<Union>i. mkdisjoint A i))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. Measure.measure M (mkdisjoint A i)) sums Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<Sum>i. Measure.measure M (mkdisjoint A i)) = Measure.measure M (\<Union> (range (mkdisjoint A)))
[PROOF STEP]
by (rule sums_unique[THEN sym])
[PROOF STATE]
proof (state)
this:
(\<Sum>i. Measure.measure M (mkdisjoint A i)) = Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i. Measure.measure M (mkdisjoint A i)) = Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from sums
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. Measure.measure M (mkdisjoint A i)) sums Measure.measure M (\<Union> (range (mkdisjoint A)))
[PROOF STEP]
have "summable (\<lambda>i. measure M (mkdisjoint A i))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. Measure.measure M (mkdisjoint A i)) sums Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. summable (\<lambda>i. Measure.measure M (mkdisjoint A i))
[PROOF STEP]
by (rule sums_summable)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>i. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
hence "(\<lambda>n. \<Sum>i<n. measure M (mkdisjoint A i))
    \<longlonglongrightarrow> (\<Sum>i. measure M (mkdisjoint A i))"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>i. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> (\<Sum>i. Measure.measure M (mkdisjoint A i))
[PROOF STEP]
by (rule summable_LIMSEQ)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> (\<Sum>i. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
hence "(\<lambda>n. \<Sum>i<Suc n. measure M (mkdisjoint A i)) \<longlonglongrightarrow> (\<Sum>i. measure M (mkdisjoint A i))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> (\<Sum>i. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> (\<Sum>i. Measure.measure M (mkdisjoint A i))
[PROOF STEP]
by (rule LIMSEQ_Suc)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> (\<Sum>i. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i. Measure.measure M (mkdisjoint A i)) = Measure.measure M (\<Union> (range (mkdisjoint A)))
(\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> (\<Sum>i. Measure.measure M (mkdisjoint A i))
[PROOF STEP]
have "(\<lambda>n. \<Sum>i<Suc n. measure M (mkdisjoint A i))
    \<longlonglongrightarrow> (measure M (\<Union>i. mkdisjoint A i))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. Measure.measure M (mkdisjoint A i)) = Measure.measure M (\<Union> (range (mkdisjoint A)))
(\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> (\<Sum>i. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from up
[PROOF STATE]
proof (chain)
picking this:
A ?n \<subseteq> A (Suc ?n)
[PROOF STEP]
have "A n = (\<Union>i\<in>{..n}. mkdisjoint A i)"
[PROOF STATE]
proof (prove)
using this:
A ?n \<subseteq> A (Suc ?n)

goal (1 subgoal):
 1. A n = \<Union> (mkdisjoint A ` {..n})
[PROOF STEP]
by (rule mkdisjoint_un)
[PROOF STATE]
proof (state)
this:
A n = \<Union> (mkdisjoint A ` {..n})

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
hence "measure M (A n) = measure M (\<Union>i\<in>{..n}. mkdisjoint A i)"
[PROOF STATE]
proof (prove)
using this:
A n = \<Union> (mkdisjoint A ` {..n})

goal (1 subgoal):
 1. Measure.measure M (A n) = Measure.measure M (\<Union> (mkdisjoint A ` {..n}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Measure.measure M (A n) = Measure.measure M (\<Union> (mkdisjoint A ` {..n}))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Measure.measure M (A n) = Measure.measure M (\<Union> (mkdisjoint A ` {..n}))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
have
      "(\<Union>i\<in>{..n}. mkdisjoint A i) = (\<Union>i. if i\<le>n then mkdisjoint A i else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
have "UNIV = {..n} \<union> {n<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = {..n} \<union> {n<..}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
UNIV = {..n} \<union> {n<..}

goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
hence "(\<Union>i. if i\<le>n then mkdisjoint A i else {}) =
        (\<Union>i\<in>{..n}. if i\<le>n then mkdisjoint A i else {})
        \<union>  (\<Union>i\<in>{n<..}. if i\<le>n then mkdisjoint A i else {})"
[PROOF STATE]
proof (prove)
using this:
UNIV = {..n} \<union> {n<..}

goal (1 subgoal):
 1. (\<Union>i. if i \<le> n then mkdisjoint A i else {}) = (\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
by (auto split: if_splits)
[PROOF STATE]
proof (state)
this:
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) = (\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {})

goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) = (\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {})

goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) = (\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {})

goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
have "(\<Union>i\<in>{n<..}. if i\<le>n then mkdisjoint A i else {}) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {}) = {}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {}) = {}

goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {}) = {}

goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
hence "\<dots> = (\<Union>i\<in>{..n}. mkdisjoint A i)"
[PROOF STATE]
proof (prove)
using this:
(\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {}) = {}

goal (1 subgoal):
 1. (\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {}) = \<Union> (mkdisjoint A ` {..n})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {}) = \<Union> (mkdisjoint A ` {..n})

goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) = (\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {})
(\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {}) = \<Union> (mkdisjoint A ` {..n})
[PROOF STEP]
show
        "(\<Union>i\<in>{..n}. mkdisjoint A i) = (\<Union>i. if i\<le>n then mkdisjoint A i else {})"
[PROOF STATE]
proof (prove)
using this:
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) = (\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {})
(\<Union>i\<le>n. if i \<le> n then mkdisjoint A i else {}) \<union> (\<Union>i\<in>{n<..}. if i \<le> n then mkdisjoint A i else {}) = \<Union> (mkdisjoint A ` {..n})

goal (1 subgoal):
 1. \<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Measure.measure M (A n) = Measure.measure M (\<Union> (mkdisjoint A ` {..n}))
\<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
have
      "measure M (A n) = measure M (\<Union>i. if i\<le>n then mkdisjoint A i else {})"
[PROOF STATE]
proof (prove)
using this:
Measure.measure M (A n) = Measure.measure M (\<Union> (mkdisjoint A ` {..n}))
\<Union> (mkdisjoint A ` {..n}) = (\<Union>i. if i \<le> n then mkdisjoint A i else {})

goal (1 subgoal):
 1. Measure.measure M (A n) = Measure.measure M (\<Union>i. if i \<le> n then mkdisjoint A i else {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Measure.measure M (A n) = Measure.measure M (\<Union>i. if i \<le> n then mkdisjoint A i else {})

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Measure.measure M (A n) = Measure.measure M (\<Union>i. if i \<le> n then mkdisjoint A i else {})

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from i ms
[PROOF STATE]
proof (chain)
picking this:
mkdisjoint A ?i \<in> measurable_sets M
measure_space M
[PROOF STEP]
have
      un: "(\<Union>i. if i\<le>n then mkdisjoint A i else {}) \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
mkdisjoint A ?i \<in> measurable_sets M
measure_space M

goal (1 subgoal):
 1. (\<Union>i. if i \<le> n then mkdisjoint A i else {}) \<in> measurable_sets M
[PROOF STEP]
by (simp add: measure_space_def sigma_algebra_def cong add: SUP_cong_simp)
[PROOF STATE]
proof (state)
this:
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from i ms
[PROOF STATE]
proof (chain)
picking this:
mkdisjoint A ?i \<in> measurable_sets M
measure_space M
[PROOF STEP]
have
      "range (\<lambda>i. if i\<le>n then mkdisjoint A i else {}) \<subseteq> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
mkdisjoint A ?i \<in> measurable_sets M
measure_space M

goal (1 subgoal):
 1. range (\<lambda>i. if i \<le> n then mkdisjoint A i else {}) \<subseteq> measurable_sets M
[PROOF STEP]
by (auto simp add: measure_space_def sigma_algebra_def)
[PROOF STATE]
proof (state)
this:
range (\<lambda>i. if i \<le> n then mkdisjoint A i else {}) \<subseteq> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
range (\<lambda>i. if i \<le> n then mkdisjoint A i else {}) \<subseteq> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from up
[PROOF STATE]
proof (chain)
picking this:
A ?n \<subseteq> A (Suc ?n)
[PROOF STEP]
have "\<forall>i j. i \<noteq> j \<longrightarrow>
      (if i\<le>n then mkdisjoint A i else {}) \<inter>
      (if j\<le>n then mkdisjoint A j else {}) = {}"
[PROOF STATE]
proof (prove)
using this:
A ?n \<subseteq> A (Suc ?n)

goal (1 subgoal):
 1. \<forall>i j. i \<noteq> j \<longrightarrow> (if i \<le> n then mkdisjoint A i else {}) \<inter> (if j \<le> n then mkdisjoint A j else {}) = {}
[PROOF STEP]
by (simp add: mkdisjoint_disj)
[PROOF STATE]
proof (state)
this:
\<forall>i j. i \<noteq> j \<longrightarrow> (if i \<le> n then mkdisjoint A i else {}) \<inter> (if j \<le> n then mkdisjoint A j else {}) = {}

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>i j. i \<noteq> j \<longrightarrow> (if i \<le> n then mkdisjoint A i else {}) \<inter> (if j \<le> n then mkdisjoint A j else {}) = {}

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
note ms
[PROOF STATE]
proof (state)
this:
measure_space M

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Measure.measure M (A n) = Measure.measure M (\<Union>i. if i \<le> n then mkdisjoint A i else {})
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) \<in> measurable_sets M
range (\<lambda>i. if i \<le> n then mkdisjoint A i else {}) \<subseteq> measurable_sets M
\<forall>i j. i \<noteq> j \<longrightarrow> (if i \<le> n then mkdisjoint A i else {}) \<inter> (if j \<le> n then mkdisjoint A j else {}) = {}
measure_space M
[PROOF STEP]
have
      "measure M (A n) = (\<Sum>i. measure M (if i \<le> n then mkdisjoint A i else {}))"
[PROOF STATE]
proof (prove)
using this:
Measure.measure M (A n) = Measure.measure M (\<Union>i. if i \<le> n then mkdisjoint A i else {})
(\<Union>i. if i \<le> n then mkdisjoint A i else {}) \<in> measurable_sets M
range (\<lambda>i. if i \<le> n then mkdisjoint A i else {}) \<subseteq> measurable_sets M
\<forall>i j. i \<noteq> j \<longrightarrow> (if i \<le> n then mkdisjoint A i else {}) \<inter> (if j \<le> n then mkdisjoint A j else {}) = {}
measure_space M

goal (1 subgoal):
 1. Measure.measure M (A n) = (\<Sum>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))
[PROOF STEP]
by (simp add: measure_space_def countably_additive_def sums_unique cong add: SUP_cong_simp)
[PROOF STATE]
proof (state)
this:
Measure.measure M (A n) = (\<Sum>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Measure.measure M (A n) = (\<Sum>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
from ms
[PROOF STATE]
proof (chain)
picking this:
measure_space M
[PROOF STEP]
have
      "\<forall>i. (Suc n)\<le>i \<longrightarrow> measure M (if i \<le> n then mkdisjoint A i else {}) = 0"
[PROOF STATE]
proof (prove)
using this:
measure_space M

goal (1 subgoal):
 1. \<forall>i\<ge>Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}) = 0
[PROOF STEP]
by (simp add: measure_space_def positive_def)
[PROOF STATE]
proof (state)
this:
\<forall>i\<ge>Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}) = 0

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
hence "(\<lambda>i. measure M (if i \<le> n then mkdisjoint A i else {})) sums
      (\<Sum>i<Suc n. measure M (if i \<le> n then mkdisjoint A i else {}))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<ge>Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}) = 0

goal (1 subgoal):
 1. (\<lambda>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {})) sums (\<Sum>i<Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))
[PROOF STEP]
by (intro sums_finite) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {})) sums (\<Sum>i<Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
hence "(\<Sum>i. measure M (if i \<le> n then mkdisjoint A i else {})) =
      (\<Sum>i<Suc n. measure M (if i \<le> n then mkdisjoint A i else {}))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {})) sums (\<Sum>i<Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))

goal (1 subgoal):
 1. (\<Sum>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {})) = (\<Sum>i<Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))
[PROOF STEP]
by (rule sums_unique[THEN sym])
[PROOF STATE]
proof (state)
this:
(\<Sum>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {})) = (\<Sum>i<Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i. Measure.measure M (if i \<le> n then mkdisjoint A i else {})) = (\<Sum>i<Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {}))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
have "\<dots> = (\<Sum>i<Suc n. measure M (mkdisjoint A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {})) = (\<Sum>i<Suc n. Measure.measure M (mkdisjoint A i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i<Suc n. Measure.measure M (if i \<le> n then mkdisjoint A i else {})) = (\<Sum>i<Suc n. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Measure.measure M (A n) = (\<Sum>i<Suc n. Measure.measure M (mkdisjoint A i))
[PROOF STEP]
have
      "measure M (A n) = (\<Sum>i<Suc n. measure M (mkdisjoint A i))"
[PROOF STATE]
proof (prove)
using this:
Measure.measure M (A n) = (\<Sum>i<Suc n. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. Measure.measure M (A n) = (\<Sum>i<Suc n. Measure.measure M (mkdisjoint A i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Measure.measure M (A n) = (\<Sum>i<Suc n. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
Measure.measure M (A ?n2) = (\<Sum>i<Suc ?n2. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))
Measure.measure M (A ?n2) = (\<Sum>i<Suc ?n2. Measure.measure M (mkdisjoint A i))
[PROOF STEP]
have
    "(\<lambda>n. measure M (A n)) \<longlonglongrightarrow> (measure M (\<Union>i. mkdisjoint A i))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<Suc n. Measure.measure M (mkdisjoint A i)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))
Measure.measure M (A ?n2) = (\<Sum>i<Suc ?n2. Measure.measure M (mkdisjoint A i))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
with AB
[PROOF STATE]
proof (chain)
picking this:
A\<up>B
(\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A\<up>B
(\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M (\<Union> (range (mkdisjoint A)))

goal (1 subgoal):
 1. (\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B
[PROOF STEP]
by (simp add: mkdisjoint_mon_conv)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Measure.measure M (A n)) \<longlonglongrightarrow> Measure.measure M B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bfun_prob_space_integrable:
  assumes "prob_space S" "v \<in> borel_measurable S"
  assumes "(v :: 'a \<Rightarrow> 'b :: {second_countable_topology, banach}) \<in> bfun"
  shows "integrable S v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable S v
[PROOF STEP]
using prob_space.finite_measure norm_le_norm_bfun[of "Bfun v"] Bfun_inverse[OF assms(3)] assms
[PROOF STATE]
proof (prove)
using this:
prob_space ?M \<Longrightarrow> finite_measure ?M
norm (apply_bfun (bfun.Bfun v) ?x) \<le> norm (bfun.Bfun v)
apply_bfun (bfun.Bfun v) = v
prob_space S
v \<in> borel_measurable S
v \<in> bfun

goal (1 subgoal):
 1. integrable S v
[PROOF STEP]
by (auto intro: finite_measure.integrable_const_bound)


[STATEMENT]
lemma cl_op_prop [iff]: "(cl_op (x \<squnion> y) = cl_op y) = (cl_op (x::'a::clattice_with_clop) \<le> cl_op y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cl_op (x \<squnion> y) = cl_op y) = (cl_op x \<le> cl_op y)
[PROOF STEP]
by (smt cl_op_class.clop_iso clop_ext clop_wtrans inf_sup_ord(4) le_iff_sup sup.absorb_iff1 sup_left_commute)


[STATEMENT]
lemma integral_has_real_derivative:
  assumes "continuous_on {a..b} g"
  assumes "t \<in> {a..b}"
  shows "((\<lambda>x. integral {a..x} g) has_real_derivative g t) (at t within {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. integral {a..x} g) has_real_derivative g t) (at t within {a..b})
[PROOF STEP]
using integral_has_vector_derivative[of a b g t] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on {a..b} g; t \<in> {a..b}\<rbrakk> \<Longrightarrow> ((\<lambda>u. integral {a..u} g) has_vector_derivative g t) (at t within {a..b})
continuous_on {a..b} g
t \<in> {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. integral {a..x} g) has_real_derivative g t) (at t within {a..b})
[PROOF STEP]
by (auto simp: has_real_derivative_iff_has_vector_derivative)


[STATEMENT]
lemma lsc_sequentially_mem:
  fixes f :: "'a::metric_space \<Rightarrow> ereal"
  assumes "lsc_at x0 f"
  assumes "x \<longlonglongrightarrow> x0" "c \<longlonglongrightarrow> c0"
  assumes "\<forall>n. f(x n)\<le>c n"
  shows "f(x0)\<le>c0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x0 \<le> c0
[PROOF STEP]
using lsc_sequentially_gen[of x0 f] assms
[PROOF STATE]
proof (prove)
using this:
lsc_at x0 f = (\<forall>x c c0. x \<longlonglongrightarrow> x0 \<and> c \<longlonglongrightarrow> c0 \<and> (\<forall>n. f (x n) \<le> c n) \<longrightarrow> f x0 \<le> c0)
lsc_at x0 f
x \<longlonglongrightarrow> x0
c \<longlonglongrightarrow> c0
\<forall>n. f (x n) \<le> c n

goal (1 subgoal):
 1. f x0 \<le> c0
[PROOF STEP]
by auto


[STATEMENT]
lemma match_Star_unfold: "i < j \<Longrightarrow> (i, j) \<in> match (Star r) \<Longrightarrow> \<exists>k \<in> {i..<j}. (i, k) \<in> match (Star r) \<and> (k, j) \<in> match r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < j; (i, j) \<in> match (Star r)\<rbrakk> \<Longrightarrow> \<exists>k\<in>{i..<j}. (i, k) \<in> match (Star r) \<and> (k, j) \<in> match r
[PROOF STEP]
using rtrancl_unfold'[of i j "match r"] match_le[of _ j r] match_le[of i _ "Star r"]
[PROOF STATE]
proof (prove)
using this:
(i, j) \<in> (match r)\<^sup>* \<Longrightarrow> i = j \<or> (\<exists>y. (i, y) \<in> (match r)\<^sup>* \<and> y \<noteq> j \<and> (y, j) \<in> match r)
(?i, j) \<in> match r \<Longrightarrow> ?i \<le> j
(i, ?j) \<in> match (Star r) \<Longrightarrow> i \<le> ?j

goal (1 subgoal):
 1. \<lbrakk>i < j; (i, j) \<in> match (Star r)\<rbrakk> \<Longrightarrow> \<exists>k\<in>{i..<j}. (i, k) \<in> match (Star r) \<and> (k, j) \<in> match r
[PROOF STEP]
by auto (meson atLeastLessThan_iff order_le_less)


[STATEMENT]
lemma poly_cards_single:
  assumes "x \<in> carrier R"
  assumes "y \<in> carrier R"
  shows "card {\<omega> \<in> space. eval \<omega> x = y} = field_size^(k-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {\<omega> \<in> local.space. local.eval \<omega> x = y} = field_size ^ (k - 1)
[PROOF STEP]
using poly_cards[where K="{x}" and y="\<lambda>_. y", simplified] assms k_ge_0
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<in> carrier R; Suc 0 \<le> k; y \<in> carrier R\<rbrakk> \<Longrightarrow> card {\<omega> \<in> local.space. local.eval \<omega> x = y} = field_size ^ (k - Suc 0)
x \<in> carrier R
y \<in> carrier R
0 < k

goal (1 subgoal):
 1. card {\<omega> \<in> local.space. local.eval \<omega> x = y} = field_size ^ (k - 1)
[PROOF STEP]
by simp


[STATEMENT]
lemma hcpow_zero_zero: "r pow n = 0 \<Longrightarrow> r = 0"
  for r :: hcomplex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r pow n = 0 \<Longrightarrow> r = 0
[PROOF STEP]
by (blast intro: ccontr dest: hcpow_not_zero)


[STATEMENT]
lemma attractor_unfolding: "attractor p W = attractor_step p W (attractor p W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. attractor p W = W \<union> attractor p W \<union> directly_attracted p (attractor p W)
[PROOF STEP]
unfolding attractor_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp (\<lambda>S. W \<union> S \<union> directly_attracted p S) = W \<union> lfp (\<lambda>S. W \<union> S \<union> directly_attracted p S) \<union> directly_attracted p (lfp (\<lambda>S. W \<union> S \<union> directly_attracted p S))
[PROOF STEP]
using attractor_step_mono lfp_unfold
[PROOF STATE]
proof (prove)
using this:
mono (\<lambda>S. ?W \<union> S \<union> directly_attracted ?p S)
mono ?f \<Longrightarrow> lfp ?f = ?f (lfp ?f)

goal (1 subgoal):
 1. lfp (\<lambda>S. W \<union> S \<union> directly_attracted p S) = W \<union> lfp (\<lambda>S. W \<union> S \<union> directly_attracted p S) \<union> directly_attracted p (lfp (\<lambda>S. W \<union> S \<union> directly_attracted p S))
[PROOF STEP]
by blast


[STATEMENT]
lemma qtable_wf_tuple_cong: "qtable n A P Q X \<Longrightarrow> A = B \<Longrightarrow> (\<And>v. wf_tuple n A v \<Longrightarrow> P v \<Longrightarrow> Q v = Q' v) \<Longrightarrow> qtable n B P Q' X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>qtable n A P Q X; A = B; \<And>v. \<lbrakk>wf_tuple n A v; P v\<rbrakk> \<Longrightarrow> Q v = Q' v\<rbrakk> \<Longrightarrow> qtable n B P Q' X
[PROOF STEP]
unfolding qtable_def table_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ball X (wf_tuple n A) \<and> (\<forall>x. (x \<in> X \<and> P x \<longrightarrow> Q x) \<and> (wf_tuple n A x \<and> P x \<and> Q x \<longrightarrow> x \<in> X)); A = B; \<And>v. \<lbrakk>wf_tuple n A v; P v\<rbrakk> \<Longrightarrow> Q v = Q' v\<rbrakk> \<Longrightarrow> Ball X (wf_tuple n B) \<and> (\<forall>x. (x \<in> X \<and> P x \<longrightarrow> Q' x) \<and> (wf_tuple n B x \<and> P x \<and> Q' x \<longrightarrow> x \<in> X))
[PROOF STEP]
by blast


[STATEMENT]
lemma surj_on_add_mult: assumes coprime: "coprime x (q::nat)" and inj: "inj_on (\<lambda> b. (y + x*b) mod q) {..<q}"
  shows "(\<lambda> b. (y + x*b) mod q) ` {..< q} = {..< q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. (y + x * b) mod q) ` {..<q} = {..<q}
[PROOF STEP]
apply(rule endo_inj_surj)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {..<q}
 2. (\<lambda>b. (y + x * b) mod q) ` {..<q} \<subseteq> {..<q}
 3. inj_on (\<lambda>b. (y + x * b) mod q) {..<q}
[PROOF STEP]
using coprime inj
[PROOF STATE]
proof (prove)
using this:
coprime x q
inj_on (\<lambda>b. (y + x * b) mod q) {..<q}

goal (3 subgoals):
 1. finite {..<q}
 2. (\<lambda>b. (y + x * b) mod q) ` {..<q} \<subseteq> {..<q}
 3. inj_on (\<lambda>b. (y + x * b) mod q) {..<q}
[PROOF STEP]
by auto


[STATEMENT]
lemma tendsto_norm_zero_cancel: "((\<lambda>x. norm (f x)) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. norm (f x)) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
unfolding tendsto_iff dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e>0. \<forall>\<^sub>F x in F. norm (norm (f x) - 0) < e \<Longrightarrow> \<forall>e>0. \<forall>\<^sub>F x in F. norm (f x - (0::'b)) < e
[PROOF STEP]
by simp


[STATEMENT]
lemma aux_comp_sum_divide_cmod:
  fixes n:: nat and g:: "nat \<Rightarrow> int" and a:: real
  shows "(cmod(complex_of_real(\<Sum>k<n. g k / a)))\<^sup>2 = (cmod (\<Sum>k<n. g k) / a)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real (\<Sum>k<n. real_of_int (g k) / a)))\<^sup>2 = (cmod (of_int (sum g {..<n})) / a)\<^sup>2
[PROOF STEP]
by (metis cmod_square_real of_int_sum of_real_of_int_eq power_divide sum_divide_distrib)


[STATEMENT]
lemma subadditive_converges_unbounded:
  assumes "subadditive u"
          "\<not> (bdd_below {u n/n | n. n>0})"
  shows "(\<lambda>n. ereal(u n/n)) \<longlonglongrightarrow> -\<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ereal (u n / real n)) \<longlonglongrightarrow> - \<infinity>
[PROOF STEP]
by (rule subadditive_converges_unbounded'[OF subadditive_imp_eventually_subadditive[OF assms(1)] assms(2)])


[STATEMENT]
lemma nn_integral_finite_imp_abs_sumable_on':
  assumes "nn_integral (count_space A) (\<lambda>x. ennreal (f x)) < \<infinity>" "\<And>x. f x \<ge> 0"
  shows   "f abs_summable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f abs_summable_on A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A < \<infinity>
0 \<le> f ?x

goal (1 subgoal):
 1. f abs_summable_on A
[PROOF STEP]
unfolding abs_summable_on_def integrable_iff_bounded
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A < \<infinity>
0 \<le> f ?x

goal (1 subgoal):
 1. f \<in> borel_measurable (count_space A) \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>count_space A < \<infinity>
[PROOF STEP]
by auto


[STATEMENT]
lemma mod_eq_imp_eq_aux: "b mod N = (a::nat) mod N \<Longrightarrow> a\<le>b \<Longrightarrow> b<a+N \<Longrightarrow> b=a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b mod N = a mod N; a \<le> b; b < a + N\<rbrakk> \<Longrightarrow> b = a
[PROOF STEP]
by (auto simp add: mod_eq_dvd_iff_nat le_imp_diff_is_add)


[STATEMENT]
lemma matrix_mult_0_right [simp]:
  "(A::('a::{comm_monoid_add,mult_zero},'m,'n) matrix) *\<^sub>M 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>M 0 = 0
[PROOF STEP]
by (cases A, simp add: zero_matrix_def)


[STATEMENT]
lemma zip_append1:
  "zip (xs @ ys) zs =
  zip xs (take (length xs) zs) @ zip ys (drop (length xs) zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip (xs @ ys) zs = zip xs (take (length xs) zs) @ zip ys (drop (length xs) zs)
[PROOF STEP]
by (induct xs zs rule:list_induct2') auto


[STATEMENT]
lemma atLeastLessThanPlusOne_atLeastAtMost_integer: "{l..<u+1} = {l..(u::integer)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l..<u + 1} = {l..u}
[PROOF STEP]
apply (auto simp add: atLeastAtMost_def atLeastLessThan_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>l \<le> x; x < u + 1\<rbrakk> \<Longrightarrow> x \<le> u
[PROOF STEP]
including integer.lifting
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>l \<le> x; x < u + 1\<rbrakk> \<Longrightarrow> x \<le> u
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x l u. \<lbrakk>l \<le> x; x < u + 1\<rbrakk> \<Longrightarrow> x \<le> u
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma neq_imp_neq_div_or_mod:
  fixes i j:: nat
  assumes "i \<noteq> j"
  shows "i div 2^n \<noteq> j div 2^n \<or> i mod 2^n \<noteq> j mod 2^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div 2 ^ n \<noteq> j div 2 ^ n \<or> i mod 2 ^ n \<noteq> j mod 2 ^ n
[PROOF STEP]
using assms div_mult_mod_eq_minus
[PROOF STATE]
proof (prove)
using this:
i \<noteq> j
?i div 2 ^ ?n * 2 ^ ?n + ?i mod 2 ^ ?n - ?j div 2 ^ ?n * 2 ^ ?n - ?j mod 2 ^ ?n = ?i - ?j

goal (1 subgoal):
 1. i div 2 ^ n \<noteq> j div 2 ^ n \<or> i mod 2 ^ n \<noteq> j mod 2 ^ n
[PROOF STEP]
by (metis add.right_neutral cancel_div_mod_rules(2))


[STATEMENT]
lemma mset_le_subtract: "A\<subseteq>#B \<Longrightarrow> A-C \<subseteq># B-(C::'a multiset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq># B \<Longrightarrow> A - C \<subseteq># B - C
[PROOF STEP]
apply (unfold subseteq_mset_def count_diff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. count A a \<le> count B a \<Longrightarrow> \<forall>a. count A a - count C a \<le> count B a - count C a
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<forall>a. count A a \<le> count B a \<Longrightarrow> count A a - count C a \<le> count B a - count C a
[PROOF STEP]
apply (subgoal_tac "count A a \<le> count B a")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>\<forall>a. count A a \<le> count B a; count A a \<le> count B a\<rbrakk> \<Longrightarrow> count A a - count C a \<le> count B a - count C a
 2. \<And>a. \<forall>a. count A a \<le> count B a \<Longrightarrow> count A a \<le> count B a
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<forall>a. count A a \<le> count B a \<Longrightarrow> count A a \<le> count B a
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma homeomorphism_into_1d:
  fixes f :: "'a::topological_space \<Rightarrow> real"
  assumes "path_connected S" "continuous_on S f" "f ` S = T" "inj_on f S"
  shows "\<exists>g. homeomorphism S T f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. homeomorphism S T f g
[PROOF STEP]
using assms injective_into_1d_eq_homeomorphism
[PROOF STATE]
proof (prove)
using this:
path_connected S
continuous_on S f
f ` S = T
inj_on f S
\<lbrakk>continuous_on ?S ?f; path_connected ?S\<rbrakk> \<Longrightarrow> inj_on ?f ?S = (\<exists>g. homeomorphism ?S (?f ` ?S) ?f g)

goal (1 subgoal):
 1. \<exists>g. homeomorphism S T f g
[PROOF STEP]
by blast


[STATEMENT]
lemma summable_zero[simp, intro]: "summable (\<lambda>n. 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. 0::'a)
[PROOF STEP]
by (rule sums_zero [THEN sums_summable])


[STATEMENT]
lemma invertible_and_upper_diagonal_not0:
  fixes H :: "int^'n::mod_type^'n::mod_type"
  assumes inv_H: "invertible (map_matrix rat_of_int H)" and up_H: "upper_triangular H"
  shows "H $ i $ i \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H $ i $ i \<noteq> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. H $ i $ i \<noteq> 0
[PROOF STEP]
let ?RAT_H = "(map_matrix rat_of_int H)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. H $ i $ i \<noteq> 0
[PROOF STEP]
have up_RAT_H: "upper_triangular ?RAT_H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular (map_matrix rat_of_int H)
[PROOF STEP]
using up_H
[PROOF STATE]
proof (prove)
using this:
upper_triangular H

goal (1 subgoal):
 1. upper_triangular (map_matrix rat_of_int H)
[PROOF STEP]
unfolding upper_triangular_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. j < i \<longrightarrow> H $ i $ j = 0

goal (1 subgoal):
 1. \<forall>i j. j < i \<longrightarrow> map_matrix rat_of_int H $ i $ j = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
upper_triangular (map_matrix rat_of_int H)

goal (1 subgoal):
 1. H $ i $ i \<noteq> 0
[PROOF STEP]
have "is_unit (det ?RAT_H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (det (map_matrix rat_of_int H))
[PROOF STEP]
using inv_H
[PROOF STATE]
proof (prove)
using this:
invertible (map_matrix rat_of_int H)

goal (1 subgoal):
 1. is_unit (det (map_matrix rat_of_int H))
[PROOF STEP]
using invertible_iff_is_unit
[PROOF STATE]
proof (prove)
using this:
invertible (map_matrix rat_of_int H)
invertible ?A = (det ?A dvd (1::?'a))

goal (1 subgoal):
 1. is_unit (det (map_matrix rat_of_int H))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_unit (det (map_matrix rat_of_int H))

goal (1 subgoal):
 1. H $ i $ i \<noteq> 0
[PROOF STEP]
hence "?RAT_H $ i $ i \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
is_unit (det (map_matrix rat_of_int H))

goal (1 subgoal):
 1. map_matrix rat_of_int H $ i $ i \<noteq> 0
[PROOF STEP]
using inv_H up_RAT_H is_unit_diagonal
[PROOF STATE]
proof (prove)
using this:
is_unit (det (map_matrix rat_of_int H))
invertible (map_matrix rat_of_int H)
upper_triangular (map_matrix rat_of_int H)
\<lbrakk>upper_triangular ?U; is_unit (det ?U)\<rbrakk> \<Longrightarrow> \<forall>i. is_unit (?U $ i $ i)

goal (1 subgoal):
 1. map_matrix rat_of_int H $ i $ i \<noteq> 0
[PROOF STEP]
by (metis not_is_unit_0)
[PROOF STATE]
proof (state)
this:
map_matrix rat_of_int H $ i $ i \<noteq> 0

goal (1 subgoal):
 1. H $ i $ i \<noteq> 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
map_matrix rat_of_int H $ i $ i \<noteq> 0

goal (1 subgoal):
 1. H $ i $ i \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
H $ i $ i \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_0_abs_less_imp_0:
  fixes a::int
  assumes a1: "[a = 0] (mod m)"
  and a2: "abs(a)<m"
  shows "a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = 0
[PROOF STEP]
have "m\<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[a = 0] (mod m)
\<bar>a\<bar> < m

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

goal (1 subgoal):
 1. a = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> m

goal (1 subgoal):
 1. a = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> m
[a = 0] (mod m)
\<bar>a\<bar> < m

goal (1 subgoal):
 1. a = 0
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> m
a mod m = 0 mod m
\<bar>a\<bar> < m

goal (1 subgoal):
 1. a = 0
[PROOF STEP]
using int_mod_pos_eq large_mod_0 zless_imp_add1_zle
[PROOF STATE]
proof (prove)
using this:
0 \<le> m
a mod m = 0 mod m
\<bar>a\<bar> < m
\<lbrakk>?a = ?b * ?q + ?r; 0 \<le> ?r; ?r < ?b\<rbrakk> \<Longrightarrow> ?a mod ?b = ?r
\<lbrakk>1 < ?n; \<bar>?k\<bar> < ?n; ?k mod ?n = 0\<rbrakk> \<Longrightarrow> ?k = 0
?w < ?z \<Longrightarrow> ?w + 1 \<le> ?z

goal (1 subgoal):
 1. a = 0
[PROOF STEP]
by (metis abs_of_nonneg le_less not_less zabs_less_one_iff zmod_trivial_iff)
[PROOF STATE]
proof (state)
this:
a = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partition_set:
  assumes "partition P xs = (yes, no)"
  shows "set yes \<union> set no = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set yes \<union> set no = set xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set yes \<union> set no = set xs
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
partition P xs = (yes, no)
[PROOF STEP]
have "yes = fst (partition P xs)" and "no = snd (partition P xs)"
[PROOF STATE]
proof (prove)
using this:
partition P xs = (yes, no)

goal (1 subgoal):
 1. yes = fst (partition P xs) &&& no = snd (partition P xs)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
yes = fst (partition P xs)
no = snd (partition P xs)

goal (1 subgoal):
 1. set yes \<union> set no = set xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
yes = fst (partition P xs)
no = snd (partition P xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
yes = fst (partition P xs)
no = snd (partition P xs)

goal (1 subgoal):
 1. set yes \<union> set no = set xs
[PROOF STEP]
by (auto simp add: partition_filter1 partition_filter2)
[PROOF STATE]
proof (state)
this:
set yes \<union> set no = set xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Carmichael_number_card_prime_factors:
  assumes "Carmichael_number n"
  shows   "card (prime_factors n) \<ge> 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 \<le> card (prime_factors n)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Carmichael_number n
[PROOF STEP]
have "n > 3"
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n

goal (1 subgoal):
 1. 3 < n
[PROOF STEP]
using Carmichael_number_gt_3[of n]
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n
Carmichael_number n \<Longrightarrow> 3 < n

goal (1 subgoal):
 1. 3 < n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
3 < n

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
assume "\<not>(card (prime_factors n) \<ge> 3)"
[PROOF STATE]
proof (state)
this:
\<not> 3 \<le> card (prime_factors n)

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> 3 \<le> card (prime_factors n)

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
have "card (prime_factors n) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (prime_factors n) \<noteq> 0
[PROOF STEP]
using assms Carmichael_number_gt_3[of n]
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n
Carmichael_number n \<Longrightarrow> 3 < n

goal (1 subgoal):
 1. card (prime_factors n) \<noteq> 0
[PROOF STEP]
by (auto simp: prime_factorization_empty_iff)
[PROOF STATE]
proof (state)
this:
card (prime_factors n) \<noteq> 0

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (prime_factors n) \<noteq> 0

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
have "card (prime_factors n) \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (prime_factors n) \<noteq> 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n

goal (1 subgoal):
 1. card (prime_factors n) \<noteq> 1
[PROOF STEP]
by (auto simp: one_prime_factor_iff_primepow Carmichael_not_primepow)
[PROOF STATE]
proof (state)
this:
card (prime_factors n) \<noteq> 1

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> 3 \<le> card (prime_factors n)
card (prime_factors n) \<noteq> 0
card (prime_factors n) \<noteq> 1
[PROOF STEP]
have "card (prime_factors n) = 2"
[PROOF STATE]
proof (prove)
using this:
\<not> 3 \<le> card (prime_factors n)
card (prime_factors n) \<noteq> 0
card (prime_factors n) \<noteq> 1

goal (1 subgoal):
 1. card (prime_factors n) = 2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
card (prime_factors n) = 2

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (prime_factors n) = 2
[PROOF STEP]
obtain p q where pq: "prime_factors n = {p, q}" "p \<noteq> q"
[PROOF STATE]
proof (prove)
using this:
card (prime_factors n) = 2

goal (1 subgoal):
 1. (\<And>p q. \<lbrakk>prime_factors n = {p, q}; p \<noteq> q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: card_Suc_eq numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
prime_factors n = {p, q}
p \<noteq> q

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
hence "prime p" "prime q"
[PROOF STATE]
proof (prove)
using this:
prime_factors n = {p, q}
p \<noteq> q

goal (1 subgoal):
 1. prime p &&& prime q
[PROOF STEP]
by (auto simp: in_prime_factors_iff)
[PROOF STATE]
proof (state)
this:
prime p
prime q

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
have "n = \<Prod>(prime_factors n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = \<Prod>(prime_factors n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n

goal (1 subgoal):
 1. n = \<Prod>(prime_factors n)
[PROOF STEP]
by (subst squarefree_imp_prod_prime_factors_eq)
                   (auto simp: Carmichael_number_imp_squarefree)
[PROOF STATE]
proof (state)
this:
n = \<Prod>(prime_factors n)

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
with pq
[PROOF STATE]
proof (chain)
picking this:
prime_factors n = {p, q}
p \<noteq> q
n = \<Prod>(prime_factors n)
[PROOF STEP]
have n_eq: "n = p * q"
[PROOF STATE]
proof (prove)
using this:
prime_factors n = {p, q}
p \<noteq> q
n = \<Prod>(prime_factors n)

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

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
have "p - 1 dvd n - 1" and "q - 1 dvd n - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p - 1 dvd n - 1 &&& q - 1 dvd n - 1
[PROOF STEP]
using assms pq
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n
prime_factors n = {p, q}
p \<noteq> q

goal (1 subgoal):
 1. p - 1 dvd n - 1 &&& q - 1 dvd n - 1
[PROOF STEP]
unfolding Carmichael_number_iff
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 1 \<and> \<not> prime n \<and> squarefree n \<and> (\<forall>p\<in>#prime_factorization n. p - 1 dvd n - 1)
prime_factors n = {p, q}
p \<noteq> q

goal (1 subgoal):
 1. p - 1 dvd n - 1 &&& q - 1 dvd n - 1
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
p - 1 dvd n - 1
q - 1 dvd n - 1

goal (1 subgoal):
 1. \<not> 3 \<le> card (prime_factors n) \<Longrightarrow> False
[PROOF STEP]
with \<open>prime p\<close> \<open>prime q\<close> \<open>n = p * q\<close> \<open>p \<noteq> q\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
prime q
n = p * q
p \<noteq> q
p - 1 dvd n - 1
q - 1 dvd n - 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
n = p * q
p \<noteq> q
p - 1 dvd n - 1
q - 1 dvd n - 1

goal (1 subgoal):
 1. False
[PROOF STEP]
proof (induction p q rule: linorder_wlog)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case (le p q)
[PROOF STATE]
proof (state)
this:
p \<le> q
prime p
prime q
n = p * q
p \<noteq> q
p - 1 dvd n - 1
q - 1 dvd n - 1

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "p < q"
[PROOF STATE]
proof (prove)
using this:
p \<le> q
prime p
prime q
n = p * q
p \<noteq> q
p - 1 dvd n - 1
q - 1 dvd n - 1

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

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "[q = 1] (mod q - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [q = 1] (mod q - 1)
[PROOF STEP]
using prime_gt_1_nat[of q] \<open>prime q\<close>
[PROOF STATE]
proof (prove)
using this:
prime q \<Longrightarrow> 1 < q
prime q

goal (1 subgoal):
 1. [q = 1] (mod q - 1)
[PROOF STEP]
by (simp add: cong_def le_mod_geq)
[PROOF STATE]
proof (state)
this:
[q = 1] (mod q - 1)

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "[p * q - 1 = p * 1 - 1] (mod q - 1)"
[PROOF STATE]
proof (prove)
using this:
[q = 1] (mod q - 1)

goal (1 subgoal):
 1. [p * q - 1 = p * 1 - 1] (mod q - 1)
[PROOF STEP]
using le prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
[q = 1] (mod q - 1)
p \<le> q
prime p
prime q
n = p * q
p \<noteq> q
p - 1 dvd n - 1
q - 1 dvd n - 1
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. [p * q - 1 = p * 1 - 1] (mod q - 1)
[PROOF STEP]
by (intro cong_diff_nat cong_mult) auto
[PROOF STATE]
proof (state)
this:
[p * q - 1 = p * 1 - 1] (mod q - 1)

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "[p - 1 = n - 1] (mod q - 1)"
[PROOF STATE]
proof (prove)
using this:
[p * q - 1 = p * 1 - 1] (mod q - 1)

goal (1 subgoal):
 1. [p - 1 = n - 1] (mod q - 1)
[PROOF STEP]
by (simp add: \<open>n = p * q\<close> cong_sym_eq)
[PROOF STATE]
proof (state)
this:
[p - 1 = n - 1] (mod q - 1)

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[p - 1 = n - 1] (mod q - 1)

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "[n - 1 = 0] (mod q - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [n - 1 = 0] (mod q - 1)
[PROOF STEP]
using le
[PROOF STATE]
proof (prove)
using this:
p \<le> q
prime p
prime q
n = p * q
p \<noteq> q
p - 1 dvd n - 1
q - 1 dvd n - 1

goal (1 subgoal):
 1. [n - 1 = 0] (mod q - 1)
[PROOF STEP]
by (simp add: cong_def)
[PROOF STATE]
proof (state)
this:
[n - 1 = 0] (mod q - 1)

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[p - 1 = 0] (mod q - 1)
[PROOF STEP]
have "(p - 1) mod (q - 1) = 0"
[PROOF STATE]
proof (prove)
using this:
[p - 1 = 0] (mod q - 1)

goal (1 subgoal):
 1. (p - 1) mod (q - 1) = 0
[PROOF STEP]
by (simp add: cong_def)
[PROOF STATE]
proof (state)
this:
(p - 1) mod (q - 1) = 0

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p - 1) mod (q - 1) = 0

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "(p - 1) mod (q - 1) = p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p - 1) mod (q - 1) = p - 1
[PROOF STEP]
using prime_gt_1_nat[of p] \<open>prime p\<close> \<open>p < q\<close>
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 1 < p
prime p
p < q

goal (1 subgoal):
 1. (p - 1) mod (q - 1) = p - 1
[PROOF STEP]
by (intro mod_less) auto
[PROOF STATE]
proof (state)
this:
(p - 1) mod (q - 1) = p - 1

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
 2. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p - 1 = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
p - 1 = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using prime_gt_1_nat[of p] \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
p - 1 = 0
prime p \<Longrightarrow> 1 < p
prime p

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

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>\<lbrakk>prime b; prime a; n = b * a; b \<noteq> a; b - 1 dvd n - 1; a - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False; prime a; prime b; n = a * b; a \<noteq> b; a - 1 dvd n - 1; b - 1 dvd n - 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
qed (simp_all add: mult.commute)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma split_time_hint1:
  assumes "n = Suc m"
  shows   "split_time s (Suc n) (i + n * i + n) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. split_time s (Suc n) (i + n * i + n) = []
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. split_time s (Suc n) (i + n * i + n) = []
[PROOF STEP]
have sg1:"i + n * i + n = (Suc n) * i + n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + n * i + n = Suc n * i + n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i + n * i + n = Suc n * i + n

goal (1 subgoal):
 1. split_time s (Suc n) (i + n * i + n) = []
[PROOF STEP]
have sg2:"n < Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n < Suc n

goal (1 subgoal):
 1. split_time s (Suc n) (i + n * i + n) = []
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
n = Suc m
[PROOF STEP]
have sg3:"0 < n"
[PROOF STATE]
proof (prove)
using this:
n = Suc m

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. split_time s (Suc n) (i + n * i + n) = []
[PROOF STEP]
from sg2 and sg3
[PROOF STATE]
proof (chain)
picking this:
n < Suc n
0 < n
[PROOF STEP]
have sg4:"split_time s (Suc n) (Suc n * i + n) = []"
[PROOF STATE]
proof (prove)
using this:
n < Suc n
0 < n

goal (1 subgoal):
 1. split_time s (Suc n) (Suc n * i + n) = []
[PROOF STEP]
by (rule split_time_empty)
[PROOF STATE]
proof (state)
this:
split_time s (Suc n) (Suc n * i + n) = []

goal (1 subgoal):
 1. split_time s (Suc n) (i + n * i + n) = []
[PROOF STEP]
from sg1 and sg4
[PROOF STATE]
proof (chain)
picking this:
i + n * i + n = Suc n * i + n
split_time s (Suc n) (Suc n * i + n) = []
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i + n * i + n = Suc n * i + n
split_time s (Suc n) (Suc n * i + n) = []

goal (1 subgoal):
 1. split_time s (Suc n) (i + n * i + n) = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
split_time s (Suc n) (i + n * i + n) = []

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_of_rows_carrier[simp]:
  "mat_of_rows n vs \<in> carrier_mat (length vs) n"
  "dim_row (mat_of_rows n vs) = length vs"
  "dim_col (mat_of_rows n vs) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows n vs \<in> carrier_mat (length vs) n &&& dim_row (mat_of_rows n vs) = length vs &&& dim_col (mat_of_rows n vs) = n
[PROOF STEP]
unfolding mat_of_rows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (length vs) n (\<lambda>(i, y). vs ! i $ y) \<in> carrier_mat (length vs) n &&& dim_row (mat (length vs) n (\<lambda>(i, y). vs ! i $ y)) = length vs &&& dim_col (mat (length vs) n (\<lambda>(i, y). vs ! i $ y)) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma det_col_mul: "det (upd_col M i (c *s a)) = c * det (upd_col M i a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.det (upd_col M i (c *s a)) = c * Square_Matrix.det (upd_col M i a)
[PROOF STEP]
using det_row_mul[of "transpose M" i c a]
[PROOF STATE]
proof (prove)
using this:
Square_Matrix.det (upd_row (Square_Matrix.transpose M) i (c *s a)) = c * Square_Matrix.det (upd_row (Square_Matrix.transpose M) i a)

goal (1 subgoal):
 1. Square_Matrix.det (upd_col M i (c *s a)) = c * Square_Matrix.det (upd_col M i a)
[PROOF STEP]
by (simp add: upd_row_transpose det_transpose)


[STATEMENT]
lemma mat_det_hermitean_real:
  assumes "hermitean A"
  shows "is_real (mat_det A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_real (mat_det A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitean A

goal (1 subgoal):
 1. is_real (mat_det A)
[PROOF STEP]
unfolding hermitean_def
[PROOF STATE]
proof (prove)
using this:
mat_adj A = A

goal (1 subgoal):
 1. is_real (mat_det A)
[PROOF STEP]
by (metis eq_cnj_iff_real mat_det_adj)


[STATEMENT]
lemma linf_norm_vec_vCons[simp]: "\<parallel>vCons a v\<parallel>\<^sub>\<infinity> = max \<bar>a\<bar> \<parallel>v\<parallel>\<^sub>\<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>vCons a v\<parallel>\<^sub>\<infinity> = max \<bar>a\<bar> \<parallel>v\<parallel>\<^sub>\<infinity>
[PROOF STEP]
by (auto simp: linf_norm_vec_def max_list_Cons)


[STATEMENT]
lemma proj_list_5_length:
  assumes "proj_list_5 xs (ys, w, ws, z, zs) = (ys', w', ws', z', zs')"
    "length xs = length ys + 1 + length ws + 1 + length zs"
  shows "length ys = length ys'" "length ws = length ws'"
    "length zs = length zs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys = length ys' &&& length ws = length ws' &&& length zs = length zs'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
proj_list_5 xs (ys, w, ws, z, zs) = (ys', w', ws', z', zs')
length xs = length ys + 1 + length ws + 1 + length zs

goal (1 subgoal):
 1. length ys = length ys' &&& length ws = length ws' &&& length zs = length zs'
[PROOF STEP]
by auto


[STATEMENT]
lemma is_projection_on_iff_orthog:
  \<open>closed_csubspace M \<Longrightarrow> is_projection_on \<pi> M \<longleftrightarrow> (\<forall>h. h - \<pi> h \<in> orthogonal_complement M \<and> \<pi> h \<in> M)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace M \<Longrightarrow> is_projection_on \<pi> M = (\<forall>h. h - \<pi> h \<in> orthogonal_complement M \<and> \<pi> h \<in> M)
[PROOF STEP]
by (simp add: is_projection_on_def smallest_dist_is_ortho)


[STATEMENT]
lemma test_fst_kN:
  "test_fst_k N = 1\<^sub>m N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. test_fst_k N = 1\<^sub>m N
[PROOF STEP]
apply (rule eq_matI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m N); j < dim_col (1\<^sub>m N)\<rbrakk> \<Longrightarrow> test_fst_k N $$ (i, j) = 1\<^sub>m N $$ (i, j)
 2. dim_row (test_fst_k N) = dim_row (1\<^sub>m N)
 3. dim_col (test_fst_k N) = dim_col (1\<^sub>m N)
[PROOF STEP]
unfolding test_fst_k_def
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m N); j < dim_col (1\<^sub>m N)\<rbrakk> \<Longrightarrow> mat N N (\<lambda>(i, j). if i = j \<and> i < N then 1 else 0) $$ (i, j) = 1\<^sub>m N $$ (i, j)
 2. dim_row (mat N N (\<lambda>(i, j). if i = j \<and> i < N then 1 else 0)) = dim_row (1\<^sub>m N)
 3. dim_col (mat N N (\<lambda>(i, j). if i = j \<and> i < N then 1 else 0)) = dim_col (1\<^sub>m N)
[PROOF STEP]
by auto


[STATEMENT]
lemma resultant_smult_right: assumes "(c :: 'a :: idom) \<noteq> 0"
  shows "resultant f (smult c g) = c ^ degree f * resultant f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant f (Polynomial.smult c g) = c ^ degree f * resultant f g
[PROOF STEP]
unfolding coeff_subresultant_0_0_resultant[symmetric] subresultant_smult_right[OF assms] coeff_smult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c ^ (degree f - 0) * coeff (subresultant 0 f g) 0 = c ^ degree f * coeff (subresultant 0 f g) 0
[PROOF STEP]
by simp


[STATEMENT]
lemma cut_less_inext_nth_card_eq2: "
  \<lbrakk> finite I; card I \<le> Suc n \<rbrakk> \<Longrightarrow> card (I \<down>< (I \<rightarrow> n)) = card I - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; card I \<le> Suc n\<rbrakk> \<Longrightarrow> card (I \<down>< (I \<rightarrow> n)) = card I - Suc 0
[PROOF STEP]
apply (case_tac "I = {}", simp add: cut_less_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; card I \<le> Suc n; I \<noteq> {}\<rbrakk> \<Longrightarrow> card (I \<down>< (I \<rightarrow> n)) = card I - Suc 0
[PROOF STEP]
apply (simp add: inext_nth_card_Max cut_less_Max_eq_Diff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sqrt_tc: "VARS r
  [0 \<le> (x::int)]
  r := 0;
  WHILE (r+1)*(r+1) <= x
  INV {r*r \<le> x}
  VAR { nat (x-r)}
  DO r := r+1 OD
  [r*r \<le> x \<and> x < (r+1)*(r+1)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0 \<le> x]
r := 0; WHILE (r + 1) * (r + 1) \<le> x INV {r * r \<le> x}  VAR {nat (x - r)}
DO r := r + 1 OD
[r * r \<le> x \<and> x < (r + 1) * (r + 1)]
[PROOF STEP]
apply vcg_tc_simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r. r * r \<le> x \<and> (r + 1) * (r + 1) \<le> x \<Longrightarrow> r < x
[PROOF STEP]
by (smt (verit) div_pos_pos_trivial mult_less_0_iff nonzero_mult_div_cancel_left)


[STATEMENT]
lemma us_IInf_inv: "us \<circ> IInf = (id::'a::complete_lattice_with_dual upset \<Rightarrow> 'a upset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. us \<circ> IInf = id
[PROOF STEP]
unfolding us_def IInf_def fun_eq_iff id_def comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. Abs_upset (\<up> (\<Sqinter> Rep_upset x)) = x
[PROOF STEP]
by (metis (no_types, lifting) Inf_upset_id Rep_upset Rep_upset_inverse f_the_inv_into_f pointfree_idE upset_inj)


[STATEMENT]
lemma concat_same_lengths_nth:
  assumes "\<And>xs. xs \<in> set XS \<Longrightarrow> length xs = N"
  assumes "i < length XS * N" "N > 0"
  shows "concat XS ! i = XS ! (i div N) ! (i mod N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat XS ! i = XS ! (i div N) ! (i mod N)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set XS \<Longrightarrow> length ?xs = N
i < length XS * N
0 < N

goal (1 subgoal):
 1. concat XS ! i = XS ! (i div N) ! (i mod N)
[PROOF STEP]
by (induction XS arbitrary: i)
  (auto simp: nth_append nth_Cons div_eq_0_iff le_div_geq le_mod_geq split: nat.splits)


[STATEMENT]
lemma primorial_pos [simp, intro]: "primorial x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < primorial x
[PROOF STEP]
unfolding primorial_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<Prod>{p. prime p \<and> real p \<le> x}
[PROOF STEP]
by (intro prod_pos) (auto dest: prime_gt_0_nat)


[STATEMENT]
lemma continuous_matpow: "continuous_on R (\<lambda> A :: 'a :: {semiring_1, real_normed_algebra_1} ^ 'n ^ 'n. matpow A n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on R (\<lambda>A. matpow A n)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>R. ((\<lambda>A. matpow A n) \<longlongrightarrow> matpow x n) (at x within R)
[PROOF STEP]
by (auto intro!: tendsto_intros)


[STATEMENT]
lemma det_single: assumes "A \<in> carrier_mat 1 1"
  shows "det A = A $$ (0,0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = A $$ (0, 0)
[PROOF STEP]
by (subst det_upper_triangular[of _ 1], insert assms, auto simp: diag_mat_def)


[STATEMENT]
lemma exp_bound_half: "norm z \<le> 1/2 \<Longrightarrow> norm (exp z) \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm z \<le> 1 / 2 \<Longrightarrow> norm (exp z) \<le> 2
[PROOF STEP]
by (blast intro: order_trans intro!: exp_half_le2 norm_exp)


[STATEMENT]
lemma finite_enumerate:
  assumes fS: "finite S"
  shows "\<exists>r::nat\<Rightarrow>nat. strict_mono_on {..<card S} r \<and> (\<forall>n<card S. r n \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. strict_mono_on {..<card S} r \<and> (\<forall>n<card S. r n \<in> S)
[PROOF STEP]
unfolding strict_mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. strict_mono_on {..<card S} r \<and> (\<forall>n<card S. r n \<in> S)
[PROOF STEP]
using finite_enumerate_in_set[OF fS] finite_enumerate_mono[of _ _ S] fS
[PROOF STATE]
proof (prove)
using this:
?n < card S \<Longrightarrow> wellorder_class.enumerate S ?n \<in> S
\<lbrakk>?m < ?n; finite S; ?n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S ?m < wellorder_class.enumerate S ?n
finite S

goal (1 subgoal):
 1. \<exists>r. strict_mono_on {..<card S} r \<and> (\<forall>n<card S. r n \<in> S)
[PROOF STEP]
by (metis lessThan_iff strict_mono_on_def)