[STATEMENT]
lemma adjoint_mult:
  fixes A B :: "'a::conjugatable_field mat"
  assumes "A \<in> carrier_mat n m" "B \<in> carrier_mat m l"
  shows "adjoint (A * B) = adjoint B * adjoint A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (A * B) = adjoint B * adjoint A
[PROOF STEP]
proof (rule eq_matI, auto simp add: adjoint_eval adjoint_row adjoint_col)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col B; j < dim_row A\<rbrakk> \<Longrightarrow> conjugate (row A j \<bullet> col B i) = inner_prod (row A j) (conjugate (col B i))
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col B; j < dim_row A\<rbrakk> \<Longrightarrow> conjugate (row A j \<bullet> col B i) = inner_prod (row A j) (conjugate (col B i))
[PROOF STEP]
assume "i < dim_col B" "j < dim_row A"
[PROOF STATE]
proof (state)
this:
i < dim_col B
j < dim_row A

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col B; j < dim_row A\<rbrakk> \<Longrightarrow> conjugate (row A j \<bullet> col B i) = inner_prod (row A j) (conjugate (col B i))
[PROOF STEP]
show "conjugate (row A j \<bullet> col B i) = conjugate (col B i) \<bullet> conjugate (row A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (row A j \<bullet> col B i) = inner_prod (row A j) (conjugate (col B i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m
B \<in> carrier_mat m l

goal (1 subgoal):
 1. conjugate (row A j \<bullet> col B i) = inner_prod (row A j) (conjugate (col B i))
[PROOF STEP]
apply (simp add: conjugate_scalar_prod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat n m; B \<in> carrier_mat m l\<rbrakk> \<Longrightarrow> inner_prod (col B i) (conjugate (row A j)) = inner_prod (row A j) (conjugate (col B i))
[PROOF STEP]
apply (subst comm_scalar_prod[where n="dim_row B"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>A \<in> carrier_mat n m; B \<in> carrier_mat m l\<rbrakk> \<Longrightarrow> conjugate (row A j) \<in> carrier_vec (dim_row B)
 2. \<lbrakk>A \<in> carrier_mat n m; B \<in> carrier_mat m l\<rbrakk> \<Longrightarrow> conjugate (col B i) \<in> carrier_vec (dim_row B)
 3. \<lbrakk>A \<in> carrier_mat n m; B \<in> carrier_mat m l\<rbrakk> \<Longrightarrow> inner_prod (row A j) (conjugate (col B i)) = inner_prod (row A j) (conjugate (col B i))
[PROOF STEP]
by (auto simp add: carrier_vecI)
[PROOF STATE]
proof (state)
this:
conjugate (row A j \<bullet> col B i) = inner_prod (row A j) (conjugate (col B i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma icard_empty_iff: "(icard A = 0) = (A = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (icard A = 0) = (A = {})
[PROOF STEP]
apply (unfold zero_enat_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (icard A = enat 0) = (A = {})
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. icard A = enat 0 \<Longrightarrow> A = {}
 2. A = {} \<Longrightarrow> icard A = enat 0
[PROOF STEP]
apply (frule icard_eq_enat_imp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>icard A = enat 0; finite A\<rbrakk> \<Longrightarrow> A = {}
 2. A = {} \<Longrightarrow> icard A = enat 0
[PROOF STEP]
apply (simp add: icard_finite)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = {} \<Longrightarrow> icard A = enat 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fib_asymptotics:
  fixes \<phi> :: real
  defines "\<phi> \<equiv> (1 + sqrt 5) / 2"
  shows "(\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
define \<psi> :: real where "\<psi> \<equiv> (1 - sqrt 5) / 2"
[PROOF STATE]
proof (state)
this:
\<psi> \<equiv> (1 - sqrt 5) / 2

goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
have "\<phi> > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < \<phi>
[PROOF STEP]
by (simp add: \<phi>_def)
[PROOF STATE]
proof (state)
this:
1 < \<phi>

goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < \<phi>
[PROOF STEP]
have *: "\<phi> \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
1 < \<phi>

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

goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
have "(\<lambda>n. (\<psi> / \<phi>) ^ n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (^) (\<psi> / \<phi>) \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule LIMSEQ_power_zero) (simp_all add: \<phi>_def \<psi>_def field_simps add_pos_pos)
[PROOF STATE]
proof (state)
this:
(^) (\<psi> / \<phi>) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(^) (\<psi> / \<phi>) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. 1 - (\<psi> / \<phi>) ^ n) \<longlonglongrightarrow> 1 - 0"
[PROOF STATE]
proof (prove)
using this:
(^) (\<psi> / \<phi>) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. 1 - (\<psi> / \<phi>) ^ n) \<longlonglongrightarrow> 1 - 0
[PROOF STEP]
by (intro tendsto_diff tendsto_const)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 - (\<psi> / \<phi>) ^ n) \<longlonglongrightarrow> 1 - 0

goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
\<phi> \<noteq> 0
(\<lambda>n. 1 - (\<psi> / \<phi>) ^ n) \<longlonglongrightarrow> 1 - 0
[PROOF STEP]
have "(\<lambda>n. (\<phi> ^ n - \<psi> ^ n) / \<phi> ^ n) \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
using this:
\<phi> \<noteq> 0
(\<lambda>n. 1 - (\<psi> / \<phi>) ^ n) \<longlonglongrightarrow> 1 - 0

goal (1 subgoal):
 1. (\<lambda>n. (\<phi> ^ n - \<psi> ^ n) / \<phi> ^ n) \<longlonglongrightarrow> 1
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<phi> ^ n - \<psi> ^ n) / \<phi> ^ n) \<longlonglongrightarrow> 1

goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (\<phi> ^ n - \<psi> ^ n) / \<phi> ^ n) \<longlonglongrightarrow> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (\<phi> ^ n - \<psi> ^ n) / \<phi> ^ n) \<longlonglongrightarrow> 1

goal (1 subgoal):
 1. (\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1
[PROOF STEP]
by (simp add: fib_closed_form \<phi>_def \<psi>_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real (fib n) / (\<phi> ^ n / sqrt 5)) \<longlonglongrightarrow> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arctan_series':
  assumes "\<bar>x\<bar> \<le> 1"
  shows "(\<lambda>k. (-1)^k * (1 / real (k*2+1) * x ^ (k*2+1))) sums arctan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) sums arctan x
[PROOF STEP]
using summable_arctan_series[OF assms] arctan_series[OF assms]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))

goal (1 subgoal):
 1. (\<lambda>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) sums arctan x
[PROOF STEP]
by (simp add: sums_iff)


[STATEMENT]
lemma cbox_complex_of_real: "cbox (complex_of_real x) (complex_of_real y) = complex_of_real ` {x..y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox (complex_of_real x) (complex_of_real y) = complex_of_real ` {x..y}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cbox (complex_of_real x) (complex_of_real y) = complex_of_real ` {x..y}
[PROOF STEP]
have "(x \<le> Re z \<and> Re z \<le> y \<and> Im z = 0) = (z \<in> complex_of_real ` {x..y})" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> Re z \<and> Re z \<le> y \<and> Im z = 0) = (z \<in> complex_of_real ` {x..y})
[PROOF STEP]
by (cases z) (simp add: complex_eq_cancel_iff2 image_iff)
[PROOF STATE]
proof (state)
this:
(x \<le> Re ?z \<and> Re ?z \<le> y \<and> Im ?z = 0) = (?z \<in> complex_of_real ` {x..y})

