[STATEMENT]
lemma polynomial_function_iff_Basis_inner:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space"
  shows "polynomial_function f \<longleftrightarrow> (\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. inner (f x) b))"
        (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polynomial_function f = (\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b))
[PROOF STEP]
unfolding polynomial_function_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>fa. bounded_linear fa \<longrightarrow> real_polynomial_function (fa \<circ> f)) = (\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b))
[PROOF STEP]
proof (intro iffI allI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>fa. bounded_linear fa \<longrightarrow> real_polynomial_function (fa \<circ> f) \<Longrightarrow> \<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b)
 2. \<And>fa. \<lbrakk>\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b); bounded_linear fa\<rbrakk> \<Longrightarrow> real_polynomial_function (fa \<circ> f)
[PROOF STEP]
assume "\<forall>h. bounded_linear h \<longrightarrow> real_polynomial_function (h \<circ> f)"
[PROOF STATE]
proof (state)
this:
\<forall>h. bounded_linear h \<longrightarrow> real_polynomial_function (h \<circ> f)

goal (2 subgoals):
 1. \<forall>fa. bounded_linear fa \<longrightarrow> real_polynomial_function (fa \<circ> f) \<Longrightarrow> \<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b)
 2. \<And>fa. \<lbrakk>\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b); bounded_linear fa\<rbrakk> \<Longrightarrow> real_polynomial_function (fa \<circ> f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>h. bounded_linear h \<longrightarrow> real_polynomial_function (h \<circ> f)
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
\<forall>h. bounded_linear h \<longrightarrow> real_polynomial_function (h \<circ> f)

goal (1 subgoal):
 1. \<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b)
[PROOF STEP]
by (force simp add: bounded_linear_inner_left o_def)
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b)

goal (1 subgoal):
 1. \<And>fa. \<lbrakk>\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b); bounded_linear fa\<rbrakk> \<Longrightarrow> real_polynomial_function (fa \<circ> f)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>fa. \<lbrakk>\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b); bounded_linear fa\<rbrakk> \<Longrightarrow> real_polynomial_function (fa \<circ> f)
[PROOF STEP]
fix h :: "'b \<Rightarrow> real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>fa. \<lbrakk>\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b); bounded_linear fa\<rbrakk> \<Longrightarrow> real_polynomial_function (fa \<circ> f)
[PROOF STEP]
assume rp: "\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b)" and h: "bounded_linear h"
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b)
bounded_linear h

goal (1 subgoal):
 1. \<And>fa. \<lbrakk>\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b); bounded_linear fa\<rbrakk> \<Longrightarrow> real_polynomial_function (fa \<circ> f)
[PROOF STEP]
have "real_polynomial_function (h \<circ> (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_polynomial_function (h \<circ> (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b))
[PROOF STEP]
using rp
[PROOF STATE]
proof (prove)
using this:
\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b)

goal (1 subgoal):
 1. real_polynomial_function (h \<circ> (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b))
[PROOF STEP]
by (force simp: real_polynomial_function_eq polynomial_function_mult
              intro!: real_polynomial_function_compose [OF _  linear [OF h]])
[PROOF STATE]
proof (state)
this:
real_polynomial_function (h \<circ> (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b))

