[STATEMENT]
lemma subst_list_singleton_fv_subset:
  "(\<Union>x \<in> set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x))
    \<subseteq> fv t \<union> (\<Union>x \<in> set E. fv (fst x) \<union> fv (snd x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
[PROOF STEP]
proof (induction E)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
case (Cons x E)
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))

goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
let ?fvs = "\<lambda>L. \<Union>x \<in> set L. fv (fst x) \<union> fv (snd x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
let ?fvx = "fv (fst x) \<union> fv (snd x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
let ?fvxsubst = "fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
have "?fvs (subst_list (subst v t) (x#E)) = ?fvxsubst \<union> ?fvs (subst_list (subst v t) E)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) = fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
unfolding subst_list_def subst_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>set (map (\<lambda>p. (fst p \<cdot> Var(v := t), snd p \<cdot> Var(v := t))) (x # E)). fv (fst x) \<union> fv (snd x)) = fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> (\<Union>x\<in>set (map (\<lambda>p. (fst p \<cdot> Var(v := t), snd p \<cdot> Var(v := t))) E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) = fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x))

goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
hence "?fvs (subst_list (subst v t) (x#E)) \<subseteq> ?fvxsubst \<union> fv t \<union> ?fvs E"
[PROOF STATE]
proof (prove)
using this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) = fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x))

goal (1 subgoal):
 1. (\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
[PROOF STEP]
using Cons.IH
[PROOF STATE]
proof (prove)
using this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) = fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x))
(\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))

goal (1 subgoal):
 1. (\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))

goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))

goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
have "?fvs (x#E) = ?fvx \<union> ?fvs E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x)) = fv (fst x) \<union> fv (snd x) \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x)) = fv (fst x) \<union> fv (snd x) \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))

goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x)) = fv (fst x) \<union> fv (snd x) \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))

goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
have "?fvxsubst \<subseteq> ?fvx \<union> fv t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<subseteq> fv (fst x) \<union> fv (snd x) \<union> fv t
[PROOF STEP]
using subst_fv_bound_singleton[of _ v t]
[PROOF STATE]
proof (prove)
using this:
fv (?t \<cdot> Var(v := t)) \<subseteq> fv ?t \<union> fv t

goal (1 subgoal):
 1. fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<subseteq> fv (fst x) \<union> fv (snd x) \<union> fv t
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<subseteq> fv (fst x) \<union> fv (snd x) \<union> fv t

