[STATEMENT]
lemma reduce_\<delta>_states_rules[simp]:
  "(ta_rules (ta_reduce TA (\<delta>_states (ta_rules TA)))) = ta_rules TA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_rules (ta_reduce TA (\<delta>_states (ta_rules TA))) = ta_rules TA
[PROOF STEP]
by (auto simp add: ta_reduce_def \<delta>_states_def reduce_rules_def)

\<comment> \<open>Reducing a tree automaton to the states that occur in its rules does
      not change its language\<close>


[STATEMENT]
lemma emeasure_eq_AE:
  assumes iff: "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B"
  assumes A: "A \<in> sets M" and B: "B \<in> sets M"
  shows "emeasure M A = emeasure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M A = emeasure M B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
AE x in M. (x \<in> A) = (x \<in> B)
A \<in> sets M
B \<in> sets M

goal (1 subgoal):
 1. emeasure M A = emeasure M B
[PROOF STEP]
by (safe intro!: antisym emeasure_mono_AE) auto


[STATEMENT]
lemma adv_d_keys:
  assumes inv: "\<And>q bs. case Mapping.lookup st (q, bs) of None \<Rightarrow> True | Some v \<Rightarrow> step q bs = v"
  and distinct: "distinct (map fst s)"
  and adv_d: "adv_d step st i bs s = (s', st')"
shows "mmap_keys s' = (\<lambda>q. step q bs) ` (mmap_keys s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mmap_keys s' = (\<lambda>q. step q bs) ` mmap_keys s
[PROOF STEP]
using adv_d_mmap_fold[OF inv adv_d[unfolded adv_d_def]]
    mmap_fold_set[OF distinct]
[PROOF STATE]
proof (prove)
using this:
s' = mmap_fold s (\<lambda>(x, v). (step x bs, drop_cur i v)) (\<lambda>x y. x) [] \<and> (\<forall>q bs. case Mapping.lookup st' (q, bs) of None \<Rightarrow> True | Some v \<Rightarrow> step q bs = v)
set (map fst (mmap_fold s ?f ?c [])) = (fst \<circ> ?f) ` set s

goal (1 subgoal):
 1. mmap_keys s' = (\<lambda>q. step q bs) ` mmap_keys s
[PROOF STEP]
unfolding mmap_keys_def
[PROOF STATE]
proof (prove)
using this:
s' = mmap_fold s (\<lambda>(x, v). (step x bs, drop_cur i v)) (\<lambda>x y. x) [] \<and> (\<forall>q bs. case Mapping.lookup st' (q, bs) of None \<Rightarrow> True | Some v \<Rightarrow> step q bs = v)
set (map fst (mmap_fold s ?f ?c [])) = (fst \<circ> ?f) ` set s

goal (1 subgoal):
 1. set (map fst s') = (\<lambda>q. step q bs) ` set (map fst s)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma iT_Plus_neg_icard_le: "icard (I \<oplus>- k) \<le> icard I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard (I \<oplus>- k) \<le> icard I
[PROOF STEP]
apply (case_tac "finite I")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite I \<Longrightarrow> icard (I \<oplus>- k) \<le> icard I
 2. infinite I \<Longrightarrow> icard (I \<oplus>- k) \<le> icard I
