[STATEMENT]
lemma Inf_distrib_INF_qual:
  fixes f :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"
  assumes qual: "P {d x |x. x \<in> X}"
  assumes f_Inf_distrib: "\<And>c D. P D \<Longrightarrow> f c (\<Sqinter> D) = \<Sqinter> {f c d | d . d \<in> D }"
  shows "f c (\<Sqinter>x\<in>X. d x) = (\<Sqinter>x\<in>X. f c (d x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
have "f c (\<Sqinter>x\<in>X. d x) = f c (\<Sqinter>{d x |x. x \<in> X})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = f c (\<Sqinter> {d x |x::'b. x \<in> X})
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
by (simp add: INF_Inf)
[PROOF STATE]
proof (state)
this:
(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) (\<Sqinter> ((d::'b::type \<Rightarrow> 'a::type) ` (X::'b::type set))) = f c (\<Sqinter> {d x |x::'b::type. x \<in> X})

goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) (\<Sqinter> ((d::'b::type \<Rightarrow> 'a::type) ` (X::'b::type set))) = f c (\<Sqinter> {d x |x::'b::type. x \<in> X})

goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
have "... = (\<Sqinter>{f c dx |dx. dx \<in> {d x | x. x \<in> X}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f c (\<Sqinter> {d x |x::'b. x \<in> X}) = \<Sqinter> {f c dx |dx::'a. dx \<in> {d x |x::'b. x \<in> X}}
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
by (simp add: qual f_Inf_distrib)
[PROOF STATE]
proof (state)
this:
(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) (\<Sqinter> {(d::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> (X::'b::type set)}) = \<Sqinter> {f c dx |dx::'a::type. dx \<in> {d x |x::'b::type. x \<in> X}}

goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) (\<Sqinter> {(d::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> (X::'b::type set)}) = \<Sqinter> {f c dx |dx::'a::type. dx \<in> {d x |x::'b::type. x \<in> X}}

goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
have "... = (\<Sqinter>{f c (d x) |x. x \<in> X})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> {f c dx |dx::'a. dx \<in> {d x |x::'b. x \<in> X}} = \<Sqinter> {f c (d x) |x::'b. x \<in> X}
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
by (simp only: nested_Collect)
[PROOF STATE]
proof (state)
this:
\<Sqinter> {(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) dx |dx::'a::type. dx \<in> {(d::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> (X::'b::type set)}} = \<Sqinter> {f c (d x) |x::'b::type. x \<in> X}

goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sqinter> {(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) dx |dx::'a::type. dx \<in> {(d::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> (X::'b::type set)}} = \<Sqinter> {f c (d x) |x::'b::type. x \<in> X}

goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
have "... = (\<Sqinter>x\<in>X. f c (d x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> {f c (d x) |x::'b. x \<in> X} = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
by (simp add: INF_Inf)
[PROOF STATE]
proof (state)
this:
\<Sqinter> {(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) ((d::'b::type \<Rightarrow> 'a::type) x) |x::'b::type. x \<in> (X::'b::type set)} = (\<Sqinter>x::'b::type\<in>X. f c (d x))

goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) (\<Sqinter> ((d::'b::type \<Rightarrow> 'a::type) ` (X::'b::type set))) = (\<Sqinter>x::'b::type\<in>X. f c (d x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) (\<Sqinter> ((d::'b::type \<Rightarrow> 'a::type) ` (X::'b::type set))) = (\<Sqinter>x::'b::type\<in>X. f c (d x))

goal (1 subgoal):
 1. f c (\<Sqinter> (d ` X)) = (\<Sqinter>x::'b\<in>X. f c (d x))
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f::'a::type \<Rightarrow> 'a::type \<Rightarrow> 'a::type) (c::'a::type) (\<Sqinter> ((d::'b::type \<Rightarrow> 'a::type) ` (X::'b::type set))) = (\<Sqinter>x::'b::type\<in>X. f c (d x))

goal:
No subgoals!
variables:
X :: 'b set
d :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
c :: 'a
f :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
qed


[STATEMENT]
lemma hull_Un_left: "P hull (S \<union> T) = P hull (P hull S \<union> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P hull (S \<union> T) = P hull (P hull S \<union> T)
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. P hull (S \<union> T) \<subseteq> P hull (P hull S \<union> T)
 2. P hull (P hull S \<union> T) \<subseteq> P hull (S \<union> T)
[PROOF STEP]
apply (simp add: Un_commute hull_mono hull_subset sup.coboundedI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P hull (P hull S \<union> T) \<subseteq> P hull (S \<union> T)
[PROOF STEP]
by (metis Un_subset_iff hull_hull hull_mono hull_subset)


[STATEMENT]
lemma lang_biderivs: "\<lbrakk>wf n r; wf_word n w1; wf_word n w2\<rbrakk> \<Longrightarrow>
  lang n (biderivs w1 w2 r) = biQuots w1 w2 (lang n r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.wf n r; wf_word n w1; wf_word n w2\<rbrakk> \<Longrightarrow> lang n (biderivs w1 w2 r) = biQuots w1 w2 (lang n r)
[PROOF STEP]
unfolding biderivs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.wf n r; wf_word n w1; wf_word n w2\<rbrakk> \<Longrightarrow> lang n ((rderivs w2 \<circ> lderivs w1) r) = biQuots w1 w2 (lang n r)
[PROOF STEP]
by (auto simp: lang_rderivs lang_lderivs in_lists_conv_set)


[STATEMENT]
lemma card_Nset_im:"f \<in> {j. j \<le> (n::nat)} \<rightarrow> A \<Longrightarrow>
                      (Suc 0) \<le> card (f `{j. j \<le> n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {j. j \<le> n} \<rightarrow> A \<Longrightarrow> Suc 0 \<le> card (f ` {j. j \<le> n})
[PROOF STEP]
apply (cut_tac image_Nsetn_card_pos[of f n])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; 0 < card (f ` {i. i \<le> n})\<rbrakk> \<Longrightarrow> Suc 0 \<le> card (f ` {j. j \<le> n})
[PROOF STEP]
apply (frule_tac m = 0 and n = "card (f ` {i. i \<le> n})" in Suc_leI,
        assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in HMM) likelihood_init:
  "likelihood s os = T (s, obs) {\<omega> \<in> space S. L os \<omega>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. likelihood s os = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. likelihood s os = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
have *: "(\<Sum>o\<in>\<O>\<^sub>s. emeasure (T (s, o)) {\<omega> \<in> space S. L os \<omega>}) =
    of_nat (card \<O>\<^sub>s) * emeasure (T (s, obs)) {\<omega> \<in> space S. L os \<omega>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>o\<in>\<O>\<^sub>s. emeasure (T (s, o)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}) = of_nat (card \<O>\<^sub>s) * emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
by (subst sum_constant[symmetric]) (fastforce intro: sum.cong T_init_observation_eq[simplified])
[PROOF STATE]
proof (state)
this:
(\<Sum>o\<in>\<O>\<^sub>s. emeasure (T (s, o)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}) = of_nat (card \<O>\<^sub>s) * emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}

goal (1 subgoal):
 1. likelihood s os = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. likelihood s os = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
unfolding likelihood_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (T' (I s)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>o\<^sub>0 xs \<omega>'. \<omega> = (s, o\<^sub>0) ## xs @- \<omega>' \<and> map snd xs = os} = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
apply (subst emeasure_T')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>o\<^sub>0 xs \<omega>'. \<omega> = (s, o\<^sub>0) ## xs @- \<omega>' \<and> map snd xs = os} \<in> sets (stream_space (count_space UNIV))
 2. \<integral>\<^sup>+ sa. emeasure (T sa) {\<omega> \<in> space (stream_space (count_space UNIV)). sa ## \<omega> \<in> {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>o\<^sub>0 xs \<omega>'. \<omega> = (s, o\<^sub>0) ## xs @- \<omega>' \<and> map snd xs = os}} \<partial>measure_pmf (I s) = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>o\<^sub>0 xs \<omega>'. \<omega> = (s, o\<^sub>0) ## xs @- \<omega>' \<and> map snd xs = os} \<in> sets (stream_space (count_space UNIV))
[PROOF STEP]
by measurable
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ sa. emeasure (T sa) {\<omega> \<in> space (stream_space (count_space UNIV)). sa ## \<omega> \<in> {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>o\<^sub>0 xs \<omega>'. \<omega> = (s, o\<^sub>0) ## xs @- \<omega>' \<and> map snd xs = os}} \<partial>measure_pmf (I s) = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
(\<Sum>o\<in>\<O>\<^sub>s. emeasure (T (s, o)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}) = of_nat (card \<O>\<^sub>s) * emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}

goal (1 subgoal):
 1. \<integral>\<^sup>+ sa. emeasure (T sa) {\<omega> \<in> space (stream_space (count_space UNIV)). sa ## \<omega> \<in> {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>o\<^sub>0 xs \<omega>'. \<omega> = (s, o\<^sub>0) ## xs @- \<omega>' \<and> map snd xs = os}} \<partial>measure_pmf (I s) = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}
[PROOF STEP]
apply (simp add: I_def in_S observations_finite observations_wellformed nn_integral_pmf_of_set)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>o\<in>\<O>\<^sub>s. emeasure (T (s, o)) {\<omega>. \<exists>xs. (\<exists>\<omega>'. \<omega> = xs @- \<omega>') \<and> map snd xs = os}) = of_nat (card \<O>\<^sub>s) * emeasure (T (s, obs)) {\<omega>. \<exists>xs. (\<exists>\<omega>'. \<omega> = xs @- \<omega>') \<and> map snd xs = os} \<Longrightarrow> of_nat (card \<O>\<^sub>s) * emeasure (T (s, obs)) {\<omega>. \<exists>xs. (\<exists>\<omega>'. \<omega> = xs @- \<omega>') \<and> map snd xs = os} / of_nat (card \<O>\<^sub>s) = emeasure (T (s, obs)) {\<omega>. \<exists>xs. (\<exists>\<omega>'. \<omega> = xs @- \<omega>') \<and> map snd xs = os}
[PROOF STEP]
apply (subst mult.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>o\<in>\<O>\<^sub>s. emeasure (T (s, o)) {\<omega>. \<exists>xs. (\<exists>\<omega>'. \<omega> = xs @- \<omega>') \<and> map snd xs = os}) = of_nat (card \<O>\<^sub>s) * emeasure (T (s, obs)) {\<omega>. \<exists>xs. (\<exists>\<omega>'. \<omega> = xs @- \<omega>') \<and> map snd xs = os} \<Longrightarrow> emeasure (T (s, obs)) {\<omega>. \<exists>xs. (\<exists>\<omega>'. \<omega> = xs @- \<omega>') \<and> map snd xs = os} * of_nat (card \<O>\<^sub>s) / of_nat (card \<O>\<^sub>s) = emeasure (T (s, obs)) {\<omega>. \<exists>xs. (\<exists>\<omega>'. \<omega> = xs @- \<omega>') \<and> map snd xs = os}
[PROOF STEP]
apply (simp add: observations_finite observations_wellformed mult_divide_eq_ennreal)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
likelihood s os = emeasure (T (s, obs)) {\<omega> \<in> space (stream_space (count_space UNIV)). \<exists>xs \<omega>'. \<omega> = xs @- \<omega>' \<and> map snd xs = os}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_lcomp_ObjMap_app[cat_cs_simps]:
  assumes "category \<alpha> \<CC>"
    and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
    and "a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
    and "c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
  shows "cf_lcomp \<CC> \<SS> \<FF>\<lparr>ObjMap\<rparr>\<lparr>a, c\<rparr>\<^sub>\<bullet> = \<SS>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>, c\<rparr>\<^sub>\<bullet>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_lcomp \<CC> \<SS> \<FF>\<^esub> c = \<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_lcomp \<CC> \<SS> \<FF>\<^esub> c = \<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> c
[PROOF STEP]
unfolding cf_lcomp_def
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_bcomp \<SS> \<FF> (dghm_id \<CC>)\<^esub> c = \<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> c
[PROOF STEP]
by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros cat_prod_cs_intros)


[STATEMENT]
lemma fs_contract: "fst ` { p | p. f (fst p) (snd p) \<in> S } = { a . \<exists>b. f a b \<in> S }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ` {p |p. f (fst p) (snd p) \<in> S} = {a. \<exists>b. f a b \<in> S}
[PROOF STEP]
by (simp add: image_Collect)


[STATEMENT]
lemma YFtorObj2:
  assumes "LSCategory C" and "X \<in> Obj C" and "Y \<in> Obj C"
  shows "((YFtor C) @@ Y) @@ X = Hom\<^bsub>C \<^esub>X Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (YFtor C @@ Y) @@ X = Hom\<^bsub>C\<^esub> X Y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (YFtor C @@ Y) @@ X = Hom\<^bsub>C\<^esub> X Y
[PROOF STEP]
have "Hom\<^bsub>C \<^esub>X Y = ((Hom\<^bsub>C\<^esub>[\<midarrow>,Y]) @@ X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hom\<^bsub>C\<^esub> X Y = (Hom\<^bsub>C\<^esub>[\<midarrow>,Y]) @@ X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
LSCategory C
X \<in> obj\<^bsub>C\<^esub>
Y \<in> obj\<^bsub>C\<^esub>

goal (1 subgoal):
 1. Hom\<^bsub>C\<^esub> X Y = (Hom\<^bsub>C\<^esub>[\<midarrow>,Y]) @@ X
[PROOF STEP]
by (simp add: HomFtorOpObj)
[PROOF STATE]
proof (state)
this:
Hom\<^bsub>C\<^esub> X Y = (Hom\<^bsub>C\<^esub>[\<midarrow>,Y]) @@ X

goal (1 subgoal):
 1. (YFtor C @@ Y) @@ X = Hom\<^bsub>C\<^esub> X Y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hom\<^bsub>C\<^esub> X Y = (Hom\<^bsub>C\<^esub>[\<midarrow>,Y]) @@ X

goal (1 subgoal):
 1. (YFtor C @@ Y) @@ X = Hom\<^bsub>C\<^esub> X Y
[PROOF STEP]
have "... = ((YFtor C @@ Y) @@ X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Hom\<^bsub>C\<^esub>[\<midarrow>,Y]) @@ X = (YFtor C @@ Y) @@ X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
LSCategory C
X \<in> obj\<^bsub>C\<^esub>
Y \<in> obj\<^bsub>C\<^esub>

goal (1 subgoal):
 1. (Hom\<^bsub>C\<^esub>[\<midarrow>,Y]) @@ X = (YFtor C @@ Y) @@ X
[PROOF STEP]
by (simp add: YFtorObj)
[PROOF STATE]
proof (state)
this:
(Hom\<^bsub>C\<^esub>[\<midarrow>,Y]) @@ X = (YFtor C @@ Y) @@ X

goal (1 subgoal):
 1. (YFtor C @@ Y) @@ X = Hom\<^bsub>C\<^esub> X Y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Hom\<^bsub>C\<^esub> X Y = (YFtor C @@ Y) @@ X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Hom\<^bsub>C\<^esub> X Y = (YFtor C @@ Y) @@ X

goal (1 subgoal):
 1. (YFtor C @@ Y) @@ X = Hom\<^bsub>C\<^esub> X Y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(YFtor C @@ Y) @@ X = Hom\<^bsub>C\<^esub> X Y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_subtrees: "finite {x. is_subtree x t}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x. is_subtree x t}
[PROOF STEP]
by (induction t) auto


[STATEMENT]
lemma mset_remdups: "mset (remdups xs) = mset_set (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (remdups xs) = mset_set (set xs)
[PROOF STEP]
proof (induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mset (remdups []) = mset_set (set [])
 2. \<And>a xs. mset (remdups xs) = mset_set (set xs) \<Longrightarrow> mset (remdups (a # xs)) = mset_set (set (a # xs))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
mset (remdups xs) = mset_set (set xs)

goal (2 subgoals):
 1. mset (remdups []) = mset_set (set [])
 2. \<And>a xs. mset (remdups xs) = mset_set (set xs) \<Longrightarrow> mset (remdups (a # xs)) = mset_set (set (a # xs))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
mset (remdups xs) = mset_set (set xs)

goal (1 subgoal):
 1. mset (remdups (x # xs)) = mset_set (set (x # xs))
[PROOF STEP]
by (cases "x \<in> set xs") (auto simp: insert_absorb)
[PROOF STATE]
proof (state)
this:
mset (remdups (x # xs)) = mset_set (set (x # xs))

goal (1 subgoal):
 1. mset (remdups []) = mset_set (set [])
[PROOF STEP]
qed auto


[STATEMENT]
lemma upper_minus[simp]: "upper (minus A B) = minus (upper A) (lower B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper (A - B) = upper A - lower B
[PROOF STEP]
by (auto simp: minus_interval_def)


[STATEMENT]
lemma subseqs_Cons: "subseqs (x#xs) = map (Cons x) (subseqs xs) @ (subseqs xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subseqs (x # xs) = map ((#) x) (subseqs xs) @ subseqs xs
[PROOF STEP]
using cong_let[of "subseqs xs" "\<lambda>xss. map (Cons x) xss @ xss"]
[PROOF STATE]
proof (prove)
using this:
(let xa = subseqs xs in map ((#) x) xa @ xa) = map ((#) x) (subseqs xs) @ subseqs xs

goal (1 subgoal):
 1. subseqs (x # xs) = map ((#) x) (subseqs xs) @ subseqs xs
[PROOF STEP]
by simp


[STATEMENT]
lemma cblinfun_power_compose[simp]: \<open>cblinfun_power A n o\<^sub>C\<^sub>L cblinfun_power A m = cblinfun_power A (n+m)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_power A n o\<^sub>C\<^sub>L cblinfun_power A m = cblinfun_power A (n + m)
[PROOF STEP]
apply (induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. cblinfun_power A 0 o\<^sub>C\<^sub>L cblinfun_power A m = cblinfun_power A (0 + m)
 2. \<And>n. cblinfun_power A n o\<^sub>C\<^sub>L cblinfun_power A m = cblinfun_power A (n + m) \<Longrightarrow> cblinfun_power A (Suc n) o\<^sub>C\<^sub>L cblinfun_power A m = cblinfun_power A (Suc n + m)
[PROOF STEP]
by (auto simp: cblinfun_power_Suc' cblinfun_compose_assoc)


[STATEMENT]
lemma hoare_weaken_left[trans]: \<open>A \<le> B \<Longrightarrow> hoare B p C \<Longrightarrow> hoare A p C\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<le> B; hoare B p C\<rbrakk> \<Longrightarrow> hoare A p C
[PROOF STEP]
unfolding hoare_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<le> B; \<forall>\<psi>\<in>space_as_set B. program p *\<^sub>V \<psi> \<in> space_as_set C\<rbrakk> \<Longrightarrow> \<forall>\<psi>\<in>space_as_set A. program p *\<^sub>V \<psi> \<in> space_as_set C
[PROOF STEP]
by (meson in_mono less_eq_ccsubspace.rep_eq)


[STATEMENT]
lemma mkuexpr_divide [mkuexpr]: "mk\<^sub>e (\<lambda> s. f s / g s) = mk\<^sub>e f / mk\<^sub>e g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk\<^sub>e (\<lambda>s. f s / g s) = mk\<^sub>e f / mk\<^sub>e g
[PROOF STEP]
by (simp add: divide_uexpr_def, transfer, simp)


[STATEMENT]
lemma all_edges_btwn_neighbor_sets_lower_bound:
  fixes \<epsilon>::real
  assumes rp2: "regular_pair Y Z G \<epsilon>"
    and ed1: "edge_density X Y G  \<ge> 2*\<epsilon>" and ed2: "edge_density X Z G  \<ge> 2*\<epsilon>"
    and cond1: "card (neighbors_ss x Y G) \<ge> (edge_density X Y G - \<epsilon>) * card Y"
    and cond2: "card (neighbors_ss x Z G) \<ge> (edge_density X Z G - \<epsilon>) * card Z"
  shows "card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G)
      \<ge> (edge_density Y Z G - \<epsilon>) * card (neighbors_ss x Y G) * card (neighbors_ss x Z G)"
    (is "card (all_edges_between ?Y' ?Z' G) \<ge> (edge_density Y Z G - \<epsilon>) * card ?Y' * card ?Z'")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
have yss': "?Y' \<subseteq> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. neighbors_ss x Y G \<subseteq> Y
[PROOF STEP]
using neighbors_ss_def
[PROOF STATE]
proof (prove)
using this:
neighbors_ss ?x ?Y ?G \<equiv> {y \<in> ?Y. neighbor_in_graph ?x y ?G}

goal (1 subgoal):
 1. neighbors_ss x Y G \<subseteq> Y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
neighbors_ss x Y G \<subseteq> Y

goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
have zss': "?Z' \<subseteq> Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. neighbors_ss x Z G \<subseteq> Z
[PROOF STEP]
using neighbors_ss_def
[PROOF STATE]
proof (prove)
using this:
neighbors_ss ?x ?Y ?G \<equiv> {y \<in> ?Y. neighbor_in_graph ?x y ?G}

goal (1 subgoal):
 1. neighbors_ss x Z G \<subseteq> Z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
neighbors_ss x Z G \<subseteq> Z

goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
have min_sizeY: "card ?Y' \<ge> \<epsilon> * card Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<epsilon> * real (card Y) \<le> real (card (neighbors_ss x Y G))
[PROOF STEP]
using cond1 ed1 neighbor_set_meets_e_reg_cond
[PROOF STATE]
proof (prove)
using this:
(edge_density X Y G - \<epsilon>) * real (card Y) \<le> real (card (neighbors_ss x Y G))
2 * \<epsilon> \<le> edge_density X Y G
\<lbrakk>2 * ?\<epsilon> \<le> edge_density ?X ?Y ?G; (edge_density ?X ?Y ?G - ?\<epsilon>) * real (card ?Y) \<le> real (card (neighbors_ss ?x ?Y ?G))\<rbrakk> \<Longrightarrow> ?\<epsilon> * real (card ?Y) \<le> real (card (neighbors_ss ?x ?Y ?G))

goal (1 subgoal):
 1. \<epsilon> * real (card Y) \<le> real (card (neighbors_ss x Y G))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<epsilon> * real (card Y) \<le> real (card (neighbors_ss x Y G))

goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
have min_sizeZ: "card ?Z' \<ge> \<epsilon> * card Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<epsilon> * real (card Z) \<le> real (card (neighbors_ss x Z G))
[PROOF STEP]
using cond2 ed2 neighbor_set_meets_e_reg_cond
[PROOF STATE]
proof (prove)
using this:
(edge_density X Z G - \<epsilon>) * real (card Z) \<le> real (card (neighbors_ss x Z G))
2 * \<epsilon> \<le> edge_density X Z G
\<lbrakk>2 * ?\<epsilon> \<le> edge_density ?X ?Y ?G; (edge_density ?X ?Y ?G - ?\<epsilon>) * real (card ?Y) \<le> real (card (neighbors_ss ?x ?Y ?G))\<rbrakk> \<Longrightarrow> ?\<epsilon> * real (card ?Y) \<le> real (card (neighbors_ss ?x ?Y ?G))

goal (1 subgoal):
 1. \<epsilon> * real (card Z) \<le> real (card (neighbors_ss x Z G))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<epsilon> * real (card Z) \<le> real (card (neighbors_ss x Z G))

goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<epsilon> * real (card Z) \<le> real (card (neighbors_ss x Z G))
[PROOF STEP]
have "\<bar> edge_density ?Y' ?Z' G - edge_density Y Z G \<bar> \<le> \<epsilon>"
[PROOF STATE]
proof (prove)
using this:
\<epsilon> * real (card Z) \<le> real (card (neighbors_ss x Z G))

goal (1 subgoal):
 1. \<bar>edge_density (neighbors_ss x Y G) (neighbors_ss x Z G) G - edge_density Y Z G\<bar> \<le> \<epsilon>
[PROOF STEP]
using min_sizeY yss' zss' assms
[PROOF STATE]
proof (prove)
using this:
\<epsilon> * real (card Z) \<le> real (card (neighbors_ss x Z G))
\<epsilon> * real (card Y) \<le> real (card (neighbors_ss x Y G))
neighbors_ss x Y G \<subseteq> Y
neighbors_ss x Z G \<subseteq> Z
regular_pair Y Z G \<epsilon>
2 * \<epsilon> \<le> edge_density X Y G
2 * \<epsilon> \<le> edge_density X Z G
(edge_density X Y G - \<epsilon>) * real (card Y) \<le> real (card (neighbors_ss x Y G))
(edge_density X Z G - \<epsilon>) * real (card Z) \<le> real (card (neighbors_ss x Z G))

goal (1 subgoal):
 1. \<bar>edge_density (neighbors_ss x Y G) (neighbors_ss x Z G) G - edge_density Y Z G\<bar> \<le> \<epsilon>
[PROOF STEP]
by (force simp add: regular_pair_def)
[PROOF STATE]
proof (state)
this:
\<bar>edge_density (neighbors_ss x Y G) (neighbors_ss x Z G) G - edge_density Y Z G\<bar> \<le> \<epsilon>

goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>edge_density (neighbors_ss x Y G) (neighbors_ss x Z G) G - edge_density Y Z G\<bar> \<le> \<epsilon>
[PROOF STEP]
have "edge_density Y Z G - \<epsilon> \<le> (card (all_edges_between ?Y' ?Z' G)/(card ?Y' * card ?Z'))"
[PROOF STATE]
proof (prove)
using this:
\<bar>edge_density (neighbors_ss x Y G) (neighbors_ss x Z G) G - edge_density Y Z G\<bar> \<le> \<epsilon>

goal (1 subgoal):
 1. edge_density Y Z G - \<epsilon> \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G)) / real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G))
[PROOF STEP]
using edge_density_def
[PROOF STATE]
proof (prove)
using this:
\<bar>edge_density (neighbors_ss x Y G) (neighbors_ss x Z G) G - edge_density Y Z G\<bar> \<le> \<epsilon>
edge_density ?X ?Y ?G \<equiv> real (card (all_edges_between ?X ?Y ?G)) / real (card ?X * card ?Y)

goal (1 subgoal):
 1. edge_density Y Z G - \<epsilon> \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G)) / real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
edge_density Y Z G - \<epsilon> \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G)) / real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G))

goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
edge_density Y Z G - \<epsilon> \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G)) / real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G))
[PROOF STEP]
have "(card ?Y' * card ?Z') * (edge_density Y Z G - \<epsilon>) \<le> (card (all_edges_between ?Y' ?Z' G))"
[PROOF STATE]
proof (prove)
using this:
edge_density Y Z G - \<epsilon> \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G)) / real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G))

goal (1 subgoal):
 1. real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G)) * (edge_density Y Z G - \<epsilon>) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
by (fastforce simp: divide_simps mult.commute simp flip: of_nat_mult split: if_split_asm)
[PROOF STATE]
proof (state)
this:
real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G)) * (edge_density Y Z G - \<epsilon>) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))

goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G)) * (edge_density Y Z G - \<epsilon>) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (card (neighbors_ss x Y G) * card (neighbors_ss x Z G)) * (edge_density Y Z G - \<epsilon>) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))

goal (1 subgoal):
 1. (edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))
