[STATEMENT]
lemma finite_Znm[simp]: "finite (Z n m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Z n m)
[PROOF STEP]
proof (unfold Z_alt_def, rule finite_cartesian_product)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
 2. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
have finN: "finite {0..<n}" and finM: "finite {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..<n} &&& finite {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {0..<n}
finite {0..<m}

goal (2 subgoals):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
 2. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
let ?A="{f \<in> {0..<n} \<rightarrow> {0..<m}. (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i) }"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
 2. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
let ?B="{f \<in> {0..<n} \<rightarrow> {0..<m}. (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
 2. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
have B: "{f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} = ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} = {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} = {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}

goal (2 subgoals):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
 2. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
have "?A\<subseteq>?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i} \<subseteq> {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i} \<subseteq> {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}

goal (2 subgoals):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
 2. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i} \<subseteq> {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}

goal (2 subgoals):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
 2. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
have "finite ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
[PROOF STEP]
using B finite_bounded_functions[OF finM finN]
[PROOF STATE]
proof (prove)
using this:
{f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} = {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
finite {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}

goal (2 subgoals):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
 2. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i} \<subseteq> {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
[PROOF STEP]
show "finite ?A"
[PROOF STATE]
proof (prove)
using this:
{f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i} \<subseteq> {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}

goal (1 subgoal):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
[PROOF STEP]
using rev_finite_subset
[PROOF STATE]
proof (prove)
using this:
{f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i} \<subseteq> {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {f \<in> {0..<n} \<rightarrow> {0..<m}. \<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i}

goal (1 subgoal):
 1. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
show "finite {\<pi>. \<pi> permutes {0..<n}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
using finite_permutations
[PROOF STATE]
proof (prove)
using this:
finite ?S \<Longrightarrow> finite {p. p permutes ?S}

goal (1 subgoal):
 1. finite {\<pi>. \<pi> permutes {0..<n}}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {\<pi>. \<pi> permutes {0..<n}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_fps_expansion_cmult_right [fps_expansion_intros]:
  fixes c :: "'a :: {banach, real_normed_div_algebra, comm_ring_1}"
  assumes "f has_fps_expansion F"
  shows   "(\<lambda>x. f x * c) has_fps_expansion F * fps_const c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x * c) has_fps_expansion F * fps_const c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. f x * c) has_fps_expansion F * fps_const c
[PROOF STEP]
have "F * fps_const c = fps_const c * F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F * fps_const c = fps_const c * F
[PROOF STEP]
by (intro fps_ext) (auto simp: mult.commute)
[PROOF STATE]
proof (state)
this:
F * fps_const c = fps_const c * F

goal (1 subgoal):
 1. (\<lambda>x. f x * c) has_fps_expansion F * fps_const c
[PROOF STEP]
with has_fps_expansion_cmult_left [OF assms]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. ?c * f x) has_fps_expansion fps_const ?c * F
F * fps_const c = fps_const c * F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ?c * f x) has_fps_expansion fps_const ?c * F
F * fps_const c = fps_const c * F

goal (1 subgoal):
 1. (\<lambda>x. f x * c) has_fps_expansion F * fps_const c
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x * c) has_fps_expansion F * fps_const c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subst_cls_mset_image_mset[simp]: "image_mset f X \<cdot>cm \<sigma> = {# f x \<cdot> \<sigma>. x \<in># X #}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f X \<cdot>cm \<sigma> = {#f x \<cdot> \<sigma>. x \<in># X#}
[PROOF STEP]
unfolding subst_cls_mset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#A \<cdot> \<sigma>. A \<in># image_mset f X#} = {#f x \<cdot> \<sigma>. x \<in># X#}
[PROOF STEP]
by auto


[STATEMENT]
lemma continuous_within_subset:
  "continuous (at x within s) f \<Longrightarrow> t \<subseteq> s \<Longrightarrow> continuous (at x within t) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous (at x within s) f; t \<subseteq> s\<rbrakk> \<Longrightarrow> continuous (at x within t) f
[PROOF STEP]
unfolding continuous_within
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f x) (at x within s); t \<subseteq> s\<rbrakk> \<Longrightarrow> (f \<longlongrightarrow> f x) (at x within t)
[PROOF STEP]
by(metis tendsto_within_subset)


[STATEMENT]
lemma finiteVarsFormula:
  fixes F :: Formula
  shows "finite (vars F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (vars F)
