[STATEMENT]
lemma weak_integer_composition_enum_length:
  "xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l
[PROOF STEP]
proof(induct l arbitrary: xs i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs i. xs \<in> set (weak_integer_composition_enum i 0) \<Longrightarrow> length xs = 0
 2. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
xs \<in> set (weak_integer_composition_enum i 0)

goal (2 subgoals):
 1. \<And>xs i. xs \<in> set (weak_integer_composition_enum i 0) \<Longrightarrow> length xs = 0
 2. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<in> set (weak_integer_composition_enum i 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
xs \<in> set (weak_integer_composition_enum i 0)

goal (1 subgoal):
 1. length xs = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length xs = 0

goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
case (Suc l)
[PROOF STATE]
proof (state)
this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> length ?xs = l
xs \<in> set (weak_integer_composition_enum i (Suc l))

goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> length ?xs = l
xs \<in> set (weak_integer_composition_enum i (Suc l))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> length ?xs = l
xs \<in> set (weak_integer_composition_enum i (Suc l))

goal (1 subgoal):
 1. length xs = Suc l
[PROOF STEP]
by(cases l) auto
[PROOF STATE]
proof (state)
this:
length xs = Suc l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma twice_field_differentiable_at_power [simp, intro]:
  "(\<lambda>x. x ^ n) twice_field_differentiable_at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
have "\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
have "deriv ((\<lambda>x. x ^ n)) field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
have "deriv ((\<lambda>x. x ^ n)) = (\<lambda>x. of_nat n * x ^ (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))
[PROOF STEP]
by (simp add: ext)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))

goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))

goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
using field_differentiable_mult[of "\<lambda>x. of_nat n" x UNIV "\<lambda>x. x ^ (n - 1)"]
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))
\<lbrakk>(\<lambda>x. of_nat n) field_differentiable at x; (\<lambda>x. x ^ (n - 1)) field_differentiable at x\<rbrakk> \<Longrightarrow> (\<lambda>z. of_nat n * z ^ (n - 1)) field_differentiable at x

goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
by (simp add: field_differentiable_caratheodory_at)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. x ^ n) field_differentiable at x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x
deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x
deriv (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
unfolding twice_field_differentiable_at_def field_differentiable_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x
deriv (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. \<exists>S. (\<forall>x\<in>S. (\<lambda>x. x ^ n) field_differentiable at x within S) \<and> x \<in> interior S \<and> deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x ^ n) twice_field_differentiable_at x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma listset_card[simp]: "card (listset XS) = prod_list (map card XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (listset XS) = prod_list (map card XS)
[PROOF STEP]
proof (induct XS)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card (listset []) = prod_list (map card [])
 2. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card (listset []) = prod_list (map card [])
 2. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (listset []) = prod_list (map card [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (listset []) = prod_list (map card [])

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
case (Cons A XS)
[PROOF STATE]
proof (state)
this:
card (listset XS) = prod_list (map card XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have 1: "inj (case_prod Cons)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>(x, y). x # y)
[PROOF STEP]
unfolding inj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (case x of (x, xa) \<Rightarrow> x # xa) = (case y of (x, xa) \<Rightarrow> x # xa) \<longrightarrow> x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj (\<lambda>(x, y). x # y)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "listset (A # XS) = case_prod Cons ` (A \<times> listset XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. listset (A # XS) = (\<lambda>(x, y). x # y) ` (A \<times> listset XS)
[PROOF STEP]
by (auto simp: set_Cons_def)
[PROOF STATE]
proof (state)
this:
listset (A # XS) = (\<lambda>(x, y). x # y) ` (A \<times> listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
listset (A # XS) = (\<lambda>(x, y). x # y) ` (A \<times> listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "card \<dots> = card (A \<times> listset XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>(x, y). x # y) ` (A \<times> listset XS)) = card (A \<times> listset XS)
[PROOF STEP]
using card_image 1
[PROOF STATE]
proof (prove)
using this:
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A
inj (\<lambda>(x, y). x # y)

goal (1 subgoal):
 1. card ((\<lambda>(x, y). x # y) ` (A \<times> listset XS)) = card (A \<times> listset XS)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card ((\<lambda>(x, y). x # y) ` (A \<times> listset XS)) = card (A \<times> listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((\<lambda>(x, y). x # y) ` (A \<times> listset XS)) = card (A \<times> listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "\<dots> = card A * card (listset XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<times> listset XS) = card A * card (listset XS)
[PROOF STEP]
using card_cartesian_product
[PROOF STATE]
proof (prove)
using this:
card (?A \<times> ?B) = card ?A * card ?B

goal (1 subgoal):
 1. card (A \<times> listset XS) = card A * card (listset XS)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (A \<times> listset XS) = card A * card (listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (A \<times> listset XS) = card A * card (listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "card (listset XS) = prod_list (map card XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (listset XS) = prod_list (map card XS)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
card (listset XS) = prod_list (map card XS)

goal (1 subgoal):
 1. card (listset XS) = prod_list (map card XS)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (listset XS) = prod_list (map card XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (listset XS) = prod_list (map card XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "card A * \<dots> = prod_list (map card (A # XS))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A * prod_list (map card XS) = prod_list (map card (A # XS))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card A * prod_list (map card XS) = prod_list (map card (A # XS))

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (listset (A # XS)) = prod_list (map card (A # XS))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (listset (A # XS)) = prod_list (map card (A # XS))

goal (1 subgoal):
 1. card (listset (A # XS)) = prod_list (map card (A # XS))
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (listset (A # XS)) = prod_list (map card (A # XS))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_on_linord_of_list:
  assumes "Linear_order r"
  assumes "set xs = Field r"
  assumes "sorted_on r xs"
  assumes "distinct xs"
  shows "linord_of_list (rev xs) = r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linord_of_list (rev xs) = r
[PROOF STEP]
proof(rule equalityI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. linord_of_list (rev xs) \<subseteq> r
 2. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs
[PROOF STEP]
show "linord_of_list (rev xs) \<subseteq> r"
[PROOF STATE]
proof (prove)
using this:
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs

goal (1 subgoal):
 1. linord_of_list (rev xs) \<subseteq> r
[PROOF STEP]
using sorted_on_linord_of_list_subseteq_r
[PROOF STATE]
proof (prove)
using this:
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs
\<lbrakk>Linear_order ?r; sorted_on ?r ?xs; distinct ?xs\<rbrakk> \<Longrightarrow> linord_of_list (rev ?xs) \<subseteq> ?r

goal (1 subgoal):
 1. linord_of_list (rev xs) \<subseteq> r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linord_of_list (rev xs) \<subseteq> r

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
assume xy: "(x, y) \<in> r"
[PROOF STATE]
proof (state)
this:
(x, y) \<in> r

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
with \<open>Linear_order r\<close>
[PROOF STATE]
proof (chain)
picking this:
Linear_order r
(x, y) \<in> r
[PROOF STEP]
have "(y, x) \<notin> r - Id"
[PROOF STATE]
proof (prove)
using this:
Linear_order r
(x, y) \<in> r

goal (1 subgoal):
 1. (y, x) \<notin> r - Id
[PROOF STEP]
using Linear_order_in_diff_Id
[PROOF STATE]
proof (prove)
using this:
Linear_order r
(x, y) \<in> r
\<lbrakk>Linear_order ?r; ?a \<in> Field ?r; ?b \<in> Field ?r\<rbrakk> \<Longrightarrow> ((?a, ?b) \<in> ?r) = ((?b, ?a) \<notin> ?r - Id)

goal (1 subgoal):
 1. (y, x) \<notin> r - Id
[PROOF STEP]
by (fastforce intro: FieldI1)
[PROOF STATE]
proof (state)
this:
(y, x) \<notin> r - Id

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
with linord_of_list_Linear_order[of "rev xs" "Field r"] assms xy
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>distinct (rev xs); Field r = set (rev xs)\<rbrakk> \<Longrightarrow> linear_order_on (Field r) (linord_of_list (rev xs))
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs
(x, y) \<in> r
(y, x) \<notin> r - Id
[PROOF STEP]
have "(x, y) \<in> linord_of_list (rev xs)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>distinct (rev xs); Field r = set (rev xs)\<rbrakk> \<Longrightarrow> linear_order_on (Field r) (linord_of_list (rev xs))
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs
(x, y) \<in> r
(y, x) \<notin> r - Id

goal (1 subgoal):
 1. (x, y) \<in> linord_of_list (rev xs)
[PROOF STEP]
by simp (metis Diff_subset FieldI1 FieldI2 Linear_order_in_diff_Id linord_of_list_Field set_rev sorted_on_linord_of_list_subseteq_r subset_eq)
[PROOF STATE]
proof (state)
this:
(x, y) \<in> linord_of_list (rev xs)

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(?x2, ?y2) \<in> r \<Longrightarrow> (?x2, ?y2) \<in> linord_of_list (rev xs)

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?x2, ?y2) \<in> r \<Longrightarrow> (?x2, ?y2) \<in> linord_of_list (rev xs)
[PROOF STEP]
show "r \<subseteq> linord_of_list (rev xs)"
[PROOF STATE]
proof (prove)
using this:
(?x2, ?y2) \<in> r \<Longrightarrow> (?x2, ?y2) \<in> linord_of_list (rev xs)

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
by clarsimp
[PROOF STATE]
proof (state)
this:
r \<subseteq> linord_of_list (rev xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in monoid_cancel) divides_mult_l [simp]:
  assumes carr: "a \<in> carrier G"  "b \<in> carrier G"  "c \<in> carrier G"
  shows "(c \<otimes> a) divides (c \<otimes> b) = a divides b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<otimes> a divides c \<otimes> b = a divides b
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b
 2. a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b
[PROOF STEP]
show "c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b
[PROOF STEP]
using carr monoid.m_assoc monoid_axioms monoid_cancel.l_cancel monoid_cancel_axioms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
b \<in> carrier G
c \<in> carrier G
\<lbrakk>Group.monoid ?G; ?x \<in> carrier ?G; ?y \<in> carrier ?G; ?z \<in> carrier ?G\<rbrakk> \<Longrightarrow> ?x \<otimes>\<^bsub>?G\<^esub> ?y \<otimes>\<^bsub>?G\<^esub> ?z = ?x \<otimes>\<^bsub>?G\<^esub> (?y \<otimes>\<^bsub>?G\<^esub> ?z)
Group.monoid G
\<lbrakk>monoid_cancel ?G; ?c \<otimes>\<^bsub>?G\<^esub> ?a = ?c \<otimes>\<^bsub>?G\<^esub> ?b; ?a \<in> carrier ?G; ?b \<in> carrier ?G; ?c \<in> carrier ?G\<rbrakk> \<Longrightarrow> ?a = ?b
monoid_cancel G

goal (1 subgoal):
 1. c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b

goal (1 subgoal):
 1. a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b
[PROOF STEP]
show "a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b
[PROOF STEP]
using carr(1) carr(3)
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
c \<in> carrier G

goal (1 subgoal):
 1. a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_distinct: "finite s \<Longrightarrow> finite {xs . set xs \<subseteq> s \<and> distinct xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
assume "finite s"
[PROOF STATE]
proof (state)
this:
finite s

goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
hence "{xs . set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}"
[PROOF STATE]
proof (prove)
using this:
finite s

goal (1 subgoal):
 1. {xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
using distinct_length_le
[PROOF STATE]
proof (prove)
using this:
finite s
\<lbrakk>finite ?s; set ?xs \<subseteq> ?s; distinct ?xs\<rbrakk> \<Longrightarrow> length ?xs \<le> card ?s

goal (1 subgoal):
 1. {xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}

goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}

goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
have "finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
using finite_lists_length_le[OF \<open>finite s\<close>]
[PROOF STATE]
proof (prove)
using this:
finite {xs. set xs \<subseteq> s \<and> length xs \<le> ?n}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}

goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {xs. set xs \<subseteq> s \<and> distinct xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_det_bound_of_int: fixes A :: "'a :: linordered_idom mat"
  assumes db: "is_det_bound db"
  and A: "A \<in> carrier_mat n n"
  and "A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)"
shows "abs (det A) \<le> of_int (db n bnd)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_det_bound db
A \<in> carrier_mat n n
A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)
[PROOF STEP]
have "A \<in> \<int>\<^sub>m"
[PROOF STATE]
proof (prove)
using this:
is_det_bound db
A \<in> carrier_mat n n
A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)

goal (1 subgoal):
 1. A \<in> \<int>\<^sub>m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> \<int>\<^sub>m

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
from Ints_matE[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>B. A = of_int_hom.mat_hom B
[PROOF STEP]
obtain B where
    AB: "A = map_mat of_int B"
[PROOF STATE]
proof (prove)
using this:
\<exists>B. A = of_int_hom.mat_hom B

goal (1 subgoal):
 1. (\<And>B. A = of_int_hom.mat_hom B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = of_int_hom.mat_hom B

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_det_bound db
A \<in> carrier_mat n n
A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)
[PROOF STEP]
have "A \<in> Bounded_mat (of_int bnd)"
[PROOF STATE]
proof (prove)
using this:
is_det_bound db
A \<in> carrier_mat n n
A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)

goal (1 subgoal):
 1. A \<in> Bounded_mat (of_int bnd)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> Bounded_mat (of_int bnd)

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
hence "B \<in> Bounded_mat bnd"
[PROOF STATE]
proof (prove)
using this:
A \<in> Bounded_mat (of_int bnd)

goal (1 subgoal):
 1. B \<in> Bounded_mat bnd
[PROOF STEP]
unfolding AB Bounded_mat_elements_mat
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>elements_mat (of_int_hom.mat_hom B). \<bar>x\<bar> \<le> of_int bnd

goal (1 subgoal):
 1. \<forall>x\<in>elements_mat B. \<bar>x\<bar> \<le> bnd
[PROOF STEP]
by (auto simp flip: of_int_abs)
[PROOF STATE]
proof (state)
this:
B \<in> Bounded_mat bnd

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
from db[unfolded is_det_bound_def, rule_format, OF _ this, of n] AB A
[PROOF STATE]
proof (chain)
picking this:
B \<in> carrier_mat n n \<Longrightarrow> \<bar>det B\<bar> \<le> db n bnd
A = of_int_hom.mat_hom B
A \<in> carrier_mat n n
[PROOF STEP]
have "\<bar>det B\<bar> \<le> db n bnd"
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n \<Longrightarrow> \<bar>det B\<bar> \<le> db n bnd
A = of_int_hom.mat_hom B
A \<in> carrier_mat n n

goal (1 subgoal):
 1. \<bar>det B\<bar> \<le> db n bnd
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>det B\<bar> \<le> db n bnd

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>det B\<bar> \<le> db n bnd

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
unfolding AB of_int_hom.hom_det
[PROOF STATE]
proof (prove)
using this:
\<bar>det B\<bar> \<le> db n bnd

goal (1 subgoal):
 1. \<bar>of_int (det B)\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
by (simp flip: of_int_abs)
[PROOF STATE]
proof (state)
this:
\<bar>det A\<bar> \<le> of_int (db n bnd)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_If_set:
  assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'"
  assumes P: "A \<inter> space M \<in> sets M"
  shows "(\<lambda>x. if x \<in> A then f x else g x) \<in> measurable M M'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> A then f x else g x) \<in> M \<rightarrow>\<^sub>M M'
[PROOF STEP]
proof (rule measurable_If[OF measure])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} \<in> sets M
[PROOF STEP]
have "{x \<in> space M. x \<in> A} = A \<inter> space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} = A \<inter> space M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> space M. x \<in> A} = A \<inter> space M

goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} \<in> sets M
[PROOF STEP]
thus "{x \<in> space M. x \<in> A} \<in> sets M"
[PROOF STATE]
proof (prove)
using this:
{x \<in> space M. x \<in> A} = A \<inter> space M

goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} \<in> sets M
[PROOF STEP]
using \<open>A \<inter> space M \<in> sets M\<close>
[PROOF STATE]
proof (prove)
using this:
{x \<in> space M. x \<in> A} = A \<inter> space M
A \<inter> space M \<in> sets M

goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} \<in> sets M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> space M. x \<in> A} \<in> sets M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_orbit_list:
  assumes "x \<in> orbit f x"
  shows "set (orbit_list f x) = orbit f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (orbit_list f x) = orbit f x
[PROOF STEP]
by (simp add: orbit_list_def orbit_conv_funpow_dist1[OF assms] set_iterate)


[STATEMENT]
theorem smullyan_double_fixed_point_theorem:
  assumes "recfn 2 g" and "total g" and "recfn 2 h" and "total h"
  shows "\<exists>m n.
    (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and>
    (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
obtain m where
    "recfn 1 m" and
    "total m" and
    m: "\<forall>x y. eval r_phi [the (eval m [x]), y] =
      eval r_phi [the (eval g [the (eval m [x]), x]), y]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. \<lbrakk>recfn 1 m; Partial_Recursive.total m; \<forall>x y. eval r_phi [the (eval m [x]), y] = eval r_phi [the (eval g [the (eval m [x]), x]), y]\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using kleene_fixed_point_theorem_2[of g] assms(1,2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>recfn 2 g; Partial_Recursive.total g\<rbrakk> \<Longrightarrow> \<exists>n. recfn 1 n \<and> Partial_Recursive.total n \<and> (\<forall>x y. eval r_phi [the (eval n [x]), y] = eval r_phi [the (eval g [the (eval n [x]), x]), y])
recfn 2 g
Partial_Recursive.total g

goal (1 subgoal):
 1. (\<And>m. \<lbrakk>recfn 1 m; Partial_Recursive.total m; \<forall>x y. eval r_phi [the (eval m [x]), y] = eval r_phi [the (eval g [the (eval m [x]), x]), y]\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
recfn 1 m
Partial_Recursive.total m
\<forall>x y. eval r_phi [the (eval m [x]), y] = eval r_phi [the (eval g [the (eval m [x]), x]), y]

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
define k where "k = Cn 1 h [m, Id 1 0]"
[PROOF STATE]
proof (state)
this:
k = Cn 1 h [m, recf.Id 1 0]

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = Cn 1 h [m, recf.Id 1 0]
[PROOF STEP]
have "recfn 1 k"
[PROOF STATE]
proof (prove)
using this:
k = Cn 1 h [m, recf.Id 1 0]

goal (1 subgoal):
 1. recfn 1 k
[PROOF STEP]
using \<open>recfn 1 m\<close> assms(3)
[PROOF STATE]
proof (prove)
using this:
k = Cn 1 h [m, recf.Id 1 0]
recfn 1 m
recfn 2 h

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

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
have "total (Id 1 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Partial_Recursive.total (recf.Id 1 0)
[PROOF STEP]
by (simp add: Mn_free_imp_total)
[PROOF STATE]
proof (state)
this:
Partial_Recursive.total (recf.Id 1 0)

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Partial_Recursive.total (recf.Id 1 0)
[PROOF STEP]
have "total k"
[PROOF STATE]
proof (prove)
using this:
Partial_Recursive.total (recf.Id 1 0)

goal (1 subgoal):
 1. Partial_Recursive.total k
[PROOF STEP]
using \<open>total m\<close> assms(4) Cn_total k_def \<open>recfn 1 k\<close>
[PROOF STATE]
proof (prove)
using this:
Partial_Recursive.total (recf.Id 1 0)
Partial_Recursive.total m
Partial_Recursive.total h
\<lbrakk>\<forall>g\<in>set ?gs. Partial_Recursive.total g; Partial_Recursive.total ?f; recfn ?n (Cn ?n ?f ?gs)\<rbrakk> \<Longrightarrow> Partial_Recursive.total (Cn ?n ?f ?gs)
k = Cn 1 h [m, recf.Id 1 0]
recfn 1 k

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

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
obtain n where n: "\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval k [n]), x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. \<forall>x. eval r_phi [n, x] = eval r_phi [the (eval k [n]), x] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using rogers_fixed_point_theorem[of k] \<open>recfn 1 k\<close> \<open>total k\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>recfn 1 k; Partial_Recursive.total k\<rbrakk> \<Longrightarrow> \<exists>n\<ge>?k. \<forall>x. eval r_phi [n, x] = eval r_phi [the (eval k [n]), x]
recfn 1 k
Partial_Recursive.total k

goal (1 subgoal):
 1. (\<And>n. \<forall>x. eval r_phi [n, x] = eval r_phi [the (eval k [n]), x] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval k [n]), x]

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
obtain mm where mm: "eval m [n] \<down>= mm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>mm. eval m [n] \<down>= mm \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>total m\<close> \<open>recfn 1 m\<close>
[PROOF STATE]
proof (prove)
using this:
Partial_Recursive.total m
recfn 1 m

goal (1 subgoal):
 1. (\<And>mm. eval m [n] \<down>= mm \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
eval m [n] \<down>= mm

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval m [n] \<down>= mm
[PROOF STEP]
have "\<forall>x. eval r_phi [mm, x] = eval r_phi [the (eval g [mm, n]), x]"
[PROOF STATE]
proof (prove)
using this:
eval m [n] \<down>= mm

goal (1 subgoal):
 1. \<forall>x. eval r_phi [mm, x] = eval r_phi [the (eval g [mm, n]), x]
[PROOF STEP]
by (metis m option.sel)
[PROOF STATE]
proof (state)
this:
\<forall>x. eval r_phi [mm, x] = eval r_phi [the (eval g [mm, n]), x]

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x. eval r_phi [mm, x] = eval r_phi [the (eval g [mm, n]), x]

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
have "\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [mm, n]), x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [mm, n]), x]
[PROOF STEP]
using k_def assms(3) \<open>total m\<close> \<open>recfn 1 m\<close> mm n
[PROOF STATE]
proof (prove)
using this:
k = Cn 1 h [m, recf.Id 1 0]
recfn 2 h
Partial_Recursive.total m
recfn 1 m
eval m [n] \<down>= mm
\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval k [n]), x]

goal (1 subgoal):
 1. \<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [mm, n]), x]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [mm, n]), x]

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. eval r_phi [mm, x] = eval r_phi [the (eval g [mm, n]), x]
\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [mm, n]), x]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x. eval r_phi [mm, x] = eval r_phi [the (eval g [mm, n]), x]
\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [mm, n]), x]

goal (1 subgoal):
 1. \<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>m n. (\<forall>x. eval r_phi [m, x] = eval r_phi [the (eval g [m, n]), x]) \<and> (\<forall>x. eval r_phi [n, x] = eval r_phi [the (eval h [m, n]), x])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in semiring_of_sets) generated_ring_disjoint_Union:
  assumes "finite A" shows "A \<subseteq> generated_ring \<Longrightarrow> disjoint A \<Longrightarrow> \<Union>A \<in> generated_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> generated_ring; disjoint A\<rbrakk> \<Longrightarrow> \<Union> A \<in> generated_ring
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> generated_ring; disjoint A\<rbrakk> \<Longrightarrow> \<Union> A \<in> generated_ring
[PROOF STEP]
by (induct A) (auto simp: disjoint_def intro!: generated_ring_disjoint_Un generated_ring_empty)


[STATEMENT]
lemma aux1_1_digit_lt_linear:
  assumes "b < 2^r" "k \<ge> r"
  shows  "bin_carry (a*2^r) b k = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_carry (a * 2 ^ r) b k = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bin_carry (a * 2 ^ r) b k = 0
[PROOF STEP]
have "b < 2^r \<longrightarrow>(a*2^r) \<bottom> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b < 2 ^ r \<longrightarrow> a * 2 ^ r \<bottom> b
[PROOF STEP]
proof(induct a  b rule: bitAND_nat.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>uu_. uu_ < 2 ^ r \<longrightarrow> 0 * 2 ^ r \<bottom> uu_
 2. \<And>v n. n div 2 < 2 ^ r \<longrightarrow> Suc v div 2 * 2 ^ r \<bottom> n div 2 \<Longrightarrow> n < 2 ^ r \<longrightarrow> Suc v * 2 ^ r \<bottom> n
[PROOF STEP]
case (1 uu)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>uu_. uu_ < 2 ^ r \<longrightarrow> 0 * 2 ^ r \<bottom> uu_
 2. \<And>v n. n div 2 < 2 ^ r \<longrightarrow> Suc v div 2 * 2 ^ r \<bottom> n div 2 \<Longrightarrow> n < 2 ^ r \<longrightarrow> Suc v * 2 ^ r \<bottom> n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uu < 2 ^ r \<longrightarrow> 0 * 2 ^ r \<bottom> uu
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
uu < 2 ^ r \<longrightarrow> 0 * 2 ^ r \<bottom> uu

goal (1 subgoal):
 1. \<And>v n. n div 2 < 2 ^ r \<longrightarrow> Suc v div 2 * 2 ^ r \<bottom> n div 2 \<Longrightarrow> n < 2 ^ r \<longrightarrow> Suc v * 2 ^ r \<bottom> n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v n. n div 2 < 2 ^ r \<longrightarrow> Suc v div 2 * 2 ^ r \<bottom> n div 2 \<Longrightarrow> n < 2 ^ r \<longrightarrow> Suc v * 2 ^ r \<bottom> n
[PROOF STEP]
case (2 v n)
[PROOF STATE]
proof (state)
this:
n div 2 < 2 ^ r \<longrightarrow> Suc v div 2 * 2 ^ r \<bottom> n div 2

goal (1 subgoal):
 1. \<And>v n. n div 2 < 2 ^ r \<longrightarrow> Suc v div 2 * 2 ^ r \<bottom> n div 2 \<Longrightarrow> n < 2 ^ r \<longrightarrow> Suc v * 2 ^ r \<bottom> n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < 2 ^ r \<longrightarrow> Suc v * 2 ^ r \<bottom> n
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < 2 ^ r \<Longrightarrow> 2 ^ r + v * 2 ^ r && n = 0
[PROOF STEP]
using bitAND_linear[of n r 0 0 "Suc(v)"] bitAND_commutes
[PROOF STATE]
proof (prove)
using this:
n < 2 ^ r \<and> 0 < 2 ^ r \<Longrightarrow> 0 * 2 ^ r + n && Suc v * 2 ^ r + 0 = (0 && Suc v) * 2 ^ r + (n && 0)
?m && ?n = ?n && ?m

goal (1 subgoal):
 1. n < 2 ^ r \<Longrightarrow> 2 ^ r + v * 2 ^ r && n = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n < 2 ^ r \<longrightarrow> Suc v * 2 ^ r \<bottom> n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b < 2 ^ r \<longrightarrow> a * 2 ^ r \<bottom> b

goal (1 subgoal):
 1. bin_carry (a * 2 ^ r) b k = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b < 2 ^ r \<longrightarrow> a * 2 ^ r \<bottom> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b < 2 ^ r \<longrightarrow> a * 2 ^ r \<bottom> b

goal (1 subgoal):
 1. bin_carry (a * 2 ^ r) b k = 0
[PROOF STEP]
using ortho_mult_equiv no_carry_mult_equiv assms(1)
[PROOF STATE]
proof (prove)
using this:
b < 2 ^ r \<longrightarrow> a * 2 ^ r \<bottom> b
(?a \<bottom> ?b) = (\<forall>k. ?a \<exclamdown> k * ?b \<exclamdown> k = 0)
(\<forall>k. ?a \<exclamdown> k * ?b \<exclamdown> k = 0) = (\<forall>k. bin_carry ?a ?b k = 0)
b < 2 ^ r

goal (1 subgoal):
 1. bin_carry (a * 2 ^ r) b k = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bin_carry (a * 2 ^ r) b k = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aff_dim_eq_dim:
  "aff_dim S = int (dim ((+) (- a) ` S))" if "a \<in> affine hull S"
    for S :: "'n::euclidean_space set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S = int (dim ((+) (- a) ` S))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim S = int (dim ((+) (- a) ` S))
[PROOF STEP]
have "0 \<in> affine hull (+) (- a) ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'n) \<in> affine hull (+) (- a) ` S
[PROOF STEP]
unfolding affine_hull_translation
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'n) \<in> (+) (- a) ` (affine hull S)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
a \<in> affine hull S

goal (1 subgoal):
 1. (0::'n) \<in> (+) (- a) ` (affine hull S)
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
(0::'n) \<in> affine hull (+) (- a) ` S

goal (1 subgoal):
 1. aff_dim S = int (dim ((+) (- a) ` S))
[PROOF STEP]
with aff_dim_zero
[PROOF STATE]
proof (chain)
picking this:
(0::?'n) \<in> affine hull ?S \<Longrightarrow> aff_dim ?S = int (dim ?S)
(0::'n) \<in> affine hull (+) (- a) ` S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0::?'n) \<in> affine hull ?S \<Longrightarrow> aff_dim ?S = int (dim ?S)
(0::'n) \<in> affine hull (+) (- a) ` S

goal (1 subgoal):
 1. aff_dim S = int (dim ((+) (- a) ` S))
[PROOF STEP]
by (metis aff_dim_translation_eq)
[PROOF STATE]
proof (state)
this:
aff_dim S = int (dim ((+) (- a) ` S))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infinite_imp_many_elems:
  "infinite A \<Longrightarrow> \<exists> xs. set xs \<subseteq> A \<and> length xs = n \<and> distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = n \<and> distinct xs
[PROOF STEP]
proof (induct n arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = 0 \<and> distinct xs
 2. \<And>n A. \<lbrakk>\<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = n \<and> distinct xs; infinite A\<rbrakk> \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = Suc n \<and> distinct xs
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
infinite ?A \<Longrightarrow> \<exists>xs. set xs \<subseteq> ?A \<and> length xs = n \<and> distinct xs
infinite A

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = 0 \<and> distinct xs
 2. \<And>n A. \<lbrakk>\<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = n \<and> distinct xs; infinite A\<rbrakk> \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = Suc n \<and> distinct xs
[PROOF STEP]
from infinite_imp_elem[OF Suc(2)]
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. x \<in> A
[PROOF STEP]
obtain x where x: "x \<in> A"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x \<in> A

goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> A

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = 0 \<and> distinct xs
 2. \<And>n A. \<lbrakk>\<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = n \<and> distinct xs; infinite A\<rbrakk> \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = Suc n \<and> distinct xs
[PROOF STEP]
from Suc(2)
[PROOF STATE]
proof (chain)
picking this:
infinite A
[PROOF STEP]
have "infinite (A - {x})"
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. infinite (A - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
infinite (A - {x})

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = 0 \<and> distinct xs
 2. \<And>n A. \<lbrakk>\<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = n \<and> distinct xs; infinite A\<rbrakk> \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = Suc n \<and> distinct xs
[PROOF STEP]
from Suc(1)[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>xs. set xs \<subseteq> A - {x} \<and> length xs = n \<and> distinct xs
[PROOF STEP]
obtain xs where "set xs \<subseteq> A - {x}" and "length xs = n" and "distinct xs"
[PROOF STATE]
proof (prove)
using this:
\<exists>xs. set xs \<subseteq> A - {x} \<and> length xs = n \<and> distinct xs

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>set xs \<subseteq> A - {x}; length xs = n; distinct xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> A - {x}
length xs = n
distinct xs

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = 0 \<and> distinct xs
 2. \<And>n A. \<lbrakk>\<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = n \<and> distinct xs; infinite A\<rbrakk> \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = Suc n \<and> distinct xs
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
set xs \<subseteq> A - {x}
length xs = n
distinct xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
x \<in> A
set xs \<subseteq> A - {x}
length xs = n
distinct xs

goal (1 subgoal):
 1. \<exists>xs. set xs \<subseteq> A \<and> length xs = Suc n \<and> distinct xs
[PROOF STEP]
by (intro exI[of _ "x # xs"], auto)
[PROOF STATE]
proof (state)
this:
\<exists>xs. set xs \<subseteq> A \<and> length xs = Suc n \<and> distinct xs

goal (1 subgoal):
 1. \<And>A. infinite A \<Longrightarrow> \<exists>xs. set xs \<subseteq> A \<and> length xs = 0 \<and> distinct xs
[PROOF STEP]
qed auto


[STATEMENT]
theorem Max_in_image:
  assumes "finite A" and "A \<noteq> {}"
  obtains x where "x \<in> A" and "Max (f ` A) = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> A; Max (f ` A) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> A; Max (f ` A) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from Max_in[of "f ` A"] assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite (f ` A); f ` A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (f ` A) \<in> f ` A
finite A
A \<noteq> {}
[PROOF STEP]
have "Max (f ` A) \<in> f ` A"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (f ` A); f ` A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (f ` A) \<in> f ` A
finite A
A \<noteq> {}

goal (1 subgoal):
 1. Max (f ` A) \<in> f ` A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max (f ` A) \<in> f ` A

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> A; Max (f ` A) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Max (f ` A) \<in> f ` A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Max (f ` A) \<in> f ` A

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bound_of_nat_times: "bound (of_nat n * v) \<le> n * bound v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bound (of_nat n * v) \<le> n * bound v
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bound (of_nat 0 * v) \<le> 0 * bound v
 2. \<And>n. bound (of_nat n * v) \<le> n * bound v \<Longrightarrow> bound (of_nat (Suc n) * v) \<le> Suc n * bound v
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
bound (of_nat n * v) \<le> n * bound v

goal (2 subgoals):
 1. bound (of_nat 0 * v) \<le> 0 * bound v
 2. \<And>n. bound (of_nat n * v) \<le> n * bound v \<Longrightarrow> bound (of_nat (Suc n) * v) \<le> Suc n * bound v
[PROOF STEP]
have "bound (of_nat (Suc n) * v) = bound (v + of_nat n * v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bound (of_nat (Suc n) * v) = bound (v + of_nat n * v)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
bound (of_nat (Suc n) * v) = bound (v + of_nat n * v)

goal (2 subgoals):
 1. bound (of_nat 0 * v) \<le> 0 * bound v
 2. \<And>n. bound (of_nat n * v) \<le> n * bound v \<Longrightarrow> bound (of_nat (Suc n) * v) \<le> Suc n * bound v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bound (of_nat (Suc n) * v) = bound (v + of_nat n * v)

goal (2 subgoals):
 1. bound (of_nat 0 * v) \<le> 0 * bound v
 2. \<And>n. bound (of_nat n * v) \<le> n * bound v \<Longrightarrow> bound (of_nat (Suc n) * v) \<le> Suc n * bound v
[PROOF STEP]
have "\<dots> \<le> bound v + bound (of_nat n * v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bound (v + of_nat n * v) \<le> bound v + bound (of_nat n * v)
[PROOF STEP]
by (rule bound_plus)
[PROOF STATE]
proof (state)
this:
bound (v + of_nat n * v) \<le> bound v + bound (of_nat n * v)

goal (2 subgoals):
 1. bound (of_nat 0 * v) \<le> 0 * bound v
 2. \<And>n. bound (of_nat n * v) \<le> n * bound v \<Longrightarrow> bound (of_nat (Suc n) * v) \<le> Suc n * bound v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bound (v + of_nat n * v) \<le> bound v + bound (of_nat n * v)

goal (2 subgoals):
 1. bound (of_nat 0 * v) \<le> 0 * bound v
 2. \<And>n. bound (of_nat n * v) \<le> n * bound v \<Longrightarrow> bound (of_nat (Suc n) * v) \<le> Suc n * bound v
[PROOF STEP]
have "\<dots> \<le> bound v + n * bound v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bound v + bound (of_nat n * v) \<le> bound v + n * bound v
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
bound (of_nat n * v) \<le> n * bound v

goal (1 subgoal):
 1. bound v + bound (of_nat n * v) \<le> bound v + n * bound v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bound v + bound (of_nat n * v) \<le> bound v + n * bound v

goal (2 subgoals):
 1. bound (of_nat 0 * v) \<le> 0 * bound v
 2. \<And>n. bound (of_nat n * v) \<le> n * bound v \<Longrightarrow> bound (of_nat (Suc n) * v) \<le> Suc n * bound v
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bound (of_nat (Suc n) * v) \<le> bound v + n * bound v
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
bound (of_nat (Suc n) * v) \<le> bound v + n * bound v

goal (1 subgoal):
 1. bound (of_nat (Suc n) * v) \<le> Suc n * bound v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bound (of_nat (Suc n) * v) \<le> Suc n * bound v

goal (1 subgoal):
 1. bound (of_nat 0 * v) \<le> 0 * bound v
[PROOF STEP]
qed simp


[STATEMENT]
lemma replicate_prop:
  assumes "P x"
  shows "\<forall>y\<in>set (replicate n x). P y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y\<in>set (replicate n x). P y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P x

goal (1 subgoal):
 1. \<forall>y\<in>set (replicate n x). P y
[PROOF STEP]
by (induct n) simp_all


[STATEMENT]
lemma permutation_delete_permutes:
  assumes p: "p permutes {0 ..< Suc n}" (is "_ permutes ?N")
      and i: "i < Suc n"
  shows "permutation_delete p i permutes {0..<n}" (is "?p permutes ?N'")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_delete p i permutes {0..<n}
[PROOF STEP]
proof (rule bij_imp_permutes, rule permutation_delete_bij_betw)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. i \<in> {0..<Suc n}
 2. bij_betw p {0..<Suc n} {0..<Suc n}
 3. \<And>x. x \<notin> {0..<n} \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
have pi: "p i < Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p i < Suc n
[PROOF STEP]
using p i
[PROOF STATE]
proof (prove)
using this:
p permutes {0..<Suc n}
i < Suc n

goal (1 subgoal):
 1. p i < Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p i < Suc n

goal (3 subgoals):
 1. i \<in> {0..<Suc n}
 2. bij_betw p {0..<Suc n} {0..<Suc n}
 3. \<And>x. x \<notin> {0..<n} \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
show "bij_betw p ?N ?N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw p {0..<Suc n} {0..<Suc n}
[PROOF STEP]
using permutes_imp_bij[OF p]
[PROOF STATE]
proof (prove)
using this:
bij_betw p {0..<Suc n} {0..<Suc n}

goal (1 subgoal):
 1. bij_betw p {0..<Suc n} {0..<Suc n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
bij_betw p {0..<Suc n} {0..<Suc n}

goal (2 subgoals):
 1. i \<in> {0..<Suc n}
 2. \<And>x. x \<notin> {0..<n} \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<in> {0..<Suc n}
 2. \<And>x. x \<notin> {0..<n} \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
assume "x \<notin> {0..<n}"
[PROOF STATE]
proof (state)
this:
x \<notin> {0..<n}

goal (2 subgoals):
 1. i \<in> {0..<Suc n}
 2. \<And>x. x \<notin> {0..<n} \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
hence x: "x \<ge> n"
[PROOF STATE]
proof (prove)
using this:
x \<notin> {0..<n}

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

goal (2 subgoals):
 1. i \<in> {0..<Suc n}
 2. \<And>x. x \<notin> {0..<n} \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
show "?p x = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_delete p i x = x
[PROOF STEP]
proof(cases "x < i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x < i \<Longrightarrow> permutation_delete p i x = x
 2. \<not> x < i \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < i

goal (2 subgoals):
 1. x < i \<Longrightarrow> permutation_delete p i x = x
 2. \<not> x < i \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x < i

goal (1 subgoal):
 1. permutation_delete p i x = x
[PROOF STEP]
unfolding permutation_delete_def
[PROOF STATE]
proof (prove)
using this:
x < i

goal (1 subgoal):
 1. delete_ran (delete_dom p i) (p i) x = x
[PROOF STEP]
using x i
[PROOF STATE]
proof (prove)
using this:
x < i
n \<le> x
i < Suc n

goal (1 subgoal):
 1. delete_ran (delete_dom p i) (p i) x = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
permutation_delete p i x = x

goal (1 subgoal):
 1. \<not> x < i \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < i \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < i

goal (1 subgoal):
 1. \<not> x < i \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
hence "p (Suc x) = Suc x"
[PROOF STATE]
proof (prove)
using this:
\<not> x < i

goal (1 subgoal):
 1. p (Suc x) = Suc x
[PROOF STEP]
using x permutes_others[OF p]
[PROOF STATE]
proof (prove)
using this:
\<not> x < i
n \<le> x
?x \<notin> {0..<Suc n} \<Longrightarrow> p ?x = ?x

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

goal (1 subgoal):
 1. \<not> x < i \<Longrightarrow> permutation_delete p i x = x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p (Suc x) = Suc x

goal (1 subgoal):
 1. permutation_delete p i x = x
[PROOF STEP]
unfolding permutation_delete_expand
[PROOF STATE]
proof (prove)
using this:
p (Suc x) = Suc x

goal (1 subgoal):
 1. (if p (if x < i then x else Suc x) < p i then p (if x < i then x else Suc x) else p (if x < i then x else Suc x) - Suc 0) = x
[PROOF STEP]
using False pi x
[PROOF STATE]
proof (prove)
using this:
p (Suc x) = Suc x
\<not> x < i
p i < Suc n
n \<le> x

goal (1 subgoal):
 1. (if p (if x < i then x else Suc x) < p i then p (if x < i then x else Suc x) else p (if x < i then x else Suc x) - Suc 0) = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
permutation_delete p i x = x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
permutation_delete p i x = x

goal (1 subgoal):
 1. i \<in> {0..<Suc n}
[PROOF STEP]
qed (insert i,auto)


[STATEMENT]
lemma "~~(((P-->Q) --> P)  -->  P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> \<not> (((P \<longrightarrow> Q) \<longrightarrow> P) \<longrightarrow> P)
[PROOF STEP]
by iprover


[STATEMENT]
lemma pl_pl_mm: "a + b = c + d \<Longrightarrow> a - c = d - b"
  for a b c d :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + b = c + d \<Longrightarrow> a - c = d - b
[PROOF STEP]
by arith


[STATEMENT]
lemma "(a - b) + (b - c) = a - (c::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - b + (b - c) = a - c
[PROOF STEP]
by arith


[STATEMENT]
lemma "((P\<longrightarrow>Q) \<longrightarrow> P)  \<longrightarrow>  P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((P \<longrightarrow> Q) \<longrightarrow> P) \<longrightarrow> P
[PROOF STEP]
by blast


[STATEMENT]
lemma refl_on_trancl:
  assumes "refl_on A r"
  shows "refl_on A (r^+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. refl_on A (r\<^sup>+)
[PROOF STEP]
proof(rule refl_onI, safe del: conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. (a, b) \<in> r\<^sup>+ \<Longrightarrow> a \<in> A \<and> b \<in> A
 2. \<And>x. x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. (a, b) \<in> r\<^sup>+ \<Longrightarrow> a \<in> A \<and> b \<in> A
 2. \<And>x. x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+
[PROOF STEP]
assume "(a, b) \<in> r^+"
[PROOF STATE]
proof (state)
this:
(a, b) \<in> r\<^sup>+

goal (2 subgoals):
 1. \<And>a b. (a, b) \<in> r\<^sup>+ \<Longrightarrow> a \<in> A \<and> b \<in> A
 2. \<And>x. x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+
[PROOF STEP]
thus "a \<in> A \<and> b \<in> A"
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> r\<^sup>+

goal (1 subgoal):
 1. a \<in> A \<and> b \<in> A
[PROOF STEP]
by induct(blast intro: refl_onD1[OF assms] refl_onD2[OF assms])+
[PROOF STATE]
proof (state)
this:
a \<in> A \<and> b \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> (x, x) \<in> r\<^sup>+
[PROOF STEP]
qed(blast dest: refl_onD[OF assms])


[STATEMENT]
lemma real_0[simp]: "real_of 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
have "real_of 0 = real_of (0+0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (0::'a) = real_of ((0::'a) + (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of (0::'a) = real_of ((0::'a) + (0::'a))

goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of (0::'a) = real_of ((0::'a) + (0::'a))

goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
have "... = real_of 0 + real_of 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of ((0::'a) + (0::'a)) = real_of (0::'a) + real_of (0::'a)
[PROOF STEP]
unfolding real_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (0::'a) + real_of (0::'a) = real_of (0::'a) + real_of (0::'a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
real_of ((0::'a) + (0::'a)) = real_of (0::'a) + real_of (0::'a)

goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of ((0::'a) + (0::'a)) = real_of (0::'a) + real_of (0::'a)

goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
have "... = 2*(real_of 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (0::'a) + real_of (0::'a) = 2 * real_of (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of (0::'a) + real_of (0::'a) = 2 * real_of (0::'a)

goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of (0::'a) = 2 * real_of (0::'a)
[PROOF STEP]
have "real_of 0 = 2* real_of 0"
[PROOF STATE]
proof (prove)
using this:
real_of (0::'a) = 2 * real_of (0::'a)

goal (1 subgoal):
 1. real_of (0::'a) = 2 * real_of (0::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real_of (0::'a) = 2 * real_of (0::'a)

goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of (0::'a) = 2 * real_of (0::'a)

goal (1 subgoal):
 1. real_of (0::'a) = 0
[PROOF STEP]
by (auto simp add: two_not_one)
[PROOF STATE]
proof (state)
this:
real_of (0::'a) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma incratseq_lb [simp]: "x - 1/(Suc n) < real_of_rat (incratseq x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - 1 / real (Suc n) < real_of_rat (incratseq x n)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x - 1 / real (Suc 0) < real_of_rat (incratseq x 0)
 2. \<And>n. x - 1 / real (Suc n) < real_of_rat (incratseq x n) \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. x - 1 / real (Suc 0) < real_of_rat (incratseq x 0)
 2. \<And>n. x - 1 / real (Suc n) < real_of_rat (incratseq x n) \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - 1 / real (Suc 0) < real_of_rat (incratseq x 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x - 1 / real (Suc 0) < real_of_rat (incratseq x 0)

goal (1 subgoal):
 1. \<And>n. x - 1 / real (Suc n) < real_of_rat (incratseq x n) \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. x - 1 / real (Suc n) < real_of_rat (incratseq x n) \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
x - 1 / real (Suc n) < real_of_rat (incratseq x n)

goal (1 subgoal):
 1. \<And>n. x - 1 / real (Suc n) < real_of_rat (incratseq x n) \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - 1 / real (Suc n) < real_of_rat (incratseq x n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
x - 1 / real (Suc n) < real_of_rat (incratseq x n)

goal (1 subgoal):
 1. x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
proof (cases "real_of_rat (incratseq x n) \<le> x - 1/Suc(Suc n)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
 2. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))

goal (2 subgoals):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
 2. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))
[PROOF STEP]
have " 1 / Suc(Suc n) < 1 / Suc n"
[PROOF STATE]
proof (prove)
using this:
real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))

goal (1 subgoal):
 1. 1 / real (Suc (Suc n)) < 1 / real (Suc n)
[PROOF STEP]
using Suc.IH
[PROOF STATE]
proof (prove)
using this:
real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))
x - 1 / real (Suc n) < real_of_rat (incratseq x n)

goal (1 subgoal):
 1. 1 / real (Suc (Suc n)) < 1 / real (Suc n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / real (Suc (Suc n)) < 1 / real (Suc n)

goal (2 subgoals):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
 2. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
have "x - 1/Suc(Suc n) < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - 1 / real (Suc (Suc n)) < x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x - 1 / real (Suc (Suc n)) < x

goal (2 subgoals):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
 2. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - 1 / real (Suc (Suc n)) < x
[PROOF STEP]
have "\<exists>a. x - 1 /Suc(Suc n) < real_of_rat a \<and> real_of_rat a < x"
[PROOF STATE]
proof (prove)
using this:
x - 1 / real (Suc (Suc n)) < x

goal (1 subgoal):
 1. \<exists>a. x - 1 / real (Suc (Suc n)) < real_of_rat a \<and> real_of_rat a < x
[PROOF STEP]
using of_rat_dense
[PROOF STATE]
proof (prove)
using this:
x - 1 / real (Suc (Suc n)) < x
?x < ?y \<Longrightarrow> \<exists>q. ?x < real_of_rat q \<and> real_of_rat q < ?y

goal (1 subgoal):
 1. \<exists>a. x - 1 / real (Suc (Suc n)) < real_of_rat a \<and> real_of_rat a < x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>a. x - 1 / real (Suc (Suc n)) < real_of_rat a \<and> real_of_rat a < x

goal (2 subgoals):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
 2. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>a. x - 1 / real (Suc (Suc n)) < real_of_rat a \<and> real_of_rat a < x
[PROOF STEP]
have "x - 1 / real (Suc (Suc n))
             < real_of_rat
                (SOME q.
                    (if real_of_rat (incratseq x n) \<le> x - 1 / Suc(Suc n)
                     then x - 1 / Suc(Suc n) else real_of_rat (incratseq x n))
                    < real_of_rat q \<and>
                    real_of_rat q < x)"
[PROOF STATE]
proof (prove)
using this:
\<exists>a. x - 1 / real (Suc (Suc n)) < real_of_rat a \<and> real_of_rat a < x

goal (1 subgoal):
 1. x - 1 / real (Suc (Suc n)) < real_of_rat (SOME q. (if real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n)) then x - 1 / real (Suc (Suc n)) else real_of_rat (incratseq x n)) < real_of_rat q \<and> real_of_rat q < x)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
\<exists>a. x - 1 / real (Suc (Suc n)) < real_of_rat a \<and> real_of_rat a < x
real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))

goal (1 subgoal):
 1. x - 1 / real (Suc (Suc n)) < real_of_rat (SOME q. (if real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n)) then x - 1 / real (Suc (Suc n)) else real_of_rat (incratseq x n)) < real_of_rat q \<and> real_of_rat q < x)
[PROOF STEP]
by (auto intro: someI2_ex)
[PROOF STATE]
proof (state)
this:
x - 1 / real (Suc (Suc n)) < real_of_rat (SOME q. (if real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n)) then x - 1 / real (Suc (Suc n)) else real_of_rat (incratseq x n)) < real_of_rat q \<and> real_of_rat q < x)

goal (2 subgoals):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
 2. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - 1 / real (Suc (Suc n)) < real_of_rat (SOME q. (if real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n)) then x - 1 / real (Suc (Suc n)) else real_of_rat (incratseq x n)) < real_of_rat q \<and> real_of_rat q < x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x - 1 / real (Suc (Suc n)) < real_of_rat (SOME q. (if real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n)) then x - 1 / real (Suc (Suc n)) else real_of_rat (incratseq x n)) < real_of_rat q \<and> real_of_rat q < x)

goal (1 subgoal):
 1. x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
x - 1 / real (Suc (Suc n)) < real_of_rat (SOME q. (if real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n)) then x - 1 / real (Suc (Suc n)) else real_of_rat (incratseq x n)) < real_of_rat q \<and> real_of_rat q < x)
real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))

