[STATEMENT]
lemma restricted_graph_intersection:
  assumes "g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p"
  assumes "S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "restricted_graph n g S = graph n g \<inter> (cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restricted_graph n g S = graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. restricted_graph n g S \<subseteq> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
 2. graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)) \<subseteq> restricted_graph n g S
[PROOF STEP]
show "restricted_graph n g S \<subseteq> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restricted_graph n g S \<subseteq> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
using assms restricted_graph_subset restricted_graph_subset'
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p
S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
\<lbrakk>?g \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>) \<rightarrow> carrier Q\<^sub>p; ?S \<subseteq> carrier (Q\<^sub>p\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> restricted_graph ?n ?g ?S \<subseteq> graph ?n ?g
\<lbrakk>?g \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>) \<rightarrow> carrier Q\<^sub>p; ?S \<subseteq> carrier (Q\<^sub>p\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> restricted_graph ?n ?g ?S \<subseteq> cartesian_product ?S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))

goal (1 subgoal):
 1. restricted_graph n g S \<subseteq> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
by (meson Int_subset_iff)
[PROOF STATE]
proof (state)
this:
restricted_graph n g S \<subseteq> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))

goal (1 subgoal):
 1. graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)) \<subseteq> restricted_graph n g S
[PROOF STEP]
show "graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)) \<subseteq> restricted_graph n g S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)) \<subseteq> restricted_graph n g S
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)) \<Longrightarrow> x \<in> restricted_graph n g S
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)) \<Longrightarrow> x \<in> restricted_graph n g S
[PROOF STEP]
assume A: " x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))"
[PROOF STATE]
proof (state)
this:
x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))

goal (1 subgoal):
 1. \<And>x. x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)) \<Longrightarrow> x \<in> restricted_graph n g S
[PROOF STEP]
show "x \<in> restricted_graph n g S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> restricted_graph n g S
[PROOF STEP]
apply(rule restricted_graph_memI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. x \<in> carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>)
 2. take n x \<in> S
 3. g (take n x) = x ! n
[PROOF STEP]
using A graph_memE[of g n x]
[PROOF STATE]
proof (prove)
using this:
x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> g (take n x) = x ! n
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> x = take n x @ [g (take n x)]
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> take n x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)

goal (3 subgoals):
 1. x \<in> carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>)
 2. take n x \<in> S
 3. g (take n x) = x ! n
[PROOF STEP]
apply (metis (no_types, lifting) Int_iff add.commute assms(1) graph_mem_closed plus_1_eq_Suc)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. take n x \<in> S
 2. g (take n x) = x ! n
[PROOF STEP]
using A graph_memE[of g n x] cartesian_product_memE[of x S "carrier (Q\<^sub>p\<^bsup>1\<^esup>)" Q\<^sub>p n]
[PROOF STATE]
proof (prove)
using this:
x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> g (take n x) = x ! n
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> x = take n x @ [g (take n x)]
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> take n x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
\<lbrakk>x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)); S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> take n x \<in> S
\<lbrakk>x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)); S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> drop n x \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)

goal (2 subgoals):
 1. take n x \<in> S
 2. g (take n x) = x ! n
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> g (take n x) = x ! n
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> x = take n x @ [g (take n x)]
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> take n x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
\<lbrakk>x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)); S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> take n x \<in> S
\<lbrakk>x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)); S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> drop n x \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)
S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)

goal (2 subgoals):
 1. take n x \<in> S
 2. g (take n x) = x ! n
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (take n x) = x ! n
[PROOF STEP]
using A graph_memE[of g n x] cartesian_product_memE[of x S "carrier (Q\<^sub>p\<^bsup>1\<^esup>)" Q\<^sub>p n]
[PROOF STATE]
proof (prove)
using this:
x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> g (take n x) = x ! n
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> x = take n x @ [g (take n x)]
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> take n x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
\<lbrakk>x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)); S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> take n x \<in> S
\<lbrakk>x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)); S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> drop n x \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)