goal (2 subgoals):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
 2. \<And>a E. (\<Union>x\<in>set (subst_list (subst v t) E). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x)) \<Longrightarrow> (\<Union>x\<in>set (subst_list (subst v t) (a # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (a # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
(\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x)) = fv (fst x) \<union> fv (snd x) \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<subseteq> fv (fst x) \<union> fv (snd x) \<union> fv t
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
(\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x)) = fv (fst x) \<union> fv (snd x) \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<subseteq> fv (fst x) \<union> fv (snd x) \<union> fv t

goal (1 subgoal):
 1. (\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
unfolding range_vars_alt_def
[PROOF STATE]
proof (prove)
using this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<union> fv t \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
(\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x)) = fv (fst x) \<union> fv (snd x) \<union> (\<Union>x\<in>set E. fv (fst x) \<union> fv (snd x))
fv (fst x \<cdot> Var(v := t)) \<union> fv (snd x \<cdot> Var(v := t)) \<subseteq> fv (fst x) \<union> fv (snd x) \<union> fv t

goal (1 subgoal):
 1. (\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>set (subst_list (subst v t) (x # E)). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set (x # E). fv (fst x) \<union> fv (snd x))

goal (1 subgoal):
 1. (\<Union>x\<in>set (subst_list (subst v t) []). fv (fst x) \<union> fv (snd x)) \<subseteq> fv t \<union> (\<Union>x\<in>set []. fv (fst x) \<union> fv (snd x))
[PROOF STEP]
qed (simp add: subst_list_def)


[STATEMENT]
lemma Rf_eq_Rf_diff_Rf: "Rf N = Rf (N - Rf N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rf N = Rf (N - Rf N)
[PROOF STEP]
by (metis Diff_subset Rf_mono Rf_subs_Rf_diff_Rf subset_antisym)


[STATEMENT]
lemma theorem12:
  fixes g :: "'a::discrete_cpo \<rightarrow> 'b::type set" and R :: "'a \<rightarrow> 'a set"
  shows "fix\<cdot>(\<Lambda> f x. g\<cdot>x \<union> (\<Union>y\<in>R\<cdot>x. f\<cdot>y))\<cdot>x =  \<^ps>g\<cdot>(\<Union>i.((\<^ps>R)\<^bsup>i\<^esup>\<cdot>{x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<mu> f. \<Lambda> x. g\<cdot>x \<union> \<Union> (Rep_cfun f ` R\<cdot>x))\<cdot>x = \<^ps> g\<cdot>(\<Union>i. (\<^ps> R)\<^bsup>i\<^esup>\<cdot>{x})
[PROOF STEP]
by(subst theorem12'[OF theorem10ps[THEN sym]], auto simp add:powerset_distr)


[STATEMENT]
lemma NATDistr:
  "N \<noteq> [] \<Longrightarrow> F = Cp (list2policyR N) \<Longrightarrow>
  ((\<lambda> (x,y). x) o_f ((NAT \<Otimes>\<^sub>2 F) o (\<lambda> x. (x,x)))  =
   (list2policy (  ((NAT \<Otimes>\<^sub>L (map Cp N)) (\<Otimes>\<^sub>2)
    (\<lambda> (x,y). x) (\<lambda> x. (x,x))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>N \<noteq> []; F = Cp (list2policyR N)\<rbrakk> \<Longrightarrow> (\<lambda>(x, y). x) o\<^sub>f (NAT \<Otimes>\<^sub>2 F \<circ> (\<lambda>x. (x, x))) = list2policy ((NAT \<Otimes>\<^sub>L map Cp N) (\<Otimes>\<^sub>2) (\<lambda>(x, y). x) (\<lambda>x. (x, x)))
[PROOF STEP]
by (simp add: l2polR_eq)  (rule ext,rule Norm_Distr_2)


[STATEMENT]
lemma mat_mod_N_representative: "mat_mod N = to_int_mat (map_mat of_int N :: 'a mod_ring mat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.mat_mod N = to_int_mat (of_int_hom.mat_hom N)
[PROOF STEP]
unfolding mat_mod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_mat (\<lambda>x. x mod m) N = to_int_mat (of_int_hom.mat_hom N)
[PROOF STEP]
by (auto simp: to_int_mod_ring_of_int_mod)


[STATEMENT]
lemma Ord_pred [simp]: "Ord \<beta> \<Longrightarrow> \<Squnion> (insert \<beta> (elts \<beta>)) = \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord \<beta> \<Longrightarrow> \<Squnion> insert \<beta> (elts \<beta>) = \<beta>
[PROOF STEP]
using Ord_def Transset_pred
[PROOF STATE]
proof (prove)
using this:
Ord ?x \<equiv> Transset ?x \<and> (\<forall>y\<in>elts ?x. Transset y)
Transset ?x \<Longrightarrow> \<Squnion> elts (ZFC_in_HOL.succ ?x) = ?x

goal (1 subgoal):
 1. Ord \<beta> \<Longrightarrow> \<Squnion> insert \<beta> (elts \<beta>) = \<beta>
[PROOF STEP]
by auto


[STATEMENT]
lemma fstar_unfoldl [simp]:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  shows "Inf_pres f \<Longrightarrow> id \<sqinter> (f \<circ> fstar f) = fstar f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> id \<sqinter> (f \<circ> fstar f) = fstar f
[PROOF STEP]
by (simp add: fun_eq_iff)


[STATEMENT]
lemma scalar_product_CONS: "length xs = length (bs :: bool list) \<Longrightarrow>
  scalar_product (map_index (\<lambda>i n. 2 * n + bs ! i) xs) is =
  scalar_product bs is + 2 * scalar_product xs is"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length bs \<Longrightarrow> scalar_product (map_index (\<lambda>i n. 2 * n + map of_bool bs ! i) xs) is = scalar_product (map of_bool bs) is + 2 * scalar_product xs is
[PROOF STEP]
by (induct "is" arbitrary: bs xs) (auto split: list.splits simp: algebra_simps)


[STATEMENT]
lemma unat_of_nat_word_log2:
  "LENGTH('a) < 2 ^ LENGTH('b)
   \<Longrightarrow> unat (of_nat (word_log2 (n :: 'a :: len word)) :: 'b :: len word) = word_log2 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LENGTH('a) < 2 ^ LENGTH('b) \<Longrightarrow> unat (word_of_nat (word_log2 n)) = word_log2 n
[PROOF STEP]
by (metis less_trans unat_of_nat_eq word_log2_max word_size)


[STATEMENT]
lemma lsc_hull_of_convex:
  fixes f :: "'a::euclidean_space \<Rightarrow> ereal"
  assumes "convex_on UNIV f"
  assumes "x : rel_interior (domain f)"
  shows "((\<lambda>m. f((1-m)*\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> (lsc_hull f) y) (at 1 within {0..<1})"
         (is "(?g \<longlongrightarrow> _ y) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
proof (cases "y=x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y = x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
 2. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y = x

goal (2 subgoals):
 1. y = x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
 2. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "?g = (\<lambda>m. f y)"
[PROOF STATE]
proof (prove)
using this:
y = x

goal (1 subgoal):
 1. (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = (\<lambda>m. f y)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = (\<lambda>m. f y)

goal (2 subgoals):
 1. y = x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
 2. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "(?g \<longlongrightarrow> f y) (at 1 within {0..<1})"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = (\<lambda>m. f y)

goal (1 subgoal):
 1. ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> f y) (at 1 within {0..<1})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> f y) (at 1 within {0..<1})

goal (2 subgoals):
 1. y = x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
 2. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> f y) (at 1 within {0..<1})

goal (2 subgoals):
 1. y = x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
 2. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
have "(lsc_hull f) y = f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lsc_hull f y = f y
[PROOF STEP]
by (metis \<open>y=x\<close> assms lsc_hull_of_convex_agrees_onRI)
[PROOF STATE]
proof (state)
this:
lsc_hull f y = f y

goal (2 subgoals):
 1. y = x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
 2. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> f y) (at 1 within {0..<1})
lsc_hull f y = f y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> f y) (at 1 within {0..<1})
lsc_hull f y = f y

goal (1 subgoal):
 1. ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
y \<noteq> x

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
have aux: "\<forall>m. y - ((1 - m) *\<^sub>R x + m *\<^sub>R y) = (1-m)*\<^sub>R (y-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m. y - ((1 - m) *\<^sub>R x + m *\<^sub>R y) = (1 - m) *\<^sub>R (y - x)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<forall>m. y - ((1 - m) *\<^sub>R x + m *\<^sub>R y) = (1 - m) *\<^sub>R (y - x)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
have "(lsc_hull f) y = min (f y) (Liminf (at y) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lsc_hull f y = min (f y) (Liminf (at y) f)
[PROOF STEP]
by (metis lsc_hull_liminf_at)
[PROOF STATE]
proof (state)
this:
lsc_hull f y = min (f y) (Liminf (at y) f)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lsc_hull f y = min (f y) (Liminf (at y) f)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
have "\<dots> \<le> Liminf (at 1 within {0..<1}) ?g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (f y) (Liminf (at y) f) \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
[PROOF STEP]
unfolding min_Liminf_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP e\<in>{0<..}. Inf (f ` ball y e)) \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
[PROOF STEP]
unfolding Liminf_within
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP e\<in>{0<..}. Inf (f ` ball y e)) \<le> (SUP e\<in>{0<..}. INF m\<in>{0..<1} \<inter> ball 1 e - {1}. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
[PROOF STEP]
apply (subst SUP_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. n \<in> {0<..} \<Longrightarrow> \<exists>m\<in>{0<..}. Inf (f ` ball y n) \<le> (INF m\<in>{0..<1} \<inter> ball 1 m - {1}. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
 2. True
[PROOF STEP]
apply (rule_tac x="n/norm(y-x)" in bexI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. n \<in> {0<..} \<Longrightarrow> Inf (f ` ball y n) \<le> (INF m\<in>{0..<1} \<inter> ball 1 (n / norm (y - x)) - {1}. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
 2. \<And>n. n \<in> {0<..} \<Longrightarrow> n / norm (y - x) \<in> {0<..}
 3. True
[PROOF STEP]
apply (subst INF_mono)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>n m. \<lbrakk>n \<in> {0<..}; m \<in> {0..<1} \<inter> ball 1 (n / norm (y - x)) - {1}\<rbrakk> \<Longrightarrow> \<exists>n\<in>ball y n. f n \<le> f ((1 - m) *\<^sub>R x + m *\<^sub>R y)
 2. \<And>n. n \<in> {0<..} \<Longrightarrow> True
 3. \<And>n. n \<in> {0<..} \<Longrightarrow> n / norm (y - x) \<in> {0<..}
 4. True
[PROOF STEP]
apply (rule_tac x="(1 - m) *\<^sub>R x + m *\<^sub>R y" in bexI)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>n m. \<lbrakk>n \<in> {0<..}; m \<in> {0..<1} \<inter> ball 1 (n / norm (y - x)) - {1}\<rbrakk> \<Longrightarrow> f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> f ((1 - m) *\<^sub>R x + m *\<^sub>R y)
 2. \<And>n m. \<lbrakk>n \<in> {0<..}; m \<in> {0..<1} \<inter> ball 1 (n / norm (y - x)) - {1}\<rbrakk> \<Longrightarrow> (1 - m) *\<^sub>R x + m *\<^sub>R y \<in> ball y n
 3. \<And>n. n \<in> {0<..} \<Longrightarrow> True
 4. \<And>n. n \<in> {0<..} \<Longrightarrow> n / norm (y - x) \<in> {0<..}
 5. True
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>n m. \<lbrakk>n \<in> {0<..}; m \<in> {0..<1} \<inter> ball 1 (n / norm (y - x)) - {1}\<rbrakk> \<Longrightarrow> (1 - m) *\<^sub>R x + m *\<^sub>R y \<in> ball y n
 2. \<And>n m. \<lbrakk>n \<in> {0<..}; m \<in> {0..<1} \<inter> ball 1 (n / norm (y - x)) - {1}\<rbrakk> \<Longrightarrow> f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> f ((1 - m) *\<^sub>R x + m *\<^sub>R y)
 3. \<And>n. n \<in> {0<..} \<Longrightarrow> True
 4. \<And>n. n \<in> {0<..} \<Longrightarrow> n / norm (y - x) \<in> {0<..}
 5. True
[PROOF STEP]
unfolding ball_def dist_norm
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>n m. \<lbrakk>n \<in> {0<..}; m \<in> {0..<1} \<inter> {ya. norm (1 - ya) < n / norm (y - x)} - {1}\<rbrakk> \<Longrightarrow> (1 - m) *\<^sub>R x + m *\<^sub>R y \<in> {ya. norm (y - ya) < n}
 2. \<And>n m. \<lbrakk>n \<in> {0<..}; m \<in> {0..<1} \<inter> {ya. norm (1 - ya) < n / norm (y - x)} - {1}\<rbrakk> \<Longrightarrow> f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> f ((1 - m) *\<^sub>R x + m *\<^sub>R y)
 3. \<And>n. n \<in> {0<..} \<Longrightarrow> True
 4. \<And>n. n \<in> {0<..} \<Longrightarrow> n / norm (y - x) \<in> {0<..}
 5. True
[PROOF STEP]
by (auto simp add: aux \<open>y\<noteq>x\<close> less_divide_eq)
[PROOF STATE]
proof (state)
this:
min (f y) (Liminf (at y) f) \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lsc_hull f y \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
[PROOF STEP]
have *: "(lsc_hull f) y \<le> Liminf (at 1 within {0..<1}) ?g"
[PROOF STATE]
proof (prove)
using this:
lsc_hull f y \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))

goal (1 subgoal):
 1. lsc_hull f y \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lsc_hull f y \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
lsc_hull f y \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
assume "ereal b\<ge>(lsc_hull f) y"
[PROOF STATE]
proof (state)
this:
lsc_hull f y \<le> ereal b

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence yb: "(y,b):closure(Epigraph UNIV f)"
[PROOF STATE]
proof (prove)
using this:
lsc_hull f y \<le> ereal b

goal (1 subgoal):
 1. (y, b) \<in> closure (Epigraph UNIV f)
[PROOF STEP]
by (metis epigraph_lsc_hull mem_Epigraph UNIV_I)
[PROOF STATE]
proof (state)
this:
(y, b) \<in> closure (Epigraph UNIV f)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
have "x : domain f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> domain f
[PROOF STEP]
by (metis assms(2) rel_interior_subset rev_subsetD)
[PROOF STATE]
proof (state)
this:
x \<in> domain f

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "f x<\<infinity>"
[PROOF STATE]
proof (prove)
using this:
x \<in> domain f

goal (1 subgoal):
 1. f x < \<infinity>
[PROOF STEP]
unfolding domain_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {x. f x < \<infinity>}

goal (1 subgoal):
 1. f x < \<infinity>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f x < \<infinity>

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f x < \<infinity>
[PROOF STEP]
obtain a where"ereal a>f x"
[PROOF STATE]
proof (prove)
using this:
f x < \<infinity>

goal (1 subgoal):
 1. (\<And>a. f x < ereal a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis ereal_dense2)
[PROOF STATE]
proof (state)
this:
f x < ereal a

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence xa: "(x,a):rel_interior(Epigraph UNIV f)"
[PROOF STATE]
proof (prove)
using this:
f x < ereal a

goal (1 subgoal):
 1. (x, a) \<in> rel_interior (Epigraph UNIV f)
[PROOF STEP]
by (metis assms rel_interior_Epigraph)
[PROOF STATE]
proof (state)
this:
(x, a) \<in> rel_interior (Epigraph UNIV f)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(x, a) \<in> rel_interior (Epigraph UNIV f)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
fix m :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
assume "0 \<le> m \<and> m < 1"
[PROOF STATE]
proof (state)
this:
0 \<le> m \<and> m < 1

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "(y, b) - (1-m) *\<^sub>R ((y, b) - (x, a)) : rel_interior (Epigraph UNIV f)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> m \<and> m < 1

goal (1 subgoal):
 1. (y, b) - (1 - m) *\<^sub>R ((y, b) - (x, a)) \<in> rel_interior (Epigraph UNIV f)
[PROOF STEP]
apply (subst rel_interior_closure_convex_shrink)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. 0 \<le> m \<and> m < 1 \<Longrightarrow> convex (Epigraph UNIV f)
 2. 0 \<le> m \<and> m < 1 \<Longrightarrow> (x, a) \<in> rel_interior (Epigraph UNIV f)
 3. 0 \<le> m \<and> m < 1 \<Longrightarrow> (y, b) \<in> closure (Epigraph UNIV f)
 4. 0 \<le> m \<and> m < 1 \<Longrightarrow> 0 < 1 - m
 5. 0 \<le> m \<and> m < 1 \<Longrightarrow> 1 - m \<le> 1
 6. 0 \<le> m \<and> m < 1 \<Longrightarrow> True
[PROOF STEP]
apply (metis assms(1) convex_Epigraph convex_UNIV convex_on_ereal_univ)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. 0 \<le> m \<and> m < 1 \<Longrightarrow> (x, a) \<in> rel_interior (Epigraph UNIV f)
 2. 0 \<le> m \<and> m < 1 \<Longrightarrow> (y, b) \<in> closure (Epigraph UNIV f)
 3. 0 \<le> m \<and> m < 1 \<Longrightarrow> 0 < 1 - m
 4. 0 \<le> m \<and> m < 1 \<Longrightarrow> 1 - m \<le> 1
 5. 0 \<le> m \<and> m < 1 \<Longrightarrow> True
[PROOF STEP]
using yb xa
[PROOF STATE]
proof (prove)
using this:
(y, b) \<in> closure (Epigraph UNIV f)
(x, a) \<in> rel_interior (Epigraph UNIV f)

goal (5 subgoals):
 1. 0 \<le> m \<and> m < 1 \<Longrightarrow> (x, a) \<in> rel_interior (Epigraph UNIV f)
 2. 0 \<le> m \<and> m < 1 \<Longrightarrow> (y, b) \<in> closure (Epigraph UNIV f)
 3. 0 \<le> m \<and> m < 1 \<Longrightarrow> 0 < 1 - m
 4. 0 \<le> m \<and> m < 1 \<Longrightarrow> 1 - m \<le> 1
 5. 0 \<le> m \<and> m < 1 \<Longrightarrow> True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(y, b) - (1 - m) *\<^sub>R ((y, b) - (x, a)) \<in> rel_interior (Epigraph UNIV f)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "f (y - (1-m) *\<^sub>R (y-x) ) < ereal (b-(1-m)*(b-a))"
[PROOF STATE]
proof (prove)
using this:
(y, b) - (1 - m) *\<^sub>R ((y, b) - (x, a)) \<in> rel_interior (Epigraph UNIV f)

goal (1 subgoal):
 1. f (y - (1 - m) *\<^sub>R (y - x)) < ereal (b - (1 - m) * (b - a))
[PROOF STEP]
using assms(1) rel_interior_Epigraph
[PROOF STATE]
proof (prove)
using this:
(y, b) - (1 - m) *\<^sub>R ((y, b) - (x, a)) \<in> rel_interior (Epigraph UNIV f)
Lower_Semicontinuous.convex_on UNIV f
Lower_Semicontinuous.convex_on UNIV ?f \<Longrightarrow> ((?x, ?z) \<in> rel_interior (Epigraph UNIV ?f)) = (?x \<in> rel_interior (domain ?f) \<and> ?f ?x < ereal ?z)

goal (1 subgoal):
 1. f (y - (1 - m) *\<^sub>R (y - x)) < ereal (b - (1 - m) * (b - a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (y - (1 - m) *\<^sub>R (y - x)) < ereal (b - (1 - m) * (b - a))

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "?g m \<le> ereal ((1-m)*a+m*b)"
[PROOF STATE]
proof (prove)
using this:
f (y - (1 - m) *\<^sub>R (y - x)) < ereal (b - (1 - m) * (b - a))

goal (1 subgoal):
 1. f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 \<le> ?m2 \<and> ?m2 < 1 \<Longrightarrow> f ((1 - ?m2) *\<^sub>R x + ?m2 *\<^sub>R y) \<le> ereal ((1 - ?m2) * a + ?m2 * b)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "eventually (\<lambda>m. ?g m \<le> ereal ((1-m)*a+m*b))
         (at 1 within {0..<1})"
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?m2 \<and> ?m2 < 1 \<Longrightarrow> f ((1 - ?m2) *\<^sub>R x + ?m2 *\<^sub>R y) \<le> ereal ((1 - ?m2) * a + ?m2 * b)

goal (1 subgoal):
 1. \<forall>\<^sub>F m in at 1 within {0..<1}. f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b)
[PROOF STEP]
apply (subst always_eventually_within)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>m. 0 \<le> m \<and> m < 1 \<Longrightarrow> f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b)) \<Longrightarrow> \<forall>xa\<in>{0..<1}. f ((1 - xa) *\<^sub>R x + xa *\<^sub>R y) \<le> ereal ((1 - xa) * a + xa * b)
 2. (\<And>m. 0 \<le> m \<and> m < 1 \<Longrightarrow> f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b)) \<Longrightarrow> True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F m in at 1 within {0..<1}. f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b)

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "Limsup (at 1 within {0..<1}) ?g \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. ereal ((1-m)*a+m*b))"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F m in at 1 within {0..<1}. f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b)

goal (1 subgoal):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. ereal ((1 - m) * a + m * b))
[PROOF STEP]
apply (subst Limsup_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>\<^sub>F m in at 1 within {0..<1}. f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b) \<Longrightarrow> \<forall>\<^sub>F xa in at 1 within {0..<1}. f ((1 - xa) *\<^sub>R x + xa *\<^sub>R y) \<le> ereal ((1 - xa) * a + xa * b)
 2. \<forall>\<^sub>F m in at 1 within {0..<1}. f ((1 - m) *\<^sub>R x + m *\<^sub>R y) \<le> ereal ((1 - m) * a + m * b) \<Longrightarrow> True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. ereal ((1 - m) * a + m * b))

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. ereal ((1 - m) * a + m * b))

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
have "\<dots> \<le> ereal b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. ereal ((1 - m) * a + m * b)) \<le> ereal b
[PROOF STEP]
using lsc_hull_of_convex_aux
[PROOF STATE]
proof (prove)
using this:
Limsup (at 1 within {0..<1}) (\<lambda>m. ereal ((1 - m) * ?a + m * ?b)) \<le> ereal ?b

goal (1 subgoal):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. ereal ((1 - m) * a + m * b)) \<le> ereal b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Limsup (at 1 within {0..<1}) (\<lambda>m. ereal ((1 - m) * a + m * b)) \<le> ereal b

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> ereal b
[PROOF STEP]
have "Limsup (at 1 within {0..<1}) ?g \<le>ereal b"
[PROOF STATE]
proof (prove)
using this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> ereal b

goal (1 subgoal):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> ereal b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> ereal b

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
lsc_hull f y \<le> ereal ?b2 \<Longrightarrow> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> ereal ?b2

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "Limsup (at 1 within {0..<1}) ?g \<le> (lsc_hull f) y"
[PROOF STATE]
proof (prove)
using this:
lsc_hull f y \<le> ereal ?b2 \<Longrightarrow> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> ereal ?b2

goal (1 subgoal):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> lsc_hull f y
[PROOF STEP]
using ereal_le_real[of "(lsc_hull f) y"]
[PROOF STATE]
proof (prove)
using this:
lsc_hull f y \<le> ereal ?b2 \<Longrightarrow> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> ereal ?b2
(\<And>z. lsc_hull f y \<le> ereal z \<Longrightarrow> ?y \<le> ereal z) \<Longrightarrow> ?y \<le> lsc_hull f y

goal (1 subgoal):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> lsc_hull f y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> lsc_hull f y

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> lsc_hull f y

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
have nontr: "~trivial_limit (at (1::real) within {0..<1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at 1 within {0..<1} \<noteq> bot
[PROOF STEP]
apply (subst trivial_limit_within)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> \<not> 1 islimpt {0..<1}
[PROOF STEP]
using real_interval_limpt
[PROOF STATE]
proof (prove)
using this:
?a < ?b \<Longrightarrow> ?b islimpt {?a..<?b}

goal (1 subgoal):
 1. \<not> \<not> 1 islimpt {0..<1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
at 1 within {0..<1} \<noteq> bot

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
at 1 within {0..<1} \<noteq> bot

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
hence "Liminf (at 1 within {0..<1}) ?g \<le> Limsup (at 1 within {0..<1}) ?g"
[PROOF STATE]
proof (prove)
using this:
at 1 within {0..<1} \<noteq> bot

goal (1 subgoal):
 1. Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
[PROOF STEP]
apply (subst Liminf_le_Limsup)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. at 1 within {0..<1} \<noteq> bot \<Longrightarrow> at 1 within {0..<1} \<noteq> bot
 2. at 1 within {0..<1} \<noteq> bot \<Longrightarrow> True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> lsc_hull f y
at 1 within {0..<1} \<noteq> bot
Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
[PROOF STEP]
have "Limsup (at 1 within {0..<1}) ?g = (lsc_hull f) y
                   \<and> Liminf (at 1 within {0..<1}) ?g = (lsc_hull f) y"
[PROOF STATE]
proof (prove)
using this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> lsc_hull f y
at 1 within {0..<1} \<noteq> bot
Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))