[PROOF STEP]
by (metis (no_types, lifting) mult.assoc mult_of_nat_commute of_nat_mult)
[PROOF STATE]
proof (state)
this:
(edge_density Y Z G - \<epsilon>) * real (card (neighbors_ss x Y G)) * real (card (neighbors_ss x Z G)) \<le> real (card (all_edges_between (neighbors_ss x Y G) (neighbors_ss x Z G) G))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SUP_comp_fun:
  "(\<Squnion>a\<in>A. g a) \<circ> f = (\<Squnion>a\<in>A. g a \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (g ` A) \<circ> f = (\<Squnion>a\<in>A. g a \<circ> f)
[PROOF STEP]
by (simp add: fun_eq_iff image_comp)


[STATEMENT]
lemma map_option_mono [partial_function_mono]: (* To be moved to HOL *)
  "mono_option f \<Longrightarrow> mono_option (\<lambda>x. map_option g (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone option.le_fun option_ord f \<Longrightarrow> monotone option.le_fun option_ord (\<lambda>x. map_option g (f x))
[PROOF STEP]
apply (rule monotoneI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>monotone option.le_fun option_ord f; option.le_fun x y\<rbrakk> \<Longrightarrow> option_ord (map_option g (f x)) (map_option g (f y))
[PROOF STEP]
apply (drule (1) monotoneD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>option.le_fun x y; option_ord (f x) (f y)\<rbrakk> \<Longrightarrow> option_ord (map_option g (f x)) (map_option g (f y))
[PROOF STEP]
apply (auto simp add: flat_ord_def split: option.split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_prefixes_append:
  "set (prefixes (xs @ ys)) = set (prefixes xs) \<union> {xs @ ys' |ys'. ys' \<in> set (prefixes ys)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (prefixes (xs @ ys)) = set (prefixes xs) \<union> {xs @ ys' |ys'. ys' \<in> set (prefixes ys)}
[PROOF STEP]
by (subst prefixes_append, cases ys) auto


[STATEMENT]
lemma length_eq_card_rows:
  fixes A::"'a^'columns::{mod_type}^'rows::{mod_type}"
  shows "IArray.length (matrix_to_iarray A) = CARD('rows)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.length (matrix_to_iarray A) = CARD('rows)
[PROOF STEP]
unfolding matrix_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.length (IArray (map (vec_to_iarray \<circ> ($) A \<circ> mod_type_class.from_nat) [0..<CARD('rows)])) = CARD('rows)
[PROOF STEP]
by auto


[STATEMENT]
lemma suminf_upper:
  fixes f :: "nat \<Rightarrow> ereal"
  assumes "\<And>n. 0 \<le> f n"
  shows "(\<Sum>n<N. f n) \<le> (\<Sum>n. f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<N} \<le> (\<Sum>n. f n)
[PROOF STEP]
unfolding suminf_ereal_eq_SUP [OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<N} \<le> (SUP n. sum f {..<n})
[PROOF STEP]
by (auto intro: complete_lattice_class.SUP_upper)


[STATEMENT]
lemma leadsTo_eq_subset_wlt: "F \<in> A leadsTo B = (A \<subseteq> wlt F B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<in> A \<longmapsto> B) = (A \<subseteq> wlt F B)
[PROOF STEP]
by (blast intro!: leadsTo_subset wlt_leadsTo [THEN leadsTo_weaken_L])


[STATEMENT]
lemma trans_knights_path:
  assumes "knights_path b ps"
  shows "knights_path (trans_board (k\<^sub>1,k\<^sub>2) b) (trans_path (k\<^sub>1,k\<^sub>2) ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) ps)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
knights_path b ps

goal (1 subgoal):
 1. knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) ps)
[PROOF STEP]
proof (induction rule: knights_path.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
case (2 s\<^sub>i b s\<^sub>j xs)
[PROOF STATE]
proof (state)
this:
s\<^sub>i \<notin> b
valid_step s\<^sub>i s\<^sub>j
knights_path b (s\<^sub>j # xs)
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # xs))

goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s\<^sub>i \<notin> b
valid_step s\<^sub>i s\<^sub>j
knights_path b (s\<^sub>j # xs)
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # xs))
[PROOF STEP]
obtain i j i' j' where split: "s\<^sub>i = (i,j)" "s\<^sub>j = (i',j')"
[PROOF STATE]
proof (prove)
using this:
s\<^sub>i \<notin> b
valid_step s\<^sub>i s\<^sub>j
knights_path b (s\<^sub>j # xs)
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # xs))

goal (1 subgoal):
 1. (\<And>i j i' j'. \<lbrakk>s\<^sub>i = (i, j); s\<^sub>j = (i', j')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
s\<^sub>i = (i, j)
s\<^sub>j = (i', j')

goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
let ?s\<^sub>i="(i+k\<^sub>1,j+k\<^sub>2)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
let ?s\<^sub>j="(i'+k\<^sub>1,j'+k\<^sub>2)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
let ?xs="trans_path (k\<^sub>1,k\<^sub>2) xs"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
let ?b="trans_board (k\<^sub>1,k\<^sub>2) b"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
have simps: "trans_path (k\<^sub>1,k\<^sub>2) (s\<^sub>i#s\<^sub>j#xs) = ?s\<^sub>i#?s\<^sub>j#?xs"
              "?b \<union> {?s\<^sub>i} = trans_board (k\<^sub>1,k\<^sub>2) (b \<union> {s\<^sub>i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # xs) = (i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs &&& trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)} = trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})
[PROOF STEP]
unfolding trans_board_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # xs) = (i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs &&& (case (k\<^sub>1, k\<^sub>2) of (k\<^sub>1, k\<^sub>2) \<Rightarrow> {(i + k\<^sub>1, j + k\<^sub>2) |i j. (i, j) \<in> b}) \<union> {(i + k\<^sub>1, j + k\<^sub>2)} = (case (k\<^sub>1, k\<^sub>2) of (k\<^sub>1, k\<^sub>2) \<Rightarrow> {(i + k\<^sub>1, j + k\<^sub>2) |i j. (i, j) \<in> b \<union> {s\<^sub>i}})
[PROOF STEP]
using split
[PROOF STATE]
proof (prove)
using this:
s\<^sub>i = (i, j)
s\<^sub>j = (i', j')

goal (1 subgoal):
 1. trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # xs) = (i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs &&& (case (k\<^sub>1, k\<^sub>2) of (k\<^sub>1, k\<^sub>2) \<Rightarrow> {(i + k\<^sub>1, j + k\<^sub>2) |i j. (i, j) \<in> b}) \<union> {(i + k\<^sub>1, j + k\<^sub>2)} = (case (k\<^sub>1, k\<^sub>2) of (k\<^sub>1, k\<^sub>2) \<Rightarrow> {(i + k\<^sub>1, j + k\<^sub>2) |i j. (i, j) \<in> b \<union> {s\<^sub>i}})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # xs) = (i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs
trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)} = trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})

goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
have "?s\<^sub>i \<notin> ?b" "valid_step ?s\<^sub>i ?s\<^sub>j" "knights_path ?b (?s\<^sub>j#?xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i + k\<^sub>1, j + k\<^sub>2) \<notin> trans_board (k\<^sub>1, k\<^sub>2) b &&& valid_step (i + k\<^sub>1, j + k\<^sub>2) (i' + k\<^sub>1, j' + k\<^sub>2) &&& knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) ((i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)
[PROOF STEP]
using 2 split trans_valid_step
[PROOF STATE]
proof (prove)
using this:
s\<^sub>i \<notin> b
valid_step s\<^sub>i s\<^sub>j
knights_path b (s\<^sub>j # xs)
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # xs))
s\<^sub>i = (i, j)
s\<^sub>j = (i', j')
valid_step (?i, ?j) (?i', ?j') \<Longrightarrow> valid_step (?i + ?k\<^sub>1, ?j + ?k\<^sub>2) (?i' + ?k\<^sub>1, ?j' + ?k\<^sub>2)

goal (1 subgoal):
 1. (i + k\<^sub>1, j + k\<^sub>2) \<notin> trans_board (k\<^sub>1, k\<^sub>2) b &&& valid_step (i + k\<^sub>1, j + k\<^sub>2) (i' + k\<^sub>1, j' + k\<^sub>2) &&& knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) ((i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)
[PROOF STEP]
by (auto simp: trans_board_def)
[PROOF STATE]
proof (state)
this:
(i + k\<^sub>1, j + k\<^sub>2) \<notin> trans_board (k\<^sub>1, k\<^sub>2) b
valid_step (i + k\<^sub>1, j + k\<^sub>2) (i' + k\<^sub>1, j' + k\<^sub>2)
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) ((i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)

goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(i + k\<^sub>1, j + k\<^sub>2) \<notin> trans_board (k\<^sub>1, k\<^sub>2) b
valid_step (i + k\<^sub>1, j + k\<^sub>2) (i' + k\<^sub>1, j' + k\<^sub>2)
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) ((i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)
[PROOF STEP]
have "knights_path (?b \<union> {?s\<^sub>i}) (?s\<^sub>i#?s\<^sub>j#?xs)"
[PROOF STATE]
proof (prove)
using this:
(i + k\<^sub>1, j + k\<^sub>2) \<notin> trans_board (k\<^sub>1, k\<^sub>2) b
valid_step (i + k\<^sub>1, j + k\<^sub>2) (i' + k\<^sub>1, j' + k\<^sub>2)
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) ((i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)

goal (1 subgoal):
 1. knights_path (trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)}) ((i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)
[PROOF STEP]
using knights_path.intros
[PROOF STATE]
proof (prove)
using this:
(i + k\<^sub>1, j + k\<^sub>2) \<notin> trans_board (k\<^sub>1, k\<^sub>2) b
valid_step (i + k\<^sub>1, j + k\<^sub>2) (i' + k\<^sub>1, j' + k\<^sub>2)
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) ((i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)
knights_path {?s\<^sub>i} [?s\<^sub>i]
\<lbrakk>?s\<^sub>i \<notin> ?b; valid_step ?s\<^sub>i ?s\<^sub>j; knights_path ?b (?s\<^sub>j # ?ps)\<rbrakk> \<Longrightarrow> knights_path (?b \<union> {?s\<^sub>i}) (?s\<^sub>i # ?s\<^sub>j # ?ps)

goal (1 subgoal):
 1. knights_path (trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)}) ((i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)}) ((i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)

goal (2 subgoals):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
 2. \<And>s\<^sub>i b s\<^sub>j ps. \<lbrakk>s\<^sub>i \<notin> b; valid_step s\<^sub>i s\<^sub>j; knights_path b (s\<^sub>j # ps); knights_path (trans_board (k\<^sub>1, k\<^sub>2) b) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>j # ps))\<rbrakk> \<Longrightarrow> knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # ps))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)}) ((i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)}) ((i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)

goal (1 subgoal):
 1. knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # xs))
[PROOF STEP]
using simps
[PROOF STATE]
proof (prove)
using this:
knights_path (trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)}) ((i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs)
trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # xs) = (i + k\<^sub>1, j + k\<^sub>2) # (i' + k\<^sub>1, j' + k\<^sub>2) # trans_path (k\<^sub>1, k\<^sub>2) xs
trans_board (k\<^sub>1, k\<^sub>2) b \<union> {(i + k\<^sub>1, j + k\<^sub>2)} = trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})

goal (1 subgoal):
 1. knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
knights_path (trans_board (k\<^sub>1, k\<^sub>2) (b \<union> {s\<^sub>i})) (trans_path (k\<^sub>1, k\<^sub>2) (s\<^sub>i # s\<^sub>j # xs))

goal (1 subgoal):
 1. \<And>s\<^sub>i. knights_path (trans_board (k\<^sub>1, k\<^sub>2) {s\<^sub>i}) (trans_path (k\<^sub>1, k\<^sub>2) [s\<^sub>i])
[PROOF STEP]
qed (auto simp: trans_board_def intro: knights_path.intros)


[STATEMENT]
lemma exists_base:
  assumes "dimension n K E"
  shows "\<exists>Vs. set Vs \<subseteq> carrier R \<and> independent K Vs \<and> length Vs = n \<and> Span K Vs = E"
    (is "\<exists>Vs. ?base K Vs E n")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dimension n K E

goal (1 subgoal):
 1. \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E
[PROOF STEP]
proof (induct E rule: dimension.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>K. \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = 0 \<and> Span K Vs = {\<zero>}
 2. \<And>v E n K. \<lbrakk>v \<in> carrier R; v \<notin> E; dimension n K E; \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E\<rbrakk> \<Longrightarrow> \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E
[PROOF STEP]
case zero_dim
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>K. \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = 0 \<and> Span K Vs = {\<zero>}
 2. \<And>v E n K. \<lbrakk>v \<in> carrier R; v \<notin> E; dimension n K E; \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E\<rbrakk> \<Longrightarrow> \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K_ Vs \<and> length Vs = 0 \<and> Span K_ Vs = {\<zero>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K_ Vs \<and> length Vs = 0 \<and> Span K_ Vs = {\<zero>}

goal (1 subgoal):
 1. \<And>v E n K. \<lbrakk>v \<in> carrier R; v \<notin> E; dimension n K E; \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E\<rbrakk> \<Longrightarrow> \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v E n K. \<lbrakk>v \<in> carrier R; v \<notin> E; dimension n K E; \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E\<rbrakk> \<Longrightarrow> \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E
[PROOF STEP]
case (Suc_dim v E n K)
[PROOF STATE]
proof (state)
this:
v \<in> carrier R
v \<notin> E
dimension n K E
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E

goal (1 subgoal):
 1. \<And>v E n K. \<lbrakk>v \<in> carrier R; v \<notin> E; dimension n K E; \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E\<rbrakk> \<Longrightarrow> \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v \<in> carrier R
v \<notin> E
dimension n K E
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E
[PROOF STEP]
obtain Vs where Vs: "set Vs \<subseteq> carrier R" "independent K Vs" "length Vs = n" "Span K Vs = E"
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier R
v \<notin> E
dimension n K E
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E

goal (1 subgoal):
 1. (\<And>Vs. \<lbrakk>set Vs \<subseteq> carrier R; local.independent K Vs; length Vs = n; Span K Vs = E\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Vs \<subseteq> carrier R
local.independent K Vs
length Vs = n
Span K Vs = E

goal (1 subgoal):
 1. \<And>v E n K. \<lbrakk>v \<in> carrier R; v \<notin> E; dimension n K E; \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E\<rbrakk> \<Longrightarrow> \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E
[PROOF STEP]
hence "?base K (v # Vs) (line_extension K v E) (Suc n)"
[PROOF STATE]
proof (prove)
using this:
set Vs \<subseteq> carrier R
local.independent K Vs
length Vs = n
Span K Vs = E

goal (1 subgoal):
 1. set (v # Vs) \<subseteq> carrier R \<and> local.independent K (v # Vs) \<and> length (v # Vs) = Suc n \<and> Span K (v # Vs) = line_extension K v E
[PROOF STEP]
using Suc_dim li_Cons
[PROOF STATE]
proof (prove)
using this:
set Vs \<subseteq> carrier R
local.independent K Vs
length Vs = n
Span K Vs = E
v \<in> carrier R
v \<notin> E
dimension n K E
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E
\<lbrakk>?u \<in> carrier R; ?u \<notin> Span ?K ?Us; local.independent ?K ?Us\<rbrakk> \<Longrightarrow> local.independent ?K (?u # ?Us)

goal (1 subgoal):
 1. set (v # Vs) \<subseteq> carrier R \<and> local.independent K (v # Vs) \<and> length (v # Vs) = Suc n \<and> Span K (v # Vs) = line_extension K v E
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (v # Vs) \<subseteq> carrier R \<and> local.independent K (v # Vs) \<and> length (v # Vs) = Suc n \<and> Span K (v # Vs) = line_extension K v E

goal (1 subgoal):
 1. \<And>v E n K. \<lbrakk>v \<in> carrier R; v \<notin> E; dimension n K E; \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E\<rbrakk> \<Longrightarrow> \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set (v # Vs) \<subseteq> carrier R \<and> local.independent K (v # Vs) \<and> length (v # Vs) = Suc n \<and> Span K (v # Vs) = line_extension K v E

goal (1 subgoal):
 1. \<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = Suc n \<and> Span K Vs = line_extension K v E

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Theorem_6:
  assumes "stable_on ds X"
  assumes "stable_on ds Y"
  shows "d \<in> ds \<Longrightarrow> card (Cd d X) = card (Cd d Y)"
    and "card (Ch h X) = card (Ch h Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d \<in> ds \<Longrightarrow> card (Cd d X) = card (Cd d Y)) &&& card (Ch h X) = card (Ch h Y)
[PROOF STEP]
using %invisible Theorem_6_fp_cop_F assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>stable_on ?ds ?X; ?d \<in> ?ds\<rbrakk> \<Longrightarrow> card (Cd ?d ?X) = card (Cd ?d (cop ?ds))
stable_on ?ds ?X \<Longrightarrow> card (Ch ?h ?X) = card (Ch ?h (fp_cop_F ?ds))
stable_on ds X
stable_on ds Y

goal (1 subgoal):
 1. (d \<in> ds \<Longrightarrow> card (Cd d X) = card (Cd d Y)) &&& card (Ch h X) = card (Ch h Y)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma cmax2:
  assumes "Card_order r" "Card_order s" "r \<le>o s"
  shows "cmax r s =o s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmax r s =o s
[PROOF STEP]
by (metis assms cmax1 cmax_com ordIso_transitive)


[STATEMENT]
lemma qTermLessPlus_wf: "wf (qTermLess ^+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (qTermLess\<^sup>+)
[PROOF STEP]
using qTermLess_wf wf_trancl
[PROOF STATE]
proof (prove)
using this:
wf qTermLess
wf ?r \<Longrightarrow> wf (?r\<^sup>+)

goal (1 subgoal):
 1. wf (qTermLess\<^sup>+)
[PROOF STEP]
by auto


[STATEMENT]
lemma lset_nth_member_inf: "\<lbrakk> \<not>lfinite xs; lset xs \<subseteq> A \<rbrakk> \<Longrightarrow> lnth xs n \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> lfinite xs; lset xs \<subseteq> A\<rbrakk> \<Longrightarrow> lnth xs n \<in> A
[PROOF STEP]
by (metis contra_subsetD inf_llist_lnth lset_inf_llist rangeI)


[STATEMENT]
lemma fls_base_factor_zero: "fls_base_factor (0::'a::zero fls) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_base_factor 0 = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma closed_plane[simp]: "closed {x. x \<bullet> i = c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (plane i c)
[PROOF STEP]
using closed_hyperplane[of i c]
[PROOF STATE]
proof (prove)
using this:
closed {x. i \<bullet> x = c}

goal (1 subgoal):
 1. closed (plane i c)
[PROOF STEP]
by (auto simp: inner_commute)


[STATEMENT]
lemma intersects_x_axis_intersects_y_axis [simp]:
  shows "intersects_x_axis (moebius_circline (moebius_rotation (pi/2)) H) \<longleftrightarrow> intersects_y_axis H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. intersects_x_axis (moebius_circline (moebius_rotation (pi / 2)) H) = intersects_y_axis H
[PROOF STEP]
unfolding moebius_rotation_def moebius_similarity_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. intersects_x_axis (moebius_circline (mk_moebius (cis (pi / 2)) 0 0 1) H) = intersects_y_axis H
[PROOF STEP]
by simp (transfer, transfer, auto simp add: mat_adj_def mat_cnj_def)


[STATEMENT]
lemma uncross_positive_flip_inv: "uncross_positive_flip w1 w2 \<Longrightarrow> (kauff_mat w1) = (kauff_mat w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncross_positive_flip w1 w2 \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
unfolding uncross_positive_flip_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w1 = right_over \<and> w2 = left_over \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
using  positive_flip_kauff_mat
[PROOF STATE]
proof (prove)
using this:
kauff_mat left_over = kauff_mat right_over

goal (1 subgoal):
 1. w1 = right_over \<and> w2 = left_over \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
by auto


[STATEMENT]
lemma expectation_bernoulli_pmf:
  fixes f :: "bool \<Rightarrow> 'a :: {banach, second_countable_topology}"
  assumes p: "p \<in> {0..1}"
  shows   "measure_pmf.expectation (bernoulli_pmf p) f = p *\<^sub>R f True + (1 - p) *\<^sub>R f False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (bernoulli_pmf p) f = p *\<^sub>R f True + (1 - p) *\<^sub>R f False
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. measure_pmf.expectation (bernoulli_pmf p) f = p *\<^sub>R f True + (1 - p) *\<^sub>R f False
[PROOF STEP]
by (subst integral_measure_pmf[of UNIV]) (auto simp: UNIV_bool)


[STATEMENT]
lemma right_options_plus:
  "right_options (plus_game u v) =  zunion (zimage (\<lambda>g. plus_game g v) (right_options u)) (zimage (\<lambda>h. plus_game u h) (right_options v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_options (plus_game u v) = zunion (zimage (\<lambda>g. plus_game g v) (right_options u)) (zimage (plus_game u) (right_options v))
[PROOF STEP]
by (subst plus_game.simps, simp)


[STATEMENT]
lemma odd_real_root_power_cancel: "odd n \<Longrightarrow> root n (x ^ n) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd n \<Longrightarrow> root n (x ^ n) = x
[PROOF STEP]
using root_sgn_power[of n x]
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> root n (sgn x * \<bar>x\<bar> ^ n) = x

goal (1 subgoal):
 1. odd n \<Longrightarrow> root n (x ^ n) = x
[PROOF STEP]
by (simp add: odd_pos sgn_real_def power_0_left split: if_split_asm)


[STATEMENT]
lemma of_nat_dvd_of_nat_gauss_int_iff:
  "(of_nat m :: gauss_int) dvd of_nat n \<longleftrightarrow> m dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat m dvd of_nat n) = (m dvd n)
[PROOF STEP]
using of_int_dvd_of_int_gauss_int_iff[of "int m" "int n"]
[PROOF STATE]
proof (prove)
using this:
(of_int (int m) dvd of_int (int n)) = (int m dvd int n)

goal (1 subgoal):
 1. (of_nat m dvd of_nat n) = (m dvd n)
[PROOF STEP]
by simp


[STATEMENT]
lemma poly_replicate_append: "poly (monom 1 n * p) (x::'a::comm_ring_1) = x^n * poly p x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (monom (1::'a) n * p) x = x ^ n * poly p x
[PROOF STEP]
by (simp add: poly_monom)


[STATEMENT]
lemma r01_r01__r01__r01_r01_id:
  assumes "0 < r1" "r1 < 1"
          "0 < r2" "r2 < 1"
    shows "(r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1,r2) = (r1,r2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2) = (r1, r2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
 2. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
show "fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
have "fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r01_to_r01_r01_fst (r01_r01_to_r01 (r1,r2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r01_to_r01_r01_fst (r01_r01_to_r01 (r1, r2))
[PROOF STEP]
by(simp add: r01_to_r01_r01_def)
[PROOF STATE]
proof (state)
this:
fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r01_to_r01_r01_fst (r01_r01_to_r01 (r1, r2))

goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r01_to_r01_r01_fst (r01_r01_to_r01 (r1, r2))

goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
have "... = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_to_r01_r01_fst (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
using r01_to_r01_r01_fst_def'[of "r01_r01_to_r01 (r1,r2)"]
[PROOF STATE]
proof (prove)
using this:
r01_to_r01_r01_fst (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. r01_to_r01_r01_fst (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r01_to_r01_r01_fst (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r01_to_r01_r01_fst (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
have "... = (\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1)) = (\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
using r01_r01_to_r01_binary_nth[of r1 r2] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < r1; r1 < 1; 0 < r2; r2 < 1\<rbrakk> \<Longrightarrow> r01_binary_expansion' r1 ?n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * ?n) \<and> r01_binary_expansion' r2 ?n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * ?n + 1)
0 < r1
r1 < 1
0 < r2
r2 < 1

goal (1 subgoal):
 1. (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1)) = (\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1)) = (\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n)) * (1 / 2) ^ (n + 1)) = (\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
have "... = r1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ (n + 1)) = r1
[PROOF STEP]
using r01_binary_expression_correct[of r1] assms(1,2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < r1; r1 < 1\<rbrakk> \<Longrightarrow> r1 = (\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ Suc n)
0 < r1
r1 < 1

goal (1 subgoal):
 1. (\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ (n + 1)) = r1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (r01_binary_expansion' r1 n) * (1 / 2) ^ (n + 1)) = r1

goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r1

goal (1 subgoal):
 1. fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fst ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = fst (r1, r2)

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
show "snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
have "snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r01_to_r01_r01_snd (r01_r01_to_r01 (r1,r2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r01_to_r01_r01_snd (r01_r01_to_r01 (r1, r2))
[PROOF STEP]
by(simp add: r01_to_r01_r01_def)
[PROOF STATE]
proof (state)
this:
snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r01_to_r01_r01_snd (r01_r01_to_r01 (r1, r2))

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r01_to_r01_r01_snd (r01_r01_to_r01 (r1, r2))

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
have "... = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_to_r01_r01_snd (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
using r01_to_r01_r01_snd_def'[of "r01_r01_to_r01 (r1,r2)"]
[PROOF STATE]
proof (prove)
using this:
r01_to_r01_r01_snd (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. r01_to_r01_r01_snd (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r01_to_r01_r01_snd (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r01_to_r01_r01_snd (r01_r01_to_r01 (r1, r2)) = (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
have "... = (\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1)) = (\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
using r01_r01_to_r01_binary_nth[of r1 r2] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < r1; r1 < 1; 0 < r2; r2 < 1\<rbrakk> \<Longrightarrow> r01_binary_expansion' r1 ?n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * ?n) \<and> r01_binary_expansion' r2 ?n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * ?n + 1)
0 < r1
r1 < 1
0 < r2
r2 < 1

goal (1 subgoal):
 1. (\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1)) = (\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ (n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1)) = (\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)) * (1 / 2) ^ (n + 1)) = (\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ (n + 1))

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
have "... = r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ (n + 1)) = r2
[PROOF STEP]
using r01_binary_expression_correct[of r2] assms(3,4)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < r2; r2 < 1\<rbrakk> \<Longrightarrow> r2 = (\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ Suc n)
0 < r2
r2 < 1

goal (1 subgoal):
 1. (\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ (n + 1)) = r2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (r01_binary_expansion' r2 n) * (1 / 2) ^ (n + 1)) = r2

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = r2

goal (1 subgoal):
 1. snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
snd ((r01_to_r01_r01 \<circ> r01_r01_to_r01) (r1, r2)) = snd (r1, r2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minimal_alt_def : "minimal M = (\<forall> q q' . q \<in> states M \<longrightarrow> q' \<in> states M \<longrightarrow> LS M q = LS M q' \<longrightarrow> q = q')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. minimal M = (\<forall>q q'. q \<in> FSM.states M \<longrightarrow> q' \<in> FSM.states M \<longrightarrow> LS M q = LS M q' \<longrightarrow> q = q')
[PROOF STEP]
by auto


[STATEMENT]
theorem omega_comp_fix: "x ^ \<omega> * y = (x * (x ^ \<omega>) * y) \<sqinter> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ \<omega> * y = x * x ^ \<omega> * y \<sqinter> y
[PROOF STEP]
apply (subst omega_fix)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * x ^ \<omega> \<sqinter> (1::'a) * y = x * x ^ \<omega> * y \<sqinter> y
[PROOF STEP]
by (simp add: inf_comp)


[STATEMENT]
theorem decT_liftT [simp]:
  "k \<le> k' \<Longrightarrow> k' + m \<le> k + n \<Longrightarrow> \<down>\<^sub>\<tau> m k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - m) k \<Gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<le> k'; k' + m \<le> k + n\<rbrakk> \<Longrightarrow> \<down>\<^sub>\<tau> m k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - m) k \<Gamma>
[PROOF STEP]
apply (induct m arbitrary: n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>k \<le> k'; k' + 0 \<le> k + n\<rbrakk> \<Longrightarrow> \<down>\<^sub>\<tau> 0 k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - 0) k \<Gamma>
 2. \<And>m n. \<lbrakk>\<And>n. \<lbrakk>k \<le> k'; k' + m \<le> k + n\<rbrakk> \<Longrightarrow> \<down>\<^sub>\<tau> m k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - m) k \<Gamma>; k \<le> k'; k' + Suc m \<le> k + n\<rbrakk> \<Longrightarrow> \<down>\<^sub>\<tau> (Suc m) k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - Suc m) k \<Gamma>
[PROOF STEP]
apply (subgoal_tac [2] "k' + m \<le> k + (n - Suc 0)")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. \<lbrakk>k \<le> k'; k' + 0 \<le> k + n\<rbrakk> \<Longrightarrow> \<down>\<^sub>\<tau> 0 k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - 0) k \<Gamma>
 2. \<And>m n. \<lbrakk>\<And>n. \<lbrakk>k \<le> k'; k' + m \<le> k + n\<rbrakk> \<Longrightarrow> \<down>\<^sub>\<tau> m k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - m) k \<Gamma>; k \<le> k'; k' + Suc m \<le> k + n; k' + m \<le> k + (n - Suc 0)\<rbrakk> \<Longrightarrow> \<down>\<^sub>\<tau> (Suc m) k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - Suc m) k \<Gamma>
 3. \<And>m n. \<lbrakk>\<And>n. \<lbrakk>k \<le> k'; k' + m \<le> k + n\<rbrakk> \<Longrightarrow> \<down>\<^sub>\<tau> m k' (\<up>\<^sub>\<tau> n k \<Gamma>) = \<up>\<^sub>\<tau> (n - m) k \<Gamma>; k \<le> k'; k' + Suc m \<le> k + n\<rbrakk> \<Longrightarrow> k' + m \<le> k + (n - Suc 0)
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lexord_fusion_code:
  "lexord_fusion g1 g2 s1 s2 \<longleftrightarrow>
  (if list.has_next g1 s1 then
     if list.has_next g2 s2 then
       let (x, s1') = list.next g1 s1;
           (y, s2') = list.next g2 s2
       in x < y \<or> \<not> y < x \<and> lexord_fusion g1 g2 s1' s2'
     else False
   else list.has_next g2 s2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lexord_fusion g1 g2 s1 s2 = (if list.has_next g1 s1 then if list.has_next g2 s2 then let (x, s1') = list.next g1 s1; (y, s2') = list.next g2 s2 in x < y \<or> \<not> y < x \<and> lexord_fusion g1 g2 s1' s2' else False else list.has_next g2 s2)
[PROOF STEP]
unfolding lexord_fusion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lexordp (list.unfoldr g1 s1) (list.unfoldr g2 s2) = (if list.has_next g1 s1 then if list.has_next g2 s2 then let (x, s1') = list.next g1 s1; (y, s2') = list.next g2 s2 in x < y \<or> \<not> y < x \<and> lexordp (list.unfoldr g1 s1') (list.unfoldr g2 s2') else False else list.has_next g2 s2)
[PROOF STEP]
by(subst (1 2) list.unfoldr.simps)(auto split: prod.split_asm)


[STATEMENT]
theorem ArrowGeneralPossibility:
  assumes has3A: "has 3 A"
      and finiteIs: "finite Is"
      and has2Is: "has 2 Is"
      and iia: "iia swf A Is"
      and swf: "SWF swf A Is universal_domain"
      and wp: "weak_pareto swf A Is universal_domain"
  obtains j where "dictator swf A Is j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. dictator swf A Is j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using sd_imp_dictator[OF has3A iia swf wp]
        sd_exists[OF has3A finiteIs has2Is iia swf wp]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>hasw [?u, ?v] A; semidecisive swf A Is {?j} ?u ?v\<rbrakk> \<Longrightarrow> dictator swf A Is ?j
\<exists>j u v. hasw [u, v] A \<and> semidecisive swf A Is {j} u v

goal (1 subgoal):
 1. (\<And>j. dictator swf A Is j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma point_linorder_matrix_unique:
  fixes f :: "('a::finite,'b::non_trivial_linorder_stone_relation_algebra_expansion) square"
  shows "matrix_stone_relation_algebra.point f \<longleftrightarrow> (\<exists>!i . \<forall>j . f (i,j) = top \<and> (\<forall>k . i \<noteq> k \<longrightarrow> f (k,j) = bot))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_stone_relation_algebra.point f = (\<exists>!i. \<forall>j. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))
[PROOF STEP]
apply (unfold vector_linorder_matrix bijective_linorder_matrix)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i j k. f (i, j) = f (i, k)) \<and> (\<forall>j. \<exists>i. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))) = (\<exists>!i. \<forall>j. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>i j k. f (i, j) = f (i, k)) \<and> (\<forall>j. \<exists>i. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot)) \<Longrightarrow> \<exists>!i. \<forall>j. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot)
 2. \<exists>!i. \<forall>j. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot) \<Longrightarrow> (\<forall>i j k. f (i, j) = f (i, k)) \<and> (\<forall>j. \<exists>i. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))
[PROOF STEP]
apply (metis bot_not_top)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!i. \<forall>j. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot) \<Longrightarrow> (\<forall>i j k. f (i, j) = f (i, k)) \<and> (\<forall>j. \<exists>i. f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))
[PROOF STEP]
by metis


[STATEMENT]
lemma lastn_one_less:
 shows "n > 0 \<and> n \<le> length x \<and> lastn n x = (a#y) \<longrightarrow> lastn (n - 1) x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<and> n \<le> length x \<and> lastn n x = a # y \<longrightarrow> lastn (n - 1) x = y
[PROOF STEP]
unfolding lastn_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<and> n \<le> length x \<and> drop (length x - n) x = a # y \<longrightarrow> drop (length x - (n - 1)) x = y
[PROOF STEP]
using drop_Suc[where n="length x - n" and xs=x] drop_tl[where n="length x - n" and xs=x]
[PROOF STATE]
proof (prove)
using this:
drop (Suc (length x - n)) x = drop (length x - n) (tl x)
drop (length x - n) (tl x) = tl (drop (length x - n) x)

goal (1 subgoal):
 1. 0 < n \<and> n \<le> length x \<and> drop (length x - n) x = a # y \<longrightarrow> drop (length x - (n - 1)) x = y
[PROOF STEP]
by(auto)


[STATEMENT]
lemma "(0::real) \<le> b \<and> 0 \<le> c \<and> 0 \<le> x \<and> 0 \<le> y \<and> x\<^sup>2 = c \<and> y\<^sup>2 = a\<^sup>2 * c + b \<longrightarrow> a * c \<le> y * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> b \<and> 0 \<le> c \<and> 0 \<le> x \<and> 0 \<le> y \<and> x\<^sup>2 = c \<and> y\<^sup>2 = a\<^sup>2 * c + b \<longrightarrow> a * c \<le> y * x
[PROOF STEP]
by sos


[STATEMENT]
lemma powrat_incseq_bounded:
     "\<lbrakk> 1 \<le> a; \<forall>n. r n < of_rat q; incseq r \<rbrakk> \<Longrightarrow>  a pow\<^sub>\<rat> (r n) \<le> a pow\<^sub>\<rat> q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 \<le> a; \<forall>n. r n < of_rat q; incseq r\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> r n \<le> a pow\<^sub>\<rat> q
[PROOF STEP]
by (simp add: less_imp_le powrat_le_mono)


[STATEMENT]
lemma gen_dfs_pre_imp_wf:
  assumes "gen_dfs_pre E U S V u0"
  shows "wf (gen_dfs_var U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (gen_dfs_var U)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
gen_dfs_pre E U S V u0

goal (1 subgoal):
 1. wf (gen_dfs_var U)
[PROOF STEP]
unfolding gen_dfs_pre_def gen_dfs_var_def
[PROOF STATE]
proof (prove)
using this:
E `` U \<subseteq> U \<and> finite U \<and> V \<subseteq> U \<and> u0 \<in> U \<and> E `` (V - S) \<subseteq> V \<and> u0 \<notin> V \<and> S \<subseteq> V \<and> (\<forall>v\<in>S. (v, u0) \<in> (E \<inter> S \<times> UNIV)\<^sup>*)

goal (1 subgoal):
 1. wf (finite_psupset U)
[PROOF STEP]
by auto


[STATEMENT]
lemma unity_root_uminus: "unity_root k (-m) = cnj (unity_root k m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unity_root k (- m) = cnj (unity_root k m)
[PROOF STEP]
unfolding unity_root_conv_exp exp_cnj
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (complex_of_real (2 * pi * real_of_int (- m) / real k) * \<i>) = exp (cnj (complex_of_real (2 * pi * real_of_int m / real k) * \<i>))
[PROOF STEP]
by simp


[STATEMENT]
lemma powrat_le_mono:
  assumes "r \<le> s" and "1 \<le> x"
  shows "x  pow\<^sub>\<rat> r \<le> x pow\<^sub>\<rat> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> r \<le> x pow\<^sub>\<rat> s
[PROOF STEP]
by (metis (full_types) assms le_less powrat_less_mono powrat_one_eq_one)


[STATEMENT]
lemma valid_states_snapshot:
  "valid_states (prob_proj PROB (prob_dom (snapshot PROB s))) = valid_states (snapshot PROB s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_states (prob_proj PROB (prob_dom (snapshot PROB s))) = valid_states (snapshot PROB s)
[PROOF STEP]
by (metis dom_proj_snapshot valid_states_def)


[STATEMENT]
lemma pick_eq_iff_inf:
assumes "infinite S"
shows "x = y \<longleftrightarrow> pick S x = pick S y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = y) = (pick S x = pick S y)
[PROOF STEP]
by (metis assms nat_neq_iff pick_mono_inf)


[STATEMENT]
lemma (in prob_space) borel_0_1_law_AE:
  fixes P :: "nat \<Rightarrow> 'a \<Rightarrow> bool"
  assumes "indep_events (\<lambda>m. {x\<in>space M. P m x}) UNIV" (is "indep_events ?P _")
  shows "(AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
have [measurable]: "\<And>m. {x\<in>space M. P m x} \<in> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. {x \<in> space M. P m x} \<in> events
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
indep_events (\<lambda>m. {x \<in> space M. P m x}) UNIV

goal (1 subgoal):
 1. \<And>m. {x \<in> space M. P m x} \<in> events
[PROOF STEP]
by (auto simp: indep_events_def)
[PROOF STATE]
proof (state)
this:
{x \<in> space M. P ?m8 x} \<in> events

goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
have *: "(\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) \<in> events"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) \<in> events
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) \<in> events

goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
indep_events (\<lambda>m. {x \<in> space M. P m x}) UNIV
[PROOF STEP]
have "prob (\<Inter>n. \<Union>m\<in>{n..}. ?P m) = 0 \<or> prob (\<Inter>n. \<Union>m\<in>{n..}. ?P m) = 1"
[PROOF STATE]
proof (prove)
using this:
indep_events (\<lambda>m. {x \<in> space M. P m x}) UNIV

goal (1 subgoal):
 1. prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 0 \<or> prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 1
[PROOF STEP]
by (rule borel_0_1_law)
[PROOF STATE]
proof (state)
this:
prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 0 \<or> prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 1

goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 0 \<or> prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 1

goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
have "prob (\<Inter>n. \<Union>m\<in>{n..}. ?P m) = 1 \<longleftrightarrow> (AE x in M. infinite {m. P m x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 1) = (AE x in M. infinite {m. P m x})
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
(\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) \<in> events

goal (1 subgoal):
 1. (prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 1) = (AE x in M. infinite {m. P m x})
[PROOF STEP]
by (simp add: prob_eq_1)
      (simp add: Bex_def infinite_nat_iff_unbounded_le)
[PROOF STATE]
proof (state)
this:
(prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 1) = (AE x in M. infinite {m. P m x})

goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 1) = (AE x in M. infinite {m. P m x})

goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
have "prob (\<Inter>n. \<Union>m\<in>{n..}. ?P m) = 0 \<longleftrightarrow> (AE x in M. finite {m. P m x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 0) = (AE x in M. finite {m. P m x})
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
(\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) \<in> events

goal (1 subgoal):
 1. (prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 0) = (AE x in M. finite {m. P m x})
[PROOF STEP]
by (simp add: prob_eq_0)
      (auto simp add: Ball_def finite_nat_iff_bounded not_less [symmetric])
[PROOF STATE]
proof (state)
this:
(prob (\<Inter>n. \<Union>m\<in>{n..}. {x \<in> space M. P m x}) = 0) = (AE x in M. finite {m. P m x})

goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(AE x in M. finite {m. P m x}) \<or> (AE x in M. infinite {m. P m x})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(AE x in M. finite {m. P m x}) \<or> (AE x in M. infinite {m. P m x})

goal (1 subgoal):
 1. (AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(AE x in M. infinite {m. P m x}) \<or> (AE x in M. finite {m. P m x})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Qp_units_int_pow:
  fixes n::int
  assumes "a \<in> nonzero Q\<^sub>p"
  shows "a[^]n = a[^]\<^bsub>units_of Q\<^sub>p\<^esub>n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] n = a [^]\<^bsub>units_of Q\<^sub>p\<^esub> n
[PROOF STEP]
apply(cases "n \<ge> 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> n \<Longrightarrow> a [^] n = a [^]\<^bsub>units_of Q\<^sub>p\<^esub> n
 2. \<not> 0 \<le> n \<Longrightarrow> a [^] n = a [^]\<^bsub>units_of Q\<^sub>p\<^esub> n
[PROOF STEP]
using monoid.units_of_pow[of Q\<^sub>p]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Group.monoid Q\<^sub>p; ?x \<in> Units Q\<^sub>p\<rbrakk> \<Longrightarrow> ?x [^]\<^bsub>units_of Q\<^sub>p\<^esub> ?n = ?x [^] ?n

goal (2 subgoals):
 1. 0 \<le> n \<Longrightarrow> a [^] n = a [^]\<^bsub>units_of Q\<^sub>p\<^esub> n
 2. \<not> 0 \<le> n \<Longrightarrow> a [^] n = a [^]\<^bsub>units_of Q\<^sub>p\<^esub> n
[PROOF STEP]
apply (metis int_pow_def2 mult_of_is_Units nat_pow_mult_of not_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> 0 \<le> n \<Longrightarrow> a [^] n = a [^]\<^bsub>units_of Q\<^sub>p\<^esub> n
[PROOF STEP]
by (metis Qp.Units_pow_closed Qp.units_of_inv Units_eq_nonzero assms int_pow_def2 mult_of_is_Units nat_pow_mult_of)


[STATEMENT]
lemma omega_slide:
  "x * (y * x)\<^sup>\<omega> = (x * y)\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (y * x)\<^sup>\<omega> = (x * y)\<^sup>\<omega>
[PROOF STEP]
by (metis order.antisym mult_assoc mult_right_isotone omega_simulation omega_unfold order_refl)


[STATEMENT]
lemma "y + (x - y) = (x::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y + (x - y) = x
[PROOF STEP]
by arith


[STATEMENT]
lemma less_ccSup_iff: "countable S \<Longrightarrow> a < Sup S \<longleftrightarrow> (\<exists>x\<in>S. a < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable S \<Longrightarrow> (a < Sup S) = (\<exists>x\<in>S. a < x)
[PROOF STEP]
unfolding not_le [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable S \<Longrightarrow> (\<not> Sup S \<le> a) = (\<exists>x\<in>S. \<not> x \<le> a)
[PROOF STEP]
by (subst ccSup_le_iff) auto


[STATEMENT]
lemma ennreal_inverse_mult': "((0 < b \<or> a < top) \<and> (0 < a \<or> b < top)) \<Longrightarrow> inverse (a * b::ennreal) = inverse a * inverse b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < b \<or> a < top) \<and> (0 < a \<or> b < top) \<Longrightarrow> inverse (a * b) = inverse a * inverse b
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b a. \<lbrakk>0 \<le> b; 0 \<le> a; (0 < b \<or> a < top) \<and> (0 < a \<or> b < top)\<rbrakk> \<Longrightarrow> inverse (a * b) = inverse a * inverse b
[PROOF STEP]
subgoal for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; 0 \<le> b; (0 < a \<or> b < top) \<and> (0 < b \<or> a < top)\<rbrakk> \<Longrightarrow> inverse (b * a) = inverse b * inverse a
[PROOF STEP]
by (cases a b rule: ereal2_cases) (auto simp: top_ereal_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eval_append : "(\<exists>l\<in>set (A#B).evalUni l x) = (evalUni A x \<or> (\<exists>l\<in>set (B).evalUni l x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>l\<in>set (A # B). evalUni l x) = (evalUni A x \<or> (\<exists>l\<in>set B. evalUni l x))
[PROOF STEP]
by auto


[STATEMENT]
lemma NSLIMSEQ_unique: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> X \<longlonglongrightarrow>\<^sub>N\<^sub>S b \<Longrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; X \<longlonglongrightarrow>\<^sub>N\<^sub>S b\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
unfolding NSLIMSEQ_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>N\<in>HNatInfinite. (*f* X) N \<approx> star_of a; \<forall>N\<in>HNatInfinite. (*f* X) N \<approx> star_of b\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
using HNatInfinite_whn approx_trans3 star_of_approx_iff
[PROOF STATE]
proof (prove)
using this:
whn \<in> HNatInfinite
\<lbrakk>?x \<approx> ?r; ?x \<approx> ?s\<rbrakk> \<Longrightarrow> ?r \<approx> ?s
(star_of ?x \<approx> star_of ?y) = (?x = ?y)

goal (1 subgoal):
 1. \<lbrakk>\<forall>N\<in>HNatInfinite. (*f* X) N \<approx> star_of a; \<forall>N\<in>HNatInfinite. (*f* X) N \<approx> star_of b\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
by blast


[STATEMENT]
lemma tanh_ln_complex: "x \<noteq> 0 \<Longrightarrow> tanh (ln x :: complex) = (x ^ 2 - 1) / (x ^ 2 + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> tanh (Ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
by (simp add: tanh_def sinh_ln_complex cosh_ln_complex divide_simps power2_eq_square)


[STATEMENT]
lemma continuous_on_eq_continuous_at: "open s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. isCont f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s \<Longrightarrow> continuous_on s f = (\<forall>x\<in>s. isCont f x)
[PROOF STEP]
by (simp add: continuous_on_def continuous_at at_within_open[of _ s])


[STATEMENT]
lemma eval_tm_SNOC[simp]:
  "\<lbrakk>length is \<le> #\<^sub>V \<AA>; #\<^sub>V \<AA> = length x\<rbrakk> \<Longrightarrow>
   eval_tm (SNOC x \<AA>) is = eval_tm \<AA> is + 2 ^ Length \<AA> * scalar_product x is"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length is \<le> #\<^sub>V \<AA>; #\<^sub>V \<AA> = length x\<rbrakk> \<Longrightarrow> eval_tm (SNOC x \<AA>) is = eval_tm \<AA> is + 2 ^ Length \<AA> * scalar_product (map of_bool x) is
[PROOF STEP]
by transfer (auto simp: scalar_product_SNOC[symmetric]
    intro!: arg_cong2[of _ _ _ _ scalar_product] nth_equalityI)


[STATEMENT]
lemma is_real_inversion:
  assumes "is_real x" and "x \<noteq> 0"
  shows "is_real (to_complex (inversion (of_complex x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_real (to_complex (inversion (of_complex x)))
[PROOF STEP]
using assms eq_cnj_iff_real[of x]
[PROOF STATE]
proof (prove)
using this:
is_real x
x \<noteq> 0
(cnj x = x) = is_real x

goal (1 subgoal):
 1. is_real (to_complex (inversion (of_complex x)))
[PROOF STEP]
by simp


[STATEMENT]
lemma Pow_cexp_ctwo:
  "|Pow A| =o ctwo ^c |A|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Pow A| =o ctwo ^c |A|
[PROOF STEP]
unfolding ctwo_def cexp_def Field_card_of
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Pow A| =o |Func A UNIV|
[PROOF STEP]
by (rule card_of_Pow_Func)


[STATEMENT]
lemma polytope_convex_hull: "finite S \<Longrightarrow> polytope(convex hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> polytope (convex hull S)
[PROOF STEP]
using polytope_def
[PROOF STATE]
proof (prove)
using this:
polytope ?S \<equiv> \<exists>v. finite v \<and> ?S = convex hull v

goal (1 subgoal):
 1. finite S \<Longrightarrow> polytope (convex hull S)
[PROOF STEP]
by auto


[STATEMENT]
lemma H2_ALL [simp]:
  shows "(\<forall>h. P h) = (\<forall>h\<in>{H1, H2}. P h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>h. P h) = (\<forall>h\<in>{H1, H2}. P h)
[PROOF STEP]
using H2_UNIV
[PROOF STATE]
proof (prove)
using this:
UNIV = set [H1, H2]

goal (1 subgoal):
 1. (\<forall>h. P h) = (\<forall>h\<in>{H1, H2}. P h)
[PROOF STEP]
by auto


[STATEMENT]
lemma suminf_eq_SUP_real:
  assumes X: "summable X" "\<And>i. 0 \<le> X i" shows "suminf X = (SUP i. \<Sum>n<i. X n::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. suminf X = (SUP i. sum X {..<i})
[PROOF STEP]
by (intro LIMSEQ_unique[OF summable_LIMSEQ] X LIMSEQ_incseq_SUP)
     (auto intro!: bdd_aboveI2[where M="\<Sum>i. X i"] sum_le_suminf X monoI sum_mono2)