[STATEMENT]
lemma rref_rank:
  fixes A::"'a::{field}^'m::{mod_type}^'n::{finite,one,plus,ord}"
  assumes rref_A: "reduced_row_echelon_form A"
  shows "rank A = card {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = card {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
unfolding rank_def row_rank_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (row_space A) = card {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
proof (rule vec.dim_unique[of "{row i A | i. row i A \<noteq> 0}"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. {row i A |i. row i A \<noteq> 0} \<subseteq> row_space A
 2. row_space A \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
 3. vec.independent {row i A |i. row i A \<noteq> 0}
 4. card {row i A |i. row i A \<noteq> 0} = card {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
show "{row i A |i. row i A \<noteq> 0} \<subseteq> row_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {row i A |i. row i A \<noteq> 0} \<subseteq> row_space A
[PROOF STEP]
proof (auto, unfold row_space_def rows_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. row i A \<noteq> 0 \<Longrightarrow> row i A \<in> vec.span {row i A |i. i \<in> UNIV}
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. row i A \<noteq> 0 \<Longrightarrow> row i A \<in> vec.span {row i A |i. i \<in> UNIV}
[PROOF STEP]
assume "row i A \<noteq> 0"
[PROOF STATE]
proof (state)
this:
row i A \<noteq> 0

goal (1 subgoal):
 1. \<And>i. row i A \<noteq> 0 \<Longrightarrow> row i A \<in> vec.span {row i A |i. i \<in> UNIV}
[PROOF STEP]
show "row i A \<in> vec.span {row i A |i. i \<in> UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row i A \<in> vec.span {row i A |i. i \<in> UNIV}
[PROOF STEP]
by (rule vec.span_base, auto)
[PROOF STATE]
proof (state)
this:
row i A \<in> vec.span {row i A |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{row i A |i. row i A \<noteq> 0} \<subseteq> row_space A

goal (3 subgoals):
 1. row_space A \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
 2. vec.independent {row i A |i. row i A \<noteq> 0}
 3. card {row i A |i. row i A \<noteq> 0} = card {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
show "row_space A \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_space A \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
proof (unfold row_space_def rows_def, cases "\<exists>i. row i A = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
 2. \<nexists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>i. row i A = 0

goal (2 subgoals):
 1. \<exists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
 2. \<nexists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
have set_rw: "{row i A |i. i \<in> UNIV} = insert 0 {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {row i A |i. i \<in> UNIV} = insert 0 {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
\<exists>i. row i A = 0

goal (1 subgoal):
 1. {row i A |i. i \<in> UNIV} = insert 0 {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{row i A |i. i \<in> UNIV} = insert 0 {row i A |i. row i A \<noteq> 0}

goal (2 subgoals):
 1. \<exists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
 2. \<nexists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
have "vec.span {row i A |i. i \<in> UNIV} = vec.span {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.span {row i A |i. i \<in> UNIV} = vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
unfolding set_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.span (insert 0 {row i A |i. row i A \<noteq> 0}) = vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
using vec.span_insert_0
[PROOF STATE]
proof (prove)
using this:
vec.span (insert 0 ?S) = vec.span ?S

goal (1 subgoal):
 1. vec.span (insert 0 {row i A |i. row i A \<noteq> 0}) = vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec.span {row i A |i. i \<in> UNIV} = vec.span {row i A |i. row i A \<noteq> 0}

goal (2 subgoals):
 1. \<exists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
 2. \<nexists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
thus "vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
vec.span {row i A |i. i \<in> UNIV} = vec.span {row i A |i. row i A \<noteq> 0}

goal (1 subgoal):
 1. vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}

goal (1 subgoal):
 1. \<nexists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<nexists>i. row i A = 0

goal (1 subgoal):
 1. \<nexists>i. row i A = 0 \<Longrightarrow> vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
show "vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<nexists>i. row i A = 0

goal (1 subgoal):
 1. vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec.span {row i A |i. i \<in> UNIV} \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row_space A \<subseteq> vec.span {row i A |i. row i A \<noteq> 0}

goal (2 subgoals):
 1. vec.independent {row i A |i. row i A \<noteq> 0}
 2. card {row i A |i. row i A \<noteq> 0} = card {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
show "vec.independent {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
by (rule independent_not_zero_rows_rref[OF rref_A])
[PROOF STATE]
proof (state)
this:
vec.independent {row i A |i. row i A \<noteq> 0}

goal (1 subgoal):
 1. card {row i A |i. row i A \<noteq> 0} = card {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
show "card {row i A |i. row i A \<noteq> 0} = card {row i A |i. row i A \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {row i A |i. row i A \<noteq> 0} = card {row i A |i. row i A \<noteq> 0}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card {row i A |i. row i A \<noteq> 0} = card {row i A |i. row i A \<noteq> 0}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exists_greater:
  assumes  len: "length F = length F'"
      and sum: "sum_list (map weight F) > sum_list (map weight F')"
    shows "\<exists>i<length F. weight (F ! i) > weight (F' ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i<length F. weight (F' ! i) < weight (F ! i)
[PROOF STEP]
using len sum
[PROOF STATE]
proof (prove)
using this:
length F = length F'
sum_list (map weight F') < sum_list (map weight F)

goal (1 subgoal):
 1. \<exists>i<length F. weight (F' ! i) < weight (F ! i)
[PROOF STEP]
proof (induct rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum_list (map weight []) < sum_list (map weight []) \<Longrightarrow> \<exists>i<length []. weight ([] ! i) < weight ([] ! i)
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list (map weight ys) < sum_list (map weight xs) \<Longrightarrow> \<exists>i<length xs. weight (ys ! i) < weight (xs ! i); sum_list (map weight (y # ys)) < sum_list (map weight (x # xs))\<rbrakk> \<Longrightarrow> \<exists>i<length (x # xs). weight ((y # ys) ! i) < weight ((x # xs) ! i)
[PROOF STEP]
case (Cons x xs y ys)
[PROOF STATE]
proof (state)
this:
length xs = length ys
sum_list (map weight ys) < sum_list (map weight xs) \<Longrightarrow> \<exists>i<length xs. weight (ys ! i) < weight (xs ! i)
sum_list (map weight (y # ys)) < sum_list (map weight (x # xs))

goal (2 subgoals):
 1. sum_list (map weight []) < sum_list (map weight []) \<Longrightarrow> \<exists>i<length []. weight ([] ! i) < weight ([] ! i)
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list (map weight ys) < sum_list (map weight xs) \<Longrightarrow> \<exists>i<length xs. weight (ys ! i) < weight (xs ! i); sum_list (map weight (y # ys)) < sum_list (map weight (x # xs))\<rbrakk> \<Longrightarrow> \<exists>i<length (x # xs). weight ((y # ys) ! i) < weight ((x # xs) ! i)
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
sum_list (map weight (y # ys)) < sum_list (map weight (x # xs))
[PROOF STEP]
have *: "~ weight y < weight x \<Longrightarrow> sum_list (map weight ys) < sum_list (map weight xs)"
[PROOF STATE]
proof (prove)
using this:
sum_list (map weight (y # ys)) < sum_list (map weight (x # xs))

goal (1 subgoal):
 1. \<not> weight y < weight x \<Longrightarrow> sum_list (map weight ys) < sum_list (map weight xs)
[PROOF STEP]
by (metis add_mono not_less sum_list_map_cons)
[PROOF STATE]
proof (state)
this:
\<not> weight y < weight x \<Longrightarrow> sum_list (map weight ys) < sum_list (map weight xs)

goal (2 subgoals):
 1. sum_list (map weight []) < sum_list (map weight []) \<Longrightarrow> \<exists>i<length []. weight ([] ! i) < weight ([] ! i)
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list (map weight ys) < sum_list (map weight xs) \<Longrightarrow> \<exists>i<length xs. weight (ys ! i) < weight (xs ! i); sum_list (map weight (y # ys)) < sum_list (map weight (x # xs))\<rbrakk> \<Longrightarrow> \<exists>i<length (x # xs). weight ((y # ys) ! i) < weight ((x # xs) ! i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i<length (x # xs). weight ((y # ys) ! i) < weight ((x # xs) ! i)
[PROOF STEP]
using Cons *
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
sum_list (map weight ys) < sum_list (map weight xs) \<Longrightarrow> \<exists>i<length xs. weight (ys ! i) < weight (xs ! i)
sum_list (map weight (y # ys)) < sum_list (map weight (x # xs))
\<not> weight y < weight x \<Longrightarrow> sum_list (map weight ys) < sum_list (map weight xs)

goal (1 subgoal):
 1. \<exists>i<length (x # xs). weight ((y # ys) ! i) < weight ((x # xs) ! i)
[PROOF STEP]
by (cases "weight y < weight x", auto)
[PROOF STATE]
proof (state)
this:
\<exists>i<length (x # xs). weight ((y # ys) ! i) < weight ((x # xs) ! i)

goal (1 subgoal):
 1. sum_list (map weight []) < sum_list (map weight []) \<Longrightarrow> \<exists>i<length []. weight ([] ! i) < weight ([] ! i)
[PROOF STEP]
qed simp


[STATEMENT]
lemma rat_sgn_code [code abstract]: "quotient_of (sgn p) = (sgn (fst (quotient_of p)), 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quotient_of (sgn p) = (sgn (fst (quotient_of p)), 1)
[PROOF STEP]
proof (cases p)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> quotient_of (sgn p) = (sgn (fst (quotient_of p)), 1)
[PROOF STEP]
case (Fract a b)
[PROOF STATE]
proof (state)
this:
p = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> quotient_of (sgn p) = (sgn (fst (quotient_of p)), 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = Fract a b
0 < b
coprime a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. quotient_of (sgn p) = (sgn (fst (quotient_of p)), 1)
[PROOF STEP]
by (cases "0::int" a rule: linorder_cases) (simp_all add: quotient_of_Fract)
[PROOF STATE]
proof (state)
this:
quotient_of (sgn p) = (sgn (fst (quotient_of p)), 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_assn_aux_append[simp]:
  "length l1=length l1' \<Longrightarrow>
    list_assn P (l1@l2) (l1'@l2')
    = list_assn P l1 l1' * list_assn P l2 l2'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length l1 = length l1' \<Longrightarrow> list_assn P (l1 @ l2) (l1' @ l2') = list_assn P l1 l1' * list_assn P l2 l2'
[PROOF STEP]
apply (induct rule: list_induct2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. list_assn P ([] @ l2) ([] @ l2') = list_assn P [] [] * list_assn P l2 l2'
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; list_assn P (xs @ l2) (ys @ l2') = list_assn P xs ys * list_assn P l2 l2'\<rbrakk> \<Longrightarrow> list_assn P ((x # xs) @ l2) ((y # ys) @ l2') = list_assn P (x # xs) (y # ys) * list_assn P l2 l2'
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; list_assn P (xs @ l2) (ys @ l2') = list_assn P xs ys * list_assn P l2 l2'\<rbrakk> \<Longrightarrow> list_assn P ((x # xs) @ l2) ((y # ys) @ l2') = list_assn P (x # xs) (y # ys) * list_assn P l2 l2'
[PROOF STEP]
apply (simp add: star_assoc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_uniq_bottom: "has_bottom P \<Longrightarrow> \<exists>!z\<in>P. \<forall>x\<in>P. z\<^bold>\<le>x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_bottom P \<Longrightarrow> \<exists>!z. z \<in> P \<and> (\<forall>x\<in>P. z \<^bold>\<le> x)
[PROOF STEP]
using has_bottom_def antisym
[PROOF STATE]
proof (prove)
using this:
has_bottom ?P \<equiv> \<exists>z\<in>?P. \<forall>x\<in>?P. z \<^bold>\<le> x
\<lbrakk>?a \<^bold>\<le> ?b; ?b \<^bold>\<le> ?a\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. has_bottom P \<Longrightarrow> \<exists>!z. z \<in> P \<and> (\<forall>x\<in>P. z \<^bold>\<le> x)
[PROOF STEP]
by force


[STATEMENT]
lemma inheritedFinite: "inherited subs (%A. finite A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inherited subs finite
[PROOF STEP]
apply(blast intro!: inheritedI finiteUn[symmetric] finiteIncLevel[symmetric] finiteInsert[symmetric] finiteEmpty)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ccw'_contra: "ccw' t r q \<Longrightarrow> ccw' t q r = False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccw' t r q \<Longrightarrow> ccw' t q r = False
[PROOF STEP]
by (auto simp: ccw'_def det3_def' algebra_simps)


[STATEMENT]
lemma strict_partial_order_acyclic:
  assumes "strict_partial_order r"
  shows "acyclic r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. acyclic r
[PROOF STEP]
by (metis acyclic_irrefl assms strict_partial_order_def trancl_id)


[STATEMENT]
lemma directed_ub: "directed X \<Longrightarrow> (\<forall>x \<in> X. \<forall>y \<in> X. \<exists>z \<in> X. x \<le> z \<and> y \<le> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. directed X \<Longrightarrow> \<forall>x\<in>X. \<forall>y\<in>X. \<exists>z\<in>X. x \<le> z \<and> y \<le> z
[PROOF STEP]
by (meson empty_subsetI directed_def finite.emptyI finite_insert insert_subset order_refl)


[STATEMENT]
lemma ad_equiv_list_link: "(\<forall>i \<in> set ns. ad_equiv_pair X (\<sigma> i, \<tau> i)) \<longleftrightarrow>
  ad_equiv_list X (map \<sigma> ns) (map \<tau> ns)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>set ns. ad_equiv_pair X (\<sigma> i, \<tau> i)) = ad_equiv_list X (map \<sigma> ns) (map \<tau> ns)
[PROOF STEP]
by (auto simp: ad_equiv_list_def set_zip) (metis in_set_conv_nth nth_map)


[STATEMENT]
lemma no_change_eval:
  fixes x y:: "real"
  assumes "getPoly At = (a, b, c)"
  assumes "x < y"
  assumes "\<not>(\<exists>w. x \<le> w \<and> w \<le> y \<and> a*w^2 + b*w + c = 0)"
  shows  "((aEvalUni At) x = aEvalUni (At) y \<and> x < y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aEvalUni At x = aEvalUni At y \<and> x < y
[PROOF STEP]
using change_eval
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x < ?y; aEvalUni ?At ?x \<noteq> aEvalUni ?At ?y; getPoly ?At = (?a, ?b, ?c)\<rbrakk> \<Longrightarrow> \<exists>w\<ge>?x. w \<le> ?y \<and> ?a * w\<^sup>2 + ?b * w + ?c = 0

goal (1 subgoal):
 1. aEvalUni At x = aEvalUni At y \<and> x < y
[PROOF STEP]
using assms(1) assms(2) assms(3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x < ?y; aEvalUni ?At ?x \<noteq> aEvalUni ?At ?y; getPoly ?At = (?a, ?b, ?c)\<rbrakk> \<Longrightarrow> \<exists>w\<ge>?x. w \<le> ?y \<and> ?a * w\<^sup>2 + ?b * w + ?c = 0
getPoly At = (a, b, c)
x < y
\<not> (\<exists>w\<ge>x. w \<le> y \<and> a * w\<^sup>2 + b * w + c = 0)

goal (1 subgoal):
 1. aEvalUni At x = aEvalUni At y \<and> x < y
[PROOF STEP]
by blast


[STATEMENT]
lemma rel_pmf_measureD:
  assumes "rel_pmf R p q"
  shows "measure (measure_pmf p) A \<le> measure (measure_pmf q) {y. \<exists>x\<in>A. R x y}" (is "?lhs \<le> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
rel_pmf R p q

goal (1 subgoal):
 1. measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y; map_pmf fst pq = p; map_pmf snd pq = q\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
fix pq
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y; map_pmf fst pq = p; map_pmf snd pq = q\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
assume R: "\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y"
    and p[symmetric]: "map_pmf fst pq = p"
    and q[symmetric]: "map_pmf snd pq = q"
[PROOF STATE]
proof (state)
this:
(?x, ?y) \<in> set_pmf pq \<Longrightarrow> R ?x ?y
p = map_pmf fst pq
q = map_pmf snd pq

goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y; map_pmf fst pq = p; map_pmf snd pq = q\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
have "?lhs = measure (measure_pmf pq) (fst -` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob pq (fst -` A)
[PROOF STEP]
by(simp add: p)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p A = measure_pmf.prob pq (fst -` A)

goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y; map_pmf fst pq = p; map_pmf snd pq = q\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p A = measure_pmf.prob pq (fst -` A)

goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y; map_pmf fst pq = p; map_pmf snd pq = q\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
have "\<dots> \<le> measure (measure_pmf pq) {y. \<exists>x\<in>A. R x (snd y)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob pq (fst -` A) \<le> measure_pmf.prob pq {y. \<exists>x\<in>A. R x (snd y)}
[PROOF STEP]
by(rule measure_pmf.finite_measure_mono_AE)(auto 4 3 simp add: AE_measure_pmf_iff dest: R)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob pq (fst -` A) \<le> measure_pmf.prob pq {y. \<exists>x\<in>A. R x (snd y)}

goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y; map_pmf fst pq = p; map_pmf snd pq = q\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob pq (fst -` A) \<le> measure_pmf.prob pq {y. \<exists>x\<in>A. R x (snd y)}

goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y; map_pmf fst pq = p; map_pmf snd pq = q\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob pq {y. \<exists>x\<in>A. R x (snd y)} = measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
by(simp add: q)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob pq {y. \<exists>x\<in>A. R x (snd y)} = measure_pmf.prob q {y. \<exists>x\<in>A. R x y}

goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> R x y; map_pmf fst pq = p; map_pmf snd pq = q\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}

goal (1 subgoal):
 1. measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p A \<le> measure_pmf.prob q {y. \<exists>x\<in>A. R x y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma i_set_mult_0_eq_i_set_cont: "i_set_mult 0 = i_set_cont"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i_set_mult 0 = i_set_cont
[PROOF STEP]
apply (rule set_eqI, rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> i_set_mult 0 \<Longrightarrow> x \<in> i_set_cont
 2. \<And>x. x \<in> i_set_cont \<Longrightarrow> x \<in> i_set_mult 0
[PROOF STEP]
apply (rename_tac x, rule_tac a=x in i_set_mult.cases[of _ 0])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. \<And>x. x \<in> i_set_mult 0 \<Longrightarrow> x \<in> i_set_mult 0
 2. \<And>x n. \<lbrakk>x \<in> i_set_mult 0; x = [n\<dots>]\<rbrakk> \<Longrightarrow> x \<in> i_set_cont
 3. \<And>x n. \<lbrakk>x \<in> i_set_mult 0; x = [\<dots>n]\<rbrakk> \<Longrightarrow> x \<in> i_set_cont
 4. \<And>x n d. \<lbrakk>x \<in> i_set_mult 0; x = [n\<dots>,d]\<rbrakk> \<Longrightarrow> x \<in> i_set_cont
 5. \<And>x r m. \<lbrakk>x \<in> i_set_mult 0; x = [ r, mod m * 0 ]\<rbrakk> \<Longrightarrow> x \<in> i_set_cont
 6. \<And>x r m c. \<lbrakk>x \<in> i_set_mult 0; x = [ r, mod m * 0, c ]\<rbrakk> \<Longrightarrow> x \<in> i_set_cont
 7. \<And>x. x \<in> i_set_cont \<Longrightarrow> x \<in> i_set_mult 0
[PROOF STEP]
apply (simp_all add: i_set_cont.intros iMOD_0 iMODb_mod_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> i_set_cont \<Longrightarrow> x \<in> i_set_mult 0
[PROOF STEP]
apply (rename_tac x, rule_tac a=x in i_set_cont.cases)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x. x \<in> i_set_cont \<Longrightarrow> x \<in> i_set_cont
 2. \<And>x n. \<lbrakk>x \<in> i_set_cont; x = [n\<dots>]\<rbrakk> \<Longrightarrow> x \<in> i_set_mult 0
 3. \<And>x n. \<lbrakk>x \<in> i_set_cont; x = [\<dots>n]\<rbrakk> \<Longrightarrow> x \<in> i_set_mult 0
 4. \<And>x n d. \<lbrakk>x \<in> i_set_cont; x = [n\<dots>,d]\<rbrakk> \<Longrightarrow> x \<in> i_set_mult 0
[PROOF STEP]
apply (simp_all add: i_set_mult.intros)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in prob_space) indep_var_compose:
  assumes "indep_var M1 X1 M2 X2" "Y1 \<in> measurable M1 N1" "Y2 \<in> measurable M2 N2"
  shows "indep_var N1 (Y1 \<circ> X1) N2 (Y2 \<circ> X2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_var N1 (Y1 \<circ> X1) N2 (Y2 \<circ> X2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. indep_var N1 (Y1 \<circ> X1) N2 (Y2 \<circ> X2)
[PROOF STEP]
have "indep_vars (case_bool N1 N2) (\<lambda>b. case_bool Y1 Y2 b \<circ> case_bool X1 X2 b) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_vars (case_bool N1 N2) (\<lambda>b. (case b of True \<Rightarrow> Y1 | False \<Rightarrow> Y2) \<circ> (case b of True \<Rightarrow> X1 | False \<Rightarrow> X2)) UNIV
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
indep_var M1 X1 M2 X2
Y1 \<in> M1 \<rightarrow>\<^sub>M N1
Y2 \<in> M2 \<rightarrow>\<^sub>M N2

goal (1 subgoal):
 1. indep_vars (case_bool N1 N2) (\<lambda>b. (case b of True \<Rightarrow> Y1 | False \<Rightarrow> Y2) \<circ> (case b of True \<Rightarrow> X1 | False \<Rightarrow> X2)) UNIV
[PROOF STEP]
by (intro indep_vars_compose[where M'="case_bool M1 M2"])
       (auto simp: indep_var_def split: bool.split)
[PROOF STATE]
proof (state)
this:
indep_vars (case_bool N1 N2) (\<lambda>b. (case b of True \<Rightarrow> Y1 | False \<Rightarrow> Y2) \<circ> (case b of True \<Rightarrow> X1 | False \<Rightarrow> X2)) UNIV

goal (1 subgoal):
 1. indep_var N1 (Y1 \<circ> X1) N2 (Y2 \<circ> X2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
indep_vars (case_bool N1 N2) (\<lambda>b. (case b of True \<Rightarrow> Y1 | False \<Rightarrow> Y2) \<circ> (case b of True \<Rightarrow> X1 | False \<Rightarrow> X2)) UNIV

goal (1 subgoal):
 1. indep_var N1 (Y1 \<circ> X1) N2 (Y2 \<circ> X2)
[PROOF STEP]
have "(\<lambda>b. case_bool Y1 Y2 b \<circ> case_bool X1 X2 b) = case_bool (Y1 \<circ> X1) (Y2 \<circ> X2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. (case b of True \<Rightarrow> Y1 | False \<Rightarrow> Y2) \<circ> (case b of True \<Rightarrow> X1 | False \<Rightarrow> X2)) = case_bool (Y1 \<circ> X1) (Y2 \<circ> X2)
[PROOF STEP]
by (simp add: fun_eq_iff split: bool.split)
[PROOF STATE]
proof (state)
this:
(\<lambda>b. (case b of True \<Rightarrow> Y1 | False \<Rightarrow> Y2) \<circ> (case b of True \<Rightarrow> X1 | False \<Rightarrow> X2)) = case_bool (Y1 \<circ> X1) (Y2 \<circ> X2)

goal (1 subgoal):
 1. indep_var N1 (Y1 \<circ> X1) N2 (Y2 \<circ> X2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
indep_vars (\<lambda>a. case a of True \<Rightarrow> N1 | False \<Rightarrow> N2) (\<lambda>b. case b of True \<Rightarrow> Y1 \<circ> X1 | False \<Rightarrow> Y2 \<circ> X2) UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
indep_vars (\<lambda>a. case a of True \<Rightarrow> N1 | False \<Rightarrow> N2) (\<lambda>b. case b of True \<Rightarrow> Y1 \<circ> X1 | False \<Rightarrow> Y2 \<circ> X2) UNIV

goal (1 subgoal):
 1. indep_var N1 (Y1 \<circ> X1) N2 (Y2 \<circ> X2)
[PROOF STEP]
unfolding indep_var_def
[PROOF STATE]
proof (prove)
using this:
indep_vars (\<lambda>a. case a of True \<Rightarrow> N1 | False \<Rightarrow> N2) (\<lambda>b. case b of True \<Rightarrow> Y1 \<circ> X1 | False \<Rightarrow> Y2 \<circ> X2) UNIV

goal (1 subgoal):
 1. indep_vars (case_bool N1 N2) (case_bool (Y1 \<circ> X1) (Y2 \<circ> X2)) UNIV
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
indep_var N1 (Y1 \<circ> X1) N2 (Y2 \<circ> X2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_eq_sum_prepend: "\<lbrakk>0 < i; i \<le> j; length xs < i; length ys = length xs\<rbrakk> \<Longrightarrow> sum (xs @ as) i j = sum (ys @ as) i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; length xs < i; length ys = length xs\<rbrakk> \<Longrightarrow> SWA.sum (xs @ as) i j = SWA.sum (ys @ as) i j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; length xs < i; length ys = length xs\<rbrakk> \<Longrightarrow> SWA.sum (xs @ as) i j = SWA.sum (ys @ as) i j
[PROOF STEP]
assume assms: "0 < i" "i \<le> j" "length xs < i" "length ys = length xs"
[PROOF STATE]
proof (state)
this:
0 < i
i \<le> j
length xs < i
length ys = length xs

goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; length xs < i; length ys = length xs\<rbrakk> \<Longrightarrow> SWA.sum (xs @ as) i j = SWA.sum (ys @ as) i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < i
i \<le> j
length xs < i
length ys = length xs
[PROOF STEP]
have *: "rev (map ((!) (xs @ as)) [i - Suc 0..<j - Suc 0]) = rev (map ((!) (ys @ as)) [i - Suc 0..<j - Suc 0])"
[PROOF STATE]
proof (prove)
using this:
0 < i
i \<le> j
length xs < i
length ys = length xs

goal (1 subgoal):
 1. rev (map ((!) (xs @ as)) [i - Suc 0..<j - Suc 0]) = rev (map ((!) (ys @ as)) [i - Suc 0..<j - Suc 0])
[PROOF STEP]
by (auto simp: nth_append)
[PROOF STATE]
proof (state)
this:
rev (map ((!) (xs @ as)) [i - Suc 0..<j - Suc 0]) = rev (map ((!) (ys @ as)) [i - Suc 0..<j - Suc 0])

goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; length xs < i; length ys = length xs\<rbrakk> \<Longrightarrow> SWA.sum (xs @ as) i j = SWA.sum (ys @ as) i j
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < i
i \<le> j
length xs < i
length ys = length xs
[PROOF STEP]
have "(xs @ as) ! (j - Suc 0) = (ys @ as) ! (j - Suc 0)"
[PROOF STATE]
proof (prove)
using this:
0 < i
i \<le> j
length xs < i
length ys = length xs

goal (1 subgoal):
 1. (xs @ as) ! (j - Suc 0) = (ys @ as) ! (j - Suc 0)
[PROOF STEP]
by (auto simp: nth_append)
[PROOF STATE]
proof (state)
this:
(xs @ as) ! (j - Suc 0) = (ys @ as) ! (j - Suc 0)

goal (1 subgoal):
 1. \<lbrakk>0 < i; i \<le> j; length xs < i; length ys = length xs\<rbrakk> \<Longrightarrow> SWA.sum (xs @ as) i j = SWA.sum (ys @ as) i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(xs @ as) ! (j - Suc 0) = (ys @ as) ! (j - Suc 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(xs @ as) ! (j - Suc 0) = (ys @ as) ! (j - Suc 0)

goal (1 subgoal):
 1. SWA.sum (xs @ as) i j = SWA.sum (ys @ as) i j
[PROOF STEP]
by (simp add: *)
[PROOF STATE]
proof (state)
this:
SWA.sum (xs @ as) i j = SWA.sum (ys @ as) i j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_integral_K_cfg: "(\<integral>\<^sup>+cfg. f cfg \<partial>K_cfg cfg) = (\<integral>\<^sup>+s. f (cont cfg s) \<partial>action cfg)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (K_cfg cfg)) f = \<integral>\<^sup>+ s. f (cont cfg s) \<partial>measure_pmf (action cfg)
[PROOF STEP]
by (simp add: K_cfg_def map_pmf_rep_eq nn_integral_distr)


[STATEMENT]
lemma iT_Plus_neg_iUntil_conv: "(P t1. t1 \<U> t2 (I \<oplus>- k). Q t2) = (P (t1 - k). t1 \<U> t2 (I \<down>\<ge> k). Q (t2 - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P t1. t1 \<U> t2 I \<oplus>- k. Q t2) = (P (t1 - k). t1 \<U> t2 I \<down>\<ge> k. Q (t2 - k))
[PROOF STEP]
apply (simp add: iUntil_def iT_Plus_neg_iAll_conv iT_Plus_neg_iEx_conv iT_Plus_neg_cut_less2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<diamond> t I \<down>\<ge> k. Q (t - k) \<and> (\<box> t I \<down>< t \<down>\<ge> k. P (t - k))) = (\<diamond> t I \<down>\<ge> k. Q (t - k) \<and> (\<box> t' I \<down>\<ge> k \<down>< t. P (t' - k)))
[PROOF STEP]
apply (simp add: i_cut_commute_disj)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ordinal_times_monoR: "y \<le> y' \<Longrightarrow> x * y \<le> x * (y'::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> y' \<Longrightarrow> x * y \<le> x * y'
[PROOF STEP]
by (rule continuous.monoD[OF continuous_times])


[STATEMENT]
lemma summable_sum: "(\<And>i. i \<in> I \<Longrightarrow> summable (f i)) \<Longrightarrow> summable (\<lambda>n. \<Sum>i\<in>I. f i n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> summable (f i)) \<Longrightarrow> summable (\<lambda>n. \<Sum>i\<in>I. f i n)
[PROOF STEP]
using sums_summable[OF sums_sum[OF summable_sums]]
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> I \<Longrightarrow> summable (f i)) \<Longrightarrow> summable (\<lambda>n. \<Sum>i\<in>I. f i n)

goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> summable (f i)) \<Longrightarrow> summable (\<lambda>n. \<Sum>i\<in>I. f i n)
[PROOF STEP]
.


[STATEMENT]
lemma inorder_skew: "inorder(skew t) = inorder t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tree2.inorder (skew t) = Tree2.inorder t
[PROOF STEP]
by(cases t rule: skew.cases) (auto)


[STATEMENT]
lemma "dist x y = r / 2 \<Longrightarrow> (\<forall>z. dist x z < r / 4 \<longrightarrow> dist y z \<le> 3 * r / 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y = r / 2 \<Longrightarrow> \<forall>z. dist x z < r / 4 \<longrightarrow> dist y z \<le> 3 * r / 4
[PROOF STEP]
by metric


[STATEMENT]
lemma has_integral_substitution_general_:
  fixes f :: "real \<Rightarrow> 'a::euclidean_space" and g :: "real \<Rightarrow> real"
  assumes s: "finite s" and le: "a \<le> b"
    and subset: "g ` {a..b} \<subseteq> {c..d}"
    and f: "f integrable_on {c..d}" "continuous_on ({c..d} - (g ` s)) f"
    (*and f [continuous_intros]: "continuous_on {c..d} f"*)
    and g : "continuous_on {a..b} g" "inj_on g ({a..b} \<union> s)"
    and deriv [derivative_intros]:
    "\<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_field_derivative g' x) (at x within {a..b})"
  shows "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (integral {g a..g b} f - integral {g b..g a} f)) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
let ?F = "\<lambda>x. integral {c..g x} f"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
have cont_int: "continuous_on {a..b} ?F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. integral {c..g x} f)
[PROOF STEP]
by (rule continuous_on_compose2[OF _ g(1) subset] indefinite_integral_continuous_1
        f)+
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. integral {c..g x} f)

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
have deriv: "\<And>x. x \<in> {a..b} - s \<Longrightarrow> (((\<lambda>x. integral {c..x} f) \<circ> g) has_vector_derivative g' x *\<^sub>R f (g x))
                 (at x within ({a..b} - s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) \<circ> g has_vector_derivative g' x *\<^sub>R f (g x)) (at x within {a..b} - s)
[PROOF STEP]
apply (rule has_vector_derivative_eq_rhs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) \<circ> g has_vector_derivative ?X x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?X x = g' x *\<^sub>R f (g x)
[PROOF STEP]
apply (rule vector_diff_chain_within)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_vector_derivative ?f'3 x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 3. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?f'3 x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
apply (subst has_real_derivative_iff_has_vector_derivative [symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_real_derivative ?f'7 x x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 3. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?f'7 x x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_real_derivative ?f'7 x x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 3. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?f'7 x x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
fix x::real
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_real_derivative ?f'7 x x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 3. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?f'7 x x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
assume ass: "x \<in> {a..b} - s"
[PROOF STATE]
proof (state)
this:
x \<in> {a..b} - s

goal (3 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_real_derivative ?f'7 x x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 3. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?f'7 x x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
let ?f'3 = "g' x"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_real_derivative ?f'7 x x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 3. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?f'7 x x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
have i:"{a..b} - s \<subseteq> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..b} - s \<subseteq> {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a..b} - s \<subseteq> {a..b}

goal (3 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_real_derivative ?f'7 x x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 3. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?f'7 x x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
have ii: " (g has_vector_derivative g' x) (at x within {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_vector_derivative g' x) (at x within {a..b})
[PROOF STEP]
using deriv[OF ass]
[PROOF STATE]
proof (prove)
using this:
(g has_real_derivative g' x) (at x within {a..b})

goal (1 subgoal):
 1. (g has_vector_derivative g' x) (at x within {a..b})
[PROOF STEP]
by (simp only: has_real_derivative_iff_has_vector_derivative)
[PROOF STATE]
proof (state)
this:
(g has_vector_derivative g' x) (at x within {a..b})

goal (3 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_real_derivative ?f'7 x x) (at x within {a..b} - s)
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 3. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ?f'7 x x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
show "(g has_real_derivative ?f'3) (at x within {a..b} - s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_real_derivative g' x) (at x within {a..b} - s)
[PROOF STEP]
using has_vector_derivative_within_subset[OF ii i]
[PROOF STATE]
proof (prove)
using this:
(g has_vector_derivative g' x) (at x within {a..b} - s)

goal (1 subgoal):
 1. (g has_real_derivative g' x) (at x within {a..b} - s)
[PROOF STEP]
by (simp only: has_real_derivative_iff_has_vector_derivative)
[PROOF STATE]
proof (state)
this:
(g has_real_derivative g' x) (at x within {a..b} - s)

goal (2 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> g' x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> g' x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
let ?g'3 = "f o g"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))
 2. \<And>x. x \<in> {a..b} - s \<Longrightarrow> g' x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)
[PROOF STEP]
show "\<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
fix x::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
assume ass: "x \<in> {a..b} - s"
[PROOF STATE]
proof (state)
this:
x \<in> {a..b} - s

goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
have "finite (g ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (g ` s)
[PROOF STEP]
using s
[PROOF STATE]
proof (prove)
using this:
finite s

goal (1 subgoal):
 1. finite (g ` s)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (g ` s)

goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (g ` s)
[PROOF STEP]
have i: "((\<lambda>x. integral {c..x} f) has_vector_derivative f(g x)) (at (g x) within ({c..d} - g ` s))"
[PROOF STATE]
proof (prove)
using this:
finite (g ` s)

goal (1 subgoal):
 1. ((\<lambda>x. integral {c..x} f) has_vector_derivative f (g x)) (at (g x) within {c..d} - g ` s)
[PROOF STEP]
apply (rule integral_has_vector_derivative')
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. f integrable_on {c..d}
 2. g x \<in> {c..d} - g ` s
 3. continuous (at (g x) within {c..d} - g ` s) f
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f integrable_on {c..d}
 2. g x \<in> {c..d} - g ` s
 3. continuous (at (g x) within {c..d} - g ` s) f
[PROOF STEP]
show " f integrable_on {c..d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on {c..d}
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
f integrable_on {c..d}
continuous_on ({c..d} - g ` s) f

goal (1 subgoal):
 1. f integrable_on {c..d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f integrable_on {c..d}

goal (2 subgoals):
 1. g x \<in> {c..d} - g ` s
 2. continuous (at (g x) within {c..d} - g ` s) f
[PROOF STEP]
show "g x \<in> {c..d} - g ` s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g x \<in> {c..d} - g ` s
[PROOF STEP]
using ass subset
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..b} - s
g ` {a..b} \<subseteq> {c..d}

goal (1 subgoal):
 1. g x \<in> {c..d} - g ` s
[PROOF STEP]
(*sledgehammer*)
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..b} - s
g ` {a..b} \<subseteq> {c..d}

goal (1 subgoal):
 1. g x \<in> {c..d} - g ` s
[PROOF STEP]
by (smt Diff_iff Un_upper1 Un_upper2 g(2) imageE image_subset_iff inj_onD subsetCE)
[PROOF STATE]
proof (state)
this:
g x \<in> {c..d} - g ` s

goal (1 subgoal):
 1. continuous (at (g x) within {c..d} - g ` s) f
[PROOF STEP]
show "continuous (at (g x) within {c..d} - g ` s) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at (g x) within {c..d} - g ` s) f
[PROOF STEP]
(*sledgehammer*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at (g x) within {c..d} - g ` s) f
[PROOF STEP]
using \<open>g x \<in> {c..d} - g ` s\<close> continuous_on_eq_continuous_within f(2)
[PROOF STATE]
proof (prove)
using this:
g x \<in> {c..d} - g ` s
continuous_on ?s ?f = (\<forall>x\<in>?s. continuous (at x within ?s) ?f)
continuous_on ({c..d} - g ` s) f

goal (1 subgoal):
 1. continuous (at (g x) within {c..d} - g ` s) f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous (at (g x) within {c..d} - g ` s) f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. integral {c..x} f) has_vector_derivative f (g x)) (at (g x) within {c..d} - g ` s)

goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
have ii: "g ` ({a..b} - s) \<subseteq> ({c..d} - g ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` ({a..b} - s) \<subseteq> {c..d} - g ` s
[PROOF STEP]
using subset g(2)
[PROOF STATE]
proof (prove)
using this:
g ` {a..b} \<subseteq> {c..d}
inj_on g ({a..b} \<union> s)

goal (1 subgoal):
 1. g ` ({a..b} - s) \<subseteq> {c..d} - g ` s
[PROOF STEP]
(*sledgehammer*)
[PROOF STATE]
proof (prove)
using this:
g ` {a..b} \<subseteq> {c..d}
inj_on g ({a..b} \<union> s)

goal (1 subgoal):
 1. g ` ({a..b} - s) \<subseteq> {c..d} - g ` s
[PROOF STEP]
by (smt Diff_subset Un_Diff Un_commute Un_upper2 inj_on_image_set_diff subset_trans sup.order_iff)
[PROOF STATE]
proof (state)
this:
g ` ({a..b} - s) \<subseteq> {c..d} - g ` s

goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g ` ({a..b} - s) \<subseteq> {c..d} - g ` s
[PROOF STEP]
show "((\<lambda>x. integral {c..x} f) has_vector_derivative ?g'3 x) (at (g x) within g ` ({a..b} - s))"
[PROOF STATE]
proof (prove)
using this:
g ` ({a..b} - s) \<subseteq> {c..d} - g ` s

goal (1 subgoal):
 1. ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
(*sledgehammer*)
[PROOF STATE]
proof (prove)
using this:
g ` ({a..b} - s) \<subseteq> {c..d} - g ` s

goal (1 subgoal):
 1. ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))
[PROOF STEP]
by (smt Diff_subset has_vector_derivative_weaken Un_upper1 Un_upper2 \<open>finite (g ` s)\<close> ass comp_def continuous_on_eq_continuous_within f(1) f(2) g(2) image_diff_subset image_subset_iff inj_on_image_set_diff integral_has_vector_derivative_continuous_at' subset_trans)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) x) (at (g x) within g ` ({a..b} - s))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) has_vector_derivative (f \<circ> g) ?x) (at (g ?x) within g ` ({a..b} - s))

goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> g' x *\<^sub>R (f \<circ> g) x = g' x *\<^sub>R f (g x)
[PROOF STEP]
show "\<And>x. x \<in> {a..b} - s \<Longrightarrow> g' x *\<^sub>R ?g'3 x = g' x *\<^sub>R f (g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} - s \<Longrightarrow> g' x *\<^sub>R (f \<circ> g) x = g' x *\<^sub>R f (g x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> {a..b} - s \<Longrightarrow> g' ?x *\<^sub>R (f \<circ> g) ?x = g' ?x *\<^sub>R f (g ?x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) \<circ> g has_vector_derivative g' ?x *\<^sub>R f (g ?x)) (at ?x within {a..b} - s)

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
have deriv: "(?F has_vector_derivative g' x *\<^sub>R f (g x))
                  (at x within {a..b} - s)" if "x \<in> {a<..<b} - (s)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. integral {c..g x} f) has_vector_derivative g' x *\<^sub>R f (g x)) (at x within {a..b} - s)
[PROOF STEP]
using deriv[of x] that
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..b} - s \<Longrightarrow> ((\<lambda>x. integral {c..x} f) \<circ> g has_vector_derivative g' x *\<^sub>R f (g x)) (at x within {a..b} - s)
x \<in> {a<..<b} - s

goal (1 subgoal):
 1. ((\<lambda>x. integral {c..g x} f) has_vector_derivative g' x *\<^sub>R f (g x)) (at x within {a..b} - s)
[PROOF STEP]
by (simp add: at_within_Icc_at o_def)
[PROOF STATE]
proof (state)
this:
?x \<in> {a<..<b} - s \<Longrightarrow> ((\<lambda>x. integral {c..g x} f) has_vector_derivative g' ?x *\<^sub>R f (g ?x)) (at ?x within {a..b} - s)

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
have "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (?F b - ?F a)) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {c..g b} f - integral {c..g a} f) {a..b}
[PROOF STEP]
using cont_int
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} (\<lambda>x. integral {c..g x} f)

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {c..g b} f - integral {c..g a} f) {a..b}
[PROOF STEP]
using fundamental_theorem_of_calculus_interior_stronger'[OF s le deriv]
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} (\<lambda>x. integral {c..g x} f)
\<lbrakk>\<And>x. x \<in> {a<..<b} - s \<Longrightarrow> x \<in> {a<..<b} - s; continuous_on {a..b} (\<lambda>x. integral {c..g x} f)\<rbrakk> \<Longrightarrow> ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {c..g b} f - integral {c..g a} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {c..g b} f - integral {c..g a} f) {a..b}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {c..g b} f - integral {c..g a} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {c..g b} f - integral {c..g a} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
from subset
[PROOF STATE]
proof (chain)
picking this:
g ` {a..b} \<subseteq> {c..d}
[PROOF STEP]
have "g x \<in> {c..d}" if "x \<in> {a..b}" for x
[PROOF STATE]
proof (prove)
using this:
g ` {a..b} \<subseteq> {c..d}

goal (1 subgoal):
 1. g x \<in> {c..d}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
g ` {a..b} \<subseteq> {c..d}
x \<in> {a..b}

goal (1 subgoal):
 1. g x \<in> {c..d}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> {a..b} \<Longrightarrow> g ?x \<in> {c..d}

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
from this[of a] this[of b] le
[PROOF STATE]
proof (chain)
picking this:
a \<in> {a..b} \<Longrightarrow> g a \<in> {c..d}
b \<in> {a..b} \<Longrightarrow> g b \<in> {c..d}
a \<le> b
[PROOF STEP]
have cd: "c \<le> g a" "g b \<le> d" "c \<le> g b" "g a \<le> d"
[PROOF STATE]
proof (prove)
using this:
a \<in> {a..b} \<Longrightarrow> g a \<in> {c..d}
b \<in> {a..b} \<Longrightarrow> g b \<in> {c..d}
a \<le> b

goal (1 subgoal):
 1. (c \<le> g a &&& g b \<le> d) &&& c \<le> g b &&& g a \<le> d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<le> g a
g b \<le> d
c \<le> g b
g a \<le> d

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
have "integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
 2. \<not> ?P \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
assume "g a \<le> g b"
[PROOF STATE]
proof (state)
this:
g a \<le> g b

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
 2. \<not> ?P \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
note le = le this
[PROOF STATE]
proof (state)
this:
a \<le> b
g a \<le> g b

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
 2. \<not> ?P \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
from cd
[PROOF STATE]
proof (chain)
picking this:
c \<le> g a
g b \<le> d
c \<le> g b
g a \<le> d
[PROOF STEP]
have "integral {c..g a} f + integral {g a..g b} f = integral {c..g b} f"
[PROOF STATE]
proof (prove)
using this:
c \<le> g a
g b \<le> d
c \<le> g b
g a \<le> d

goal (1 subgoal):
 1. integral {c..g a} f + integral {g a..g b} f = integral {c..g b} f
[PROOF STEP]
by (meson Henstock_Kurzweil_Integration.integral_combine atLeastatMost_subset_iff f(1) integrable_on_subinterval le(2) order_refl)
[PROOF STATE]
proof (state)
this:
integral {c..g a} f + integral {g a..g b} f = integral {c..g b} f

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
 2. \<not> ?P \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
with le
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
g a \<le> g b
integral {c..g a} f + integral {g a..g b} f = integral {c..g b} f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<le> b
g a \<le> g b
integral {c..g a} f + integral {g a..g b} f = integral {c..g b} f

goal (1 subgoal):
 1. integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
by (cases "g a = g b") (simp_all add: algebra_simps)
[PROOF STATE]
proof (state)
this:
integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f

goal (1 subgoal):
 1. \<not> g a \<le> g b \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> g a \<le> g b \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
assume less: "\<not>g a \<le> g b"
[PROOF STATE]
proof (state)
this:
\<not> g a \<le> g b

goal (1 subgoal):
 1. \<not> g a \<le> g b \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> g a \<le> g b
[PROOF STEP]
have "g a \<ge> g b"
[PROOF STATE]
proof (prove)
using this:
\<not> g a \<le> g b

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

goal (1 subgoal):
 1. \<not> g a \<le> g b \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
note le = le this
[PROOF STATE]
proof (state)
this:
a \<le> b
g b \<le> g a

goal (1 subgoal):
 1. \<not> g a \<le> g b \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
from cd
[PROOF STATE]
proof (chain)
picking this:
c \<le> g a
g b \<le> d
c \<le> g b
g a \<le> d
[PROOF STEP]
have "integral {c..g b} f + integral {g b..g a} f = integral {c..g a} f"
[PROOF STATE]
proof (prove)
using this:
c \<le> g a
g b \<le> d
c \<le> g b
g a \<le> d

goal (1 subgoal):
 1. integral {c..g b} f + integral {g b..g a} f = integral {c..g a} f
[PROOF STEP]
by (meson Henstock_Kurzweil_Integration.integral_combine atLeastatMost_subset_iff f(1) integrable_on_subinterval le(2) order_refl)
[PROOF STATE]
proof (state)
this:
integral {c..g b} f + integral {g b..g a} f = integral {c..g a} f

goal (1 subgoal):
 1. \<not> g a \<le> g b \<Longrightarrow> integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
with less
[PROOF STATE]
proof (chain)
picking this:
\<not> g a \<le> g b
integral {c..g b} f + integral {g b..g a} f = integral {c..g a} f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> g a \<le> g b
integral {c..g b} f + integral {g b..g a} f = integral {c..g a} f

goal (1 subgoal):
 1. integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f
[PROOF STEP]
by (simp_all add: algebra_simps)
[PROOF STATE]
proof (state)
this:
integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral integral {g a..g b} f - integral {g b..g a} f) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_list_rats_with_index: assumes "\<And> n d i. (n,d,i) \<in> set xs \<Longrightarrow> d > 0"
  and max: "max_list_rats_with_index xs = (nm, dm, im)"
  and "(n,d,i) \<in> set xs"
shows "rat_of_int n / of_int d \<le> of_int nm / of_int dm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(?n, ?d, ?i) \<in> set xs \<Longrightarrow> 0 < ?d
max_list_rats_with_index xs = (nm, dm, im)
(n, d, i) \<in> set xs

goal (1 subgoal):
 1. rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
proof (induct xs arbitrary: n d i rule: max_list_rats_with_index.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
case (2 n1 d1 i1 n2 d2 i2 xs n d i)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (?n, ?d, ?i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int ?n / rat_of_int ?d \<le> rat_of_int nm / rat_of_int dm
(?n, ?d, ?i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < ?d
max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im)
(n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
let ?r = "rat_of_int"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
from 2(2)
[PROOF STATE]
proof (chain)
picking this:
(?n, ?d, ?i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < ?d
[PROOF STEP]
have "d1 > 0" "d2 > 0"
[PROOF STATE]
proof (prove)
using this:
(?n, ?d, ?i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < ?d

goal (1 subgoal):
 1. 0 < d1 &&& 0 < d2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < d1
0 < d2

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
hence d: "?r d1 > 0" "?r d2 > 0"
[PROOF STATE]
proof (prove)
using this:
0 < d1
0 < d2

goal (1 subgoal):
 1. 0 < rat_of_int d1 &&& 0 < rat_of_int d2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < rat_of_int d1
0 < rat_of_int d2

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
have "(n1 * d2 \<le> n2 * d1) = (?r n1 * ?r d2 \<le> ?r n2 * ?r d1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n1 * d2 \<le> n2 * d1) = (rat_of_int n1 * rat_of_int d2 \<le> rat_of_int n2 * rat_of_int d1)
[PROOF STEP]
unfolding of_int_mult[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n1 * d2 \<le> n2 * d1) = (rat_of_int (n1 * d2) \<le> rat_of_int (n2 * d1))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(n1 * d2 \<le> n2 * d1) = (rat_of_int n1 * rat_of_int d2 \<le> rat_of_int n2 * rat_of_int d1)

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(n1 * d2 \<le> n2 * d1) = (rat_of_int n1 * rat_of_int d2 \<le> rat_of_int n2 * rat_of_int d1)

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
have "\<dots> = (?r n1 / ?r d1 \<le> ?r n2 / ?r d2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rat_of_int n1 * rat_of_int d2 \<le> rat_of_int n2 * rat_of_int d1) = (rat_of_int n1 / rat_of_int d1 \<le> rat_of_int n2 / rat_of_int d2)
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
0 < rat_of_int d1
0 < rat_of_int d2

goal (1 subgoal):
 1. (rat_of_int n1 * rat_of_int d2 \<le> rat_of_int n2 * rat_of_int d1) = (rat_of_int n1 / rat_of_int d1 \<le> rat_of_int n2 / rat_of_int d2)
[PROOF STEP]
by (smt divide_strict_right_mono leD le_less_linear mult.commute nonzero_mult_div_cancel_left
        not_less_iff_gr_or_eq times_divide_eq_right)
[PROOF STATE]
proof (state)
this:
(rat_of_int n1 * rat_of_int d2 \<le> rat_of_int n2 * rat_of_int d1) = (rat_of_int n1 / rat_of_int d1 \<le> rat_of_int n2 / rat_of_int d2)

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(n1 * d2 \<le> n2 * d1) = (rat_of_int n1 / rat_of_int d1 \<le> rat_of_int n2 / rat_of_int d2)
[PROOF STEP]
have id: "(n1 * d2 \<le> n2 * d1) = (?r n1 / ?r d1 \<le> ?r n2 / ?r d2)"
[PROOF STATE]
proof (prove)
using this:
(n1 * d2 \<le> n2 * d1) = (rat_of_int n1 / rat_of_int d1 \<le> rat_of_int n2 / rat_of_int d2)

goal (1 subgoal):
 1. (n1 * d2 \<le> n2 * d1) = (rat_of_int n1 / rat_of_int d1 \<le> rat_of_int n2 / rat_of_int d2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(n1 * d2 \<le> n2 * d1) = (rat_of_int n1 / rat_of_int d1 \<le> rat_of_int n2 / rat_of_int d2)

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
obtain n' d' i' where new: "(if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) = (n',d',i')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n' d' i'. (if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) = (n', d', i') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) = (n', d', i')

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
have nd': "(n',d',i') \<in> {(n1,d1,i1), (n2, d2, i2)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n', d', i') \<in> {(n1, d1, i1), (n2, d2, i2)}
[PROOF STEP]
using new[symmetric]
[PROOF STATE]
proof (prove)
using this:
(n', d', i') = (if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1))

goal (1 subgoal):
 1. (n', d', i') \<in> {(n1, d1, i1), (n2, d2, i2)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(n', d', i') \<in> {(n1, d1, i1), (n2, d2, i2)}

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
from 2(3)
[PROOF STATE]
proof (chain)
picking this:
max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im)
[PROOF STEP]
have res: "max_list_rats_with_index ((n',d',i') # xs) = (nm, dm, im)"
[PROOF STATE]
proof (prove)
using this:
max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im)

goal (1 subgoal):
 1. max_list_rats_with_index ((n', d', i') # xs) = (nm, dm, im)
[PROOF STEP]
using new
[PROOF STATE]
proof (prove)
using this:
max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im)
(if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) = (n', d', i')

goal (1 subgoal):
 1. max_list_rats_with_index ((n', d', i') # xs) = (nm, dm, im)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
max_list_rats_with_index ((n', d', i') # xs) = (nm, dm, im)

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
note 2 = 2[unfolded new]
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>n d i. (n, d, i) \<in> set ((n', d', i') # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n', d', i') # xs) = (nm, dm, im); (?n, ?d, ?i) \<in> set ((n', d', i') # xs)\<rbrakk> \<Longrightarrow> rat_of_int ?n / rat_of_int ?d \<le> rat_of_int nm / rat_of_int dm
(?n, ?d, ?i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < ?d
max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im)
(n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)

goal (3 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n1 d1 i1 n2 d2 i2 xs n d i. \<lbrakk>\<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs) = (nm, dm, im); (n, d, i) \<in> set ((if n1 * d2 \<le> n2 * d1 then (n2, d2, i2) else (n1, d1, i1)) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm; \<And>n d i. (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs) \<Longrightarrow> 0 < d; max_list_rats_with_index ((n1, d1, i1) # (n2, d2, i2) # xs) = (nm, dm, im); (n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 3. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
proof (cases "(n,d,i) \<in> set xs")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (n, d, i) \<in> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
(n, d, i) \<in> set xs

goal (2 subgoals):
 1. (n, d, i) \<in> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
by (rule 2(1)[of n d, OF 2(2) res], insert True nd', force+)
[PROOF STATE]
proof (state)
this:
rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm

goal (1 subgoal):
 1. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
(n, d, i) \<notin> set xs

goal (1 subgoal):
 1. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
with 2(4)
[PROOF STATE]
proof (chain)
picking this:
(n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)
(n, d, i) \<notin> set xs
[PROOF STEP]
have "n = n1 \<and> d = d1 \<or> n = n2 \<and> d = d2"
[PROOF STATE]
proof (prove)
using this:
(n, d, i) \<in> set ((n1, d1, i1) # (n2, d2, i2) # xs)
(n, d, i) \<notin> set xs

goal (1 subgoal):
 1. n = n1 \<and> d = d1 \<or> n = n2 \<and> d = d2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n = n1 \<and> d = d1 \<or> n = n2 \<and> d = d2

goal (1 subgoal):
 1. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
hence "?r n / ?r d \<le> ?r n' / ?r d'"
[PROOF STATE]
proof (prove)
using this:
n = n1 \<and> d = d1 \<or> n = n2 \<and> d = d2

goal (1 subgoal):
 1. rat_of_int n / rat_of_int d \<le> rat_of_int n' / rat_of_int d'
[PROOF STEP]
using new[unfolded id]
[PROOF STATE]
proof (prove)
using this:
n = n1 \<and> d = d1 \<or> n = n2 \<and> d = d2
(if rat_of_int n1 / rat_of_int d1 \<le> rat_of_int n2 / rat_of_int d2 then (n2, d2, i2) else (n1, d1, i1)) = (n', d', i')

goal (1 subgoal):
 1. rat_of_int n / rat_of_int d \<le> rat_of_int n' / rat_of_int d'
[PROOF STEP]
by (metis linear prod.inject)
[PROOF STATE]
proof (state)
this:
rat_of_int n / rat_of_int d \<le> rat_of_int n' / rat_of_int d'

goal (1 subgoal):
 1. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rat_of_int n / rat_of_int d \<le> rat_of_int n' / rat_of_int d'

goal (1 subgoal):
 1. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
have "?r n' / ?r d' \<le> ?r nm / ?r dm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int n' / rat_of_int d' \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
by (rule 2(1)[of n' d', OF 2(2) res], insert nd', force+)
[PROOF STATE]
proof (state)
this:
rat_of_int n' / rat_of_int d' \<le> rat_of_int nm / rat_of_int dm

goal (1 subgoal):
 1. (n, d, i) \<notin> set xs \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm

goal (1 subgoal):
 1. rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm

goal (2 subgoals):
 1. \<And>x n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [x] \<Longrightarrow> 0 < d; max_list_rats_with_index [x] = (nm, dm, im); (n, d, i) \<in> set [x]\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
 2. \<And>n d i. \<lbrakk>\<And>n d i. (n, d, i) \<in> set [] \<Longrightarrow> 0 < d; max_list_rats_with_index [] = (nm, dm, im); (n, d, i) \<in> set []\<rbrakk> \<Longrightarrow> rat_of_int n / rat_of_int d \<le> rat_of_int nm / rat_of_int dm
[PROOF STEP]
qed auto


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


[STATEMENT]
lemma times2plus:"(2::nat)*n = n + n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * n = n + n
[PROOF STEP]
by simp


[STATEMENT]
lemma val_ineq_cancel_le:
  assumes "a \<in> nonzero Q\<^sub>p"
  assumes "b \<in> carrier Q\<^sub>p"
  assumes "c \<in> carrier Q\<^sub>p"
  assumes "val (a \<otimes> b) < val (a \<otimes> c)"
  shows "val b < val c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val b < val c
[PROOF STEP]
using Qp.nonzero_closed assms(1) assms(2) assms(3) assms(4) val_mult
[PROOF STATE]
proof (prove)
using this:
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> ?a \<in> carrier Q\<^sub>p
a \<in> nonzero Q\<^sub>p
b \<in> carrier Q\<^sub>p
c \<in> carrier Q\<^sub>p
val (a \<otimes> b) < val (a \<otimes> c)
\<lbrakk>?x \<in> carrier Q\<^sub>p; ?y \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> val (?x \<otimes> ?y) = val ?x + val ?y

goal (1 subgoal):
 1. val b < val c
[PROOF STEP]
by auto


[STATEMENT]
lemma truncate_down_rat_precision:
    "truncate_down prec (real x / real y) = round_down (rat_precision prec x y) (real x / real y)"
  and truncate_up_rat_precision:
    "truncate_up prec (real x / real y) = round_up (rat_precision prec x y) (real x / real y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. truncate_down prec (real x / real y) = round_down (rat_precision prec (int x) (int y)) (real x / real y) &&& truncate_up prec (real x / real y) = round_up (rat_precision prec (int x) (int y)) (real x / real y)
[PROOF STEP]
unfolding truncate_down_def truncate_up_def rat_precision_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round_down (int prec - \<lfloor>log 2 \<bar>real x / real y\<bar>\<rfloor>) (real x / real y) = round_down (let d = bitlen (int x) - bitlen (int y) in int prec - d + (if Float \<bar>int x\<bar> 0 < Float \<bar>int y\<bar> d then 1 else 0)) (real x / real y) &&& round_up (int prec - \<lfloor>log 2 \<bar>real x / real y\<bar>\<rfloor>) (real x / real y) = round_up (let d = bitlen (int x) - bitlen (int y) in int prec - d + (if Float \<bar>int x\<bar> 0 < Float \<bar>int y\<bar> d then 1 else 0)) (real x / real y)
[PROOF STEP]
by (cases x; cases y) (auto simp: floor_log_divide_eq algebra_simps bitlen_alt_def)


[STATEMENT]
lemma square_mod_lower: "m > 0 \<Longrightarrow> (q\<^sup>2 :: nat) mod m = a \<Longrightarrow> \<exists>q' < m. q'\<^sup>2 mod m = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; q\<^sup>2 mod m = a\<rbrakk> \<Longrightarrow> \<exists>q'<m. q'\<^sup>2 mod m = a
[PROOF STEP]
using mod_less_divisor mod_mod_trivial power_mod
[PROOF STATE]
proof (prove)
using this:
0 < ?n \<Longrightarrow> ?m mod ?n < ?n
?a mod ?b mod ?b = ?a mod ?b
(?a mod ?b) ^ ?n mod ?b = ?a ^ ?n mod ?b

goal (1 subgoal):
 1. \<lbrakk>0 < m; q\<^sup>2 mod m = a\<rbrakk> \<Longrightarrow> \<exists>q'<m. q'\<^sup>2 mod m = a
[PROOF STEP]
by blast


[STATEMENT]
lemma basis_ex : "\<exists>vs. basis_for V vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>vs. set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
[PROOF STEP]
using findim basis_for_Span_ex
[PROOF STATE]
proof (prove)
using this:
\<exists>ms. set ms \<subseteq> V \<and> RSpan ms = V
set ?vs \<subseteq> V \<Longrightarrow> \<exists>us. set us \<subseteq> RSpan ?vs \<and> RSpan ?vs = RSpan us \<and> R_lin_independent us

goal (1 subgoal):
 1. \<exists>vs. set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
[PROOF STEP]
by auto


[STATEMENT]
lemma stutter_extend_edges_rtrancl[simp]: "(stutter_extend_edges V E)\<^sup>* = E\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (stutter_extend_edges V E)\<^sup>* = E\<^sup>*
[PROOF STEP]
unfolding stutter_extend_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (E \<union> {(v, v) |v. v \<in> V \<and> v \<notin> Domain E})\<^sup>* = E\<^sup>*
[PROOF STEP]
by (auto intro: in_rtrancl_UnI elim: rtrancl_induct)


[STATEMENT]
lemma OPT2_A': assumes "x \<noteq> y" "qs \<in> lang (seq [Plus (Atom x) One, Atom y, Atom y])"
  shows "real (T\<^sub>p [x,y] qs (OPT2 qs [x,y])) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (T\<^sub>p [x, y] qs (OPT2 qs [x, y])) = 1
[PROOF STEP]
using OPT2_A[OF assms]
[PROOF STATE]
proof (prove)
using this:
T\<^sub>p [x, y] qs (OPT2 qs [x, y]) = 1

goal (1 subgoal):
 1. real (T\<^sub>p [x, y] qs (OPT2 qs [x, y])) = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma closed_eucl_atLeast[simp, intro]:
  fixes a :: "'a::ordered_euclidean_space"
  shows "closed {a..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {a..}
[PROOF STEP]
by (simp add: closed_interval_right eucl_le_atLeast[symmetric])


[STATEMENT]
lemma fps_mult_var:
  "(f * g) $ n = \<Sum>{f $ (fst p) * g $ (snd p) | p. p \<in> splitset n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<cdot> g) $ n = \<Sum> {f $ fst p \<cdot> g $ snd p |p. p \<in> splitset n}
[PROOF STEP]
by (simp add: times_fps_def splitset_def)


[STATEMENT]
lemma Bernstein_reciprocal_translate:
  "reciprocal_poly p (Bernstein_Poly_01 i p) \<circ>\<^sub>p [:1, 1:] =
   monom (p choose i) (p - i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly p (Bernstein_Poly_01 i p) \<circ>\<^sub>p [:1, 1:] = monom (real (p choose i)) (p - i)
[PROOF STEP]
by (auto simp: Bernstein_reciprocal pcompose_smult pcompose_pCons monom_altdef hom_distribs)


[STATEMENT]
lemma card_grab [simp]:
  assumes "infinite N" shows "card (fst (grab N n)) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (fst (grab N n)) = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (fst (grab N n)) = n
[PROOF STEP]
have "N \<inter> enumerate N ` {..<n} = enumerate N ` {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N \<inter> enum N ` {..<n} = enum N ` {..<n}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
infinite N

goal (1 subgoal):
 1. N \<inter> enum N ` {..<n} = enum N ` {..<n}
[PROOF STEP]
by (auto simp: enumerate_in_set)
[PROOF STATE]
proof (state)
this:
N \<inter> enum N ` {..<n} = enum N ` {..<n}

goal (1 subgoal):
 1. card (fst (grab N n)) = n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
infinite N
N \<inter> enum N ` {..<n} = enum N ` {..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite N
N \<inter> enum N ` {..<n} = enum N ` {..<n}

goal (1 subgoal):
 1. card (fst (grab N n)) = n
[PROOF STEP]
by (simp add: card_image grab_def strict_mono_enum strict_mono_imp_inj_on)
[PROOF STATE]
proof (state)
this:
card (fst (grab N n)) = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma APPEND[import_const APPEND : append]:
  "(\<forall>l::'A list. [] @ l = l) \<and> (\<forall>(h::'A) t l. (h # t) @ l = h # t @ l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>l. [] @ l = l) \<and> (\<forall>h t l. (h # t) @ l = h # t @ l)
[PROOF STEP]
by simp


[STATEMENT]
lemma echelon_form_of_unit:
  fixes A::"'a::{bezout_domain_div}^'n::{mod_type}^'n::{mod_type}"
  shows "is_unit (fst (echelon_form_of_det A k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (fst (echelon_form_of_det A k))
[PROOF STEP]
unfolding echelon_form_of_det_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (fst (echelon_form_of_upt_k_det k (1::'a, A) (ncols A - 1)))
[PROOF STEP]
by (rule echelon_form_of_upt_k_det_unit)


[STATEMENT]
lemma "karatsuba_cost \<in> \<Theta>(\<lambda>n. real n powr log 2 3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. karatsuba_cost \<in> \<Theta>(\<lambda>n. real n powr log 2 3)
[PROOF STEP]
using karatsuba_cost_pos
[PROOF STATE]
proof (prove)
using this:
1 \<le> ?n \<Longrightarrow> 0 < karatsuba_cost ?n

goal (1 subgoal):
 1. karatsuba_cost \<in> \<Theta>(\<lambda>n. real n powr log 2 3)
[PROOF STEP]
by (master_theorem 1 p': 1) (auto simp add: powr_divide eventually_at_top_linorder)


[STATEMENT]
lemma (in PolynRg) pol_deg_eq_c_max:"\<lbrakk>p \<in> carrier R;
       pol_coeff S c; p = polyn_expr R X (fst c) c\<rbrakk> \<Longrightarrow>
                   deg_n R S X p = c_max S c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; pol_coeff S c; p = polyn_expr R X (fst c) c\<rbrakk> \<Longrightarrow> deg_n R S X p = c_max S c
[PROOF STEP]
apply (cut_tac subring, frule subring_Ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; pol_coeff S c; p = polyn_expr R X (fst c) c; Subring R S; Ring S\<rbrakk> \<Longrightarrow> deg_n R S X p = c_max S c
[PROOF STEP]
apply (frule polyn_c_max[of c])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; pol_coeff S c; p = polyn_expr R X (fst c) c; Subring R S; Ring S; polyn_expr R X (fst c) c = polyn_expr R X (c_max S c) c\<rbrakk> \<Longrightarrow> deg_n R S X p = c_max S c
[PROOF STEP]
apply (frule pol_SOME_2[of p])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; pol_coeff S c; p = polyn_expr R X (fst c) c; Subring R S; Ring S; polyn_expr R X (fst c) c = polyn_expr R X (c_max S c) c; pol_coeff S (SOME c. cf_sol R S X p c) \<and> p = polyn_expr R X (fst (SOME c. cf_sol R S X p c)) (SOME c. cf_sol R S X p c)\<rbrakk> \<Longrightarrow> deg_n R S X p = c_max S c
[PROOF STEP]
apply (subst deg_n_def, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; pol_coeff S c; p = polyn_expr R X (fst c) c; Subring R S; Ring S; polyn_expr R X (fst c) c = polyn_expr R X (c_max S c) c; pol_coeff S (SOME c. cf_sol R S X p c); p = polyn_expr R X (fst (SOME c. cf_sol R S X p c)) (SOME c. cf_sol R S X p c)\<rbrakk> \<Longrightarrow> c_max S (Eps (cf_sol R S X p)) = c_max S c
[PROOF STEP]
apply (rule polyn_degree_unique[of "Eps (cf_sol R S X p)" "c"], simp,
       assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; pol_coeff S c; p = polyn_expr R X (fst c) c; Subring R S; Ring S; polyn_expr R X (fst c) c = polyn_expr R X (c_max S c) c; pol_coeff S (SOME c. cf_sol R S X p c); p = polyn_expr R X (fst (SOME c. cf_sol R S X p c)) (SOME c. cf_sol R S X p c)\<rbrakk> \<Longrightarrow> polyn_expr R X (fst (Eps (cf_sol R S X p))) (Eps (cf_sol R S X p)) = polyn_expr R X (fst c) c
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Infinitesimal_add_approx_self2: "y \<in> Infinitesimal \<Longrightarrow> x \<approx> y + x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> Infinitesimal \<Longrightarrow> x \<approx> y + x
[PROOF STEP]
by (auto dest: Infinitesimal_add_approx_self simp add: add.commute)