goal (1 subgoal):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> lsc_hull f y
at 1 within {0..<1} \<noteq> bot
Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<le> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))
lsc_hull f y \<le> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y))

goal (1 subgoal):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y

goal (1 subgoal):
 1. y \<noteq> x \<Longrightarrow> ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y

goal (1 subgoal):
 1. ((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})
[PROOF STEP]
apply (subst Liminf_eq_Limsup)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<Longrightarrow> at 1 within {0..<1} \<noteq> bot
 2. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<Longrightarrow> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y
 3. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<Longrightarrow> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y
 4. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<Longrightarrow> True
[PROOF STEP]
using nontr
[PROOF STATE]
proof (prove)
using this:
at 1 within {0..<1} \<noteq> bot

goal (4 subgoals):
 1. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<Longrightarrow> at 1 within {0..<1} \<noteq> bot
 2. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<Longrightarrow> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y
 3. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<Longrightarrow> Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y
 4. Limsup (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<and> Liminf (at 1 within {0..<1}) (\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) = lsc_hull f y \<Longrightarrow> True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>m. f ((1 - m) *\<^sub>R x + m *\<^sub>R y)) \<longlongrightarrow> lsc_hull f y) (at 1 within {0..<1})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wcode_lemma:
  "args \<noteq> [] \<Longrightarrow>
  \<exists> stp ln rn. steps0 (Suc 0, [], <m # args>)  (wcode_tm) stp =
              (0,  [Bk],  <[m ,bl_bin (<args>)]> @ Bk\<up>(rn))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. args \<noteq> [] \<Longrightarrow> \<exists>stp ln rn. steps0 (Suc 0, [], <m # args>) wcode_tm stp = (0, [Bk], <[m, bl_bin (<args>)]> @ Bk \<up> rn)
[PROOF STEP]
using wcode_lemma_1[of args m]
[PROOF STATE]
proof (prove)
using this:
args \<noteq> [] \<Longrightarrow> \<exists>stp ln rn. steps0 (Suc 0, [], <m # args>) wcode_tm stp = (0, [Bk], Oc \<up> Suc m @ Bk # Oc \<up> Suc (bl_bin (<args>)) @ Bk \<up> rn)

goal (1 subgoal):
 1. args \<noteq> [] \<Longrightarrow> \<exists>stp ln rn. steps0 (Suc 0, [], <m # args>) wcode_tm stp = (0, [Bk], <[m, bl_bin (<args>)]> @ Bk \<up> rn)
[PROOF STEP]
apply(simp add: wcode_tm_def tape_of_list_def tape_of_nat_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma register_tensor_is_register:
  fixes F :: "'a::domain update \<Rightarrow> 'b::domain update" and G :: "'c::domain update \<Rightarrow> 'd::domain update"
  shows "register F \<Longrightarrow> register G \<Longrightarrow> register (F \<otimes>\<^sub>r G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (F \<otimes>\<^sub>r G)
[PROOF STEP]
unfolding register_tensor_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>a. F a \<otimes>\<^sub>u id_update;\<lambda>b. id_update \<otimes>\<^sub>u G b)
[PROOF STEP]
apply (rule register_pair_is_register)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>a. F a \<otimes>\<^sub>u id_update)
 2. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> register (\<lambda>b. id_update \<otimes>\<^sub>u G b)
 3. \<And>a b. \<lbrakk>register F; register G\<rbrakk> \<Longrightarrow> F a \<otimes>\<^sub>u id_update *\<^sub>u id_update \<otimes>\<^sub>u G b = id_update \<otimes>\<^sub>u G b *\<^sub>u F a \<otimes>\<^sub>u id_update
[PROOF STEP]
by (simp_all add: tensor_update_mult)


[STATEMENT]
theorem UP_ring: "ring P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring P
[PROOF STEP]
by (auto intro!: ringI abelian_groupI monoidI UP_a_assoc)
    (auto intro: UP_a_comm UP_l_neg_ex UP_m_assoc UP_l_distr UP_r_distr)


[STATEMENT]
lemma [code]:
  "card_UNIV TYPE('a :: enum) = card (set (Enum.enum :: 'a list))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_UNIV TYPE('a) = card (set enum)
[PROOF STEP]
by (simp only: card_UNIV_def enum_UNIV)


[STATEMENT]
theorem P2_secure:
  assumes "x < q n" "y < q n"
  shows "sim_non_det_def.perfect_sec_P2 n x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sim_non_det_def.perfect_sec_P2 n x y
[PROOF STEP]
by (metis P2_security assms)


[STATEMENT]
lemma fdia_eq: "ad.fdia x p = Inf{d q |q. x \<cdot> d p \<le> d q \<cdot> x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. antidomain_semiringl.fdia a (\<cdot>) x p = Inf {d q |q. x \<cdot> d p \<le> d q \<cdot> x}
[PROOF STEP]
apply (rule Inf_eqI[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i \<in> {d q |q. x \<cdot> d p \<le> d q \<cdot> x} \<Longrightarrow> antidomain_semiringl.fdia a (\<cdot>) x p \<le> i
 2. \<And>y. (\<And>i. i \<in> {d q |q. x \<cdot> d p \<le> d q \<cdot> x} \<Longrightarrow> y \<le> i) \<Longrightarrow> y \<le> antidomain_semiringl.fdia a (\<cdot>) x p
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q. x \<cdot> d p \<le> d q \<cdot> x \<Longrightarrow> antidomain_semiringl.fdia a (\<cdot>) x p \<le> d q
 2. \<And>y. (\<And>i. i \<in> {d q |q. x \<cdot> d p \<le> d q \<cdot> x} \<Longrightarrow> y \<le> i) \<Longrightarrow> y \<le> antidomain_semiringl.fdia a (\<cdot>) x p
[PROOF STEP]
using ds.fdemodalisation2
[PROOF STATE]
proof (prove)
using this:
(domain_semiringl.fd (\<cdot>) d ?x ?y \<le> d ?z) = (?x \<cdot> d ?y \<le> d ?z \<cdot> ?x)

goal (2 subgoals):
 1. \<And>q. x \<cdot> d p \<le> d q \<cdot> x \<Longrightarrow> antidomain_semiringl.fdia a (\<cdot>) x p \<le> d q
 2. \<And>y. (\<And>i. i \<in> {d q |q. x \<cdot> d p \<le> d q \<cdot> x} \<Longrightarrow> y \<le> i) \<Longrightarrow> y \<le> antidomain_semiringl.fdia a (\<cdot>) x p
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. (\<And>i. i \<in> {d q |q. x \<cdot> d p \<le> d q \<cdot> x} \<Longrightarrow> y \<le> i) \<Longrightarrow> y \<le> antidomain_semiringl.fdia a (\<cdot>) x p
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. (\<And>i. \<exists>q. i = d q \<and> x \<cdot> d p \<le> d q \<cdot> x \<Longrightarrow> y \<le> i) \<Longrightarrow> y \<le> antidomain_semiringl.fdia a (\<cdot>) x p
[PROOF STEP]
by (metis ad.fd_eq_fdia ad.fdia_def da_a double_compl ds.fdemodalisation2 inf_bot_iff_le inf_compl_bot)


[STATEMENT]
lemma enat_plus_eq_enat_conv: \<comment> \<open>Move to Extended\_Nat\<close>
  "enat m + n = enat k \<longleftrightarrow> k \<ge> m \<and> n = enat (k - m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (enat m + n = enat k) = (m \<le> k \<and> n = enat (k - m))
[PROOF STEP]
by(cases n) auto


[STATEMENT]
lemma (in disc_equity_market) remaining_qty_adapt:
  assumes "borel_adapt_stoch_proc F (prices Mkt asset)"
  and "trading_strategy pf"
and "support_adapt Mkt pf"
shows "remaining_qty Mkt v pf asset n \<in> borel_measurable (F n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. remaining_qty Mkt v pf asset n \<in> borel_measurable (F n)
[PROOF STEP]
using adapt_stoch_proc_def assms(1) assms(2) predict_imp_adapt remaining_qty_predict
[PROOF STATE]
proof (prove)
using this:
adapt_stoch_proc ?F ?X ?N = (\<forall>t. ?X t \<in> ?F t \<rightarrow>\<^sub>M ?N)
borel_adapt_stoch_proc F (prices Mkt asset)
trading_strategy pf
predict_stoch_proc F ?X ?N \<Longrightarrow> adapt_stoch_proc F ?X ?N
\<lbrakk>borel_adapt_stoch_proc F (prices Mkt ?asset); trading_strategy ?pf; support_adapt Mkt ?pf\<rbrakk> \<Longrightarrow> borel_predict_stoch_proc F (remaining_qty Mkt ?v ?pf ?asset)

goal (1 subgoal):
 1. remaining_qty Mkt v pf asset n \<in> borel_measurable (F n)
[PROOF STEP]
by (metis assms(3))


[STATEMENT]
lemma coprime_iff_gcd_eq_1 [presburger, code]:
  "coprime a b \<longleftrightarrow> gcd a b = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a b = (gcd a b = (1::'a))
[PROOF STEP]
by rule (simp_all add: gcd_eq_1_imp_coprime)


[STATEMENT]
lemma Vset_succ [simp]: "Ord k \<Longrightarrow> Vset (succ k) = HPow (Vset k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord k \<Longrightarrow> Vset (succ k) = HPow (Vset k)
[PROOF STEP]
by (simp add: Vset_def)


[STATEMENT]
lemma valid_all_sub_consts:
  fixes e :: \<open>nat \<Rightarrow> 'a\<close>
  assumes \<open>\<forall>(e :: nat \<Rightarrow> 'a) f g. list_all (eval e f g) G \<longrightarrow> eval e f g p\<close>
  shows \<open>list_all (eval e f g) (map (sub_consts cs) G) \<longrightarrow> eval e f g (sub_consts cs p)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all (eval e f g) (map (sub_consts cs) G) \<longrightarrow> eval e f g (sub_consts cs p)
[PROOF STEP]
using assms eval_conjoin eval_sub_consts all_sub_consts_conjoin
[PROOF STATE]
proof (prove)
using this:
\<forall>e f g. list_all (eval e f g) G \<longrightarrow> eval e f g p
list_all (eval ?e ?f ?g) ?G = eval ?e ?f ?g (conjoin ?G)
\<lbrakk>\<forall>e f g. eval e f g ?p \<longrightarrow> eval e f g ?q; eval ?e ?f ?g (sub_consts ?cs ?p)\<rbrakk> \<Longrightarrow> eval ?e ?f ?g (sub_consts ?cs ?q)
list_all (eval ?e ?f ?g) (map (sub_consts ?cs) ?G) = eval ?e ?f ?g (sub_consts ?cs (conjoin ?G))

goal (1 subgoal):
 1. list_all (eval e f g) (map (sub_consts cs) G) \<longrightarrow> eval e f g (sub_consts cs p)
[PROOF STEP]
by metis


[STATEMENT]
lemma lm130:
  assumes "runiq f"
  shows "sum (f Else 0) (X\<inter>(Domain f))  =  sum (toFunction f) (X\<inter>(Domain f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MiscTools.sum' f (X \<inter> Domain f) = sum (toFunction f) (X \<inter> Domain f)
[PROOF STEP]
using assms sum.cong lm129
[PROOF STATE]
proof (prove)
using this:
runiq f
\<lbrakk>?A = ?B; \<And>x. x \<in> ?B \<Longrightarrow> ?g x = ?h x\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?h ?B
\<lbrakk>runiq ?f; ?x \<in> Domain ?f\<rbrakk> \<Longrightarrow> (?f Else (0::?'b)) ?x = toFunction ?f ?x

goal (1 subgoal):
 1. MiscTools.sum' f (X \<inter> Domain f) = sum (toFunction f) (X \<inter> Domain f)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma "(p1 \<and> p2) \<or> p3 \<longrightarrow> (p1 \<longrightarrow> (p3 \<and> p2) \<or> (p1 \<and> p3)) \<or> p1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p1 \<and> p2 \<or> p3 \<longrightarrow> (p1 \<longrightarrow> p3 \<and> p2 \<or> p1 \<and> p3) \<or> p1
[PROOF STEP]
by (smt (verit))


[STATEMENT]
lemma [simp]:
  "size_exp' (Letrec defs e) = Suc (size_exp' e + size_list (size_prod (\<lambda>_. 0) (size_prod (\<lambda>_. 0) size_exp')) defs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size_exp' (Letrec defs e) = Suc (size_exp' e + size_list (size_prod (\<lambda>_. 0) (size_prod (\<lambda>_. 0) size_exp')) defs)
[PROOF STEP]
apply (simp add: size_exp'.simps size_list_conv_sum_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ((\<lambda>(uu_, uu_, es). Suc (Suc es)) \<circ> map_prod id (map_prod id size_exp')) defs) = sum_list (map (size_prod (\<lambda>_. 0) (size_prod (\<lambda>_. 0) size_exp')) defs)
[PROOF STEP]
apply (rule arg_cong[where f = sum_list])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((\<lambda>(uu_, uu_, es). Suc (Suc es)) \<circ> map_prod id (map_prod id size_exp')) defs = map (size_prod (\<lambda>_. 0) (size_prod (\<lambda>_. 0) size_exp')) defs
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma reachable_refl [intro!, Pure.intro!, simp]: "v \<in> verts G \<Longrightarrow> v \<rightarrow>\<^sup>* v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> verts G \<Longrightarrow> v \<rightarrow>\<^sup>* v
[PROOF STEP]
unfolding reachable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> verts G \<Longrightarrow> (v, v) \<in> rtrancl_on (verts G) (arcs_ends G)
[PROOF STEP]
by auto


[STATEMENT]
lemma last_message_hold_init_snoc: "
  last_message_hold_init (xs @ [x]) m =
  last_message_hold_init xs m @
    [if x = \<NoMsg> then last_message (m # xs) else x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last_message_hold_init (xs @ [x]) m = last_message_hold_init xs m @ [if x = NoMsg then last_message (m # xs) else x]
[PROOF STEP]
by (simp add: list_eq_iff nth_append last_message_hold_init_nth last_message_append)


[STATEMENT]
lemma surj_prod_encode: "surj prod_encode"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj prod_encode
[PROOF STEP]
by (rule surjI) (rule prod_decode_inverse)


[STATEMENT]
lemma Qp_poly_smult_cfs:
  assumes "a \<in> carrier Q\<^sub>p"
  assumes "P \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>])"
  shows "(a \<odot>\<^bsub>Q\<^sub>p[\<X>\<^bsub>n\<^esub>]\<^esub> P) m = a \<otimes> (P m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<odot>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> P) m = a \<otimes> P m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Q\<^sub>p
P \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])

goal (1 subgoal):
 1. (a \<odot>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> P) m = a \<otimes> P m
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Q\<^sub>p
P \<in> carrier (Pring Q\<^sub>p {..<n})

goal (1 subgoal):
 1. (a \<odot>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> P) m = a \<otimes> P m
[PROOF STEP]
using Qp.Pring_smult_cfs
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Q\<^sub>p
P \<in> carrier (Pring Q\<^sub>p {..<n})
\<lbrakk>?a \<in> carrier Q\<^sub>p; ?P \<in> carrier (Pring Q\<^sub>p ?I)\<rbrakk> \<Longrightarrow> (?a \<odot>\<^bsub>Pring Q\<^sub>p ?I\<^esub> ?P) ?m = ?a \<otimes> ?P ?m

goal (1 subgoal):
 1. (a \<odot>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> P) m = a \<otimes> P m
[PROOF STEP]
by blast


[STATEMENT]
lemma monoI1: "\<forall>m. \<forall>n \<ge> m. X m \<le> X n \<Longrightarrow> monoseq X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n \<Longrightarrow> monoseq X
[PROOF STEP]
by (simp add: monoseq_def)


[STATEMENT]
lemma dropWhile_sorted_le_above:
  "\<lbrakk> sorted xs; x \<in> set (dropWhile (\<lambda> x. x \<le> n) xs) \<rbrakk> \<Longrightarrow> x > n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted xs; x \<in> set (dropWhile (\<lambda>x. x \<le> n) xs)\<rbrakk> \<Longrightarrow> n < x
[PROOF STEP]
apply (induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>sorted []; x \<in> set (dropWhile (\<lambda>x. x \<le> n) [])\<rbrakk> \<Longrightarrow> n < x
 2. \<And>a xs. \<lbrakk>\<lbrakk>sorted xs; x \<in> set (dropWhile (\<lambda>x. x \<le> n) xs)\<rbrakk> \<Longrightarrow> n < x; sorted (a # xs); x \<in> set (dropWhile (\<lambda>x. x \<le> n) (a # xs))\<rbrakk> \<Longrightarrow> n < x
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>x \<in> set (dropWhile (\<lambda>x. x \<le> n) xs) \<Longrightarrow> n < x; x \<in> set (if a \<le> n then dropWhile (\<lambda>x. x \<le> n) xs else a # xs); \<forall>x\<in>set xs. a \<le> x; sorted xs\<rbrakk> \<Longrightarrow> n < x
[PROOF STEP]
apply (rename_tac a xs)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>x \<in> set (dropWhile (\<lambda>x. x \<le> n) xs) \<Longrightarrow> n < x; x \<in> set (if a \<le> n then dropWhile (\<lambda>x. x \<le> n) xs else a # xs); \<forall>x\<in>set xs. a \<le> x; sorted xs\<rbrakk> \<Longrightarrow> n < x
[PROOF STEP]
apply (case_tac "a \<le> n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs. \<lbrakk>x \<in> set (dropWhile (\<lambda>x. x \<le> n) xs) \<Longrightarrow> n < x; x \<in> set (if a \<le> n then dropWhile (\<lambda>x. x \<le> n) xs else a # xs); \<forall>x\<in>set xs. a \<le> x; sorted xs; a \<le> n\<rbrakk> \<Longrightarrow> n < x
 2. \<And>a xs. \<lbrakk>x \<in> set (dropWhile (\<lambda>x. x \<le> n) xs) \<Longrightarrow> n < x; x \<in> set (if a \<le> n then dropWhile (\<lambda>x. x \<le> n) xs else a # xs); \<forall>x\<in>set xs. a \<le> x; sorted xs; \<not> a \<le> n\<rbrakk> \<Longrightarrow> n < x
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma find_sort_least :
  assumes "find P (sort xs) = Some x"
  shows "\<forall> x' \<in> set xs . x \<le> x' \<or> \<not> P x'"
  and   "x = (LEAST x' \<in> set xs . P x')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x' &&& x = (LEAST x'. x' \<in> set xs \<and> P x')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'
 2. x = (LEAST x'. x' \<in> set xs \<and> P x')
[PROOF STEP]
obtain i where "i < length (sort xs)"
           and   "(sort xs) ! i = x"
           and   "(\<forall> j < i . \<not> P ((sort xs) ! j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length (sort xs); sort xs ! i = x; \<forall>j<i. \<not> P (sort xs ! j)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using find_sort_index[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>i<length (sort xs). sort xs ! i = x \<and> (\<forall>j<i. \<not> P (sort xs ! j))

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length (sort xs); sort xs ! i = x; \<forall>j<i. \<not> P (sort xs ! j)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i < length (sort xs)
sort xs ! i = x
\<forall>j<i. \<not> P (sort xs ! j)

goal (2 subgoals):
 1. \<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'
 2. x = (LEAST x'. x' \<in> set xs \<and> P x')
[PROOF STEP]
have "\<And> j . j > i \<Longrightarrow> j < length xs \<Longrightarrow> (sort xs) ! i \<le> (sort xs) ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>i < j; j < length xs\<rbrakk> \<Longrightarrow> sort xs ! i \<le> sort xs ! j
[PROOF STEP]
by (simp add: sorted_nth_mono)
[PROOF STATE]
proof (state)
this:
\<lbrakk>i < ?j; ?j < length xs\<rbrakk> \<Longrightarrow> sort xs ! i \<le> sort xs ! ?j

goal (2 subgoals):
 1. \<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'
 2. x = (LEAST x'. x' \<in> set xs \<and> P x')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>i < ?j; ?j < length xs\<rbrakk> \<Longrightarrow> sort xs ! i \<le> sort xs ! ?j
[PROOF STEP]
have "\<And> j . j < length xs \<Longrightarrow> (sort xs) ! i \<le> (sort xs) ! j \<or> \<not> P ((sort xs) ! j)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < ?j; ?j < length xs\<rbrakk> \<Longrightarrow> sort xs ! i \<le> sort xs ! ?j

goal (1 subgoal):
 1. \<And>j. j < length xs \<Longrightarrow> sort xs ! i \<le> sort xs ! j \<or> \<not> P (sort xs ! j)
[PROOF STEP]
using \<open>(\<forall> j < i . \<not> P ((sort xs) ! j))\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < ?j; ?j < length xs\<rbrakk> \<Longrightarrow> sort xs ! i \<le> sort xs ! ?j
\<forall>j<i. \<not> P (sort xs ! j)

goal (1 subgoal):
 1. \<And>j. j < length xs \<Longrightarrow> sort xs ! i \<le> sort xs ! j \<or> \<not> P (sort xs ! j)
[PROOF STEP]
by (metis not_less_iff_gr_or_eq order_refl)
[PROOF STATE]
proof (state)
this:
?j < length xs \<Longrightarrow> sort xs ! i \<le> sort xs ! ?j \<or> \<not> P (sort xs ! ?j)

goal (2 subgoals):
 1. \<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'
 2. x = (LEAST x'. x' \<in> set xs \<and> P x')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?j < length xs \<Longrightarrow> sort xs ! i \<le> sort xs ! ?j \<or> \<not> P (sort xs ! ?j)
[PROOF STEP]
show "\<forall> x' \<in> set xs . x \<le> x' \<or> \<not> P x'"
[PROOF STATE]
proof (prove)
using this:
?j < length xs \<Longrightarrow> sort xs ! i \<le> sort xs ! ?j \<or> \<not> P (sort xs ! ?j)

goal (1 subgoal):
 1. \<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'
[PROOF STEP]
by (metis \<open>sort xs ! i = x\<close> in_set_conv_nth length_sort set_sort)
[PROOF STATE]
proof (state)
this:
\<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'

goal (1 subgoal):
 1. x = (LEAST x'. x' \<in> set xs \<and> P x')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'
[PROOF STEP]
show "x = (LEAST x' \<in> set xs . P x')"
[PROOF STATE]
proof (prove)
using this:
\<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'

goal (1 subgoal):
 1. x = (LEAST x'. x' \<in> set xs \<and> P x')
[PROOF STEP]
using find_set[OF assms] find_condition[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<forall>x'\<in>set xs. x \<le> x' \<or> \<not> P x'
x \<in> set (sort xs)
P x

goal (1 subgoal):
 1. x = (LEAST x'. x' \<in> set xs \<and> P x')
[PROOF STEP]
by (metis (mono_tags, lifting) Least_equality set_sort)
[PROOF STATE]
proof (state)
this:
x = (LEAST x'. x' \<in> set xs \<and> P x')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldr_apply_guards:
  "(gval (foldr gAnd G (Bc True)) s = true) = apply_guards G s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (gval (foldr gAnd G (Bc True)) s = true) = apply_guards G s
[PROOF STEP]
by (simp add: apply_guards_foldr)


[STATEMENT]
lemma min_union_finite:
  "finite A \<Longrightarrow> finite B \<Longrightarrow> finite (A \<union>\<^sub>m B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B\<rbrakk> \<Longrightarrow> finite (A \<union>\<^sub>m B)
[PROOF STEP]
by (simp add: min_union_def min_set_finite)


[STATEMENT]
lemma bernoulli_Not: "map_pmf Not (bernoulli_pmf (1 / 2)) = (bernoulli_pmf (1 / 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf Not (bernoulli_pmf (1 / 2)) = bernoulli_pmf (1 / 2)
[PROOF STEP]
apply(rule pmf_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
proof (case_tac i, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
 2. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
case (1 i)
[PROOF STATE]
proof (state)
this:
i

goal (2 subgoals):
 1. \<And>i. i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
 2. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i
[PROOF STEP]
have "pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i =
    pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (Not False)"
[PROOF STATE]
proof (prove)
using this:
i

goal (1 subgoal):
 1. pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> False)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> False)

goal (2 subgoals):
 1. \<And>i. i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
 2. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> False)

goal (2 subgoals):
 1. \<And>i. i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
 2. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
have "\<dots> = pmf (bernoulli_pmf (1 / 2)) False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> False) = pmf (bernoulli_pmf (1 / 2)) False
[PROOF STEP]
apply (rule pmf_map_inj')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj Not
[PROOF STEP]
apply(rule injI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (\<not> x) = (\<not> y) \<Longrightarrow> x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> False) = pmf (bernoulli_pmf (1 / 2)) False

goal (2 subgoals):
 1. \<And>i. i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
 2. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> False) = pmf (bernoulli_pmf (1 / 2)) False

goal (2 subgoals):
 1. \<And>i. i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
 2. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
have "\<dots> = pmf (bernoulli_pmf (1 / 2)) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (bernoulli_pmf (1 / 2)) False = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmf (bernoulli_pmf (1 / 2)) False = pmf (bernoulli_pmf (1 / 2)) i

goal (2 subgoals):
 1. \<And>i. i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
 2. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i

goal (1 subgoal):
 1. pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i

goal (1 subgoal):
 1. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
case (2 i)
[PROOF STATE]
proof (state)
this:
\<not> i

goal (1 subgoal):
 1. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> i
[PROOF STEP]
have "pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i =
    pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (Not True)"
[PROOF STATE]
proof (prove)
using this:
\<not> i

goal (1 subgoal):
 1. pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> True)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> True)

goal (1 subgoal):
 1. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> True)

goal (1 subgoal):
 1. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
have "\<dots> = pmf (bernoulli_pmf (1 / 2)) True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> True) = pmf (bernoulli_pmf (1 / 2)) True
[PROOF STEP]
apply (rule pmf_map_inj')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj Not
[PROOF STEP]
apply(rule injI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (\<not> x) = (\<not> y) \<Longrightarrow> x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> True) = pmf (bernoulli_pmf (1 / 2)) True

goal (1 subgoal):
 1. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) (\<not> True) = pmf (bernoulli_pmf (1 / 2)) True

goal (1 subgoal):
 1. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
have "\<dots> = pmf (bernoulli_pmf (1 / 2)) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (bernoulli_pmf (1 / 2)) True = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmf (bernoulli_pmf (1 / 2)) True = pmf (bernoulli_pmf (1 / 2)) i

goal (1 subgoal):
 1. \<And>i. \<not> i \<Longrightarrow> pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i

goal (1 subgoal):
 1. pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
pmf (map_pmf Not (bernoulli_pmf (1 / 2))) i = pmf (bernoulli_pmf (1 / 2)) i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma app_vlrestrictionE[elim]:
  assumes "x \<in>\<^sub>\<circ> r \<restriction>\<^sup>l\<^sub>\<circ> A"
  obtains a b where "x = \<langle>a, b\<rangle>" and "a \<in>\<^sub>\<circ> A" and "\<langle>a, b\<rangle> \<in>\<^sub>\<circ> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; a \<in>\<^sub>\<circ> A; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> r \<restriction>\<^sup>l\<^sub>\<circ> A

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; a \<in>\<^sub>\<circ> A; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding vlrestriction_def
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> (\<lambda>\<langle>r, A\<rangle>\<in>\<^sub>\<circ>set {\<langle>r, A\<rangle>}. set {\<langle>a, b\<rangle> |a b. a \<in>\<^sub>\<circ> A \<and> \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r})\<lparr>\<langle>r, A\<rangle>\<rparr>

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; a \<in>\<^sub>\<circ> A; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_divide_add:
  fixes f g h :: "'a::{semiring_0,inverse,uminus} fps"
  shows "(f + g) / h = f / h + g / h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f + g) / h = f / h + g / h
[PROOF STEP]
by    (simp add: fps_divide_def algebra_simps fps_shift_add)


[STATEMENT]
lemma fls_divide_uminus:
  fixes f g h :: "'a::{ring,inverse} fls"
  shows "(- f) / g = - (f / g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - f / g = - (f / g)
[PROOF STEP]
by    (simp add: fls_divide_convert_times_inverse)


[STATEMENT]
lemma cos_converges: "(\<lambda>n. cos_coeff n *\<^sub>R x^n) sums cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. cos_coeff n *\<^sub>R x ^ n) sums cos x
[PROOF STEP]
unfolding cos_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. cos_coeff n *\<^sub>R x ^ n) sums (\<Sum>n. cos_coeff n *\<^sub>R x ^ n)
[PROOF STEP]
by (metis (full_types) summable_norm_cancel summable_norm_cos summable_sums)


[STATEMENT]
lemma prime_power_dvd_pderiv:
  fixes f p :: "'a :: field_gcd poly"
  assumes "prime_elem p"
  defines "n \<equiv> multiplicity p f - 1"
  shows   "p ^ n dvd pderiv f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ n dvd pderiv f
[PROOF STEP]
proof (cases "p dvd f \<and> f \<noteq> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p dvd f \<and> f \<noteq> 0

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
hence "multiplicity p f > 0"
[PROOF STATE]
proof (prove)
using this:
p dvd f \<and> f \<noteq> 0

goal (1 subgoal):
 1. 0 < multiplicity p f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p dvd f \<and> f \<noteq> 0
prime_elem p
n \<equiv> multiplicity p f - 1

goal (1 subgoal):
 1. 0 < multiplicity p f
[PROOF STEP]
by (subst prime_multiplicity_gt_zero_iff) auto
[PROOF STATE]
proof (state)
this:
0 < multiplicity p f

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
hence Suc_n: "Suc n = multiplicity p f"
[PROOF STATE]
proof (prove)
using this:
0 < multiplicity p f

goal (1 subgoal):
 1. Suc n = multiplicity p f
[PROOF STEP]
by (simp add: n_def)
[PROOF STATE]
proof (state)
this:
Suc n = multiplicity p f

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
define g where "g = f div p ^ Suc n"
[PROOF STATE]
proof (state)
this:
g = f div p ^ Suc n

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
have "p ^ Suc n dvd f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ Suc n dvd f
[PROOF STEP]
unfolding Suc_n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ multiplicity p f dvd f
[PROOF STEP]
by (rule multiplicity_dvd)
[PROOF STATE]
proof (state)
this:
p ^ Suc n dvd f

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
hence f_eq: "f = p ^ Suc n * g"
[PROOF STATE]
proof (prove)
using this:
p ^ Suc n dvd f

goal (1 subgoal):
 1. f = p ^ Suc n * g
[PROOF STEP]
by (simp add: g_def)
[PROOF STATE]
proof (state)
this:
f = p ^ Suc n * g

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f = p ^ Suc n * g

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
have "pderiv \<dots> = p ^ n * (smult (of_nat (Suc n)) (pderiv p * g) + p * pderiv g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv (p ^ Suc n * g) = p ^ n * (smult (of_nat (Suc n)) (pderiv p * g) + p * pderiv g)
[PROOF STEP]
by (simp only: pderiv_mult pderiv_power_Suc) (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
pderiv (p ^ Suc n * g) = p ^ n * (smult (of_nat (Suc n)) (pderiv p * g) + p * pderiv g)

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pderiv (p ^ Suc n * g) = p ^ n * (smult (of_nat (Suc n)) (pderiv p * g) + p * pderiv g)

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
have "p ^ n dvd \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ n dvd p ^ n * (smult (of_nat (Suc n)) (pderiv p * g) + p * pderiv g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p ^ n dvd p ^ n * (smult (of_nat (Suc n)) (pderiv p * g) + p * pderiv g)

goal (2 subgoals):
 1. p dvd f \<and> f \<noteq> 0 \<Longrightarrow> p ^ n dvd pderiv f
 2. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p ^ n dvd pderiv f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p ^ n dvd pderiv f

goal (1 subgoal):
 1. p ^ n dvd pderiv f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
p ^ n dvd pderiv f

goal (1 subgoal):
 1. \<not> (p dvd f \<and> f \<noteq> 0) \<Longrightarrow> p ^ n dvd pderiv f
[PROOF STEP]
qed (auto simp: n_def not_dvd_imp_multiplicity_0)


[STATEMENT]
lemma ex_unit_disc_fix_mapping_u_to_zero:
  assumes "u \<in> unit_disc"
  shows "\<exists> M. unit_disc_fix M \<and> moebius_pt M u = 0\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>M. unit_disc_fix M \<and> moebius_pt M u = 0\<^sub>h
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>M. unit_disc_fix M \<and> moebius_pt M u = 0\<^sub>h
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
u \<in> unit_disc
[PROOF STEP]
obtain c where *: "u = of_complex c"
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc

goal (1 subgoal):
 1. (\<And>c. u = of_complex c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis inf_notin_unit_disc inf_or_of_complex)
[PROOF STATE]
proof (state)
this:
u = of_complex c

goal (1 subgoal):
 1. \<exists>M. unit_disc_fix M \<and> moebius_pt M u = 0\<^sub>h
[PROOF STEP]
hence "cmod c < 1"
[PROOF STATE]
proof (prove)
using this:
u = of_complex c

goal (1 subgoal):
 1. cmod c < 1
[PROOF STEP]
using assms unit_disc_iff_cmod_lt_1
[PROOF STATE]
proof (prove)
using this:
u = of_complex c
u \<in> unit_disc
(of_complex ?c \<in> unit_disc) = (cmod ?c < 1)

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

goal (1 subgoal):
 1. \<exists>M. unit_disc_fix M \<and> moebius_pt M u = 0\<^sub>h
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod c < 1

goal (1 subgoal):
 1. \<exists>M. unit_disc_fix M \<and> moebius_pt M u = 0\<^sub>h
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
cmod c < 1
u = of_complex c

goal (1 subgoal):
 1. \<exists>M. unit_disc_fix M \<and> moebius_pt M u = 0\<^sub>h
[PROOF STEP]
by (rule_tac x="blaschke c" in exI)
       (smt blaschke_a_to_zero blaschke_ounit_circle_fix' unit_disc_fix_iff_ounit_circle)
[PROOF STATE]
proof (state)
this:
\<exists>M. unit_disc_fix M \<and> moebius_pt M u = 0\<^sub>h

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in complete_boolean_algebra) shunt1: "x \<sqinter> y \<le> z \<longleftrightarrow> x \<le> -y \<squnion> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<sqinter> y \<le> z) = (x \<le> - y \<squnion> z)
[PROOF STEP]
proof standard
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<sqinter> y \<le> z \<Longrightarrow> x \<le> - y \<squnion> z
 2. x \<le> - y \<squnion> z \<Longrightarrow> x \<sqinter> y \<le> z
[PROOF STEP]
assume "x \<sqinter> y \<le> z"
[PROOF STATE]
proof (state)
this:
x \<sqinter> y \<le> z

goal (2 subgoals):
 1. x \<sqinter> y \<le> z \<Longrightarrow> x \<le> - y \<squnion> z
 2. x \<le> - y \<squnion> z \<Longrightarrow> x \<sqinter> y \<le> z
[PROOF STEP]
hence  "-y \<squnion> (x \<sqinter> y) \<le> -y \<squnion> z"
[PROOF STATE]
proof (prove)
using this:
x \<sqinter> y \<le> z

goal (1 subgoal):
 1. - y \<squnion> (x \<sqinter> y) \<le> - y \<squnion> z
[PROOF STEP]
using sup.mono
[PROOF STATE]
proof (prove)
using this:
x \<sqinter> y \<le> z
\<lbrakk>?c \<le> ?a; ?d \<le> ?b\<rbrakk> \<Longrightarrow> ?c \<squnion> ?d \<le> ?a \<squnion> ?b

goal (1 subgoal):
 1. - y \<squnion> (x \<sqinter> y) \<le> - y \<squnion> z
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
- y \<squnion> (x \<sqinter> y) \<le> - y \<squnion> z

goal (2 subgoals):
 1. x \<sqinter> y \<le> z \<Longrightarrow> x \<le> - y \<squnion> z
 2. x \<le> - y \<squnion> z \<Longrightarrow> x \<sqinter> y \<le> z
[PROOF STEP]
hence "-y \<squnion> x \<le> -y \<squnion> z"
[PROOF STATE]
proof (prove)
using this:
- y \<squnion> (x \<sqinter> y) \<le> - y \<squnion> z

goal (1 subgoal):
 1. - y \<squnion> x \<le> - y \<squnion> z
[PROOF STEP]
by (simp add: sup_inf_distrib1)
[PROOF STATE]
proof (state)
this:
- y \<squnion> x \<le> - y \<squnion> z

goal (2 subgoals):
 1. x \<sqinter> y \<le> z \<Longrightarrow> x \<le> - y \<squnion> z
 2. x \<le> - y \<squnion> z \<Longrightarrow> x \<sqinter> y \<le> z
[PROOF STEP]
thus "x \<le> -y \<squnion> z"
[PROOF STATE]
proof (prove)
using this:
- y \<squnion> x \<le> - y \<squnion> z

goal (1 subgoal):
 1. x \<le> - y \<squnion> z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<le> - y \<squnion> z

goal (1 subgoal):
 1. x \<le> - y \<squnion> z \<Longrightarrow> x \<sqinter> y \<le> z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> - y \<squnion> z \<Longrightarrow> x \<sqinter> y \<le> z
[PROOF STEP]
assume "x \<le> - y \<squnion> z"
[PROOF STATE]
proof (state)
this:
x \<le> - y \<squnion> z

goal (1 subgoal):
 1. x \<le> - y \<squnion> z \<Longrightarrow> x \<sqinter> y \<le> z
[PROOF STEP]
hence "x \<sqinter> y \<le> (-y \<squnion> z) \<sqinter> y"
[PROOF STATE]
proof (prove)
using this:
x \<le> - y \<squnion> z

goal (1 subgoal):
 1. x \<sqinter> y \<le> - y \<squnion> z \<sqinter> y
[PROOF STEP]
using inf_mono
[PROOF STATE]
proof (prove)
using this:
x \<le> - y \<squnion> z
\<lbrakk>?a \<le> ?c; ?b \<le> ?d\<rbrakk> \<Longrightarrow> ?a \<sqinter> ?b \<le> ?c \<sqinter> ?d

goal (1 subgoal):
 1. x \<sqinter> y \<le> - y \<squnion> z \<sqinter> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<sqinter> y \<le> - y \<squnion> z \<sqinter> y

goal (1 subgoal):
 1. x \<le> - y \<squnion> z \<Longrightarrow> x \<sqinter> y \<le> z
[PROOF STEP]
thus  "x \<sqinter> y \<le> z"
[PROOF STATE]
proof (prove)
using this:
x \<sqinter> y \<le> - y \<squnion> z \<sqinter> y

goal (1 subgoal):
 1. x \<sqinter> y \<le> z
[PROOF STEP]
using inf.boundedE inf_sup_distrib2
[PROOF STATE]
proof (prove)
using this:
x \<sqinter> y \<le> - y \<squnion> z \<sqinter> y
\<lbrakk>?a \<le> ?b \<sqinter> ?c; \<lbrakk>?a \<le> ?b; ?a \<le> ?c\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
?y \<squnion> ?z \<sqinter> ?x = (?y \<sqinter> ?x) \<squnion> (?z \<sqinter> ?x)

goal (1 subgoal):
 1. x \<sqinter> y \<le> z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<sqinter> y \<le> z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma d_fixpoint:
  "(\<exists>y . x = d(y)) \<longleftrightarrow> x = d(x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>y. x = d y) = (x = d x)
[PROOF STEP]
using d_involutive
[PROOF STATE]
proof (prove)
using this:
d (d ?x) = d ?x

goal (1 subgoal):
 1. (\<exists>y. x = d y) = (x = d x)
[PROOF STEP]
by auto


[STATEMENT]
lemma smult_conv_map_poly: "smult c p = map_poly (\<lambda>x. c * x) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult c p = map_poly ((*) c) p
[PROOF STEP]
by (intro poly_eqI) (simp_all add: coeff_map_poly)


[STATEMENT]
lemma successively_map: "successively P (map f xs) \<longleftrightarrow> successively (\<lambda>x y. P (f x) (f y)) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. successively P (map f xs) = successively (\<lambda>x y. P (f x) (f y)) xs
[PROOF STEP]
by (induction xs rule: induct_list012) auto


[STATEMENT]
lemma ge_iff_diff_ge_0:
  fixes a :: "'a::linordered_ring"
  shows "a \<ge> b \<equiv> a - b \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<le> a \<equiv> (0::'a) \<le> a - b
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma (in linorder) set_iterator_linord_foldli_correct :
assumes dist_xs: "distinct xs"
assumes sorted_xs: "sorted xs"
shows "set_iterator_linord (foldli xs) (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_iterator_linord (foldli xs) (set xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs
sorted xs

goal (1 subgoal):
 1. set_iterator_linord (foldli xs) (set xs)
[PROOF STEP]
by (rule_tac set_iterator_linord_I[of xs]) (simp_all)


[STATEMENT]
lemma det_sgn_congruence [simp]:
  assumes "mat_det M \<noteq> 0"
  shows "sgn (mat_det (congruence M H)) = sgn (mat_det H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (mat_det (congruence M H)) = sgn (mat_det H)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mat_det M \<noteq> 0

goal (1 subgoal):
 1. sgn (mat_det (congruence M H)) = sgn (mat_det H)
[PROOF STEP]
by (subst mat_det_congruence, auto simp add: sgn_mult power2_eq_square) (simp add: sgn_of_real)


[STATEMENT]
lemma The_Max: "Ex1 P \<Longrightarrow> The P = Max {x. P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ex1 P \<Longrightarrow> The P = Max {x. P x}
[PROOF STEP]
apply (rule the_equality)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Ex1 P \<Longrightarrow> P (Max {x. P x})
 2. \<And>x. \<lbrakk>Ex1 P; P x\<rbrakk> \<Longrightarrow> x = Max {x. P x}
[PROOF STEP]
apply (metis (mono_tags) Max.infinite Max_in Max_singleton all_not_in_conv finite_subset insert_iff mem_Collect_eq subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Ex1 P; P x\<rbrakk> \<Longrightarrow> x = Max {x. P x}
[PROOF STEP]
by (metis Max_singleton Min_singleton Nitpick.Ex1_unfold The_Min the_equality)


[STATEMENT]
lemma set_Cons_empty_iff[simp]: "set_Cons A Xs = {} \<longleftrightarrow> A = {} \<or> Xs = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set_Cons A Xs = {}) = (A = {} \<or> Xs = {})
[PROOF STEP]
unfolding set_Cons_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x # xs |x xs. x \<in> A \<and> xs \<in> Xs} = {}) = (A = {} \<or> Xs = {})
[PROOF STEP]
by auto


[STATEMENT]
lemma closed_closure[simp, intro]: "closed (closure S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (closure S)
[PROOF STEP]
by (simp add: closure_interior closed_Compl)


[STATEMENT]
lemma if_then_else_cont[simp]:
  assumes *:"(\<And>x. P x \<Longrightarrow> cont ((f::'c \<Rightarrow> ('a::cpo) \<Rightarrow> 'b process) x))"
  and     **:"(\<And>x. \<not> P x \<Longrightarrow> cont (g x))"
  shows "\<And>x. cont(\<lambda>y. if P x then f x y else g x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. cont (\<lambda>y. if P x then f x y else g x y)
[PROOF STEP]
using * **
[PROOF STATE]
proof (prove)
using this:
P ?x \<Longrightarrow> cont (f ?x)
\<not> P ?x \<Longrightarrow> cont (g ?x)

goal (1 subgoal):
 1. \<And>x. cont (\<lambda>y. if P x then f x y else g x y)
[PROOF STEP]
by (auto simp:cont_def)