[STATEMENT]
lemma bound_on_all_plans_bounds_problem_plan_bound_thesis':
  assumes "finite PROB" "(\<forall>as s.
      s \<in> (valid_states PROB)
      \<and> as \<in> (valid_plans PROB)
      \<longrightarrow> (\<exists>as'.
        (exec_plan s as = exec_plan s as')
        \<and> subseq as' as
        \<and> length as' < k
      )
    )"
  shows "problem_plan_bound PROB < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. problem_plan_bound PROB < k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. problem_plan_bound PROB < k
[PROOF STEP]
have 1: "\<forall>x \<in> MPLS PROB. x < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>MPLS PROB. x < k
[PROOF STEP]
using assms(1, 2) bound_on_all_plans_bounds_MPLS_thesis
[PROOF STATE]
proof (prove)
using this:
finite PROB
\<forall>as s. s \<in> valid_states PROB \<and> as \<in> valid_plans PROB \<longrightarrow> (\<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' < k)
\<lbrakk>finite ?PROB; \<forall>as s. s \<in> valid_states ?PROB \<and> as \<in> valid_plans ?PROB \<longrightarrow> (\<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' < ?k); ?x \<in> MPLS ?PROB\<rbrakk> \<Longrightarrow> ?x < ?k

goal (1 subgoal):
 1. \<forall>x\<in>MPLS PROB. x < k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>MPLS PROB. x < k

goal (1 subgoal):
 1. problem_plan_bound PROB < k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>MPLS PROB. x < k
[PROOF STEP]
have "Sup (MPLS PROB) \<in> MPLS PROB"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>MPLS PROB. x < k

goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
using assms(1) bounded_MPLS_contains_supremum
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>MPLS PROB. x < k
finite PROB
\<lbrakk>finite ?PROB; \<exists>k. \<forall>x\<in>MPLS ?PROB. x < k\<rbrakk> \<Longrightarrow> Sup (MPLS ?PROB) \<in> MPLS ?PROB

goal (1 subgoal):
 1. Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sup (MPLS PROB) \<in> MPLS PROB

goal (1 subgoal):
 1. problem_plan_bound PROB < k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup (MPLS PROB) \<in> MPLS PROB
[PROOF STEP]
have "Sup (MPLS PROB) < k"
[PROOF STATE]
proof (prove)
using this:
Sup (MPLS PROB) \<in> MPLS PROB

goal (1 subgoal):
 1. Sup (MPLS PROB) < k
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
Sup (MPLS PROB) \<in> MPLS PROB
\<forall>x\<in>MPLS PROB. x < k

goal (1 subgoal):
 1. Sup (MPLS PROB) < k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Sup (MPLS PROB) < k

goal (1 subgoal):
 1. problem_plan_bound PROB < k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup (MPLS PROB) < k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sup (MPLS PROB) < k

goal (1 subgoal):
 1. problem_plan_bound PROB < k
[PROOF STEP]
unfolding problem_plan_bound_def
[PROOF STATE]
proof (prove)
using this:
Sup (MPLS PROB) < k

goal (1 subgoal):
 1. Sup (MPLS PROB) < k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
problem_plan_bound PROB < k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sublist_set_elem: "\<lbrakk>sublist xs (A@B); x \<in> set xs\<rbrakk> \<Longrightarrow> x \<in> set A \<or> x \<in> set B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sublist xs (A @ B); x \<in> set xs\<rbrakk> \<Longrightarrow> x \<in> set A \<or> x \<in> set B
[PROOF STEP]
using set_mono_sublist
[PROOF STATE]
proof (prove)
using this:
sublist ?xs ?ys \<Longrightarrow> set ?xs \<subseteq> set ?ys

goal (1 subgoal):
 1. \<lbrakk>sublist xs (A @ B); x \<in> set xs\<rbrakk> \<Longrightarrow> x \<in> set A \<or> x \<in> set B
[PROOF STEP]
by fastforce


[STATEMENT]
lemma lemScaleInverse:
  assumes "k \<noteq> (0::'a)"
    and   "v = k**u"
  shows   "u = (inverse k)**v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u = inverse k ** v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u = inverse k ** v
[PROOF STEP]
have "(inverse k)**v = (inverse k * k)**u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse k ** v = (inverse k * k) ** u
[PROOF STEP]
by (simp add: lemScaleScale assms(2) mult.assoc)
[PROOF STATE]
proof (state)
this:
inverse k ** v = (inverse k * k) ** u

goal (1 subgoal):
 1. u = inverse k ** v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
inverse k ** v = (inverse k * k) ** u

goal (1 subgoal):
 1. u = inverse k ** v
[PROOF STEP]
by (metis (lifting) field_inverse assms(1) lemScale1)
[PROOF STATE]
proof (state)
this:
u = inverse k ** v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p_H_nonneg[simp]: "0 \<le> p_H" "p_H \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> p_H &&& p_H \<le> 1
[PROOF STEP]
by (auto simp: p_H_def divide_le_eq_1 card_gt_0_iff intro!: card_mono )


[STATEMENT]
theorem sup_state_append_snd:
  "length a = length b \<Longrightarrow>
  (G \<turnstile> (i,a@x) <=s (j,b@y)) = ((G \<turnstile> (i,a) <=s (j,b)) \<and> (G \<turnstile> (i,x) <=s (j,y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length a = length b \<Longrightarrow> G \<turnstile> (i, a @ x) <=s (j, b @ y) = (G \<turnstile> (i, a) <=s (j, b) \<and> G \<turnstile> (i, x) <=s (j, y))
[PROOF STEP]
by (auto simp add: sup_state_def stk_convert lesub_def Product.le_def sup_loc_append)


[STATEMENT]
lemma oprod_Refl:"\<lbrakk>Refl r; Refl r'\<rbrakk> \<Longrightarrow> Refl (r *o r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Refl r; Refl r'\<rbrakk> \<Longrightarrow> Refl (r *o r')
[PROOF STEP]
unfolding refl_on_def Field_oprod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<subseteq> Field r \<times> Field r \<and> (\<forall>x\<in>Field r. (x, x) \<in> r); r' \<subseteq> Field r' \<times> Field r' \<and> (\<forall>x\<in>Field r'. (x, x) \<in> r')\<rbrakk> \<Longrightarrow> r *o r' \<subseteq> (Field r \<times> Field r') \<times> Field r \<times> Field r' \<and> (\<forall>x\<in>Field r \<times> Field r'. (x, x) \<in> r *o r')
[PROOF STEP]
unfolding oprod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<subseteq> Field r \<times> Field r \<and> (\<forall>x\<in>Field r. (x, x) \<in> r); r' \<subseteq> Field r' \<times> Field r' \<and> (\<forall>x\<in>Field r'. (x, x) \<in> r')\<rbrakk> \<Longrightarrow> {((x1, y1), x2, y2). (y1, y2) \<in> r' - Id \<and> x1 \<in> Field r \<and> x2 \<in> Field r \<or> (y1, y2) \<in> Restr Id (Field r') \<and> (x1, x2) \<in> r} \<subseteq> (Field r \<times> Field r') \<times> Field r \<times> Field r' \<and> (\<forall>x\<in>Field r \<times> Field r'. (x, x) \<in> {((x1, y1), x2, y2). (y1, y2) \<in> r' - Id \<and> x1 \<in> Field r \<and> x2 \<in> Field r \<or> (y1, y2) \<in> Restr Id (Field r') \<and> (x1, x2) \<in> r})
[PROOF STEP]
by auto


[STATEMENT]
lemma (in Finite_Graph) sum_incoming_extend:
  assumes "\<And>v. \<lbrakk> v\<in>V; (v,u)\<notin>E \<rbrakk> \<Longrightarrow> g (v,u) = 0"
  shows "(\<Sum>e\<in>incoming u. g e) = (\<Sum>v\<in>V. g (v,u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum g (incoming u) = (\<Sum>v\<in>V. g (v, u))
[PROOF STEP]
apply (subst sum_incoming_pointwise)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>E\<inverse> `` {u}. g (v, u)) = (\<Sum>v\<in>V. g (v, u))
[PROOF STEP]
apply (rule sum.mono_neutral_left)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite V
 2. E\<inverse> `` {u} \<subseteq> V
 3. \<forall>i\<in>V - E\<inverse> `` {u}. g (i, u) = (0::'b)
[PROOF STEP]
using assms pred_ss_V
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> V; (?v, u) \<notin> E\<rbrakk> \<Longrightarrow> g (?v, u) = (0::'b)
E\<inverse> `` {?u} \<subseteq> V

goal (3 subgoals):
 1. finite V
 2. E\<inverse> `` {u} \<subseteq> V
 3. \<forall>i\<in>V - E\<inverse> `` {u}. g (i, u) = (0::'b)
[PROOF STEP]
by auto


[STATEMENT]
lemma len_lexext_irrefl: "(\<forall>x \<in> set xs. \<not> gt x x) \<Longrightarrow> \<not> len_lexext gt xs xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. \<not> gt x x \<Longrightarrow> \<not> len_lexext gt xs xs
[PROOF STEP]
by (rule lenext_irrefl[OF lexext_irrefl])


[STATEMENT]
lemma permutations_of_set_empty [simp]: "permutations_of_set {} = {[]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutations_of_set {} = {[]}
[PROOF STEP]
by (auto simp: permutations_of_set_def)


[STATEMENT]
lemma real_of_float_dense:
  fixes x y :: real
  assumes "x < y"
  shows "\<exists>q :: float. x < real_of_float q \<and> real_of_float q < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q. x < real_of_float q \<and> real_of_float q < y
[PROOF STEP]
using float_dense_in_real [OF \<open>x < y\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>r\<in>float. x < r \<and> r < y

goal (1 subgoal):
 1. \<exists>q. x < real_of_float q \<and> real_of_float q < y
[PROOF STEP]
by (auto elim: real_of_float_cases)


[STATEMENT]
lemma abs_less_imp_sq_less [rule_format]:
  fixes x::real and y::real and z::real and w::real
  assumes diff: "abs (x-y) < abs (z-w)"
  shows "(x-y)^2 < (z-w)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
 2. \<not> ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
assume "x=y"
[PROOF STATE]
proof (state)
this:
x = y

goal (2 subgoals):
 1. ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
 2. \<not> ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
hence "abs (x-y) = 0"
[PROOF STATE]
proof (prove)
using this:
x = y

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

goal (2 subgoals):
 1. ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
 2. \<not> ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<bar>x - y\<bar> = 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
 2. \<not> ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
with diff
[PROOF STATE]
proof (chain)
picking this:
\<bar>x - y\<bar> < \<bar>z - w\<bar>
\<bar>x - y\<bar> = 0
[PROOF STEP]
have "abs(z-w) > 0"
[PROOF STATE]
proof (prove)
using this:
\<bar>x - y\<bar> < \<bar>z - w\<bar>
\<bar>x - y\<bar> = 0

goal (1 subgoal):
 1. 0 < \<bar>z - w\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < \<bar>z - w\<bar>

goal (2 subgoals):
 1. ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
 2. \<not> ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
hence "(z-w)^2 > 0"
[PROOF STATE]
proof (prove)
using this:
0 < \<bar>z - w\<bar>

goal (1 subgoal):
 1. 0 < (z - w)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < (z - w)\<^sup>2

goal (2 subgoals):
 1. ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
 2. \<not> ?P \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<bar>x - y\<bar> = 0
0 < (z - w)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>x - y\<bar> = 0
0 < (z - w)\<^sup>2

goal (1 subgoal):
 1. (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x - y)\<^sup>2 < (z - w)\<^sup>2

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
assume "x\<noteq>y"
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
hence "abs (x - y) > 0"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y

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

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
with diff
[PROOF STATE]
proof (chain)
picking this:
\<bar>x - y\<bar> < \<bar>z - w\<bar>
0 < \<bar>x - y\<bar>
[PROOF STEP]
have "(abs (x-y))^2 < (abs (z-w))^2"
[PROOF STATE]
proof (prove)
using this:
\<bar>x - y\<bar> < \<bar>z - w\<bar>
0 < \<bar>x - y\<bar>

goal (1 subgoal):
 1. \<bar>x - y\<bar>\<^sup>2 < \<bar>z - w\<bar>\<^sup>2
[PROOF STEP]
by - (drule power_strict_mono [where a="abs (x-y)" and n=2 and b="abs (z-w)"], auto)
[PROOF STATE]
proof (state)
this:
\<bar>x - y\<bar>\<^sup>2 < \<bar>z - w\<bar>\<^sup>2

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>x - y\<bar>\<^sup>2 < \<bar>z - w\<bar>\<^sup>2

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_divide_inverse:
  "set_divide (A :: (_ \<Rightarrow> (_ :: division_ring)) set) B = set_mult A (set_inverse B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_divide A B = set_mult A (set_inverse B)
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> set_divide A B \<Longrightarrow> x \<in> set_mult A (set_inverse B)
 2. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> set_divide A B \<Longrightarrow> x \<in> set_mult A (set_inverse B)
 2. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
assume "f \<in> set_divide A B"
[PROOF STATE]
proof (state)
this:
f \<in> set_divide A B

goal (2 subgoals):
 1. \<And>x. x \<in> set_divide A B \<Longrightarrow> x \<in> set_mult A (set_inverse B)
 2. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<in> set_divide A B
[PROOF STEP]
obtain g h where "f = (\<lambda>x. g x / h x)" "g \<in> A" "h \<in> B"
[PROOF STATE]
proof (prove)
using this:
f \<in> set_divide A B

goal (1 subgoal):
 1. (\<And>g h. \<lbrakk>f = (\<lambda>x. g x / h x); g \<in> A; h \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding set_divide_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {\<lambda>x. f x / g x |f g. f \<in> A \<and> g \<in> B}

goal (1 subgoal):
 1. (\<And>g h. \<lbrakk>f = (\<lambda>x. g x / h x); g \<in> A; h \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. g x / h x)
g \<in> A
h \<in> B

goal (2 subgoals):
 1. \<And>x. x \<in> set_divide A B \<Longrightarrow> x \<in> set_mult A (set_inverse B)
 2. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
hence "f = g * (\<lambda>x. inverse (h x))" "(\<lambda>x. inverse (h x)) \<in> set_inverse B"
[PROOF STATE]
proof (prove)
using this:
f = (\<lambda>x. g x / h x)
g \<in> A
h \<in> B

goal (1 subgoal):
 1. f = g * (\<lambda>x. inverse (h x)) &&& (\<lambda>x. inverse (h x)) \<in> set_inverse B
[PROOF STEP]
unfolding set_inverse_def
[PROOF STATE]
proof (prove)
using this:
f = (\<lambda>x. g x / h x)
g \<in> A
h \<in> B

goal (1 subgoal):
 1. f = g * (\<lambda>x. inverse (h x)) &&& (\<lambda>x. inverse (h x)) \<in> {\<lambda>x. inverse (f x) |f. f \<in> B}
[PROOF STEP]
by (auto simp: divide_inverse)
[PROOF STATE]
proof (state)
this:
f = g * (\<lambda>x. inverse (h x))
(\<lambda>x. inverse (h x)) \<in> set_inverse B

goal (2 subgoals):
 1. \<And>x. x \<in> set_divide A B \<Longrightarrow> x \<in> set_mult A (set_inverse B)
 2. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
with \<open>g \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
g \<in> A
f = g * (\<lambda>x. inverse (h x))
(\<lambda>x. inverse (h x)) \<in> set_inverse B
[PROOF STEP]
show "f \<in> set_mult A (set_inverse B)"
[PROOF STATE]
proof (prove)
using this:
g \<in> A
f = g * (\<lambda>x. inverse (h x))
(\<lambda>x. inverse (h x)) \<in> set_inverse B

goal (1 subgoal):
 1. f \<in> set_mult A (set_inverse B)
[PROOF STEP]
unfolding set_mult_def
[PROOF STATE]
proof (prove)
using this:
g \<in> A
f = g * (\<lambda>x. inverse (h x))
(\<lambda>x. inverse (h x)) \<in> set_inverse B

goal (1 subgoal):
 1. f \<in> {\<lambda>x. f x * g x |f g. f \<in> A \<and> g \<in> set_inverse B}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
f \<in> set_mult A (set_inverse B)

goal (1 subgoal):
 1. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
assume "f \<in> set_mult A (set_inverse B)"
[PROOF STATE]
proof (state)
this:
f \<in> set_mult A (set_inverse B)

goal (1 subgoal):
 1. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<in> set_mult A (set_inverse B)
[PROOF STEP]
obtain g h where "f = g * (\<lambda>x. inverse (h x))" "g \<in> A" "h \<in> B"
[PROOF STATE]
proof (prove)
using this:
f \<in> set_mult A (set_inverse B)

goal (1 subgoal):
 1. (\<And>g h. \<lbrakk>f = g * (\<lambda>x. inverse (h x)); g \<in> A; h \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding set_times_def set_inverse_def set_mult_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {\<lambda>x. f x * g x |f g. f \<in> A \<and> g \<in> {\<lambda>x. inverse (f x) |f. f \<in> B}}

goal (1 subgoal):
 1. (\<And>g h. \<lbrakk>f = g * (\<lambda>x. inverse (h x)); g \<in> A; h \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
f = g * (\<lambda>x. inverse (h x))
g \<in> A
h \<in> B

goal (1 subgoal):
 1. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
hence "f = (\<lambda>x. g x / h x)"
[PROOF STATE]
proof (prove)
using this:
f = g * (\<lambda>x. inverse (h x))
g \<in> A
h \<in> B

goal (1 subgoal):
 1. f = (\<lambda>x. g x / h x)
[PROOF STEP]
by (intro ext) (simp add: divide_inverse)
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. g x / h x)

goal (1 subgoal):
 1. \<And>x. x \<in> set_mult A (set_inverse B) \<Longrightarrow> x \<in> set_divide A B
[PROOF STEP]
with \<open>g \<in> A\<close> \<open>h \<in> B\<close>
[PROOF STATE]
proof (chain)
picking this:
g \<in> A
h \<in> B
f = (\<lambda>x. g x / h x)
[PROOF STEP]
show "f \<in> set_divide A B"
[PROOF STATE]
proof (prove)
using this:
g \<in> A
h \<in> B
f = (\<lambda>x. g x / h x)

goal (1 subgoal):
 1. f \<in> set_divide A B
[PROOF STEP]
unfolding set_divide_def
[PROOF STATE]
proof (prove)
using this:
g \<in> A
h \<in> B
f = (\<lambda>x. g x / h x)

goal (1 subgoal):
 1. f \<in> {\<lambda>x. f x / g x |f g. f \<in> A \<and> g \<in> B}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f \<in> set_divide A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p_eq2: "int p = (2 * ((int p - 1) div 2)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int p = 2 * ((int p - 1) div 2) + 1
[PROOF STEP]
using odd_p p_ge_2 nonzero_mult_div_cancel_left [of 2 "p - 1"]
[PROOF STATE]
proof (prove)
using this:
odd p
2 < p
2 \<noteq> 0 \<Longrightarrow> 2 * (p - 1) div 2 = p - 1

goal (1 subgoal):
 1. int p = 2 * ((int p - 1) div 2) + 1
[PROOF STEP]
by simp


[STATEMENT]
lemma regular_divisionE:
  assumes "K \<in> regular_division a b n" "a<b"
  obtains k where "k<n" "K = {a + (b-a)*(real k / n) .. a + (b-a)*((1 + real k) / n)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k < n; K = {a + (b - a) * (real k / real n)..a + (b - a) * ((1 + real k) / real n)}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k < n; K = {a + (b - a) * (real k / real n)..a + (b - a) * ((1 + real k) / real n)}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have eq: "(\<lambda>x. a + (b - a) * x) = (\<lambda>x. a + x) \<circ> (\<lambda>x. (b - a) * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. a + (b - a) * x) = (+) a \<circ> (*) (b - a)
[PROOF STEP]
by (simp add: o_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. a + (b - a) * x) = (+) a \<circ> (*) (b - a)

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k < n; K = {a + (b - a) * (real k / real n)..a + (b - a) * ((1 + real k) / real n)}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain k where "k<n" "K = ((\<lambda>x. a+x) \<circ> (\<lambda>x. (b-a) * x)) ` {k/n .. (1 + real k) / n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k < n; K = ((+) a \<circ> (*) (b - a)) ` {real k / real n..(1 + real k) / real n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
K \<in> regular_division a b n
a < b

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k < n; K = ((+) a \<circ> (*) (b - a)) ` {real k / real n..(1 + real k) / real n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: regular_division_def segments_def segment_def)
[PROOF STATE]
proof (state)
this:
k < n
K = ((+) a \<circ> (*) (b - a)) ` {real k / real n..(1 + real k) / real n}

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k < n; K = {a + (b - a) * (real k / real n)..a + (b - a) * ((1 + real k) / real n)}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with that \<open>a<b\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?k < n; K = {a + (b - a) * (real ?k / real n)..a + (b - a) * ((1 + real ?k) / real n)}\<rbrakk> \<Longrightarrow> thesis
a < b
k < n
K = ((+) a \<circ> (*) (b - a)) ` {real k / real n..(1 + real k) / real n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?k < n; K = {a + (b - a) * (real ?k / real n)..a + (b - a) * ((1 + real ?k) / real n)}\<rbrakk> \<Longrightarrow> thesis
a < b
k < n
K = ((+) a \<circ> (*) (b - a)) ` {real k / real n..(1 + real k) / real n}

goal (1 subgoal):
 1. thesis
[PROOF STEP]
unfolding image_comp [symmetric]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?k < n; K = {a + (b - a) * (real ?k / real n)..a + (b - a) * ((1 + real ?k) / real n)}\<rbrakk> \<Longrightarrow> thesis
a < b
k < n
K = (+) a ` (*) (b - a) ` {real k / real n..(1 + real k) / real n}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma padic_a_inv_in_padic_set:
  assumes "f \<in> padic_set p"
  assumes "prime (p::int)"
  shows "(padic_a_inv p f) \<in> padic_set p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_a_inv p f \<in> padic_set p
[PROOF STEP]
proof(rule padic_set_memI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))
 2. \<And>m n. m < n \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
show "\<And>m. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))
[PROOF STEP]
show "padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))
[PROOF STEP]
have P0: "padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p^m)\<^esub> (f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m
[PROOF STEP]
using padic_a_inv_def
[PROOF STATE]
proof (prove)
using this:
padic_a_inv ?p ?f \<equiv> \<lambda>n. \<ominus>\<^bsub>residue_ring (?p ^ n)\<^esub> ?f n

goal (1 subgoal):
 1. padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m

goal (1 subgoal):
 1. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m

goal (1 subgoal):
 1. padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))
[PROOF STEP]
by (metis (no_types, lifting) assms(1) assms(2) cring.cring_simprules(3) neq0_conv
            one_less_power padic_set_res_closed padic_set_zero_res power_0 prime_gt_1_int residue_1_prop
            residue_ring_def residues.cring residues.intro ring.simps(1))
[PROOF STATE]
proof (state)
this:
padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_a_inv p f m \<in> carrier (residue_ring (p ^ m))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_a_inv p f ?m \<in> carrier (residue_ring (p ^ ?m))

goal (1 subgoal):
 1. \<And>m n. m < n \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
show "\<And>m n. m < n \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. m < n \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m n. m < n \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
fix m n::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m n. m < n \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
assume "m < n"
[PROOF STATE]
proof (state)
this:
m < n

goal (1 subgoal):
 1. \<And>m n. m < n \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
show "residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
proof(cases "m=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
 2. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
m = 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
 2. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = 0
[PROOF STEP]
have 0: "residue (p ^ m) (padic_a_inv p f n) = 0"
[PROOF STATE]
proof (prove)
using this:
m = 0

goal (1 subgoal):
 1. residue (p ^ m) (padic_a_inv p f n) = 0
[PROOF STEP]
using residue_1_zero
[PROOF STATE]
proof (prove)
using this:
m = 0
residue 1 ?n = 0

goal (1 subgoal):
 1. residue (p ^ m) (padic_a_inv p f n) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
residue (p ^ m) (padic_a_inv p f n) = 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
 2. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
have "f m = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f m = 0
[PROOF STEP]
using assms True padic_set_def residue_ring_def padic_set_zero_res
[PROOF STATE]
proof (prove)
using this:
f \<in> padic_set p
prime p
m = 0
padic_set ?p = {f. (\<forall>m. f m \<in> carrier (residue_ring (?p ^ m))) \<and> (\<forall>n m. m < n \<longrightarrow> residue (?p ^ m) (f n) = f m)}
residue_ring ?m = \<lparr>carrier = {0..?m - 1}, monoid.mult = \<lambda>x y. x * y mod ?m, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod ?m\<rparr>
\<lbrakk>prime ?p; ?f \<in> padic_set ?p\<rbrakk> \<Longrightarrow> ?f 0 = 0

goal (1 subgoal):
 1. f m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f m = 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
 2. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f m = 0
[PROOF STEP]
have 1: "padic_a_inv p f m = 0"
[PROOF STATE]
proof (prove)
using this:
f m = 0

goal (1 subgoal):
 1. padic_a_inv p f m = 0
[PROOF STEP]
using residue_1_prop assms
[PROOF STATE]
proof (prove)
using this:
f m = 0
\<ominus>\<^bsub>residue_ring 1\<^esub> \<zero>\<^bsub>residue_ring 1\<^esub> = \<zero>\<^bsub>residue_ring 1\<^esub>
f \<in> padic_set p
prime p

goal (1 subgoal):
 1. padic_a_inv p f m = 0
[PROOF STEP]
by (simp add: True padic_a_inv_def residue_ring_def)
[PROOF STATE]
proof (state)
this:
padic_a_inv p f m = 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
 2. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_a_inv p f m = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
padic_a_inv p f m = 0

goal (1 subgoal):
 1. residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
using 0 1
[PROOF STATE]
proof (prove)
using this:
padic_a_inv p f m = 0
residue (p ^ m) (padic_a_inv p f n) = 0
padic_a_inv p f m = 0

goal (1 subgoal):
 1. residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
m \<noteq> 0

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
have 0: "f n \<in> carrier (residue_ring (p^n)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
using assms(1) padic_set_res_closed
[PROOF STATE]
proof (prove)
using this:
f \<in> padic_set p
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))

goal (1 subgoal):
 1. f n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f n \<in> carrier (residue_ring (p ^ n))

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
have 1: "padic_a_inv p f n = \<ominus>\<^bsub>residue_ring (p^n)\<^esub> (f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_a_inv p f n = \<ominus>\<^bsub>residue_ring (p ^ n)\<^esub> f n
[PROOF STEP]
using padic_a_inv_def
[PROOF STATE]
proof (prove)
using this:
padic_a_inv ?p ?f \<equiv> \<lambda>n. \<ominus>\<^bsub>residue_ring (?p ^ n)\<^esub> ?f n

goal (1 subgoal):
 1. padic_a_inv p f n = \<ominus>\<^bsub>residue_ring (p ^ n)\<^esub> f n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
padic_a_inv p f n = \<ominus>\<^bsub>residue_ring (p ^ n)\<^esub> f n

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
have 2: "padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p^m)\<^esub> (f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m
[PROOF STEP]
using  False padic_a_inv_def
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0
padic_a_inv ?p ?f \<equiv> \<lambda>n. \<ominus>\<^bsub>residue_ring (?p ^ n)\<^esub> ?f n

goal (1 subgoal):
 1. padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
have 3: "residue (p ^ m) \<in> ring_hom (residue_ring (p ^ n)) (residue_ring (p ^ m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (p ^ m) \<in> ring_hom (residue_ring (p ^ n)) (residue_ring (p ^ m))
[PROOF STEP]
using residue_hom_p False \<open>m < n\<close> assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?m \<le> ?n; 0 < ?m; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) \<in> ring_hom (residue_ring (?p ^ ?n)) (residue_ring (?p ^ ?m))
m \<noteq> 0
m < n
prime p

goal (1 subgoal):
 1. residue (p ^ m) \<in> ring_hom (residue_ring (p ^ n)) (residue_ring (p ^ m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
residue (p ^ m) \<in> ring_hom (residue_ring (p ^ n)) (residue_ring (p ^ m))

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
have 4: " cring (residue_ring (p ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring (residue_ring (p ^ n))
[PROOF STEP]
using \<open>m < n\<close> assms(2) prime_gt_1_int residues.cring residues.intro
[PROOF STATE]
proof (prove)
using this:
m < n
prime p
prime ?p \<Longrightarrow> 1 < ?p
residues ?m \<Longrightarrow> cring (residue_ring ?m)
1 < ?m \<Longrightarrow> residues ?m

goal (1 subgoal):
 1. cring (residue_ring (p ^ n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cring (residue_ring (p ^ n))

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
have 5: " cring (residue_ring (p ^ m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring (residue_ring (p ^ m))
[PROOF STEP]
using False assms(2) prime_gt_1_int residues.cring residues.intro
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0
prime p
prime ?p \<Longrightarrow> 1 < ?p
residues ?m \<Longrightarrow> cring (residue_ring ?m)
1 < ?m \<Longrightarrow> residues ?m

goal (1 subgoal):
 1. cring (residue_ring (p ^ m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cring (residue_ring (p ^ m))

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
have  "ring_hom_cring (residue_ring (p ^ n))  (residue_ring (p ^ m)) (residue (p ^ m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_cring (residue_ring (p ^ n)) (residue_ring (p ^ m)) (residue (p ^ m))
[PROOF STEP]
using 3 4 5 UnivPoly.ring_hom_cringI
[PROOF STATE]
proof (prove)
using this:
residue (p ^ m) \<in> ring_hom (residue_ring (p ^ n)) (residue_ring (p ^ m))
cring (residue_ring (p ^ n))
cring (residue_ring (p ^ m))
\<lbrakk>cring ?R; cring ?S; ?h \<in> ring_hom ?R ?S\<rbrakk> \<Longrightarrow> ring_hom_cring ?R ?S ?h

goal (1 subgoal):
 1. ring_hom_cring (residue_ring (p ^ n)) (residue_ring (p ^ m)) (residue (p ^ m))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ring_hom_cring (residue_ring (p ^ n)) (residue_ring (p ^ m)) (residue (p ^ m))

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ring_hom_cring (residue_ring (p ^ n)) (residue_ring (p ^ m)) (residue (p ^ m))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ring_hom_cring (residue_ring (p ^ n)) (residue_ring (p ^ m)) (residue (p ^ m))

goal (1 subgoal):
 1. residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
using 0  1 2 ring_hom_cring.hom_a_inv
[PROOF STATE]
proof (prove)
using this:
ring_hom_cring (residue_ring (p ^ n)) (residue_ring (p ^ m)) (residue (p ^ m))
f n \<in> carrier (residue_ring (p ^ n))
padic_a_inv p f n = \<ominus>\<^bsub>residue_ring (p ^ n)\<^esub> f n
padic_a_inv p f m = \<ominus>\<^bsub>residue_ring (p ^ m)\<^esub> f m
\<lbrakk>ring_hom_cring ?R ?S ?h; ?x \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (\<ominus>\<^bsub>?R\<^esub> ?x) = \<ominus>\<^bsub>?S\<^esub> ?h ?x

goal (1 subgoal):
 1. residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m
[PROOF STEP]
by (metis \<open>m < n\<close> assms(1) assms(2) less_imp_le_nat padic_set_res_coherent)
[PROOF STATE]
proof (state)
this:
residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
residue (p ^ m) (padic_a_inv p f n) = padic_a_inv p f m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?m < ?n \<Longrightarrow> residue (p ^ ?m) (padic_a_inv p f ?n) = padic_a_inv p f ?m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma funpow_dist1_least:
  assumes "0 < n" "n < funpow_dist1 f x y" shows "(f ^^ n) x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ n) x \<noteq> y
[PROOF STEP]
proof (rule notI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f ^^ n) x = y \<Longrightarrow> False
[PROOF STEP]
assume "(f ^^ n) x = y"
[PROOF STATE]
proof (state)
this:
(f ^^ n) x = y

goal (1 subgoal):
 1. (f ^^ n) x = y \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f ^^ n) x = y
[PROOF STEP]
have "(f ^^ (n - 1)) (f x) = y"
[PROOF STATE]
proof (prove)
using this:
(f ^^ n) x = y

goal (1 subgoal):
 1. (f ^^ (n - 1)) (f x) = y
[PROOF STEP]
using \<open>0 < n\<close>
[PROOF STATE]
proof (prove)
using this:
(f ^^ n) x = y
0 < n

goal (1 subgoal):
 1. (f ^^ (n - 1)) (f x) = y
[PROOF STEP]
by (cases n) (simp_all add: funpow_swap1)
[PROOF STATE]
proof (state)
this:
(f ^^ (n - 1)) (f x) = y

goal (1 subgoal):
 1. (f ^^ n) x = y \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f ^^ (n - 1)) (f x) = y
[PROOF STEP]
have "funpow_dist f (f x) y \<le> n - 1"
[PROOF STATE]
proof (prove)
using this:
(f ^^ (n - 1)) (f x) = y

goal (1 subgoal):
 1. funpow_dist f (f x) y \<le> n - 1
[PROOF STEP]
unfolding funpow_dist_def
[PROOF STATE]
proof (prove)
using this:
(f ^^ (n - 1)) (f x) = y

goal (1 subgoal):
 1. (LEAST n. (f ^^ n) (f x) = y) \<le> n - 1
[PROOF STEP]
by (rule Least_le)
[PROOF STATE]
proof (state)
this:
funpow_dist f (f x) y \<le> n - 1

goal (1 subgoal):
 1. (f ^^ n) x = y \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
n < funpow_dist1 f x y
funpow_dist f (f x) y \<le> n - 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
0 < n
n < funpow_dist1 f x y
funpow_dist f (f x) y \<le> n - 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma kth_obs_mono: assumes \<open>is_kth_obs \<pi> k i\<close> \<open>is_kth_obs \<pi> l j\<close> \<open>k < l\<close> shows \<open>i < j\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < j
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> False
[PROOF STEP]
assume \<open>\<not> i < j\<close>
[PROOF STATE]
proof (state)
this:
\<not> i < j

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> False
[PROOF STEP]
hence \<open>{..<j} \<subseteq> {..<i}\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> i < j

goal (1 subgoal):
 1. {..<j} \<subseteq> {..<i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..<j} \<subseteq> {..<i}

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> False
[PROOF STEP]
hence \<open>obs_ids \<pi> \<inter> {..<j} \<subseteq> obs_ids \<pi> \<inter> {..<i}\<close>
[PROOF STATE]
proof (prove)
using this:
{..<j} \<subseteq> {..<i}

goal (1 subgoal):
 1. obs_ids \<pi> \<inter> {..<j} \<subseteq> obs_ids \<pi> \<inter> {..<i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
obs_ids \<pi> \<inter> {..<j} \<subseteq> obs_ids \<pi> \<inter> {..<i}

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
obs_ids \<pi> \<inter> {..<j} \<subseteq> obs_ids \<pi> \<inter> {..<i}

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> False
[PROOF STEP]
have \<open>finite (obs_ids \<pi> \<inter> {..<i})\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (obs_ids \<pi> \<inter> {..<i})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (obs_ids \<pi> \<inter> {..<i})

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
obs_ids \<pi> \<inter> {..<j} \<subseteq> obs_ids \<pi> \<inter> {..<i}
finite (obs_ids \<pi> \<inter> {..<i})
[PROOF STEP]
have \<open>card (obs_ids \<pi> \<inter> {..<j}) \<le> card (obs_ids \<pi> \<inter> {..<i})\<close>
[PROOF STATE]
proof (prove)
using this:
obs_ids \<pi> \<inter> {..<j} \<subseteq> obs_ids \<pi> \<inter> {..<i}
finite (obs_ids \<pi> \<inter> {..<i})

goal (1 subgoal):
 1. card (obs_ids \<pi> \<inter> {..<j}) \<le> card (obs_ids \<pi> \<inter> {..<i})
[PROOF STEP]
by (metis card_mono)
[PROOF STATE]
proof (state)
this:
card (obs_ids \<pi> \<inter> {..<j}) \<le> card (obs_ids \<pi> \<inter> {..<i})

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> False
[PROOF STEP]
thus \<open>False\<close>
[PROOF STATE]
proof (prove)
using this:
card (obs_ids \<pi> \<inter> {..<j}) \<le> card (obs_ids \<pi> \<inter> {..<i})

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card (obs_ids \<pi> \<inter> {..<j}) \<le> card (obs_ids \<pi> \<inter> {..<i})
is_kth_obs \<pi> k i
is_kth_obs \<pi> l j
k < l

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding is_kth_obs_def
[PROOF STATE]
proof (prove)
using this:
card (obs_ids \<pi> \<inter> {..<j}) \<le> card (obs_ids \<pi> \<inter> {..<i})
card (obs_ids \<pi> \<inter> {..<i}) = k \<and> local.att (\<pi> i) \<noteq> None
card (obs_ids \<pi> \<inter> {..<j}) = l \<and> local.att (\<pi> j) \<noteq> None
k < l

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_imp_locally_path_connected:
  fixes S :: "'a :: real_normed_vector set"
  assumes "open S"
  shows "locally path_connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally path_connected S
[PROOF STEP]
proof (rule locally_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. locally ?P S
 2. \<And>T. ?P T \<Longrightarrow> path_connected T
[PROOF STEP]
show "locally convex S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally convex S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
open S

goal (1 subgoal):
 1. locally convex S
[PROOF STEP]
unfolding locally_def
[PROOF STATE]
proof (prove)
using this:
open S

goal (1 subgoal):
 1. \<forall>w x. openin (top_of_set S) w \<and> x \<in> w \<longrightarrow> (\<exists>u v. openin (top_of_set S) u \<and> convex v \<and> x \<in> u \<and> u \<subseteq> v \<and> v \<subseteq> w)
[PROOF STEP]
by (meson open_ball centre_in_ball convex_ball openE open_subset openin_imp_subset openin_open_trans subset_trans)
[PROOF STATE]
proof (state)
this:
locally convex S

goal (1 subgoal):
 1. \<And>T. convex T \<Longrightarrow> path_connected T
[PROOF STEP]
show "\<And>T::'a set. convex T \<Longrightarrow> path_connected T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>T. convex T \<Longrightarrow> path_connected T
[PROOF STEP]
using convex_imp_path_connected
[PROOF STATE]
proof (prove)
using this:
convex ?S \<Longrightarrow> path_connected ?S

goal (1 subgoal):
 1. \<And>T. convex T \<Longrightarrow> path_connected T
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
convex ?T \<Longrightarrow> path_connected ?T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sub_design_isomorphism:
  assumes "sub_set_system V B \<V> \<B>"
  assumes "design V B"
  shows "design_isomorphism V B (\<pi> ` V) (blocks_image B \<pi>) \<pi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. design_isomorphism V B (\<pi> ` V) (blocks_image B \<pi>) \<pi>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. design_isomorphism V B (\<pi> ` V) (blocks_image B \<pi>) \<pi>
[PROOF STEP]
interpret design "(\<pi> ` V)" "(blocks_image B \<pi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. design (\<pi> ` V) (blocks_image B \<pi>)
[PROOF STEP]
by (simp add: assms(1) assms(2) subdesign_image_is_design)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. design_isomorphism V B (\<pi> ` V) (blocks_image B \<pi>) \<pi>
[PROOF STEP]
interpret des: design V B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. design V B
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. design_isomorphism V B (\<pi> ` V) (blocks_image B \<pi>) \<pi>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. design_isomorphism V B (\<pi> ` V) (blocks_image B \<pi>) \<pi>
[PROOF STEP]
proof (unfold_locales)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bij_betw \<pi> V (\<pi> ` V)
 2. image_mset ((`) \<pi>) B = blocks_image B \<pi>
[PROOF STEP]
show "bij_betw \<pi> V (\<pi> ` V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw \<pi> V (\<pi> ` V)
[PROOF STEP]
using bij
[PROOF STATE]
proof (prove)
using this:
bij_betw \<pi> \<V> \<V>'

goal (1 subgoal):
 1. bij_betw \<pi> V (\<pi> ` V)
[PROOF STEP]
by (metis assms(1) bij_betw_subset sub_set_system.points_subset)
[PROOF STATE]
proof (state)
this:
bij_betw \<pi> V (\<pi> ` V)

goal (1 subgoal):
 1. image_mset ((`) \<pi>) B = blocks_image B \<pi>
[PROOF STEP]
show "image_mset ((`) \<pi>) B = blocks_image B \<pi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset ((`) \<pi>) B = blocks_image B \<pi>
[PROOF STEP]
by (simp add: blocks_image_def)
[PROOF STATE]
proof (state)
this:
image_mset ((`) \<pi>) B = blocks_image B \<pi>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
design_isomorphism V B (\<pi> ` V) (blocks_image B \<pi>) \<pi>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permut_length:
  assumes "bij_betw f {..< length as} {..< length as}"
  shows "length (permut as f) = length as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (permut as f) = length as
[PROOF STEP]
using permut_aux_length[OF assms]
[PROOF STATE]
proof (prove)
using this:
length (permut_aux as f as) = length as

goal (1 subgoal):
 1. length (permut as f) = length as
[PROOF STEP]
by simp


[STATEMENT]
lemma isolated_singularity_at_divide[singularity_intros]:
  assumes f_iso:"isolated_singularity_at f z"
      and g_iso:"isolated_singularity_at g z"
      and g_ness:"not_essential g z"
    shows "isolated_singularity_at (\<lambda>w. f w / g w) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolated_singularity_at (\<lambda>w. f w / g w) z
[PROOF STEP]
using isolated_singularity_at_inverse[THEN isolated_singularity_at_times[OF f_iso,
          of "\<lambda>w. inverse (g w)"],OF g_iso g_ness]
[PROOF STATE]
proof (prove)
using this:
isolated_singularity_at (\<lambda>w. f w * inverse (g w)) z

goal (1 subgoal):
 1. isolated_singularity_at (\<lambda>w. f w / g w) z
[PROOF STEP]
by (simp add:field_simps)


[STATEMENT]
lemma wf_iff_wfp_on:
  "wf p \<longleftrightarrow> wfp_on (\<lambda>a b. (a, b) \<in> p) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf p = wfp_on (\<lambda>a b. (a, b) \<in> p) UNIV
[PROOF STEP]
unfolding wfp_on_iff_inductive_on wf_def inductive_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>P. (\<forall>x. (\<forall>y. (y, x) \<in> p \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> All P) = (\<forall>Q. (\<forall>y\<in>UNIV. (\<forall>x\<in>UNIV. (x, y) \<in> p \<longrightarrow> Q x) \<longrightarrow> Q y) \<longrightarrow> Ball UNIV Q)
[PROOF STEP]
by force


[STATEMENT]
lemma powreal_zero_eq_one [simp]: "a > 0 \<Longrightarrow> a pow\<^sub>\<real> 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> a pow\<^sub>\<real> 0 = 1
[PROOF STEP]
by (auto dest: real_inverse_ge_one_lemma simp add: powreal_def)


[STATEMENT]
lemma ideal_insert_polynomial_bool_swap: \<open>r - s \<in> ideal polynomial_bool \<Longrightarrow>
  More_Modules.ideal (insert r  (A \<union> polynomial_bool)) = More_Modules.ideal (insert s (A \<union> polynomial_bool))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r - s \<in> More_Modules.ideal polynomial_bool \<Longrightarrow> More_Modules.ideal (insert r (A \<union> polynomial_bool)) = More_Modules.ideal (insert s (A \<union> polynomial_bool))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>r - s \<in> More_Modules.ideal polynomial_bool; x \<in> More_Modules.ideal (insert r (A \<union> polynomial_bool))\<rbrakk> \<Longrightarrow> x \<in> More_Modules.ideal (insert s (A \<union> polynomial_bool))
 2. \<And>x. \<lbrakk>r - s \<in> More_Modules.ideal polynomial_bool; x \<in> More_Modules.ideal (insert s (A \<union> polynomial_bool))\<rbrakk> \<Longrightarrow> x \<in> More_Modules.ideal (insert r (A \<union> polynomial_bool))
[PROOF STEP]
using ideal.eq_span_insert_eq ideal.span_mono sup_ge2
[PROOF STATE]
proof (prove)
using this:
?x - ?y \<in> More_Modules.ideal ?S \<Longrightarrow> More_Modules.ideal (insert ?x ?S) = More_Modules.ideal (insert ?y ?S)
?A \<subseteq> ?B \<Longrightarrow> More_Modules.ideal ?A \<subseteq> More_Modules.ideal ?B
?y \<le> sup ?x ?y

goal (2 subgoals):
 1. \<And>x. \<lbrakk>r - s \<in> More_Modules.ideal polynomial_bool; x \<in> More_Modules.ideal (insert r (A \<union> polynomial_bool))\<rbrakk> \<Longrightarrow> x \<in> More_Modules.ideal (insert s (A \<union> polynomial_bool))
 2. \<And>x. \<lbrakk>r - s \<in> More_Modules.ideal polynomial_bool; x \<in> More_Modules.ideal (insert s (A \<union> polynomial_bool))\<rbrakk> \<Longrightarrow> x \<in> More_Modules.ideal (insert r (A \<union> polynomial_bool))
[PROOF STEP]
apply blast+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem ta_empty_lang[simp]: "ta_lang ta_empty = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_lang ta_empty = {}
[PROOF STEP]
by (auto simp add: ta_empty_def ta_lang_def)


[STATEMENT]
theorem ptolemy:
  fixes A B C D center :: "real ^ 2"
  assumes "dist center A = radius" and "dist center B = radius"
  assumes "dist center C = radius" and "dist center D = radius"
  assumes ordering_of_points:
    "radiant_of (A - center) \<le> radiant_of (B - center)"
    "radiant_of (B - center) \<le> radiant_of (C - center)"
    "radiant_of (C - center) \<le> radiant_of (D - center)"
  shows "dist A C * dist B D = dist A B * dist C D + dist A D * dist B C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
from \<open>dist center A = radius\<close>
[PROOF STATE]
proof (chain)
picking this:
dist center A = radius
[PROOF STEP]
have "0 \<le> radius"
[PROOF STATE]
proof (prove)
using this:
dist center A = radius

goal (1 subgoal):
 1. 0 \<le> radius
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> radius

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
define \<alpha> \<beta> \<gamma> \<delta>
    where "\<alpha> = radiant_of (A - center)" and "\<beta> = radiant_of (B - center)"
    and "\<gamma> = radiant_of (C - center)" and "\<delta> = radiant_of (D - center)"
[PROOF STATE]
proof (state)
this:
\<alpha> = radiant_of (A - center)
\<beta> = radiant_of (B - center)
\<gamma> = radiant_of (C - center)
\<delta> = radiant_of (D - center)

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
from ordering_of_points
[PROOF STATE]
proof (chain)
picking this:
radiant_of (A - center) \<le> radiant_of (B - center)
radiant_of (B - center) \<le> radiant_of (C - center)
radiant_of (C - center) \<le> radiant_of (D - center)
[PROOF STEP]
have angle_basics:
    "\<alpha> \<le> \<beta>" "\<beta> \<le> \<gamma>" "\<gamma> \<le> \<delta>"
    "0 \<le> \<alpha>" "\<alpha> \<le> 2 * pi" "0 \<le> \<beta>" "\<beta> \<le> 2 * pi"
    "0 \<le> \<gamma>" "\<gamma> \<le> 2 * pi" "0 \<le> \<delta>" "\<delta> \<le> 2 * pi"
[PROOF STATE]
proof (prove)
using this:
radiant_of (A - center) \<le> radiant_of (B - center)
radiant_of (B - center) \<le> radiant_of (C - center)
radiant_of (C - center) \<le> radiant_of (D - center)

goal (1 subgoal):
 1. ((\<alpha> \<le> \<beta> &&& \<beta> \<le> \<gamma>) &&& \<gamma> \<le> \<delta> &&& 0 \<le> \<alpha> &&& \<alpha> \<le> 2 * pi) &&& (0 \<le> \<beta> &&& \<beta> \<le> 2 * pi &&& 0 \<le> \<gamma>) &&& \<gamma> \<le> 2 * pi &&& 0 \<le> \<delta> &&& \<delta> \<le> 2 * pi
[PROOF STEP]
unfolding \<alpha>_def \<beta>_def \<gamma>_def \<delta>_def
[PROOF STATE]
proof (prove)
using this:
radiant_of (A - center) \<le> radiant_of (B - center)
radiant_of (B - center) \<le> radiant_of (C - center)
radiant_of (C - center) \<le> radiant_of (D - center)

goal (1 subgoal):
 1. ((radiant_of (A - center) \<le> radiant_of (B - center) &&& radiant_of (B - center) \<le> radiant_of (C - center)) &&& radiant_of (C - center) \<le> radiant_of (D - center) &&& 0 \<le> radiant_of (A - center) &&& radiant_of (A - center) \<le> 2 * pi) &&& (0 \<le> radiant_of (B - center) &&& radiant_of (B - center) \<le> 2 * pi &&& 0 \<le> radiant_of (C - center)) &&& radiant_of (C - center) \<le> 2 * pi &&& 0 \<le> radiant_of (D - center) &&& radiant_of (D - center) \<le> 2 * pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<alpha> \<le> \<beta>
\<beta> \<le> \<gamma>
\<gamma> \<le> \<delta>
0 \<le> \<alpha>
\<alpha> \<le> 2 * pi
0 \<le> \<beta>
\<beta> \<le> 2 * pi
0 \<le> \<gamma>
\<gamma> \<le> 2 * pi
0 \<le> \<delta>
\<delta> \<le> 2 * pi

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
from assms(1-4)
[PROOF STATE]
proof (chain)
picking this:
dist center A = radius
dist center B = radius
dist center C = radius
dist center D = radius
[PROOF STEP]
have
    "A = center + radius *\<^sub>R of_radiant \<alpha>" "B = center + radius *\<^sub>R of_radiant \<beta>"
    "C = center + radius *\<^sub>R of_radiant \<gamma>" "D = center + radius *\<^sub>R of_radiant \<delta>"
[PROOF STATE]
proof (prove)
using this:
dist center A = radius
dist center B = radius
dist center C = radius
dist center D = radius

goal (1 subgoal):
 1. (A = center + radius *\<^sub>R of_radiant \<alpha> &&& B = center + radius *\<^sub>R of_radiant \<beta>) &&& C = center + radius *\<^sub>R of_radiant \<gamma> &&& D = center + radius *\<^sub>R of_radiant \<delta>
[PROOF STEP]
unfolding \<alpha>_def \<beta>_def \<gamma>_def \<delta>_def
[PROOF STATE]
proof (prove)
using this:
dist center A = radius
dist center B = radius
dist center C = radius
dist center D = radius

goal (1 subgoal):
 1. (A = center + radius *\<^sub>R of_radiant (radiant_of (A - center)) &&& B = center + radius *\<^sub>R of_radiant (radiant_of (B - center))) &&& C = center + radius *\<^sub>R of_radiant (radiant_of (C - center)) &&& D = center + radius *\<^sub>R of_radiant (radiant_of (D - center))
[PROOF STEP]
using relative_polar_form_eq dist_commute
[PROOF STATE]
proof (prove)
using this:
dist center A = radius
dist center B = radius
dist center C = radius
dist center D = radius
?Q + dist ?P ?Q *\<^sub>R of_radiant (radiant_of (?P - ?Q)) = ?P
dist ?x ?y = dist ?y ?x

goal (1 subgoal):
 1. (A = center + radius *\<^sub>R of_radiant (radiant_of (A - center)) &&& B = center + radius *\<^sub>R of_radiant (radiant_of (B - center))) &&& C = center + radius *\<^sub>R of_radiant (radiant_of (C - center)) &&& D = center + radius *\<^sub>R of_radiant (radiant_of (D - center))
[PROOF STEP]
by metis+
[PROOF STATE]
proof (state)
this:
A = center + radius *\<^sub>R of_radiant \<alpha>
B = center + radius *\<^sub>R of_radiant \<beta>
C = center + radius *\<^sub>R of_radiant \<gamma>
D = center + radius *\<^sub>R of_radiant \<delta>

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
A = center + radius *\<^sub>R of_radiant \<alpha>
B = center + radius *\<^sub>R of_radiant \<beta>
C = center + radius *\<^sub>R of_radiant \<gamma>
D = center + radius *\<^sub>R of_radiant \<delta>
[PROOF STEP]
have dist_eqs:
    "dist A C = 2 * radius * sin ((\<gamma> - \<alpha>) / 2)"
    "dist B D = 2 * radius * sin ((\<delta> - \<beta>) / 2)"
    "dist A B = 2 * radius * sin ((\<beta> - \<alpha>) / 2)"
    "dist C D = 2 * radius * sin ((\<delta> - \<gamma>) / 2)"
    "dist A D = 2 * radius * sin ((\<delta> - \<alpha>) / 2)"
    "dist B C = 2 * radius * sin ((\<gamma> - \<beta>) / 2)"
[PROOF STATE]
proof (prove)
using this:
A = center + radius *\<^sub>R of_radiant \<alpha>
B = center + radius *\<^sub>R of_radiant \<beta>
C = center + radius *\<^sub>R of_radiant \<gamma>
D = center + radius *\<^sub>R of_radiant \<delta>

goal (1 subgoal):
 1. (dist A C = 2 * radius * sin ((\<gamma> - \<alpha>) / 2) &&& dist B D = 2 * radius * sin ((\<delta> - \<beta>) / 2) &&& dist A B = 2 * radius * sin ((\<beta> - \<alpha>) / 2)) &&& dist C D = 2 * radius * sin ((\<delta> - \<gamma>) / 2) &&& dist A D = 2 * radius * sin ((\<delta> - \<alpha>) / 2) &&& dist B C = 2 * radius * sin ((\<gamma> - \<beta>) / 2)
[PROOF STEP]
using angle_basics \<open>radius \<ge> 0\<close> dist_circle_segment
[PROOF STATE]
proof (prove)
using this:
A = center + radius *\<^sub>R of_radiant \<alpha>
B = center + radius *\<^sub>R of_radiant \<beta>
C = center + radius *\<^sub>R of_radiant \<gamma>
D = center + radius *\<^sub>R of_radiant \<delta>
\<alpha> \<le> \<beta>
\<beta> \<le> \<gamma>
\<gamma> \<le> \<delta>
0 \<le> \<alpha>
\<alpha> \<le> 2 * pi
0 \<le> \<beta>
\<beta> \<le> 2 * pi
0 \<le> \<gamma>
\<gamma> \<le> 2 * pi
0 \<le> \<delta>
\<delta> \<le> 2 * pi
0 \<le> radius
\<lbrakk>0 \<le> ?radius; 0 \<le> ?\<alpha>; ?\<alpha> \<le> ?\<beta>; ?\<beta> \<le> 2 * pi\<rbrakk> \<Longrightarrow> dist (?center + ?radius *\<^sub>R of_radiant ?\<alpha>) (?center + ?radius *\<^sub>R of_radiant ?\<beta>) = 2 * ?radius * sin ((?\<beta> - ?\<alpha>) / 2)

goal (1 subgoal):
 1. (dist A C = 2 * radius * sin ((\<gamma> - \<alpha>) / 2) &&& dist B D = 2 * radius * sin ((\<delta> - \<beta>) / 2) &&& dist A B = 2 * radius * sin ((\<beta> - \<alpha>) / 2)) &&& dist C D = 2 * radius * sin ((\<delta> - \<gamma>) / 2) &&& dist A D = 2 * radius * sin ((\<delta> - \<alpha>) / 2) &&& dist B C = 2 * radius * sin ((\<gamma> - \<beta>) / 2)
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
dist A C = 2 * radius * sin ((\<gamma> - \<alpha>) / 2)
dist B D = 2 * radius * sin ((\<delta> - \<beta>) / 2)
dist A B = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
dist C D = 2 * radius * sin ((\<delta> - \<gamma>) / 2)
dist A D = 2 * radius * sin ((\<delta> - \<alpha>) / 2)
dist B C = 2 * radius * sin ((\<gamma> - \<beta>) / 2)

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
have "dist A C * dist B D = 4 * radius ^ 2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist A C * dist B D = 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2)
[PROOF STEP]
unfolding dist_eqs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * radius * sin ((\<gamma> - \<alpha>) / 2) * (2 * radius * sin ((\<delta> - \<beta>) / 2)) = 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
dist A C * dist B D = 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2)

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist A C * dist B D = 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2)

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
have "\<dots> = 4 * radius ^ 2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
define \<omega>\<^sub>1 \<omega>\<^sub>2 \<omega>\<^sub>3 where "\<omega>\<^sub>1 = (\<beta> - \<alpha>) / 2" and "\<omega>\<^sub>2 = (\<gamma> - \<beta>) / 2" and "\<omega>\<^sub>3 = (\<delta> - \<gamma>) / 2"
[PROOF STATE]
proof (state)
this:
\<omega>\<^sub>1 = (\<beta> - \<alpha>) / 2
\<omega>\<^sub>2 = (\<gamma> - \<beta>) / 2
\<omega>\<^sub>3 = (\<delta> - \<gamma>) / 2

goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
have "(\<gamma> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2" and "(\<delta> - \<beta>) / 2 = \<omega>\<^sub>2 + \<omega>\<^sub>3" and "(\<delta> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<gamma> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2 &&& (\<delta> - \<beta>) / 2 = \<omega>\<^sub>2 + \<omega>\<^sub>3 &&& (\<delta> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3
[PROOF STEP]
unfolding \<omega>\<^sub>1_def \<omega>\<^sub>2_def \<omega>\<^sub>3_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<gamma> - \<alpha>) / 2 = (\<beta> - \<alpha>) / 2 + (\<gamma> - \<beta>) / 2 &&& (\<delta> - \<beta>) / 2 = (\<gamma> - \<beta>) / 2 + (\<delta> - \<gamma>) / 2 &&& (\<delta> - \<alpha>) / 2 = (\<beta> - \<alpha>) / 2 + (\<gamma> - \<beta>) / 2 + (\<delta> - \<gamma>) / 2
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<gamma> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2
(\<delta> - \<beta>) / 2 = \<omega>\<^sub>2 + \<omega>\<^sub>3
(\<delta> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3

goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
have "sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = sin (\<omega>\<^sub>1 + \<omega>\<^sub>2) * sin (\<omega>\<^sub>2 + \<omega>\<^sub>3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = sin (\<omega>\<^sub>1 + \<omega>\<^sub>2) * sin (\<omega>\<^sub>2 + \<omega>\<^sub>3)
[PROOF STEP]
using \<open>(\<gamma> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2\<close> \<open>(\<delta> - \<beta>) / 2 = \<omega>\<^sub>2 + \<omega>\<^sub>3\<close>
[PROOF STATE]
proof (prove)
using this:
(\<gamma> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2
(\<delta> - \<beta>) / 2 = \<omega>\<^sub>2 + \<omega>\<^sub>3

goal (1 subgoal):
 1. sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = sin (\<omega>\<^sub>1 + \<omega>\<^sub>2) * sin (\<omega>\<^sub>2 + \<omega>\<^sub>3)
[PROOF STEP]
by (simp only:)
[PROOF STATE]
proof (state)
this:
sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = sin (\<omega>\<^sub>1 + \<omega>\<^sub>2) * sin (\<omega>\<^sub>2 + \<omega>\<^sub>3)

goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = sin (\<omega>\<^sub>1 + \<omega>\<^sub>2) * sin (\<omega>\<^sub>2 + \<omega>\<^sub>3)

goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
have "\<dots> = sin \<omega>\<^sub>1 * sin \<omega>\<^sub>3 + sin \<omega>\<^sub>2 * sin (\<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (\<omega>\<^sub>1 + \<omega>\<^sub>2) * sin (\<omega>\<^sub>2 + \<omega>\<^sub>3) = sin \<omega>\<^sub>1 * sin \<omega>\<^sub>3 + sin \<omega>\<^sub>2 * sin (\<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3)
[PROOF STEP]
by (rule ptolemy_trigonometric)
[PROOF STATE]
proof (state)
this:
sin (\<omega>\<^sub>1 + \<omega>\<^sub>2) * sin (\<omega>\<^sub>2 + \<omega>\<^sub>3) = sin \<omega>\<^sub>1 * sin \<omega>\<^sub>3 + sin \<omega>\<^sub>2 * sin (\<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3)

goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sin (\<omega>\<^sub>1 + \<omega>\<^sub>2) * sin (\<omega>\<^sub>2 + \<omega>\<^sub>3) = sin \<omega>\<^sub>1 * sin \<omega>\<^sub>3 + sin \<omega>\<^sub>2 * sin (\<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3)

goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
have "\<dots> = (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin \<omega>\<^sub>1 * sin \<omega>\<^sub>3 + sin \<omega>\<^sub>2 * sin (\<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3) = sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2)
[PROOF STEP]
using \<omega>\<^sub>1_def \<omega>\<^sub>2_def \<omega>\<^sub>3_def \<open>(\<delta> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3\<close>
[PROOF STATE]
proof (prove)
using this:
\<omega>\<^sub>1 = (\<beta> - \<alpha>) / 2
\<omega>\<^sub>2 = (\<gamma> - \<beta>) / 2
\<omega>\<^sub>3 = (\<delta> - \<gamma>) / 2
(\<delta> - \<alpha>) / 2 = \<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3

goal (1 subgoal):
 1. sin \<omega>\<^sub>1 * sin \<omega>\<^sub>3 + sin \<omega>\<^sub>2 * sin (\<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3) = sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2)
[PROOF STEP]
by (simp only:)
[PROOF STATE]
proof (state)
this:
sin \<omega>\<^sub>1 * sin \<omega>\<^sub>3 + sin \<omega>\<^sub>2 * sin (\<omega>\<^sub>1 + \<omega>\<^sub>2 + \<omega>\<^sub>3) = sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2)

goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2)

goal (1 subgoal):
 1. 4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
4 * radius\<^sup>2 * sin ((\<gamma> - \<alpha>) / 2) * sin ((\<delta> - \<beta>) / 2) = 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2))

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
have "\<dots> = dist A B * dist C D + dist A D * dist B C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2)) = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
unfolding dist_eqs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2)) = 2 * radius * sin ((\<beta> - \<alpha>) / 2) * (2 * radius * sin ((\<delta> - \<gamma>) / 2)) + 2 * radius * sin ((\<delta> - \<alpha>) / 2) * (2 * radius * sin ((\<gamma> - \<beta>) / 2))
[PROOF STEP]
by (simp add: distrib_left power2_eq_square)
[PROOF STATE]
proof (state)
this:
4 * radius\<^sup>2 * (sin ((\<beta> - \<alpha>) / 2) * sin ((\<delta> - \<gamma>) / 2) + sin ((\<gamma> - \<beta>) / 2) * sin ((\<delta> - \<alpha>) / 2)) = dist A B * dist C D + dist A D * dist B C

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist A C * dist B D = dist A B * dist C D + dist A D * dist B C

goal (1 subgoal):
 1. dist A C * dist B D = dist A B * dist C D + dist A D * dist B C
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist A C * dist B D = dist A B * dist C D + dist A D * dist B C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma keys_minus_higher: "keys (p - higher p v) = {u \<in> keys p. u \<preceq>\<^sub>t v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (p - higher p v) = {u \<in> keys p. u \<preceq>\<^sub>t v}
[PROOF STEP]
by (rule set_eqI, simp add: lookup_minus_higher conj_commute flip: lookup_not_eq_zero_eq_in_keys)


[STATEMENT]
lemma landau_symbol_at_top_imp_at:
  "(\<lambda>x. f (a - inverse x)) \<in> L' at_top (\<lambda>x. g (a - inverse x)) \<Longrightarrow>
   (\<lambda>x. f (a + inverse x)) \<in> L' at_top (\<lambda>x. g (a + inverse x)) \<Longrightarrow>
   f \<in> L (at a) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. f (a - inverse x)) \<in> L' at_top (\<lambda>x. g (a - inverse x)); (\<lambda>x. f (a + inverse x)) \<in> L' at_top (\<lambda>x. g (a + inverse x))\<rbrakk> \<Longrightarrow> f \<in> L (at a) g
[PROOF STEP]
by (simp add: sup at_eq_sup_left_right
        landau_symbol_at_top_imp_at_left landau_symbol_at_top_imp_at_right)


[STATEMENT]
lemma convex_condition_imp_convex:
  assumes "is_convex_condition I"
  shows "is_convex (I \<alpha> \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_convex (I \<alpha> \<beta>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_convex_condition I

goal (1 subgoal):
 1. is_convex (I \<alpha> \<beta>)
[PROOF STEP]
unfolding is_convex_condition_def
[PROOF STATE]
proof (prove)
using this:
I = closed_interval \<or> I = left_closed_interval \<or> I = closed_ray \<or> I = open_ray

goal (1 subgoal):
 1. is_convex (I \<alpha> \<beta>)
[PROOF STEP]
by (meson closed_interval_is_convex closed_ray_is_convex left_closed_interval_is_convex open_ray_is_convex)


[STATEMENT]
lemma ex1I_alt: "(\<exists>x. P x \<and> (\<forall>y. P y \<longrightarrow> x = y)) \<Longrightarrow> (\<exists>!x. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. P x \<and> (\<forall>y. P y \<longrightarrow> x = y) \<Longrightarrow> \<exists>!x. P x
[PROOF STEP]
by auto


[STATEMENT]
lemma IntegralI:
  assumes "\<And>e. 0 < e \<Longrightarrow>
    \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e)"
  shows "Integral (a, b) f k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Integral (a, b) f k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < ?e)

goal (1 subgoal):
 1. Integral (a, b) f k
[PROOF STEP]
unfolding Integral_def
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < ?e)

goal (1 subgoal):
 1. (case (a, b) of (a, b) \<Rightarrow> \<lambda>f k. \<forall>e>0. \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e)) f k
[PROOF STEP]
by auto


[STATEMENT]
lemma iWeakUntil_iUntil_conj_conv: "
  (P t1. t1 \<W> t2 I. Q t2) =
  (\<not> (\<not> Q t1. t1 \<U> t2 I. (\<not> P t2 \<and> \<not> Q t2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P t1. t1 \<W> t2 I. Q t2) = (\<not> (\<not> Q t1. t1 \<U> t2 I. \<not> P t2 \<and> \<not> Q t2))
[PROOF STEP]
apply (subst iWeakUntil_disj_iWeakUntil_conv[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iWeakUntil I (\<lambda>t1. P t1 \<or> Q t1) Q = (\<not> (\<not> Q t1. t1 \<U> t2 I. \<not> P t2 \<and> \<not> Q t2))
[PROOF STEP]
apply (subst de_Morgan_disj[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iWeakUntil I (\<lambda>t1. P t1 \<or> Q t1) Q = (\<not> (\<not> Q t1. t1 \<U> t2 I. \<not> (P t2 \<or> Q t2)))
[PROOF STEP]
apply (subst iWeakUntil_conj_iUntil_conv[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iWeakUntil I (\<lambda>t1. P t1 \<or> Q t1) Q = (P t1 \<or> Q t1. t1 \<W> t2 I. (P t2 \<or> Q t2) \<and> Q t2)
[PROOF STEP]
apply (simp add: conj_disj_distribR conj_disj_absorb)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma expands_to_imp_eventually_nz:
  assumes "basis_wf basis" "(f expands_to F) basis" "trimmed F"
  shows   "eventually (\<lambda>x. f x \<noteq> 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
using trimmed_imp_eventually_nz[OF assms(1), of F] assms(2,3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_expansion F basis; trimmed F\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. eval F x \<noteq> 0
(f expands_to F) basis
trimmed F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
by (auto simp: expands_to.simps elim: eventually_elim2)


[STATEMENT]
lemma ceiling_numeral_power [simp]: "\<lceil>numeral x ^ n\<rceil> = numeral x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>numeral x ^ n\<rceil> = numeral x ^ n
[PROOF STEP]
by (metis ceiling_of_int of_int_numeral of_int_power)


[STATEMENT]
lemma rtrancl_listrel1_ConsI2:
  "(x,y) \<in> r\<^sup>* \<Longrightarrow> (xs, ys) \<in> (listrel1 r)\<^sup>* \<Longrightarrow> (x # xs, y # ys) \<in> (listrel1 r)\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> r\<^sup>*; (xs, ys) \<in> (listrel1 r)\<^sup>*\<rbrakk> \<Longrightarrow> (x # xs, y # ys) \<in> (listrel1 r)\<^sup>*
[PROOF STEP]
by (meson in_mono listrel1I1 listrel1_rtrancl_subset_rtrancl_listrel1 rtrancl_listrel1_ConsI1 rtrancl_trans)


[STATEMENT]
lemma scalar_prod_inc_vec_mat_inter_num:
  assumes "j1 < dim_col M" "j2 < dim_col M"
  shows "(col M j1) \<bullet> (col M j2) = of_nat (mat_inter_num M j1 j2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
have split: "{0..<dim_row M} = {i \<in> {0..<dim_row M} . (M $$ (i, j1) = 1) \<and> (M $$ (i, j2) = 1) } \<union>
    {i \<in> {0..<dim_row M} . M $$ (i, j1) = 0 \<or> M $$ (i, j2) = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<dim_row M} = {i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<union> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)}
[PROOF STEP]
using assms M_not_zero_simp
[PROOF STATE]
proof (prove)
using this:
j1 < dim_col M
j2 < dim_col M
\<lbrakk>?j < dim_col M; ?i < dim_row M; M $$ (?i, ?j) \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> M $$ (?i, ?j) = (1::'b)

goal (1 subgoal):
 1. {0..<dim_row M} = {i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<union> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<dim_row M} = {i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<union> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)}

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
have inter: "{i \<in> {0..<dim_row M} . (M $$ (i, j1) = 1) \<and> (M $$ (i, j2) = 1) } \<inter>
    {i \<in> {0..<dim_row M} . M $$ (i, j1) = 0 \<or> M $$ (i, j2) = 0} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<inter> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<inter> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)} = {}

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
have "(col M j1) \<bullet> (col M j2) = (\<Sum> i \<in> {0..<dim_row M} . (col M j1) $ i * (col M j2) $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = (\<Sum>i = 0..<dim_row M. col M j1 $ i * col M j2 $ i)
[PROOF STEP]
using assms scalar_prod_def
[PROOF STATE]
proof (prove)
using this:
j1 < dim_col M
j2 < dim_col M
?v \<bullet> ?w \<equiv> \<Sum>i = 0..<dim_vec ?w. ?v $ i * ?w $ i

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = (\<Sum>i = 0..<dim_row M. col M j1 $ i * col M j2 $ i)
[PROOF STEP]
by (metis (full_types) dim_col)
[PROOF STATE]
proof (state)
this:
col M j1 \<bullet> col M j2 = (\<Sum>i = 0..<dim_row M. col M j1 $ i * col M j2 $ i)

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
col M j1 \<bullet> col M j2 = (\<Sum>i = 0..<dim_row M. col M j1 $ i * col M j2 $ i)

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
have "... = (\<Sum> i \<in> {0..<dim_row M} . M $$ (i, j1) * M $$ (i, j2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row M. col M j1 $ i * col M j2 $ i) = (\<Sum>i = 0..<dim_row M. M $$ (i, j1) * M $$ (i, j2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j1 < dim_col M
j2 < dim_col M

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row M. col M j1 $ i * col M j2 $ i) = (\<Sum>i = 0..<dim_row M. M $$ (i, j1) * M $$ (i, j2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_row M. col M j1 $ i * col M j2 $ i) = (\<Sum>i = 0..<dim_row M. M $$ (i, j1) * M $$ (i, j2))

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_row M. col M j1 $ i * col M j2 $ i) = (\<Sum>i = 0..<dim_row M. M $$ (i, j1) * M $$ (i, j2))

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
have "... = (\<Sum> i \<in> {i \<in> {0..<dim_row M} . (M $$ (i, j1) = 1) \<and> (M $$ (i, j2) = 1) } . M $$ (i, j1) * M $$ (i, j2))
      + (\<Sum> i \<in> {i \<in> {0..<dim_row M} . M $$ (i, j1) = 0 \<or> M $$ (i, j2) = 0} . M $$ (i, j1) * M $$ (i, j2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row M. M $$ (i, j1) * M $$ (i, j2)) = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). M $$ (i, j1) * M $$ (i, j2)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). M $$ (i, j1) * M $$ (i, j2))
[PROOF STEP]
using split inter sum.union_disjoint[of " {i \<in> {0..<dim_row M} . (M $$ (i, j1) = 1) \<and> (M $$ (i, j2) = 1)}"
      "{i \<in> {0..<dim_row M} . M $$ (i, j1) = 0 \<or> M $$ (i, j2) = 0}" "\<lambda> i . M $$ (i, j1) * M $$ (i, j2)"]
[PROOF STATE]
proof (prove)
using this:
{0..<dim_row M} = {i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<union> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)}
{i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<inter> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)} = {}
\<lbrakk>finite {i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)}; finite {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)}; {i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<inter> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)} = {}\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>{i \<in> {0..<dim_row M}. M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)} \<union> {i \<in> {0..<dim_row M}. M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)}. M $$ (i, j1) * M $$ (i, j2)) = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). M $$ (i, j1) * M $$ (i, j2)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). M $$ (i, j1) * M $$ (i, j2))

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row M. M $$ (i, j1) * M $$ (i, j2)) = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). M $$ (i, j1) * M $$ (i, j2)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). M $$ (i, j1) * M $$ (i, j2))
[PROOF STEP]
by (metis (no_types, lifting) finite_Un finite_atLeastLessThan)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_row M. M $$ (i, j1) * M $$ (i, j2)) = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). M $$ (i, j1) * M $$ (i, j2)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). M $$ (i, j1) * M $$ (i, j2))

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_row M. M $$ (i, j1) * M $$ (i, j2)) = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). M $$ (i, j1) * M $$ (i, j2)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). M $$ (i, j1) * M $$ (i, j2))

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
have "... = (\<Sum> i \<in> {i \<in> {0..<dim_row M} . (M $$ (i, j1) = 1) \<and> (M $$ (i, j2) = 1) } . 1)
      + (\<Sum> i \<in> {i \<in> {0..<dim_row M} . M $$ (i, j1) = 0 \<or> M $$ (i, j2) = 0} . 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). M $$ (i, j1) * M $$ (i, j2)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). M $$ (i, j1) * M $$ (i, j2)) = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). (1::'b)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). (0::'b))