goal (1 subgoal):
 1. \<And>fa. \<lbrakk>\<forall>b\<in>Basis. real_polynomial_function (\<lambda>x. f x \<bullet> b); bounded_linear fa\<rbrakk> \<Longrightarrow> real_polynomial_function (fa \<circ> f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_polynomial_function (h \<circ> (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b))
[PROOF STEP]
show "real_polynomial_function (h \<circ> f)"
[PROOF STATE]
proof (prove)
using this:
real_polynomial_function (h \<circ> (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b))

goal (1 subgoal):
 1. real_polynomial_function (h \<circ> f)
[PROOF STEP]
by (simp add: euclidean_representation_sum_fun)
[PROOF STATE]
proof (state)
this:
real_polynomial_function (h \<circ> f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma image_mset_filter_mset_swap:
  "image_mset f (filter_mset (\<lambda>x. P (f x)) M) = filter_mset P (image_mset f M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f {#x \<in># M. P (f x)#} = filter_mset P (image_mset f M)
[PROOF STEP]
by (induction M rule: multiset_induct) simp_all


[STATEMENT]
theorem Par_Wbis[simp]:
assumes "c1 \<approx>w d1" and "c2 \<approx>w d2"
shows "Par c1 c2 \<approx>w Par d1 d2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c1 | c2 \<approx>w d1 | d2
[PROOF STEP]
using assms thetaParW_Wbis
[PROOF STATE]
proof (prove)
using this:
c1 \<approx>w d1
c2 \<approx>w d2
thetaParW \<subseteq> Wbis

goal (1 subgoal):
 1. c1 | c2 \<approx>w d1 | d2
[PROOF STEP]
unfolding thetaParW_def
[PROOF STATE]
proof (prove)
using this:
c1 \<approx>w d1
c2 \<approx>w d2
{(c1 | c2, d1 | d2) |c1 c2 d1 d2. c1 \<approx>w d1 \<and> c2 \<approx>w d2} \<subseteq> Wbis

goal (1 subgoal):
 1. c1 | c2 \<approx>w d1 | d2
[PROOF STEP]
by blast


[STATEMENT]
lemma vec_prod_zero: "(0\<^sub>v n) \<bullet> (0\<^sub>v n) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>v n \<bullet> 0\<^sub>v n = (0::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in valid_unMultigraph) rem_UnPath_parity_v:
  assumes "finite E"  "is_trail v ps v'"
  shows "v\<noteq>v' \<longleftrightarrow> (odd (degree v (rem_unPath ps G)) = even(degree v G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<noteq> v') = (odd (degree v (rem_unPath ps G)) = even (degree v G))
[PROOF STEP]
by (metis assms is_trail_rev rem_UnPath_parity_v' rem_unPath_graph)


[STATEMENT]
lemma path_restrict_tl:
  "\<lbrakk> u\<notin>R; path (E \<inter> UNIV \<times> -R) u p v \<rbrakk> \<Longrightarrow> path (rel_restrict E R) u p v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<notin> R; path (E \<inter> UNIV \<times> - R) u p v\<rbrakk> \<Longrightarrow> path (rel_restrict E R) u p v
[PROOF STEP]
apply (induction p arbitrary: u)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>u. \<lbrakk>u \<notin> R; path (E \<inter> UNIV \<times> - R) u [] v\<rbrakk> \<Longrightarrow> path (rel_restrict E R) u [] v
 2. \<And>a p u. \<lbrakk>\<And>u. \<lbrakk>u \<notin> R; path (E \<inter> UNIV \<times> - R) u p v\<rbrakk> \<Longrightarrow> path (rel_restrict E R) u p v; u \<notin> R; path (E \<inter> UNIV \<times> - R) u (a # p) v\<rbrakk> \<Longrightarrow> path (rel_restrict E R) u (a # p) v
[PROOF STEP]
apply (auto simp: path_simps rel_restrict_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gbinomial_Suc_Suc: "(a + 1) gchoose (Suc k) = a gchoose k + (a gchoose (Suc k))"
  for a :: "'a::field_char_0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
proof (cases k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
 2. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
k = 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
 2. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = 0

goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
case (Suc h)
[PROOF STATE]
proof (state)
this:
k = Suc h

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have eq0: "(\<Prod>i\<in>{1..k}. (a + 1) - of_nat i) = (\<Prod>i\<in>{0..h}. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 1..k. a + (1::'a) - of_nat i) = (\<Prod>i = 0..h. a - of_nat i)
[PROOF STEP]
proof (rule prod.reindex_cong)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. inj_on ?l {0..h}
 2. {1..k} = ?l ` {0..h}
 3. \<And>x. x \<in> {0..h} \<Longrightarrow> a + (1::'a) - of_nat (?l x) = a - of_nat x
[PROOF STEP]
show "{1..k} = Suc ` {0..h}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..k} = Suc ` {0..h}
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
k = Suc h

goal (1 subgoal):
 1. {1..k} = Suc ` {0..h}
[PROOF STEP]
by (auto simp add: image_Suc_atMost)
[PROOF STATE]
proof (state)
this:
{1..k} = Suc ` {0..h}

goal (2 subgoals):
 1. inj_on Suc {0..h}
 2. \<And>x. x \<in> {0..h} \<Longrightarrow> a + (1::'a) - of_nat (Suc x) = a - of_nat x
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 1..k. a + (1::'a) - of_nat i) = (\<Prod>i = 0..h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "fact (Suc k) * (a gchoose k + (a gchoose (Suc k))) =
      (a gchoose Suc h) * (fact (Suc (Suc h))) +
      (a gchoose Suc (Suc h)) * (fact (Suc (Suc h)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = (a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h))
[PROOF STEP]
by (simp add: Suc field_simps del: fact_Suc)
[PROOF STATE]
proof (state)
this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = (a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = (a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i=0..Suc h. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h)) = (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
apply (simp only: gbinomial_mult_fact field_simps mult.left_commute [of _ "2"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose Suc h) * fact (Suc (Suc h)) + (\<Prod>i = 0..<Suc (Suc h). a - of_nat i) = (\<Prod>i = 0..Suc h. a - of_nat i) + (a gchoose Suc h) * of_nat (fact (Suc h) * Suc (Suc h))
[PROOF STEP]
apply (simp del: fact_Suc add: fact_Suc [of "Suc h"] field_simps gbinomial_mult_fact
      mult.left_commute [of _ "2"] atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h)) = (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h)) = (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    (fact (Suc h) * (a gchoose Suc h)) * of_nat (Suc (Suc h)) + (\<Prod>i=0..Suc h. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
by (simp only: fact_Suc mult.commute mult.left_commute of_nat_fact of_nat_id of_nat_mult)
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    of_nat (Suc (Suc h)) * (\<Prod>i=0..h. a - of_nat i) + (\<Prod>i=0..Suc h. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
unfolding gbinomial_mult_fact atLeastLessThanSuc_atLeastAtMost
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..h. a - of_nat i) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    (\<Prod>i=0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i=0..h. a - of_nat i) + 2 * (\<Prod>i=0..h. a - of_nat i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    ((a gchoose Suc h) * (fact (Suc h)) * of_nat (Suc k)) + (\<Prod>i\<in>{0..Suc h}. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i)) = (a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
unfolding gbinomial_mult_fact'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i)) = (\<Prod>i = 0..<Suc h. a - of_nat i) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
by (simp add: comm_semiring_class.distrib field_simps Suc atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i)) = (a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i)) = (a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> = (\<Prod>i\<in>{0..h}. a - of_nat i) * (a + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a))
[PROOF STEP]
unfolding gbinomial_mult_fact' atLeast0_atMost_Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<Suc h. a - of_nat i) * of_nat (Suc k) + (\<Prod>i\<in>insert (Suc h) {0..h}. a - of_nat i) = (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a))
[PROOF STEP]
by (simp add: field_simps Suc atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> = (\<Prod>i\<in>{0..k}. (a + 1) - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a)) = (\<Prod>i = 0..k. a + (1::'a) - of_nat i)
[PROOF STEP]
using eq0
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i = 1..k. a + (1::'a) - of_nat i) = (\<Prod>i = 0..h. a - of_nat i)

goal (1 subgoal):
 1. (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a)) = (\<Prod>i = 0..k. a + (1::'a) - of_nat i)
[PROOF STEP]
by (simp add: Suc prod.atLeast0_atMost_Suc_shift del: prod.cl_ivl_Suc)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a)) = (\<Prod>i = 0..k. a + (1::'a) - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a)) = (\<Prod>i = 0..k. a + (1::'a) - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> = (fact (Suc k)) * ((a + 1) gchoose (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..k. a + (1::'a) - of_nat i) = fact (Suc k) * (a + (1::'a) gchoose Suc k)
[PROOF STEP]
by (simp only: gbinomial_mult_fact atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..k. a + (1::'a) - of_nat i) = fact (Suc k) * (a + (1::'a) gchoose Suc k)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = fact (Suc k) * (a + (1::'a) gchoose Suc k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = fact (Suc k) * (a + (1::'a) gchoose Suc k)

goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
using fact_nonzero [of "Suc k"]
[PROOF STATE]
proof (prove)
using this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = fact (Suc k) * (a + (1::'a) gchoose Suc k)
fact (Suc k) \<noteq> (0::?'a)

goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iprev_lessThan: "t < n \<Longrightarrow> iprev t {..<n} = t - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t < n \<Longrightarrow> iprev t {..<n} = t - Suc 0
[PROOF STEP]
apply (case_tac n, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>t < n; n = Suc nat\<rbrakk> \<Longrightarrow> iprev t {..<n} = t - Suc 0
[PROOF STEP]
apply (simp add: lessThan_Suc_atMost iprev_atMost)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma r_list_encode:
  assumes "length xs = Suc n"
  shows "eval (r_list_encode n) xs \<down>= list_encode xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
have "eval (r_tuple_encode n) xs \<down>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (r_tuple_encode n) xs \<down>
[PROOF STEP]
by (simp add: assms r_tuple_encode)
[PROOF STATE]
proof (state)
this:
eval (r_tuple_encode n) xs \<down>

goal (1 subgoal):
 1. eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval (r_tuple_encode n) xs \<down>
[PROOF STEP]
have "eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs \<down>"
[PROOF STATE]
proof (prove)
using this:
eval (r_tuple_encode n) xs \<down>

goal (1 subgoal):
 1. eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs \<down>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
eval (r_tuple_encode n) xs \<down>
length xs = Suc n

goal (1 subgoal):
 1. eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs \<down>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs \<down>

goal (1 subgoal):
 1. eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs \<down>
[PROOF STEP]
have "eval (r_list_encode n) xs =
      eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]"
[PROOF STATE]
proof (prove)
using this:
eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs \<down>

goal (1 subgoal):
 1. eval (r_list_encode n) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]
[PROOF STEP]
unfolding r_list_encode_def
[PROOF STATE]
proof (prove)
using this:
eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs \<down>

goal (1 subgoal):
 1. eval (Cn (Suc n) S [Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]]) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]
[PROOF STEP]
using assms r_tuple_encode
[PROOF STATE]
proof (prove)
using this:
eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs \<down>
length xs = Suc n
length ?xs = Suc ?n \<Longrightarrow> eval (r_tuple_encode ?n) ?xs \<down>= tuple_encode ?n ?xs

goal (1 subgoal):
 1. eval (Cn (Suc n) S [Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]]) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval (r_list_encode n) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]

goal (1 subgoal):
 1. eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
eval (r_list_encode n) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]

goal (1 subgoal):
 1. eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
length xs = Suc n
[PROOF STEP]
obtain y ys where "xs = y # ys"
[PROOF STATE]
proof (prove)
using this:
length xs = Suc n

goal (1 subgoal):
 1. (\<And>y ys. xs = y # ys \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson length_Suc_conv)
[PROOF STATE]
proof (state)
this:
xs = y # ys

goal (1 subgoal):
 1. eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
eval (r_list_encode n) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]
xs = y # ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
eval (r_list_encode n) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]
xs = y # ys

goal (1 subgoal):
 1. eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
unfolding r_list_encode_def
[PROOF STATE]
proof (prove)
using this:
eval (Cn (Suc n) S [Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]]) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]
xs = y # ys

goal (1 subgoal):
 1. eval (Cn (Suc n) S [Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]]) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
using assms r_tuple_encode
[PROOF STATE]
proof (prove)
using this:
eval (Cn (Suc n) S [Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]]) xs = eval S [the (eval (Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]) xs)]
xs = y # ys
length xs = Suc n
length ?xs = Suc ?n \<Longrightarrow> eval (r_tuple_encode ?n) ?xs \<down>= tuple_encode ?n ?xs

goal (1 subgoal):
 1. eval (Cn (Suc n) S [Cn (Suc n) r_prod_encode [r_constn n n, r_tuple_encode n]]) xs \<down>= Partial_Recursive.list_encode xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval (r_list_encode n) xs \<down>= Partial_Recursive.list_encode xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unfoldr_append_generator_Inl:
  "list.unfoldr (append_generator g1 g2) (Inl (s1, s2)) =
   list.unfoldr g1 s1 @ list.unfoldr g2 s2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.unfoldr (append_generator g1 g2) (Inl (s1, s2)) = list.unfoldr g1 s1 @ list.unfoldr g2 s2
[PROOF STEP]
apply(induct s1 taking: g1 rule: list.unfoldr.induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. (\<And>x xa y. \<lbrakk>list.has_next g1 s; x = list.next g1 s; (xa, y) = x\<rbrakk> \<Longrightarrow> list.unfoldr (append_generator g1 g2) (Inl (y, s2)) = list.unfoldr g1 y @ list.unfoldr g2 s2) \<Longrightarrow> list.unfoldr (append_generator g1 g2) (Inl (s, s2)) = list.unfoldr g1 s @ list.unfoldr g2 s2
[PROOF STEP]
apply(subst (1 2 3) list.unfoldr.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. (\<And>x xa y. \<lbrakk>list.has_next g1 s; x = list.next g1 s; (xa, y) = x\<rbrakk> \<Longrightarrow> list.unfoldr (append_generator g1 g2) (Inl (y, s2)) = list.unfoldr g1 y @ list.unfoldr g2 s2) \<Longrightarrow> (if list.has_next (append_generator g1 g2) (Inl (s, s2)) then let (a, s') = list.next (append_generator g1 g2) (Inl (s, s2)) in a # list.unfoldr (append_generator g1 g2) s' else []) = (if list.has_next g1 s then let (a, s') = list.next g1 s in a # list.unfoldr g1 s' else []) @ (if list.has_next g2 s2 then let (a, s') = list.next g2 s2 in a # list.unfoldr g2 s' else [])
[PROOF STEP]
apply(auto split: prod.splits simp add: apsnd_def map_prod_def unfoldr_append_generator_Inr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s x1 x2. \<lbrakk>\<And>a b xa y. \<lbrakk>(a, b) = list.next g1 s; (xa, y) = list.next g1 s\<rbrakk> \<Longrightarrow> list.unfoldr (append_generator g1 g2) (Inl (y, s2)) = list.unfoldr g1 y @ list.unfoldr g2 s2; list.next g2 s2 = (x1, x2); list.has_next g2 s2; list.has_next g1 s\<rbrakk> \<Longrightarrow> list.unfoldr g2 s2 = x1 # list.unfoldr g2 x2
[PROOF STEP]
apply(simp add: list.unfoldr_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma inverse_negative_imp_negative:
  assumes inv_less_0: "inverse a < 0" and nz: "a \<noteq> 0"
  shows "a < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < (0::'a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a < (0::'a)
[PROOF STEP]
have "inverse (inverse a) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (inverse a) < (0::'a)
[PROOF STEP]
using inv_less_0
[PROOF STATE]
proof (prove)
using this:
inverse a < (0::'a)

goal (1 subgoal):
 1. inverse (inverse a) < (0::'a)
[PROOF STEP]
by (rule negative_imp_inverse_negative)
[PROOF STATE]
proof (state)
this:
inverse (inverse a) < (0::'a)

goal (1 subgoal):
 1. a < (0::'a)
[PROOF STEP]
thus "a < 0"
[PROOF STATE]
proof (prove)
using this:
inverse (inverse a) < (0::'a)

goal (1 subgoal):
 1. a < (0::'a)
[PROOF STEP]
using nz
[PROOF STATE]
proof (prove)
using this:
inverse (inverse a) < (0::'a)
a \<noteq> (0::'a)

goal (1 subgoal):
 1. a < (0::'a)
[PROOF STEP]
by (simp add: nonzero_inverse_inverse_eq)
[PROOF STATE]
proof (state)
this:
a < (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pn_choose_k_modp_0:
  fixes n k::nat
  assumes "prime p"
          "k \<ge> 1 \<and> k \<le> p^n - 1"
          "n > 0"
  shows "(p^n choose k) mod p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have inequality: "k \<le> p^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> p ^ n
[PROOF STEP]
using assms (2)
[PROOF STATE]
proof (prove)
using this:
1 \<le> k \<and> k \<le> p ^ n - 1

goal (1 subgoal):
 1. k \<le> p ^ n
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
k \<le> p ^ n

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have choose_take_1: "((p^n - 1) choose ( k - 1))= fact (p^n - 1) div (fact (k - 1) * fact (p^n - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ n - 1 choose (k - 1) = fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k))
[PROOF STEP]
using binomial_altdef_nat diff_le_mono inequality assms(2)
[PROOF STATE]
proof (prove)
using this:
?k \<le> ?n \<Longrightarrow> ?n choose ?k = fact ?n div (fact ?k * fact (?n - ?k))
?m \<le> ?n \<Longrightarrow> ?m - ?l \<le> ?n - ?l
k \<le> p ^ n
1 \<le> k \<and> k \<le> p ^ n - 1

goal (1 subgoal):
 1. p ^ n - 1 choose (k - 1) = fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p ^ n - 1 choose (k - 1) = fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have "k * (p^n choose k) = k * ((fact (p^n)) div (fact k * fact((p^n) - k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * (p ^ n choose k) = k * (fact (p ^ n) div (fact k * fact (p ^ n - k)))
[PROOF STEP]
using assms binomial_fact'[OF inequality]
[PROOF STATE]
proof (prove)
using this:
prime p
1 \<le> k \<and> k \<le> p ^ n - 1
0 < n
p ^ n choose k = fact (p ^ n) div (fact k * fact (p ^ n - k))

goal (1 subgoal):
 1. k * (p ^ n choose k) = k * (fact (p ^ n) div (fact k * fact (p ^ n - k)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k * (p ^ n choose k) = k * (fact (p ^ n) div (fact k * fact (p ^ n - k)))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k * (p ^ n choose k) = k * (fact (p ^ n) div (fact k * fact (p ^ n - k)))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have "... = k * fact (p^n) div (fact k * fact((p^n) - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * (fact (p ^ n) div (fact k * fact (p ^ n - k))) = k * fact (p ^ n) div (fact k * fact (p ^ n - k))
[PROOF STEP]
using binomial_fact_lemma div_mult_self_is_m fact_gt_zero inequality mult.assoc mult.commute
          nat_0_less_mult_iff
[PROOF STATE]
proof (prove)
using this:
?k \<le> ?n \<Longrightarrow> fact ?k * fact (?n - ?k) * (?n choose ?k) = fact ?n
0 < ?n \<Longrightarrow> ?m * ?n div ?n = ?m
(0::?'a) < fact ?n
k \<le> p ^ n
?a * ?b * ?c = ?a * (?b * ?c)
?a * ?b = ?b * ?a
(0 < ?m * ?n) = (0 < ?m \<and> 0 < ?n)

goal (1 subgoal):
 1. k * (fact (p ^ n) div (fact k * fact (p ^ n - k))) = k * fact (p ^ n) div (fact k * fact (p ^ n - k))
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
k * (fact (p ^ n) div (fact k * fact (p ^ n - k))) = k * fact (p ^ n) div (fact k * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k * (fact (p ^ n) div (fact k * fact (p ^ n - k))) = k * fact (p ^ n) div (fact k * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have "... = k * fact (p^n) div (k * fact (k - 1) * fact((p^n) - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * fact (p ^ n) div (fact k * fact (p ^ n - k)) = k * fact (p ^ n) div (k * fact (k - 1) * fact (p ^ n - k))
[PROOF STEP]
by (metis assms(2) fact_nonzero fact_num_eq_if le0 le_antisym of_nat_id)
[PROOF STATE]
proof (state)
this:
k * fact (p ^ n) div (fact k * fact (p ^ n - k)) = k * fact (p ^ n) div (k * fact (k - 1) * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k * fact (p ^ n) div (fact k * fact (p ^ n - k)) = k * fact (p ^ n) div (k * fact (k - 1) * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have "... = fact (p^n) div (fact (k - 1) * fact((p^n) - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * fact (p ^ n) div (k * fact (k - 1) * fact (p ^ n - k)) = fact (p ^ n) div (fact (k - 1) * fact (p ^ n - k))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
1 \<le> k \<and> k \<le> p ^ n - 1
0 < n

goal (1 subgoal):
 1. k * fact (p ^ n) div (k * fact (k - 1) * fact (p ^ n - k)) = fact (p ^ n) div (fact (k - 1) * fact (p ^ n - k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k * fact (p ^ n) div (k * fact (k - 1) * fact (p ^ n - k)) = fact (p ^ n) div (fact (k - 1) * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k * fact (p ^ n) div (k * fact (k - 1) * fact (p ^ n - k)) = fact (p ^ n) div (fact (k - 1) * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have "... = ((p^n) * fact (p^n - 1)) div (fact (k - 1) * fact((p^n) - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (p ^ n) div (fact (k - 1) * fact (p ^ n - k)) = p ^ n * fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k))
[PROOF STEP]
by (metis assms(2) fact_nonzero fact_num_eq_if inequality le0 le_antisym of_nat_id)
[PROOF STATE]
proof (state)
this:
fact (p ^ n) div (fact (k - 1) * fact (p ^ n - k)) = p ^ n * fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (p ^ n) div (fact (k - 1) * fact (p ^ n - k)) = p ^ n * fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have "... = (p^n) * (fact (p^n - 1) div (fact (k - 1) * fact((p^n) - k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ n * fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k)) = p ^ n * (fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k)))
[PROOF STEP]
by (metis assms(2) calculation choose_take_1 neq0_conv not_one_le_zero times_binomial_minus1_eq)
[PROOF STATE]
proof (state)
this:
p ^ n * fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k)) = p ^ n * (fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k)))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
k * (p ^ n choose k) = p ^ n * (fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k)))
[PROOF STEP]
have equality: "k * (p^n choose k) = p^n * ((p^n - 1) choose (k - 1))"
[PROOF STATE]
proof (prove)
using this:
k * (p ^ n choose k) = p ^ n * (fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k)))

goal (1 subgoal):
 1. k * (p ^ n choose k) = p ^ n * (p ^ n - 1 choose (k - 1))
[PROOF STEP]
using assms(2) times_binomial_minus1_eq
[PROOF STATE]
proof (prove)
using this:
k * (p ^ n choose k) = p ^ n * (fact (p ^ n - 1) div (fact (k - 1) * fact (p ^ n - k)))
1 \<le> k \<and> k \<le> p ^ n - 1
0 < ?k \<Longrightarrow> ?k * (?n choose ?k) = ?n * (?n - 1 choose (?k - 1))

goal (1 subgoal):
 1. k * (p ^ n choose k) = p ^ n * (p ^ n - 1 choose (k - 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k * (p ^ n choose k) = p ^ n * (p ^ n - 1 choose (k - 1))

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k * (p ^ n choose k) = p ^ n * (p ^ n - 1 choose (k - 1))
[PROOF STEP]
have dvd_result: "p^n dvd (k * (p^n choose k))"
[PROOF STATE]
proof (prove)
using this:
k * (p ^ n choose k) = p ^ n * (p ^ n - 1 choose (k - 1))

goal (1 subgoal):
 1. p ^ n dvd k * (p ^ n choose k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p ^ n dvd k * (p ^ n choose k)

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
have "\<not> (p^n dvd k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p ^ n dvd k
[PROOF STEP]
using assms (2) binomial_n_0 diff_diff_cancel nat_dvd_not_less neq0_conv
[PROOF STATE]
proof (prove)
using this:
1 \<le> k \<and> k \<le> p ^ n - 1
?n choose 0 = 1
?i \<le> ?n \<Longrightarrow> ?n - (?n - ?i) = ?i
\<lbrakk>0 < ?m; ?m < ?n\<rbrakk> \<Longrightarrow> \<not> ?n dvd ?m
(?n \<noteq> 0) = (0 < ?n)

goal (1 subgoal):
 1. \<not> p ^ n dvd k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> p ^ n dvd k

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> p ^ n dvd k
[PROOF STEP]
have "p dvd (p^n choose k)"
[PROOF STATE]
proof (prove)
using this:
\<not> p ^ n dvd k

goal (1 subgoal):
 1. p dvd p ^ n choose k
[PROOF STEP]
using mult.commute prime_imp_prime_elem prime_power_dvd_multD assms dvd_result
[PROOF STATE]
proof (prove)
using this:
\<not> p ^ n dvd k
?a * ?b = ?b * ?a
prime ?p \<Longrightarrow> prime_elem ?p
\<lbrakk>prime_elem ?p; ?p ^ ?n dvd ?a * ?b; 0 < ?n; \<not> ?p dvd ?a\<rbrakk> \<Longrightarrow> ?p ^ ?n dvd ?b
prime p
1 \<le> k \<and> k \<le> p ^ n - 1
0 < n
p ^ n dvd k * (p ^ n choose k)

goal (1 subgoal):
 1. p dvd p ^ n choose k
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
p dvd p ^ n choose k

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
thus "?thesis"
[PROOF STATE]
proof (prove)
using this:
p dvd p ^ n choose k

goal (1 subgoal):
 1. (p ^ n choose k) mod p = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(p ^ n choose k) mod p = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subst_exu[simp]:
assumes [simp]: "\<phi> \<in> fmla" "t \<in> trm" "x \<in> var" "y \<in> var" "x \<noteq> y" "x \<notin> FvarsT t"
shows "subst (exu x \<phi>) t y = exu x (subst \<phi> t y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subst (exu x \<phi>) t y = exu x (subst \<phi> t y)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subst (exu x \<phi>) t y = exu x (subst \<phi> t y)
[PROOF STEP]
define u where u: "u \<equiv> getFr [x,y] [t] [\<phi>]"
[PROOF STATE]
proof (state)
this:
u \<equiv> getFr [x, y] [t] [\<phi>]

goal (1 subgoal):
 1. subst (exu x \<phi>) t y = exu x (subst \<phi> t y)
[PROOF STEP]
have u_facts[simp]:  "u \<in> var" "u \<noteq> x" "u \<noteq> y" "y \<noteq> u" "x \<noteq> u"
    "u \<notin> FvarsT t" "u \<notin> Fvars \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> var &&& u \<noteq> x &&& u \<noteq> y) &&& (y \<noteq> u &&& x \<noteq> u) &&& u \<notin> FvarsT t &&& u \<notin> Fvars \<phi>
[PROOF STEP]
unfolding u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (getFr [x, y] [t] [\<phi>] \<in> var &&& getFr [x, y] [t] [\<phi>] \<noteq> x &&& getFr [x, y] [t] [\<phi>] \<noteq> y) &&& (y \<noteq> getFr [x, y] [t] [\<phi>] &&& x \<noteq> getFr [x, y] [t] [\<phi>]) &&& getFr [x, y] [t] [\<phi>] \<notin> FvarsT t &&& getFr [x, y] [t] [\<phi>] \<notin> Fvars \<phi>
[PROOF STEP]
using getFr_FvarsT_Fvars[of "[x,y]" "[t]" "[\<phi>]"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set [x, y] \<subseteq> var; set [t] \<subseteq> trm; set [\<phi>] \<subseteq> fmla\<rbrakk> \<Longrightarrow> getFr [x, y] [t] [\<phi>] \<in> var \<and> getFr [x, y] [t] [\<phi>] \<notin> set [x, y] \<and> (?t \<in> set [t] \<longrightarrow> getFr [x, y] [t] [\<phi>] \<notin> FvarsT ?t) \<and> (?\<phi> \<in> set [\<phi>] \<longrightarrow> getFr [x, y] [t] [\<phi>] \<notin> Fvars ?\<phi>)

goal (1 subgoal):
 1. (getFr [x, y] [t] [\<phi>] \<in> var &&& getFr [x, y] [t] [\<phi>] \<noteq> x &&& getFr [x, y] [t] [\<phi>] \<noteq> y) &&& (y \<noteq> getFr [x, y] [t] [\<phi>] &&& x \<noteq> getFr [x, y] [t] [\<phi>]) &&& getFr [x, y] [t] [\<phi>] \<notin> FvarsT t &&& getFr [x, y] [t] [\<phi>] \<notin> Fvars \<phi>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<in> var
u \<noteq> x
u \<noteq> y
y \<noteq> u
x \<noteq> u
u \<notin> FvarsT t
u \<notin> Fvars \<phi>

goal (1 subgoal):
 1. subst (exu x \<phi>) t y = exu x (subst \<phi> t y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subst (exu x \<phi>) t y = exu x (subst \<phi> t y)
[PROOF STEP]
by (auto simp: Let_def exu_def_var[of _ u] subst_compose_diff)
[PROOF STATE]
proof (state)
this:
subst (exu x \<phi>) t y = exu x (subst \<phi> t y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fun_point_Inter_set_eq:
  "fun_point_Inter (set fs) = fun_point_Inter_list fs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fun_point_Inter (set fs) = fun_point_Inter_list fs
[PROOF STEP]
unfolding fun_point_Inter_def fun_point_Inter_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<Inter>f\<in>set fs. f x) = (\<lambda>x. \<Inter> (set (map (\<lambda>f. f x) fs)))
[PROOF STEP]
by simp


[STATEMENT]
lemma permute_list_closed:
  assumes "a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "\<sigma> permutes {..<n}"
  shows "permute_list \<sigma> a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list \<sigma> a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
[PROOF STEP]
apply(rule cartesian_power_car_memI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (permute_list \<sigma> a) = n
 2. set (permute_list \<sigma> a) \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
using assms cartesian_power_car_memE length_permute_list
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
\<sigma> permutes {..<n}
?as \<in> carrier (?R\<^bsup>?n\<^esup>) \<Longrightarrow> length ?as = ?n
length (permute_list ?f ?xs) = length ?xs

goal (2 subgoals):
 1. length (permute_list \<sigma> a) = n
 2. set (permute_list \<sigma> a) \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (permute_list \<sigma> a) \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
using assms cartesian_power_car_memE'' permute_list_set
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
\<sigma> permutes {..<n}
?as \<in> carrier (?R\<^bsup>?n\<^esup>) \<Longrightarrow> set ?as \<subseteq> carrier ?R
\<lbrakk>?a \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>); ?\<sigma> permutes {..<?n}\<rbrakk> \<Longrightarrow> set (permute_list ?\<sigma> ?a) = set ?a

goal (1 subgoal):
 1. set (permute_list \<sigma> a) \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
by blast


[STATEMENT]
lemma compact_complete_linorder:
  fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
  shows "\<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
obtain r where "strict_mono r" and mono: "monoseq (X \<circ> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. \<lbrakk>strict_mono r; monoseq (X \<circ> r)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using seq_monosub[of X]
[PROOF STATE]
proof (prove)
using this:
\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. X (f n))

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>strict_mono r; monoseq (X \<circ> r)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
using this:
\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. X (f n))

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>strict_mono r; monoseq (\<lambda>x. X (r x))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
strict_mono r
monoseq (X \<circ> r)

goal (1 subgoal):
 1. \<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
strict_mono r
monoseq (X \<circ> r)
[PROOF STEP]
have "(\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) m \<le> (X \<circ> r) n) \<or> (\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) n \<le> (X \<circ> r) m)"
[PROOF STATE]
proof (prove)
using this:
strict_mono r
monoseq (X \<circ> r)

goal (1 subgoal):
 1. (\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) m \<le> (X \<circ> r) n) \<or> (\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) n \<le> (X \<circ> r) m)
[PROOF STEP]
by (auto simp add: monoseq_def)
[PROOF STATE]
proof (state)
this:
(\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) m \<le> (X \<circ> r) n) \<or> (\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) n \<le> (X \<circ> r) m)

goal (1 subgoal):
 1. \<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) m \<le> (X \<circ> r) n) \<or> (\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) n \<le> (X \<circ> r) m)
[PROOF STEP]
obtain l where "(X \<circ> r) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
using this:
(\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) m \<le> (X \<circ> r) n) \<or> (\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) n \<le> (X \<circ> r) m)

goal (1 subgoal):
 1. (\<And>l. (X \<circ> r) \<longlonglongrightarrow> l \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using lim_increasing_cl[of "X \<circ> r"] lim_decreasing_cl[of "X \<circ> r"]
[PROOF STATE]
proof (prove)
using this:
(\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) m \<le> (X \<circ> r) n) \<or> (\<forall>n m. m \<le> n \<longrightarrow> (X \<circ> r) n \<le> (X \<circ> r) m)
\<lbrakk>\<And>n m. m \<le> n \<Longrightarrow> (X \<circ> r) m \<le> (X \<circ> r) n; \<And>l. (X \<circ> r) \<longlonglongrightarrow> l \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
\<lbrakk>\<And>n m. m \<le> n \<Longrightarrow> (X \<circ> r) n \<le> (X \<circ> r) m; \<And>l. (X \<circ> r) \<longlonglongrightarrow> l \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>l. (X \<circ> r) \<longlonglongrightarrow> l \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(X \<circ> r) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. \<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(X \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(X \<circ> r) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. \<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
using \<open>strict_mono r\<close>
[PROOF STATE]
proof (prove)
using this:
(X \<circ> r) \<longlonglongrightarrow> l
strict_mono r

goal (1 subgoal):
 1. \<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>l r. strict_mono r \<and> (X \<circ> r) \<longlonglongrightarrow> l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_of_eq: "X closure_of S = S \<longleftrightarrow> closedin X S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X closure_of S = S) = closedin X S
[PROOF STEP]
proof (cases "S \<subseteq> topspace X")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S \<subseteq> topspace X \<Longrightarrow> (X closure_of S = S) = closedin X S
 2. \<not> S \<subseteq> topspace X \<Longrightarrow> (X closure_of S = S) = closedin X S
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S \<subseteq> topspace X

goal (2 subgoals):
 1. S \<subseteq> topspace X \<Longrightarrow> (X closure_of S = S) = closedin X S
 2. \<not> S \<subseteq> topspace X \<Longrightarrow> (X closure_of S = S) = closedin X S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> topspace X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> topspace X

goal (1 subgoal):
 1. (X closure_of S = S) = closedin X S
[PROOF STEP]
by (metis closure_of_subset closure_of_subset_eq set_eq_subset)
[PROOF STATE]
proof (state)
this:
(X closure_of S = S) = closedin X S

goal (1 subgoal):
 1. \<not> S \<subseteq> topspace X \<Longrightarrow> (X closure_of S = S) = closedin X S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> S \<subseteq> topspace X \<Longrightarrow> (X closure_of S = S) = closedin X S
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> S \<subseteq> topspace X

goal (1 subgoal):
 1. \<not> S \<subseteq> topspace X \<Longrightarrow> (X closure_of S = S) = closedin X S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> S \<subseteq> topspace X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> S \<subseteq> topspace X

goal (1 subgoal):
 1. (X closure_of S = S) = closedin X S
[PROOF STEP]
using closure_of closure_of_subset_eq
[PROOF STATE]
proof (prove)
using this:
\<not> S \<subseteq> topspace X
?X closure_of ?S = topspace ?X \<inter> (?S \<union> ?X derived_set_of ?S)
(?S \<subseteq> topspace ?X \<and> ?X closure_of ?S \<subseteq> ?S) = closedin ?X ?S

goal (1 subgoal):
 1. (X closure_of S = S) = closedin X S
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(X closure_of S = S) = closedin X S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pred_in_set_mono:
  assumes "S \<subseteq> T"
  shows "(\<lambda>x. x \<in> S) \<le> (\<lambda>x. x \<in> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x \<in> S) \<le> (\<lambda>x. x \<in> T)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> T

goal (1 subgoal):
 1. (\<lambda>x. x \<in> S) \<le> (\<lambda>x. x \<in> T)
[PROOF STEP]
by auto


[STATEMENT]
lemma length_swap [simp]: "length (swap xs i j) = length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (swap xs i j) = length xs
[PROOF STEP]
by (simp add: swap_def)


[STATEMENT]
lemma frontier_of_subset_closedin: "closedin X S \<Longrightarrow> (X frontier_of S) \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin X S \<Longrightarrow> X frontier_of S \<subseteq> S
[PROOF STEP]
using closure_of_eq frontier_of_def
[PROOF STATE]
proof (prove)
using this:
(?X closure_of ?S = ?S) = closedin ?X ?S
?X frontier_of ?S \<equiv> ?X closure_of ?S - ?X interior_of ?S

goal (1 subgoal):
 1. closedin X S \<Longrightarrow> X frontier_of S \<subseteq> S
[PROOF STEP]
by fastforce


[STATEMENT]
lemma from_list_finite_tree :
  "finite_tree (from_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_tree (from_list xs)
[PROOF STEP]
using insert_finite_tree empty_finite_tree
[PROOF STATE]
proof (prove)
using this:
finite_tree ?t \<Longrightarrow> finite_tree (Prefix_Tree.insert ?t ?xs)
finite_tree Prefix_Tree.empty

goal (1 subgoal):
 1. finite_tree (from_list xs)
[PROOF STEP]
by (induction xs; auto)


[STATEMENT]
lemma prime_power_inj'':
  assumes "prime p" "prime q"
  shows   "p ^ m = q ^ n \<longleftrightarrow> (m = 0 \<and> n = 0) \<or> (p = q \<and> m = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p ^ m = q ^ n) = (m = 0 \<and> n = 0 \<or> p = q \<and> m = n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
prime q

goal (1 subgoal):
 1. (p ^ m = q ^ n) = (m = 0 \<and> n = 0 \<or> p = q \<and> m = n)
[PROOF STEP]
by (cases "m = 0"; cases "n = 0")
     (auto dest: prime_power_inj'[OF assms])


[STATEMENT]
lemma s'_a_equals_s_a [simp]:
  "\<And>A::type_scheme list. $(\<lambda>n. if n : (free_tv A) Un (free_tv t) then (S n) else (TVar n)) A = $S A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. $ (\<lambda>n. if n \<in> free_tv A \<union> free_tv t then S n else TVar n) A = $ S A
[PROOF STEP]
apply (rule scheme_list_substitutions_only_on_free_variables)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. \<forall>x\<in>free_tv A. (if x \<in> free_tv A \<union> free_tv t then S x else TVar x) = S x
[PROOF STEP]
apply (simp add: Ball_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma zeroth_pow_res:
  assumes "x \<in> carrier Q\<^sub>p"
  shows "pow_res 0 x = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pow_res 0 x = {x}
[PROOF STEP]
apply(rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. pow_res 0 x \<subseteq> {x}
 2. {x} \<subseteq> pow_res 0 x
[PROOF STEP]
apply(rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. xa \<in> pow_res 0 x \<Longrightarrow> xa \<in> {x}
 2. {x} \<subseteq> pow_res 0 x
[PROOF STEP]
unfolding pow_res_def mem_Collect_eq
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. xa \<in> carrier Q\<^sub>p \<and> (\<exists>y\<in>nonzero Q\<^sub>p. xa = x \<otimes> y [^] 0) \<Longrightarrow> xa \<in> {x}
 2. {x} \<subseteq> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = x \<otimes> y [^] 0}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Q\<^sub>p

goal (2 subgoals):
 1. \<And>xa. xa \<in> carrier Q\<^sub>p \<and> (\<exists>y\<in>nonzero Q\<^sub>p. xa = x \<otimes> y [^] 0) \<Longrightarrow> xa \<in> {x}
 2. {x} \<subseteq> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = x \<otimes> y [^] 0}
[PROOF STEP]
apply (metis Qp.nat_pow_0 Qp.r_one singletonI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x} \<subseteq> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = x \<otimes> y [^] 0}
[PROOF STEP]
apply(rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {x} \<Longrightarrow> xa \<in> {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = x \<otimes> y [^] 0}
[PROOF STEP]
unfolding pow_res_def mem_Collect_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {x} \<Longrightarrow> xa \<in> carrier Q\<^sub>p \<and> (\<exists>y\<in>nonzero Q\<^sub>p. xa = x \<otimes> y [^] 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x} \<Longrightarrow> xa \<in> carrier Q\<^sub>p \<and> (\<exists>y\<in>nonzero Q\<^sub>p. xa = x \<otimes> y [^] 0)
[PROOF STEP]
by (metis Qp.nat_pow_0 Qp.one_nonzero Qp.r_one equals0D insertE)


[STATEMENT]
lemma homeomorphic_rel_boundaries_same_dimension:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "S homeomorphic T" and aff: "aff_dim S = aff_dim T"
  shows "(S - rel_interior S) homeomorphic (T - rel_interior T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
using assms [unfolded homeomorphic_minimal]
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
aff_dim S = aff_dim T

goal (1 subgoal):
 1. S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
unfolding homeomorphic_def
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
aff_dim S = aff_dim T

goal (1 subgoal):
 1. \<exists>f g. homeomorphism (S - rel_interior S) (T - rel_interior T) f g
[PROOF STEP]
proof (clarify elim!: ex_forward)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>aff_dim S = aff_dim T; \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (S - rel_interior S) (T - rel_interior T) f g
[PROOF STEP]
fix f g
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>aff_dim S = aff_dim T; \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (S - rel_interior S) (T - rel_interior T) f g
[PROOF STEP]
assume S: "\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x" and T: "\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y"
     and contf: "continuous_on S f" and contg: "continuous_on T g"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>aff_dim S = aff_dim T; \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (S - rel_interior S) (T - rel_interior T) f g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g
[PROOF STEP]
have fST: "f ` S = T" and gTS: "g ` T = S" and "inj_on f S" "inj_on g T"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. f ` S = T &&& g ` T = S &&& inj_on f S &&& inj_on g T
[PROOF STEP]
by (auto simp: inj_on_def intro: rev_image_eqI) metis+
[PROOF STATE]
proof (state)
this:
f ` S = T
g ` T = S
inj_on f S
inj_on g T

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>aff_dim S = aff_dim T; \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (S - rel_interior S) (T - rel_interior T) f g
[PROOF STEP]
have fim: "f ` rel_interior S \<subseteq> rel_interior T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` rel_interior S \<subseteq> rel_interior T
[PROOF STEP]
by (metis \<open>inj_on f S\<close> aff contf continuous_image_subset_rel_interior fST order_refl)
[PROOF STATE]
proof (state)
this:
f ` rel_interior S \<subseteq> rel_interior T

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>aff_dim S = aff_dim T; \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (S - rel_interior S) (T - rel_interior T) f g
[PROOF STEP]
have gim: "g ` rel_interior T \<subseteq> rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` rel_interior T \<subseteq> rel_interior S
[PROOF STEP]
by (metis \<open>inj_on g T\<close> aff contg continuous_image_subset_rel_interior gTS order_refl)
[PROOF STATE]
proof (state)
this:
g ` rel_interior T \<subseteq> rel_interior S

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>aff_dim S = aff_dim T; \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (S - rel_interior S) (T - rel_interior T) f g
[PROOF STEP]
show "homeomorphism (S - rel_interior S) (T - rel_interior T) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism (S - rel_interior S) (T - rel_interior T) f g
[PROOF STEP]
unfolding homeomorphism_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>S - rel_interior S. g (f x) = x) \<and> f ` (S - rel_interior S) = T - rel_interior T \<and> continuous_on (S - rel_interior S) f \<and> (\<forall>y\<in>T - rel_interior T. f (g y) = y) \<and> g ` (T - rel_interior T) = S - rel_interior S \<and> continuous_on (T - rel_interior T) g
[PROOF STEP]
proof (intro conjI ballI)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. \<And>x. x \<in> S - rel_interior S \<Longrightarrow> g (f x) = x
 2. f ` (S - rel_interior S) = T - rel_interior T
 3. continuous_on (S - rel_interior S) f
 4. \<And>y. y \<in> T - rel_interior T \<Longrightarrow> f (g y) = y
 5. g ` (T - rel_interior T) = S - rel_interior S
 6. continuous_on (T - rel_interior T) g
[PROOF STEP]
show gf: "\<And>x. x \<in> S - rel_interior S \<Longrightarrow> g (f x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S - rel_interior S \<Longrightarrow> g (f x) = x
[PROOF STEP]
using S rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. \<And>x. x \<in> S - rel_interior S \<Longrightarrow> g (f x) = x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> S - rel_interior S \<Longrightarrow> g (f ?x) = ?x

goal (5 subgoals):
 1. f ` (S - rel_interior S) = T - rel_interior T
 2. continuous_on (S - rel_interior S) f
 3. \<And>y. y \<in> T - rel_interior T \<Longrightarrow> f (g y) = y
 4. g ` (T - rel_interior T) = S - rel_interior S
 5. continuous_on (T - rel_interior T) g
[PROOF STEP]
show fg: "\<And>y. y \<in> T - rel_interior T \<Longrightarrow> f (g y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> T - rel_interior T \<Longrightarrow> f (g y) = y
[PROOF STEP]
using T mem_rel_interior_ball
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
(?x \<in> rel_interior ?S) = (?x \<in> ?S \<and> (\<exists>e>0. ball ?x e \<inter> affine hull ?S \<subseteq> ?S))

goal (1 subgoal):
 1. \<And>y. y \<in> T - rel_interior T \<Longrightarrow> f (g y) = y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?y \<in> T - rel_interior T \<Longrightarrow> f (g ?y) = ?y

goal (4 subgoals):
 1. f ` (S - rel_interior S) = T - rel_interior T
 2. continuous_on (S - rel_interior S) f
 3. g ` (T - rel_interior T) = S - rel_interior S
 4. continuous_on (T - rel_interior T) g
[PROOF STEP]
show "f ` (S - rel_interior S) = T - rel_interior T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (S - rel_interior S) = T - rel_interior T
[PROOF STEP]
using S fST fim gim
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
f ` S = T
f ` rel_interior S \<subseteq> rel_interior T
g ` rel_interior T \<subseteq> rel_interior S

goal (1 subgoal):
 1. f ` (S - rel_interior S) = T - rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` (S - rel_interior S) = T - rel_interior T

goal (3 subgoals):
 1. continuous_on (S - rel_interior S) f
 2. g ` (T - rel_interior T) = S - rel_interior S
 3. continuous_on (T - rel_interior T) g
[PROOF STEP]
show "continuous_on (S - rel_interior S) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (S - rel_interior S) f
[PROOF STEP]
using contf continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. continuous_on (S - rel_interior S) f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on (S - rel_interior S) f

goal (2 subgoals):
 1. g ` (T - rel_interior T) = S - rel_interior S
 2. continuous_on (T - rel_interior T) g
[PROOF STEP]
show "g ` (T - rel_interior T) = S - rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` (T - rel_interior T) = S - rel_interior S
[PROOF STEP]
using T gTS gim fim
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
g ` T = S
g ` rel_interior T \<subseteq> rel_interior S
f ` rel_interior S \<subseteq> rel_interior T

goal (1 subgoal):
 1. g ` (T - rel_interior T) = S - rel_interior S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g ` (T - rel_interior T) = S - rel_interior S

goal (1 subgoal):
 1. continuous_on (T - rel_interior T) g
[PROOF STEP]
show "continuous_on (T - rel_interior T) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (T - rel_interior T) g
[PROOF STEP]
using contg continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on T g
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. continuous_on (T - rel_interior T) g
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on (T - rel_interior T) g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
homeomorphism (S - rel_interior S) (T - rel_interior T) f g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma disj_lemma: "\<And> x y. rec_exec rec_disj [x, y] = (if x = 0 \<and> y = 0 then 0
                                                     else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. rec_exec rec_disj [x, y] = (if x = 0 \<and> y = 0 then 0 else 1)
[PROOF STEP]
by(induct_tac y, auto simp: rec_disj_def sg_lemma add_lemma rec_exec.simps)


[STATEMENT]
lemma refl_listrelp: "\<forall>x\<in>set xs. R x x \<Longrightarrow> listrelp R xs xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. R x x \<Longrightarrow> listrelp R xs xs
[PROOF STEP]
by (induct xs) (auto intro: listrelp.intros)


[STATEMENT]
lemma vec_to_iarray_inner:
  "a \<bullet> b = vec_to_iarray a \<bullet>i vec_to_iarray b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<bullet> b = vec_to_iarray a \<bullet>i vec_to_iarray b
[PROOF STEP]
proof (unfold inner_iarray_def inner_vec_def, auto, unfold IArray.sub_def[symmetric] IArray.length_def[symmetric])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
have set_rw: "{0..<IArray.length (vec_to_iarray a)}  = (to_nat)`(UNIV::'a set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<IArray.length (vec_to_iarray a)} = range mod_type_class.to_nat
[PROOF STEP]
unfolding vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<IArray.length (IArray.of_fun (\<lambda>i. a $ mod_type_class.from_nat i) CARD('a))} = range mod_type_class.to_nat
[PROOF STEP]
using to_nat_less_card
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat ?j < CARD(?'a)

goal (1 subgoal):
 1. {0..<IArray.length (IArray.of_fun (\<lambda>i. a $ mod_type_class.from_nat i) CARD('a))} = range mod_type_class.to_nat
[PROOF STEP]
using bij_to_nat[where ?'a='a]
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat ?j < CARD(?'a)
bij_betw mod_type_class.to_nat UNIV {0..<CARD('a)}

goal (1 subgoal):
 1. {0..<IArray.length (IArray.of_fun (\<lambda>i. a $ mod_type_class.from_nat i) CARD('a))} = range mod_type_class.to_nat
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat ?j < CARD(?'a)
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('a)}

goal (1 subgoal):
 1. {0..<IArray.length (IArray.of_fun (\<lambda>i. a $ mod_type_class.from_nat i) CARD('a))} = range mod_type_class.to_nat
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<IArray.length (vec_to_iarray a)} = range mod_type_class.to_nat

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
have inj: "inj_on (to_nat::'a=>nat) (UNIV::'a set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj mod_type_class.to_nat
[PROOF STEP]
by (metis strict_mono_imp_inj_on strict_mono_to_nat)
[PROOF STATE]
proof (state)
this:
inj mod_type_class.to_nat

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
have "(\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
    = (\<Sum>n\<in>range (to_nat::'a=>nat). vec_to_iarray a !! n * vec_to_iarray b !! n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>n\<in>range mod_type_class.to_nat. vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
unfolding set_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>range mod_type_class.to_nat. vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>n\<in>range mod_type_class.to_nat. vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>n\<in>range mod_type_class.to_nat. vec_to_iarray a !! n * vec_to_iarray b !! n)

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>n\<in>range mod_type_class.to_nat. vec_to_iarray a !! n * vec_to_iarray b !! n)

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
have "... = (\<Sum>x\<in>(UNIV::'a set). vec_to_iarray a !! to_nat x * vec_to_iarray b !! to_nat x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>range mod_type_class.to_nat. vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>x\<in>UNIV. vec_to_iarray a !! mod_type_class.to_nat x * vec_to_iarray b !! mod_type_class.to_nat x)
[PROOF STEP]
unfolding sum.reindex[OF inj] o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. vec_to_iarray a !! mod_type_class.to_nat x * vec_to_iarray b !! mod_type_class.to_nat x) = (\<Sum>x\<in>UNIV. vec_to_iarray a !! mod_type_class.to_nat x * vec_to_iarray b !! mod_type_class.to_nat x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>range mod_type_class.to_nat. vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>x\<in>UNIV. vec_to_iarray a !! mod_type_class.to_nat x * vec_to_iarray b !! mod_type_class.to_nat x)

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>range mod_type_class.to_nat. vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>x\<in>UNIV. vec_to_iarray a !! mod_type_class.to_nat x * vec_to_iarray b !! mod_type_class.to_nat x)

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
have "...= (\<Sum>x\<in>UNIV. a $ x * b $ x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. vec_to_iarray a !! mod_type_class.to_nat x * vec_to_iarray b !! mod_type_class.to_nat x) = (\<Sum>x\<in>UNIV. a $ x * b $ x)
[PROOF STEP]
unfolding vec_to_iarray_nth'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. a $ x * b $ x) = (\<Sum>x\<in>UNIV. a $ x * b $ x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. vec_to_iarray a !! mod_type_class.to_nat x * vec_to_iarray b !! mod_type_class.to_nat x) = (\<Sum>x\<in>UNIV. a $ x * b $ x)

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>x\<in>UNIV. a $ x * b $ x)
[PROOF STEP]
show "(\<Sum>i\<in>UNIV. a $ i * b $ i)
    = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n) = (\<Sum>x\<in>UNIV. a $ x * b $ x)

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. a $ i * b $ i) = (\<Sum>n = 0..<IArray.length (vec_to_iarray a). vec_to_iarray a !! n * vec_to_iarray b !! n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fun_lam:
    assumes "ide a" and "ide b" and "ide c"
    and "in_hom f (prod a b) c"
    shows "Fun (\<Lambda> a b c f) =
           restrict (\<lambda>x. arr_of (happ (hlam (ide_to_hf a) (ide_to_hf b) (ide_to_hf c) (arr_to_hfun f))
                                  (elem_of x)))
                    (set a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fun (\<Lambda> a b c f) = (\<lambda>x\<^bold>\<in>local.set a. arr_of (happ (hlam (ide_to_hf a) (ide_to_hf b) (ide_to_hf c) (arr_to_hfun f)) (elem_of x)))
[PROOF STEP]
using assms arr_char lam_simps(1) \<Lambda>_def Fun_mkArr
[PROOF STATE]
proof (prove)
using this:
ide a
ide b
ide c
\<guillemotleft>f : local.prod a b \<rightarrow> c\<guillemotright>
arr ?f = (?f \<noteq> concrete_category.Null \<and> finite (concrete_category.Dom ?f) \<and> finite (concrete_category.Cod ?f) \<and> concrete_category.Map ?f \<in> extensional (concrete_category.Dom ?f) \<inter> (concrete_category.Dom ?f \<rightarrow> concrete_category.Cod ?f))
\<lbrakk>ide ?a; ide ?b; ide ?c; \<guillemotleft>?f : local.prod ?a ?b \<rightarrow> ?c\<guillemotright>\<rbrakk> \<Longrightarrow> arr (\<Lambda> ?a ?b ?c ?f)
\<Lambda> ?a ?b ?c ?f = mkArr (local.set ?a) (local.set (exp ?b ?c)) (\<lambda>x. arr_of (happ (hlam (ide_to_hf ?a) (ide_to_hf ?b) (ide_to_hf ?c) (arr_to_hfun ?f)) (elem_of x)))
arr (mkArr ?A ?B ?F) \<Longrightarrow> Fun (mkArr ?A ?B ?F) = restrict ?F ?A

goal (1 subgoal):
 1. Fun (\<Lambda> a b c f) = (\<lambda>x\<^bold>\<in>local.set a. arr_of (happ (hlam (ide_to_hf a) (ide_to_hf b) (ide_to_hf c) (arr_to_hfun f)) (elem_of x)))
[PROOF STEP]
by simp


[STATEMENT]
lemma
      heap_parent_le: "\<lbrakk>heap_invar l; valid l i; has_parent l i\<rbrakk>
        \<Longrightarrow> pparent l i \<le> prio_of l i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>heap_invar l; valid l i; has_parent l i\<rbrakk> \<Longrightarrow> pparent l i \<le> prio_of l i
[PROOF STEP]
unfolding heap_invar_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i. valid l i \<longrightarrow> has_parent l i \<longrightarrow> pparent l i \<le> prio_of l i; valid l i; has_parent l i\<rbrakk> \<Longrightarrow> pparent l i \<le> prio_of l i
[PROOF STEP]
by auto


[STATEMENT]
lemma measure_space_0: "A \<subseteq> Pow \<Omega> \<Longrightarrow> measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>x. 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> Pow \<Omega> \<Longrightarrow> measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>x. 0)
[PROOF STEP]
unfolding measure_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> Pow \<Omega> \<Longrightarrow> sigma_algebra \<Omega> (sigma_sets \<Omega> A) \<and> positive (sigma_sets \<Omega> A) (\<lambda>x. 0) \<and> countably_additive (sigma_sets \<Omega> A) (\<lambda>x. 0)
[PROOF STEP]
by (auto intro!: sigma_algebra_sigma_sets simp: positive_def countably_additive_def)


[STATEMENT]
lemma fun_eq_onI: "(\<And>a. a\<in>A \<Longrightarrow> f a = g a) \<Longrightarrow> fun_eq_on f g A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a \<in> A \<Longrightarrow> f a = g a) \<Longrightarrow> fun_eq_on f g A
[PROOF STEP]
using fun_eq_on_def
[PROOF STATE]
proof (prove)
using this:
fun_eq_on ?f ?g ?A \<equiv> \<forall>a\<in>?A. ?f a = ?g a

goal (1 subgoal):
 1. (\<And>a. a \<in> A \<Longrightarrow> f a = g a) \<Longrightarrow> fun_eq_on f g A
[PROOF STEP]
by fast


[STATEMENT]
lemma tendsto_infdist [tendsto_intros]:
  assumes f: "(f \<longlongrightarrow> l) F"
  shows "((\<lambda>x. infdist (f x) A) \<longlongrightarrow> infdist l A) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. infdist (f x) A) \<longlongrightarrow> infdist l A) F
[PROOF STEP]
proof (rule tendstoI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
fix e ::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
from tendstoD[OF f this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
show "eventually (\<lambda>x. dist (infdist (f x) A) (infdist l A) < e) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. dist (f x) l < e

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
proof (eventually_elim)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. dist (f x) l < e \<Longrightarrow> dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. dist (f x) l < e \<Longrightarrow> dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
from infdist_triangle[of l A "f x"] infdist_triangle[of "f x" A l]
[PROOF STATE]
proof (chain)
picking this:
infdist l A \<le> infdist (f x) A + dist l (f x)
infdist (f x) A \<le> infdist l A + dist (f x) l
[PROOF STEP]
have "dist (infdist (f x) A) (infdist l A) \<le> dist (f x) l"
[PROOF STATE]
proof (prove)
using this:
infdist l A \<le> infdist (f x) A + dist l (f x)
infdist (f x) A \<le> infdist l A + dist (f x) l

goal (1 subgoal):
 1. dist (infdist (f x) A) (infdist l A) \<le> dist (f x) l
[PROOF STEP]
by (simp add: dist_commute dist_real_def)
[PROOF STATE]
proof (state)
this:
dist (infdist (f x) A) (infdist l A) \<le> dist (f x) l

goal (1 subgoal):
 1. \<And>x. dist (f x) l < e \<Longrightarrow> dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist (infdist (f x) A) (infdist l A) \<le> dist (f x) l

goal (1 subgoal):
 1. \<And>x. dist (f x) l < e \<Longrightarrow> dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
assume "dist (f x) l < e"
[PROOF STATE]
proof (state)
this:
dist (f x) l < e

goal (1 subgoal):
 1. \<And>x. dist (f x) l < e \<Longrightarrow> dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
show "dist (infdist (f x) A) (infdist l A) < e"
[PROOF STATE]
proof (prove)
using this:
dist (infdist (f x) A) (infdist l A) < e

goal (1 subgoal):
 1. dist (infdist (f x) A) (infdist l A) < e
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist (infdist (f x) A) (infdist l A) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. dist (infdist (f x) A) (infdist l A) < e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma FDOM_pre_subset_FDOM_valid_states_pair:
  fixes a s
  assumes "a \<in> PROB" "s \<in> valid_states PROB"
  shows "fmdom' (fst a) \<subseteq> fmdom' s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
have "fmdom' (fst a) \<subseteq> (\<lambda>(s1, s2). action_dom s1 s2) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> (case a of (s1, s2) \<Rightarrow> action_dom s1 s2)
[PROOF STEP]
using action_dom_def
[PROOF STATE]
proof (prove)
using this:
action_dom ?s1.0 ?s2.0 \<equiv> fmdom' ?s1.0 \<union> fmdom' ?s2.0

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> (case a of (s1, s2) \<Rightarrow> action_dom s1 s2)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
fmdom' (fst a) \<subseteq> (case a of (s1, s2) \<Rightarrow> action_dom s1 s2)

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fmdom' (fst a) \<subseteq> (case a of (s1, s2) \<Rightarrow> action_dom s1 s2)

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
have "\<dots> \<subseteq> prob_dom PROB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case a of (s1, s2) \<Rightarrow> action_dom s1 s2) \<subseteq> prob_dom PROB
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
a \<in> PROB

goal (1 subgoal):
 1. (case a of (s1, s2) \<Rightarrow> action_dom s1 s2) \<subseteq> prob_dom PROB
[PROOF STEP]
by (simp add: Sup_upper pair_imageI prob_dom_def)
[PROOF STATE]
proof (state)
this:
(case a of (s1, s2) \<Rightarrow> action_dom s1 s2) \<subseteq> prob_dom PROB

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fmdom' (fst a) \<subseteq> prob_dom PROB
[PROOF STEP]
have "fmdom' (fst a) \<subseteq> fmdom' s"
[PROOF STATE]
proof (prove)
using this:
fmdom' (fst a) \<subseteq> prob_dom PROB

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
using assms(2) valid_states_def
[PROOF STATE]
proof (prove)
using this:
fmdom' (fst a) \<subseteq> prob_dom PROB
s \<in> valid_states PROB
valid_states ?prob \<equiv> {s. fmdom' s = prob_dom ?prob}

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
fmdom' (fst a) \<subseteq> fmdom' s

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
fmdom' (fst a) \<subseteq> fmdom' s

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fmdom' (fst a) \<subseteq> fmdom' s

goal (1 subgoal):
 1. fmdom' (fst a) \<subseteq> fmdom' s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fmdom' (fst a) \<subseteq> fmdom' s

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>TODO unwrap the simp proof.\<close>


[STATEMENT]
lemma eval_monom_neg:
  assumes "basis_wf basis" "fst monom < 0"
  shows   "eventually (\<lambda>x. eval_monom monom basis x < 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. eval_monom monom basis x < 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. eval_monom monom basis x < 0
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
basis_wf basis
fst monom < 0
[PROOF STEP]
have "eventually (\<lambda>x. eval_monom (-fst monom, snd monom) basis x > 0) at_top"
[PROOF STATE]
proof (prove)
using this:
basis_wf basis
fst monom < 0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval_monom (- fst monom, snd monom) basis x
[PROOF STEP]
by (intro eval_monom_pos) simp_all
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 0 < eval_monom (- fst monom, snd monom) basis x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. eval_monom monom basis x < 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 0 < eval_monom (- fst monom, snd monom) basis x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. eval_monom monom basis x < 0
[PROOF STEP]
by (simp add: eval_monom_uminus)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. eval_monom monom basis x < 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex1_lemma [simp]:
  "rec_eval (rec_ex1 f) [x, y] = (if (\<exists>z \<le> x. 0 < rec_eval f [z, y]) then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_eval (rec_ex1 f) [x, y] = (if \<exists>z\<le>x. 0 < rec_eval f [z, y] then 1 else 0)
[PROOF STEP]
by (simp add: rec_ex1_def)


[STATEMENT]
lemma zero_account_alt_def: "just_cash 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. just_cash 0 = 0
[PROOF STEP]
unfolding zero_account_def just_cash_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<iota> (\<lambda>n. if n = 0 then 0 else 0) = \<iota> (\<lambda>_. 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma monotone_ldrop: "monotone (rel_prod (=) (\<sqsubseteq>)) (\<sqsubseteq>) (case_prod ldrop)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (rel_prod (=) (\<sqsubseteq>)) (\<sqsubseteq>) (\<lambda>(x, y). ldrop x y)
[PROOF STEP]
by(rule llist.fixp_preserves_mono2[OF ldrop.mono ldrop_def]) simp


[STATEMENT]
lemma homeomorphic_rel_interiors:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "S homeomorphic T" "rel_interior S = {} \<longleftrightarrow> rel_interior T = {}"
    shows "(rel_interior S) homeomorphic (rel_interior T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior S homeomorphic rel_interior T
[PROOF STEP]
proof (cases "rel_interior T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel_interior T = {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
 2. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
rel_interior T = {}

goal (2 subgoals):
 1. rel_interior T = {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
 2. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
rel_interior T = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
rel_interior T = {}

goal (1 subgoal):
 1. rel_interior S homeomorphic rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior S homeomorphic rel_interior T

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
rel_interior T \<noteq> {}

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
have "aff_dim (affine hull S) \<le> aff_dim (affine hull T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
using False assms homeomorphic_aff_dim_le
[PROOF STATE]
proof (prove)
using this:
rel_interior T \<noteq> {}
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
\<lbrakk>?S homeomorphic ?T; rel_interior ?S \<noteq> {}\<rbrakk> \<Longrightarrow> aff_dim (affine hull ?S) \<le> aff_dim (affine hull ?T)

goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
have "aff_dim (affine hull T) \<le> aff_dim (affine hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
using False assms(1) homeomorphic_aff_dim_le homeomorphic_sym
[PROOF STATE]
proof (prove)
using this:
rel_interior T \<noteq> {}
S homeomorphic T
\<lbrakk>?S homeomorphic ?T; rel_interior ?S \<noteq> {}\<rbrakk> \<Longrightarrow> aff_dim (affine hull ?S) \<le> aff_dim (affine hull ?T)
?s homeomorphic ?t = ?t homeomorphic ?s

goal (1 subgoal):
 1. aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull T) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
have "aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
using this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
aff_dim (affine hull T) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. aff_dim S = aff_dim T
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
aff_dim S = aff_dim T

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim S = aff_dim T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim S = aff_dim T

goal (1 subgoal):
 1. rel_interior S homeomorphic rel_interior T
[PROOF STEP]
by (rule homeomorphic_rel_interiors_same_dimension [OF \<open>S homeomorphic T\<close>])
[PROOF STATE]
proof (state)
this:
rel_interior S homeomorphic rel_interior T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma n_mult_least_upper_bound:
  "n(x) \<le> n(y) \<and> n(x) \<le> n(z) \<longleftrightarrow> n(x) \<le> n(y) * n(z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n x \<le> n y \<and> n x \<le> n z) = (n x \<le> n y * n z)
[PROOF STEP]
by (metis order.trans mult_left_isotone n_mult_commutative n_mult_right_lower_bound n_order)


[STATEMENT]
lemma Range_set_zip[simp]:
  assumes "length A = length B"
  shows "Range (set (zip A B)) = set B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Range (set (zip A B)) = set B
[PROOF STEP]
unfolding Range_snd set_map[symmetric] map_snd_zip[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set B = set B
[PROOF STEP]
..