[PROOF STEP]
proof (induct F)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (vars [])
 2. \<And>a F. finite (vars F) \<Longrightarrow> finite (vars (a # F))
[PROOF STEP]
case (Cons c F)
[PROOF STATE]
proof (state)
this:
finite (vars F)

goal (2 subgoals):
 1. finite (vars [])
 2. \<And>a F. finite (vars F) \<Longrightarrow> finite (vars (a # F))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
finite (vars F)

goal (1 subgoal):
 1. finite (vars (c # F))
[PROOF STEP]
using finiteVarsClause[of "c"]
[PROOF STATE]
proof (prove)
using this:
finite (vars F)
finite (vars c)

goal (1 subgoal):
 1. finite (vars (c # F))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (vars (c # F))

goal (1 subgoal):
 1. finite (vars [])
[PROOF STEP]
qed simp


[STATEMENT]
lemma pred_Diff_0[simp]: "0 \<notin> A \<Longrightarrow> i \<in> (\<lambda>x. x - Suc 0) ` A \<longleftrightarrow> Suc i \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> A \<Longrightarrow> (i \<in> (\<lambda>x. x - Suc 0) ` A) = (Suc i \<in> A)
[PROOF STEP]
by (cases i) (fastforce simp: image_iff le_Suc_eq  elim: contrapos_np)+


[STATEMENT]
lemma set_iterator_foldli_conv :
  "set_iterator iti S \<longleftrightarrow>
   (\<exists>l0. distinct l0 \<and> S = set l0 \<and> iti = foldli l0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_iterator iti S = (\<exists>l0. distinct l0 \<and> S = set l0 \<and> iti = foldli l0)
[PROOF STEP]
unfolding set_iterator_def set_iterator_genord_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>l0. distinct l0 \<and> S = set l0 \<and> sorted_wrt (\<lambda>_ _. True) l0 \<and> iti = foldli l0) = (\<exists>l0. distinct l0 \<and> S = set l0 \<and> iti = foldli l0)
[PROOF STEP]
by simp


[STATEMENT]
lemma swap_set_not_in:
  assumes a: "a \<notin> S" "b \<notin> S"
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<rightleftharpoons> b) \<bullet> S = S
[PROOF STEP]
unfolding permute_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(a \<rightleftharpoons> b) \<bullet> x |x. x \<in> S} = S
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
a \<notin> S
b \<notin> S

goal (1 subgoal):
 1. {(a \<rightleftharpoons> b) \<bullet> x |x. x \<in> S} = S
[PROOF STEP]
by (auto simp: swap_atom)


[STATEMENT]
lemma neg_fun_distr3:
  assumes 1: "left_unique R" "right_total R"
    and 2: "right_unique S" "left_total S"
  shows "rel_fun (R OO R') (S OO S') \<le> rel_fun R S OO rel_fun R' S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R OO R' ===> S OO S' \<le> (R ===> S) OO (R' ===> S')
[PROOF STEP]
using functional_converse_relation[OF 1] functional_relation[OF 2]
[PROOF STATE]
proof (prove)
using this:
\<forall>y. \<exists>!x. R x y
\<forall>x. \<exists>!y. S x y

goal (1 subgoal):
 1. R OO R' ===> S OO S' \<le> (R ===> S) OO (R' ===> S')
[PROOF STEP]
unfolding rel_fun_def OO_def
[PROOF STATE]
proof (prove)
using this:
\<forall>y. \<exists>!x. R x y
\<forall>x. \<exists>!y. S x y

goal (1 subgoal):
 1. (\<lambda>f g. \<forall>x y. (\<exists>ya. R x ya \<and> R' ya y) \<longrightarrow> (\<exists>ya. S (f x) ya \<and> S' ya (g y))) \<le> (\<lambda>x z. \<exists>y. (\<forall>xa ya. R xa ya \<longrightarrow> S (x xa) (y ya)) \<and> (\<forall>x ya. R' x ya \<longrightarrow> S' (y x) (z ya)))
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<forall>y. \<exists>!x. R x y; \<forall>x. \<exists>!y. S x y; \<forall>xa ya. (\<exists>y. R xa y \<and> R' y ya) \<longrightarrow> (\<exists>yb. S (x xa) yb \<and> S' yb (y ya))\<rbrakk> \<Longrightarrow> \<exists>ya. (\<forall>xa y. R xa y \<longrightarrow> S (x xa) (ya y)) \<and> (\<forall>x yb. R' x yb \<longrightarrow> S' (ya x) (y yb))
[PROOF STEP]
apply (subst all_comm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<forall>y. \<exists>!x. R x y; \<forall>x. \<exists>!y. S x y; \<forall>xa ya. (\<exists>y. R xa y \<and> R' y ya) \<longrightarrow> (\<exists>yb. S (x xa) yb \<and> S' yb (y ya))\<rbrakk> \<Longrightarrow> \<exists>ya. (\<forall>y xa. R xa y \<longrightarrow> S (x xa) (ya y)) \<and> (\<forall>x yb. R' x yb \<longrightarrow> S' (ya x) (y yb))
[PROOF STEP]
apply (subst all_conj_distrib[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<forall>y. \<exists>!x. R x y; \<forall>x. \<exists>!y. S x y; \<forall>xa ya. (\<exists>y. R xa y \<and> R' y ya) \<longrightarrow> (\<exists>yb. S (x xa) yb \<and> S' yb (y ya))\<rbrakk> \<Longrightarrow> \<exists>ya. \<forall>xa. (\<forall>xb. R xb xa \<longrightarrow> S (x xb) (ya xa)) \<and> (\<forall>yb. R' xa yb \<longrightarrow> S' (ya xa) (y yb))
[PROOF STEP]
apply (intro choice)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<forall>y. \<exists>!x. R x y; \<forall>x. \<exists>!y. S x y; \<forall>xa ya. (\<exists>y. R xa y \<and> R' y ya) \<longrightarrow> (\<exists>yb. S (x xa) yb \<and> S' yb (y ya))\<rbrakk> \<Longrightarrow> \<forall>xa. \<exists>ya. (\<forall>xb. R xb xa \<longrightarrow> S (x xb) ya) \<and> (\<forall>yb. R' xa yb \<longrightarrow> S' ya (y yb))
[PROOF STEP]
by metis


[STATEMENT]
lemma wf_dom_w2:
  assumes "wf_dom ss w"
  shows "(\<forall>x\<in>set w. x < n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set w. x < n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_dom ss w

goal (1 subgoal):
 1. \<forall>x\<in>set w. x < n
[PROOF STEP]
by (auto simp add:wf_dom_def)


[STATEMENT]
lemma bin_to_bl_cat:
  "bin_to_bl (nv + nw) (concat_bit nw w v) =
    bin_to_bl_aux nv v (bin_to_bl nw w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_to_bl (nv + nw) (concat_bit nw w v) = bin_to_bl_aux nv v (bin_to_bl nw w)
[PROOF STEP]
by (simp add: bin_to_bl_def bin_to_bl_aux_cat)


[STATEMENT]
lemma tendsto_MInfty: "(f \<longlongrightarrow> -\<infinity>) F \<longleftrightarrow> (\<forall>r. eventually (\<lambda>x. f x < ereal r) F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> - \<infinity>) F = (\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r)
[PROOF STEP]
unfolding tendsto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S)) = (\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
 2. \<And>S. \<lbrakk>\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r; open S; - \<infinity> \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<in> S
[PROOF STEP]
fix S :: "ereal set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
 2. \<And>S. \<lbrakk>\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r; open S; - \<infinity> \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<in> S
[PROOF STEP]
assume "open S" "-\<infinity> \<in> S"
[PROOF STATE]
proof (state)
this:
open S
- \<infinity> \<in> S

goal (2 subgoals):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
 2. \<And>S. \<lbrakk>\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r; open S; - \<infinity> \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<in> S
[PROOF STEP]
from open_MInfty[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. {..<ereal x} \<subseteq> S
[PROOF STEP]
obtain B where "{..<ereal B} \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. {..<ereal x} \<subseteq> S

goal (1 subgoal):
 1. (\<And>B. {..<ereal B} \<subseteq> S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
{..<ereal B} \<subseteq> S

goal (2 subgoals):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
 2. \<And>S. \<lbrakk>\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r; open S; - \<infinity> \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<in> S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{..<ereal B} \<subseteq> S

goal (2 subgoals):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
 2. \<And>S. \<lbrakk>\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r; open S; - \<infinity> \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<in> S
[PROOF STEP]
assume "\<forall>r::real. eventually (\<lambda>z. f z < r) F"
[PROOF STATE]
proof (state)
this:
\<forall>x. \<forall>\<^sub>F z in F. f z < ereal x

goal (2 subgoals):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
 2. \<And>S. \<lbrakk>\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r; open S; - \<infinity> \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. \<forall>\<^sub>F z in F. f z < ereal x
[PROOF STEP]
have "eventually (\<lambda>z. f z \<in> {..< B}) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. \<forall>\<^sub>F z in F. f z < ereal x

goal (1 subgoal):
 1. \<forall>\<^sub>F z in F. f z \<in> {..<ereal B}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F z in F. f z \<in> {..<ereal B}

goal (2 subgoals):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
 2. \<And>S. \<lbrakk>\<forall>r. \<forall>\<^sub>F x in F. f x < ereal r; open S; - \<infinity> \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<in> S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{..<ereal B} \<subseteq> S
\<forall>\<^sub>F z in F. f z \<in> {..<ereal B}
[PROOF STEP]
show "eventually (\<lambda>z. f z \<in> S) F"
[PROOF STATE]
proof (prove)
using this:
{..<ereal B} \<subseteq> S
\<forall>\<^sub>F z in F. f z \<in> {..<ereal B}

goal (1 subgoal):
 1. \<forall>\<^sub>F z in F. f z \<in> S
[PROOF STEP]
by (auto elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F z in F. f z \<in> S

goal (1 subgoal):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
[PROOF STEP]
assume "\<forall>S. open S \<longrightarrow> -\<infinity> \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F"
[PROOF STATE]
proof (state)
this:
\<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S)

goal (1 subgoal):
 1. \<And>r. \<forall>S. open S \<longrightarrow> - \<infinity> \<in> S \<longrightarrow> (\<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ereal r
[PROOF STEP]
from this[rule_format, of "{..< ereal x}"]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>open {..<ereal x}; - \<infinity> \<in> {..<ereal x}\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F xa in F. f xa \<in> {..<ereal x}
[PROOF STEP]
show "eventually (\<lambda>y. f y < ereal x) F"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>open {..<ereal x}; - \<infinity> \<in> {..<ereal x}\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F xa in F. f xa \<in> {..<ereal x}

goal (1 subgoal):
 1. \<forall>\<^sub>F y in F. f y < ereal x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F y in F. f y < ereal x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma harry_meas_Falses_True [simp]: "harry_meas (replicate n False @ [True]) = 2 * n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
 2. n \<noteq> 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
 2. n \<noteq> 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
hence "replicate n False @ [True] = False # replicate (n - 1) False @ [True]"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. replicate n False @ [True] = False # replicate (n - 1) False @ [True]
[PROOF STEP]
by (cases n) auto
[PROOF STATE]
proof (state)
this:
replicate n False @ [True] = False # replicate (n - 1) False @ [True]

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
 2. n \<noteq> 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
replicate n False @ [True] = False # replicate (n - 1) False @ [True]

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
 2. n \<noteq> 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
have "harry_meas \<dots> = 2 * n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harry_meas (False # replicate (n - 1) False @ [True]) = 2 * n + 1
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. harry_meas (False # replicate (n - 1) False @ [True]) = 2 * n + 1
[PROOF STEP]
by (simp add: harry_meas_False_True algebra_simps)
[PROOF STATE]
proof (state)
this:
harry_meas (False # replicate (n - 1) False @ [True]) = 2 * n + 1

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
 2. n \<noteq> 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
harry_meas (replicate n False @ [True]) = 2 * n + 1

goal (1 subgoal):
 1. harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
harry_meas (replicate n False @ [True]) = 2 * n + 1

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> harry_meas (replicate n False @ [True]) = 2 * n + 1
[PROOF STEP]
qed auto


[STATEMENT]
lemma fps_lr_one_over_one_minus_fps_X_squared:
  shows   "fps_left_inverse ((1 - fps_X)^2) (1::'a::ring_1) = Abs_fps (\<lambda>n. of_nat (n+1))"
          "fps_right_inverse ((1 - fps_X)^2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1)) &&& fps_right_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fps_left_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
 2. fps_right_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
[PROOF STEP]
define  f invf2 :: "'a fps"
    where "f \<equiv> (1 - fps_X)"
    and   "invf2 \<equiv> Abs_fps (\<lambda>n. of_nat (n+1))"
[PROOF STATE]
proof (state)
this:
f \<equiv> 1 - fps_X
invf2 \<equiv> Abs_fps (\<lambda>n. of_nat (n + 1))

goal (2 subgoals):
 1. fps_left_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
 2. fps_right_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
[PROOF STEP]
have f2_nth_simps:
    "f^2 $ 1 = - of_nat 2" "f^2 $ 2 = 1" "\<And>n. n>2 \<Longrightarrow> f^2 $ n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f\<^sup>2 $ 1 = - of_nat 2 &&& f\<^sup>2 $ 2 = (1::'a) &&& (\<And>n. 2 < n \<Longrightarrow> f\<^sup>2 $ n = (0::'a))
[PROOF STEP]
by (simp_all add: power2_eq_square f_def fps_mult_nth sum.atLeast_Suc_atMost)
[PROOF STATE]
proof (state)
this:
f\<^sup>2 $ 1 = - of_nat 2
f\<^sup>2 $ 2 = (1::'a)
2 < ?n \<Longrightarrow> f\<^sup>2 $ ?n = (0::'a)

goal (2 subgoals):
 1. fps_left_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
 2. fps_right_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
[PROOF STEP]
show "fps_left_inverse (f^2) 1 = invf2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) = invf2
[PROOF STEP]
proof (intro fps_ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. fps_left_inverse (f\<^sup>2) (1::'a) $ n = invf2 $ n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. fps_left_inverse (f\<^sup>2) (1::'a) $ n = invf2 $ n
[PROOF STEP]
show "fps_left_inverse (f^2) 1 $ n = invf2 $ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ n = invf2 $ n
[PROOF STEP]
proof (induct n rule: nat_less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<forall>m<n. fps_left_inverse (f\<^sup>2) (1::'a) $ m = invf2 $ m \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ n = invf2 $ n
[PROOF STEP]
case (1 t)
[PROOF STATE]
proof (state)
this:
\<forall>m<t. fps_left_inverse (f\<^sup>2) (1::'a) $ m = invf2 $ m

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. fps_left_inverse (f\<^sup>2) (1::'a) $ m = invf2 $ m \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ n = invf2 $ n
[PROOF STEP]
hence induct_assm:
        "\<And>m. m < t \<Longrightarrow> fps_left_inverse (f\<^sup>2) 1 $ m = invf2 $ m"
[PROOF STATE]
proof (prove)
using this:
\<forall>m<t. fps_left_inverse (f\<^sup>2) (1::'a) $ m = invf2 $ m

goal (1 subgoal):
 1. \<And>m. m < t \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ m = invf2 $ m
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
?m < t \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ ?m = invf2 $ ?m

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. fps_left_inverse (f\<^sup>2) (1::'a) $ m = invf2 $ m \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ n = invf2 $ n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
[PROOF STEP]
proof (cases t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
 2. \<And>nat. t = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
t = Suc m

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
 2. \<And>nat. t = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
[PROOF STEP]
have m: "t = Suc m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t = Suc m
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
t = Suc m

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
 2. \<And>nat. t = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
t = Suc m

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
 2. \<And>nat. t = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
[PROOF STEP]
have "fps_left_inverse (f^2) 1 $ Suc m = invf2 $ Suc m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
proof (cases m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
 2. \<And>nat. m = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
m = 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
 2. \<And>nat. m = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m = 0

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
using f2_nth_simps(1)
[PROOF STATE]
proof (prove)
using this:
m = 0
f\<^sup>2 $ 1 = - of_nat 2

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
by (simp add: invf2_def)
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
case (Suc l)
[PROOF STATE]
proof (state)
this:
m = Suc l

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
have l: "m = Suc l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = Suc l
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
m = Suc l

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
m = Suc l

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
have "fps_left_inverse (f^2) 1 $ Suc (Suc l) = invf2 $ Suc (Suc l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
proof (cases l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. l = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
 2. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
l = 0

goal (2 subgoals):
 1. l = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
 2. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
l = 0

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
using f2_nth_simps(1,2)
[PROOF STATE]
proof (prove)
using this:
l = 0
f\<^sup>2 $ 1 = - of_nat 2
f\<^sup>2 $ 2 = (1::'a)

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
by (simp add: Suc_1[symmetric] invf2_def)
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
l = Suc k

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
from Suc l m
[PROOF STATE]
proof (chain)
picking this:
l = Suc k
m = Suc l
t = Suc m
[PROOF STEP]
have A: "fps_left_inverse (f\<^sup>2) 1 $ Suc (Suc k) = invf2 $ Suc (Suc k)"
              and  B: "fps_left_inverse (f\<^sup>2) 1 $ Suc k = invf2 $ Suc k"
[PROOF STATE]
proof (prove)
using this:
l = Suc k
m = Suc l
t = Suc m

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) = invf2 $ Suc (Suc k) &&& fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k = invf2 $ Suc k
[PROOF STEP]
using induct_assm[of "Suc k"] induct_assm[of "Suc (Suc k)"]
[PROOF STATE]
proof (prove)
using this:
l = Suc k
m = Suc l
t = Suc m
Suc k < t \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k = invf2 $ Suc k
Suc (Suc k) < t \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) = invf2 $ Suc (Suc k)

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) = invf2 $ Suc (Suc k) &&& fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k = invf2 $ Suc k
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) = invf2 $ Suc (Suc k)
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k = invf2 $ Suc k

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
have times2: "\<And>a::nat. 2*a = a + a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. 2 * a = a + a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * ?a = ?a + ?a

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
have "\<forall>i\<in>{0..k}. (f^2)$(Suc (Suc (Suc k)) - i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{0..k}. f\<^sup>2 $ (Suc (Suc (Suc k)) - i) = (0::'a)
[PROOF STEP]
using f2_nth_simps(3)
[PROOF STATE]
proof (prove)
using this:
2 < ?n \<Longrightarrow> f\<^sup>2 $ ?n = (0::'a)

goal (1 subgoal):
 1. \<forall>i\<in>{0..k}. f\<^sup>2 $ (Suc (Suc (Suc k)) - i) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{0..k}. f\<^sup>2 $ (Suc (Suc (Suc k)) - i) = (0::'a)

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
hence
              "fps_left_inverse (f^2) 1 $ Suc (Suc (Suc k)) =
                fps_left_inverse (f\<^sup>2) 1 $ Suc (Suc k) * of_nat 2 -
                fps_left_inverse (f\<^sup>2) 1 $ Suc k"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{0..k}. f\<^sup>2 $ (Suc (Suc (Suc k)) - i) = (0::'a)

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) * of_nat 2 - fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k
[PROOF STEP]
using sum.ub_add_nat f2_nth_simps(1,2)
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{0..k}. f\<^sup>2 $ (Suc (Suc (Suc k)) - i) = (0::'a)
?m \<le> ?n + 1 \<Longrightarrow> sum ?g {?m..?n + ?p} = sum ?g {?m..?n} + sum ?g {?n + 1..?n + ?p}
f\<^sup>2 $ 1 = - of_nat 2
f\<^sup>2 $ 2 = (1::'a)

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) * of_nat 2 - fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) * of_nat 2 - fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) * of_nat 2 - fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
have "\<dots> = of_nat (2 * Suc (Suc (Suc k))) - of_nat (Suc (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) * of_nat 2 - fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k = of_nat (2 * Suc (Suc (Suc k))) - of_nat (Suc (Suc k))
[PROOF STEP]
by (subst A, subst B) (simp add: invf2_def mult.commute)
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) * of_nat 2 - fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k = of_nat (2 * Suc (Suc (Suc k))) - of_nat (Suc (Suc k))

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc k) * of_nat 2 - fps_left_inverse (f\<^sup>2) (1::'a) $ Suc k = of_nat (2 * Suc (Suc (Suc k))) - of_nat (Suc (Suc k))

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
have "\<dots> = of_nat (Suc (Suc (Suc k)) + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (2 * Suc (Suc (Suc k))) - of_nat (Suc (Suc k)) = of_nat (Suc (Suc (Suc k)) + 1)
[PROOF STEP]
by (subst times2[of "Suc (Suc (Suc k))"]) simp
[PROOF STATE]
proof (state)
this:
of_nat (2 * Suc (Suc (Suc k))) - of_nat (Suc (Suc k)) = of_nat (Suc (Suc (Suc k)) + 1)

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = of_nat (Suc (Suc (Suc k)) + 1)
[PROOF STEP]
have
              "fps_left_inverse (f^2) 1 $ Suc (Suc (Suc k)) = invf2 $ Suc (Suc (Suc k))"
[PROOF STATE]
proof (prove)
using this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = of_nat (Suc (Suc (Suc k)) + 1)

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = invf2 $ Suc (Suc (Suc k))
[PROOF STEP]
by (simp add: invf2_def)
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = invf2 $ Suc (Suc (Suc k))

goal (1 subgoal):
 1. \<And>nat. l = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
with Suc
[PROOF STATE]
proof (chain)
picking this:
l = Suc k
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = invf2 $ Suc (Suc (Suc k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
l = Suc k
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc (Suc k)) = invf2 $ Suc (Suc (Suc k))

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
m = Suc l
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = Suc l
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc (Suc l) = invf2 $ Suc (Suc l)

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
 2. \<And>nat. t = Suc nat \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
t = Suc m
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t = Suc m
fps_left_inverse (f\<^sup>2) (1::'a) $ Suc m = invf2 $ Suc m

goal (1 subgoal):
 1. fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t

goal (1 subgoal):
 1. t = 0 \<Longrightarrow> fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t
[PROOF STEP]
qed (simp add: invf2_def)
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ t = invf2 $ t

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) $ n = invf2 $ n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) = invf2

goal (1 subgoal):
 1. fps_right_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fps_left_inverse (f\<^sup>2) (1::'a) = invf2

goal (1 subgoal):
 1. fps_right_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
[PROOF STEP]
have "fps_right_inverse (f^2) 1 = fps_left_inverse (f^2) 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_right_inverse (f\<^sup>2) (1::'a) = fps_left_inverse (f\<^sup>2) (1::'a)
[PROOF STEP]
by  (auto
          intro: fps_left_inverse_eq_fps_right_inverse[symmetric]
          simp: f_def power2_eq_square
        )
[PROOF STATE]
proof (state)
this:
fps_right_inverse (f\<^sup>2) (1::'a) = fps_left_inverse (f\<^sup>2) (1::'a)

goal (1 subgoal):
 1. fps_right_inverse ((1 - fps_X)\<^sup>2) (1::'a) = Abs_fps (\<lambda>n. of_nat (n + 1))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
fps_left_inverse (f\<^sup>2) (1::'a) = invf2
fps_right_inverse (f\<^sup>2) (1::'a) = fps_left_inverse (f\<^sup>2) (1::'a)
[PROOF STEP]
show "fps_right_inverse (f^2) 1 = invf2"
[PROOF STATE]
proof (prove)
using this:
fps_left_inverse (f\<^sup>2) (1::'a) = invf2
fps_right_inverse (f\<^sup>2) (1::'a) = fps_left_inverse (f\<^sup>2) (1::'a)

goal (1 subgoal):
 1. fps_right_inverse (f\<^sup>2) (1::'a) = invf2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_right_inverse (f\<^sup>2) (1::'a) = invf2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_cond_exp_intg:
  assumes [measurable]: "f \<in> borel_measurable F" "g \<in> borel_measurable M"
  shows "(\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M) = (\<integral>\<^sup>+ x. f x * g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have [measurable]: "f \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> borel_measurable M
[PROOF STEP]
by (meson assms subalg borel_measurable_subalgebra subalgebra_def)
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have ac: "absolutely_continuous (restr_to_subalg M F) (restr_to_subalg (density M g) F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. absolutely_continuous (restr_to_subalg M F) (restr_to_subalg (density M g) F)
[PROOF STEP]
unfolding absolutely_continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
have "null_sets (restr_to_subalg M F) = null_sets M \<inter> sets F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) = null_sets M \<inter> sets F
[PROOF STEP]
by (rule null_sets_restr_to_subalg[OF subalg])
[PROOF STATE]
proof (state)
this:
null_sets (restr_to_subalg M F) = null_sets M \<inter> sets F

goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
null_sets (restr_to_subalg M F) = null_sets M \<inter> sets F

goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
have "null_sets M \<subseteq> null_sets (density M g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_sets M \<subseteq> null_sets (density M g)
[PROOF STEP]
by (rule absolutely_continuousI_density[unfolded absolutely_continuous_def]) auto
[PROOF STATE]
proof (state)
this:
null_sets M \<subseteq> null_sets (density M g)

goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
null_sets (restr_to_subalg M F) = null_sets M \<inter> sets F
null_sets M \<subseteq> null_sets (density M g)
[PROOF STEP]
have "null_sets (restr_to_subalg M F) \<subseteq> null_sets (density M g) \<inter> sets F"
[PROOF STATE]
proof (prove)
using this:
null_sets (restr_to_subalg M F) = null_sets M \<inter> sets F
null_sets M \<subseteq> null_sets (density M g)

goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (density M g) \<inter> sets F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
null_sets (restr_to_subalg M F) \<subseteq> null_sets (density M g) \<inter> sets F

goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
null_sets (restr_to_subalg M F) \<subseteq> null_sets (density M g) \<inter> sets F

goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
have "null_sets (density M g) \<inter> sets F = null_sets (restr_to_subalg (density M g) F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_sets (density M g) \<inter> sets F = null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
by (rule null_sets_restr_to_subalg[symmetric]) (metis subalg sets_density space_density subalgebra_def)
[PROOF STATE]
proof (state)
this:
null_sets (density M g) \<inter> sets F = null_sets (restr_to_subalg (density M g) F)

goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
null_sets (restr_to_subalg M F) \<subseteq> null_sets (density M g) \<inter> sets F
null_sets (density M g) \<inter> sets F = null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
show "null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)"
[PROOF STATE]
proof (prove)
using this:
null_sets (restr_to_subalg M F) \<subseteq> null_sets (density M g) \<inter> sets F
null_sets (density M g) \<inter> sets F = null_sets (restr_to_subalg (density M g) F)

goal (1 subgoal):
 1. null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
null_sets (restr_to_subalg M F) \<subseteq> null_sets (restr_to_subalg (density M g) F)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
absolutely_continuous (restr_to_subalg M F) (restr_to_subalg (density M g) F)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have "(\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M) = (\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>(restr_to_subalg M F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>restr_to_subalg M F
[PROOF STEP]
by (rule nn_integral_subalgebra2[symmetric]) (simp_all add: assms subalg)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>restr_to_subalg M F

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>restr_to_subalg M F

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>(restr_to_subalg M F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>restr_to_subalg M F = \<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>restr_to_subalg M F
[PROOF STEP]
unfolding nn_cond_exp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (if g \<in> borel_measurable M \<and> subalgebra M F then RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) else (\<lambda>_. 0)) x \<partial>restr_to_subalg M F = \<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>restr_to_subalg M F
[PROOF STEP]
using assms subalg
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable F
g \<in> borel_measurable M
subalgebra M F

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (if g \<in> borel_measurable M \<and> subalgebra M F then RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) else (\<lambda>_. 0)) x \<partial>restr_to_subalg M F = \<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>restr_to_subalg M F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>restr_to_subalg M F = \<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>restr_to_subalg M F

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>restr_to_subalg M F = \<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>restr_to_subalg M F

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x * f x \<partial>(restr_to_subalg M F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>restr_to_subalg M F = \<integral>\<^sup>+ x. RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x * f x \<partial>restr_to_subalg M F
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>restr_to_subalg M F = \<integral>\<^sup>+ x. RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x * f x \<partial>restr_to_subalg M F

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \<partial>restr_to_subalg M F = \<integral>\<^sup>+ x. RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x * f x \<partial>restr_to_subalg M F

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f x \<partial>(restr_to_subalg (density M g) F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x * f x \<partial>restr_to_subalg M F = integral\<^sup>N (restr_to_subalg (density M g) F) f
[PROOF STEP]
proof (rule sigma_finite_measure.RN_deriv_nn_integral[symmetric])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. sigma_finite_measure (restr_to_subalg M F)
 2. absolutely_continuous (restr_to_subalg M F) (restr_to_subalg (density M g) F)
 3. sets (restr_to_subalg (density M g) F) = sets (restr_to_subalg M F)
 4. f \<in> borel_measurable (restr_to_subalg M F)
[PROOF STEP]
show "sets (restr_to_subalg (density M g) F) = sets (restr_to_subalg M F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (restr_to_subalg (density M g) F) = sets (restr_to_subalg M F)
[PROOF STEP]
by (metis subalg restr_to_subalg_def sets.sets_measure_of_eq space_density subalgebra_def)
[PROOF STATE]
proof (state)
this:
sets (restr_to_subalg (density M g) F) = sets (restr_to_subalg M F)

goal (3 subgoals):
 1. sigma_finite_measure (restr_to_subalg M F)
 2. absolutely_continuous (restr_to_subalg M F) (restr_to_subalg (density M g) F)
 3. f \<in> borel_measurable (restr_to_subalg M F)
[PROOF STEP]
qed (auto simp add: assms measurable_restrict ac measurable_in_subalg subalg sigma_fin_subalg)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x * f x \<partial>restr_to_subalg M F = integral\<^sup>N (restr_to_subalg (density M g) F) f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x * f x \<partial>restr_to_subalg M F = integral\<^sup>N (restr_to_subalg (density M g) F) f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f x \<partial>(density M g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (restr_to_subalg (density M g) F) f = integral\<^sup>N (density M g) f
[PROOF STEP]
by (metis nn_integral_subalgebra2 subalg assms(1) sets_density space_density subalgebra_def)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (restr_to_subalg (density M g) F) f = integral\<^sup>N (density M g) f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (restr_to_subalg (density M g) F) f = integral\<^sup>N (density M g) f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. g x * f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (density M g) f = \<integral>\<^sup>+ x. g x * f x \<partial>M
[PROOF STEP]
by (rule nn_integral_density) (simp_all add: assms)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (density M g) f = \<integral>\<^sup>+ x. g x * f x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (density M g) f = \<integral>\<^sup>+ x. g x * f x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f x * g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. g x * f x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. g x * f x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_cond_exp M F g x \<partial>M = \<integral>\<^sup>+ x. f x * g x \<partial>M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_from_roots:
  fixes f :: "'a \<Rightarrow> 'b :: comm_ring_1" assumes fin: "finite A"
  shows "(\<Prod>x\<in>A. [:-f x, 1:]) = (\<Sum>X\<in>Pow A. monom ((-1) ^ card X * (\<Prod>x\<in>X. f x)) (card (A - X)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
have "(\<Prod>x\<in>A. [:-f x, 1:]) = (\<Prod>x\<in>A. [:0, 1:] - [:f x:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Prod>x\<in>A. [:0::'b, 1::'b:] - [:f x:])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Prod>x\<in>A. [:0::'b, 1::'b:] - [:f x:])

goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Prod>x\<in>A. [:0::'b, 1::'b:] - [:f x:])

goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Pow A. (-1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom 1 (card (A - X)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:0::'b, 1::'b:] - [:f x:]) = (\<Sum>X\<in>Pow A. (- 1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom (1::'b) (card (A - X)))
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:0::'b, 1::'b:] - [:f x:]) = (\<Sum>X\<in>Pow A. (- 1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom (1::'b) (card (A - X)))
[PROOF STEP]
by (subst prod_diff1) (auto simp: monom_altdef mult_ac)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. [:0::'b, 1::'b:] - [:f x:]) = (\<Sum>X\<in>Pow A. (- 1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom (1::'b) (card (A - X)))

goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. [:0::'b, 1::'b:] - [:f x:]) = (\<Sum>X\<in>Pow A. (- 1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom (1::'b) (card (A - X)))

goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Pow A. monom ((-1) ^ card X * (\<Prod>x\<in>X. f x)) (card (A - X)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Pow A. (- 1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom (1::'b) (card (A - X))) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
proof (intro sum.cong refl, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> Pow A \<Longrightarrow> (- 1) ^ card x * (\<Prod>x\<in>x. [:f x:]) * monom (1::'b) (card (A - x)) = monom ((- (1::'b)) ^ card x * prod f x) (card (A - x))
[PROOF STEP]
case (1 X)
[PROOF STATE]
proof (state)
this:
X \<in> Pow A

goal (1 subgoal):
 1. \<And>x. x \<in> Pow A \<Longrightarrow> (- 1) ^ card x * (\<Prod>x\<in>x. [:f x:]) * monom (1::'b) (card (A - x)) = monom ((- (1::'b)) ^ card x * prod f x) (card (A - x))
[PROOF STEP]
have "(-1 :: 'b poly) ^ card X = [:(-1) ^ card X:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ card X = [:(- (1::'b)) ^ card X:]
[PROOF STEP]
by (induction X rule: infinite_finite_induct) (auto simp: one_pCons algebra_simps)
[PROOF STATE]
proof (state)
this:
(- 1) ^ card X = [:(- (1::'b)) ^ card X:]

goal (1 subgoal):
 1. \<And>x. x \<in> Pow A \<Longrightarrow> (- 1) ^ card x * (\<Prod>x\<in>x. [:f x:]) * monom (1::'b) (card (A - x)) = monom ((- (1::'b)) ^ card x * prod f x) (card (A - x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(- 1) ^ card X = [:(- (1::'b)) ^ card X:]

goal (1 subgoal):
 1. \<And>x. x \<in> Pow A \<Longrightarrow> (- 1) ^ card x * (\<Prod>x\<in>x. [:f x:]) * monom (1::'b) (card (A - x)) = monom ((- (1::'b)) ^ card x * prod f x) (card (A - x))
[PROOF STEP]
have "(\<Prod>x\<in>X. [:f x:]) = [:\<Prod>x\<in>X. f x:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. [:f x:]) = [:prod f X:]
[PROOF STEP]
by (induction X rule: infinite_finite_induct) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. [:f x:]) = [:prod f X:]

goal (1 subgoal):
 1. \<And>x. x \<in> Pow A \<Longrightarrow> (- 1) ^ card x * (\<Prod>x\<in>x. [:f x:]) * monom (1::'b) (card (A - x)) = monom ((- (1::'b)) ^ card x * prod f x) (card (A - x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(- 1) ^ card X = [:(- (1::'b)) ^ card X:]
(\<Prod>x\<in>X. [:f x:]) = [:prod f X:]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(- 1) ^ card X = [:(- (1::'b)) ^ card X:]
(\<Prod>x\<in>X. [:f x:]) = [:prod f X:]

goal (1 subgoal):
 1. (- 1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom (1::'b) (card (A - X)) = monom ((- (1::'b)) ^ card X * prod f X) (card (A - X))
[PROOF STEP]
by (simp add: smult_monom)
[PROOF STATE]
proof (state)
this:
(- 1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom (1::'b) (card (A - X)) = monom ((- (1::'b)) ^ card X * prod f X) (card (A - X))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Pow A. (- 1) ^ card X * (\<Prod>x\<in>X. [:f x:]) * monom (1::'b) (card (A - X))) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))

goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))

goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. [:- f x, 1::'b:]) = (\<Sum>X\<in>Pow A. monom ((- (1::'b)) ^ card X * prod f X) (card (A - X)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma alw: "alw \<phi> \<pi>l \<longleftrightarrow> (\<forall> i. \<phi> (map (sdrop i) \<pi>l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alw \<phi> \<pi>l = (\<forall>i. \<phi> (map (sdrop i) \<pi>l))
[PROOF STEP]
unfolding alw_def ev neg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>i. \<not> \<phi> (map (sdrop i) \<pi>l)) = (\<forall>i. \<phi> (map (sdrop i) \<pi>l))
[PROOF STEP]
by simp


[STATEMENT]
lemma span_trans: "x \<in> span S \<Longrightarrow> y \<in> span (insert x S) \<Longrightarrow> y \<in> span S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> span S; y \<in> span (insert x S)\<rbrakk> \<Longrightarrow> y \<in> span S
[PROOF STEP]
by (simp only: span_redundant)


[STATEMENT]
lemma (in algebra) sets_Collect_finite_All:
  assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" "finite S"
  shows "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} \<in> M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> \<Omega>. \<forall>i\<in>S. P i x} \<in> M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x \<in> \<Omega>. \<forall>i\<in>S. P i x} \<in> M
[PROOF STEP]
have "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} = (if S = {} then \<Omega> else \<Inter>i\<in>S. {x\<in>\<Omega>. P i x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> \<Omega>. \<forall>i\<in>S. P i x} = (if S = {} then \<Omega> else \<Inter>i\<in>S. {x \<in> \<Omega>. P i x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> \<Omega>. \<forall>i\<in>S. P i x} = (if S = {} then \<Omega> else \<Inter>i\<in>S. {x \<in> \<Omega>. P i x})

goal (1 subgoal):
 1. {x \<in> \<Omega>. \<forall>i\<in>S. P i x} \<in> M
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
?i \<in> S \<Longrightarrow> {x \<in> \<Omega>. P ?i x} \<in> M
finite S
{x \<in> \<Omega>. \<forall>i\<in>S. P i x} = (if S = {} then \<Omega> else \<Inter>i\<in>S. {x \<in> \<Omega>. P i x})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i \<in> S \<Longrightarrow> {x \<in> \<Omega>. P ?i x} \<in> M
finite S
{x \<in> \<Omega>. \<forall>i\<in>S. P i x} = (if S = {} then \<Omega> else \<Inter>i\<in>S. {x \<in> \<Omega>. P i x})

goal (1 subgoal):
 1. {x \<in> \<Omega>. \<forall>i\<in>S. P i x} \<in> M
[PROOF STEP]
by (auto intro!: sets_Collect_finite_All')
[PROOF STATE]
proof (state)
this:
{x \<in> \<Omega>. \<forall>i\<in>S. P i x} \<in> M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SeqQuoteP_subst [simp]:
      "(SeqQuoteP t u s k)(j::=w) =
       SeqQuoteP (subst j w t) (subst j w u) (subst j w s) (subst j w k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SeqQuoteP t u s k)(j::=w) = SeqQuoteP (subst j w t) (subst j w u) (subst j w s) (subst j w k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (SeqQuoteP t u s k)(j::=w) = SeqQuoteP (subst j w t) (subst j w u) (subst j w s) (subst j w k)
[PROOF STEP]
obtain l::name and sl::name and sl'::name and m::name and n::name and
         sm::name and sm'::name and sn::name and sn'::name
    where "atom l \<sharp> (s,k,w,j,sl,sl',m,n,sm,sm',sn,sn')"
          "atom sl \<sharp> (s,w,j,sl',m,n,sm,sm',sn,sn')"  "atom sl' \<sharp> (s,w,j,m,n,sm,sm',sn,sn')"
          "atom m \<sharp> (s,w,j,n,sm,sm',sn,sn')"  "atom n \<sharp> (s,w,j,sm,sm',sn,sn')"
          "atom sm \<sharp> (s,w,j,sm',sn,sn')"  "atom sm' \<sharp> (s,w,j,sn,sn')"
          "atom sn \<sharp> (s,w,j,sn')"  "atom sn' \<sharp> (s,w,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l sl sl' m n sm sm' sn sn'. \<lbrakk>atom l \<sharp> (s, k, w, j, sl, sl', m, n, sm, sm', sn, sn'); atom sl \<sharp> (s, w, j, sl', m, n, sm, sm', sn, sn'); atom sl' \<sharp> (s, w, j, m, n, sm, sm', sn, sn'); atom m \<sharp> (s, w, j, n, sm, sm', sn, sn'); atom n \<sharp> (s, w, j, sm, sm', sn, sn'); atom sm \<sharp> (s, w, j, sm', sn, sn'); atom sm' \<sharp> (s, w, j, sn, sn'); atom sn \<sharp> (s, w, j, sn'); atom sn' \<sharp> (s, w, j)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis obtain_fresh)
[PROOF STATE]
proof (state)
this:
atom l \<sharp> (s, k, w, j, sl, sl', m, n, sm, sm', sn, sn')
atom sl \<sharp> (s, w, j, sl', m, n, sm, sm', sn, sn')
atom sl' \<sharp> (s, w, j, m, n, sm, sm', sn, sn')
atom m \<sharp> (s, w, j, n, sm, sm', sn, sn')
atom n \<sharp> (s, w, j, sm, sm', sn, sn')
atom sm \<sharp> (s, w, j, sm', sn, sn')
atom sm' \<sharp> (s, w, j, sn, sn')
atom sn \<sharp> (s, w, j, sn')
atom sn' \<sharp> (s, w, j)

goal (1 subgoal):
 1. (SeqQuoteP t u s k)(j::=w) = SeqQuoteP (subst j w t) (subst j w u) (subst j w s) (subst j w k)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
atom l \<sharp> (s, k, w, j, sl, sl', m, n, sm, sm', sn, sn')
atom sl \<sharp> (s, w, j, sl', m, n, sm, sm', sn, sn')
atom sl' \<sharp> (s, w, j, m, n, sm, sm', sn, sn')
atom m \<sharp> (s, w, j, n, sm, sm', sn, sn')
atom n \<sharp> (s, w, j, sm, sm', sn, sn')
atom sm \<sharp> (s, w, j, sm', sn, sn')
atom sm' \<sharp> (s, w, j, sn, sn')
atom sn \<sharp> (s, w, j, sn')
atom sn' \<sharp> (s, w, j)

goal (1 subgoal):
 1. (SeqQuoteP t u s k)(j::=w) = SeqQuoteP (subst j w t) (subst j w u) (subst j w s) (subst j w k)
[PROOF STEP]
by (force simp add: SeqQuoteP.simps [of l _ _ sl sl' m n sm sm' sn sn'])
[PROOF STATE]
proof (state)
this:
(SeqQuoteP t u s k)(j::=w) = SeqQuoteP (subst j w t) (subst j w u) (subst j w s) (subst j w k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gen_boolean_algebra_intersect:
  assumes "A \<in> gen_boolean_algebra S B"
  assumes "C \<in> gen_boolean_algebra S B"
  shows "A \<inter> C \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
have 0: "S - A \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - A \<in> gen_boolean_algebra S B
[PROOF STEP]
using assms(1) gen_boolean_algebra.complement
[PROOF STATE]
proof (prove)
using this:
A \<in> gen_boolean_algebra S B
?A \<in> gen_boolean_algebra ?S ?B \<Longrightarrow> ?S - ?A \<in> gen_boolean_algebra ?S ?B

goal (1 subgoal):
 1. S - A \<in> gen_boolean_algebra S B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S - A \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
have 1: "S - C \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - C \<in> gen_boolean_algebra S B
[PROOF STEP]
using assms(2) gen_boolean_algebra.complement
[PROOF STATE]
proof (prove)
using this:
C \<in> gen_boolean_algebra S B
?A \<in> gen_boolean_algebra ?S ?B \<Longrightarrow> ?S - ?A \<in> gen_boolean_algebra ?S ?B

goal (1 subgoal):
 1. S - C \<in> gen_boolean_algebra S B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S - C \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
have 2: "(S - A) \<union> (S - C) \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - A \<union> (S - C) \<in> gen_boolean_algebra S B
[PROOF STEP]
using "0" "1" gen_boolean_algebra.union
[PROOF STATE]
proof (prove)
using this:
S - A \<in> gen_boolean_algebra S B
S - C \<in> gen_boolean_algebra S B
\<lbrakk>?A \<in> gen_boolean_algebra ?S ?B; ?C \<in> gen_boolean_algebra ?S ?B\<rbrakk> \<Longrightarrow> ?A \<union> ?C \<in> gen_boolean_algebra ?S ?B

goal (1 subgoal):
 1. S - A \<union> (S - C) \<in> gen_boolean_algebra S B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S - A \<union> (S - C) \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
have "S - (A \<inter> C) \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
by (simp add: 2 Diff_Int)
[PROOF STATE]
proof (state)
this:
S - A \<inter> C \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S - A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
have 3: "S - (S - (A \<inter> C)) \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
using this:
S - A \<inter> C \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. S - (S - A \<inter> C) \<in> gen_boolean_algebra S B
[PROOF STEP]
using gen_boolean_algebra.complement
[PROOF STATE]
proof (prove)
using this:
S - A \<inter> C \<in> gen_boolean_algebra S B
?A \<in> gen_boolean_algebra ?S ?B \<Longrightarrow> ?S - ?A \<in> gen_boolean_algebra ?S ?B

goal (1 subgoal):
 1. S - (S - A \<inter> C) \<in> gen_boolean_algebra S B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S - (S - A \<inter> C) \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
have "A \<inter> C \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> C \<subseteq> S
[PROOF STEP]
using assms(1) gen_boolean_algebra_subset
[PROOF STATE]
proof (prove)
using this:
A \<in> gen_boolean_algebra S B
?A \<in> gen_boolean_algebra ?S ?B \<Longrightarrow> ?A \<subseteq> ?S

goal (1 subgoal):
 1. A \<inter> C \<subseteq> S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<inter> C \<subseteq> S

goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<inter> C \<subseteq> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<inter> C \<subseteq> S

goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
A \<inter> C \<subseteq> S
S - (S - A \<inter> C) \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. A \<inter> C \<in> gen_boolean_algebra S B
[PROOF STEP]
by (metis "0" Diff_partition Un_subset_iff assms(1) double_diff gen_boolean_algebra_subset)
[PROOF STATE]
proof (state)
this:
A \<inter> C \<in> gen_boolean_algebra S B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_rank_strict_mono:
  assumes "linorder_on B R" "finite A" "A \<subseteq> B" "y \<in> A" "(y, x) \<in> R" "x \<noteq> y"
  shows   "linorder_rank R A y < linorder_rank R A x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
linorder_on B R
[PROOF STEP]
have trans: "trans R"
[PROOF STATE]
proof (prove)
using this:
linorder_on B R

goal (1 subgoal):
 1. trans R
[PROOF STEP]
by (simp add: linorder_on_def)
[PROOF STATE]
proof (state)
this:
trans R

goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
linorder_on B R
finite A
A \<subseteq> B
y \<in> A
(y, x) \<in> R
x \<noteq> y
[PROOF STEP]
have *: "(x, y) \<notin> R"
[PROOF STATE]
proof (prove)
using this:
linorder_on B R
finite A
A \<subseteq> B
y \<in> A
(y, x) \<in> R
x \<noteq> y

goal (1 subgoal):
 1. (x, y) \<notin> R
[PROOF STEP]
by (auto simp: linorder_on_def antisym_def)
[PROOF STATE]
proof (state)
this:
(x, y) \<notin> R

goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
from this and \<open>(y,x) \<in> R\<close>
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<notin> R
(y, x) \<in> R
[PROOF STEP]
have "{z\<in>A-{y}. (z, y) \<in> R} \<subseteq> {z\<in>A-{x}. (z,x) \<in> R}"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<notin> R
(y, x) \<in> R

goal (1 subgoal):
 1. {z \<in> A - {y}. (z, y) \<in> R} \<subseteq> {z \<in> A - {x}. (z, x) \<in> R}
[PROOF STEP]
by (auto intro: transD[OF trans])
[PROOF STATE]
proof (state)
this:
{z \<in> A - {y}. (z, y) \<in> R} \<subseteq> {z \<in> A - {x}. (z, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{z \<in> A - {y}. (z, y) \<in> R} \<subseteq> {z \<in> A - {x}. (z, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
from * and assms
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<notin> R
linorder_on B R
finite A
A \<subseteq> B
y \<in> A
(y, x) \<in> R
x \<noteq> y
[PROOF STEP]
have "y \<notin> {z\<in>A-{y}. (z, y) \<in> R}" "y \<in> {z\<in>A-{x}. (z, x) \<in> R}"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<notin> R
linorder_on B R
finite A
A \<subseteq> B
y \<in> A
(y, x) \<in> R
x \<noteq> y

goal (1 subgoal):
 1. y \<notin> {z \<in> A - {y}. (z, y) \<in> R} &&& y \<in> {z \<in> A - {x}. (z, x) \<in> R}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<notin> {z \<in> A - {y}. (z, y) \<in> R}
y \<in> {z \<in> A - {x}. (z, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{z \<in> A - {y}. (z, y) \<in> R} \<subseteq> {z \<in> A - {x}. (z, x) \<in> R}
y \<notin> {z \<in> A - {y}. (z, y) \<in> R}
y \<in> {z \<in> A - {x}. (z, x) \<in> R}
[PROOF STEP]
have "{z\<in>A-{y}. (z, y) \<in> R} \<subset> {z\<in>A-{x}. (z,x) \<in> R}"
[PROOF STATE]
proof (prove)
using this:
{z \<in> A - {y}. (z, y) \<in> R} \<subseteq> {z \<in> A - {x}. (z, x) \<in> R}
y \<notin> {z \<in> A - {y}. (z, y) \<in> R}
y \<in> {z \<in> A - {x}. (z, x) \<in> R}

goal (1 subgoal):
 1. {z \<in> A - {y}. (z, y) \<in> R} \<subset> {z \<in> A - {x}. (z, x) \<in> R}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{z \<in> A - {y}. (z, y) \<in> R} \<subset> {z \<in> A - {x}. (z, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{z \<in> A - {y}. (z, y) \<in> R} \<subset> {z \<in> A - {x}. (z, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{z \<in> A - {y}. (z, y) \<in> R} \<subset> {z \<in> A - {x}. (z, x) \<in> R}
linorder_on B R
finite A
A \<subseteq> B
y \<in> A
(y, x) \<in> R
x \<noteq> y

goal (1 subgoal):
 1. linorder_rank R A y < linorder_rank R A x
[PROOF STEP]
unfolding linorder_rank_def
[PROOF STATE]
proof (prove)
using this:
{z \<in> A - {y}. (z, y) \<in> R} \<subset> {z \<in> A - {x}. (z, x) \<in> R}
linorder_on B R
finite A
A \<subseteq> B
y \<in> A
(y, x) \<in> R
x \<noteq> y

goal (1 subgoal):
 1. card {ya \<in> A - {y}. (ya, y) \<in> R} < card {y \<in> A - {x}. (y, x) \<in> R}
[PROOF STEP]
by (intro psubset_card_mono) auto
[PROOF STATE]
proof (state)
this:
linorder_rank R A y < linorder_rank R A x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dvdnumcoeff_aux2:
  assumes "numgcd t > 1" shows "dvdnumcoeff t (numgcd t) \<and> numgcd t > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dvdnumcoeff t (numgcd t) \<and> 0 < numgcd t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < numgcd t

goal (1 subgoal):
 1. dvdnumcoeff t (numgcd t) \<and> 0 < numgcd t
[PROOF STEP]
proof (simp add: numgcd_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < numgcdh t (maxcoeff t) \<Longrightarrow> dvdnumcoeff t (numgcdh t (maxcoeff t))
[PROOF STEP]
let ?mc = "maxcoeff t"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < numgcdh t (maxcoeff t) \<Longrightarrow> dvdnumcoeff t (numgcdh t (maxcoeff t))
[PROOF STEP]
let ?g = "numgcdh t ?mc"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < numgcdh t (maxcoeff t) \<Longrightarrow> dvdnumcoeff t (numgcdh t (maxcoeff t))
[PROOF STEP]
have th1: "ismaxcoeff t ?mc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ismaxcoeff t (maxcoeff t)
[PROOF STEP]
by (rule maxcoeff_ismaxcoeff)
[PROOF STATE]
proof (state)
this:
ismaxcoeff t (maxcoeff t)

goal (1 subgoal):
 1. 1 < numgcdh t (maxcoeff t) \<Longrightarrow> dvdnumcoeff t (numgcdh t (maxcoeff t))
[PROOF STEP]
have th2: "?mc \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> maxcoeff t
[PROOF STEP]
by (rule maxcoeff_pos)
[PROOF STATE]
proof (state)
this:
0 \<le> maxcoeff t

goal (1 subgoal):
 1. 1 < numgcdh t (maxcoeff t) \<Longrightarrow> dvdnumcoeff t (numgcdh t (maxcoeff t))
[PROOF STEP]
assume H: "numgcdh t ?mc > 1"
[PROOF STATE]
proof (state)
this:
1 < numgcdh t (maxcoeff t)

goal (1 subgoal):
 1. 1 < numgcdh t (maxcoeff t) \<Longrightarrow> dvdnumcoeff t (numgcdh t (maxcoeff t))
[PROOF STEP]
from dvdnumcoeff_aux[OF th1 th2 H]
[PROOF STATE]
proof (chain)
picking this:
dvdnumcoeff t (numgcdh t (maxcoeff t))
[PROOF STEP]
show "dvdnumcoeff t ?g"
[PROOF STATE]
proof (prove)
using this:
dvdnumcoeff t (numgcdh t (maxcoeff t))

goal (1 subgoal):
 1. dvdnumcoeff t (numgcdh t (maxcoeff t))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dvdnumcoeff t (numgcdh t (maxcoeff t))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dvd_dvd_imp_unit_mult:
    assumes xy: "x dvd y" and yx: "y dvd x"
    shows "\<exists>z. z dvd 1 \<and> y = x * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
proof(cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
 2. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = (0::'a)

goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
 2. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
with xy
[PROOF STATE]
proof (chain)
picking this:
x dvd y
x = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x dvd y
x = (0::'a)

goal (1 subgoal):
 1. \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
by (auto intro: exI[of _ 1])
[PROOF STATE]
proof (state)
this:
\<exists>z. z dvd (1::'a) \<and> y = x * z

goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
case x0: False
[PROOF STATE]
proof (state)
this:
x \<noteq> (0::'a)

goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
from xy
[PROOF STATE]
proof (chain)
picking this:
x dvd y
[PROOF STEP]
obtain z where z: "y = x * z"
[PROOF STATE]
proof (prove)
using this:
x dvd y

goal (1 subgoal):
 1. (\<And>z. y = x * z \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim dvdE, auto)
[PROOF STATE]
proof (state)
this:
y = x * z

goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
from yx
[PROOF STATE]
proof (chain)
picking this:
y dvd x
[PROOF STEP]
obtain w where w: "x = y * w"
[PROOF STATE]
proof (prove)
using this:
y dvd x

goal (1 subgoal):
 1. (\<And>w. x = y * w \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim dvdE, auto)
[PROOF STATE]
proof (state)
this:
x = y * w

goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
from z w
[PROOF STATE]
proof (chain)
picking this:
y = x * z
x = y * w
[PROOF STEP]
have "x * (z * w) = x"
[PROOF STATE]
proof (prove)
using this:
y = x * z
x = y * w

goal (1 subgoal):
 1. x * (z * w) = x
[PROOF STEP]
by (auto simp: ac_simps)
[PROOF STATE]
proof (state)
this:
x * (z * w) = x

goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * (z * w) = x
[PROOF STEP]
have "z * w = 1"
[PROOF STATE]
proof (prove)
using this:
x * (z * w) = x

goal (1 subgoal):
 1. z * w = (1::'a)
[PROOF STEP]
using x0
[PROOF STATE]
proof (prove)
using this:
x * (z * w) = x
x \<noteq> (0::'a)

goal (1 subgoal):
 1. z * w = (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z * w = (1::'a)

goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
with z
[PROOF STATE]
proof (chain)
picking this:
y = x * z
z * w = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y = x * z
z * w = (1::'a)

goal (1 subgoal):
 1. \<exists>z. z dvd (1::'a) \<and> y = x * z
[PROOF STEP]
by (auto intro: exI[of _ z])
[PROOF STATE]
proof (state)
this:
\<exists>z. z dvd (1::'a) \<and> y = x * z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diagonal_to_Smith_row_i_dvd_jj:
  fixes A::"'a::{bezout_ring}^'b::mod_type^'c::mod_type"
  assumes "to_nat a \<in> {i..<min (nrows A) (ncols A)}"
  and "to_nat a = to_nat b"
  shows "(Diagonal_to_Smith_row_i A i bezout) $ (from_nat i) $ (from_nat i)
          dvd (Diagonal_to_Smith_row_i A i bezout) $ a $ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
[PROOF STEP]
proof (cases "to_nat a = i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. to_nat a = i \<Longrightarrow> Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
 2. to_nat a \<noteq> i \<Longrightarrow> Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
to_nat a = i

goal (2 subgoals):
 1. to_nat a = i \<Longrightarrow> Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
 2. to_nat a \<noteq> i \<Longrightarrow> Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
to_nat a = i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
to_nat a = i

goal (1 subgoal):
 1. Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
[PROOF STEP]
by (metis assms(2) dvd_refl from_nat_to_nat_id)
[PROOF STATE]
proof (state)
this:
Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b

goal (1 subgoal):
 1. to_nat a \<noteq> i \<Longrightarrow> Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. to_nat a \<noteq> i \<Longrightarrow> Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
to_nat a \<noteq> i

goal (1 subgoal):
 1. to_nat a \<noteq> i \<Longrightarrow> Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b
[PROOF STEP]
unfolding Diagonal_to_Smith_row_i_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_to_Smith_i [i + 1..<min (nrows A) (ncols A)] A i bezout $ from_nat i $ from_nat i dvd diagonal_to_Smith_i [i + 1..<min (nrows A) (ncols A)] A i bezout $ a $ b
[PROOF STEP]
by (rule diagonal_to_Smith_i_dvd_jj, insert assms False ib, auto)
[PROOF STATE]
proof (state)
this:
Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd Diagonal_to_Smith_row_i A i bezout $ a $ b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fract_of_nat_eq: "Fract (of_nat k) 1 = of_nat k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fract (int k) 1 = of_nat k
[PROOF STEP]
by (rule of_nat_rat [symmetric])


[STATEMENT]
lemma closed_halfspace_ge: "closed {x. inner a x \<ge> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. b \<le> a \<bullet> x}
[PROOF STEP]
by (simp add: closed_Collect_le continuous_on_inner)


[STATEMENT]
lemma take_i_f_join_eq2: "
  \<lbrakk> finite I; card I \<le> n \<rbrakk> \<Longrightarrow> f \<Join>\<^bsub>i-f\<^esub> I \<down> n = f \<Join>\<^bsub>i-f\<^esub> I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; card I \<le> n\<rbrakk> \<Longrightarrow> f \<Join>\<^sub> I \<down> n = f \<Join>\<^sub> I
[PROOF STEP]
apply (case_tac "I = {}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; card I \<le> n; I = {}\<rbrakk> \<Longrightarrow> f \<Join>\<^sub> I \<down> n = f \<Join>\<^sub> I
 2. \<lbrakk>finite I; card I \<le> n; I \<noteq> {}\<rbrakk> \<Longrightarrow> f \<Join>\<^sub> I \<down> n = f \<Join>\<^sub> I
[PROOF STEP]
apply (simp add: cut_less_empty i_f_join_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; card I \<le> n; I \<noteq> {}\<rbrakk> \<Longrightarrow> f \<Join>\<^sub> I \<down> n = f \<Join>\<^sub> I
[PROOF STEP]
apply (simp add: i_f_join_def take_f_join_eq2 cut_less_Max_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma approx_scaleR1: "a \<approx> star_of b \<Longrightarrow> c \<in> HFinite \<Longrightarrow> scaleHR a c \<approx> b *\<^sub>R c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<approx> hypreal_of_real b; c \<in> HFinite\<rbrakk> \<Longrightarrow> scaleHR a c \<approx> b *\<^sub>R c
[PROOF STEP]
unfolding approx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a - hypreal_of_real b \<in> Infinitesimal; c \<in> HFinite\<rbrakk> \<Longrightarrow> scaleHR a c - b *\<^sub>R c \<in> Infinitesimal
[PROOF STEP]
by (metis Infinitesimal_HFinite_scaleHR scaleHR_def scaleHR_left_diff_distrib star_scaleR_def starfun2_star_of)


[STATEMENT]
lemma mult2_s_cancel:
  assumes "s O ns \<subseteq> s" "ns O s \<subseteq> s" "refl ns" "trans ns" "irrefl s" "trans s"
  shows "(X + Z, Y + Z) \<in> mult2_s ns s \<Longrightarrow> (X, Y) \<in> mult2_s ns s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X + Z, Y + Z) \<in> mult2_s ns s \<Longrightarrow> (X, Y) \<in> mult2_s ns s
[PROOF STEP]
using mult2_s_locally_cancel assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?s O ?ns \<subseteq> ?s; ?ns O ?s \<subseteq> ?s; refl ?ns; trans ?ns; locally_irrefl ?s (?X + ?Z); locally_irrefl ?s (?Y + ?Z); trans ?s; (?X + ?Z, ?Y + ?Z) \<in> mult2_s ?ns ?s\<rbrakk> \<Longrightarrow> (?X, ?Y) \<in> mult2_s ?ns ?s
s O ns \<subseteq> s
ns O s \<subseteq> s
refl ns
trans ns
irrefl s
trans s

goal (1 subgoal):
 1. (X + Z, Y + Z) \<in> mult2_s ns s \<Longrightarrow> (X, Y) \<in> mult2_s ns s
[PROOF STEP]
by (metis irrefl_def locally_irrefl_def)


[STATEMENT]
lemma JN_Un: "(\<Squnion>i \<in> I \<union> J. F i) = ((\<Squnion>i \<in> I. F i)\<squnion>(\<Squnion>i \<in> J. F i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. JOIN (I \<union> J) F = JOIN I F \<squnion> JOIN J F
[PROOF STEP]
by (auto intro!: program_equalityI)


[STATEMENT]
lemma poly_power_zero_iff: fixes x :: "'a :: idom"
  shows "(poly (p^n) x = 0) = (n \<noteq> 0 \<and> poly p x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (p ^ n) x = (0::'a)) = (n \<noteq> 0 \<and> poly p x = (0::'a))
[PROOF STEP]
by (cases n, auto)


[STATEMENT]
lemma "heap_map h1 ## heap_map h2 \<Longrightarrow> \<W>\<^sub>\<ff>(heap_map h1 + heap_map h2)
   \<Longrightarrow> \<W>\<^sub>\<ff>(heap_map h1) \<and> \<W>\<^sub>\<ff>(heap_map h2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>heap_map h1 ## heap_map h2; \<W>\<^sub>\<ff>heap_map h1 + heap_map h2\<rbrakk> \<Longrightarrow> \<W>\<^sub>\<ff>heap_map h1 \<and> \<W>\<^sub>\<ff>heap_map h2
[PROOF STEP]
unfolding wellformed_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>heap_map h1 ## heap_map h2; \<forall>b obj. Mapping.lookup (heap_map h1 + heap_map h2) b = Some (Map obj) \<longrightarrow> Set.filter (\<lambda>x. x mod |Cap|\<^sub>\<tau> \<noteq> 0) (Mapping.keys (tags obj)) = {}\<rbrakk> \<Longrightarrow> (\<forall>b obj. Mapping.lookup (heap_map h1) b = Some (Map obj) \<longrightarrow> Set.filter (\<lambda>x. x mod |Cap|\<^sub>\<tau> \<noteq> 0) (Mapping.keys (tags obj)) = {}) \<and> (\<forall>b obj. Mapping.lookup (heap_map h2) b = Some (Map obj) \<longrightarrow> Set.filter (\<lambda>x. x mod |Cap|\<^sub>\<tau> \<noteq> 0) (Mapping.keys (tags obj)) = {})
[PROOF STEP]
by (safe, erule_tac x=b in allE, erule_tac x=obj in allE)
    (fastforce intro: mapping_lookup_disj1 mapping_lookup_disj2)+


[STATEMENT]
lemma \<pi>_mono [intro]: "x \<le> y \<Longrightarrow> \<pi> x \<le> \<pi> y"
  and \<theta>_mono [intro]: "x \<le> y \<Longrightarrow> \<theta> x \<le> \<theta> y"
  and primes_M_mono [intro]: "x \<le> y \<Longrightarrow> \<MM> x \<le> \<MM> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y \<Longrightarrow> \<pi> x \<le> \<pi> y) &&& (x \<le> y \<Longrightarrow> \<theta> x \<le> \<theta> y) &&& (x \<le> y \<Longrightarrow> \<MM> x \<le> \<MM> y)
[PROOF STEP]
unfolding primes_pi_def primes_theta_def primes_M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y \<Longrightarrow> prime_sum_upto (\<lambda>p. 1) x \<le> prime_sum_upto (\<lambda>p. 1) y) &&& (x \<le> y \<Longrightarrow> prime_sum_upto (\<lambda>p. ln (real p)) x \<le> prime_sum_upto (\<lambda>p. ln (real p)) y) &&& (x \<le> y \<Longrightarrow> prime_sum_upto (\<lambda>p. ln (real p) / real p) x \<le> prime_sum_upto (\<lambda>p. ln (real p) / real p) y)
[PROOF STEP]
by (rule prime_sum_upto_mono; simp)+


[STATEMENT]
lemma w_method_via_h_framework_lists_completeness :
  fixes M1 :: "('a::linorder,'b::linorder,'c::linorder) fsm"
  fixes M2 :: "('d,'b,'c) fsm"
  assumes "observable M1"
  and     "observable M2"
  and     "minimal M1"
  and     "minimal M2"
  and     "size_r M1 \<le> m"
  and     "size M2 \<le> m"
  and     "inputs M2 = inputs M1"
  and     "outputs M2 = outputs M1"
shows "(L M1 = L M2) \<longleftrightarrow> list_all (passes_test_case M2 (initial M2)) (w_method_via_h_framework_lists M1 m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (w_method_via_h_framework_lists M1 m)
[PROOF STEP]
using h_framework_static_with_empty_graph_lists_completeness[OF assms, where dist_fun="(\<lambda> k q . distinguishing_set M1)", OF _ distinguishing_set_finite]
[PROOF STATE]
proof (prove)
using this:
(\<And>q1 q2. \<lbrakk>q1 \<in> FSM.states M1; q2 \<in> FSM.states M1; q1 \<noteq> q2\<rbrakk> \<Longrightarrow> \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set M1) \<inter> Prefix_Tree.set (distinguishing_set M1) \<and> distinguishes M1 q1 q2 io) \<Longrightarrow> (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (h_framework_static_with_empty_graph_lists M1 (\<lambda>k q. distinguishing_set M1) m)

goal (1 subgoal):
 1. (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (w_method_via_h_framework_lists M1 m)
[PROOF STEP]
using distinguishing_set_distinguishes[OF assms(1,3)]
[PROOF STATE]
proof (prove)
using this:
(\<And>q1 q2. \<lbrakk>q1 \<in> FSM.states M1; q2 \<in> FSM.states M1; q1 \<noteq> q2\<rbrakk> \<Longrightarrow> \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set M1) \<inter> Prefix_Tree.set (distinguishing_set M1) \<and> distinguishes M1 q1 q2 io) \<Longrightarrow> (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (h_framework_static_with_empty_graph_lists M1 (\<lambda>k q. distinguishing_set M1) m)
\<lbrakk>?q1.0 \<in> FSM.states M1; ?q2.0 \<in> FSM.states M1; ?q1.0 \<noteq> ?q2.0\<rbrakk> \<Longrightarrow> \<exists>io\<in>Prefix_Tree.set (distinguishing_set M1). distinguishes M1 ?q1.0 ?q2.0 io

goal (1 subgoal):
 1. (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (w_method_via_h_framework_lists M1 m)
[PROOF STEP]
unfolding w_method_via_h_framework_lists_def h_framework_static_with_empty_graph_lists_def w_method_via_h_framework_def
[PROOF STATE]
proof (prove)
using this:
(\<And>q1 q2. \<lbrakk>q1 \<in> FSM.states M1; q2 \<in> FSM.states M1; q1 \<noteq> q2\<rbrakk> \<Longrightarrow> \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set M1) \<inter> Prefix_Tree.set (distinguishing_set M1) \<and> distinguishes M1 q1 q2 io) \<Longrightarrow> (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (sorted_list_of_maximal_sequences_in_tree (test_suite_from_io_tree M1 (FSM.initial M1) (h_framework_static_with_empty_graph M1 (\<lambda>k q. distinguishing_set M1) m)))
\<lbrakk>?q1.0 \<in> FSM.states M1; ?q2.0 \<in> FSM.states M1; ?q1.0 \<noteq> ?q2.0\<rbrakk> \<Longrightarrow> \<exists>io\<in>Prefix_Tree.set (distinguishing_set M1). distinguishes M1 ?q1.0 ?q2.0 io

goal (1 subgoal):
 1. (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (sorted_list_of_maximal_sequences_in_tree (test_suite_from_io_tree M1 (FSM.initial M1) (h_framework_static_with_empty_graph M1 (\<lambda>k q. distinguishing_set M1) m)))
[PROOF STEP]
by blast


[STATEMENT]
lemma le_DT_adm: "cont (u::('a::cpo) \<Rightarrow> 'b process) \<Longrightarrow> monofun v \<Longrightarrow> adm(\<lambda>x. u x \<sqsubseteq>\<^sub>D\<^sub>T v x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cont u; monofun v\<rbrakk> \<Longrightarrow> adm (\<lambda>x. u x \<sqsubseteq>\<^sub>D\<^sub>T v x)
[PROOF STEP]
using adm_conj[OF le_T_adm[of u v] le_D_adm[of u v]]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cont u; monofun v; cont u; monofun v\<rbrakk> \<Longrightarrow> adm (\<lambda>x. u x \<sqsubseteq>\<^sub>T v x \<and> u x \<sqsubseteq>\<^sub>D v x)

goal (1 subgoal):
 1. \<lbrakk>cont u; monofun v\<rbrakk> \<Longrightarrow> adm (\<lambda>x. u x \<sqsubseteq>\<^sub>D\<^sub>T v x)
[PROOF STEP]
by (simp add:trace_divergence_refine_def)