[PROOF STEP]
using sum.cong mem_Collect_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A = ?B; \<And>x. x \<in> ?B \<Longrightarrow> ?g x = ?h x\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?h ?B
(?a \<in> Collect ?P) = ?P ?a

goal (1 subgoal):
 1. (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). M $$ (i, j1) * M $$ (i, j2)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). M $$ (i, j1) * M $$ (i, j2)) = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). (1::'b)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). (0::'b))
[PROOF STEP]
by (smt (z3) mult.right_neutral mult_not_zero)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). M $$ (i, j1) * M $$ (i, j2)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). M $$ (i, j1) * M $$ (i, j2)) = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). (1::'b)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). (0::'b))

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
col M j1 \<bullet> col M j2 = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). (1::'b)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). (0::'b))
[PROOF STEP]
have "(col M j1) \<bullet> (col M j2) =
      of_nat (card {i . i < dim_row M \<and> (M $$ (i, j1) = 1) \<and> (M $$ (i, j2) = 1)})"
[PROOF STATE]
proof (prove)
using this:
col M j1 \<bullet> col M j2 = (\<Sum>i | i \<in> {0..<dim_row M} \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b). (1::'b)) + (\<Sum>i | i \<in> {0..<dim_row M} \<and> (M $$ (i, j1) = (0::'b) \<or> M $$ (i, j2) = (0::'b)). (0::'b))

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (card {i. i < dim_row M \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
col M j1 \<bullet> col M j2 = of_nat (card {i. i < dim_row M \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)})

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
col M j1 \<bullet> col M j2 = of_nat (card {i. i < dim_row M \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
col M j1 \<bullet> col M j2 = of_nat (card {i. i < dim_row M \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)})

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
using mat_inter_num_def[of M j1 j2]
[PROOF STATE]
proof (prove)
using this:
col M j1 \<bullet> col M j2 = of_nat (card {i. i < dim_row M \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)})
mat_inter_num M j1 j2 \<equiv> card {i. i < dim_row M \<and> M $$ (i, j1) = (1::'b) \<and> M $$ (i, j2) = (1::'b)}

goal (1 subgoal):
 1. col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
col M j1 \<bullet> col M j2 = of_nat (mat_inter_num M j1 j2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) npMulElmL: "\<And> n. \<lbrakk> x \<in> carrier R; 0 \<le> n\<rbrakk>
        \<Longrightarrow> x \<cdot>\<^sub>r (npow R x n) = npow R x (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<in> carrier R; 0 \<le> n\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r x^\<^bsup>R n\<^esup> = x^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (simp only:npow_suc,
       frule_tac n = n and x = x in npClose,
       simp add:ring_tOp_commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


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


[STATEMENT]
lemma Rep_Abs_0: "Rep (Abs 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep (Abs 0) = 0
[PROOF STEP]
apply (rule Abs_inverse [of 0])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<in> {0..<int CARD('a)}
[PROOF STEP]
using size0
[PROOF STATE]
proof (prove)
using this:
0 < int CARD('a)

goal (1 subgoal):
 1. 0 \<in> {0..<int CARD('a)}
[PROOF STEP]
by simp


[STATEMENT]
lemma nn_integral_mono_measure:
  assumes "sets M = sets N" "M \<le> N" shows "nn_integral M f \<le> nn_integral N f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N M f \<le> integral\<^sup>N N f
[PROOF STEP]
unfolding nn_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (integral\<^sup>S M ` {g. simple_function M g \<and> g \<le> f}) \<le> Sup (integral\<^sup>S N ` {g. simple_function N g \<and> g \<le> f})
[PROOF STEP]
proof (intro SUP_subset_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {g. simple_function M g \<and> g \<le> f} \<subseteq> {g. simple_function N g \<and> g \<le> f}
 2. \<And>x. x \<in> {g. simple_function M g \<and> g \<le> f} \<Longrightarrow> integral\<^sup>S M x \<le> integral\<^sup>S N x
[PROOF STEP]
note \<open>sets M = sets N\<close>[simp]  \<open>sets M = sets N\<close>[THEN sets_eq_imp_space_eq, simp]
[PROOF STATE]
proof (state)
this:
sets M = sets N
space M = space N

goal (2 subgoals):
 1. {g. simple_function M g \<and> g \<le> f} \<subseteq> {g. simple_function N g \<and> g \<le> f}
 2. \<And>x. x \<in> {g. simple_function M g \<and> g \<le> f} \<Longrightarrow> integral\<^sup>S M x \<le> integral\<^sup>S N x
[PROOF STEP]
show "{g. simple_function M g \<and> g \<le> f} \<subseteq> {g. simple_function N g \<and> g \<le> f}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {g. simple_function M g \<and> g \<le> f} \<subseteq> {g. simple_function N g \<and> g \<le> f}
[PROOF STEP]
by (simp add: simple_function_def)
[PROOF STATE]
proof (state)
this:
{g. simple_function M g \<and> g \<le> f} \<subseteq> {g. simple_function N g \<and> g \<le> f}

goal (1 subgoal):
 1. \<And>x. x \<in> {g. simple_function M g \<and> g \<le> f} \<Longrightarrow> integral\<^sup>S M x \<le> integral\<^sup>S N x
[PROOF STEP]
show "integral\<^sup>S M x \<le> integral\<^sup>S N x" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>S M x \<le> integral\<^sup>S N x
[PROOF STEP]
using le_measureD3[OF \<open>M \<le> N\<close>]
[PROOF STATE]
proof (prove)
using this:
sets M = sets N \<Longrightarrow> emeasure M ?X \<le> emeasure N ?X

goal (1 subgoal):
 1. integral\<^sup>S M x \<le> integral\<^sup>S N x
[PROOF STEP]
by (auto simp add: simple_integral_def intro!: sum_mono mult_mono)
[PROOF STATE]
proof (state)
this:
integral\<^sup>S M ?x \<le> integral\<^sup>S N ?x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma canAccessThis_simp1: "canAccessThis \<noteq> vertex_1 \<Longrightarrow> succ_tran \<lparr>nodes = {vertex_1, canAccessThis}, edges = {(vertex_1, canAccessThis)}\<rparr> vertex_1 = {canAccessThis}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canAccessThis \<noteq> vertex_1 \<Longrightarrow> succ_tran \<lparr>nodes = {vertex_1, canAccessThis}, edges = {(vertex_1, canAccessThis)}\<rparr> vertex_1 = {canAccessThis}
[PROOF STEP]
apply (simp add: succ_tran_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canAccessThis \<noteq> vertex_1 \<Longrightarrow> {e2. (vertex_1, e2) \<in> {(vertex_1, canAccessThis)}\<^sup>+} = {canAccessThis}
[PROOF STEP]
by (metis (lifting, no_types) Collect_cong Range.intros Range_empty Range_insert mem_Collect_eq singleton_conv singleton_iff trancl.r_into_trancl trancl_range)


[STATEMENT]
lemma harm_integral_0_1_fraction:
  "set_integrable lborel {0::real..1} (\<lambda>x. (1 - x ^ n) / (1 - x))"
  "(LBINT x = 0..1. ((1 - x ^ n) / (1 - x))) = harm n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x)) &&& LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))
 2. LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
show "set_integrable lborel {0::real..1} (\<lambda>x. (1 - x ^ n) / (1 - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))
[PROOF STEP]
have "AE x\<in>{0::real..1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x\<in>{0..1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}
[PROOF STEP]
by (auto intro!: eventually_mono[OF AE_lborel_singleton[of 1]] simp add: sum_gp_strict)
[PROOF STATE]
proof (state)
this:
AE x\<in>{0..1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}

goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))
[PROOF STEP]
with harm_integral_x_raised_n
[PROOF STATE]
proof (chain)
picking this:
set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<?n})
LBINT x=0..1. sum ((^) x) {..<?n} = harm ?n
AE x\<in>{0..1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<?n})
LBINT x=0..1. sum ((^) x) {..<?n} = harm ?n
AE x\<in>{0..1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}

goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))
[PROOF STEP]
by (subst set_integrable_cong_AE) auto
[PROOF STATE]
proof (state)
this:
set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))

goal (1 subgoal):
 1. LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))