goal (1 subgoal):
 1. g (take n x) = x ! n
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> g (take n x) = x ! n
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> x = take n x @ [g (take n x)]
\<lbrakk>g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p; x \<in> graph n g\<rbrakk> \<Longrightarrow> take n x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
\<lbrakk>x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)); S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> take n x \<in> S
\<lbrakk>x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)); S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> drop n x \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)
g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. g (take n x) = x ! n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> restricted_graph n g S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
graph n g \<inter> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>)) \<subseteq> restricted_graph n g S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arccos: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> 0 \<le> arccos y \<and> arccos y \<le> pi \<and> cos (arccos y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> 0 \<le> arccos y \<and> arccos y \<le> pi \<and> cos (arccos y) = y
[PROOF STEP]
unfolding arccos_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> 0 \<le> (THE x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y) \<and> (THE x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y) \<le> pi \<and> cos (THE x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y) = y
[PROOF STEP]
by (rule theI' [OF cos_total])


[STATEMENT]
lemma fps_divide_unit_factor_both':
  fixes   f g :: "'a::{inverse,comm_monoid_add,uminus,mult_zero} fps"
  assumes "subdegree g \<le> subdegree f"
  shows   "unit_factor f / unit_factor g = fps_shift (subdegree f - subdegree g) (f / g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_factor f / unit_factor g = fps_shift (subdegree f - subdegree g) (f / g)
[PROOF STEP]
using   assms fps_divide_unit_factor_numer[of f "unit_factor g"]
          fps_divide_unit_factor_denom[of g f]
          fps_shift_rev_shift(1)[of "subdegree g" "subdegree f" "f/g"]
[PROOF STATE]
proof (prove)
using this:
subdegree g \<le> subdegree f
unit_factor f / unit_factor g = fps_shift (subdegree f) (f / unit_factor g)
subdegree g \<le> subdegree f \<Longrightarrow> f / unit_factor g = Abs_fps (\<lambda>k. if k < subdegree g then 0::'a else (f / g) $ (k - subdegree g))
subdegree g \<le> subdegree f \<Longrightarrow> fps_shift (subdegree f) (Abs_fps (\<lambda>k. if k < subdegree g then 0::'a else (f / g) $ (k - subdegree g))) = fps_shift (subdegree f - subdegree g) (f / g)

goal (1 subgoal):
 1. unit_factor f / unit_factor g = fps_shift (subdegree f - subdegree g) (f / g)
[PROOF STEP]
by      simp


[STATEMENT]
lemma EF_step_inv: "(I \<subseteq> {sa::'s :: state. (\<exists>i\<in>I. i \<rightarrow>\<^sub>i* sa) \<and> sa \<in> EF s})
         \<Longrightarrow> \<forall> x \<in> I. \<exists> y \<in> s. x \<rightarrow>\<^sub>i* y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<subseteq> {sa. (\<exists>i\<in>I. i \<rightarrow>\<^sub>i* sa) \<and> sa \<in> EF s} \<Longrightarrow> \<forall>x\<in>I. \<exists>y\<in>s. x \<rightarrow>\<^sub>i* y
[PROOF STEP]
using EF_step_star_rev
[PROOF STATE]
proof (prove)
using this:
?x \<in> EF ?s \<Longrightarrow> \<exists>y\<in>?s. ?x \<rightarrow>\<^sub>i* y

goal (1 subgoal):
 1. I \<subseteq> {sa. (\<exists>i\<in>I. i \<rightarrow>\<^sub>i* sa) \<and> sa \<in> EF s} \<Longrightarrow> \<forall>x\<in>I. \<exists>y\<in>s. x \<rightarrow>\<^sub>i* y
[PROOF STEP]
by fastforce


[STATEMENT]
lemma (in flowgraph) ntrp_add_context_s:
  "\<lbrakk> ((s,c),e,(s',c'))\<in>ntrp fg; mon_w fg (le_rem_s e) \<inter> mon_c fg cn = {} \<rbrakk>
  \<Longrightarrow> ((s,c+cn),e,(s',c'+cn))\<in>ntrp fg"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>((s, c), e, s', c') \<in> ntrp fg; mon_w fg (le_rem_s e) \<inter> mon_c fg cn = {}\<rbrakk> \<Longrightarrow> ((s, c + cn), e, s', c' + cn) \<in> ntrp fg
[PROOF STEP]
apply (erule gtrp.cases)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>sa ca ea s'a c'a. \<lbrakk>mon_w fg (le_rem_s e) \<inter> mon_c fg cn = {}; s = sa; c = ca; e = LOC ea; s' = s'a; c' = c'a; ((sa, ca), ea, s'a, c'a) \<in> ntrs fg\<rbrakk> \<Longrightarrow> ((s, c + cn), e, s', c' + cn) \<in> ntrp fg
 2. \<And>sa sl ca ea s'a c'a. \<lbrakk>mon_w fg (le_rem_s e) \<inter> mon_c fg cn = {}; s = sl; c = add_mset sa ca; e = ENV ea; s' = sl; c' = add_mset s'a c'a; ((sa, add_mset sl ca), ea, s'a, add_mset sl c'a) \<in> ntrs fg\<rbrakk> \<Longrightarrow> ((s, c + cn), e, s', c' + cn) \<in> ntrp fg
[PROOF STEP]
by (auto dest: ntrs_add_context_s intro!: gtrp.intros)


[STATEMENT]
lemma L_While_unfold:
  "L (WHILE b DO c) X = vars b \<union> X \<union> L c (L (WHILE b DO c) X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (WHILE b DO c) X = vars b \<union> X \<union> L c (L (WHILE b DO c) X)
[PROOF STEP]
by(metis lfp_unfold[OF mono_union_L] L.simps(5))


[STATEMENT]
lemma R'_iter: assumes s: "s \<in> states" "s \<noteq> error" "s \<noteq> ok" shows "R' s = (\<integral>t. \<rho> s t + R' t \<partial>\<tau> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R' s = measure_pmf.expectation (\<tau> s) (\<lambda>t. \<rho> s t + R' t)
[PROOF STEP]
unfolding R'_def R_iter[OF s(2,3)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (\<integral>\<^sup>+ t. ennreal (\<rho> s t) + R t \<partial>measure_pmf (\<tau> s)) = measure_pmf.expectation (\<tau> s) (\<lambda>t. \<rho> s t + enn2real (R t))
[PROOF STEP]
proof (rule enn2real_nn_integral_eq_integral)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. AE t in measure_pmf (\<tau> s). ennreal (\<rho> s t) + R t = ennreal (\<rho> s t + enn2real (R t))
 2. AE t in measure_pmf (\<tau> s). 0 \<le> \<rho> s t + enn2real (R t)
 3. \<integral>\<^sup>+ t. ennreal (\<rho> s t) + R t \<partial>measure_pmf (\<tau> s) < \<top>
 4. measure_pmf.random_variable (\<tau> s) borel (\<lambda>x. \<rho> s x + enn2real (R x))
[PROOF STEP]
have "t \<in> E s \<Longrightarrow> R t < top" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> E s \<Longrightarrow> R t < \<top>
[PROOF STEP]
using \<open>s\<in>states\<close> E_closed[of s]
[PROOF STATE]
proof (prove)
using this:
s \<in> states
s \<in> states \<Longrightarrow> E s \<subseteq> states

goal (1 subgoal):
 1. t \<in> E s \<Longrightarrow> R t < \<top>
[PROOF STEP]
by (intro R_less_top) auto
[PROOF STATE]
proof (state)
this:
?t1 \<in> E s \<Longrightarrow> R ?t1 < \<top>

goal (4 subgoals):
 1. AE t in measure_pmf (\<tau> s). ennreal (\<rho> s t) + R t = ennreal (\<rho> s t + enn2real (R t))
 2. AE t in measure_pmf (\<tau> s). 0 \<le> \<rho> s t + enn2real (R t)
 3. \<integral>\<^sup>+ t. ennreal (\<rho> s t) + R t \<partial>measure_pmf (\<tau> s) < \<top>
 4. measure_pmf.random_variable (\<tau> s) borel (\<lambda>x. \<rho> s x + enn2real (R x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?t1 \<in> E s \<Longrightarrow> R ?t1 < \<top>
[PROOF STEP]
show "AE t in \<tau> s. ennreal (\<rho> s t) + R t = ennreal (\<rho> s t + enn2real (R t))"
[PROOF STATE]
proof (prove)
using this:
?t1 \<in> E s \<Longrightarrow> R ?t1 < \<top>

goal (1 subgoal):
 1. AE t in measure_pmf (\<tau> s). ennreal (\<rho> s t) + R t = ennreal (\<rho> s t + enn2real (R t))
[PROOF STEP]
by (auto simp: AE_measure_pmf_iff intro!: ennreal_enn2real[symmetric])
[PROOF STATE]
proof (state)
this:
AE t in measure_pmf (\<tau> s). ennreal (\<rho> s t) + R t = ennreal (\<rho> s t + enn2real (R t))

goal (3 subgoals):
 1. AE t in measure_pmf (\<tau> s). 0 \<le> \<rho> s t + enn2real (R t)
 2. \<integral>\<^sup>+ t. ennreal (\<rho> s t) + R t \<partial>measure_pmf (\<tau> s) < \<top>
 3. measure_pmf.random_variable (\<tau> s) borel (\<lambda>x. \<rho> s x + enn2real (R x))
[PROOF STEP]
show "(\<integral>\<^sup>+ t. ennreal (\<rho> s t) + R t \<partial>\<tau> s) < \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ t. ennreal (\<rho> s t) + R t \<partial>measure_pmf (\<tau> s) < \<top>
[PROOF STEP]
unfolding R_iter[symmetric, OF s(2,3)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R s < \<top>
[PROOF STEP]
by (rule R_less_top) fact
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ t. ennreal (\<rho> s t) + R t \<partial>measure_pmf (\<tau> s) < \<top>

goal (2 subgoals):
 1. AE t in measure_pmf (\<tau> s). 0 \<le> \<rho> s t + enn2real (R t)
 2. measure_pmf.random_variable (\<tau> s) borel (\<lambda>x. \<rho> s x + enn2real (R x))
[PROOF STEP]
qed auto


[STATEMENT]
theorem coprime_pairs_asymptotics':
  "(\<lambda>N. real (card (A N))) =o (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2) +o O(\<lambda>N. real N * ln (real N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. real (card (A N))) \<in> (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2) +o O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
using coprime_pairs_asymptotics
[PROOF STATE]
proof (prove)
using this:
(\<lambda>N. real (card (A N)) - 6 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))

goal (1 subgoal):
 1. (\<lambda>N. real (card (A N))) \<in> (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2) +o O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
by (subst set_minus_plus [symmetric]) (simp_all add: fun_diff_def)


[STATEMENT]
lemma countable_iff_lepoll: "countable A \<longleftrightarrow> A \<lesssim> (UNIV :: nat set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable A = (A \<lesssim> UNIV)
[PROOF STEP]
by (auto simp: countable_def lepoll_def)


[STATEMENT]
lemma FVG_finite: "finite(FVG a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (FVG a)
[PROOF STEP]
using allvars_finite
[PROOF STATE]
proof (prove)
using this:
finite Denotational_Semantics.allvars

goal (1 subgoal):
 1. finite (FVG a)
[PROOF STEP]
by (metis finite_subset mem_Collect_eq subsetI)


[STATEMENT]
lemma iT_Minus_Int: "k \<ominus> (A \<inter> B) = (k \<ominus> A) \<inter> (k \<ominus> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<ominus> A \<inter> B = (k \<ominus> A) \<inter> (k \<ominus> B)
[PROOF STEP]
by (fastforce simp: set_eq_iff iT_Minus_mem_iff)


[STATEMENT]
lemma le_HCollect_iff: "A \<le> \<lbrace>x \<^bold>\<in> B. P x\<rbrace> \<longleftrightarrow> A \<le> B \<and> (\<forall>x \<^bold>\<in> A. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<le> HCollect P B) = (A \<le> B \<and> HBall A P)
[PROOF STEP]
by blast


[STATEMENT]
lemma fproduct_vintersection: "(a \<inter>\<^sub>\<circ> b) \<times>\<^sub>\<bullet> (c \<inter>\<^sub>\<circ> d) = (a \<times>\<^sub>\<bullet> c) \<inter>\<^sub>\<circ> (b \<times>\<^sub>\<bullet> d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<inter>\<^sub>\<circ> b) \<times>\<^sub>\<bullet> (c \<inter>\<^sub>\<circ> d) = a \<times>\<^sub>\<bullet> c \<inter>\<^sub>\<circ> b \<times>\<^sub>\<bullet> d
[PROOF STEP]
by auto


[STATEMENT]
lemma fls_divide_X_inv':
  fixes   f :: "'a::{comm_monoid_add,inverse,mult_zero,uminus,zero_neq_one,monoid_mult} fls"
  assumes "inverse (1::'a) = 1"
  shows   "f / fls_X_inv = fls_shift (-1) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f / fls_X_inv = fls_shift (- 1) f
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f / fls_X_inv = fls_shift (- 1) f
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
inverse (1::'a) = (1::'a)
[PROOF STEP]
have
    "f / fls_X_inv =
      fls_shift (-1) (fls_shift (-fls_subdegree f) (fps_to_fls (fls_base_factor_to_fps f)))"
[PROOF STATE]
proof (prove)
using this:
inverse (1::'a) = (1::'a)

goal (1 subgoal):
 1. f / fls_X_inv = fls_shift (- 1) (fls_shift (- fls_subdegree f) (fls_regpart_as_fls (fls_base_factor f)))
[PROOF STEP]
by (simp add: fls_divide_def fps_divide_1' algebra_simps)
[PROOF STATE]
proof (state)
this:
f / fls_X_inv = fls_shift (- 1) (fls_shift (- fls_subdegree f) (fls_regpart_as_fls (fls_base_factor f)))

goal (1 subgoal):
 1. f / fls_X_inv = fls_shift (- 1) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f / fls_X_inv = fls_shift (- 1) (fls_shift (- fls_subdegree f) (fls_regpart_as_fls (fls_base_factor f)))

goal (1 subgoal):
 1. f / fls_X_inv = fls_shift (- 1) f
[PROOF STEP]
have "\<dots> = fls_shift (-1) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_shift (- 1) (fls_shift (- fls_subdegree f) (fls_regpart_as_fls (fls_base_factor f))) = fls_shift (- 1) f
[PROOF STEP]
using fls_conv_base_factor_to_fps_shift_subdegree[of f]
[PROOF STATE]
proof (prove)
using this:
f = fls_shift (- fls_subdegree f) (fls_regpart_as_fls (fls_base_factor f))

goal (1 subgoal):
 1. fls_shift (- 1) (fls_shift (- fls_subdegree f) (fls_regpart_as_fls (fls_base_factor f))) = fls_shift (- 1) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fls_shift (- 1) (fls_shift (- fls_subdegree f) (fls_regpart_as_fls (fls_base_factor f))) = fls_shift (- 1) f

goal (1 subgoal):
 1. f / fls_X_inv = fls_shift (- 1) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f / fls_X_inv = fls_shift (- 1) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f / fls_X_inv = fls_shift (- 1) f

goal (1 subgoal):
 1. f / fls_X_inv = fls_shift (- 1) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f / fls_X_inv = fls_shift (- 1) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integrable_measurable_subprob_algebra[measurable]:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  assumes [measurable]: "f \<in> borel_measurable N"
  shows "Measurable.pred (subprob_algebra N) (\<lambda>M. integrable M f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Measurable.pred (subprob_algebra N) (\<lambda>M. integrable M f)
[PROOF STEP]
proof (rule measurable_cong[THEN iffD2])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>w. w \<in> space (subprob_algebra N) \<Longrightarrow> integrable w f = ?g1 w
 2. Measurable.pred (subprob_algebra N) ?g1
[PROOF STEP]
show "M \<in> space (subprob_algebra N) \<Longrightarrow> integrable M f \<longleftrightarrow> (\<integral>\<^sup>+x. norm (f x) \<partial>M) < \<infinity>" for M
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<in> space (subprob_algebra N) \<Longrightarrow> integrable M f = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>)
[PROOF STEP]
by (auto simp: space_subprob_algebra integrable_iff_bounded)
[PROOF STATE]
proof (state)
this:
?M \<in> space (subprob_algebra N) \<Longrightarrow> integrable ?M f = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>?M < \<infinity>)

goal (1 subgoal):
 1. Measurable.pred (subprob_algebra N) (\<lambda>w. \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>w < \<infinity>)
[PROOF STEP]
qed measurable


[STATEMENT]
lemma fixes x::real
  shows "-7.29347719 \<le> x \<Longrightarrow> 0 < x^5 + 30*x^4 + 420*x^3 + 3360*x^2 + 15120*x + 30240"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (729347719 / 10 ^ 8) \<le> x \<Longrightarrow> 0 < x ^ 5 + 30 * x ^ 4 + 420 * x ^ 3 + 3360 * x\<^sup>2 + 15120 * x + 30240
[PROOF STEP]
by sturm


[STATEMENT]
lemma continuous_norm [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. norm (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F f \<Longrightarrow> continuous F (\<lambda>x. norm (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F \<Longrightarrow> ((\<lambda>x. norm (f x)) \<longlongrightarrow> norm (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_norm)


[STATEMENT]
lemma nvc_hom_meet: "((x \<sqinter> nc) \<cdot>  nc \<sqinter> (y \<sqinter> nc) \<cdot> nc) \<cdot> 1\<^sub>\<pi> = ((x \<sqinter> nc) \<cdot>  nc) \<cdot> 1\<^sub>\<pi> \<sqinter> ((y \<sqinter> nc) \<cdot> nc) \<cdot> 1\<^sub>\<pi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x \<sqinter> nc) \<cdot> nc \<sqinter> (y \<sqinter> nc) \<cdot> nc) \<cdot> 1\<^sub>\<pi> = (x \<sqinter> nc) \<cdot> nc \<cdot> 1\<^sub>\<pi> \<sqinter> (y \<sqinter> nc) \<cdot> nc \<cdot> 1\<^sub>\<pi>
[PROOF STEP]
by (metis local.c3 p_subid_par_eq_meet_var vec_p_prod_meet)


[STATEMENT]
lemma boundedByIncLevel: "boundedBy n (incLevel ` (tree subs gamma)) = ( \<exists>m . n = Suc m & boundedBy m (tree subs gamma))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. boundedBy n (incLevel ` tree subs gamma) = (\<exists>m. n = Suc m \<and> boundedBy m (tree subs gamma))
[PROOF STEP]
apply(cases n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> boundedBy n (incLevel ` tree subs gamma) = (\<exists>m. n = Suc m \<and> boundedBy m (tree subs gamma))
 2. \<And>nat. n = Suc nat \<Longrightarrow> boundedBy n (incLevel ` tree subs gamma) = (\<exists>m. n = Suc m \<and> boundedBy m (tree subs gamma))
[PROOF STEP]
apply(force simp add: boundedBy0 tree0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> boundedBy n (incLevel ` tree subs gamma) = (\<exists>m. n = Suc m \<and> boundedBy m (tree subs gamma))
[PROOF STEP]
apply(force simp add: treeEquation [of _ gamma] incLevel_def boundedBy_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sparse_row_matrix_cons: "sparse_row_matrix (a#arr) = ((move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0)) + sparse_row_matrix arr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sparse_row_matrix (a # arr) = move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0 + sparse_row_matrix arr
[PROOF STEP]
apply (induct arr)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sparse_row_matrix [a] = move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0 + sparse_row_matrix []
 2. \<And>aa arr. sparse_row_matrix (a # arr) = move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0 + sparse_row_matrix arr \<Longrightarrow> sparse_row_matrix (a # aa # arr) = move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0 + sparse_row_matrix (aa # arr)
[PROOF STEP]
apply (auto simp add: sparse_row_matrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa b arr. foldl (\<lambda>m r. m + move_matrix (sparse_row_vector (snd r)) (int (fst r)) 0) (move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0) arr = move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0 + foldl (\<lambda>m r. m + move_matrix (sparse_row_vector (snd r)) (int (fst r)) 0) 0 arr \<Longrightarrow> foldl (\<lambda>m r. m + move_matrix (sparse_row_vector (snd r)) (int (fst r)) 0) (move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0 + move_matrix (sparse_row_vector b) (int aa) 0) arr = move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0 + foldl (\<lambda>m r. m + move_matrix (sparse_row_vector (snd r)) (int (fst r)) 0) (move_matrix (sparse_row_vector b) (int aa) 0) arr
[PROOF STEP]
apply (simp add: foldl_distrstart[of "\<lambda>m x. m + (move_matrix (sparse_row_vector (snd x)) (int (fst x)) 0)"
    "% a m. (move_matrix (sparse_row_vector (snd a)) (int (fst a)) 0) + m"])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem Hset2_bd: "|Hset2 (x :: ('p1, 'p2, 'p3, 'p, 'a1, 'a2) H )| <o
  (Hbd :: ('p1, 'p2, 'p3, 'p) Hbd_type rel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Hset2 x| <o Hbd
[PROOF STEP]
by (tactic \<open>BNF_Comp_Tactics.mk_comp_set_bd_tac @{context} @{thm refl} NONE @{thm Hset2_alt}
      @{thms comp_single_set_bd_strict[OF F1.bd_Cinfinite F1.bd_regularCard G.bd_Cinfinite
               G.bd_regularCard F1.set_bd(2) G.set_bd(1)]
             comp_single_set_bd_strict[OF F2.bd_Cinfinite F2.bd_regularCard G.bd_Cinfinite
               G.bd_regularCard F2.set_bd(2) G.set_bd(2)]
             comp_single_set_bd_strict[OF F3.bd_Cinfinite F3.bd_regularCard G.bd_Cinfinite
               G.bd_regularCard F3.set_bd(2) G.set_bd(3)]}
      @{thms Cinfinite_cprod2[OF Cinfinite_Cnotzero[OF G.bd_Cinfinite] F1.bd_Cinfinite]
             Cinfinite_cprod2[OF Cinfinite_Cnotzero[OF G.bd_Cinfinite] F2.bd_Cinfinite]
             Cinfinite_cprod2[OF Cinfinite_Cnotzero[OF G.bd_Cinfinite] F3.bd_Cinfinite]}\<close>)


[STATEMENT]
lemma param_mset_Plus[param]: "((+),(+))\<in>\<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((+), (+)) \<in> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel
[PROOF STEP]
apply (rule rel2pD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel2p (\<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel) (+) (+)
[PROOF STEP]
apply (simp add: rel2p)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_fun (rel_mset (rel2p A)) (rel_fun (rel_mset (rel2p A)) (rel_mset (rel2p A))) (+) (+)
[PROOF STEP]
apply (intro rel_funI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa ya. \<lbrakk>rel_mset (rel2p A) x y; rel_mset (rel2p A) xa ya\<rbrakk> \<Longrightarrow> rel_mset (rel2p A) (x + xa) (y + ya)
[PROOF STEP]
by (rule rel_mset_Plus_gen)


[STATEMENT]
lemma factorization_lattice_code[code]: "factorization_lattice u k m = (
  let n = degree u in
 map
  (\<lambda>i. vec_of_poly_n (monom_mult i u) (n+k)) [k>..0]
  @ map (\<lambda>i. vec_of_poly_n (monom m i) (n+k)) [n>..0]
)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. factorization_lattice u k m = (let n = degree u in map (\<lambda>i. vec_of_poly_n (monom_mult i u) (n + k)) [k>..0] @ map (\<lambda>i. vec_of_poly_n (monom m i) (n + k)) [n>..0])
[PROOF STEP]
unfolding factorization_lattice_def monom_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. vec_of_poly_n (u * monom (1::'a) i) (degree u + k)) [k>..0] @ map (\<lambda>i. vec_of_poly_n (monom m i) (degree u + k)) [degree u>..0] = (let n = degree u in map (\<lambda>i. vec_of_poly_n (monom (1::'a) i * u) (n + k)) [k>..0] @ map (\<lambda>i. vec_of_poly_n (monom m i) (n + k)) [n>..0])
[PROOF STEP]
by (auto simp: ac_simps Let_def)


[STATEMENT]
lemma nn_integral_bind:
  assumes f: "f \<in> borel_measurable B"
  assumes N: "N \<in> measurable M (subprob_algebra B)"
  shows "(\<integral>\<^sup>+x. f x \<partial>(M \<bind> N)) = (\<integral>\<^sup>+x. \<integral>\<^sup>+y. f y \<partial>N x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (M \<bind> N) f = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (M \<bind> N) f = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (M \<bind> N) f = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M
[PROOF STEP]
assume M: "space M \<noteq> {}"
[PROOF STATE]
proof (state)
this:
space M \<noteq> {}

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (M \<bind> N) f = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (M \<bind> N) f = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (M \<bind> N) f = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M
[PROOF STEP]
unfolding bind_nonempty''[OF N M] nn_integral_join[OF f sets_distr]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ M'. integral\<^sup>N M' f \<partial>distr M (subprob_algebra B) N = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M
[PROOF STEP]
by (rule nn_integral_distr[OF N])
       (simp add: f nn_integral_measurable_subprob_algebra)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (M \<bind> N) f = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M

goal (1 subgoal):
 1. \<not> space M \<noteq> {} \<Longrightarrow> integral\<^sup>N (M \<bind> N) f = \<integral>\<^sup>+ x. integral\<^sup>N (N x) f \<partial>M
[PROOF STEP]
qed (simp add: bind_empty space_empty[of M] nn_integral_count_space)


[STATEMENT]
lemma i_Exec_Stream_Init_Pre_Post2_iAll_iNext: "
  \<lbrakk> result = i_Exec_Comp_Stream_Init trans_fun input c;
    \<forall>x_n c_n. P x_n c_n \<longrightarrow> Q (trans_fun x_n c_n);
    \<forall>t\<in>I. inext t I' = Suc t \<rbrakk> \<Longrightarrow>
  \<box> t I. (P (input t) (result t) \<longrightarrow> (\<circle> t1 t I'. Q (result t1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>result = i_Exec_Comp_Stream_Init trans_fun input c; \<forall>x_n c_n. P x_n c_n \<longrightarrow> Q (trans_fun x_n c_n); \<forall>t\<in>I. inext t I' = Suc t\<rbrakk> \<Longrightarrow> \<box> t I. P (input t) (result t) \<longrightarrow> (\<circle> t1 t I'. Q (result t1))
[PROOF STEP]
by (rule iallI, simp add: iNext_def i_Exec_Stream_Init_Pre_Post2)


[STATEMENT]
lemma co_path_append:
  assumes "[last p1, hd p2] \<notin> {[(fst e,w),(w,snd e)], [(snd e,w),(w,fst e)]}"
  shows "co_path e w (p1 @ p2) = co_path e w p1 @ co_path e w p2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. co_path e w (p1 @ p2) = co_path e w p1 @ co_path e w p2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[last p1, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}

goal (1 subgoal):
 1. co_path e w (p1 @ p2) = co_path e w p1 @ co_path e w p2
[PROOF STEP]
proof (induct p1 rule: co_path_induct)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e'. [last [e'], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([e'] @ p2) = co_path e w [e'] @ co_path e w p2
 3. \<And>e1 e2 es. \<lbrakk>e1 = (fst e, w) \<and> e2 = (w, snd e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 4. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 5. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
case single
[PROOF STATE]
proof (state)
this:
[last [e'_], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}

goal (5 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e'. [last [e'], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([e'] @ p2) = co_path e w [e'] @ co_path e w p2
 3. \<And>e1 e2 es. \<lbrakk>e1 = (fst e, w) \<and> e2 = (w, snd e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 4. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 5. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[last [e'_], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
[last [e'_], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}

goal (1 subgoal):
 1. co_path e w ([e'_] @ p2) = co_path e w [e'_] @ co_path e w p2
[PROOF STEP]
by (cases p2) auto
[PROOF STATE]
proof (state)
this:
co_path e w ([e'_] @ p2) = co_path e w [e'_] @ co_path e w p2

goal (4 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e1 e2 es. \<lbrakk>e1 = (fst e, w) \<and> e2 = (w, snd e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 3. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 4. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e1 e2 es. \<lbrakk>e1 = (fst e, w) \<and> e2 = (w, snd e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 3. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 4. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
case (co e1 e2 es)
[PROOF STATE]
proof (state)
this:
e1 = (fst e, w) \<and> e2 = (w, snd e)
[last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2
[last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}

goal (4 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e1 e2 es. \<lbrakk>e1 = (fst e, w) \<and> e2 = (w, snd e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 3. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 4. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e1 = (fst e, w) \<and> e2 = (w, snd e)
[last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2
[last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
e1 = (fst e, w) \<and> e2 = (w, snd e)
[last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2
[last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}

goal (1 subgoal):
 1. co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
by (cases es) auto
[PROOF STATE]
proof (state)
this:
co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2

goal (3 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 3. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 3. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
case (corev e1 e2 es)
[PROOF STATE]
proof (state)
this:
\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e)
[last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2
[last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}

goal (3 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e); [last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
 3. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e)
[last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2
[last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)) \<and> e1 = (snd e, w) \<and> e2 = (w, fst e)
[last es, hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w (es @ p2) = co_path e w es @ co_path e w p2
[last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}

goal (1 subgoal):
 1. co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
by (cases es) auto
[PROOF STATE]
proof (state)
this:
co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2

goal (2 subgoals):
 1. [last [], hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ([] @ p2) = co_path e w [] @ co_path e w p2
 2. \<And>e1 e2 es. \<lbrakk>\<not> (e1 = (fst e, w) \<and> e2 = (w, snd e)); \<not> (e1 = (snd e, w) \<and> e2 = (w, fst e)); [last (e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]} \<Longrightarrow> co_path e w ((e2 # es) @ p2) = co_path e w (e2 # es) @ co_path e w p2; [last (e1 # e2 # es), hd p2] \<notin> {[(fst e, w), (w, snd e)], [(snd e, w), (w, fst e)]}\<rbrakk> \<Longrightarrow> co_path e w ((e1 # e2 # es) @ p2) = co_path e w (e1 # e2 # es) @ co_path e w p2
[PROOF STEP]
qed auto


[STATEMENT]
lemma nat_le_real_less: "n \<le> m \<longleftrightarrow> real n < real m + 1"
  for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n \<le> m) = (real n < real m + 1)
[PROOF STEP]
by (meson nat_less_real_le not_le)


[STATEMENT]
lemma lex_ext_unbounded_iff: "(lex_ext_unbounded f xs ys) = (
  ((\<exists> i < length xs. i < length ys \<and> (\<forall> j < i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys !i))) \<or>
  (\<forall> i < length ys. snd (f (xs ! i) (ys ! i))) \<and> length xs > length ys),
  ((\<exists> i < length xs. i < length ys \<and> (\<forall> j < i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys !i))) \<or>
  (\<forall> i < length ys. snd (f (xs ! i) (ys ! i))) \<and> length xs \<ge> length ys))
  " (is "?lex xs ys = (?stri xs ys, ?nstri xs ys)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lex_ext_unbounded f xs ys = ((\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys < length xs, (\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys \<le> length xs)
[PROOF STEP]
proof (induct xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. lex_ext_unbounded f [] ys = ((\<exists>i<length []. i < length ys \<and> (\<forall>j<i. snd (f ([] ! j) (ys ! j))) \<and> fst (f ([] ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ([] ! i) (ys ! i))) \<and> length ys < length [], (\<exists>i<length []. i < length ys \<and> (\<forall>j<i. snd (f ([] ! j) (ys ! j))) \<and> fst (f ([] ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ([] ! i) (ys ! i))) \<and> length ys \<le> length [])
 2. \<And>a xs ys. (\<And>ys. lex_ext_unbounded f xs ys = ((\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys < length xs, (\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys \<le> length xs)) \<Longrightarrow> lex_ext_unbounded f (a # xs) ys = ((\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys < length (a # xs), (\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys \<le> length (a # xs))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>ys. lex_ext_unbounded f [] ys = ((\<exists>i<length []. i < length ys \<and> (\<forall>j<i. snd (f ([] ! j) (ys ! j))) \<and> fst (f ([] ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ([] ! i) (ys ! i))) \<and> length ys < length [], (\<exists>i<length []. i < length ys \<and> (\<forall>j<i. snd (f ([] ! j) (ys ! j))) \<and> fst (f ([] ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ([] ! i) (ys ! i))) \<and> length ys \<le> length [])
 2. \<And>a xs ys. (\<And>ys. lex_ext_unbounded f xs ys = ((\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys < length xs, (\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys \<le> length xs)) \<Longrightarrow> lex_ext_unbounded f (a # xs) ys = ((\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys < length (a # xs), (\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys \<le> length (a # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lex_ext_unbounded f [] ys = ((\<exists>i<length []. i < length ys \<and> (\<forall>j<i. snd (f ([] ! j) (ys ! j))) \<and> fst (f ([] ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ([] ! i) (ys ! i))) \<and> length ys < length [], (\<exists>i<length []. i < length ys \<and> (\<forall>j<i. snd (f ([] ! j) (ys ! j))) \<and> fst (f ([] ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ([] ! i) (ys ! i))) \<and> length ys \<le> length [])
[PROOF STEP]
by (cases ys, auto)
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f [] ys = ((\<exists>i<length []. i < length ys \<and> (\<forall>j<i. snd (f ([] ! j) (ys ! j))) \<and> fst (f ([] ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ([] ! i) (ys ! i))) \<and> length ys < length [], (\<exists>i<length []. i < length ys \<and> (\<forall>j<i. snd (f ([] ! j) (ys ! j))) \<and> fst (f ([] ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ([] ! i) (ys ! i))) \<and> length ys \<le> length [])

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. lex_ext_unbounded f xs ys = ((\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys < length xs, (\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys \<le> length xs)) \<Longrightarrow> lex_ext_unbounded f (a # xs) ys = ((\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys < length (a # xs), (\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys \<le> length (a # xs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. lex_ext_unbounded f xs ys = ((\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys < length xs, (\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys \<le> length xs)) \<Longrightarrow> lex_ext_unbounded f (a # xs) ys = ((\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys < length (a # xs), (\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys \<le> length (a # xs))
[PROOF STEP]
case (Cons a as)
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f as ?ys = ((\<exists>i<length as. i < length ?ys \<and> (\<forall>j<i. snd (f (as ! j) (?ys ! j))) \<and> fst (f (as ! i) (?ys ! i))) \<or> (\<forall>i<length ?ys. snd (f (as ! i) (?ys ! i))) \<and> length ?ys < length as, (\<exists>i<length as. i < length ?ys \<and> (\<forall>j<i. snd (f (as ! j) (?ys ! j))) \<and> fst (f (as ! i) (?ys ! i))) \<or> (\<forall>i<length ?ys. snd (f (as ! i) (?ys ! i))) \<and> length ?ys \<le> length as)

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. lex_ext_unbounded f xs ys = ((\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys < length xs, (\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys \<le> length xs)) \<Longrightarrow> lex_ext_unbounded f (a # xs) ys = ((\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys < length (a # xs), (\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys \<le> length (a # xs))
[PROOF STEP]
note oCons = this
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f as ?ys = ((\<exists>i<length as. i < length ?ys \<and> (\<forall>j<i. snd (f (as ! j) (?ys ! j))) \<and> fst (f (as ! i) (?ys ! i))) \<or> (\<forall>i<length ?ys. snd (f (as ! i) (?ys ! i))) \<and> length ?ys < length as, (\<exists>i<length as. i < length ?ys \<and> (\<forall>j<i. snd (f (as ! j) (?ys ! j))) \<and> fst (f (as ! i) (?ys ! i))) \<or> (\<forall>i<length ?ys. snd (f (as ! i) (?ys ! i))) \<and> length ?ys \<le> length as)

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. lex_ext_unbounded f xs ys = ((\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys < length xs, (\<exists>i<length xs. i < length ys \<and> (\<forall>j<i. snd (f (xs ! j) (ys ! j))) \<and> fst (f (xs ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (xs ! i) (ys ! i))) \<and> length ys \<le> length xs)) \<Longrightarrow> lex_ext_unbounded f (a # xs) ys = ((\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys < length (a # xs), (\<exists>i<length (a # xs). i < length ys \<and> (\<forall>j<i. snd (f ((a # xs) ! j) (ys ! j))) \<and> fst (f ((a # xs) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # xs) ! i) (ys ! i))) \<and> length ys \<le> length (a # xs))
[PROOF STEP]
from oCons
[PROOF STATE]
proof (chain)
picking this:
lex_ext_unbounded f as ?ys = ((\<exists>i<length as. i < length ?ys \<and> (\<forall>j<i. snd (f (as ! j) (?ys ! j))) \<and> fst (f (as ! i) (?ys ! i))) \<or> (\<forall>i<length ?ys. snd (f (as ! i) (?ys ! i))) \<and> length ?ys < length as, (\<exists>i<length as. i < length ?ys \<and> (\<forall>j<i. snd (f (as ! j) (?ys ! j))) \<and> fst (f (as ! i) (?ys ! i))) \<or> (\<forall>i<length ?ys. snd (f (as ! i) (?ys ! i))) \<and> length ?ys \<le> length as)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
lex_ext_unbounded f as ?ys = ((\<exists>i<length as. i < length ?ys \<and> (\<forall>j<i. snd (f (as ! j) (?ys ! j))) \<and> fst (f (as ! i) (?ys ! i))) \<or> (\<forall>i<length ?ys. snd (f (as ! i) (?ys ! i))) \<and> length ?ys < length as, (\<exists>i<length as. i < length ?ys \<and> (\<forall>j<i. snd (f (as ! j) (?ys ! j))) \<and> fst (f (as ! i) (?ys ! i))) \<or> (\<forall>i<length ?ys. snd (f (as ! i) (?ys ! i))) \<and> length ?ys \<le> length as)

goal (1 subgoal):
 1. lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
proof (cases ys, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa list. \<lbrakk>\<And>ys. lex_ext_unbounded f as ys = ((\<exists>i<length as. i < length ys \<and> (\<forall>j<i. snd (f (as ! j) (ys ! j))) \<and> fst (f (as ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (as ! i) (ys ! i))) \<and> length ys < length as, (\<exists>i<length as. i < length ys \<and> (\<forall>j<i. snd (f (as ! j) (ys ! j))) \<and> fst (f (as ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (as ! i) (ys ! i))) \<and> length ys \<le> length as); ys = aa # list\<rbrakk> \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
case (Cons b bs)
[PROOF STATE]
proof (state)
this:
ys = b # bs

goal (1 subgoal):
 1. \<And>aa list. \<lbrakk>\<And>ys. lex_ext_unbounded f as ys = ((\<exists>i<length as. i < length ys \<and> (\<forall>j<i. snd (f (as ! j) (ys ! j))) \<and> fst (f (as ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (as ! i) (ys ! i))) \<and> length ys < length as, (\<exists>i<length as. i < length ys \<and> (\<forall>j<i. snd (f (as ! j) (ys ! j))) \<and> fst (f (as ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f (as ! i) (ys ! i))) \<and> length ys \<le> length as); ys = aa # list\<rbrakk> \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
proof (cases "f a b")
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa ba. f a b = (aa, ba) \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
case (Pair stri nstri)
[PROOF STATE]
proof (state)
this:
f a b = (stri, nstri)

goal (1 subgoal):
 1. \<And>aa ba. f a b = (aa, ba) \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
proof (cases stri)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. stri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
 2. \<not> stri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
stri

goal (2 subgoals):
 1. stri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
 2. \<not> stri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
with Pair Cons
[PROOF STATE]
proof (chain)
picking this:
f a b = (stri, nstri)
ys = b # bs
stri
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f a b = (stri, nstri)
ys = b # bs
stri

goal (1 subgoal):
 1. lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))

goal (1 subgoal):
 1. \<not> stri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> stri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> stri

goal (1 subgoal):
 1. \<not> stri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
proof (cases nstri)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. nstri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
 2. \<not> nstri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> nstri

goal (2 subgoals):
 1. nstri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
 2. \<not> nstri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
with \<open>\<not> stri\<close> Pair Cons
[PROOF STATE]
proof (chain)
picking this:
\<not> stri
f a b = (stri, nstri)
ys = b # bs
\<not> nstri
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> stri
f a b = (stri, nstri)
ys = b # bs
\<not> nstri

goal (1 subgoal):
 1. lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))

goal (1 subgoal):
 1. nstri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nstri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
nstri

goal (1 subgoal):
 1. nstri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
with False Pair
[PROOF STATE]
proof (chain)
picking this:
\<not> stri
f a b = (stri, nstri)
nstri
[PROOF STEP]
have f: "f a b = (False, True)"
[PROOF STATE]
proof (prove)
using this:
\<not> stri
f a b = (stri, nstri)
nstri

goal (1 subgoal):
 1. f a b = (False, True)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a b = (False, True)

goal (1 subgoal):
 1. nstri \<Longrightarrow> lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))
[PROOF STEP]
by (simp add: all_Suc_conv ex_Suc_conv Cons f oCons)
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lex_ext_unbounded f (a # as) ys = ((\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys < length (a # as), (\<exists>i<length (a # as). i < length ys \<and> (\<forall>j<i. snd (f ((a # as) ! j) (ys ! j))) \<and> fst (f ((a # as) ! i) (ys ! i))) \<or> (\<forall>i<length ys. snd (f ((a # as) ! i) (ys ! i))) \<and> length ys \<le> length (a # as))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Corps) v_ldeg_p_pOp:"\<lbrakk>valuation K v; PolynRg R (Vr K v) X;
      p \<in> carrier R; q \<in> carrier R; deg R (Vr K v) X p \<le> an (Suc d);
      deg R (Vr K v) X q \<le> an (Suc d)\<rbrakk> \<Longrightarrow>
      (ldeg_p R (Vr K v) X d p) \<plusminus>\<^bsub>R\<^esub> (ldeg_p R (Vr K v) X d q) =
                              ldeg_p R (Vr K v) X d (p \<plusminus>\<^bsub>R\<^esub> q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; PolynRg R (Vr K v) X; p \<in> carrier R; q \<in> carrier R; deg R (Vr K v) X p \<le> an (Suc d); deg R (Vr K v) X q \<le> an (Suc d)\<rbrakk> \<Longrightarrow> ldeg_p R (Vr K v) X d p \<plusminus>\<^bsub>R\<^esub> ldeg_p R (Vr K v) X d q = ldeg_p R (Vr K v) X d (p \<plusminus>\<^bsub>R\<^esub> q)
[PROOF STEP]
by (simp add:PolynRg.ldeg_p_pOp[of R "Vr K v" X p q d])


[STATEMENT]
lemma one_free_Abelian_group [simp]: "\<one>\<^bsub>free_Abelian_group S\<^esub> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one>\<^bsub>free_Abelian_group S\<^esub> = 0
[PROOF STEP]
by (auto simp: free_Abelian_group_def)


[STATEMENT]
lemma (in encoding) full_abstraction_impl_SRel_iff_TRel_is_sym:
  fixes SRel :: "('procS \<times> 'procS) set"
    and TRel :: "('procT \<times> 'procT) set"
  assumes fullAbs: "fully_abstract SRel TRel"
  shows "sym SRel \<longleftrightarrow> sym {(T1, T2). \<exists>S1 S2. T1 = \<lbrakk>S1\<rbrakk> \<and> T2 = \<lbrakk>S2\<rbrakk> \<and> (T1, T2) \<in> TRel}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sym SRel = sym (_Collect (T1, T2) (\<exists>S1 S2. T1 = \<lbrakk>S1\<rbrakk> \<and> T2 = \<lbrakk>S2\<rbrakk> \<and> (T1, T2) \<in> TRel))
[PROOF STEP]
unfolding sym_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. (x, y) \<in> SRel \<longrightarrow> (y, x) \<in> SRel) = (\<forall>x y. (x, y) \<in> _Collect (T1, T2) (\<exists>S1 S2. T1 = \<lbrakk>S1\<rbrakk> \<and> T2 = \<lbrakk>S2\<rbrakk> \<and> (T1, T2) \<in> TRel) \<longrightarrow> (y, x) \<in> _Collect (T1, T2) (\<exists>S1 S2. T1 = \<lbrakk>S1\<rbrakk> \<and> T2 = \<lbrakk>S2\<rbrakk> \<and> (T1, T2) \<in> TRel))
[PROOF STEP]
by (simp add: fullAbs, blast)


[STATEMENT]
lemma (in finite_measure) nn_integral_indicator_neq_infty:
  "f -` A \<in> sets M \<Longrightarrow> (\<integral>\<^sup>+ x. indicator A (f x) \<partial>M) \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f -` A \<in> sets M \<Longrightarrow> \<integral>\<^sup>+ x. indicator A (f x) \<partial>M \<noteq> \<infinity>
[PROOF STEP]
unfolding ennreal_indicator[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f -` A \<in> sets M \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (indicat_real A (f x)) \<partial>M \<noteq> \<infinity>
[PROOF STEP]
apply(rule integrableD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f -` A \<in> sets M \<Longrightarrow> integrable M (\<lambda>x. indicat_real A (f x))
[PROOF STEP]
apply(rule integrable_const_bound[where B=1])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f -` A \<in> sets M \<Longrightarrow> AE x in M. norm (indicat_real A (f x)) \<le> 1
 2. f -` A \<in> sets M \<Longrightarrow> (\<lambda>x. indicat_real A (f x)) \<in> borel_measurable M
[PROOF STEP]
apply(simp_all add: indicator_vimage[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma size_single: "size {#b#} = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size {#b#} = 1
[PROOF STEP]
by (simp add: size_multiset_overloaded_def size_multiset_single)


[STATEMENT]
lemma nth_scast:
  "bit (scast (x :: 'a::len word) :: 'b::len word) n =
    (n < LENGTH('b) \<and>
    (if n < LENGTH('a) - 1 then bit x n
     else bit x (LENGTH('a) - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit (scast x) n = (n < LENGTH('b) \<and> (if n < LENGTH('a) - 1 then bit x n else bit x (LENGTH('a) - 1)))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x n. (n < LENGTH('b) \<and> bit (signed_take_bit (LENGTH('a) - Suc 0) x) n) = (n < LENGTH('b) \<and> (if n < LENGTH('a) - 1 then n < LENGTH('a) \<and> bit x n else LENGTH('a) - 1 < LENGTH('a) \<and> bit x (LENGTH('a) - 1)))
[PROOF STEP]
apply (auto simp add: bit_signed_take_bit_iff min_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma computation_swingneg:"rat_poly_times B (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) B) =
    rat_poly_plus
     (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A)
       (rat_poly_times B (B - rat_poly_times (rat_poly_times A A) A)))
     (rat_poly_times A (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times B (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) B) = rat_poly_plus (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) (rat_poly_times B (B - rat_poly_times (rat_poly_times A A) A))) (rat_poly_times A (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) A))
[PROOF STEP]
using computation2
[PROOF STATE]
proof (prove)
using this:
rat_poly_plus (rat_poly_times A (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) A)) (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) (rat_poly_times B (B - rat_poly_times (rat_poly_times A A) A))) = rat_poly_times B (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) B)

goal (1 subgoal):
 1. rat_poly_times B (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) B) = rat_poly_plus (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) (rat_poly_times B (B - rat_poly_times (rat_poly_times A A) A))) (rat_poly_times A (rat_poly_times (B - rat_poly_times (rat_poly_times A A) A) A))
[PROOF STEP]
by auto


[STATEMENT]
lemma gtt_comp_lang_complete:
  shows "gtt_lang \<G>\<^sub>1 O gtt_lang \<G>\<^sub>2 \<subseteq> gtt_lang (GTT_comp \<G>\<^sub>1 \<G>\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gtt_lang \<G>\<^sub>1 O gtt_lang \<G>\<^sub>2 \<subseteq> gtt_lang (GTT_comp \<G>\<^sub>1 \<G>\<^sub>2)
[PROOF STEP]
using gmctxt_cl_mono_rel[OF gtt_comp_acomplete, of UNIV \<G>\<^sub>1 \<G>\<^sub>2]
[PROOF STATE]
proof (prove)
using this:
gmctxt_cl UNIV (gcomp_rel UNIV (agtt_lang \<G>\<^sub>1) (agtt_lang \<G>\<^sub>2)) \<subseteq> gtt_lang (GTT_comp \<G>\<^sub>1 \<G>\<^sub>2)

goal (1 subgoal):
 1. gtt_lang \<G>\<^sub>1 O gtt_lang \<G>\<^sub>2 \<subseteq> gtt_lang (GTT_comp \<G>\<^sub>1 \<G>\<^sub>2)
[PROOF STEP]
by (simp only: gcomp_rel[symmetric])


[STATEMENT]
lemma principal_dchar_sum_bound':
  "(\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / k) x - Ln x) \<in> O(\<lambda>_. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - Ln (complex_of_real x)) \<in> O(\<lambda>_. 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - Ln (complex_of_real x)) \<in> O(\<lambda>_. 1)
[PROOF STEP]
have "(\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / k) x -
               (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (ln p / p))) \<in> O(\<lambda>_. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<in> O(\<lambda>_. 1)
[PROOF STEP]
proof (intro bigoI[of _ 3] eventually_mono[OF eventually_gt_at_top[of 0]], goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1
[PROOF STEP]
case (1 x)
[PROOF STATE]
proof (state)
this:
0 < x

goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1
[PROOF STEP]
have "norm (complex_of_real (\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / k) -
                of_real (\<Sum>p | prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}. ln p / p)) \<le> 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (complex_of_real (\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / real k) - complex_of_real (\<Sum>x\<in>{p. prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}}. ln (real x) / real x)) \<le> 3
[PROOF STEP]
unfolding of_real_diff [symmetric] norm_of_real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>(\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / real k) - (\<Sum>x\<in>{p. prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}}. ln (real x) / real x)\<bar> \<le> 3
[PROOF STEP]
by (rule Mertens_mangoldt_versus_ln[where n = "nat \<lfloor>x\<rfloor>"])
         (insert n, auto simp: Suc_le_eq le_nat_iff le_floor_iff intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real (\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / real k) - complex_of_real (\<Sum>x\<in>{p. prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}}. ln (real x) / real x)) \<le> 3

goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real (\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / real k) - complex_of_real (\<Sum>x\<in>{p. prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}}. ln (real x) / real x)) \<le> 3

goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1
[PROOF STEP]
have "complex_of_real (\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / k) =
                 sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / k) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / real k) = sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x
[PROOF STEP]
unfolding sum_upto_def of_real_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{k. real k \<le> x \<and> coprime k n}. complex_of_real (mangoldt x / real x)) = (\<Sum>k\<in>{i. 0 < i \<and> real i \<le> x}. \<chi>\<^sub>0 k * mangoldt k / of_nat k)
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. (\<Sum>x\<in>{k. real k \<le> x \<and> coprime k n}. complex_of_real (mangoldt x / real x)) = (\<Sum>k\<in>{i. 0 < i \<and> real i \<le> x}. \<chi>\<^sub>0 k * mangoldt k / of_nat k)
[PROOF STEP]
by (intro sum.mono_neutral_cong_left) (auto simp: principal_dchar_def intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
complex_of_real (\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / real k) = sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x

goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real (\<Sum>k | real k \<le> x \<and> coprime k n. mangoldt k / real k) = sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x

goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1
[PROOF STEP]
have "complex_of_real (\<Sum>p | prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}. ln p / p) =
                 (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (ln p / p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<Sum>x\<in>{p. prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}}. ln (real x) / real x) = (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))
[PROOF STEP]
unfolding of_real_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{p. prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}}. complex_of_real (ln (real x) / real x)) = (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))
[PROOF STEP]
by (intro sum.mono_neutral_cong_left)
         (auto simp: principal_dchar_def le_nat_iff le_floor_iff prime_gt_0_nat
               intro!: finite_subset[of _ "{..nat \<lfloor>x\<rfloor>}"])
[PROOF STATE]
proof (state)
this:
complex_of_real (\<Sum>x\<in>{p. prime p \<and> p \<in> {k. real k \<le> x \<and> coprime k n}}. ln (real x) / real x) = (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))

goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3

goal (1 subgoal):
 1. cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<le> 3 * cmod 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p))) \<in> O(\<lambda>_. 1)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - Ln (complex_of_real x)) \<in> O(\<lambda>_. 1)
[PROOF STEP]
from sum_in_bigo(1)[OF principal_dchar_sum_bound this]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p)) - Ln (complex_of_real x) + (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p)))) \<in> O(\<lambda>_. 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p)) - Ln (complex_of_real x) + (sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - (\<Sum>p | prime p \<and> real p \<le> x. \<chi>\<^sub>0 p * (Ln (of_nat p) / of_nat p)))) \<in> O(\<lambda>_. 1)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - Ln (complex_of_real x)) \<in> O(\<lambda>_. 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>k. \<chi>\<^sub>0 k * mangoldt k / of_nat k) x - Ln (complex_of_real x)) \<in> O(\<lambda>_. 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_Suc_unat_less_bound:
  "n < Suc (unat (x :: 'a :: len word)) \<Longrightarrow> n < 2 ^ LENGTH('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < Suc (unat x) \<Longrightarrow> n < 2 ^ LENGTH('a)
[PROOF STEP]
by (auto elim!: order_less_le_trans intro: Suc_leI)