goal (1 subgoal):
 1. x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
by (auto simp add: incratseq.simps(2) max_def)
[PROOF STATE]
proof (state)
this:
x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))

goal (1 subgoal):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))

goal (1 subgoal):
 1. \<lbrakk>x - 1 / real (Suc n) < real_of_rat (incratseq x n); \<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))\<rbrakk> \<Longrightarrow> x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))

goal (1 subgoal):
 1. x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
using incratseq_incseq
[PROOF STATE]
proof (prove)
using this:
\<not> real_of_rat (incratseq x n) \<le> x - 1 / real (Suc (Suc n))
incratseq ?x ?n < incratseq ?x (Suc ?n)

goal (1 subgoal):
 1. x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))
[PROOF STEP]
by (meson less_trans not_less of_rat_less)
[PROOF STATE]
proof (state)
this:
x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x - 1 / real (Suc (Suc n)) < real_of_rat (incratseq x (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gauss_int_norm_pos_iff [simp]: "gauss_int_norm z > 0 \<longleftrightarrow> z \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < gauss_int_norm z) = (z \<noteq> 0)
[PROOF STEP]
using gauss_int_norm_eq_0_iff[of z]
[PROOF STATE]
proof (prove)
using this:
(gauss_int_norm z = 0) = (z = 0)

goal (1 subgoal):
 1. (0 < gauss_int_norm z) = (z \<noteq> 0)
[PROOF STEP]
by (auto intro: Nat.gr0I)


[STATEMENT]
lemma pair_complete_imp_directed:
  assumes comp: "pair_complete A (\<sqsubseteq>)" shows "directed A (\<sqsubseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. directed A (\<sqsubseteq>)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. x \<sqsubseteq> z \<and> y \<sqsubseteq> z
[PROOF STEP]
fix x y :: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. x \<sqsubseteq> z \<and> y \<sqsubseteq> z
[PROOF STEP]
assume "x \<in> A" "y \<in> A"
[PROOF STATE]
proof (state)
this:
x \<in> A
y \<in> A

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. x \<sqsubseteq> z \<and> y \<sqsubseteq> z
[PROOF STEP]
with pair_completeD[OF comp this]
[PROOF STATE]
proof (chain)
picking this:
Ex (extreme_bound A (\<sqsubseteq>) {x, y})
x \<in> A
y \<in> A
[PROOF STEP]
show "\<exists>z \<in> A. x \<sqsubseteq> z \<and> y \<sqsubseteq> z"
[PROOF STATE]
proof (prove)
using this:
Ex (extreme_bound A (\<sqsubseteq>) {x, y})
x \<in> A
y \<in> A

goal (1 subgoal):
 1. \<exists>z\<in>A. x \<sqsubseteq> z \<and> y \<sqsubseteq> z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z\<in>A. x \<sqsubseteq> z \<and> y \<sqsubseteq> z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma to_fun_is_Fun:
  assumes "x \<in> carrier P"
  shows "to_fun x \<in> carrier (Fun R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun x \<in> carrier (function_ring (carrier R) R)
[PROOF STEP]
apply(rule ring_functions.function_ring_car_memI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. ring_functions R
 2. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun x a \<in> carrier R
 3. \<And>a. a \<notin> carrier R \<Longrightarrow> to_fun x a = undefined
[PROOF STEP]
unfolding ring_functions_def
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. ring R
 2. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun x a \<in> carrier R
 3. \<And>a. a \<notin> carrier R \<Longrightarrow> to_fun x a = undefined
[PROOF STEP]
apply(simp add: R.ring_axioms)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun x a \<in> carrier R
 2. \<And>a. a \<notin> carrier R \<Longrightarrow> to_fun x a = undefined
[PROOF STEP]
using to_fun_closed assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> carrier P; ?x \<in> carrier R\<rbrakk> \<Longrightarrow> to_fun ?f ?x \<in> carrier R
x \<in> carrier P

goal (2 subgoals):
 1. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun x a \<in> carrier R
 2. \<And>a. a \<notin> carrier R \<Longrightarrow> to_fun x a = undefined
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<notin> carrier R \<Longrightarrow> to_fun x a = undefined
[PROOF STEP]
unfolding to_function_def to_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<notin> carrier R \<Longrightarrow> (\<lambda>s\<in>carrier R. eval R R (\<lambda>x. x) s x) a = undefined
[PROOF STEP]
by auto


[STATEMENT]
lemma (in group) get_exp_self_fulfills:
  assumes "a \<in> carrier G"
  shows "a = a [^] get_exp a a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = a [^] get_exp a a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = a [^] get_exp a a
[PROOF STEP]
have "a = a [^] (1::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = a [^] 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G

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

goal (1 subgoal):
 1. a = a [^] get_exp a a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a = a [^] 1

goal (1 subgoal):
 1. a = a [^] get_exp a a
[PROOF STEP]
have "a [^] (1::int) = a [^] (SOME x::int. a [^] (1::int) = a [^] x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] 1 = a [^] (SOME x. a [^] 1 = a [^] x)
[PROOF STEP]
by (intro someI_ex[of "\<lambda>x::int. a [^] (1::int) = a [^] x"]; blast)
[PROOF STATE]
proof (state)
this:
a [^] 1 = a [^] (SOME x. a [^] 1 = a [^] x)

goal (1 subgoal):
 1. a = a [^] get_exp a a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a = a [^] 1
a [^] 1 = a [^] (SOME x. a [^] 1 = a [^] x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = a [^] 1
a [^] 1 = a [^] (SOME x. a [^] 1 = a [^] x)

goal (1 subgoal):
 1. a = a [^] get_exp a a
[PROOF STEP]
unfolding get_exp_def
[PROOF STATE]
proof (prove)
using this:
a = a [^] 1
a [^] 1 = a [^] (SOME x. a [^] 1 = a [^] x)

goal (1 subgoal):
 1. a = a [^] (SOME k. a = a [^] k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a = a [^] get_exp a a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_sin [simp]:
  fixes a::real
  assumes "a \<le> b" shows "integral {a..b} sin = cos a - cos b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a..b} sin = cos a - cos b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral {a..b} sin = cos a - cos b
[PROOF STEP]
have "(sin has_integral (- cos b - - cos a)) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin has_integral - cos b - - cos a) {a..b}
[PROOF STEP]
proof (rule fundamental_theorem_of_calculus)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<le> b
 2. \<And>x. x \<in> {a..b} \<Longrightarrow> ((\<lambda>a. - cos a) has_vector_derivative sin x) (at x within {a..b})
[PROOF STEP]
show "((\<lambda>a. - cos a) has_vector_derivative sin x) (at x within {a..b})" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>a. - cos a) has_vector_derivative sin x) (at x within {a..b})
[PROOF STEP]
unfolding has_real_derivative_iff_has_vector_derivative [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>a. - cos a) has_real_derivative sin x) (at x within {a..b})
[PROOF STEP]
by (rule derivative_eq_intros | force)+
[PROOF STATE]
proof (state)
this:
((\<lambda>a. - cos a) has_vector_derivative sin ?x) (at ?x within {a..b})

goal (1 subgoal):
 1. a \<le> b
[PROOF STEP]
qed (use assms in auto)
[PROOF STATE]
proof (state)
this:
(sin has_integral - cos b - - cos a) {a..b}

goal (1 subgoal):
 1. integral {a..b} sin = cos a - cos b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(sin has_integral - cos b - - cos a) {a..b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(sin has_integral - cos b - - cos a) {a..b}

goal (1 subgoal):
 1. integral {a..b} sin = cos a - cos b
[PROOF STEP]
by (simp add: integral_unique)
[PROOF STATE]
proof (state)
this:
integral {a..b} sin = cos a - cos b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sigma_UNIV: "UNIV \<in> sigma A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV \<in> sigma A
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV \<in> sigma A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. UNIV \<in> sigma A
[PROOF STEP]
have "{} \<in> sigma A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {} \<in> sigma A
[PROOF STEP]
by (rule sigma.empty)
[PROOF STATE]
proof (state)
this:
{} \<in> sigma A

goal (1 subgoal):
 1. UNIV \<in> sigma A
[PROOF STEP]
hence "-{} \<in> sigma A"
[PROOF STATE]
proof (prove)
using this:
{} \<in> sigma A

goal (1 subgoal):
 1. - {} \<in> sigma A
[PROOF STEP]
by (rule sigma.complement)
[PROOF STATE]
proof (state)
this:
- {} \<in> sigma A

goal (1 subgoal):
 1. UNIV \<in> sigma A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- {} \<in> sigma A

goal (1 subgoal):
 1. UNIV \<in> sigma A
[PROOF STEP]
have "-{} = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - {} = UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- {} = UNIV

goal (1 subgoal):
 1. UNIV \<in> sigma A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
UNIV \<in> sigma A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
UNIV \<in> sigma A

goal (1 subgoal):
 1. UNIV \<in> sigma A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
UNIV \<in> sigma A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<Sigma>_\<Delta>:
  "\<Sigma> (\<Delta> f) j l = f (of_int l) - f (of_int j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sigma> (\<Delta> f) j l = f (of_int l) - f (of_int j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sigma> (\<Delta> f) j l = f (of_int l) - f (of_int j)
[PROOF STEP]
from \<Delta>_\<Sigma>
[PROOF STATE]
proof (chain)
picking this:
\<Delta> (\<Sigma> ?f ?j) = ?f
[PROOF STEP]
have "\<Delta> (\<Sigma> (\<Delta> f) j) = \<Delta> f"
[PROOF STATE]
proof (prove)
using this:
\<Delta> (\<Sigma> ?f ?j) = ?f

goal (1 subgoal):
 1. \<Delta> (\<Sigma> (\<Delta> f) j) = \<Delta> f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Delta> (\<Sigma> (\<Delta> f) j) = \<Delta> f

goal (1 subgoal):
 1. \<Sigma> (\<Delta> f) j l = f (of_int l) - f (of_int j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Delta> (\<Sigma> (\<Delta> f) j) = \<Delta> f
[PROOF STEP]
obtain k where "plus k \<circ> \<Sigma> (\<Delta> f) j \<circ> of_int = f \<circ> of_int"
[PROOF STATE]
proof (prove)
using this:
\<Delta> (\<Sigma> (\<Delta> f) j) = \<Delta> f

goal (1 subgoal):
 1. (\<And>k. (+) k \<circ> \<Sigma> (\<Delta> f) j \<circ> of_int = f \<circ> of_int \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (blast dest: \<Delta>_same_shift)
[PROOF STATE]
proof (state)
this:
(+) k \<circ> \<Sigma> (\<Delta> f) j \<circ> of_int = f \<circ> of_int

goal (1 subgoal):
 1. \<Sigma> (\<Delta> f) j l = f (of_int l) - f (of_int j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(+) k \<circ> \<Sigma> (\<Delta> f) j \<circ> of_int = f \<circ> of_int
[PROOF STEP]
have "\<And>q. f (of_int q) = k + \<Sigma> (\<Delta> f) j q"
[PROOF STATE]
proof (prove)
using this:
(+) k \<circ> \<Sigma> (\<Delta> f) j \<circ> of_int = f \<circ> of_int

goal (1 subgoal):
 1. \<And>q. f (of_int q) = k + \<Sigma> (\<Delta> f) j q
[PROOF STEP]
by (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
f (of_int ?q) = k + \<Sigma> (\<Delta> f) j ?q

goal (1 subgoal):
 1. \<Sigma> (\<Delta> f) j l = f (of_int l) - f (of_int j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (of_int ?q) = k + \<Sigma> (\<Delta> f) j ?q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f (of_int ?q) = k + \<Sigma> (\<Delta> f) j ?q

goal (1 subgoal):
 1. \<Sigma> (\<Delta> f) j l = f (of_int l) - f (of_int j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Sigma> (\<Delta> f) j l = f (of_int l) - f (of_int j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma additive_tagged_division_1:
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
  assumes "a \<le> b"
    and "p tagged_division_of {a..b}"
  shows "sum (\<lambda>(x,k). f(Sup k) - f(Inf k)) p = f b - f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
let ?f = "(\<lambda>k::(real) set. if k = {} then 0 else f(interval_upperbound k) - f(interval_lowerbound k))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
interpret operative_real plus 0 ?f
    rewrites "comm_monoid_set.F (+) 0 = sum"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. operative_real (+) (0::'a) (\<lambda>k. if k = {} then 0::'a else f (interval_upperbound k) - f (interval_lowerbound k)) &&& comm_monoid_set.F (+) (0::?'c) = sum
[PROOF STEP]
by standard[1] (auto simp add: sum_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
have p_td: "p tagged_division_of cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p tagged_division_of cbox a b
[PROOF STEP]
using assms(2) box_real(2)
[PROOF STATE]
proof (prove)
using this:
p tagged_division_of {a..b}
cbox ?a ?b = {?a..?b}

goal (1 subgoal):
 1. p tagged_division_of cbox a b
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
p tagged_division_of cbox a b

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
have **: "cbox a b \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox a b \<noteq> {}
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. cbox a b \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cbox a b \<noteq> {}

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cbox a b \<noteq> {}
[PROOF STEP]
have "f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0 else f (interval_upperbound l) - f (interval_lowerbound l))"
[PROOF STATE]
proof (prove)
using this:
cbox a b \<noteq> {}

goal (1 subgoal):
 1. f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))
[PROOF STEP]
have "(if cbox a b = {} then 0 else f (interval_upperbound (cbox a b)) - f (interval_lowerbound (cbox a b))) = f b - f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if cbox a b = {} then 0::'a else f (interval_upperbound (cbox a b)) - f (interval_lowerbound (cbox a b))) = f b - f a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<le> b
p tagged_division_of {a..b}

goal (1 subgoal):
 1. (if cbox a b = {} then 0::'a else f (interval_upperbound (cbox a b)) - f (interval_lowerbound (cbox a b))) = f b - f a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if cbox a b = {} then 0::'a else f (interval_upperbound (cbox a b)) - f (interval_lowerbound (cbox a b))) = f b - f a

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(if cbox a b = {} then 0::'a else f (interval_upperbound (cbox a b)) - f (interval_lowerbound (cbox a b))) = f b - f a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(if cbox a b = {} then 0::'a else f (interval_upperbound (cbox a b)) - f (interval_lowerbound (cbox a b))) = f b - f a

goal (1 subgoal):
 1. f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))
[PROOF STEP]
using p_td assms
[PROOF STATE]
proof (prove)
using this:
(if cbox a b = {} then 0::'a else f (interval_upperbound (cbox a b)) - f (interval_lowerbound (cbox a b))) = f b - f a
p tagged_division_of cbox a b
a \<le> b
p tagged_division_of {a..b}

goal (1 subgoal):
 1. f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))
[PROOF STEP]
by (simp add: tagged_division)
[PROOF STATE]
proof (state)
this:
f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f b - f a = (\<Sum>(x, l)\<in>p. if l = {} then 0::'a else f (interval_upperbound l) - f (interval_lowerbound l))
a \<le> b
p tagged_division_of {a..b}

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a
[PROOF STEP]
by (auto intro!: sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, k)\<in>p. f (Sup k) - f (Inf k)) = f b - f a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enat_less_induct:
  assumes prem: "\<And>n. \<forall>m::enat. m < n \<longrightarrow> P m \<Longrightarrow> P n" shows "P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P n
[PROOF STEP]
have P_enat: "\<And>k. P (enat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. P (enat k)
[PROOF STEP]
apply (rule nat_less_induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k n. \<forall>m<n. P (enat m) \<Longrightarrow> P (enat n)
[PROOF STEP]
apply (rule prem, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k n m. \<lbrakk>\<forall>m<n. P (enat m); m < enat n\<rbrakk> \<Longrightarrow> P m
[PROOF STEP]
apply (erule less_enatE, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
P (enat ?k)

goal (1 subgoal):
 1. P n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>nat. P (enat nat)
 2. P \<infinity>
[PROOF STEP]
fix nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>nat. P (enat nat)
 2. P \<infinity>
[PROOF STEP]
show "P (enat nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (enat nat)
[PROOF STEP]
by (rule P_enat)
[PROOF STATE]
proof (state)
this:
P (enat nat)

goal (1 subgoal):
 1. P \<infinity>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P \<infinity>
[PROOF STEP]
show "P \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<infinity>
[PROOF STEP]
apply (rule prem, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. m < \<infinity> \<Longrightarrow> P m
[PROOF STEP]
apply (erule less_infinityE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m k. m = enat k \<Longrightarrow> P m
[PROOF STEP]
apply (simp add: P_enat)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
P \<infinity>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P n

goal:
No subgoals!
[PROOF STEP]
qed