goal (1 subgoal):
 1. cbox (complex_of_real x) (complex_of_real y) = complex_of_real ` {x..y}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x \<le> Re ?z \<and> Re ?z \<le> y \<and> Im ?z = 0) = (?z \<in> complex_of_real ` {x..y})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x \<le> Re ?z \<and> Re ?z \<le> y \<and> Im ?z = 0) = (?z \<in> complex_of_real ` {x..y})

goal (1 subgoal):
 1. cbox (complex_of_real x) (complex_of_real y) = complex_of_real ` {x..y}
[PROOF STEP]
by (auto simp: in_cbox_complex_iff)
[PROOF STATE]
proof (state)
this:
cbox (complex_of_real x) (complex_of_real y) = complex_of_real ` {x..y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_mono_plus:
  assumes "finite (range (f::_\<Rightarrow>_::ordered_ab_semigroup_add))"
          "finite (range g)"
  shows "(MAX x. f x + g x) \<le> (MAX x. f x) + (MAX x. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
obtain xmax where xmax_def: "f xmax + g xmax = (MAX x. f x + g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xmax. f xmax + g xmax = (MAX x. f x + g x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_range_plus[OF assms] Max_in
[PROOF STATE]
proof (prove)
using this:
finite (range (\<lambda>x. f x + g x))
\<lbrakk>finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> Max ?A \<in> ?A

goal (1 subgoal):
 1. (\<And>xmax. f xmax + g xmax = (MAX x. f x + g x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f xmax + g xmax = (MAX x. f x + g x)

goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
have "(MAX x. f x + g x) = f xmax + g xmax"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MAX x. f x + g x) = f xmax + g xmax
[PROOF STEP]
using xmax_def
[PROOF STATE]
proof (prove)
using this:
f xmax + g xmax = (MAX x. f x + g x)

goal (1 subgoal):
 1. (MAX x. f x + g x) = f xmax + g xmax
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(MAX x. f x + g x) = f xmax + g xmax

goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(MAX x. f x + g x) = f xmax + g xmax

goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
have "\<dots> \<le> (MAX x. f x) + g xmax"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f xmax + g xmax \<le> Max (range f) + g xmax
[PROOF STEP]
using Max_ge[OF assms(1), of "f xmax"]
[PROOF STATE]
proof (prove)
using this:
f xmax \<in> range f \<Longrightarrow> f xmax \<le> Max (range f)

goal (1 subgoal):
 1. f xmax + g xmax \<le> Max (range f) + g xmax
[PROOF STEP]
by (auto simp add: add_right_mono[of "f xmax"])
[PROOF STATE]
proof (state)
this:
f xmax + g xmax \<le> Max (range f) + g xmax

goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f xmax + g xmax \<le> Max (range f) + g xmax

goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
have "\<dots> \<le> (MAX x. f x) + (MAX x. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (range f) + g xmax \<le> Max (range f) + Max (range g)
[PROOF STEP]
using Max_ge[OF assms(2), of "g xmax"]
[PROOF STATE]
proof (prove)
using this:
g xmax \<in> range g \<Longrightarrow> g xmax \<le> Max (range g)

goal (1 subgoal):
 1. Max (range f) + g xmax \<le> Max (range f) + Max (range g)
[PROOF STEP]
by (auto simp add: add_left_mono[of "g xmax"])
[PROOF STATE]
proof (state)
this:
Max (range f) + g xmax \<le> Max (range f) + Max (range g)

goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(MAX x. f x + g x) \<le> Max (range f) + Max (range g)

goal (1 subgoal):
 1. (MAX x. f x + g x) \<le> Max (range f) + Max (range g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(MAX x. f x + g x) \<le> Max (range f) + Max (range g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem weak_conv_imp_integral_bdd_continuous_conv:
  fixes f :: "real \<Rightarrow> 'a::{banach, second_countable_topology}"
  assumes
    "\<And>x. isCont f x" and
    "\<And>x. norm (f x) \<le> B"
  shows
    "(\<lambda> n. integral\<^sup>L (\<mu> n) f) \<longlonglongrightarrow> integral\<^sup>L M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. integral\<^sup>L (\<mu> n) f) \<longlonglongrightarrow> integral\<^sup>L M f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isCont f ?x
norm (f ?x) \<le> B

goal (1 subgoal):
 1. (\<lambda>n. integral\<^sup>L (\<mu> n) f) \<longlonglongrightarrow> integral\<^sup>L M f
[PROOF STEP]
by (intro weak_conv_imp_bdd_ae_continuous_conv)
     (auto intro!: borel_measurable_continuous_onI continuous_at_imp_continuous_on)


[STATEMENT]
lemma mat_kernelI: assumes "A \<in> carrier_mat nr nc" "v \<in> carrier_vec nc" "A *\<^sub>v v = 0\<^sub>v nr"
  shows "v \<in> mat_kernel A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> mat_kernel A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
v \<in> carrier_vec nc
A *\<^sub>v v = 0\<^sub>v nr

goal (1 subgoal):
 1. v \<in> mat_kernel A
[PROOF STEP]
unfolding mat_kernel_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
v \<in> carrier_vec nc
A *\<^sub>v v = 0\<^sub>v nr

goal (1 subgoal):
 1. v \<in> {v \<in> carrier_vec (dim_col A). A *\<^sub>v v = 0\<^sub>v (dim_row A)}
[PROOF STEP]
by auto


[STATEMENT]
lemma sums_stieltjes_gamma:
  "(\<lambda>k. ln (k+1) ^ n / (k+1) - (ln (k+2) ^ (n+1) - ln (k+1) ^ (n + 1)) / (n + 1))
     sums stieltjes_gamma n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. ln (real (k + 1)) ^ n / real (k + 1) - (ln (real (k + 2)) ^ (n + 1) - ln (real (k + 1)) ^ (n + 1)) / (real n + 1)) sums stieltjes_gamma n
[PROOF STEP]
using stieltjes_gamma_summable[of n]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. ln (real (k + 1)) ^ n / real (k + 1) - (ln (real (k + 2)) ^ (n + 1) - ln (real (k + 1)) ^ (n + 1)) / (real n + 1))

goal (1 subgoal):
 1. (\<lambda>k. ln (real (k + 1)) ^ n / real (k + 1) - (ln (real (k + 2)) ^ (n + 1) - ln (real (k + 1)) ^ (n + 1)) / (real n + 1)) sums stieltjes_gamma n
[PROOF STEP]
unfolding stieltjes_gamma_def
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. ln (real (k + 1)) ^ n / real (k + 1) - (ln (real (k + 2)) ^ (n + 1) - ln (real (k + 1)) ^ (n + 1)) / (real n + 1))

goal (1 subgoal):
 1. (\<lambda>k. ln (real (k + 1)) ^ n / real (k + 1) - (ln (real (k + 2)) ^ (n + 1) - ln (real (k + 1)) ^ (n + 1)) / (real n + 1)) sums of_real (\<Sum>k. ln (real (k + 1)) ^ n / real (k + 1) - (ln (real (k + 2)) ^ (n + 1) - ln (real (k + 1)) ^ (n + 1)) / (real n + 1))
[PROOF STEP]
by (simp add: summable_sums)


[STATEMENT]
lemma disjointify_union:
  assumes "finite As"
  shows "\<Union> (disjointify As)  = \<Union> As"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (disjointify As) = \<Union> As
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite As

goal (1 subgoal):
 1. \<Union> (disjointify As) = \<Union> As
[PROOF STEP]
by (simp add: disjointify_def enumerate_enumerates rec_disjointify_finite_set)


[STATEMENT]
lemma (in ccpo) Sup_image_mono:
  assumes ccpo: "class.ccpo luba orda lessa"
  and mono: "monotone orda (\<le>) f"
  and chain: "Complete_Partial_Order.chain orda A"
  and "A \<noteq> {}"
  shows "Sup (f ` A) \<le> (f (luba A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (f ` A) \<le> f (luba A)
[PROOF STEP]
proof(rule ccpo_Sup_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Complete_Partial_Order.chain (\<le>) (f ` A)
 2. \<And>x. x \<in> f ` A \<Longrightarrow> x \<le> f (luba A)
[PROOF STEP]
from chain
[PROOF STATE]
proof (chain)
picking this:
Complete_Partial_Order.chain orda A
[PROOF STEP]
show "Complete_Partial_Order.chain (\<le>) (f ` A)"
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain orda A

goal (1 subgoal):
 1. Complete_Partial_Order.chain (\<le>) (f ` A)
[PROOF STEP]
by(rule chain_imageI)(rule monotoneD[OF mono])
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (\<le>) (f ` A)

goal (1 subgoal):
 1. \<And>x. x \<in> f ` A \<Longrightarrow> x \<le> f (luba A)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> f ` A \<Longrightarrow> x \<le> f (luba A)
[PROOF STEP]
assume "x \<in> f ` A"
[PROOF STATE]
proof (state)
this:
x \<in> f ` A

goal (1 subgoal):
 1. \<And>x. x \<in> f ` A \<Longrightarrow> x \<le> f (luba A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> f ` A
[PROOF STEP]
obtain y where "x = f y" "y \<in> A"
[PROOF STATE]
proof (prove)
using this:
x \<in> f ` A

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

goal (1 subgoal):
 1. \<And>x. x \<in> f ` A \<Longrightarrow> x \<le> f (luba A)
[PROOF STEP]
from \<open>y \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
y \<in> A
[PROOF STEP]
have "orda y (luba A)"
[PROOF STATE]
proof (prove)
using this:
y \<in> A

goal (1 subgoal):
 1. orda y (luba A)
[PROOF STEP]
by(rule ccpo.ccpo_Sup_upper[OF ccpo chain])
[PROOF STATE]
proof (state)
this:
orda y (luba A)

goal (1 subgoal):
 1. \<And>x. x \<in> f ` A \<Longrightarrow> x \<le> f (luba A)
[PROOF STEP]
hence "f y \<le> f (luba A)"
[PROOF STATE]
proof (prove)
using this:
orda y (luba A)

goal (1 subgoal):
 1. f y \<le> f (luba A)
[PROOF STEP]
by(rule monotoneD[OF mono])
[PROOF STATE]
proof (state)
this:
f y \<le> f (luba A)

goal (1 subgoal):
 1. \<And>x. x \<in> f ` A \<Longrightarrow> x \<le> f (luba A)
[PROOF STEP]
thus "x \<le> f (luba A)"
[PROOF STATE]
proof (prove)
using this:
f y \<le> f (luba A)

goal (1 subgoal):
 1. x \<le> f (luba A)
[PROOF STEP]
using \<open>x = f y\<close>
[PROOF STATE]
proof (prove)
using this:
f y \<le> f (luba A)
x = f y

goal (1 subgoal):
 1. x \<le> f (luba A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<le> f (luba A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "(a::int) ^ 4 - b ^ 4 = (a - b) * (a + b) * (a ^ 2 + b ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ 4 - b ^ 4 = (a - b) * (a + b) * (a\<^sup>2 + b\<^sup>2)
[PROOF STEP]
by ring


[STATEMENT]
lemma fib_plus_2: "fib (n + 2) = fib (n + 1) + fib n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (n + 2) = fib (n + 1) + fib n
[PROOF STEP]
by (metis Suc_eq_plus1 add_2_eq_Suc' fib.simps(3))


[STATEMENT]
lemma trace_measure2_id:
  assumes dM0: "M0 \<in> carrier_mat n n" and dM1: "M1 \<in> carrier_mat n n"
    and id: "adjoint M0 * M0 + adjoint M1 * M1 = 1\<^sub>m n"
    and dA: "A \<in> carrier_mat n n"
  shows "trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
have "trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace ((adjoint M0 * M0 + adjoint M1 * M1) * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace ((adjoint M0 * M0 + adjoint M1 * M1) * A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M0 \<in> carrier_mat n n
M1 \<in> carrier_mat n n
adjoint M0 * M0 + adjoint M1 * M1 = 1\<^sub>m n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace ((adjoint M0 * M0 + adjoint M1 * M1) * A)
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace ((adjoint M0 * M0 + adjoint M1 * M1) * A)

goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace ((adjoint M0 * M0 + adjoint M1 * M1) * A)

goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
have "\<dots> = trace (1\<^sub>m n * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace ((adjoint M0 * M0 + adjoint M1 * M1) * A) = trace (1\<^sub>m n * A)
[PROOF STEP]
using id
[PROOF STATE]
proof (prove)
using this:
adjoint M0 * M0 + adjoint M1 * M1 = 1\<^sub>m n

goal (1 subgoal):
 1. trace ((adjoint M0 * M0 + adjoint M1 * M1) * A) = trace (1\<^sub>m n * A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace ((adjoint M0 * M0 + adjoint M1 * M1) * A) = trace (1\<^sub>m n * A)

goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace ((adjoint M0 * M0 + adjoint M1 * M1) * A) = trace (1\<^sub>m n * A)

goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
have "\<dots> = trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (1\<^sub>m n * A) = trace A
[PROOF STEP]
using dA
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (1\<^sub>m n * A) = trace A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (1\<^sub>m n * A) = trace A

goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A

goal (1 subgoal):
 1. trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
trace (M0 * A * adjoint M0) + trace (M1 * A * adjoint M1) = trace A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Suc_0_mod_eq_Suc_0_iff:
  "Suc 0 mod n = Suc 0 \<longleftrightarrow> n \<noteq> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc 0 mod n = Suc 0) = (n \<noteq> Suc 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Suc 0 mod n = Suc 0) = (n \<noteq> Suc 0)
[PROOF STEP]
consider "n = 0" | "n = Suc 0" | "n > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n = 0 \<Longrightarrow> thesis; n = Suc 0 \<Longrightarrow> thesis; 1 < n \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by (cases n) auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = 0 \<Longrightarrow> ?thesis; n = Suc 0 \<Longrightarrow> ?thesis; 1 < n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (Suc 0 mod n = Suc 0) = (n \<noteq> Suc 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = 0 \<Longrightarrow> ?thesis; n = Suc 0 \<Longrightarrow> ?thesis; 1 < n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (Suc 0 mod n = Suc 0) = (n \<noteq> Suc 0)
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
(Suc 0 mod n = Suc 0) = (n \<noteq> Suc 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_zero [simp]: "\<lfloor>0\<rfloor> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>0::'a\<rfloor> = 0
[PROOF STEP]
using floor_of_int [of 0]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_int 0\<rfloor> = 0

goal (1 subgoal):
 1. \<lfloor>0::'a\<rfloor> = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma dfa_accepts_negate:
  assumes "wf_dfa A n"
  and "list_all (is_alph n) bss"
  shows "dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)
[PROOF STEP]
have "dfa_steps (negate_dfa A) 0 bss = dfa_steps A 0 bss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dfa_steps (negate_dfa A) 0 bss = dfa_steps A 0 bss
[PROOF STEP]
by (simp add: negate_dfa_def dfa_trans_def [abs_def] split_beta)
[PROOF STATE]
proof (state)
this:
dfa_steps (negate_dfa A) 0 bss = dfa_steps A 0 bss

goal (1 subgoal):
 1. dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dfa_steps (negate_dfa A) 0 bss = dfa_steps A 0 bss

goal (1 subgoal):
 1. dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
wf_dfa A n
list_all (is_alph n) bss
[PROOF STEP]
have "dfa_is_node A (dfa_steps A 0 bss)"
[PROOF STATE]
proof (prove)
using this:
wf_dfa A n
list_all (is_alph n) bss

goal (1 subgoal):
 1. dfa_is_node A (dfa_steps A 0 bss)
[PROOF STEP]
by (simp add: dfa_steps_is_node dfa_startnode_is_node)
[PROOF STATE]
proof (state)
this:
dfa_is_node A (dfa_steps A 0 bss)

goal (1 subgoal):
 1. dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dfa_steps (negate_dfa A) 0 bss = dfa_steps A 0 bss
dfa_is_node A (dfa_steps A 0 bss)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dfa_steps (negate_dfa A) 0 bss = dfa_steps A 0 bss
dfa_is_node A (dfa_steps A 0 bss)

goal (1 subgoal):
 1. dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dfa_steps (negate_dfa A) 0 bss = dfa_steps A 0 bss
dfa_is_node A (dfa_steps A 0 bss)
wf_dfa A n
list_all (is_alph n) bss

goal (1 subgoal):
 1. dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)
[PROOF STEP]
by (simp add: accepts_def dfa_accepting_def wf_dfa_def dfa_is_node_def negate_dfa_def split_beta)
[PROOF STATE]
proof (state)
this:
dfa_accepts (negate_dfa A) bss = (\<not> dfa_accepts A bss)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_identical_cols:
  assumes A: "A \<in> carrier_mat n n"
    and ij: "i \<noteq> j"
    and i: "i < n" and j: "j < n"
    and r: "col A i = col A j"
  shows "det A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (0::'a)
[PROOF STEP]
using det_identical_rows det_transpose
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?i \<noteq> ?j; ?i < ?n; ?j < ?n; row ?A ?i = row ?A ?j\<rbrakk> \<Longrightarrow> det ?A = (0::?'a)
?A \<in> carrier_mat ?n ?n \<Longrightarrow> det ?A\<^sup>T = det ?A

goal (1 subgoal):
 1. det A = (0::'a)
[PROOF STEP]
by (metis A i ij j carrier_matD(2) transpose_carrier_mat r row_transpose)


[STATEMENT]
lemma DERIV_inverse_fun:
  "(f has_field_derivative d) (at x within s) \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow>
    ((\<lambda>x. inverse (f x)) has_field_derivative (- (d * inverse(f x ^ Suc (Suc 0))))) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative d) (at x within s); f x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. inverse (f x)) has_field_derivative - (d * inverse (f x ^ Suc (Suc 0)))) (at x within s)
[PROOF STEP]
by (drule (1) DERIV_inverse') (simp add: ac_simps nonzero_inverse_mult_distrib)


[STATEMENT]
lemma mono_gfp_eqI:
  assumes MONO: "mono f"
  assumes FIXP: "a \<le> f a"
  assumes GREATEST: "\<And>x. f x = x \<Longrightarrow> x\<le>a"
  shows "gfp f = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gfp f = a
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. gfp f \<le> a
 2. a \<le> gfp f
[PROOF STEP]
apply (metis GREATEST MONO gfp_unfold)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> gfp f
[PROOF STEP]
apply (rule gfp_upperbound)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> f a
[PROOF STEP]
apply (rule FIXP)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma card_complex_roots_unity_explicit:
     "card {exp(2 * of_real pi * \<i> * of_nat j / of_nat n) | j::nat. j < n} = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {exp (2 * complex_of_real pi * \<i> * of_nat j / of_nat n) |j. j < n} = n
[PROOF STEP]
by (simp add:  Finite_Set.bij_betw_same_card [OF bij_betw_roots_unity, symmetric])


[STATEMENT]
lemma ce_rel_lm_36: "ce_set_to_rel (A \<union> B) = (ce_set_to_rel A) \<union> (ce_set_to_rel B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ce_set_to_rel (A \<union> B) = ce_set_to_rel A \<union> ce_set_to_rel B
[PROOF STEP]
by (unfold ce_set_to_rel_def, auto)


[STATEMENT]
lemma sum_list_mono2: fixes xs :: "'a ::ordered_comm_monoid_add list"
shows "\<lbrakk> length xs = length ys; \<And>i. i < length xs \<longrightarrow> xs!i \<le> ys!i \<rbrakk>
  \<Longrightarrow> sum_list xs \<le> sum_list ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>i. i < length xs \<longrightarrow> xs ! i \<le> ys ! i\<rbrakk> \<Longrightarrow> sum_list xs \<le> sum_list ys
[PROOF STEP]
apply(induction xs ys rule: list_induct2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>i. i < length [] \<longrightarrow> [] ! i \<le> [] ! i) \<Longrightarrow> sum_list [] \<le> sum_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; (\<And>i. i < length xs \<longrightarrow> xs ! i \<le> ys ! i) \<Longrightarrow> sum_list xs \<le> sum_list ys; \<And>i. i < length (x # xs) \<longrightarrow> (x # xs) ! i \<le> (y # ys) ! i\<rbrakk> \<Longrightarrow> sum_list (x # xs) \<le> sum_list (y # ys)
[PROOF STEP]
by(auto simp: nth_Cons' less_Suc_eq_0_disj imp_ex add_mono)


[STATEMENT]
lemma INT_Un_Compl_subset:
     "(\<Inter>i \<in> lessThan n. -A i \<union> A (Suc i))  \<subseteq>
      (\<Inter>i \<in> lessThan n. -A i) \<union> A n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>i<n. - A i \<union> A (Suc i)) \<subseteq> (\<Inter>i<n. - A i) \<union> A n
[PROOF STEP]
by (induct n) (auto simp: lessThan_Suc)


[STATEMENT]
lemma vectorize_plus: "vectorize_poly (p + q) = vectorize_poly p + vectorize_poly q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorize_poly (p + q) = vectorize_poly p + vectorize_poly q
[PROOF STEP]
by (rule poly_mapping_eqI, simp add: lookup_vectorize_poly lookup_add proj_plus)


[STATEMENT]
lemma exp_times_self_strict_mono:
  assumes "x \<ge> -1" "x < (y :: real)"
  shows   "x * exp x < y * exp y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * exp x < y * exp y
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
x < y

goal (1 subgoal):
 1. x * exp x < y * exp y
[PROOF STEP]
proof (rule DERIV_pos_imp_increasing_open)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>x < xa; xa < y\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at xa) \<and> 0 < y
 2. continuous_on {x..y} (\<lambda>a. a * exp a)
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>x < xa; xa < y\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at xa) \<and> 0 < y
 2. continuous_on {x..y} (\<lambda>a. a * exp a)
[PROOF STEP]
assume t: "x < t" "t < y"
[PROOF STATE]
proof (state)
this:
x < t
t < y

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>x < xa; xa < y\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at xa) \<and> 0 < y
 2. continuous_on {x..y} (\<lambda>a. a * exp a)
[PROOF STEP]
have "((\<lambda>x. x * exp x) has_real_derivative (t + 1) * exp t) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x * exp x) has_real_derivative (t + 1) * exp t) (at t)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x * exp x) has_real_derivative (t + 1) * exp t) (at t)

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>x < xa; xa < y\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at xa) \<and> 0 < y
 2. continuous_on {x..y} (\<lambda>a. a * exp a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x * exp x) has_real_derivative (t + 1) * exp t) (at t)

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>x < xa; xa < y\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at xa) \<and> 0 < y
 2. continuous_on {x..y} (\<lambda>a. a * exp a)
[PROOF STEP]
have "(t + 1) * exp t > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (t + 1) * exp t
[PROOF STEP]
using t assms
[PROOF STATE]
proof (prove)
using this:
x < t
t < y
- 1 \<le> x
x < y

goal (1 subgoal):
 1. 0 < (t + 1) * exp t
[PROOF STEP]
by (intro mult_pos_pos) auto
[PROOF STATE]
proof (state)
this:
0 < (t + 1) * exp t

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>x < xa; xa < y\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at xa) \<and> 0 < y
 2. continuous_on {x..y} (\<lambda>a. a * exp a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. x * exp x) has_real_derivative (t + 1) * exp t) (at t)
0 < (t + 1) * exp t
[PROOF STEP]
show "\<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at t) \<and> 0 < y"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x * exp x) has_real_derivative (t + 1) * exp t) (at t)
0 < (t + 1) * exp t

goal (1 subgoal):
 1. \<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at t) \<and> 0 < y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>y. ((\<lambda>a. a * exp a) has_real_derivative y) (at t) \<and> 0 < y

goal (1 subgoal):
 1. continuous_on {x..y} (\<lambda>a. a * exp a)
[PROOF STEP]
qed (auto intro!: continuous_intros)


[STATEMENT]
lemma mat_mult_invertible_lattice_eq:
  assumes fs: "set fs \<subseteq> carrier_vec n"
  and gs: "set gs \<subseteq> carrier_vec n"
  and P: "P \<in> carrier_mat m m" and invertible_P: "invertible_mat P"
  and length_fs: "length fs = m" and length_gs: "length gs = m"
  and prod: "mat_of_rows n fs = (map_mat of_int P) * mat_of_rows n gs"
  shows "lattice_of fs = lattice_of gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of fs = lattice_of gs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lattice_of fs \<subseteq> lattice_of gs
 2. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
thm mat_mult_sub_lattice
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lattice_of fs \<subseteq> lattice_of gs
 2. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
show "lattice_of fs \<subseteq> lattice_of gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of fs \<subseteq> lattice_of gs
[PROOF STEP]
by (rule mat_mult_sub_lattice[OF fs gs _ prod],simp add: length_fs length_gs P)
[PROOF STATE]
proof (state)
this:
lattice_of fs \<subseteq> lattice_of gs

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
obtain inv_P where P_inv_P: "inverts_mat P inv_P" and inv_P_P: "inverts_mat inv_P P"
    and inv_P: "inv_P \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>inv_P. \<lbrakk>inverts_mat P inv_P; inverts_mat inv_P P; inv_P \<in> carrier_mat m m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using P invertible_P obtain_inverse_matrix
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat m m
invertible_mat P
\<lbrakk>?A \<in> carrier_mat ?n ?n; invertible_mat ?A; \<And>B. \<lbrakk>inverts_mat ?A B; inverts_mat B ?A; B \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>inv_P. \<lbrakk>inverts_mat P inv_P; inverts_mat inv_P P; inv_P \<in> carrier_mat m m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inverts_mat P inv_P
inverts_mat inv_P P
inv_P \<in> carrier_mat m m

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
have "of_int_hom.mat_hom (inv_P) * mat_of_rows n fs
      = of_int_hom.mat_hom (inv_P) * ((map_mat of_int P) * mat_of_rows n gs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_hom.mat_hom inv_P * mat_of_rows n fs = of_int_hom.mat_hom inv_P * (of_int_hom.mat_hom P * mat_of_rows n gs)
[PROOF STEP]
using prod
[PROOF STATE]
proof (prove)
using this:
mat_of_rows n fs = of_int_hom.mat_hom P * mat_of_rows n gs

goal (1 subgoal):
 1. of_int_hom.mat_hom inv_P * mat_of_rows n fs = of_int_hom.mat_hom inv_P * (of_int_hom.mat_hom P * mat_of_rows n gs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom inv_P * mat_of_rows n fs = of_int_hom.mat_hom inv_P * (of_int_hom.mat_hom P * mat_of_rows n gs)

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom inv_P * mat_of_rows n fs = of_int_hom.mat_hom inv_P * (of_int_hom.mat_hom P * mat_of_rows n gs)

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
have "... = of_int_hom.mat_hom (inv_P) * (map_mat of_int P) * mat_of_rows n gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_hom.mat_hom inv_P * (of_int_hom.mat_hom P * mat_of_rows n gs) = of_int_hom.mat_hom inv_P * of_int_hom.mat_hom P * mat_of_rows n gs
[PROOF STEP]
by (smt P assoc_mult_mat inv_P length_gs map_carrier_mat mat_of_rows_carrier(1))
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom inv_P * (of_int_hom.mat_hom P * mat_of_rows n gs) = of_int_hom.mat_hom inv_P * of_int_hom.mat_hom P * mat_of_rows n gs

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom inv_P * (of_int_hom.mat_hom P * mat_of_rows n gs) = of_int_hom.mat_hom inv_P * of_int_hom.mat_hom P * mat_of_rows n gs

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
have "... = of_int_hom.mat_hom (inv_P * P) * mat_of_rows n gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_hom.mat_hom inv_P * of_int_hom.mat_hom P * mat_of_rows n gs = of_int_hom.mat_hom (inv_P * P) * mat_of_rows n gs
[PROOF STEP]
by (metis P inv_P of_int_hom.mat_hom_mult)
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom inv_P * of_int_hom.mat_hom P * mat_of_rows n gs = of_int_hom.mat_hom (inv_P * P) * mat_of_rows n gs

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom inv_P * of_int_hom.mat_hom P * mat_of_rows n gs = of_int_hom.mat_hom (inv_P * P) * mat_of_rows n gs

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
have "... = mat_of_rows n gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_hom.mat_hom (inv_P * P) * mat_of_rows n gs = mat_of_rows n gs
[PROOF STEP]
by (metis carrier_matD(1) inv_P inv_P_P inverts_mat_def left_mult_one_mat'
        length_gs mat_of_rows_carrier(2) of_int_hom.mat_hom_one)
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom (inv_P * P) * mat_of_rows n gs = mat_of_rows n gs

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int_hom.mat_hom inv_P * mat_of_rows n fs = mat_of_rows n gs
[PROOF STEP]
have prod: "mat_of_rows n gs = of_int_hom.mat_hom (inv_P) * mat_of_rows n fs"
[PROOF STATE]
proof (prove)
using this:
of_int_hom.mat_hom inv_P * mat_of_rows n fs = mat_of_rows n gs

goal (1 subgoal):
 1. mat_of_rows n gs = of_int_hom.mat_hom inv_P * mat_of_rows n fs
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
mat_of_rows n gs = of_int_hom.mat_hom inv_P * mat_of_rows n fs

goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
show "lattice_of gs \<subseteq> lattice_of fs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of gs \<subseteq> lattice_of fs
[PROOF STEP]
by (rule mat_mult_sub_lattice[OF gs fs _ prod], simp add: length_fs length_gs inv_P)
[PROOF STATE]
proof (state)
this:
lattice_of gs \<subseteq> lattice_of fs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem gs: "\<lbrakk> Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a \<rbrakk> \<Longrightarrow>
 \<exists>A. Gale_Shapley P\<^sub>a P\<^sub>b = Some(A) \<and> Pref.matching P\<^sub>a A {<n} \<and>
   Pref.stable P\<^sub>a P\<^sub>b A {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. Gale_Shapley P\<^sub>a P\<^sub>b = Some A \<and> Pref.matching P\<^sub>a A {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b A {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b A
[PROOF STEP]
unfolding Gale_Shapley_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. (if Pref P\<^sub>a P\<^sub>b then Some (fst (gs (length P\<^sub>a) P\<^sub>a (map ranking P\<^sub>b))) else None) = Some A \<and> Pref.matching P\<^sub>a A {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b A {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b A
[PROOF STEP]
using Pref.gs
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Pref ?P\<^sub>a ?P\<^sub>b; ?R\<^sub>b = map ranking ?P\<^sub>b\<rbrakk> \<Longrightarrow> gs (length ?P\<^sub>a) ?P\<^sub>a ?R\<^sub>b = (?A, ?BMai) \<longrightarrow> Pref.matching ?P\<^sub>a ?A {<length ?P\<^sub>a} \<and> Pref.stable ?P\<^sub>a ?P\<^sub>b ?A {<length ?P\<^sub>a} \<and> Pref.opti\<^sub>a ?P\<^sub>a ?P\<^sub>b ?A

goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. (if Pref P\<^sub>a P\<^sub>b then Some (fst (gs (length P\<^sub>a) P\<^sub>a (map ranking P\<^sub>b))) else None) = Some A \<and> Pref.matching P\<^sub>a A {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b A {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b A
[PROOF STEP]
by (metis fst_conv surj_pair)


[STATEMENT]
lemma mat_inverse_simps[simp]:
  fixes c :: "'a::division_ring"
  assumes "c \<noteq> 0"
  shows "mat (inverse c) ** mat c = mat 1"
    and "mat c ** mat (inverse c) = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (inverse c) ** mat c = mat (1::'a) &&& mat c ** mat (inverse c) = mat (1::'a)
[PROOF STEP]
unfolding matrix_matrix_mult_def mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. \<Sum>k\<in>UNIV. (\<chi>i j. if i = j then inverse c else (0::'a)) $ i $ k * (\<chi>i j. if i = j then c else (0::'a)) $ k $ j) = (\<chi>i j. if i = j then 1::'a else (0::'a)) &&& (\<chi>i j. \<Sum>k\<in>UNIV. (\<chi>i j. if i = j then c else (0::'a)) $ i $ k * (\<chi>i j. if i = j then inverse c else (0::'a)) $ k $ j) = (\<chi>i j. if i = j then 1::'a else (0::'a))
[PROOF STEP]
by (auto simp: vec_eq_iff assms)


[STATEMENT]
lemma lower_asymptotic_density_one_intersection:
  assumes "lower_asymptotic_density A = 1" "lower_asymptotic_density B = 1"
  shows "lower_asymptotic_density (A \<inter> B) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower_asymptotic_density (A \<inter> B) = 1
[PROOF STEP]
using lower_asymptotic_density_in_01(2)[of "A \<inter> B"] lower_asymptotic_density_intersection[of A B]
[PROOF STATE]
proof (prove)
using this:
lower_asymptotic_density (A \<inter> B) \<le> 1
lower_asymptotic_density A + lower_asymptotic_density B \<le> lower_asymptotic_density (A \<inter> B) + 1

goal (1 subgoal):
 1. lower_asymptotic_density (A \<inter> B) = 1
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
using this:
lower_asymptotic_density (A \<inter> B) \<le> 1
1 + 1 \<le> lower_asymptotic_density (A \<inter> B) + 1

goal (1 subgoal):
 1. lower_asymptotic_density (A \<inter> B) = 1
[PROOF STEP]
by auto


[STATEMENT]
lemma inv\<^sub>L_compose:
  assumes "invertible\<^sub>L f" "invertible\<^sub>L g"
  shows"inv\<^sub>L (f o\<^sub>L g) = (inv\<^sub>L g) o\<^sub>L (inv\<^sub>L f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv\<^sub>L (f o\<^sub>L g) = inv\<^sub>L g o\<^sub>L inv\<^sub>L f
[PROOF STEP]
using assms inv\<^sub>L_eq is_inverse\<^sub>L_compose
[PROOF STATE]
proof (prove)
using this:
invertible\<^sub>L f
invertible\<^sub>L g
is_inverse\<^sub>L ?f ?g \<Longrightarrow> inv\<^sub>L ?f = ?g
\<lbrakk>invertible\<^sub>L ?f; invertible\<^sub>L ?g\<rbrakk> \<Longrightarrow> is_inverse\<^sub>L (?f o\<^sub>L ?g) (inv\<^sub>L ?g o\<^sub>L inv\<^sub>L ?f)

goal (1 subgoal):
 1. inv\<^sub>L (f o\<^sub>L g) = inv\<^sub>L g o\<^sub>L inv\<^sub>L f
[PROOF STEP]
by blast


[STATEMENT]
lemma preordered_finite_set_has_maxima:
  assumes "finite A" "A \<noteq> {}"
  shows "\<exists>a::'a::{preorder} \<in> A. \<forall>b \<in> A. \<not>(a < b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a\<in>A. \<forall>b\<in>A. \<not> a < b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. \<exists>a\<in>A. \<forall>b\<in>A. \<not> a < b
[PROOF STEP]
proof (induction A rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {} \<noteq> {} \<Longrightarrow> \<exists>a\<in>{}. \<forall>b\<in>{}. \<not> a < b
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; F \<noteq> {} \<Longrightarrow> \<exists>a\<in>F. \<forall>b\<in>F. \<not> a < b; insert x F \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>a\<in>insert x F. \<forall>b\<in>insert x F. \<not> a < b
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
A \<noteq> {} \<Longrightarrow> \<exists>a\<in>A. \<forall>b\<in>A. \<not> a < b
insert a A \<noteq> {}

goal (2 subgoals):
 1. {} \<noteq> {} \<Longrightarrow> \<exists>a\<in>{}. \<forall>b\<in>{}. \<not> a < b
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; F \<noteq> {} \<Longrightarrow> \<exists>a\<in>F. \<forall>b\<in>F. \<not> a < b; insert x F \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>a\<in>insert x F. \<forall>b\<in>insert x F. \<not> a < b
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A
A \<noteq> {} \<Longrightarrow> \<exists>a\<in>A. \<forall>b\<in>A. \<not> a < b
insert a A \<noteq> {}

goal (1 subgoal):
 1. \<exists>aa\<in>insert a A. \<forall>b\<in>insert a A. \<not> aa < b
[PROOF STEP]
by (cases "A = {}", simp, metis insert_iff order_trans less_le_not_le)
[PROOF STATE]
proof (state)
this:
\<exists>aa\<in>insert a A. \<forall>b\<in>insert a A. \<not> aa < b

goal (1 subgoal):
 1. {} \<noteq> {} \<Longrightarrow> \<exists>a\<in>{}. \<forall>b\<in>{}. \<not> a < b
[PROOF STEP]
qed simp


[STATEMENT]
theorem (in group_action) burnside:
  assumes "finite (carrier G)" "finite E"
  shows "card (orbits G E \<phi>) * order G = (\<Sum>g \<in> carrier G. card(invariants E \<phi> g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
have "(\<Sum>g \<in> carrier G. card(invariants E \<phi> g)) =
        (\<Sum>g \<in> carrier G. \<Sum>x \<in> E. (if (\<phi> g) x = x then 1 else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>g\<in>carrier G. card (invariants E \<phi> g)) = (\<Sum>g\<in>carrier G. \<Sum>x\<in>E. if \<phi> g x = x then 1 else 0)
[PROOF STEP]
by (simp add: assms(2) card_as_sums invariants_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>g\<in>carrier G. card (invariants E \<phi> g)) = (\<Sum>g\<in>carrier G. \<Sum>x\<in>E. if \<phi> g x = x then 1 else 0)

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>g\<in>carrier G. card (invariants E \<phi> g)) = (\<Sum>g\<in>carrier G. \<Sum>x\<in>E. if \<phi> g x = x then 1 else 0)

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
have " ... = (\<Sum>x \<in> E. \<Sum>g \<in> carrier G. (if (\<phi> g) x = x then 1 else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>g\<in>carrier G. \<Sum>x\<in>E. if \<phi> g x = x then 1 else 0) = (\<Sum>x\<in>E. \<Sum>g\<in>carrier G. if \<phi> g x = x then 1 else 0)
[PROOF STEP]
using sum_invertion[where ?f = "\<lambda> g x. (if (\<phi> g) x = x then 1 else 0)"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>?A. \<Sum>y\<in>?B. if \<phi> x y = y then 1::?'d1 else (0::?'d1)) = (\<Sum>y\<in>?B. \<Sum>x\<in>?A. if \<phi> x y = y then 1::?'d1 else (0::?'d1))
finite (carrier G)
finite E

goal (1 subgoal):
 1. (\<Sum>g\<in>carrier G. \<Sum>x\<in>E. if \<phi> g x = x then 1 else 0) = (\<Sum>x\<in>E. \<Sum>g\<in>carrier G. if \<phi> g x = x then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>g\<in>carrier G. \<Sum>x\<in>E. if \<phi> g x = x then 1 else 0) = (\<Sum>x\<in>E. \<Sum>g\<in>carrier G. if \<phi> g x = x then 1 else 0)

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>g\<in>carrier G. \<Sum>x\<in>E. if \<phi> g x = x then 1 else 0) = (\<Sum>x\<in>E. \<Sum>g\<in>carrier G. if \<phi> g x = x then 1 else 0)

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
have " ... = (\<Sum>x \<in> E. card (stabilizer G \<phi> x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>E. \<Sum>g\<in>carrier G. if \<phi> g x = x then 1 else 0) = (\<Sum>x\<in>E. card (stabilizer G \<phi> x))
[PROOF STEP]
by (simp add: assms(1) card_as_sums stabilizer_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>E. \<Sum>g\<in>carrier G. if \<phi> g x = x then 1 else 0) = (\<Sum>x\<in>E. card (stabilizer G \<phi> x))

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>E. \<Sum>g\<in>carrier G. if \<phi> g x = x then 1 else 0) = (\<Sum>x\<in>E. card (stabilizer G \<phi> x))

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
have " ... = (\<Sum>orbit \<in> (orbits G E \<phi>). \<Sum>x \<in> orbit. card (stabilizer G \<phi> x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>E. card (stabilizer G \<phi> x)) = sum (sum (\<lambda>x. card (stabilizer G \<phi> x))) (orbits G E \<phi>)
[PROOF STEP]
using disjoint_sum orbits_coverture assms(2)
[PROOF STATE]
proof (prove)
using this:
finite E \<Longrightarrow> sum (sum ?f) (orbits G E \<phi>) = sum ?f E
\<Union> (orbits G E \<phi>) = E
finite E

goal (1 subgoal):
 1. (\<Sum>x\<in>E. card (stabilizer G \<phi> x)) = sum (sum (\<lambda>x. card (stabilizer G \<phi> x))) (orbits G E \<phi>)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>E. card (stabilizer G \<phi> x)) = sum (sum (\<lambda>x. card (stabilizer G \<phi> x))) (orbits G E \<phi>)

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>E. card (stabilizer G \<phi> x)) = sum (sum (\<lambda>x. card (stabilizer G \<phi> x))) (orbits G E \<phi>)

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
have " ... = (\<Sum>orbit \<in> (orbits G E \<phi>). order G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sum (\<lambda>x. card (stabilizer G \<phi> x))) (orbits G E \<phi>) = (\<Sum>orbit\<in>orbits G E \<phi>. order G)
[PROOF STEP]
by (simp add: assms(1) card_stablizer_sum)
[PROOF STATE]
proof (state)
this:
sum (sum (\<lambda>x. card (stabilizer G \<phi> x))) (orbits G E \<phi>) = (\<Sum>orbit\<in>orbits G E \<phi>. order G)

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>g\<in>carrier G. card (invariants E \<phi> g)) = (\<Sum>orbit\<in>orbits G E \<phi>. order G)
[PROOF STEP]
have "(\<Sum>g \<in> carrier G. card(invariants E \<phi> g)) = card (orbits G E \<phi>) * order G"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>g\<in>carrier G. card (invariants E \<phi> g)) = (\<Sum>orbit\<in>orbits G E \<phi>. order G)

goal (1 subgoal):
 1. (\<Sum>g\<in>carrier G. card (invariants E \<phi> g)) = card (orbits G E \<phi>) * order G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>g\<in>carrier G. card (invariants E \<phi> g)) = card (orbits G E \<phi>) * order G

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>g\<in>carrier G. card (invariants E \<phi> g)) = card (orbits G E \<phi>) * order G

goal (1 subgoal):
 1. card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (orbits G E \<phi>) * order G = (\<Sum>g\<in>carrier G. card (invariants E \<phi> g))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_betw_image_Fpow:
assumes "bij_betw f A B"
shows "bij_betw (image f) (Fpow A) (Fpow B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((`) f) (Fpow A) (Fpow B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B

goal (1 subgoal):
 1. bij_betw ((`) f) (Fpow A) (Fpow B)
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on f A \<and> f ` A = B

goal (1 subgoal):
 1. inj_on ((`) f) (Fpow A) \<and> (`) f ` Fpow A = Fpow B
[PROOF STEP]
by (auto simp add: inj_on_image_Fpow image_Fpow_surjective)


[STATEMENT]
lemma compute_ofsm_table_list_props:
  "length (compute_ofsm_table_list M k) = Suc k"
  "\<And> i q . i < Suc k \<Longrightarrow> ofsm_lookup ((compute_ofsm_table_list M k) ! i) q = ofsm_table M (\<lambda>q . states M) i q"
  "\<And> i . i < Suc k \<Longrightarrow> Mapping.keys ((compute_ofsm_table_list M k) ! i) = states M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (compute_ofsm_table_list M k) = Suc k &&& (\<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q) &&& (\<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. length (compute_ofsm_table_list M k) = Suc k
 2. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 3. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M
[PROOF STEP]
define t where "t = (\<lambda> k . (foldr (\<lambda> _ prev . (next_ofsm_table M (hd prev)) # prev) (rev [0..<k]) [initial_ofsm_table M]))"
[PROOF STATE]
proof (state)
this:
t = (\<lambda>k. foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) (rev [0..<k]) [initial_ofsm_table M])

goal (3 subgoals):
 1. length (compute_ofsm_table_list M k) = Suc k
 2. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 3. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M
[PROOF STEP]
have t_props:"length (t k) = Suc k
          \<and> (\<forall> i q . i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k-i)) q = ofsm_table M (\<lambda>q . states M) i q)
          \<and> (\<forall> i . i < Suc k \<longrightarrow> Mapping.keys (t k ! i) = states M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M)
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (t 0) = Suc 0 \<and> (\<forall>i q. i < Suc 0 \<longrightarrow> ofsm_lookup (t 0 ! (0 - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc 0. Mapping.keys (t 0 ! i) = FSM.states M)
 2. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. length (t 0) = Suc 0 \<and> (\<forall>i q. i < Suc 0 \<longrightarrow> ofsm_lookup (t 0 ! (0 - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc 0. Mapping.keys (t 0 ! i) = FSM.states M)
 2. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
have "t 0 = [initial_ofsm_table M]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t 0 = [initial_ofsm_table M]
[PROOF STEP]
unfolding t_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) (rev [0..<0]) [initial_ofsm_table M] = [initial_ofsm_table M]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t 0 = [initial_ofsm_table M]

goal (2 subgoals):
 1. length (t 0) = Suc 0 \<and> (\<forall>i q. i < Suc 0 \<longrightarrow> ofsm_lookup (t 0 ! (0 - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc 0. Mapping.keys (t 0 ! i) = FSM.states M)
 2. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (t 0) = Suc 0 \<and> (\<forall>i q. i < Suc 0 \<longrightarrow> ofsm_lookup (t 0 ! (0 - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc 0. Mapping.keys (t 0 ! i) = FSM.states M)
[PROOF STEP]
unfolding \<open>t 0 = [initial_ofsm_table M]\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length [initial_ofsm_table M] = Suc 0 \<and> (\<forall>i q. i < Suc 0 \<longrightarrow> ofsm_lookup ([initial_ofsm_table M] ! (0 - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc 0. Mapping.keys ([initial_ofsm_table M] ! i) = FSM.states M)
[PROOF STEP]
using initial_ofsm_table_lookup_invar[of M]
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (initial_ofsm_table M) ?q = ofsm_table M (\<lambda>q. FSM.states M) 0 ?q

goal (1 subgoal):
 1. length [initial_ofsm_table M] = Suc 0 \<and> (\<forall>i q. i < Suc 0 \<longrightarrow> ofsm_lookup ([initial_ofsm_table M] ! (0 - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc 0. Mapping.keys ([initial_ofsm_table M] ! i) = FSM.states M)
[PROOF STEP]
using initial_ofsm_table_keys_invar[of M]
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (initial_ofsm_table M) ?q = ofsm_table M (\<lambda>q. FSM.states M) 0 ?q
Mapping.keys (initial_ofsm_table M) = FSM.states M

goal (1 subgoal):
 1. length [initial_ofsm_table M] = Suc 0 \<and> (\<forall>i q. i < Suc 0 \<longrightarrow> ofsm_lookup ([initial_ofsm_table M] ! (0 - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc 0. Mapping.keys ([initial_ofsm_table M] ! i) = FSM.states M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (t 0) = Suc 0 \<and> (\<forall>i q. i < Suc 0 \<longrightarrow> ofsm_lookup (t 0 ! (0 - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc 0. Mapping.keys (t 0 ! i) = FSM.states M)

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M)

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
have "rev [0..<Suc k] = k # (rev [0..<k])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev [0..<Suc k] = k # rev [0..<k]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rev [0..<Suc k] = k # rev [0..<k]

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
have *: "t (Suc k) = (next_ofsm_table M (hd (t k))) # (t k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t (Suc k) = next_ofsm_table M (hd (t k)) # t k
[PROOF STEP]
unfolding t_def \<open>rev [0..<Suc k] = k # (rev [0..<k])\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) (k # rev [0..<k]) [initial_ofsm_table M] = next_ofsm_table M (hd (foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) (rev [0..<k]) [initial_ofsm_table M])) # foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) (rev [0..<k]) [initial_ofsm_table M]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t (Suc k) = next_ofsm_table M (hd (t k)) # t k

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
have IH1: "length (t k) = Suc k"
    and  IH2: "\<And>i q . i < Suc k \<Longrightarrow> ofsm_lookup (t k ! (k-i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q"
    and  IH3: "\<And>i . i < Suc k \<Longrightarrow> Mapping.keys (t k ! i) = FSM.states M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (t k) = Suc k &&& (\<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) &&& (\<And>i. i < Suc k \<Longrightarrow> Mapping.keys (t k ! i) = FSM.states M)
[PROOF STEP]
using Suc.IH
[PROOF STATE]
proof (prove)
using this:
length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M)

goal (1 subgoal):
 1. length (t k) = Suc k &&& (\<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) &&& (\<And>i. i < Suc k \<Longrightarrow> Mapping.keys (t k ! i) = FSM.states M)
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
length (t k) = Suc k
?i < Suc k \<Longrightarrow> ofsm_lookup (t k ! (k - ?i)) ?q = ofsm_table M (\<lambda>q. FSM.states M) ?i ?q
?i < Suc k \<Longrightarrow> Mapping.keys (t k ! ?i) = FSM.states M

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
have "length (t (Suc k)) = Suc (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (t (Suc k)) = Suc (Suc k)
[PROOF STEP]
using IH1
[PROOF STATE]
proof (prove)
using this:
length (t k) = Suc k

goal (1 subgoal):
 1. length (t (Suc k)) = Suc (Suc k)
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
length (t k) = Suc k

goal (1 subgoal):
 1. length (next_ofsm_table M (hd (t k)) # t k) = Suc (Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (t (Suc k)) = Suc (Suc k)

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (t (Suc k)) = Suc (Suc k)

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
have "\<And>i q . i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! ((Suc k)-i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i q. i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i q. i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
fix i q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i q. i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
assume "i < Suc (Suc k)"
[PROOF STATE]
proof (state)
this:
i < Suc (Suc k)

goal (1 subgoal):
 1. \<And>i q. i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < Suc (Suc k)
[PROOF STEP]
consider "i = Suc k" | "i < Suc k"
[PROOF STATE]
proof (prove)
using this:
i < Suc (Suc k)

goal (1 subgoal):
 1. \<lbrakk>i = Suc k \<Longrightarrow> thesis; i < Suc k \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using less_Suc_eq
[PROOF STATE]
proof (prove)
using this:
i < Suc (Suc k)
(?m < Suc ?n) = (?m < ?n \<or> ?m = ?n)

goal (1 subgoal):
 1. \<lbrakk>i = Suc k \<Longrightarrow> thesis; i < Suc k \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>i = Suc k \<Longrightarrow> ?thesis; i < Suc k \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<And>i q. i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>i = Suc k \<Longrightarrow> ?thesis; i < Suc k \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show "ofsm_lookup (t (Suc k) ! ((Suc k)-i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i = Suc k \<Longrightarrow> ?thesis; i < Suc k \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
i = Suc k

goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = Suc k
[PROOF STEP]
have "(t (Suc k) ! ((Suc k)-i)) = hd (t (Suc k))"
[PROOF STATE]
proof (prove)
using this:
i = Suc k

goal (1 subgoal):
 1. t (Suc k) ! (Suc k - i) = hd (t (Suc k))
[PROOF STEP]
by (metis "*" diff_self_eq_0 list.sel(1) nth_Cons_0)
[PROOF STATE]
proof (state)
this:
t (Suc k) ! (Suc k - i) = hd (t (Suc k))

goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t (Suc k) ! (Suc k - i) = hd (t (Suc k))
[PROOF STEP]
have "(t (Suc k) ! ((Suc k)-i)) = next_ofsm_table M (hd (t k))"
[PROOF STATE]
proof (prove)
using this:
t (Suc k) ! (Suc k - i) = hd (t (Suc k))

goal (1 subgoal):
 1. t (Suc k) ! (Suc k - i) = next_ofsm_table M (hd (t k))
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
(next_ofsm_table M (hd (t k)) # t k) ! (Suc k - i) = hd (next_ofsm_table M (hd (t k)) # t k)

goal (1 subgoal):
 1. (next_ofsm_table M (hd (t k)) # t k) ! (Suc k - i) = next_ofsm_table M (hd (t k))
[PROOF STEP]
by (metis list.sel(1))
[PROOF STATE]
proof (state)
this:
t (Suc k) ! (Suc k - i) = next_ofsm_table M (hd (t k))

goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t (Suc k) ! (Suc k - i) = next_ofsm_table M (hd (t k))
[PROOF STEP]
have "ofsm_lookup (t (Suc k) ! ((Suc k)-i)) q = ofsm_lookup (next_ofsm_table M (hd (t k))) q"
[PROOF STATE]
proof (prove)
using this:
t (Suc k) ! (Suc k - i) = next_ofsm_table M (hd (t k))

goal (1 subgoal):
 1. ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_lookup (next_ofsm_table M (hd (t k))) q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_lookup (next_ofsm_table M (hd (t k))) q

goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
have "(hd (t k)) = (t k ! (k-k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (t k) = t k ! (k - k)
[PROOF STEP]
by (metis IH1 diff_self_eq_0 hd_conv_nth list.size(3) nat.simps(3))
[PROOF STATE]
proof (state)
this:
hd (t k) = t k ! (k - k)

goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
hd (t k) = t k ! (k - k)

goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
have "k < Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k < Suc k

goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
hd (t k) = t k ! (k - k)
k < Suc k
[PROOF STEP]
have "ofsm_lookup (next_ofsm_table M (hd (t k))) q = ofsm_table M (\<lambda>q. FSM.states M) i q"
[PROOF STATE]
proof (prove)
using this:
hd (t k) = t k ! (k - k)
k < Suc k

goal (1 subgoal):
 1. ofsm_lookup (next_ofsm_table M (hd (t k))) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
by (metis "1" IH2 next_ofsm_table_lookup_invar)
[PROOF STATE]
proof (state)
this:
ofsm_lookup (next_ofsm_table M (hd (t k))) q = ofsm_table M (\<lambda>q. FSM.states M) i q

goal (2 subgoals):
 1. i = Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ofsm_lookup (next_ofsm_table M (hd (t k))) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (next_ofsm_table M (hd (t k))) q = ofsm_table M (\<lambda>q. FSM.states M) i q

goal (1 subgoal):
 1. ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
unfolding \<open>ofsm_lookup (t (Suc k) ! ((Suc k)-i)) q = ofsm_lookup (next_ofsm_table M (hd (t k))) q\<close>
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (next_ofsm_table M (hd (t k))) q = ofsm_table M (\<lambda>q. FSM.states M) i q

goal (1 subgoal):
 1. ofsm_lookup (next_ofsm_table M (hd (t k))) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q

goal (1 subgoal):
 1. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
i < Suc k

goal (1 subgoal):
 1. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < Suc k
[PROOF STEP]
have "((Suc k)-i) > 0"
[PROOF STATE]
proof (prove)
using this:
i < Suc k

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

goal (1 subgoal):
 1. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < Suc k - i
[PROOF STEP]
have "(t (Suc k) ! ((Suc k)-i)) = t k ! (((Suc k)-i) - 1)"
[PROOF STATE]
proof (prove)
using this:
0 < Suc k - i

goal (1 subgoal):
 1. t (Suc k) ! (Suc k - i) = t k ! (Suc k - i - 1)
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
0 < Suc k - i

goal (1 subgoal):
 1. (next_ofsm_table M (hd (t k)) # t k) ! (Suc k - i) = t k ! (Suc k - i - 1)
[PROOF STEP]
by (meson nth_Cons_pos)
[PROOF STATE]
proof (state)
this:
t (Suc k) ! (Suc k - i) = t k ! (Suc k - i - 1)

goal (1 subgoal):
 1. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t (Suc k) ! (Suc k - i) = t k ! (Suc k - i - 1)
[PROOF STEP]
have "(t (Suc k) ! ((Suc k)-i)) = t k ! (k-i)"
[PROOF STATE]
proof (prove)
using this:
t (Suc k) ! (Suc k - i) = t k ! (Suc k - i - 1)

goal (1 subgoal):
 1. t (Suc k) ! (Suc k - i) = t k ! (k - i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t (Suc k) ! (Suc k - i) = t k ! (k - i)

goal (1 subgoal):
 1. i < Suc k \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
show "ofsm_lookup (t (Suc k) ! ((Suc k)-i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
using IH2[OF 2]
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (t k ! (k - i)) ?q = ofsm_table M (\<lambda>q. FSM.states M) i ?q

goal (1 subgoal):
 1. ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
unfolding \<open>(t (Suc k) ! ((Suc k)-i)) = t k ! (k-i)\<close>
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (t k ! (k - i)) ?q = ofsm_table M (\<lambda>q. FSM.states M) i ?q

goal (1 subgoal):
 1. ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - ?i)) ?q = ofsm_table M (\<lambda>q. FSM.states M) ?i ?q

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - ?i)) ?q = ofsm_table M (\<lambda>q. FSM.states M) ?i ?q

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
have "\<And>i . i < Suc (Suc k) \<Longrightarrow> Mapping.keys (t (Suc k) ! i) = FSM.states M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < Suc (Suc k) \<Longrightarrow> Mapping.keys (t (Suc k) ! i) = FSM.states M
[PROOF STEP]
by (metis "*" IH3 Suc_diff_1 Suc_less_eq less_Suc_eq_0_disj next_ofsm_table_keys_invar nth_Cons')
[PROOF STATE]
proof (state)
this:
?i < Suc (Suc k) \<Longrightarrow> Mapping.keys (t (Suc k) ! ?i) = FSM.states M

goal (1 subgoal):
 1. \<And>k. length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M) \<Longrightarrow> length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (t (Suc k)) = Suc (Suc k)
?i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - ?i)) ?q = ofsm_table M (\<lambda>q. FSM.states M) ?i ?q
?i < Suc (Suc k) \<Longrightarrow> Mapping.keys (t (Suc k) ! ?i) = FSM.states M
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length (t (Suc k)) = Suc (Suc k)
?i < Suc (Suc k) \<Longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - ?i)) ?q = ofsm_table M (\<lambda>q. FSM.states M) ?i ?q
?i < Suc (Suc k) \<Longrightarrow> Mapping.keys (t (Suc k) ! ?i) = FSM.states M

goal (1 subgoal):
 1. length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length (t (Suc k)) = Suc (Suc k) \<and> (\<forall>i q. i < Suc (Suc k) \<longrightarrow> ofsm_lookup (t (Suc k) ! (Suc k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc (Suc k). Mapping.keys (t (Suc k) ! i) = FSM.states M)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M)

goal (3 subgoals):
 1. length (compute_ofsm_table_list M k) = Suc k
 2. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 3. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M
[PROOF STEP]
have *:"(compute_ofsm_table_list M k) = rev (t k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compute_ofsm_table_list M k = rev (t k)
[PROOF STEP]
unfolding compute_ofsm_table_list.simps t_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev (foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) [0..<k] [initial_ofsm_table M]) = rev (foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) (rev [0..<k]) [initial_ofsm_table M])
[PROOF STEP]
using foldr_length_helper[of "rev [0..<k]" "[0..<k]" "(\<lambda> prev . (next_ofsm_table M (hd prev)) # prev)", OF length_rev]
[PROOF STATE]
proof (prove)
using this:
foldr (\<lambda>_ x. next_ofsm_table M (hd x) # x) (rev [0..<k]) ?b = foldr (\<lambda>a x. next_ofsm_table M (hd x) # x) [0..<k] ?b

goal (1 subgoal):
 1. rev (foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) [0..<k] [initial_ofsm_table M]) = rev (foldr (\<lambda>_ prev. next_ofsm_table M (hd prev) # prev) (rev [0..<k]) [initial_ofsm_table M])
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
compute_ofsm_table_list M k = rev (t k)

goal (3 subgoals):
 1. length (compute_ofsm_table_list M k) = Suc k
 2. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 3. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M
[PROOF STEP]
show "length (compute_ofsm_table_list M k) = Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (compute_ofsm_table_list M k) = Suc k
[PROOF STEP]
using t_props
[PROOF STATE]
proof (prove)
using this:
length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M)

goal (1 subgoal):
 1. length (compute_ofsm_table_list M k) = Suc k
[PROOF STEP]
unfolding * length_rev
[PROOF STATE]
proof (prove)
using this:
length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M)

goal (1 subgoal):
 1. length (t k) = Suc k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length (compute_ofsm_table_list M k) = Suc k

goal (2 subgoals):
 1. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M
[PROOF STEP]
have "\<And> i . i < Suc k \<Longrightarrow> (rev (t k) ! i) = t k ! (k - i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < Suc k \<Longrightarrow> rev (t k) ! i = t k ! (k - i)
[PROOF STEP]
by (simp add: rev_nth t_props)
[PROOF STATE]
proof (state)
this:
?i < Suc k \<Longrightarrow> rev (t k) ! ?i = t k ! (k - ?i)

goal (2 subgoals):
 1. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
 2. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < Suc k \<Longrightarrow> rev (t k) ! ?i = t k ! (k - ?i)
[PROOF STEP]
show "\<And>i q. i < Suc k \<Longrightarrow>
           ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q"
[PROOF STATE]
proof (prove)
using this:
?i < Suc k \<Longrightarrow> rev (t k) ! ?i = t k ! (k - ?i)

goal (1 subgoal):
 1. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
?i < Suc k \<Longrightarrow> rev (t k) ! ?i = t k ! (k - ?i)

goal (1 subgoal):
 1. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (rev (t k) ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
using t_props
[PROOF STATE]
proof (prove)
using this:
?i < Suc k \<Longrightarrow> rev (t k) ! ?i = t k ! (k - ?i)
length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M)

goal (1 subgoal):
 1. \<And>i q. i < Suc k \<Longrightarrow> ofsm_lookup (rev (t k) ! i) q = ofsm_table M (\<lambda>q. FSM.states M) i q
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
?i < Suc k \<Longrightarrow> ofsm_lookup (compute_ofsm_table_list M k ! ?i) ?q = ofsm_table M (\<lambda>q. FSM.states M) ?i ?q

goal (1 subgoal):
 1. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M
[PROOF STEP]
show "\<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! i) = FSM.states M
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (rev (t k) ! i) = FSM.states M
[PROOF STEP]
using t_props \<open>\<And> i . i < Suc k \<Longrightarrow> (rev (t k) ! i) = t k ! (k - i)\<close>
[PROOF STATE]
proof (prove)
using this:
length (t k) = Suc k \<and> (\<forall>i q. i < Suc k \<longrightarrow> ofsm_lookup (t k ! (k - i)) q = ofsm_table M (\<lambda>q. FSM.states M) i q) \<and> (\<forall>i<Suc k. Mapping.keys (t k ! i) = FSM.states M)
?i < Suc k \<Longrightarrow> rev (t k) ! ?i = t k ! (k - ?i)

goal (1 subgoal):
 1. \<And>i. i < Suc k \<Longrightarrow> Mapping.keys (rev (t k) ! i) = FSM.states M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i < Suc k \<Longrightarrow> Mapping.keys (compute_ofsm_table_list M k ! ?i) = FSM.states M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_prod_block_size_lift_01:
  assumes "i < \<b>"
  shows "((col (lift_01_mat N) i) \<bullet> (col (lift_01_mat N) i)) = (of_nat (card (\<B>s ! i)) :: ('b :: {ring_1}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (lift_01_mat N) i \<bullet> col (lift_01_mat N) i = of_nat (card (\<B>s ! i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. col (lift_01_mat N) i \<bullet> col (lift_01_mat N) i = of_nat (card (\<B>s ! i))
[PROOF STEP]
interpret z1: zero_one_matrix_ring_1 "(lift_01_mat N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zero_one_matrix_ring_1 (lift_01_mat N)
[PROOF STEP]
by (intro_locales) (simp add: lift_mat_is_0_1)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. col (lift_01_mat N) i \<bullet> col (lift_01_mat N) i = of_nat (card (\<B>s ! i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (lift_01_mat N) i \<bullet> col (lift_01_mat N) i = of_nat (card (\<B>s ! i))
[PROOF STEP]
using assms z1.scalar_prod_inc_vec_block_size_mat preserve_mat_block_size
      mat_block_size_N_col lift_01_mat_def
[PROOF STATE]
proof (prove)
using this:
i < \<b>
?j < dim_col (lift_01_mat N) \<Longrightarrow> col (lift_01_mat N) ?j \<bullet> col (lift_01_mat N) ?j = of_nat (mat_block_size (lift_01_mat N) ?j)
\<lbrakk>inj_on_01_hom ?f; ?j < dim_col N\<rbrakk> \<Longrightarrow> mat_block_size N ?j = mat_block_size (map_mat ?f N) ?j
?j < \<b> \<Longrightarrow> mat_block_size N ?j = card (\<B>s ! ?j)
lift_01_mat ?M \<equiv> map_mat of_zero_neq_one ?M

goal (1 subgoal):
 1. col (lift_01_mat N) i \<bullet> col (lift_01_mat N) i = of_nat (card (\<B>s ! i))
[PROOF STEP]
by (metis inc_mat_dim_col lift_01_mat_simp(2) of_inj_on_01_hom.inj_on_01_hom_axioms size_mset)
[PROOF STATE]
proof (state)
this:
col (lift_01_mat N) i \<bullet> col (lift_01_mat N) i = of_nat (card (\<B>s ! i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interval_split_cart:
  "{a..b::real^'n} \<inter> {x. x$k \<le> c} = {a .. (\<chi> i. if i = k then min (b$k) c else b$i)}"
  "cbox a b \<inter> {x. x$k \<ge> c} = {(\<chi> i. if i = k then max (a$k) c else a$i) .. b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..b} \<inter> {x. x $ k \<le> c} = {a..\<chi>i. if i = k then min (b $ k) c else b $ i} &&& cbox a b \<inter> {x. c \<le> x $ k} = {\<chi>i. if i = k then max (a $ k) c else a $ i..b}
[PROOF STEP]
apply (rule_tac[!] set_eqI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. (x \<in> {a..b} \<inter> {x. x $ k \<le> c}) = (x \<in> {a..\<chi>i. if i = k then min (b $ k) c else b $ i})
 2. \<And>x. (x \<in> cbox a b \<inter> {x. c \<le> x $ k}) = (x \<in> {\<chi>i. if i = k then max (a $ k) c else a $ i..b})
[PROOF STEP]
unfolding Int_iff mem_box_cart mem_Collect_eq interval_cbox_cart
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. ((\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i) \<and> x $ k \<le> c) = (\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> (\<chi>i. if i = k then min (b $ k) c else b $ i) $ i)
 2. \<And>x. ((\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i) \<and> c \<le> x $ k) = (\<forall>i. (\<chi>i. if i = k then max (a $ k) c else a $ i) $ i \<le> x $ i \<and> x $ i \<le> b $ i)
[PROOF STEP]
unfolding vec_lambda_beta
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. ((\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i) \<and> x $ k \<le> c) = (\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> (if i = k then min (b $ k) c else b $ i))
 2. \<And>x. ((\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i) \<and> c \<le> x $ k) = (\<forall>i. (if i = k then max (a $ k) c else a $ i) \<le> x $ i \<and> x $ i \<le> b $ i)
[PROOF STEP]
by auto


[STATEMENT]
lemma subset_atMost_Max_le_conv: "
  \<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> (A \<subseteq> {..n}) = (Max A \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> (A \<subseteq> {..n}) = (Max A \<le> n)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; A \<noteq> {}; A \<subseteq> {..n}\<rbrakk> \<Longrightarrow> Max A \<le> n
 2. \<lbrakk>finite A; A \<noteq> {}; Max A \<le> n\<rbrakk> \<Longrightarrow> A \<subseteq> {..n}
[PROOF STEP]
apply (blast intro: subset_atMost_imp_Max_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}; Max A \<le> n\<rbrakk> \<Longrightarrow> A \<subseteq> {..n}
[PROOF STEP]
apply (rule Max_le_imp_subset_atMost, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem effective_matrix_tensor_elements2:
 assumes  " i<(row_length M1)*(row_length M2)"
 and "j < (length M1)*(length M2)"
 and "mat (row_length M1) (length M1) M1"
 and "mat (row_length M2) (length M2) M2"
 shows "(M1 \<otimes> M2)!j!i =
             (M1!(j div (length M2))!(i div (row_length M2)))
              * (M2!(j mod length M2)!(i mod (row_length M2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M1 \<otimes> M2) ! j ! i = M1 ! (j div length M2) ! (i div row_length M2) * M2 ! (j mod length M2) ! (i mod row_length M2)
[PROOF STEP]
using assms matrix_Tensor_elements
[PROOF STATE]
proof (prove)
using this:
i < row_length M1 * row_length M2
j < length M1 * length M2
mat (row_length M1) (length M1) M1
mat (row_length M2) (length M2) M2
\<forall>i j. (i < row_length ?M1.0 * row_length ?M2.0 \<and> j < length ?M1.0 * length ?M2.0) \<and> mat (row_length ?M1.0) (length ?M1.0) ?M1.0 \<and> mat (row_length ?M2.0) (length ?M2.0) ?M2.0 \<longrightarrow> (?M1.0 \<otimes> ?M2.0) ! j ! i = ?M1.0 ! (j div length ?M2.0) ! (i div row_length ?M2.0) * ?M2.0 ! (j mod length ?M2.0) ! (i mod row_length ?M2.0)

goal (1 subgoal):
 1. (M1 \<otimes> M2) ! j ! i = M1 ! (j div length M2) ! (i div row_length M2) * M2 ! (j mod length M2) ! (i mod row_length M2)
[PROOF STEP]
by auto


[STATEMENT]
lemma conjugate_exponent_ennreal_iff:
  assumes "p \<ge> (1::ennreal)"
  shows "q = conjugate_exponent p \<longleftrightarrow> (1/p + 1/q = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (q = conjugate_exponent p) = (1 / p + 1 / q = 1)
[PROOF STEP]
using conjugate_exponent_ennreal[OF assms]
[PROOF STATE]
proof (prove)
using this:
1 / p + 1 / conjugate_exponent p = 1
1 \<le> conjugate_exponent p
conjugate_exponent (conjugate_exponent p) = p

goal (1 subgoal):
 1. (q = conjugate_exponent p) = (1 / p + 1 / q = 1)
[PROOF STEP]
by (auto, metis ennreal_add_diff_cancel_left ennreal_add_eq_top ennreal_top_neq_one one_divide_one_divide_ennreal)


[STATEMENT]
lemma mset_mult_add:
  assumes "mset (a::'a::field list) = mset b + mset c"
  shows "prod_list a = prod_list b * prod_list c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list a = prod_list b * prod_list c
[PROOF STEP]
unfolding prod_mset_prod_list[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>\<^sub># (mset a) = \<Prod>\<^sub># (mset b) * \<Prod>\<^sub># (mset c)
[PROOF STEP]
using prod_mset_Un[of "mset b" "mset c",unfolded assms[symmetric]]
[PROOF STATE]
proof (prove)
using this:
\<Prod>\<^sub># (mset a) = \<Prod>\<^sub># (mset b) * \<Prod>\<^sub># (mset c)

goal (1 subgoal):
 1. \<Prod>\<^sub># (mset a) = \<Prod>\<^sub># (mset b) * \<Prod>\<^sub># (mset c)
[PROOF STEP]
.