[PROOF STEP]
apply (simp add: iT_Plus_neg_finite_iff icard_finite iT_Plus_neg_card_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite I \<Longrightarrow> icard (I \<oplus>- k) \<le> icard I
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma t1_space_derived_set_of_finite:
   "t1_space X \<longleftrightarrow> (\<forall>S. finite S \<longrightarrow> X derived_set_of S = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t1_space X = (\<forall>S. finite S \<longrightarrow> X derived_set_of S = {})
[PROOF STEP]
proof (intro iffI allI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> X derived_set_of S = {}
 2. \<forall>S. finite S \<longrightarrow> X derived_set_of S = {} \<Longrightarrow> t1_space X
[PROOF STEP]
fix S :: "'a set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> X derived_set_of S = {}
 2. \<forall>S. finite S \<longrightarrow> X derived_set_of S = {} \<Longrightarrow> t1_space X
[PROOF STEP]
assume "finite S"
[PROOF STATE]
proof (state)
this:
finite S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> X derived_set_of S = {}
 2. \<forall>S. finite S \<longrightarrow> X derived_set_of S = {} \<Longrightarrow> t1_space X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
[PROOF STEP]
have fin: "finite ((\<lambda>x. {x}) ` (topspace X \<inter> S))"
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. finite ((\<lambda>x. {x}) ` (topspace X \<inter> S))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>x. {x}) ` (topspace X \<inter> S))

goal (2 subgoals):
 1. \<And>S. \<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> X derived_set_of S = {}
 2. \<forall>S. finite S \<longrightarrow> X derived_set_of S = {} \<Longrightarrow> t1_space X
[PROOF STEP]
assume "t1_space X"
[PROOF STATE]
proof (state)
this:
t1_space X

goal (2 subgoals):
 1. \<And>S. \<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> X derived_set_of S = {}
 2. \<forall>S. finite S \<longrightarrow> X derived_set_of S = {} \<Longrightarrow> t1_space X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t1_space X
[PROOF STEP]
have "X derived_set_of (\<Union>x \<in> topspace X \<inter> S. {x}) = {}"
[PROOF STATE]
proof (prove)
using this:
t1_space X

goal (1 subgoal):
 1. X derived_set_of (\<Union>x\<in>topspace X \<inter> S. {x}) = {}
[PROOF STEP]
unfolding derived_set_of_Union [OF fin]
[PROOF STATE]
proof (prove)
using this:
t1_space X

goal (1 subgoal):
 1. \<Union> ((derived_set_of) X ` (\<lambda>x. {x}) ` (topspace X \<inter> S)) = {}
[PROOF STEP]
by (auto simp: t1_space_derived_set_of_singleton)
[PROOF STATE]
proof (state)
this:
X derived_set_of (\<Union>x\<in>topspace X \<inter> S. {x}) = {}

goal (2 subgoals):
 1. \<And>S. \<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> X derived_set_of S = {}
 2. \<forall>S. finite S \<longrightarrow> X derived_set_of S = {} \<Longrightarrow> t1_space X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X derived_set_of (\<Union>x\<in>topspace X \<inter> S. {x}) = {}
[PROOF STEP]
have "X derived_set_of (topspace X \<inter> S) = {}"
[PROOF STATE]
proof (prove)
using this:
X derived_set_of (\<Union>x\<in>topspace X \<inter> S. {x}) = {}

goal (1 subgoal):
 1. X derived_set_of (topspace X \<inter> S) = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X derived_set_of (topspace X \<inter> S) = {}

goal (2 subgoals):
 1. \<And>S. \<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> X derived_set_of S = {}
 2. \<forall>S. finite S \<longrightarrow> X derived_set_of S = {} \<Longrightarrow> t1_space X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X derived_set_of (topspace X \<inter> S) = {}
[PROOF STEP]
show "X derived_set_of S = {}"
[PROOF STATE]
proof (prove)
using this:
X derived_set_of (topspace X \<inter> S) = {}

goal (1 subgoal):
 1. X derived_set_of S = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X derived_set_of S = {}

goal (1 subgoal):
 1. \<forall>S. finite S \<longrightarrow> X derived_set_of S = {} \<Longrightarrow> t1_space X
[PROOF STEP]
qed (auto simp: t1_space_derived_set_of_singleton)


[STATEMENT]
lemma bivar_fun: "\<lbrakk> f \<in> A \<rightarrow> (B \<rightarrow> C); a \<in> A \<rbrakk> \<Longrightarrow> f a \<in> B \<rightarrow> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B \<rightarrow> C; a \<in> A\<rbrakk> \<Longrightarrow> f a \<in> B \<rightarrow> C
[PROOF STEP]
by (simp add:Pi_def)


[STATEMENT]
lemma signed_list_lconjaction_fst:
  "fst (signed_list_lconjaction ss x) = lconjby (sum_list ss) (fst x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (signed_list_lconjaction ss x) = lconjby (sum_list ss) (fst x)
[PROOF STEP]
using signed_lconjaction_fst lconjby_add
[PROOF STATE]
proof (prove)
using this:
fst (signed_lconjaction ?s ?x) = lconjby ?s (fst ?x)
lconjby (?x + ?y) ?z = lconjby ?x (lconjby ?y ?z)

goal (1 subgoal):
 1. fst (signed_list_lconjaction ss x) = lconjby (sum_list ss) (fst x)
[PROOF STEP]
by (induct ss) auto


[STATEMENT]
lemma in_rel_Collect_case_prod_eq: "in_rel (Collect (case_prod X)) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_rel {(x, y). X x y} = X
[PROOF STEP]
unfolding fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x xa. in_rel {(x, y). X x y} x xa = X x xa
[PROOF STEP]
by auto


[STATEMENT]
lemma field_differentiable_sum [derivative_intros]:
  "(\<And>i. i \<in> I \<Longrightarrow> (f i) field_differentiable F) \<Longrightarrow> (\<lambda>z. \<Sum>i\<in>I. f i z) field_differentiable F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> f i field_differentiable F) \<Longrightarrow> (\<lambda>z. \<Sum>i\<in>I. f i z) field_differentiable F
[PROOF STEP]
by (induct I rule: infinite_finite_induct)
     (auto intro: field_differentiable_add field_differentiable_const)


[STATEMENT]
lemma decisive_on_mono:
  assumes "decisive_on A f"
  assumes "B \<subseteq> A"
  shows "decisive_on B f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. decisive_on B f
[PROOF STEP]
using assms order_trans
[PROOF STATE]
proof (prove)
using this:
decisive_on A f
B \<subseteq> A
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z

goal (1 subgoal):
 1. decisive_on B f
[PROOF STEP]
unfolding decisive_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>B\<subseteq>A. B \<noteq> {} \<longrightarrow> f B \<noteq> {}
B \<subseteq> A
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z

goal (1 subgoal):
 1. \<forall>Ba\<subseteq>B. Ba \<noteq> {} \<longrightarrow> f Ba \<noteq> {}
[PROOF STEP]
by auto


[STATEMENT]
lemma hypnat_diff_commute: "\<And>i j k::hypnat. i - j - k = i - k - j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j k. i - j - k = i - k - j
[PROOF STEP]
by transfer (rule diff_commute)


[STATEMENT]
lemma sets_SUP:
  assumes "\<And>x. x \<in> I \<Longrightarrow> sets (M x) = sets N"
  shows "I \<noteq> {} \<Longrightarrow> sets (SUP i\<in>I. M i) = sets N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> sets (Sup (M ` I)) = sets N
[PROOF STEP]
unfolding Sup_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> sets (Sup_lexord space (Sup_lexord sets Sup_measure' (\<lambda>U. sigma (\<Union> (space ` U)) (\<Union> (sets ` U)))) (\<lambda>U. sigma (\<Union> (space ` U)) {}) (M ` I)) = sets N
[PROOF STEP]
using assms assms[THEN sets_eq_imp_space_eq]
    sets_Sup_measure'[where A=N and M="M`I"]
[PROOF STATE]
proof (prove)
using this:
?x \<in> I \<Longrightarrow> sets (M ?x) = sets N
?x1 \<in> I \<Longrightarrow> space (M ?x1) = space N
\<lbrakk>\<And>m. m \<in> M ` I \<Longrightarrow> sets m = sets N; M ` I \<noteq> {}\<rbrakk> \<Longrightarrow> sets (Sup_measure' (M ` I)) = sets N

goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> sets (Sup_lexord space (Sup_lexord sets Sup_measure' (\<lambda>U. sigma (\<Union> (space ` U)) (\<Union> (sets ` U)))) (\<lambda>U. sigma (\<Union> (space ` U)) {}) (M ` I)) = sets N
[PROOF STEP]
by (intro Sup_lexord1[where P="\<lambda>x. sets x = sets N"]) auto


[STATEMENT]
lemma support_on_simps[simp]:
  "support_on {} f = {}"
  "support_on (insert x S) f =
    (if f x = 0 then support_on S f else insert x (support_on S f))"
  "support_on (S \<union> T) f = support_on S f \<union> support_on T f"
  "support_on (S \<inter> T) f = support_on S f \<inter> support_on T f"
  "support_on (S - T) f = support_on S f - support_on T f"
  "support_on (f ` S) g = f ` (support_on S (g \<circ> f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (support_on {} f = {} &&& support_on (insert x S) f = (if f x = (0::'b) then support_on S f else insert x (support_on S f)) &&& support_on (S \<union> T) f = support_on S f \<union> support_on T f) &&& support_on (S \<inter> T) f = support_on S f \<inter> support_on T f &&& support_on (S - T) f = support_on S f - support_on T f &&& support_on (f ` S) g = f ` support_on S (g \<circ> f)
[PROOF STEP]
unfolding support_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x \<in> {}. f x \<noteq> (0::'b)} = {} &&& {xa \<in> insert x S. f xa \<noteq> (0::'b)} = (if f x = (0::'b) then {x \<in> S. f x \<noteq> (0::'b)} else insert x {x \<in> S. f x \<noteq> (0::'b)}) &&& {x \<in> S \<union> T. f x \<noteq> (0::'b)} = {x \<in> S. f x \<noteq> (0::'b)} \<union> {x \<in> T. f x \<noteq> (0::'b)}) &&& {x \<in> S \<inter> T. f x \<noteq> (0::'b)} = {x \<in> S. f x \<noteq> (0::'b)} \<inter> {x \<in> T. f x \<noteq> (0::'b)} &&& {x \<in> S - T. f x \<noteq> (0::'b)} = {x \<in> S. f x \<noteq> (0::'b)} - {x \<in> T. f x \<noteq> (0::'b)} &&& {x \<in> f ` S. g x \<noteq> (0::'c)} = f ` {x \<in> S. (g \<circ> f) x \<noteq> (0::'c)}
[PROOF STEP]
by auto


[STATEMENT]
theorem multiplicity_diff_pow:
  assumes "p > 2" and "x \<noteq> y" and "n > 0"
  shows "multiplicity p (x^n - y^n) = multiplicity p (x - y) + multiplicity p n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y) + multiplicity p n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y) + multiplicity p n
[PROOF STEP]
obtain k where n: "n = p^multiplicity p n * k" and "\<not> p dvd k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>n = p ^ multiplicity p n * k; \<not> p dvd k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>n > 0\<close> \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>n = p ^ multiplicity p n * k; \<not> p dvd k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis neq0_conv not_prime_unit multiplicity_decompose')
[PROOF STATE]
proof (state)
this:
n = p ^ multiplicity p n * k
\<not> p dvd k

goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y) + multiplicity p n
[PROOF STEP]
have "multiplicity p (x^(p^a * k) - y^(p^a * k)) = multiplicity p (x - y) + a" for a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a
[PROOF STEP]
proof (induction a)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. multiplicity (int p) (x ^ (p ^ 0 * k) - y ^ (p ^ 0 * k)) = multiplicity (int p) (x - y) + 0
 2. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. multiplicity (int p) (x ^ (p ^ 0 * k) - y ^ (p ^ 0 * k)) = multiplicity (int p) (x - y) + 0
 2. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
from \<open>\<not> p dvd k\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> p dvd k
[PROOF STEP]
have "coprime p k"
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd k

goal (1 subgoal):
 1. coprime p k
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd k
prime p

goal (1 subgoal):
 1. coprime p k
[PROOF STEP]
by (intro prime_imp_coprime)
[PROOF STATE]
proof (state)
this:
coprime p k

goal (2 subgoals):
 1. multiplicity (int p) (x ^ (p ^ 0 * k) - y ^ (p ^ 0 * k)) = multiplicity (int p) (x - y) + 0
 2. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
coprime p k

goal (1 subgoal):
 1. multiplicity (int p) (x ^ (p ^ 0 * k) - y ^ (p ^ 0 * k)) = multiplicity (int p) (x - y) + 0
[PROOF STEP]
by (simp add: multiplicity_diff_pow_coprime)
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (x ^ (p ^ 0 * k) - y ^ (p ^ 0 * k)) = multiplicity (int p) (x - y) + 0

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
case (Suc a)
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
let ?x' = "x^(p^a*k)" and ?y' = "y^(p^a*k)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
have "\<not> p dvd ?x'" and "\<not> p dvd ?y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> int p dvd x ^ (p ^ a * k) &&& \<not> int p dvd y ^ (p ^ a * k)
[PROOF STEP]
using \<open>\<not> p dvd x\<close>  \<open>\<not> p dvd y\<close> and \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> int p dvd x
\<not> int p dvd y
prime p

goal (1 subgoal):
 1. \<not> int p dvd x ^ (p ^ a * k) &&& \<not> int p dvd y ^ (p ^ a * k)
[PROOF STEP]
by (meson prime_dvd_power prime_nat_int_transfer)+
[PROOF STATE]
proof (state)
this:
\<not> int p dvd x ^ (p ^ a * k)
\<not> int p dvd y ^ (p ^ a * k)

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> int p dvd x ^ (p ^ a * k)
\<not> int p dvd y ^ (p ^ a * k)

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
have "p dvd ?x' - ?y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int p dvd x ^ (p ^ a * k) - y ^ (p ^ a * k)
[PROOF STEP]
using \<open>p dvd x - y\<close>
[PROOF STATE]
proof (prove)
using this:
int p dvd x - y

goal (1 subgoal):
 1. int p dvd x ^ (p ^ a * k) - y ^ (p ^ a * k)
[PROOF STEP]
by (simp add: power_diff_sumr2)
[PROOF STATE]
proof (state)
this:
int p dvd x ^ (p ^ a * k) - y ^ (p ^ a * k)

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
int p dvd x ^ (p ^ a * k) - y ^ (p ^ a * k)

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
have "?x' \<noteq> ?y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ (p ^ a * k) \<noteq> y ^ (p ^ a * k)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
assume "?x' = ?y'"
[PROOF STATE]
proof (state)
this:
x ^ (p ^ a * k) = y ^ (p ^ a * k)

goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x ^ (p ^ a * k) = y ^ (p ^ a * k)

goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
have "0 < p^a * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p ^ a * k
[PROOF STEP]
using \<open>prime p\<close> \<open>n > 0\<close> n
[PROOF STATE]
proof (prove)
using this:
prime p
0 < n
n = p ^ multiplicity p n * k

goal (1 subgoal):
 1. 0 < p ^ a * k
[PROOF STEP]
by (metis gr0I mult_is_0 power_not_zero prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
0 < p ^ a * k

goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x ^ (p ^ a * k) = y ^ (p ^ a * k)
0 < p ^ a * k
[PROOF STEP]
have "\<bar>x\<bar> = \<bar>y\<bar>"
[PROOF STATE]
proof (prove)
using this:
x ^ (p ^ a * k) = y ^ (p ^ a * k)
0 < p ^ a * k

goal (1 subgoal):
 1. \<bar>x\<bar> = \<bar>y\<bar>
[PROOF STEP]
by (intro power_eq_abs)
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> = \<bar>y\<bar>

goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
with \<open>x \<noteq> y\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
\<bar>x\<bar> = \<bar>y\<bar>
[PROOF STEP]
have "x = -y"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
\<bar>x\<bar> = \<bar>y\<bar>

goal (1 subgoal):
 1. x = - y
[PROOF STEP]
using abs_eq_iff
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
\<bar>x\<bar> = \<bar>y\<bar>
(\<bar>?x\<bar> = \<bar>?y\<bar>) = (?x = ?y \<or> ?x = - ?y)

goal (1 subgoal):
 1. x = - y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = - y

goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
with \<open>p dvd x - y\<close>
[PROOF STATE]
proof (chain)
picking this:
int p dvd x - y
x = - y
[PROOF STEP]
have "p dvd 2*x"
[PROOF STATE]
proof (prove)
using this:
int p dvd x - y
x = - y

goal (1 subgoal):
 1. int p dvd 2 * x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int p dvd 2 * x

goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
with \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
int p dvd 2 * x
[PROOF STEP]
have "p dvd 2 \<or> p dvd x"
[PROOF STATE]
proof (prove)
using this:
prime p
int p dvd 2 * x

goal (1 subgoal):
 1. p dvd 2 \<or> int p dvd x
[PROOF STEP]
by (metis int_dvd_int_iff of_nat_numeral prime_dvd_mult_iff prime_nat_int_transfer)
[PROOF STATE]
proof (state)
this:
p dvd 2 \<or> int p dvd x

goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
with \<open>p > 2\<close>
[PROOF STATE]
proof (chain)
picking this:
2 < p
p dvd 2 \<or> int p dvd x
[PROOF STEP]
have "p dvd x"
[PROOF STATE]
proof (prove)
using this:
2 < p
p dvd 2 \<or> int p dvd x

goal (1 subgoal):
 1. int p dvd x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int p dvd x

goal (1 subgoal):
 1. x ^ (p ^ a * k) = y ^ (p ^ a * k) \<Longrightarrow> False
[PROOF STEP]
with \<open>\<not> p dvd x\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> int p dvd x
int p dvd x
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> int p dvd x
int p dvd x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x ^ (p ^ a * k) \<noteq> y ^ (p ^ a * k)

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x ^ (p ^ a * k) \<noteq> y ^ (p ^ a * k)

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
have "p^Suc a * k = p^a * k * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ Suc a * k = p ^ a * k * p
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
p ^ Suc a * k = p ^ a * k * p

goal (1 subgoal):
 1. \<And>a. multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a \<Longrightarrow> multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> int p dvd x ^ (p ^ a * k)
\<not> int p dvd y ^ (p ^ a * k)
int p dvd x ^ (p ^ a * k) - y ^ (p ^ a * k)
x ^ (p ^ a * k) \<noteq> y ^ (p ^ a * k)
p ^ Suc a * k = p ^ a * k * p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<not> int p dvd x ^ (p ^ a * k)
\<not> int p dvd y ^ (p ^ a * k)
int p dvd x ^ (p ^ a * k) - y ^ (p ^ a * k)
x ^ (p ^ a * k) \<noteq> y ^ (p ^ a * k)
p ^ Suc a * k = p ^ a * k * p

goal (1 subgoal):
 1. multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
using LTE.multiplicity_diff_self_pow[where x="?x'" and y="?y'", OF \<open>prime p\<close>] \<open>p > 2\<close>
        and Suc.IH
[PROOF STATE]
proof (prove)
using this:
\<not> int p dvd x ^ (p ^ a * k)
\<not> int p dvd y ^ (p ^ a * k)
int p dvd x ^ (p ^ a * k) - y ^ (p ^ a * k)
x ^ (p ^ a * k) \<noteq> y ^ (p ^ a * k)
p ^ Suc a * k = p ^ a * k * p
\<lbrakk>int p dvd x ^ (p ^ a * k) - y ^ (p ^ a * k); \<not> int p dvd x ^ (p ^ a * k); \<not> int p dvd y ^ (p ^ a * k); 2 < p; x ^ (p ^ a * k) \<noteq> y ^ (p ^ a * k)\<rbrakk> \<Longrightarrow> multiplicity (int p) ((x ^ (p ^ a * k)) ^ p - (y ^ (p ^ a * k)) ^ p) = Suc (multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)))
2 < p
multiplicity (int p) (x ^ (p ^ a * k) - y ^ (p ^ a * k)) = multiplicity (int p) (x - y) + a

goal (1 subgoal):
 1. multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a
[PROOF STEP]
by (metis add_Suc_right power_mult)
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (x ^ (p ^ Suc a * k) - y ^ (p ^ Suc a * k)) = multiplicity (int p) (x - y) + Suc a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (x ^ (p ^ ?a * k) - y ^ (p ^ ?a * k)) = multiplicity (int p) (x - y) + ?a

goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y) + multiplicity p n
[PROOF STEP]
with n
[PROOF STATE]
proof (chain)
picking this:
n = p ^ multiplicity p n * k
multiplicity (int p) (x ^ (p ^ ?a * k) - y ^ (p ^ ?a * k)) = multiplicity (int p) (x - y) + ?a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = p ^ multiplicity p n * k
multiplicity (int p) (x ^ (p ^ ?a * k) - y ^ (p ^ ?a * k)) = multiplicity (int p) (x - y) + ?a

goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y) + multiplicity p n
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y) + multiplicity p n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma c1_euclidean_blinfunE:
  fixes f::"'a::euclidean_space\<Rightarrow>'b::real_normed_vector"
  assumes "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f' x) (at x within S)"
  assumes "\<And>i. i \<in> Basis \<Longrightarrow> continuous_on S (\<lambda>x. f' x i)"
  obtains bf' where
    "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S)"
    "continuous_on S bf'"
    "\<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> (f has_derivative f' ?x) (at ?x within S)
?i \<in> Basis \<Longrightarrow> continuous_on S (\<lambda>x. f' x ?i)
[PROOF STEP]
have "bounded_linear (f' x)" if "x \<in> S" for x
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> (f has_derivative f' ?x) (at ?x within S)
?i \<in> Basis \<Longrightarrow> continuous_on S (\<lambda>x. f' x ?i)

goal (1 subgoal):
 1. bounded_linear (f' x)
[PROOF STEP]
by (auto intro!: has_derivative_bounded_linear that)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> bounded_linear (f' ?x)

goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> bounded_linear (f' ?x)
[PROOF STEP]
obtain bf' where bf': "\<forall>x \<in> S. f' x = blinfun_apply (bf' x)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> bounded_linear (f' ?x)

goal (1 subgoal):
 1. (\<And>bf'. \<forall>x\<in>S. f' x = blinfun_apply (bf' x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
apply atomize_elim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> S \<Longrightarrow> bounded_linear (f' x)) \<Longrightarrow> \<exists>bf'. \<forall>x\<in>S. f' x = blinfun_apply (bf' x)
[PROOF STEP]
apply (rule bchoice)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> S \<Longrightarrow> bounded_linear (f' x)) \<Longrightarrow> \<forall>x\<in>S. \<exists>y. f' x = blinfun_apply y
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> bounded_linear (f' x); x \<in> S\<rbrakk> \<Longrightarrow> \<exists>y. f' x = blinfun_apply y
[PROOF STEP]
by (metis bounded_linear_Blinfun_apply)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. f' x = blinfun_apply (bf' x)

goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> (f has_derivative f' ?x) (at ?x within S)
?i \<in> Basis \<Longrightarrow> continuous_on S (\<lambda>x. f' x ?i)
\<forall>x\<in>S. f' x = blinfun_apply (bf' x)
[PROOF STEP]
have "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> (f has_derivative f' ?x) (at ?x within S)
?i \<in> Basis \<Longrightarrow> continuous_on S (\<lambda>x. f' x ?i)
\<forall>x\<in>S. f' x = blinfun_apply (bf' x)

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' ?x)) (at ?x within S)

goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' ?x)) (at ?x within S)

goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have f_tendsto: "((\<lambda>n. f' n j) \<longlongrightarrow> f' x j) (at x within S)"
    if "x \<in> S" "j \<in> Basis"
    for x j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. f' n j) \<longlongrightarrow> f' x j) (at x within S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> (f has_derivative f' ?x) (at ?x within S)
?i \<in> Basis \<Longrightarrow> continuous_on S (\<lambda>x. f' x ?i)

goal (1 subgoal):
 1. ((\<lambda>n. f' n j) \<longlongrightarrow> f' x j) (at x within S)
[PROOF STEP]
by (auto simp: continuous_on_def that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> S; ?j \<in> Basis\<rbrakk> \<Longrightarrow> ((\<lambda>n. f' n ?j) \<longlongrightarrow> f' ?x ?j) (at ?x within S)

goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "continuous_on S bf'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S bf'
[PROOF STEP]
by (rule continuous_on_blinfunI1) (simp add: bf'[rule_format, symmetric] assms)
[PROOF STATE]
proof (state)
this:
continuous_on S bf'

goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on S bf'

goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x
[PROOF STEP]
using bf'
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. f' x = blinfun_apply (bf' x)

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> blinfun_apply (bf' ?x) = f' ?x

goal (1 subgoal):
 1. (\<And>bf'. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' x)) (at x within S); continuous_on S bf'; \<And>x. x \<in> S \<Longrightarrow> blinfun_apply (bf' x) = f' x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' ?x)) (at ?x within S)
continuous_on S bf'
?x \<in> S \<Longrightarrow> blinfun_apply (bf' ?x) = f' ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> (f has_derivative blinfun_apply (bf' ?x)) (at ?x within S)
continuous_on S bf'
?x \<in> S \<Longrightarrow> blinfun_apply (bf' ?x) = f' ?x

goal (1 subgoal):
 1. thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma basis_in_latticeI:
  assumes fs: "set fs \<subseteq> carrier_vec n" and "f \<in> set fs"
  shows "f \<in> lattice_of fs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> lattice_of fs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<in> lattice_of fs
[PROOF STEP]
define c :: "'a vec \<Rightarrow> int" where "c v = (if v = f then 1 else 0)" for v
[PROOF STATE]
proof (state)
this:
c ?v = (if ?v = f then 1 else 0)

goal (1 subgoal):
 1. f \<in> lattice_of fs
[PROOF STEP]
have "f = (\<Oplus>\<^bsub>V\<^esub>v\<in>{f}. of_int (c v) \<cdot>\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = (\<Oplus>\<^bsub>V\<^esub>v\<in>{f}. of_int (c v) \<cdot>\<^sub>v v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set fs \<subseteq> carrier_vec n
f \<in> set fs

goal (1 subgoal):
 1. f = (\<Oplus>\<^bsub>V\<^esub>v\<in>{f}. of_int (c v) \<cdot>\<^sub>v v)
[PROOF STEP]
by (auto simp add: c_def)
[PROOF STATE]
proof (state)
this:
f = (\<Oplus>\<^bsub>V\<^esub>v\<in>{f}. of_int (c v) \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. f \<in> lattice_of fs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f = (\<Oplus>\<^bsub>V\<^esub>v\<in>{f}. of_int (c v) \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. f \<in> lattice_of fs
[PROOF STEP]
have "\<dots> = (\<Oplus>\<^bsub>V\<^esub>v\<in>set fs. of_int (c v) \<cdot>\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>\<^bsub>V\<^esub>v\<in>{f}. of_int (c v) \<cdot>\<^sub>v v) = (\<Oplus>\<^bsub>V\<^esub>v\<in>set fs. of_int (c v) \<cdot>\<^sub>v v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set fs \<subseteq> carrier_vec n
f \<in> set fs

goal (1 subgoal):
 1. (\<Oplus>\<^bsub>V\<^esub>v\<in>{f}. of_int (c v) \<cdot>\<^sub>v v) = (\<Oplus>\<^bsub>V\<^esub>v\<in>set fs. of_int (c v) \<cdot>\<^sub>v v)
[PROOF STEP]
by (intro add.finprod_mono_neutral_cong_left) (auto simp add: c_def)
[PROOF STATE]
proof (state)
this:
(\<Oplus>\<^bsub>V\<^esub>v\<in>{f}. of_int (c v) \<cdot>\<^sub>v v) = (\<Oplus>\<^bsub>V\<^esub>v\<in>set fs. of_int (c v) \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. f \<in> lattice_of fs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f = (\<Oplus>\<^bsub>V\<^esub>v\<in>set fs. of_int (c v) \<cdot>\<^sub>v v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f = (\<Oplus>\<^bsub>V\<^esub>v\<in>set fs. of_int (c v) \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. f \<in> lattice_of fs
[PROOF STEP]
using assms lattice_of_altdef
[PROOF STATE]
proof (prove)
using this:
f = (\<Oplus>\<^bsub>V\<^esub>v\<in>set fs. of_int (c v) \<cdot>\<^sub>v v)
set fs \<subseteq> carrier_vec n
f \<in> set fs
set ?vs \<subseteq> carrier_vec n \<Longrightarrow> lattice_of ?vs = range (\<lambda>c. \<Oplus>\<^bsub>V\<^esub>v\<in>set ?vs. of_int (c v) \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. f \<in> lattice_of fs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f \<in> lattice_of fs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldli_disjoint_aux:
    "foldli l1 (\<lambda>x. x) (\<lambda>x _. \<not>x\<in>s2) b \<longleftrightarrow> b \<and> op_set_disjoint (set l1) s2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldli l1 (\<lambda>x. x) (\<lambda>x _. x \<notin> s2) b = (b \<and> op_set_disjoint (set l1) s2)
[PROOF STEP]
by (induct l1 arbitrary: b) auto


[STATEMENT]
lemma sum_in_Rats [intro]: "(\<And>x. x \<in> A \<Longrightarrow> f x \<in> \<rat>) \<Longrightarrow> sum f A \<in> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x \<in> \<rat>) \<Longrightarrow> sum f A \<in> \<rat>
[PROOF STEP]
by (induction A rule: infinite_finite_induct) auto


[STATEMENT]
lemma of_bl_rev_eq:
  \<open>of_bl (rev bs) = horner_sum of_bool 2 bs\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_bl (rev bs) = horner_sum of_bool 2 bs
[PROOF STEP]
apply (rule bit_word_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. n < LENGTH('a) \<Longrightarrow> bit (of_bl (rev bs)) n = bit (horner_sum of_bool 2 bs) n
[PROOF STEP]
apply (simp add: bit_of_bl_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. n < LENGTH('a) \<Longrightarrow> (bs ! n \<and> n < length bs) = bit (horner_sum of_bool 2 bs) n
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n bs. n < LENGTH('a) \<Longrightarrow> (bs ! n \<and> n < length bs) = (n < LENGTH('a) \<and> bit (horner_sum of_bool 2 bs) n)
[PROOF STEP]
apply (simp add: bit_horner_sum_bit_iff ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma qc_imp_qc_trancl:
  assumes "quasi_commute r s" shows "quasi_commute r (s\<^sup>+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quasi_commute r (s\<^sup>+)
[PROOF STEP]
unfolding quasi_commute_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s\<^sup>+ O r \<subseteq> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
proof (rule subrelI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> s\<^sup>+ O r \<Longrightarrow> (x, y) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
fix x z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> s\<^sup>+ O r \<Longrightarrow> (x, y) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
assume "(x, z) \<in> s\<^sup>+ O r"
[PROOF STATE]
proof (state)
this:
(x, z) \<in> s\<^sup>+ O r

goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> s\<^sup>+ O r \<Longrightarrow> (x, y) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, z) \<in> s\<^sup>+ O r
[PROOF STEP]
obtain y where "(x, y) \<in> s\<^sup>+" and "(y, z) \<in> r"
[PROOF STATE]
proof (prove)
using this:
(x, z) \<in> s\<^sup>+ O r

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by best
[PROOF STATE]
proof (state)
this:
(x, y) \<in> s\<^sup>+
(y, z) \<in> r

goal (1 subgoal):
 1. \<And>x y. (x, y) \<in> s\<^sup>+ O r \<Longrightarrow> (x, y) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<in> s\<^sup>+
(y, z) \<in> r
[PROOF STEP]
show "(x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> s\<^sup>+
(y, z) \<in> r

goal (1 subgoal):
 1. (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
proof (induct arbitrary: z)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>y z. \<lbrakk>(x, y) \<in> s; (y, z) \<in> r\<rbrakk> \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
 2. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
case (base y)
[PROOF STATE]
proof (state)
this:
(x, y) \<in> s
(y, z) \<in> r

goal (2 subgoals):
 1. \<And>y z. \<lbrakk>(x, y) \<in> s; (y, z) \<in> r\<rbrakk> \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
 2. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<in> s
(y, z) \<in> r
[PROOF STEP]
have "(x, z) \<in> (s O r)"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> s
(y, z) \<in> r

goal (1 subgoal):
 1. (x, z) \<in> s O r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, z) \<in> s O r

goal (2 subgoals):
 1. \<And>y z. \<lbrakk>(x, y) \<in> s; (y, z) \<in> r\<rbrakk> \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
 2. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
quasi_commute r s
(x, z) \<in> s O r
[PROOF STEP]
have "(x, z) \<in> r O (r \<union> s)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
quasi_commute r s
(x, z) \<in> s O r

goal (1 subgoal):
 1. (x, z) \<in> r O (r \<union> s)\<^sup>*
[PROOF STEP]
unfolding quasi_commute_def
[PROOF STATE]
proof (prove)
using this:
s O r \<subseteq> r O (r \<union> s)\<^sup>*
(x, z) \<in> s O r

goal (1 subgoal):
 1. (x, z) \<in> r O (r \<union> s)\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, z) \<in> r O (r \<union> s)\<^sup>*

goal (2 subgoals):
 1. \<And>y z. \<lbrakk>(x, y) \<in> s; (y, z) \<in> r\<rbrakk> \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
 2. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, z) \<in> r O (r \<union> s)\<^sup>*
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(x, z) \<in> r O (r \<union> s)\<^sup>*

goal (1 subgoal):
 1. (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
using rtrancl_union_subset_rtrancl_union_trancl
[PROOF STATE]
proof (prove)
using this:
(x, z) \<in> r O (r \<union> s)\<^sup>*
(?r \<union> ?s\<^sup>+)\<^sup>* = (?r \<union> ?s)\<^sup>*

goal (1 subgoal):
 1. (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
case (step a b)
[PROOF STATE]
proof (state)
this:
(x, a) \<in> s\<^sup>+
(a, b) \<in> s
(a, ?z) \<in> r \<Longrightarrow> (x, ?z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
(b, z) \<in> r

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, a) \<in> s\<^sup>+
(a, b) \<in> s
(a, ?z) \<in> r \<Longrightarrow> (x, ?z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
(b, z) \<in> r
[PROOF STEP]
have "(a, z) \<in> (s O r)"
[PROOF STATE]
proof (prove)
using this:
(x, a) \<in> s\<^sup>+
(a, b) \<in> s
(a, ?z) \<in> r \<Longrightarrow> (x, ?z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
(b, z) \<in> r

goal (1 subgoal):
 1. (a, z) \<in> s O r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a, z) \<in> s O r

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
quasi_commute r s
(a, z) \<in> s O r
[PROOF STEP]
have "(a, z) \<in> r O (r \<union> s)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
quasi_commute r s
(a, z) \<in> s O r

goal (1 subgoal):
 1. (a, z) \<in> r O (r \<union> s)\<^sup>*
[PROOF STEP]
unfolding quasi_commute_def
[PROOF STATE]
proof (prove)
using this:
s O r \<subseteq> r O (r \<union> s)\<^sup>*
(a, z) \<in> s O r

goal (1 subgoal):
 1. (a, z) \<in> r O (r \<union> s)\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a, z) \<in> r O (r \<union> s)\<^sup>*

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a, z) \<in> r O (r \<union> s)\<^sup>*
[PROOF STEP]
obtain u where "(a, u) \<in> r" and "(u, z) \<in> (r \<union> s)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(a, z) \<in> r O (r \<union> s)\<^sup>*

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>(a, u) \<in> r; (u, z) \<in> (r \<union> s)\<^sup>*\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by best
[PROOF STATE]
proof (state)
this:
(a, u) \<in> r
(u, z) \<in> (r \<union> s)\<^sup>*

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a, u) \<in> r
(u, z) \<in> (r \<union> s)\<^sup>*
[PROOF STEP]
have "(u, z) \<in> (r \<union> s\<^sup>+)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(a, u) \<in> r
(u, z) \<in> (r \<union> s)\<^sup>*

goal (1 subgoal):
 1. (u, z) \<in> (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
using rtrancl_union_subset_rtrancl_union_trancl
[PROOF STATE]
proof (prove)
using this:
(a, u) \<in> r
(u, z) \<in> (r \<union> s)\<^sup>*
(?r \<union> ?s\<^sup>+)\<^sup>* = (?r \<union> ?s)\<^sup>*

goal (1 subgoal):
 1. (u, z) \<in> (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(u, z) \<in> (r \<union> s\<^sup>+)\<^sup>*

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
from \<open>(a, u) \<in> r\<close> and step
[PROOF STATE]
proof (chain)
picking this:
(a, u) \<in> r
(x, a) \<in> s\<^sup>+
(a, b) \<in> s
(a, ?z) \<in> r \<Longrightarrow> (x, ?z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
(b, z) \<in> r
[PROOF STEP]
have "(x, u) \<in> r O (r \<union> s\<^sup>+)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(a, u) \<in> r
(x, a) \<in> s\<^sup>+
(a, b) \<in> s
(a, ?z) \<in> r \<Longrightarrow> (x, ?z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
(b, z) \<in> r

goal (1 subgoal):
 1. (x, u) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, u) \<in> r O (r \<union> s\<^sup>+)\<^sup>*

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, u) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
obtain v where "(x, v) \<in> r" and "(v, u) \<in> (r \<union> s\<^sup>+)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(x, u) \<in> r O (r \<union> s\<^sup>+)\<^sup>*

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>(x, v) \<in> r; (v, u) \<in> (r \<union> s\<^sup>+)\<^sup>*\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by best
[PROOF STATE]
proof (state)
this:
(x, v) \<in> r
(v, u) \<in> (r \<union> s\<^sup>+)\<^sup>*

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
with \<open>(u, z) \<in> (r \<union> s\<^sup>+)\<^sup>*\<close>
[PROOF STATE]
proof (chain)
picking this:
(u, z) \<in> (r \<union> s\<^sup>+)\<^sup>*
(x, v) \<in> r
(v, u) \<in> (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
have "(v, z) \<in> (r \<union> s\<^sup>+)\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(u, z) \<in> (r \<union> s\<^sup>+)\<^sup>*
(x, v) \<in> r
(v, u) \<in> (r \<union> s\<^sup>+)\<^sup>*

goal (1 subgoal):
 1. (v, z) \<in> (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(v, z) \<in> (r \<union> s\<^sup>+)\<^sup>*

goal (1 subgoal):
 1. \<And>y z za. \<lbrakk>(x, y) \<in> s\<^sup>+; (y, z) \<in> s; \<And>z. (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*; (z, za) \<in> r\<rbrakk> \<Longrightarrow> (x, za) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
with \<open>(x, v) \<in> r\<close>
[PROOF STATE]
proof (chain)
picking this:
(x, v) \<in> r
(v, z) \<in> (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(x, v) \<in> r
(v, z) \<in> (r \<union> s\<^sup>+)\<^sup>*

goal (1 subgoal):
 1. (x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(x, z) \<in> r O (r \<union> s\<^sup>+)\<^sup>*

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_polychain_segments_of_aform:
  assumes "1 < length (half_segments_of_aform X)"
  shows "convex_polychain (segments_of_aform X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_polychain (segments_of_aform X)
[PROOF STEP]
unfolding segments_of_aform_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_polychain (half_segments_of_aform X @ map (pairself (mirror_point (fst X))) (half_segments_of_aform X))
[PROOF STEP]
using ccw_hd_last_half_segments_dirvec[OF assms]
[PROOF STATE]
proof (prove)
using this:
ccw' 0 (dirvec (hd (half_segments_of_aform X))) (dirvec (last (half_segments_of_aform X)))

goal (1 subgoal):
 1. convex_polychain (half_segments_of_aform X @ map (pairself (mirror_point (fst X))) (half_segments_of_aform X))
[PROOF STEP]
by (intro convex_polychain_appendI)
    (auto
      simp: convex_polychain_half_segments_of_aform convex_polychain_map_mirror dirvec_minus hd_map
        pairself_apply last_half_segments mirror_point_def fst_hd_half_segments_of_aform det3_def'
        algebra_simps ccw'_def
      intro!: polychain_appendI polychain_half_segments_of_aform polychain_map_pairself)


[STATEMENT]
lemma fst_snd_Gauss_Jordan_column_k_det_P_le_nrows:
assumes i: "i\<le>nrows A"
shows "fst (snd (Gauss_Jordan_column_k_det_P (n, i, A) k)) \<le> nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (snd (Gauss_Jordan_column_k_det_P (n, i, A) k)) \<le> nrows A
[PROOF STEP]
unfolding fst_snd_Gauss_Jordan_column_k_det_P_eq_fst_snd_Gauss_Jordan_column_k_PA[unfolded fst_snd_Gauss_Jordan_column_k_PA_eq]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k (i, A) k) \<le> nrows A
[PROOF STEP]
by (rule fst_Gauss_Jordan_column_k[OF i])


[STATEMENT]
lemma zexplode_zimplode: "zexplode (zimplode A) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zexplode (zimplode A) = A
[PROOF STEP]
apply (simp add: zimplode_def zexplode_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_zet (explode (implode (Rep_zet A))) = A
[PROOF STEP]
apply (simp add: implode_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_zet (explode (inv explode (Rep_zet A))) = A
[PROOF STEP]
apply (subst f_inv_into_f[where y="Rep_zet A"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Rep_zet A \<in> range explode
 2. Abs_zet (Rep_zet A) = A
[PROOF STEP]
apply (auto simp add: Rep_zet_inverse Rep_zet_eq_explode image_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma connectedin_path_image: "pathin X g \<Longrightarrow> connectedin X (g ` ({0..1}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pathin X g \<Longrightarrow> connectedin X (g ` {0..1})
[PROOF STEP]
by (simp add: path_connectedin_imp_connectedin path_connectedin_path_image)


[STATEMENT]
lemma ennsqrt_mono2 [mono_intros]:
  assumes "x \<le> y"
  shows "ennsqrt x \<le> ennsqrt y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennsqrt x \<le> ennsqrt y
[PROOF STEP]
using ennsqrt_mono assms
[PROOF STATE]
proof (prove)
using this:
mono ennsqrt
x \<le> y

goal (1 subgoal):
 1. ennsqrt x \<le> ennsqrt y
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<le> y \<longrightarrow> ennsqrt x \<le> ennsqrt y
x \<le> y

goal (1 subgoal):
 1. ennsqrt x \<le> ennsqrt y
[PROOF STEP]
by auto


[STATEMENT]
lemma sums_iff: "f sums x \<longleftrightarrow> summable f \<and> suminf f = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f sums x = (summable f \<and> suminf f = x)
[PROOF STEP]
by (metis summable_sums sums_summable sums_unique)


[STATEMENT]
lemma ln_Gamma_real_LIMSEQ: "(x::real) > 0 \<Longrightarrow> ln_Gamma_series x \<longlonglongrightarrow> ln_Gamma x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> ln_Gamma_series x \<longlonglongrightarrow> ln_Gamma x
[PROOF STEP]
using ln_Gamma_real_converges[of x]
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> convergent (ln_Gamma_series x)

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> ln_Gamma_series x \<longlonglongrightarrow> ln_Gamma x
[PROOF STEP]
unfolding ln_Gamma_def
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> convergent (ln_Gamma_series x)

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> ln_Gamma_series x \<longlonglongrightarrow> lim (ln_Gamma_series x)
[PROOF STEP]
by (simp add: convergent_LIMSEQ_iff)


[STATEMENT]
lemma (in comm_monoid) finprod_all1[simp]:
  assumes all1:" \<And>a. a\<in>A\<Longrightarrow>f a = \<one>\<^bsub>G\<^esub>"
  shows "(\<Otimes>\<^bsub>G\<^esub> a\<in>A. f a) = \<one>\<^bsub>G\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f A = \<one>
[PROOF STEP]
(*  "[| \<And>a. a\<in>A\<Longrightarrow>f a = \<one>\<^bsub>G\<^esub> |] ==> (\<Otimes>\<^bsub>G\<^esub> a\<in>A. f a) = \<one>\<^bsub>G\<^esub>" won't work with proof - *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f A = \<one>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finprod G f A = \<one>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
?a \<in> A \<Longrightarrow> f ?a = \<one>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?a \<in> A \<Longrightarrow> f ?a = \<one>

goal (1 subgoal):
 1. finprod G f A = \<one>
[PROOF STEP]
by (simp cong: finprod_cong)
[PROOF STATE]
proof (state)
this:
finprod G f A = \<one>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wary_subst_ground_heads:
  assumes wary_\<rho>: "wary_subst \<rho>"
  shows "ground_heads (head (subst \<rho> s)) \<subseteq> ground_heads (head s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.ground_heads (head (subst \<rho> s)) \<subseteq> local.ground_heads (head s)
[PROOF STEP]
proof (induct s rule: tm_induct_apps)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<zeta> ss. (\<And>s. s \<in> set ss \<Longrightarrow> local.ground_heads (head (subst \<rho> s)) \<subseteq> local.ground_heads (head s)) \<Longrightarrow> local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
[PROOF STEP]
case (apps \<zeta> ss)
[PROOF STATE]
proof (state)
this:
?s \<in> set ss \<Longrightarrow> local.ground_heads (head (subst \<rho> ?s)) \<subseteq> local.ground_heads (head ?s)

goal (1 subgoal):
 1. \<And>\<zeta> ss. (\<And>s. s \<in> set ss \<Longrightarrow> local.ground_heads (head (subst \<rho> s)) \<subseteq> local.ground_heads (head s)) \<Longrightarrow> local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
[PROOF STEP]
proof (cases \<zeta>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x1. \<zeta> = Var x1 \<Longrightarrow> local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
 2. \<And>x2. \<zeta> = Sym x2 \<Longrightarrow> local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
[PROOF STEP]
case x: (Var x)
[PROOF STATE]
proof (state)
this:
\<zeta> = Var x

goal (2 subgoals):
 1. \<And>x1. \<zeta> = Var x1 \<Longrightarrow> local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
 2. \<And>x2. \<zeta> = Sym x2 \<Longrightarrow> local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<zeta> = Var x

goal (1 subgoal):
 1. local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
[PROOF STEP]
using wary_\<rho> wary_subst_def x
[PROOF STATE]
proof (prove)
using this:
\<zeta> = Var x
wary_subst \<rho>
wary_subst ?\<rho> = (\<forall>x. wary (?\<rho> x) \<and> arity_var x \<le> arity (?\<rho> x) \<and> local.ground_heads (head (?\<rho> x)) \<subseteq> ground_heads_var x)
\<zeta> = Var x

goal (1 subgoal):
 1. local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))

goal (1 subgoal):
 1. \<And>x2. \<zeta> = Sym x2 \<Longrightarrow> local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
local.ground_heads (head (subst \<rho> (apps (Hd \<zeta>) ss))) \<subseteq> local.ground_heads (head (apps (Hd \<zeta>) ss))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma update_sink_swim_cases:
      assumes "heap_invar h"
      assumes "valid h i"
      obtains "swim_invar (update h i v) i" | "sink_invar (update h i v) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>swim_invar (update h i v) i \<Longrightarrow> thesis; sink_invar (update h i v) i \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
apply (cases rule: linear[of "prio v" "prio_of h i", THEN disjE])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>swim_invar (update h i v) i \<Longrightarrow> thesis; sink_invar (update h i v) i \<Longrightarrow> thesis; prio v \<le> prio_of h i\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>swim_invar (update h i v) i \<Longrightarrow> thesis; sink_invar (update h i v) i \<Longrightarrow> thesis; prio_of h i \<le> prio v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
apply (blast dest: swim_invar_decr[OF assms])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>swim_invar (update h i v) i \<Longrightarrow> thesis; sink_invar (update h i v) i \<Longrightarrow> thesis; prio_of h i \<le> prio v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
apply (blast dest: sink_invar_incr[OF assms])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma wf_subset_mset_rel: "wf {(M, N :: 'a multiset). M \<subset># N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(M, N). M \<subset># N}
[PROOF STEP]
apply (rule wf_measure [THEN wf_subset, where f1=size])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(M, N). M \<subset># N} \<subseteq> measure size
[PROOF STEP]
apply (clarsimp simp: measure_def inv_image_def mset_subset_size)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma omega_coinduct: "X x z \<Longrightarrow>
  (\<And>x z. X x z \<Longrightarrow> \<exists>y. (x, y) \<in> R \<and> (X y z \<or> (y, z) \<in> omega R)) \<Longrightarrow>
  (x, z) \<in> omega R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X x z; \<And>x z. X x z \<Longrightarrow> \<exists>y. (x, y) \<in> R \<and> (X y z \<or> (y, z) \<in> Omega_Algebra_Models.omega R)\<rbrakk> \<Longrightarrow> (x, z) \<in> Omega_Algebra_Models.omega R
[PROOF STEP]
by (metis (full_types) omega.coinduct)


[STATEMENT]
lemma positive_Real: "cauchy X \<Longrightarrow> positive (Real X) \<longleftrightarrow> (\<exists>r>0. \<exists>k. \<forall>n\<ge>k. r < X n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cauchy X \<Longrightarrow> positive (Real X) = (\<exists>r>0. \<exists>k. \<forall>n\<ge>k. r < X n)
[PROOF STEP]
using positive.transfer
[PROOF STATE]
proof (prove)
using this:
rel_fun pcr_real (=) (\<lambda>X. \<exists>r>0. \<exists>k. \<forall>n\<ge>k. r < X n) positive

goal (1 subgoal):
 1. cauchy X \<Longrightarrow> positive (Real X) = (\<exists>r>0. \<exists>k. \<forall>n\<ge>k. r < X n)
[PROOF STEP]
by (simp add: cr_real_eq rel_fun_def)


[STATEMENT]
lemma p_pow_factor:
"\<pp>[^]((int N)*l  + k) = (\<pp>[^]l)[^](N::nat) \<otimes> \<pp>[^] k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pp> [^] (int N * l + k) = (\<pp> [^] l) [^] N \<otimes> \<pp> [^] k
[PROOF STEP]
by (metis Qp_p_int_nat_pow_pow mult_of_nat_commute p_intpow_add)


[STATEMENT]
lemma less_eq_insert1_iff [iff]: "(hinsert x y) \<le> z \<longleftrightarrow> x \<^bold>\<in> z \<and> y \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<triangleleft> x \<le> z) = (x \<^bold>\<in> z \<and> y \<le> z)
[PROOF STEP]
by (auto simp: less_eq_hf_def)


[STATEMENT]
lemma sfilter_streams:
  "alw (ev (holds P)) \<omega> \<Longrightarrow> \<omega> \<in> streams A \<Longrightarrow> sfilter P \<omega> \<in> streams {x\<in>A. P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>alw (ev (holds P)) \<omega>; \<omega> \<in> streams A\<rbrakk> \<Longrightarrow> sfilter P \<omega> \<in> streams {x \<in> A. P x}
[PROOF STEP]
proof (coinduction arbitrary: \<omega>)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<omega>. \<lbrakk>alw (ev (holds P)) \<omega>; \<omega> \<in> streams A\<rbrakk> \<Longrightarrow> \<exists>a s. sfilter P \<omega> = a ## s \<and> a \<in> {x \<in> A. P x} \<and> ((\<exists>\<omega>. s = sfilter P \<omega> \<and> alw (ev (holds P)) \<omega> \<and> \<omega> \<in> streams A) \<or> s \<in> streams {x \<in> A. P x})
[PROOF STEP]
case (streams \<omega>)
[PROOF STATE]
proof (state)
this:
alw (ev (holds P)) \<omega>
\<omega> \<in> streams A

goal (1 subgoal):
 1. \<And>\<omega>. \<lbrakk>alw (ev (holds P)) \<omega>; \<omega> \<in> streams A\<rbrakk> \<Longrightarrow> \<exists>a s. sfilter P \<omega> = a ## s \<and> a \<in> {x \<in> A. P x} \<and> ((\<exists>\<omega>. s = sfilter P \<omega> \<and> alw (ev (holds P)) \<omega> \<and> \<omega> \<in> streams A) \<or> s \<in> streams {x \<in> A. P x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
alw (ev (holds P)) \<omega>
\<omega> \<in> streams A
[PROOF STEP]
have "ev (holds P) \<omega>"
[PROOF STATE]
proof (prove)
using this:
alw (ev (holds P)) \<omega>
\<omega> \<in> streams A

goal (1 subgoal):
 1. ev (holds P) \<omega>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ev (holds P) \<omega>

goal (1 subgoal):
 1. \<And>\<omega>. \<lbrakk>alw (ev (holds P)) \<omega>; \<omega> \<in> streams A\<rbrakk> \<Longrightarrow> \<exists>a s. sfilter P \<omega> = a ## s \<and> a \<in> {x \<in> A. P x} \<and> ((\<exists>\<omega>. s = sfilter P \<omega> \<and> alw (ev (holds P)) \<omega> \<and> \<omega> \<in> streams A) \<or> s \<in> streams {x \<in> A. P x})
[PROOF STEP]
from this streams
[PROOF STATE]
proof (chain)
picking this:
ev (holds P) \<omega>
alw (ev (holds P)) \<omega>
\<omega> \<in> streams A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
ev (holds P) \<omega>
alw (ev (holds P)) \<omega>
\<omega> \<in> streams A

goal (1 subgoal):
 1. \<exists>a s. sfilter P \<omega> = a ## s \<and> a \<in> {x \<in> A. P x} \<and> ((\<exists>\<omega>. s = sfilter P \<omega> \<and> alw (ev (holds P)) \<omega> \<and> \<omega> \<in> streams A) \<or> s \<in> streams {x \<in> A. P x})
[PROOF STEP]
by (induct rule: ev_induct_strong) (auto elim: streamsE)
[PROOF STATE]
proof (state)
this:
\<exists>a s. sfilter P \<omega> = a ## s \<and> a \<in> {x \<in> A. P x} \<and> ((\<exists>\<omega>. s = sfilter P \<omega> \<and> alw (ev (holds P)) \<omega> \<and> \<omega> \<in> streams A) \<or> s \<in> streams {x \<in> A. P x})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sup_same_context:
  "x \<le> y \<squnion> z \<Longrightarrow> y \<le> x \<squnion> z \<Longrightarrow> x \<squnion> z = y \<squnion> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y \<squnion> z; y \<le> x \<squnion> z\<rbrakk> \<Longrightarrow> x \<squnion> z = y \<squnion> z
[PROOF STEP]
by (simp add: le_iff_sup sup_left_commute)


[STATEMENT]
lemma "primes !! 1 = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primes !! 1 = 3
[PROOF STEP]
unfolding primes.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sieve\<cdot>[2..] !! 1 = 3
[PROOF STEP]
apply (simp only: enumFrom_intsFrom_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sieve\<cdot>(intsFrom\<cdot>2) !! 1 = 3
[PROOF STEP]
apply (subst intsFrom.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sieve\<cdot>(seq\<cdot>2\<cdot>(2 : intsFrom\<cdot>(2 + 1))) !! 1 = 3
[PROOF STEP]
apply (subst intsFrom.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sieve\<cdot>(seq\<cdot>2\<cdot>(2 : seq\<cdot>(2 + 1)\<cdot>((2 + 1) : intsFrom\<cdot>(2 + 1 + 1)))) !! 1 = 3
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_nn_integral_lborel_eq_integral:
  fixes f::"'a::euclidean_space \<Rightarrow> real"
  assumes "set_borel_measurable borel A f"
  assumes "\<And>x. x \<in> A \<Longrightarrow> 0 \<le> f x" "(\<integral>\<^sup>+x\<in>A. f x \<partial>lborel) < \<infinity>"
  shows "(\<integral>\<^sup>+x\<in>A. f x \<partial>lborel) = integral A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
have eq: "(\<integral>\<^sup>+x\<in>A. f x \<partial>lborel) = (\<integral>\<^sup>+x. ennreal (indicator A x * f x) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real A x * f x) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (auto simp: indicator_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real A x * f x) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real A x * f x) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
have "\<dots> = integral UNIV (\<lambda>x. indicator A x * f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (indicat_real A x * f x) \<partial>lborel = ennreal (integral UNIV (\<lambda>x. indicat_real A x * f x))
[PROOF STEP]
using assms eq
[PROOF STATE]
proof (prove)
using this:
set_borel_measurable borel A f
?x \<in> A \<Longrightarrow> 0 \<le> f ?x
\<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel < \<infinity>
\<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real A x * f x) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (indicat_real A x * f x) \<partial>lborel = ennreal (integral UNIV (\<lambda>x. indicat_real A x * f x))
[PROOF STEP]
by (intro nn_integral_lborel_eq_integral)
                      (auto simp: indicator_def set_borel_measurable_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (indicat_real A x * f x) \<partial>lborel = ennreal (integral UNIV (\<lambda>x. indicat_real A x * f x))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (indicat_real A x * f x) \<partial>lborel = ennreal (integral UNIV (\<lambda>x. indicat_real A x * f x))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
have "integral UNIV (\<lambda>x. indicator A x * f x) = integral A (\<lambda>x. indicator A x * f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. indicat_real A x * f x) = integral A (\<lambda>x. indicat_real A x * f x)
[PROOF STEP]
by (rule integral_spike_set) (auto intro: empty_imp_negligible)
[PROOF STATE]
proof (state)
this:
integral UNIV (\<lambda>x. indicat_real A x * f x) = integral A (\<lambda>x. indicat_real A x * f x)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral UNIV (\<lambda>x. indicat_real A x * f x) = integral A (\<lambda>x. indicat_real A x * f x)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
have "\<dots> = integral A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral A (\<lambda>x. indicat_real A x * f x) = integral A f
[PROOF STEP]
by (rule integral_cong) (auto simp: indicator_def)
[PROOF STATE]
proof (state)
this:
integral A (\<lambda>x. indicat_real A x * f x) = integral A f

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. ennreal (f x)\<partial>lborel = ennreal (integral A f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Nmlize_Hcomp_Hcomp':
    assumes "Arr t" and "Arr u" and "Arr v" and "Src t = Trg u" and "Src u = Trg v"
    shows "\<^bold>\<lfloor>t \<^bold>\<star> u \<^bold>\<star> v\<^bold>\<rfloor> = \<^bold>\<lfloor>\<^bold>\<lfloor>t\<^bold>\<rfloor> \<^bold>\<star> \<^bold>\<lfloor>u\<^bold>\<rfloor> \<^bold>\<star> \<^bold>\<lfloor>v\<^bold>\<rfloor>\<^bold>\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>\<lfloor>t \<^bold>\<star> u \<^bold>\<star> v\<^bold>\<rfloor> = \<^bold>\<lfloor>\<^bold>\<lfloor>t\<^bold>\<rfloor> \<^bold>\<star> \<^bold>\<lfloor>u\<^bold>\<rfloor> \<^bold>\<star> \<^bold>\<lfloor>v\<^bold>\<rfloor>\<^bold>\<rfloor>
[PROOF STEP]
using assms Nml_Nmlize Nmlize_Nmlize
[PROOF STATE]
proof (prove)
using this:
Arr t
Arr u
Arr v
Src t = Trg u
Src u = Trg v
Arr ?t \<Longrightarrow> Nml \<^bold>\<lfloor>?t\<^bold>\<rfloor>
Arr ?t \<Longrightarrow> Src \<^bold>\<lfloor>?t\<^bold>\<rfloor> = Src ?t
Arr ?t \<Longrightarrow> Trg \<^bold>\<lfloor>?t\<^bold>\<rfloor> = Trg ?t
Arr ?t \<Longrightarrow> Dom \<^bold>\<lfloor>?t\<^bold>\<rfloor> = \<^bold>\<lfloor>Dom ?t\<^bold>\<rfloor>
Arr ?t \<Longrightarrow> Cod \<^bold>\<lfloor>?t\<^bold>\<rfloor> = \<^bold>\<lfloor>Cod ?t\<^bold>\<rfloor>
Arr ?t \<Longrightarrow> \<^bold>\<lfloor>\<^bold>\<lfloor>?t\<^bold>\<rfloor>\<^bold>\<rfloor> = \<^bold>\<lfloor>?t\<^bold>\<rfloor>

goal (1 subgoal):
 1. \<^bold>\<lfloor>t \<^bold>\<star> u \<^bold>\<star> v\<^bold>\<rfloor> = \<^bold>\<lfloor>\<^bold>\<lfloor>t\<^bold>\<rfloor> \<^bold>\<star> \<^bold>\<lfloor>u\<^bold>\<rfloor> \<^bold>\<star> \<^bold>\<lfloor>v\<^bold>\<rfloor>\<^bold>\<rfloor>
[PROOF STEP]
by (simp add: HcompNml_assoc)


[STATEMENT]
lemma in_aug_pm_set:
       "x \<in> aug_pm_set z i A = (x = z \<or> x \<in> A \<or> x \<in> minus_set i A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> aug_pm_set z i A) = (x = z \<or> x \<in> A \<or> x \<in> minus_set i A)
[PROOF STEP]
by (simp add:aug_pm_set_def)


[STATEMENT]
lemma numer_cf4_pos: fixes x::real shows "numer_cf4 x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < numer_cf4 x
[PROOF STEP]
unfolding numer_cf4_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x ^ 4 + 20 * x ^ 3 + 180 * x\<^sup>2 + 840 * x + 1680
[PROOF STEP]
by (sos "((R<1 + ((R<1 * ((R<4469/256 * [1135/71504*x^2 + 4725/17876*x + 1]^2) + ((R<3728645/18305024 * [536265/2982916*x^2 + x]^2) + (R<106265/24436047872 * [x^2]^2)))) + ((A<=0 * R<1) * (R<45/4096 * [1]^2)))))")


[STATEMENT]
lemma gt_iff_sub_diff_same: "t >\<^sub>t s \<longleftrightarrow> gt_sub t s \<or> gt_diff t s \<or> gt_same t s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t >\<^sub>t s) = (gt_sub t s \<or> gt_diff t s \<or> gt_same t s)
[PROOF STEP]
by (subst gt.simps) (auto simp: gt_sub.simps gt_diff.simps gt_same.simps)


[STATEMENT]
lemma (in Semilat) trans_r [trans, intro?]: "\<lbrakk>x \<sqsubseteq>\<^sub>r y; y \<sqsubseteq>\<^sub>r z\<rbrakk> \<Longrightarrow> x \<sqsubseteq>\<^sub>r z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<sqsubseteq>\<^bsub>r\<^esub> y; y \<sqsubseteq>\<^bsub>r\<^esub> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> z
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<sqsubseteq>\<^bsub>r\<^esub> y; y \<sqsubseteq>\<^bsub>r\<^esub> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> z
[PROOF STEP]
by (auto intro: order_trans)


[STATEMENT]
lemma l4_16R3:
  assumes "A B C D FSC A' B' C' D'" and "A \<noteq> B"
    and "Bet C A B"
  shows "Cong C D C' D'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cong C D C' D'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Cong C D C' D'
[PROOF STEP]
have "A B C Cong3 A' B' C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B C Cong3 A' B' C'
[PROOF STEP]
using FSC_def assms(1)
[PROOF STATE]
proof (prove)
using this:
?A ?B ?C ?D FSC ?A' ?B' ?C' ?D' \<equiv> Col ?A ?B ?C \<and> ?A ?B ?C Cong3 ?A' ?B' ?C' \<and> Cong ?A ?D ?A' ?D' \<and> Cong ?B ?D ?B' ?D'
A B C D FSC A' B' C' D'

goal (1 subgoal):
 1. A B C Cong3 A' B' C'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A B C Cong3 A' B' C'

goal (1 subgoal):
 1. Cong C D C' D'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A B C Cong3 A' B' C'
[PROOF STEP]
have "Bet C' A' B'"
[PROOF STATE]
proof (prove)
using this:
A B C Cong3 A' B' C'

goal (1 subgoal):
 1. Bet C' A' B'
[PROOF STEP]
using assms(3) between_symmetry cong_3_swap l4_6
[PROOF STATE]
proof (prove)
using this:
A B C Cong3 A' B' C'
Bet C A B
Bet ?A ?B ?C \<Longrightarrow> Bet ?C ?B ?A
?A ?B ?C Cong3 ?A' ?B' ?C' \<Longrightarrow> ?B ?A ?C Cong3 ?B' ?A' ?C'
\<lbrakk>Bet ?A ?B ?C; ?A ?B ?C Cong3 ?A' ?B' ?C'\<rbrakk> \<Longrightarrow> Bet ?A' ?B' ?C'

goal (1 subgoal):
 1. Bet C' A' B'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Bet C' A' B'

goal (1 subgoal):
 1. Cong C D C' D'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Bet C' A' B'

goal (1 subgoal):
 1. Cong C D C' D'
[PROOF STEP]
by (smt Cong3_def FSC_def assms(1) assms(2) assms(3) between_symmetry cong_commutativity five_segment)
[PROOF STATE]
proof (state)
this:
Cong C D C' D'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<psi>_nonneg [intro]: "\<psi> x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<psi> x
[PROOF STEP]
unfolding \<psi>_def sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sum mangoldt {i. 0 < i \<and> real i \<le> x}
[PROOF STEP]
by (intro sum_nonneg mangoldt_nonneg)


[STATEMENT]
lemma is_function_tuple_list_update:
  assumes "is_function_tuple R n fs"
  assumes "f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R"
  assumes "i < n"
  shows "is_function_tuple R n (fs[i := f])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_function_tuple R n (fs[i := f])
[PROOF STEP]
apply(rule is_function_tupleI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (fs[i := f]) \<subseteq> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
by (metis assms(1) assms(2) is_function_tuple_def set_update_subsetI)


[STATEMENT]
lemma ordinal_exp_left_cancel [simp]:
"oSuc 0 < w \<Longrightarrow> (w ** x = w ** y) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oSuc 0 < w \<Longrightarrow> (w ** x = w ** y) = (x = y)
[PROOF STEP]
by (rule normal.cancel_eq[OF normal_exp])


[STATEMENT]
lemma recurse_traverse:
  assumes "f \<bullet> g = pure"
  shows "recurse f \<bullet> traverse g = pure"
\<comment> \<open>Gibbons and Bird impose this as an additional requirement on traversals, but they write
  that they have not found a way to derive this fact from other axioms. So we prove it directly.\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. recurse f \<bullet> traverse g = pure
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (recurse f \<bullet> traverse g) x = pure x
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (recurse f \<bullet> traverse g) x = pure x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f \<bullet> g = pure
[PROOF STEP]
have *: "\<And>x. State_Monad.bind (g x) f = State_Monad.return x"
[PROOF STATE]
proof (prove)
using this:
f \<bullet> g = pure

goal (1 subgoal):
 1. \<And>x. g x \<bind> f = pure x
[PROOF STEP]
by(simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
g ?x \<bind> f = pure ?x

goal (1 subgoal):
 1. \<And>x. (recurse f \<bullet> traverse g) x = pure x
[PROOF STEP]
hence **: "\<And>x h. State_Monad.bind (g x) (\<lambda>x. State_Monad.bind (f x) h) = h x"
[PROOF STATE]
proof (prove)
using this:
g ?x \<bind> f = pure ?x

goal (1 subgoal):
 1. \<And>x h. g x \<bind> (\<lambda>x. f x \<bind> h) = h x
[PROOF STEP]
by(fold State_Monad.bind_assoc)(simp)
[PROOF STATE]
proof (state)
this:
g ?x \<bind> (\<lambda>x. f x \<bind> ?h) = ?h ?x

goal (1 subgoal):
 1. \<And>x. (recurse f \<bullet> traverse g) x = pure x
[PROOF STEP]
show "(recurse f \<bullet> traverse g) t = pure t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (recurse f \<bullet> traverse g) t = pure t
[PROOF STEP]
unfolding kleisli_state_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. traverse g t \<bind> recurse f = pure t
[PROOF STEP]
proof(induction t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. traverse g (Tree_Relabelling.tree.Leaf x) \<bind> recurse f = pure (Tree_Relabelling.tree.Leaf x)
 2. \<And>t1 t2. \<lbrakk>traverse g t1 \<bind> recurse f = pure t1; traverse g t2 \<bind> recurse f = pure t2\<rbrakk> \<Longrightarrow> traverse g (Tree_Relabelling.tree.Node t1 t2) \<bind> recurse f = pure (Tree_Relabelling.tree.Node t1 t2)
[PROOF STEP]
case (Leaf x)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x. traverse g (Tree_Relabelling.tree.Leaf x) \<bind> recurse f = pure (Tree_Relabelling.tree.Leaf x)
 2. \<And>t1 t2. \<lbrakk>traverse g t1 \<bind> recurse f = pure t1; traverse g t2 \<bind> recurse f = pure t2\<rbrakk> \<Longrightarrow> traverse g (Tree_Relabelling.tree.Node t1 t2) \<bind> recurse f = pure (Tree_Relabelling.tree.Node t1 t2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. traverse g (Tree_Relabelling.tree.Leaf x) \<bind> recurse f = pure (Tree_Relabelling.tree.Leaf x)
[PROOF STEP]
by(simp add: ap_conv_bind_state recurse_Leaf **)
[PROOF STATE]
proof (state)
this:
traverse g (Tree_Relabelling.tree.Leaf x) \<bind> recurse f = pure (Tree_Relabelling.tree.Leaf x)

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>traverse g t1 \<bind> recurse f = pure t1; traverse g t2 \<bind> recurse f = pure t2\<rbrakk> \<Longrightarrow> traverse g (Tree_Relabelling.tree.Node t1 t2) \<bind> recurse f = pure (Tree_Relabelling.tree.Node t1 t2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>traverse g t1 \<bind> recurse f = pure t1; traverse g t2 \<bind> recurse f = pure t2\<rbrakk> \<Longrightarrow> traverse g (Tree_Relabelling.tree.Node t1 t2) \<bind> recurse f = pure (Tree_Relabelling.tree.Node t1 t2)
[PROOF STEP]
case (Node l r)
[PROOF STATE]
proof (state)
this:
traverse g l \<bind> recurse f = pure l
traverse g r \<bind> recurse f = pure r

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>traverse g t1 \<bind> recurse f = pure t1; traverse g t2 \<bind> recurse f = pure t2\<rbrakk> \<Longrightarrow> traverse g (Tree_Relabelling.tree.Node t1 t2) \<bind> recurse f = pure (Tree_Relabelling.tree.Node t1 t2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. traverse g (Tree_Relabelling.tree.Node l r) \<bind> recurse f = pure (Tree_Relabelling.tree.Node l r)
[PROOF STEP]
by(simp add: ap_conv_bind_state recurse_Node)(simp add: State_Monad.bind_assoc[symmetric] Node.IH)
[PROOF STATE]
proof (state)
this:
traverse g (Tree_Relabelling.tree.Node l r) \<bind> recurse f = pure (Tree_Relabelling.tree.Node l r)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(recurse f \<bullet> traverse g) t = pure t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ring) drop_exp_base:
  shows "drop n (exp_base x m) = exp_base x (m - n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
have ?thesis if "n > m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
by (simp add: exp_base_def)
[PROOF STATE]
proof (state)
this:
m < n \<Longrightarrow> drop n (exp_base x m) = exp_base x (m - n)

goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
m < n \<Longrightarrow> drop n (exp_base x m) = exp_base x (m - n)

goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
have ?thesis if "n \<le> m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
using exp_base_append[of x "m - n" n] that
[PROOF STATE]
proof (prove)
using this:
exp_base x (m - n + n) = map (([^]) x) (rev [m - n..<m - n + n]) @ exp_base x (m - n)
n \<le> m

goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n \<le> m \<Longrightarrow> drop n (exp_base x m) = exp_base x (m - n)

goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
m < n \<Longrightarrow> drop n (exp_base x m) = exp_base x (m - n)
n \<le> m \<Longrightarrow> drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m < n \<Longrightarrow> drop n (exp_base x m) = exp_base x (m - n)
n \<le> m \<Longrightarrow> drop n (exp_base x m) = exp_base x (m - n)

goal (1 subgoal):
 1. drop n (exp_base x m) = exp_base x (m - n)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
drop n (exp_base x m) = exp_base x (m - n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Inr_qbs_morphism:
  "Inr \<in> Y \<rightarrow>\<^sub>Q X <+>\<^sub>Q Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inr \<in> Y \<rightarrow>\<^sub>Q X <+>\<^sub>Q Y
[PROOF STEP]
proof(rule qbs_morphismI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx Y \<Longrightarrow> Inr \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
fix \<alpha>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx Y \<Longrightarrow> Inr \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
assume "\<alpha> \<in> qbs_Mx Y"
[PROOF STATE]
proof (state)
this:
\<alpha> \<in> qbs_Mx Y

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx Y \<Longrightarrow> Inr \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<alpha> \<in> qbs_Mx Y

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx Y \<Longrightarrow> Inr \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
have "Inr \<circ> \<alpha> = (\<lambda>r. Inr (\<alpha> r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inr \<circ> \<alpha> = (\<lambda>r. Inr (\<alpha> r))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inr \<circ> \<alpha> = (\<lambda>r. Inr (\<alpha> r))

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx Y \<Longrightarrow> Inr \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<alpha> \<in> qbs_Mx Y
Inr \<circ> \<alpha> = (\<lambda>r. Inr (\<alpha> r))
[PROOF STEP]
show "Inr \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)"
[PROOF STATE]
proof (prove)
using this:
\<alpha> \<in> qbs_Mx Y
Inr \<circ> \<alpha> = (\<lambda>r. Inr (\<alpha> r))

goal (1 subgoal):
 1. Inr \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
by(auto intro!: bexI[where x=UNIV] simp add: copair_qbs_Mx_def)
[PROOF STATE]
proof (state)
this:
Inr \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)

goal:
No subgoals!
[PROOF STEP]
qed