goal (1 subgoal):
 1. LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
have "AE x\<in>{0::real<..<1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x\<in>{0<..<1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}
[PROOF STEP]
by (auto simp add: sum_gp_strict)
[PROOF STATE]
proof (state)
this:
AE x\<in>{0<..<1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}

goal (1 subgoal):
 1. LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x\<in>{0<..<1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}

goal (1 subgoal):
 1. LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
have "einterval (min 0 1) (max 0 1) = {0::real<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. einterval (min 0 1) (max 0 1) = {0<..<1}
[PROOF STEP]
by (auto simp add: min_def max_def einterval_iff)
[PROOF STATE]
proof (state)
this:
einterval (min 0 1) (max 0 1) = {0<..<1}

goal (1 subgoal):
 1. LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))
AE x\<in>{0<..<1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}
einterval (min 0 1) (max 0 1) = {0<..<1}
[PROOF STEP]
show "(LBINT x = 0..1. ((1 - x ^ n) / (1 - x))) = harm n"
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))
AE x\<in>{0<..<1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}
einterval (min 0 1) (max 0 1) = {0<..<1}

goal (1 subgoal):
 1. LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
using harm_integral_x_raised_n
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel {0..1} (\<lambda>x. (1 - x ^ n) / (1 - x))
AE x\<in>{0<..<1} in lborel. (1 - x ^ n) / (1 - x) = sum ((^) x) {..<n}
einterval (min 0 1) (max 0 1) = {0<..<1}
set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<?n})
LBINT x=0..1. sum ((^) x) {..<?n} = harm ?n

goal (1 subgoal):
 1. LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n
[PROOF STEP]
by (subst interval_integral_cong_AE) auto
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. (1 - x ^ n) / (1 - x) = harm n

goal:
No subgoals!
[PROOF STEP]
qed